Permalink
Browse files

Establishes a loginType property on FBSession

Summary:
The meat of the change adding a property tracking login type
the supported types are - none, system, app, web, inline web,
and test account

Test Plan: n/a

Reviewers: clang

Reviewed By: clang

CC: msdkexp@, gregschechte

Differential Revision: https://phabricator.fb.com/D583222

Task ID: 1731992
  • Loading branch information...
1 parent 2274e04 commit 28fd0a05d931247586284203dfcdec44a2dd29d4 @onebit onebit committed Sep 25, 2012
@@ -23,12 +23,14 @@
- (BOOL)transitionToState:(FBSessionState)state
andUpdateToken:(NSString*)token
andExpirationDate:(NSDate*)date
- shouldCache:(BOOL)shouldCache;
+ shouldCache:(BOOL)shouldCache
+ loginType:(FBSessionLoginType)loginType;
- (void)transitionAndCallHandlerWithState:(FBSessionState)status
error:(NSError*)error
token:(NSString*)token
expirationDate:(NSDate*)date
- shouldCache:(BOOL)shouldCache;
+ shouldCache:(BOOL)shouldCache
+ loginType:(FBSessionLoginType)loginType;
- (void)authorizeWithPermissions:(NSArray*)permissions
behavior:(FBSessionLoginBehavior)behavior
defaultAudience:(FBSessionDefaultAudience)audience
View
@@ -131,6 +131,34 @@ typedef enum {
FBSessionDefaultAudienceEveryone = 30,
} FBSessionDefaultAudience;
+/*!
+ @typedef FBSessionLoginType enum
+
+ @abstract
+ Used as the type of the loginType property in order to specify what underlying technology was used to
+ login the user.
+
+ @discussion
+ The FBSession object is an abstraction over five distinct mechanisms. This enum allows an application
+ to test for the mechanism used by a particular instance of FBSession. Usually the mechanism used for a
+ given login does not matter, however for certain capabilities, the type of login can impact the behavior
+ of other Facebook functionality.
+ */
+typedef enum {
+ /*! A login type has not yet been established */
+ FBSessionLoginTypeNone = 0,
+ /*! A system integrated account was used to log the user into the application */
+ FBSessionLoginTypeSystemAccount = 1,
+ /*! The Facebook native application was used to log the user into the application */
+ FBSessionLoginTypeFacebookApplication = 2,
+ /*! Safari was used to log the user into the application */
+ FBSessionLoginTypeFacebookViaSafari = 3,
+ /*! A web view was used to log the user into the application */
+ FBSessionLoginTypeWebView = 4,
+ /*! A test user was used to create an open session */
+ FBSessionLoginTypeTestUser = 5,
+} FBSessionLoginType;
+
/*!
@typedef
@@ -276,6 +304,9 @@ typedef void (^FBSessionReauthorizeResultHandler)(FBSession *session,
/*! @abstract The permissions granted to the access token during the authentication flow. */
@property(readonly, copy) NSArray *permissions;
+/*! @abstract Specifies the login type used to authenticate the user. */
+@property(readonly) FBSessionLoginType loginType;
+
/*!
@methodgroup Instance methods
*/
View

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -115,7 +115,7 @@ extern NSString *const FBTokenInformationUserFBIDKey;
extern NSString *const FBTokenInformationIsFacebookLoginKey;
// The key to use with token information dictionaries to determine whether the token was fetched via the OS
-extern NSString *const FBTokenInformationIsOSIntegratedFacebookLoginKey;
+extern NSString *const FBTokenInformationLoginTypeLoginKey;
// The key to use with token information dictionaries to get the latest known permissions
extern NSString *const FBTokenInformationPermissionsKey;
@@ -24,7 +24,7 @@
NSString *const FBTokenInformationRefreshDateKey = @"com.facebook.sdk:TokenInformationRefreshDateKey";
NSString *const FBTokenInformationUserFBIDKey = @"com.facebook.sdk:TokenInformationUserFBIDKey";
NSString *const FBTokenInformationIsFacebookLoginKey = @"com.facebook.sdk:TokenInformationIsFacebookLoginKey";
-NSString *const FBTokenInformationIsOSIntegratedFacebookLoginKey = @"com.facebook.sdk:TokenInformationIsOSIntegratedFacebookLoginKey";
+NSString *const FBTokenInformationLoginTypeLoginKey = @"com.facebook.sdk:TokenInformationLoginTypeLoginKey";
NSString *const FBTokenInformationPermissionsKey = @"com.facebook.sdk:TokenInformationPermissionsKey";
@implementation FBSessionTokenCachingStrategy {
View
@@ -228,7 +228,8 @@ - (void)createNewTestUser
error:error
token:nil
expirationDate:nil
- shouldCache:NO];
+ shouldCache:NO
+ loginType:FBSessionLoginTypeNone];
}
}];
}
@@ -239,7 +240,8 @@ - (void)transitionToOpenWithToken:(NSString*)token
error:nil
token:token
expirationDate:[NSDate distantFuture]
- shouldCache:NO];
+ shouldCache:NO
+ loginType:FBSessionLoginTypeTestUser];
}
// We raise exceptions when things go wrong here, because this is intended for use only
@@ -411,14 +413,15 @@ - (BOOL)transitionToState:(FBSessionState)state
andUpdateToken:(NSString*)token
andExpirationDate:(NSDate*)date
shouldCache:(BOOL)shouldCache
-{
+ loginType:(FBSessionLoginType)loginType {
// in case we need these after the transition
NSString *userID = self.testUserID;
BOOL didTransition = [super transitionToState:state
andUpdateToken:token
andExpirationDate:date
- shouldCache:shouldCache];
+ shouldCache:shouldCache
+ loginType:loginType];
if (didTransition && FB_ISSESSIONSTATETERMINAL(self.state)) {
if (self.mode == FBTestSessionModePrivate) {
@@ -348,7 +348,6 @@
0867D691FE84028FC02AAC07 /* facebook-ios-sdk */ = {
isa = PBXGroup;
children = (
- 85A928981611272D008699F1 /* Social.framework */,
08FB77AEFE84172EC02AAC07 /* FacebookSDK */,
32C88DFF0371C24200C91783 /* Other Sources */,
B9CBC54015254CAE0036AA71 /* FacebookSDKTests */,
@@ -362,6 +361,7 @@
isa = PBXGroup;
children = (
845857A116096ED000CC89E5 /* Accounts.framework */,
+ 85A928981611272D008699F1 /* Social.framework */,
B9CC137215266B9000443948 /* QuartzCore.framework */,
B9CBC53715254AC50036AA71 /* libsqlite3.dylib */,
B9CBC53115253F6D0036AA71 /* SenTestingKit.framework */,
@@ -422,6 +422,8 @@
AEA93B0711D5293B000A4545 /* FBLoginDialog.m */,
840F658B159B3A47005D41AA /* FBLoginView.h */,
840F658E159B3A64005D41AA /* FBLoginView.m */,
+ 85A9288E1611187F008699F1 /* FBNativeDialogs.h */,
+ 85A9288F1611187F008699F1 /* FBNativeDialogs.m */,
8409694B1541F41100479AD9 /* FBOpenGraphAction.h */,
84D0A6571581A1C000A2FA5E /* FBPlacePickerCacheDescriptor.h */,
84D0A6551581A1A600A2FA5E /* FBPlacePickerCacheDescriptor.m */,
@@ -448,8 +450,6 @@
DDB7C34A15A6181100C8DCE6 /* FBSettings.h */,
2A68590515C1E37E001D4EDD /* FBSettings+Internal.h */,
DDB7C34B15A6181100C8DCE6 /* FBSettings.m */,
- 85A9288E1611187F008699F1 /* FBNativeDialogs.h */,
- 85A9288F1611187F008699F1 /* FBNativeDialogs.m */,
8525A5B8156F2049009F6F3F /* FBTestSession.h */,
85F29E9315785D72001F0531 /* FBTestSession+Internal.h */,
8525A5B9156F2049009F6F3F /* FBTestSession.m */,

0 comments on commit 28fd0a0

Please sign in to comment.