Skip to content

Commit 78a40ec

Browse files
committed
Add Google SingIn & email data user identification support.
1 parent 05117d2 commit 78a40ec

File tree

3 files changed

+54
-1
lines changed

3 files changed

+54
-1
lines changed

CosmoseSDK/Headers/CosmoseSDK.h

+45-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
#import <Foundation/Foundation.h>
1010

11-
@class FBSession;
11+
@class FBSession, GPPSignIn;
1212

1313
/**
1414
`CosmoseSDK` is a main entry class of Cosmose SDK library.
@@ -58,7 +58,51 @@
5858
Either way it is possible to provide `FBSession` instance by directly calling `[FBSession activeSession]` from the app's login flow.
5959
6060
@param fbSession The instance of active and open Facebook session obtained via Facebook-iOS-SDK (see https://developers.facebook.com/docs/ios )
61+
62+
@see updateFbDataWithToken:userInfo:
6163
*/
6264
+ (void)updateFbSession:(FBSession*)fbSession;
6365

66+
/**
67+
Alternative way to update facebook related user details. Use this method instead of `updateFbSession:`) when your app doesn't utilize Facebook SDK or when incompatible version of SDK is in use.
68+
`Nil` value can be provided for each of two parameters if not available at the moment of call and can be provided later.
69+
70+
@param fbToken Facebook API token (if available)
71+
@param fbUserInfo Dictionary with user data including user fbid (if available)
72+
73+
@see updateFbSession:
74+
*/
75+
+ (void)updateFbDataWithToken:(NSString*)fbToken userInfo:(NSDictionary*)fbUserInfo;
76+
77+
/**
78+
Link user's google account to Cosmose SDK user database.
79+
If your app supports Google SignIn via Google Plus SDK use this method to provide basic user data to Cosmose SDK.
80+
This method should be called as soon as the sing in (or silent sign in) is completed. The best place to put call to this method is in `GPPSignInDelegate`'s method `finishedWithAuth:error:` when error is not `nil.
81+
To retrieve handle to active `GPPSignIn` instance you may call `[GPPSignIn sharedInstance]`
82+
83+
@param googleSignIn The active instance of `GPPSignIn` interface
84+
85+
@see updateGoogleSignInDataWithEmail:userID:
86+
*/
87+
+ (void)updateGoogleSignIn:(GPPSignIn*)googleSignIn;
88+
89+
/**
90+
Alternative way to provide basic user data info in case when app supports Google Sign In. You should use this method instead of `updateGoogleSignIn:` when `GPPSignIn` inteface is not available in your app.
91+
92+
@param googleUserEmail User's email address used for Google Sign In
93+
@param googleUserID User's google ID retireved after successfull sing in
94+
95+
@see updateGoogleSignIn:
96+
*/
97+
+ (void)updateGoogleSignInDataWithEmail:(NSString*)googleUserEmail userID:(NSString*)googleUserID;
98+
99+
/**
100+
If your app support user login via e-mail and no Facebook nor Google authentication is in use, you may call this method to link basic user's info with Cosmose SDK.
101+
102+
@param userEmail User's email address used for app sign in or retireved from user at any point during the app usage
103+
104+
@see updateGoogleSignIn: updateFbSession:
105+
*/
106+
+ (void)updateUserEmail:(NSString*)userEmail;
107+
64108
@end

CosmoseSDK/libCosmoseSDK.a

34.7 KB
Binary file not shown.

README.md

+9
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,15 @@ We assume here, that your app integrating Facebook Login is based on a official
5959

6060
1. After the successfull login or once the app detect that user is already logged in call: `[CosmoseSDK updateFbSession:]`, and pass an instance of `FBSession` that represents the active session (e.g., `[FBSession activeSession]`).
6161

62+
Please refer to `[CosmoseSDK updateFbDataWithToken:userInfo:]` method (more info in the `appledoc`) if your app is based on incompatible version of Facebook SDK or your app is not based on Facebook SDK at all but still supports Facebook Sign In.
63+
64+
## Google SignIn integration
65+
66+
If your app supports Google SignIn, you may use `[CosmoseSDK updateGoogleSignIn:]` method to provide basic user data to Cosmose SDK. If ths sign-in process is compatible with the instructions from here: https://developers.google.com/+/mobile/ios/sign-in then you may add a call to `[CosmoseSDK updateGoogleSignIn:]` directly to your apps' `GPPSignInDelegate`. Otherwise please refer to Cosmose SDK `appledoc` and method `[CosmoseSDK updateGoogleSignInDataWithEmail:userID]` in order to pass basic user info to Cosmose SDK.
67+
68+
## Alternative user identification methods
69+
70+
If your app does not incorporate Facebook or Google Sign In but still requires user to type in his or her email address (for alternative sign in process or regardless of the reason) you may provide that information to Cosmose SDK. Once user type in a email address within your app you should call `[CosmoseSDK updateUserEmail:]` passing that email address. Please refer to the `appledoc` for more information about this method.
6271

6372
# Demo App
6473

0 commit comments

Comments
 (0)