Skip to content

Commit 6d53e1a

Browse files
committed
Initial commit.
0 parents  commit 6d53e1a

22 files changed

+1179
-0
lines changed

.gitignore

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Xcode
2+
.DS_Store
3+
build/
4+
*.pbxuser
5+
!default.pbxuser
6+
*.mode1v3
7+
!default.mode1v3
8+
*.mode2v3
9+
!default.mode2v3
10+
*.perspectivev3
11+
!default.perspectivev3
12+
*.xcworkspace
13+
!default.xcworkspace
14+
xcuserdata
15+
profile
16+
*.moved-aside
17+
DerivedData
18+
Pods
19+
.idea/

CosmoseSDK.podspec

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
2+
Pod::Spec.new do |s|
3+
4+
5+
s.name = "CosmoseSDK"
6+
s.version = "0.9.1"
7+
s.summary = "iOS SDK for Cosmose app partners."
8+
9+
s.homepage = "http://cosmose.co"
10+
s.platform = :ios, '7.0'
11+
12+
s.source = { :git => "git@bitbucket.org:Cosmose/cosmose-ios-sdk-src.git" }
13+
14+
s.source_files = 'CosmoseSDK/Headers/*.h'
15+
s.preserve_paths = 'CosmoseSDK/libCosmoseSDK.a'
16+
s.vendored_libraries = 'CosmoseSDK/libCosmoseSDK.a'
17+
18+
s.requires_arc = true
19+
20+
s.frameworks = 'CoreLocation'
21+
22+
s.dependency 'AFNetworking', '~> 2.2.0'
23+
s.dependency 'EGODatabase', '~> 2.0'
24+
s.dependency 'JSONKit-NoWarning', '~> 1.1'
25+
s.dependency 'MSSpec', '~> 0.1.1'
26+
s.dependency 'Facebook-iOS-SDK', '~> 3.12.0'
27+
28+
end

CosmoseSDK/Headers/CosmoseSDK.h

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
//
2+
// CosmoseSDK.h
3+
// CosmoseSDK
4+
//
5+
// Created by Krzysztof Magiera on 11.03.2014.
6+
// Copyright (c) 2014 Cosmose. All rights reserved.
7+
//
8+
9+
#import <Foundation/Foundation.h>
10+
11+
@class FBSession;
12+
13+
@interface CosmoseSDK : NSObject
14+
15+
+ (void)start;
16+
+ (BOOL)handleOpenURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication;
17+
+ (void)updateFbSession:(FBSession*)fbSession;
18+
19+
@end

CosmoseSDK/libCosmoseSDK.a

971 KB
Binary file not shown.

CosmoseSDKDemo/CosmoseSDKDemo.xcodeproj/project.pbxproj

+531
Large diffs are not rendered by default.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="5023" systemVersion="13A603" targetRuntime="iOS.CocoaTouch.iPad" propertyAccessControl="none" useAutolayout="YES" initialViewController="BYZ-38-t0r">
3+
<dependencies>
4+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="3733"/>
5+
</dependencies>
6+
<scenes>
7+
<!--class Prefix:identifier View Controller-->
8+
<scene sceneID="tne-QT-ifu">
9+
<objects>
10+
<viewController id="BYZ-38-t0r" customClass="COSViewController" sceneMemberID="viewController">
11+
<layoutGuides>
12+
<viewControllerLayoutGuide type="top" id="y3c-jy-aDJ"/>
13+
<viewControllerLayoutGuide type="bottom" id="wfy-db-euE"/>
14+
</layoutGuides>
15+
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
16+
<rect key="frame" x="0.0" y="0.0" width="768" height="1024"/>
17+
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
18+
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
19+
</view>
20+
</viewController>
21+
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
22+
</objects>
23+
</scene>
24+
</scenes>
25+
<simulatedMetricsContainer key="defaultSimulatedMetrics">
26+
<simulatedStatusBarMetrics key="statusBar"/>
27+
<simulatedOrientationMetrics key="orientation"/>
28+
<simulatedScreenMetrics key="destination"/>
29+
</simulatedMetricsContainer>
30+
</document>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="5023" systemVersion="13A603" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" initialViewController="vXZ-lx-hvc">
3+
<dependencies>
4+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="3733"/>
5+
</dependencies>
6+
<scenes>
7+
<!--class Prefix:identifier View Controller-->
8+
<scene sceneID="ufC-wZ-h7g">
9+
<objects>
10+
<viewController id="vXZ-lx-hvc" customClass="COSViewController" sceneMemberID="viewController">
11+
<layoutGuides>
12+
<viewControllerLayoutGuide type="top" id="jyV-Pf-zRb"/>
13+
<viewControllerLayoutGuide type="bottom" id="2fi-mo-0CV"/>
14+
</layoutGuides>
15+
<view key="view" contentMode="scaleToFill" id="kh9-bI-dsS">
16+
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
17+
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
18+
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
19+
</view>
20+
</viewController>
21+
<placeholder placeholderIdentifier="IBFirstResponder" id="x5A-6p-PRh" sceneMemberID="firstResponder"/>
22+
</objects>
23+
</scene>
24+
</scenes>
25+
<simulatedMetricsContainer key="defaultSimulatedMetrics">
26+
<simulatedStatusBarMetrics key="statusBar"/>
27+
<simulatedOrientationMetrics key="orientation"/>
28+
<simulatedScreenMetrics key="destination" type="retina4"/>
29+
</simulatedMetricsContainer>
30+
</document>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
//
2+
// COSAppDelegate.h
3+
// CosmoseSDKDemo
4+
//
5+
// Created by Krzysztof Magiera on 13.03.2014.
6+
// Copyright (c) 2014 Cosmose. All rights reserved.
7+
//
8+
9+
#import <UIKit/UIKit.h>
10+
11+
@interface COSAppDelegate : UIResponder <UIApplicationDelegate>
12+
13+
@property (strong, nonatomic) UIWindow *window;
14+
15+
@end
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
//
2+
// COSAppDelegate.m
3+
// CosmoseSDKDemo
4+
//
5+
// Created by Krzysztof Magiera on 13.03.2014.
6+
// Copyright (c) 2014 Cosmose. All rights reserved.
7+
//
8+
9+
#import "COSAppDelegate.h"
10+
11+
#import <FacebookSDK/FacebookSDK.h>
12+
#import <CosmoseSDK/CosmoseSDK.h>
13+
14+
@implementation COSAppDelegate
15+
16+
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
17+
{
18+
// Launch Cosmose SDK in application:didFinishLanuchingWithOptions:
19+
[CosmoseSDK start];
20+
21+
return YES;
22+
}
23+
24+
- (void)applicationWillResignActive:(UIApplication *)application
25+
{
26+
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
27+
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
28+
}
29+
30+
- (void)applicationDidEnterBackground:(UIApplication *)application
31+
{
32+
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
33+
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
34+
}
35+
36+
- (void)applicationWillEnterForeground:(UIApplication *)application
37+
{
38+
// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
39+
}
40+
41+
- (void)applicationDidBecomeActive:(UIApplication *)application
42+
{
43+
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
44+
}
45+
46+
- (void)applicationWillTerminate:(UIApplication *)application
47+
{
48+
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
49+
}
50+
51+
#pragma mark - FB Related stuff
52+
53+
- (BOOL)application:(UIApplication *)application
54+
openURL:(NSURL *)url
55+
sourceApplication:(NSString *)sourceApplication
56+
annotation:(id)annotation {
57+
58+
// Call FBAppCall's handleOpenURL:sourceApplication to handle Facebook app responses
59+
BOOL wasHandled;
60+
61+
wasHandled = [FBAppCall handleOpenURL:url sourceApplication:sourceApplication];
62+
63+
if (!wasHandled) {
64+
wasHandled = [CosmoseSDK handleOpenURL:url sourceApplication:sourceApplication];
65+
}
66+
67+
return wasHandled;
68+
}
69+
70+
@end
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
//
2+
// COSViewController.h
3+
// CosmoseSDKDemo
4+
//
5+
// Created by Krzysztof Magiera on 13.03.2014.
6+
// Copyright (c) 2014 Cosmose. All rights reserved.
7+
//
8+
9+
#import <UIKit/UIKit.h>
10+
11+
@interface COSViewController : UIViewController
12+
13+
@end
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
//
2+
// COSViewController.m
3+
// CosmoseSDKDemo
4+
//
5+
// Created by Krzysztof Magiera on 13.03.2014.
6+
// Copyright (c) 2014 Cosmose. All rights reserved.
7+
//
8+
9+
#import "COSViewController.h"
10+
11+
#import <FacebookSDK/FacebookSDK.h>
12+
#import <CosmoseSDK/CosmoseSDK.h>
13+
14+
@interface COSViewController () <FBLoginViewDelegate>
15+
16+
@property (strong, nonatomic) FBProfilePictureView *profilePictureView;
17+
18+
@end
19+
20+
@implementation COSViewController
21+
22+
- (void)viewDidLoad
23+
{
24+
[super viewDidLoad];
25+
26+
// Create facebook login button
27+
FBLoginView *loginView = [[FBLoginView alloc] init];
28+
loginView.delegate = self;
29+
loginView.readPermissions = @[@"basic_info", @"email"];
30+
loginView.center = self.view.center;
31+
[self.view addSubview:loginView];
32+
33+
// Create profile picture view
34+
self.profilePictureView = [[FBProfilePictureView alloc] initWithFrame:CGRectMake(0, 0, 50, 50)];
35+
self.profilePictureView.center = CGPointMake(self.view.center.x, self.view.center.y - 80);
36+
[self.view addSubview:self.profilePictureView];
37+
38+
}
39+
40+
- (void)didReceiveMemoryWarning
41+
{
42+
[super didReceiveMemoryWarning];
43+
}
44+
45+
#pragma mark - FBLoginViewDelegate
46+
47+
- (void)loginViewFetchedUserInfo:(FBLoginView *)loginView user:(id<FBGraphUser>)user
48+
{
49+
self.profilePictureView.profileID = user.id;
50+
}
51+
52+
- (void)loginViewShowingLoggedInUser:(FBLoginView *)loginView
53+
{
54+
[CosmoseSDK updateFbSession:[FBSession activeSession]];
55+
}
56+
57+
- (void)loginViewShowingLoggedOutUser:(FBLoginView *)loginView
58+
{
59+
self.profilePictureView.profileID = nil;
60+
}
61+
62+
- (void)loginView:(FBLoginView *)loginView handleError:(NSError *)error
63+
{
64+
[[[UIAlertView alloc] initWithTitle:@"Facebook Login Error" message:[error localizedDescription] delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil] show];
65+
}
66+
67+
@end
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>CFBundleDevelopmentRegion</key>
6+
<string>en</string>
7+
<key>CFBundleDisplayName</key>
8+
<string>${PRODUCT_NAME}</string>
9+
<key>CFBundleExecutable</key>
10+
<string>${EXECUTABLE_NAME}</string>
11+
<key>CFBundleIdentifier</key>
12+
<string>co.cosmose.${PRODUCT_NAME:rfc1034identifier}</string>
13+
<key>CFBundleInfoDictionaryVersion</key>
14+
<string>6.0</string>
15+
<key>CFBundleName</key>
16+
<string>${PRODUCT_NAME}</string>
17+
<key>CFBundlePackageType</key>
18+
<string>APPL</string>
19+
<key>CFBundleShortVersionString</key>
20+
<string>1.0</string>
21+
<key>CFBundleSignature</key>
22+
<string>????</string>
23+
<key>CFBundleVersion</key>
24+
<string>1.0</string>
25+
<key>LSRequiresIPhoneOS</key>
26+
<true/>
27+
<key>UIMainStoryboardFile</key>
28+
<string>Main_iPhone</string>
29+
<key>UIMainStoryboardFile~ipad</key>
30+
<string>Main_iPad</string>
31+
<key>FacebookAppID</key>
32+
<string>1377798742481102</string>
33+
<key>CosmoseAppID</key>
34+
<string>2347868799823748</string>
35+
<key>FacebookDisplayName</key>
36+
<string>Cosmose SDK Demo</string>
37+
<key>CFBundleURLTypes</key>
38+
<array>
39+
<dict>
40+
<key>CFBundleURLSchemes</key>
41+
<array>
42+
<string>xcosmose15</string>
43+
<string>fb1377798742481102</string>
44+
</array>
45+
</dict>
46+
</array>
47+
<key>UIRequiredDeviceCapabilities</key>
48+
<array>
49+
<string>armv7</string>
50+
</array>
51+
<key>UISupportedInterfaceOrientations</key>
52+
<array>
53+
<string>UIInterfaceOrientationPortrait</string>
54+
</array>
55+
<key>UISupportedInterfaceOrientations~ipad</key>
56+
<array>
57+
<string>UIInterfaceOrientationPortrait</string>
58+
<string>UIInterfaceOrientationPortraitUpsideDown</string>
59+
</array>
60+
</dict>
61+
</plist>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
//
2+
// Prefix header
3+
//
4+
// The contents of this file are implicitly included at the beginning of every source file.
5+
//
6+
7+
#import <Availability.h>
8+
9+
#ifndef __IPHONE_5_0
10+
#warning "This project uses features only available in iOS SDK 5.0 and later."
11+
#endif
12+
13+
#ifdef __OBJC__
14+
#import <UIKit/UIKit.h>
15+
#import <Foundation/Foundation.h>
16+
#endif

0 commit comments

Comments
 (0)