From 684d8be689d28b63a6762739fc2737d924d042cf Mon Sep 17 00:00:00 2001 From: Rob Hudson Date: Fri, 22 Mar 2019 12:19:41 -0700 Subject: [PATCH] Deprecate system and web login behaviors (#969) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Fix carthage with Xcode 10.2 Summary: OHHTTPStubs has finally been updated for Xcode 10.2 compatibility; it’s been causing Carthage builds to fail if the Xcode 10.2 beta is used. Reviewed By: codytwinton Differential Revision: D14512664 fbshipit-source-id: 443e8c01a96678bbc9149b3bb69197eba5c7b696 * Remove System Account auth (#964) Summary: Pull Request resolved: https://github.com/facebook/facebook-objc-sdk/pull/964 The System Account login behavior has not been supported for several iOS versions and is due to be removed. Reviewed By: codytwinton, dreamolight Differential Revision: D14492788 fbshipit-source-id: 675f044df9ebdf3a62164c9a6976f2d94ca07068 * Remove FBSDKLoginBehaviorWeb Summary: WebViews no longer share cookies with Safari (and haven’t for some time), so it’s time for FBSDKLoginBehaviorWeb to go in favor of ASWebAuthenticationSession or SFAuthenticationSession. Reviewed By: codytwinton Differential Revision: D14530004 fbshipit-source-id: 20730b1d0cd65cc0c29907b2441d1933c6832ab7 * Move deprecations to separate section --- CHANGELOG.md | 6 + Cartfile.private | 2 +- Cartfile.resolved | 2 +- Carthage/Checkouts/OHHTTPStubs | 2 +- .../FBSDKCoreKit.xcodeproj/project.pbxproj | 12 - .../FBSDKGraphErrorRecoveryProcessor.m | 21 -- .../FBSDKGraphRequestConnection.m | 31 +- .../Internal/FBSDKCoreKit+Internal.h | 1 - .../FBSDKCoreKitTestUtility.h | 2 - .../FBSDKCoreKitTestUtility.m | 6 - .../FBSDKGraphRequestConnectionTests.m | 4 - .../AppLinks/FBSDKAppLinkResolverTests.m | 12 - .../FBSDKLoginKit.xcodeproj/project.pbxproj | 4 - .../FBSDKLoginKit/FBSDKLoginManager.h | 22 +- .../FBSDKLoginKit/FBSDKLoginManager.m | 264 +----------------- .../Internal/FBSDKLoginCompletion+Internal.h | 1 - .../Internal/FBSDKLoginCompletion.h | 28 -- .../Internal/FBSDKLoginCompletion.m | 83 ------ .../FBSDKLoginKit/Internal/FBSDKLoginError.h | 1 - .../FBSDKLoginKit/Internal/FBSDKLoginError.m | 31 -- .../Internal/FBSDKLoginManager+Internal.h | 24 -- .../Internal/FBSDKLoginManagerLogger.h | 2 - .../Internal/FBSDKLoginManagerLogger.m | 18 -- 23 files changed, 21 insertions(+), 558 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4a72a6029c..519ebf178e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,6 +30,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), - Collections/Dictionaries became non null when at all possible - Class creation methods become Swift inits +### Deprecated + +- `FBSDKLoginBehaviorSystemAccount` +- `FBSDKLoginBehaviorWeb` +- `[FBSDKLoginManager renewSystemCredentials] ` + ### Removed - Deprecated methods diff --git a/Cartfile.private b/Cartfile.private index bb0c02cf51..8cd41adad3 100644 --- a/Cartfile.private +++ b/Cartfile.private @@ -1,4 +1,4 @@ -github "AliSoftware/OHHTTPStubs" "826a9217fcd468220d154ed0075cbc1a20d0c5c9" +github "AliSoftware/OHHTTPStubs" "543182991a0d59db81f5b835a40901a9a386847d" github "facebook/Tweaks" "858506f594462073a1dee82a4c8254e23d10aef0" github "erikdoe/ocmock" "c4be5d9d9238fcd10449424f651fba2b7aff87c0" github "facebook/xctool" "fe6fb5dfab112cfbb0a2fbda1f6a528abbe0d272" diff --git a/Cartfile.resolved b/Cartfile.resolved index 998c472673..c7bd2143b8 100644 --- a/Cartfile.resolved +++ b/Cartfile.resolved @@ -1,4 +1,4 @@ -github "AliSoftware/OHHTTPStubs" "826a9217fcd468220d154ed0075cbc1a20d0c5c9" +github "AliSoftware/OHHTTPStubs" "543182991a0d59db81f5b835a40901a9a386847d" github "BoltsFramework/Bolts-ObjC" "1b247a7047546e9eecd36387a121977b53e2ea43" github "erikdoe/ocmock" "c4be5d9d9238fcd10449424f651fba2b7aff87c0" github "facebook/Tweaks" "858506f594462073a1dee82a4c8254e23d10aef0" diff --git a/Carthage/Checkouts/OHHTTPStubs b/Carthage/Checkouts/OHHTTPStubs index 826a9217fc..543182991a 160000 --- a/Carthage/Checkouts/OHHTTPStubs +++ b/Carthage/Checkouts/OHHTTPStubs @@ -1 +1 @@ -Subproject commit 826a9217fcd468220d154ed0075cbc1a20d0c5c9 +Subproject commit 543182991a0d59db81f5b835a40901a9a386847d diff --git a/FBSDKCoreKit/FBSDKCoreKit.xcodeproj/project.pbxproj b/FBSDKCoreKit/FBSDKCoreKit.xcodeproj/project.pbxproj index 0d57e030e7..c7ab93503f 100644 --- a/FBSDKCoreKit/FBSDKCoreKit.xcodeproj/project.pbxproj +++ b/FBSDKCoreKit/FBSDKCoreKit.xcodeproj/project.pbxproj @@ -226,7 +226,6 @@ 814AC8501D1B528900D61E6C /* FBSDKLogo.h in Headers */ = {isa = PBXBuildFile; fileRef = 893F44931A6444DF001DB0B6 /* FBSDKLogo.h */; }; 814AC8511D1B528900D61E6C /* FBSDKGraphRequestMetadata.h in Headers */ = {isa = PBXBuildFile; fileRef = 9DF2A3FD1A70572B00DFB2FD /* FBSDKGraphRequestMetadata.h */; }; 814AC8521D1B528900D61E6C /* FBSDKPaymentObserver.h in Headers */ = {isa = PBXBuildFile; fileRef = 9D0BC14A1A8D236200BE8BA4 /* FBSDKPaymentObserver.h */; }; - 81B71D001D19C87400933E93 /* FBSDKSystemAccountStoreAdapter.m in Sources */ = {isa = PBXBuildFile; fileRef = 9DD696ED1AAADE4000838AF2 /* FBSDKSystemAccountStoreAdapter.m */; }; 81B71D011D19C87400933E93 /* FBSDKGraphRequestPiggybackManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 9DA81B281AA65FA200B9FE0B /* FBSDKGraphRequestPiggybackManager.m */; }; 81B71D021D19C87400933E93 /* FBSDKAppEventsStateManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 9D0BC15E1A8D428700BE8BA4 /* FBSDKAppEventsStateManager.m */; }; 81B71D031D19C87400933E93 /* FBSDKServerConfigurationManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 89830F2A1A7805D100226ABB /* FBSDKServerConfigurationManager.m */; }; @@ -306,7 +305,6 @@ 81B71D531D19C87400933E93 /* FBSDKGraphErrorRecoveryProcessor.h in Headers */ = {isa = PBXBuildFile; fileRef = 9DD50A3A1A9BBA1B0088AAAA /* FBSDKGraphErrorRecoveryProcessor.h */; settings = {ATTRIBUTES = (Public, ); }; }; 81B71D541D19C87400933E93 /* FBSDKMacros.h in Headers */ = {isa = PBXBuildFile; fileRef = 9D30292A1A65E6680086B9ED /* FBSDKMacros.h */; settings = {ATTRIBUTES = (Public, ); }; }; 81B71D551D19C87400933E93 /* FBSDKBase64.h in Headers */ = {isa = PBXBuildFile; fileRef = 894C0B0F1A7021F8009137EF /* FBSDKBase64.h */; }; - 81B71D561D19C87400933E93 /* FBSDKSystemAccountStoreAdapter.h in Headers */ = {isa = PBXBuildFile; fileRef = 9DD696EC1AAADE4000838AF2 /* FBSDKSystemAccountStoreAdapter.h */; }; 81B71D571D19C87400933E93 /* FBSDKAppEventsUtility.h in Headers */ = {isa = PBXBuildFile; fileRef = 9D0BC1591A8D427800BE8BA4 /* FBSDKAppEventsUtility.h */; }; 81B71D581D19C87400933E93 /* FBSDKAppEvents+Internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 9D0BC1531A8D23DB00BE8BA4 /* FBSDKAppEvents+Internal.h */; }; 81B71D591D19C87400933E93 /* FBSDKErrorConfiguration.h in Headers */ = {isa = PBXBuildFile; fileRef = 9D3AF44E1A9EA4BE00EEF724 /* FBSDKErrorConfiguration.h */; }; @@ -633,8 +631,6 @@ 9DD3FEE11D62454D00D35472 /* FBSDKURLSessionTask.m in Sources */ = {isa = PBXBuildFile; fileRef = EA4CF23E1D344BFC007AA2EB /* FBSDKURLSessionTask.m */; }; 9DD50A3C1A9BBA1B0088AAAA /* FBSDKGraphErrorRecoveryProcessor.h in Headers */ = {isa = PBXBuildFile; fileRef = 9DD50A3A1A9BBA1B0088AAAA /* FBSDKGraphErrorRecoveryProcessor.h */; settings = {ATTRIBUTES = (Public, ); }; }; 9DD50A3D1A9BBA1B0088AAAA /* FBSDKGraphErrorRecoveryProcessor.m in Sources */ = {isa = PBXBuildFile; fileRef = 9DD50A3B1A9BBA1B0088AAAA /* FBSDKGraphErrorRecoveryProcessor.m */; }; - 9DD696EE1AAADE4000838AF2 /* FBSDKSystemAccountStoreAdapter.h in Headers */ = {isa = PBXBuildFile; fileRef = 9DD696EC1AAADE4000838AF2 /* FBSDKSystemAccountStoreAdapter.h */; }; - 9DD696EF1AAADE4000838AF2 /* FBSDKSystemAccountStoreAdapter.m in Sources */ = {isa = PBXBuildFile; fileRef = 9DD696ED1AAADE4000838AF2 /* FBSDKSystemAccountStoreAdapter.m */; }; 9DDC11281BEC412C00A88306 /* FBSDKIcon.m in Sources */ = {isa = PBXBuildFile; fileRef = 891687D11AB33CA200F55364 /* FBSDKIcon.m */; }; 9DDC11291BEC413000A88306 /* FBSDKIcon.h in Headers */ = {isa = PBXBuildFile; fileRef = 891687D01AB33CA200F55364 /* FBSDKIcon.h */; }; 9DDC112A1BEC413900A88306 /* FBSDKLogo.m in Sources */ = {isa = PBXBuildFile; fileRef = 893F44941A6444DF001DB0B6 /* FBSDKLogo.m */; }; @@ -1194,8 +1190,6 @@ 9DC658A11A6EE7E200B85AAF /* FBSDKGraphRequestBody.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FBSDKGraphRequestBody.m; sourceTree = ""; }; 9DD50A3A1A9BBA1B0088AAAA /* FBSDKGraphErrorRecoveryProcessor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FBSDKGraphErrorRecoveryProcessor.h; sourceTree = ""; }; 9DD50A3B1A9BBA1B0088AAAA /* FBSDKGraphErrorRecoveryProcessor.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FBSDKGraphErrorRecoveryProcessor.m; sourceTree = ""; }; - 9DD696EC1AAADE4000838AF2 /* FBSDKSystemAccountStoreAdapter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FBSDKSystemAccountStoreAdapter.h; sourceTree = ""; }; - 9DD696ED1AAADE4000838AF2 /* FBSDKSystemAccountStoreAdapter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FBSDKSystemAccountStoreAdapter.m; sourceTree = ""; }; 9DE1F3BF1A89C57A00B54D98 /* FBSDKAccessTokenCacheV3.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FBSDKAccessTokenCacheV3.h; sourceTree = ""; }; 9DE1F3C01A89C57A00B54D98 /* FBSDKAccessTokenCacheV3.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FBSDKAccessTokenCacheV3.m; sourceTree = ""; }; 9DE1F3C31A89C9BE00B54D98 /* FBSDKAccessTokenCacheV3_17.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FBSDKAccessTokenCacheV3_17.h; sourceTree = ""; }; @@ -1465,8 +1459,6 @@ ADEA17721B7ECA1A0070EDC0 /* FBSDKMonotonicTime.m */, 9DE6C46D1AAF6E2800EC4C99 /* FBSDKProfile+Internal.h */, 9DA830421A699A2200770955 /* FBSDKSettings+Internal.h */, - 9DD696EC1AAADE4000838AF2 /* FBSDKSystemAccountStoreAdapter.h */, - 9DD696ED1AAADE4000838AF2 /* FBSDKSystemAccountStoreAdapter.m */, 89D05A931AA0E89B00609300 /* FBSDKTriStateBOOL.h */, 89D05A941AA0E89B00609300 /* FBSDKTriStateBOOL.m */, C5696FA1209CCEB3009C931F /* FBSDKSwizzler.h */, @@ -2059,7 +2051,6 @@ 81B71D541D19C87400933E93 /* FBSDKMacros.h in Headers */, 52963A89215992F400C7B252 /* FBSDKAppLinkReturnToRefererController.h in Headers */, 81B71D551D19C87400933E93 /* FBSDKBase64.h in Headers */, - 81B71D561D19C87400933E93 /* FBSDKSystemAccountStoreAdapter.h in Headers */, 81B71D571D19C87400933E93 /* FBSDKAppEventsUtility.h in Headers */, 81B71D581D19C87400933E93 /* FBSDKAppEvents+Internal.h in Headers */, 9D28F1941DB14DBB0057D709 /* FBSDKImageDownloader.h in Headers */, @@ -2175,7 +2166,6 @@ 9DD50A3C1A9BBA1B0088AAAA /* FBSDKGraphErrorRecoveryProcessor.h in Headers */, 9D30292B1A65E6680086B9ED /* FBSDKMacros.h in Headers */, 894C0B111A7021F8009137EF /* FBSDKBase64.h in Headers */, - 9DD696EE1AAADE4000838AF2 /* FBSDKSystemAccountStoreAdapter.h in Headers */, 9D0BC15B1A8D427800BE8BA4 /* FBSDKAppEventsUtility.h in Headers */, 9D0BC1541A8D23DB00BE8BA4 /* FBSDKAppEvents+Internal.h in Headers */, 9D28F1931DB14DBB0057D709 /* FBSDKImageDownloader.h in Headers */, @@ -2839,7 +2829,6 @@ buildActionMask = 2147483647; files = ( EA8D50491D356BDC00622F03 /* FBSDKURLSessionTask.m in Sources */, - 81B71D001D19C87400933E93 /* FBSDKSystemAccountStoreAdapter.m in Sources */, 81B71D011D19C87400933E93 /* FBSDKGraphRequestPiggybackManager.m in Sources */, 81B71D021D19C87400933E93 /* FBSDKAppEventsStateManager.m in Sources */, 81B71D031D19C87400933E93 /* FBSDKServerConfigurationManager.m in Sources */, @@ -2935,7 +2924,6 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 9DD696EF1AAADE4000838AF2 /* FBSDKSystemAccountStoreAdapter.m in Sources */, 9DA81B2A1AA65FA200B9FE0B /* FBSDKGraphRequestPiggybackManager.m in Sources */, 9D0BC1601A8D428700BE8BA4 /* FBSDKAppEventsStateManager.m in Sources */, 89830F2C1A7805D100226ABB /* FBSDKServerConfigurationManager.m in Sources */, diff --git a/FBSDKCoreKit/FBSDKCoreKit/FBSDKGraphErrorRecoveryProcessor.m b/FBSDKCoreKit/FBSDKCoreKit/FBSDKGraphErrorRecoveryProcessor.m index bd21cecde8..15ddc52ad2 100644 --- a/FBSDKCoreKit/FBSDKCoreKit/FBSDKGraphErrorRecoveryProcessor.m +++ b/FBSDKCoreKit/FBSDKCoreKit/FBSDKGraphErrorRecoveryProcessor.m @@ -55,7 +55,6 @@ - (BOOL)processError:(NSError *)error request:(FBSDKGraphRequest *)request deleg case FBSDKGraphRequestErrorRecoverable : if ([request.tokenString isEqualToString:[FBSDKAccessToken currentAccessToken].tokenString]) { _recoveryAttempter = error.recoveryAttempter; - BOOL isLoginRecoveryAttempter = [_recoveryAttempter isKindOfClass:NSClassFromString(@"_FBSDKLoginRecoveryAttempter")]; // Set up a block to do the typical recovery work so that we can chain it for ios auth special cases. // the block returns YES if recovery UI is started (meaning we wait for the alertviewdelegate to resume control flow). @@ -72,26 +71,6 @@ - (BOOL)processError:(NSError *)error request:(FBSDKGraphRequest *)request deleg return NO; }; - if ([request.tokenString isEqualToString:[FBSDKSystemAccountStoreAdapter sharedInstance].accessTokenString] && - isLoginRecoveryAttempter) { - // special system auth case: if user has granted permissions we can simply renew. On a successful - // renew, treat this as immediately recovered without the standard alert prompty. - // (for example, this can repair expired tokens seamlessly) - [[FBSDKSystemAccountStoreAdapter sharedInstance] - renewSystemAuthorization:^(ACAccountCredentialRenewResult result, NSError *renewError) { - dispatch_async(dispatch_get_main_queue(), ^{ - if (result == ACAccountCredentialRenewResultRenewed) { - [self.delegate processorDidAttemptRecovery:self didRecover:YES error:nil]; - self.delegate = nil; - } else if (!standardRecoveryWork()) { - [self.delegate processorDidAttemptRecovery:self didRecover:NO error:self->_error]; - }; - }); - }]; - // short-circuit YES so that the renew callback resumes the control flow. - return YES; - } - return standardRecoveryWork(); } return NO; diff --git a/FBSDKCoreKit/FBSDKCoreKit/FBSDKGraphRequestConnection.m b/FBSDKCoreKit/FBSDKCoreKit/FBSDKGraphRequestConnection.m index 990be5f440..57a6fb9b83 100644 --- a/FBSDKCoreKit/FBSDKCoreKit/FBSDKGraphRequestConnection.m +++ b/FBSDKCoreKit/FBSDKCoreKit/FBSDKGraphRequestConnection.m @@ -793,43 +793,14 @@ - (void)processResultBody:(NSDictionary *)body error:(NSError *)error metadata:( }; - FBSDKSystemAccountStoreAdapter *adapter = [FBSDKSystemAccountStoreAdapter sharedInstance]; NSString *metadataTokenString = metadata.request.tokenString; NSString *currentTokenString = [FBSDKAccessToken currentAccessToken].tokenString; - NSString *accountStoreTokenString = adapter.accessTokenString; - BOOL isAccountStoreLogin = [metadataTokenString isEqualToString:accountStoreTokenString]; - if ([metadataTokenString isEqualToString:currentTokenString] || isAccountStoreLogin) { + if ([metadataTokenString isEqualToString:currentTokenString]) { NSInteger errorCode = [error.userInfo[FBSDKGraphRequestErrorGraphErrorCodeKey] integerValue]; NSInteger errorSubcode = [error.userInfo[FBSDKGraphRequestErrorGraphErrorSubcodeKey] integerValue]; if (errorCode == 190 || errorCode == 102) { - if (isAccountStoreLogin) { - if (errorSubcode == 460) { - // For iOS6, when the password is changed on the server, the system account store - // will continue to issue the old token until the user has changed the - // password AND _THEN_ a renew call is made. To prevent opening - // with an old token which would immediately be closed, we tell our adapter - // that we want to force a blocking renew until success. - adapter.forceBlockingRenew = YES; - } else { - [adapter renewSystemAuthorization:^(ACAccountCredentialRenewResult result, NSError *renewError) { - NSOperationQueue *queue = self->_delegateQueue ?: [NSOperationQueue mainQueue]; - [queue addOperationWithBlock:^{ - clearToken(errorSubcode); - finishAndInvokeCompletionHandler(); - }]; - }]; - return; - } - } clearToken(errorSubcode); - } else if (errorCode >= 200 && errorCode < 300) { - // permission error - [adapter renewSystemAuthorization:^(ACAccountCredentialRenewResult result, NSError *renewError) { - NSOperationQueue *queue = self->_delegateQueue ?: [NSOperationQueue mainQueue]; - [queue addOperationWithBlock:finishAndInvokeCompletionHandler]; - }]; - return; } } #endif diff --git a/FBSDKCoreKit/FBSDKCoreKit/Internal/FBSDKCoreKit+Internal.h b/FBSDKCoreKit/FBSDKCoreKit/Internal/FBSDKCoreKit+Internal.h index 2dfc683a4f..90677e792e 100644 --- a/FBSDKCoreKit/FBSDKCoreKit/Internal/FBSDKCoreKit+Internal.h +++ b/FBSDKCoreKit/FBSDKCoreKit/Internal/FBSDKCoreKit+Internal.h @@ -29,7 +29,6 @@ #import "FBSDKContainerViewController.h" #import "BridgeAPI/FBSDKBridgeAPI.h" #import "FBSDKMonotonicTime.h" -#import "FBSDKSystemAccountStoreAdapter.h" #import "FBSDKTriStateBOOL.h" #import "UI/FBSDKCloseIcon.h" #import "UI/FBSDKColor.h" diff --git a/FBSDKCoreKit/FBSDKCoreKitTests/FBSDKCoreKitTestUtility.h b/FBSDKCoreKit/FBSDKCoreKitTests/FBSDKCoreKitTestUtility.h index 6de7ada783..b679315ad0 100644 --- a/FBSDKCoreKit/FBSDKCoreKitTests/FBSDKCoreKitTestUtility.h +++ b/FBSDKCoreKit/FBSDKCoreKitTests/FBSDKCoreKitTestUtility.h @@ -26,6 +26,4 @@ */ + (id)mainBundleMock; -+ (id)mockAccountStoreAdapter; - @end diff --git a/FBSDKCoreKit/FBSDKCoreKitTests/FBSDKCoreKitTestUtility.m b/FBSDKCoreKit/FBSDKCoreKitTests/FBSDKCoreKitTestUtility.m index 8bd66c575d..f3b156f6f4 100644 --- a/FBSDKCoreKit/FBSDKCoreKitTests/FBSDKCoreKitTestUtility.m +++ b/FBSDKCoreKit/FBSDKCoreKitTests/FBSDKCoreKitTestUtility.m @@ -34,10 +34,4 @@ + (id)mainBundleMock return mockNSBundle; } -+ (id)mockAccountStoreAdapter -{ - id mockAccountStoreAdapter = [OCMockObject partialMockForObject:[FBSDKSystemAccountStoreAdapter sharedInstance]]; - [[[mockAccountStoreAdapter stub]andReturn:nil] accessTokenString]; - return mockAccountStoreAdapter; -} @end diff --git a/FBSDKCoreKit/FBSDKCoreKitTests/FBSDKGraphRequestConnectionTests.m b/FBSDKCoreKit/FBSDKCoreKitTests/FBSDKGraphRequestConnectionTests.m index 02ecc3f8e7..68bbbddb66 100644 --- a/FBSDKCoreKit/FBSDKCoreKitTests/FBSDKGraphRequestConnectionTests.m +++ b/FBSDKCoreKit/FBSDKCoreKitTests/FBSDKGraphRequestConnectionTests.m @@ -35,7 +35,6 @@ @interface FBSDKGraphRequestConnectionTests : XCTestCase #import #import @class FBSDKLoginManagerLoginResult; +typedef NSInteger ACAccountCredentialRenewResult; /** Describes the call back to the FBSDKLoginManager @@ -80,20 +80,8 @@ typedef NS_ENUM(NSUInteger, FBSDKLoginBehavior) Attempts log in through the Safari or SFSafariViewController, if available. */ FBSDKLoginBehaviorBrowser, - /** - Attempts log in through the Facebook account currently signed in through - the device Settings. - @note If the account is not available to the app (either not configured by user or - as determined by the SDK) this behavior falls back to \c FBSDKLoginBehaviorNative. - */ - FBSDKLoginBehaviorSystemAccount, - /** - Attempts log in through a modal \c UIWebView pop up - - @note This behavior is only available to certain types of apps. Please check the Facebook - Platform Policy to verify your app meets the restrictions. - */ - FBSDKLoginBehaviorWeb, + FBSDKLoginBehaviorSystemAccount __deprecated_enum_msg("Use FBSDKLoginBehaviorBrowser.") = FBSDKLoginBehaviorBrowser, + FBSDKLoginBehaviorWeb __deprecated_enum_msg("Use FBSDKLoginBehaviorBrowser.") = FBSDKLoginBehaviorBrowser, }; /** @@ -209,7 +197,7 @@ DEPRECATED_MSG_ATTRIBUTE("use logInWithPublishPermissions:fromViewController:han /** @method - Issues an asynchronous renewCredentialsForAccount call to the device's Facebook account store. + Issues an asynchronous renewCredentialsForAccount call to the device's Facebook account store. @param handler The completion handler to call when the renewal is completed. This can be invoked on an arbitrary thread. @@ -222,6 +210,6 @@ DEPRECATED_MSG_ATTRIBUTE("use logInWithPublishPermissions:fromViewController:han If the `[FBSDKAccessToken currentAccessToken]` was from the account store, a succesful renewal will also set a new "currentAccessToken". */ -+ (void)renewSystemCredentials:(void (^)(ACAccountCredentialRenewResult result, NSError *error))handler; ++ (void)renewSystemCredentials:(void (^)(ACAccountCredentialRenewResult result, NSError *error))handler DEPRECATED_MSG_ATTRIBUTE("The system account login behavior is no longer supported."); @end diff --git a/FBSDKLoginKit/FBSDKLoginKit/FBSDKLoginManager.m b/FBSDKLoginKit/FBSDKLoginKit/FBSDKLoginManager.m index 0acccca8a1..23559f05b0 100644 --- a/FBSDKLoginKit/FBSDKLoginKit/FBSDKLoginManager.m +++ b/FBSDKLoginKit/FBSDKLoginKit/FBSDKLoginManager.m @@ -139,15 +139,9 @@ - (void)logOut + (void)renewSystemCredentials:(void (^)(ACAccountCredentialRenewResult result, NSError *error))handler { - FBSDKSystemAccountStoreAdapter *adapter = [FBSDKSystemAccountStoreAdapter sharedInstance]; - - if (!adapter.accountType) { - handler(ACAccountCredentialRenewResultFailed, [NSError fbErrorForFailedLoginWithCode:FBSDKLoginErrorSystemAccountUnavailable]); - } else if (!adapter.accountType.accessGranted) { - handler(ACAccountCredentialRenewResultFailed, [NSError fbErrorForFailedLoginWithCode:FBSDKLoginErrorSystemAccountAppDisabled]); - } else { - [[FBSDKSystemAccountStoreAdapter sharedInstance] renewSystemAuthorization:handler]; - } + ACAccountCredentialRenewResult failed = 2; // ACAccountCredentialRenewResultFailed + NSError *error = [NSError fbErrorForFailedLoginWithCode:FBSDKLoginErrorSystemAccountUnavailable]; + handler(failed, error); } #pragma mark - Private @@ -279,17 +273,9 @@ - (void)completeAuthentication:(FBSDKLoginCompletionParameters *)parameters expe if (cancelled || recentlyGrantedPermissions.count == 0) { NSSet *declinedPermissions = nil; if ([FBSDKAccessToken currentAccessToken] != nil) { - if (parameters.isSystemAccount) { - // If a System Account reauthorization was cancelled by the user tapping Don't Allow - // then add the declined permissions to the login result. The Accounts framework - // doesn't register the decline with Facebook, which is why we don't update the - // access token. - declinedPermissions = parameters.declinedPermissions; - } else { - // Always include the list of declined permissions from this login request - // if an access token is already cached by the SDK - declinedPermissions = recentlyDeclinedPermissions; - } + // Always include the list of declined permissions from this login request + // if an access token is already cached by the SDK + declinedPermissions = recentlyDeclinedPermissions; } result = [[FBSDKLoginManagerLoginResult alloc] initWithToken:nil @@ -466,20 +452,6 @@ - (void)logInWithBehavior:(FBSDKLoginBehavior)loginBehavior }]; break; } - case FBSDKLoginBehaviorSystemAccount: { - if (serverConfiguration.isSystemAuthenticationEnabled) { - [self beginSystemLogIn]; - } else { - [self logInWithBehavior:FBSDKLoginBehaviorNative]; - } - completion(YES, FBSDKLoginManagerLoggerAuthMethod_System, nil); - break; - } - case FBSDKLoginBehaviorWeb: - [self performWebLogInWithParameters:loginParams handler:^(BOOL openedURL, NSError *openedURLError) { - completion(openedURL, FBSDKLoginManagerLoggerAuthMethod_Webview, openedURLError); - }]; - break; } } @@ -659,227 +631,3 @@ - (BOOL)isAuthenticationURL:(NSURL *)url } @end - -@implementation FBSDKLoginManager (Accounts) - -- (void)beginSystemLogIn -{ - // First, we need to validate the current access token. The user may have uninstalled the - // app, changed their password, etc., or the access token may have expired, which - // requires us to renew the account before asking for additional permissions. - NSString *accessTokenString = [FBSDKSystemAccountStoreAdapter sharedInstance].accessTokenString; - if (accessTokenString.length > 0) { - FBSDKGraphRequest *meRequest = [[FBSDKGraphRequest alloc] initWithGraphPath:@"me" - parameters:@{ @"fields" : @"id" } - tokenString:accessTokenString - HTTPMethod:nil - flags:FBSDKGraphRequestFlagDoNotInvalidateTokenOnError | FBSDKGraphRequestFlagDisableErrorRecovery]; - [meRequest startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) { - if (!error) { - // If there was no error, make an explicit renewal call anyway to cover cases where user has revoked some read permission like email. - // Otherwise, iOS system account may continue to think email was granted and never prompt UI again. - [[FBSDKSystemAccountStoreAdapter sharedInstance] renewSystemAuthorization:^(ACAccountCredentialRenewResult renewResult, NSError *renewError) { - dispatch_async(dispatch_get_main_queue(), ^{ - [self performSystemLogIn]; - }); - }]; - } else { - // If there was an error, FBSDKGraphRequestConnection would have already done work already (like renewal calls) - [self performSystemLogIn]; - } - }]; - } else { - [self performSystemLogIn]; - } -} - -- (void)performSystemLogIn -{ - if (![FBSDKSystemAccountStoreAdapter sharedInstance].accountType) { - // There is no Facebook system account type. Fallback to Native behavior - [self fallbackToNativeBehavior]; - return; - } - BOOL isReauthorize = [FBSDKAccessToken currentAccessToken] != nil; - - // app may be asking for nothing, but we will always have a set here - NSMutableSet *permissionsToUse = _requestedPermissions ? [_requestedPermissions mutableCopy] : [NSMutableSet set]; - // Only add basic info if this is not reauthorize case, if it is the app should already have basic info ToSed - if (!isReauthorize) { - // Ensure that basic info is among the permissions requested so that the app will install if necessary. - // "email" is used as a proxy for basic_info permission. - [permissionsToUse addObject:@"email"]; - } - - [permissionsToUse removeObject:@"public_profile"]; - [permissionsToUse removeObject:@"user_friends"]; - - NSString *audience; - switch (self.defaultAudience) { - case FBSDKDefaultAudienceOnlyMe: - audience = fbsdkdfl_ACFacebookAudienceOnlyMe(); - break; - case FBSDKDefaultAudienceFriends: - audience = fbsdkdfl_ACFacebookAudienceFriends(); - break; - case FBSDKDefaultAudienceEveryone: - audience = fbsdkdfl_ACFacebookAudienceEveryone(); - break; - default: - audience = nil; - } - - uint64_t timePriorToSystemAuthUI = [FBSDKInternalUtility currentTimeInMilliseconds]; - - // the FBSDKSystemAccountStoreAdapter completion handler maintains the strong reference during the the asynchronous operation - [[FBSDKSystemAccountStoreAdapter sharedInstance] - requestAccessToFacebookAccountStore:permissionsToUse - defaultAudience:audience - isReauthorize:isReauthorize - appID:[FBSDKSettings appID] - handler:^(NSString *oauthToken, NSError *accountStoreError) { - - // There doesn't appear to be a reliable way to determine whether UI was shown or - // whether the cached token was sufficient. So we use a timer heuristic assuming that - // human response time couldn't complete a dialog in under the interval given here, but - // the process will return here fast enough if the token is cached. The threshold was - // chosen empirically, so there may be some edge cases that are false negatives or - // false positives. - BOOL didShowDialog = [FBSDKInternalUtility currentTimeInMilliseconds] - timePriorToSystemAuthUI > 350; - BOOL isUnTOSedDevice = !oauthToken && accountStoreError.code == ACErrorAccountNotFound; - [self->_logger systemAuthDidShowDialog:didShowDialog isUnTOSedDevice:isUnTOSedDevice]; - - if (accountStoreError && [FBSDKSystemAccountStoreAdapter sharedInstance].forceBlockingRenew) { - accountStoreError = [NSError fbErrorForSystemPasswordChange:accountStoreError]; - } - if (!oauthToken && !accountStoreError) { - // This means iOS did not give an error nor granted, even after a renew. In order to - // surface this to users, stuff in our own error that can be inspected. - accountStoreError = [NSError fbErrorForFailedLoginWithCode:FBSDKLoginErrorSystemAccountAppDisabled]; - } - - FBSDKLoginManagerSystemAccountState *state = [[FBSDKLoginManagerSystemAccountState alloc] init]; - state.didShowDialog = didShowDialog; - state.reauthorize = isReauthorize; - state.unTOSedDevice = isUnTOSedDevice; - - [self continueSystemLogInWithTokenString:oauthToken error:accountStoreError state:state]; - }]; -} - -- (void)continueSystemLogInWithTokenString:(NSString *)oauthToken error:(NSError *)accountStoreError state:(FBSDKLoginManagerSystemAccountState *)state -{ - id completer = nil; - - if (!oauthToken && accountStoreError.code == ACErrorAccountNotFound) { - // Even with the Accounts framework we use the Facebook app or Safari to log in if - // the user has not signed in. This condition can only be detected by attempting to - // log in because the framework does not otherwise indicate whether a Facebook account - // exists on the device unless the user has granted the app permissions. - - // Do this asynchronously so the logger correctly notes the system account was skipped - dispatch_async(dispatch_get_main_queue(), ^{ - [self fallbackToNativeBehavior]; - }); - } else if (oauthToken) { - completer = [[FBSDKLoginSystemAccountCompleter alloc] initWithTokenString:oauthToken appID:[FBSDKSettings appID]]; - } else { - completer = [[FBSDKLoginSystemAccountErrorCompleter alloc] initWithError:accountStoreError permissions:_requestedPermissions]; - } - - // any necessary strong reference is maintained by the FBSDKLoginSystemAccount[Error]Completer handler - [completer completeLogIn:self withHandler:^(FBSDKLoginCompletionParameters *parameters) { - NSString *eventName = [NSString stringWithFormat:@"%@ %@", - (state.isReauthorize ? @"Reauthorization" : @"Authorization"), - (parameters.error ? @"Error" : (parameters.accessTokenString ? @"succeeded" : @"cancelled")) - ]; - - [self completeAuthentication:parameters expectChallenge:NO]; - - if (eventName != nil) { - NSString *sortedPermissions = (parameters.permissions.count == 0) - ? @"" - : [[parameters.permissions.allObjects sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)] componentsJoinedByString:@","]; - - [FBSDKAppEvents logImplicitEvent:FBSDKAppEventNamePermissionsUILaunch - valueToSum:nil - parameters:@{ @"ui_dialog_type" : @"iOS integrated auth", - @"permissions_requested" : sortedPermissions } - accessToken:nil]; - - [FBSDKAppEvents logImplicitEvent:FBSDKAppEventNamePermissionsUIDismiss - valueToSum:nil - parameters:@{ @"ui_dialog_type" : @"iOS integrated auth", - FBSDKAppEventParameterDialogOutcome : eventName, - @"permissions_requested" : sortedPermissions } - accessToken:nil]; - } - }]; -} - -- (void)fallbackToNativeBehavior -{ - FBSDKLoginManagerLoginResult *skippedResult = [[FBSDKLoginManagerLoginResult alloc] initWithToken:nil - isCancelled:NO - grantedPermissions:nil - declinedPermissions:nil]; - skippedResult.isSkipped = YES; - [_logger endLoginWithResult:skippedResult error:nil]; - // any necessary strong reference will be maintained by the mechanism that is used - [self logInWithBehavior:FBSDKLoginBehaviorNative]; -} - -@end - -@implementation FBSDKLoginManager (WebDialog) - -- (void)performWebLogInWithParameters:(NSDictionary *)loginParams handler:(void(^)(BOOL, NSError*))handler -{ - [FBSDKInternalUtility registerTransientObject:self]; - [FBSDKInternalUtility deleteFacebookCookies]; - NSMutableDictionary *parameters = [[NSMutableDictionary alloc] initWithDictionary:loginParams]; - parameters[@"title"] = NSLocalizedStringWithDefaultValue(@"LoginWeb.LogInTitle", - @"FacebookSDK", - [FBSDKInternalUtility bundleForStrings], - @"Log In", - @"Title of the web dialog that prompts the user to log in to Facebook."); - [FBSDKWebDialog showWithName:@"oauth" parameters:parameters delegate:self]; - - if (handler) { - handler(YES, nil); - } -} - -- (void)webDialog:(FBSDKWebDialog *)webDialog didCompleteWithResults:(NSDictionary *)results -{ - NSString *token = results[@"access_token"]; - - if (token.length == 0) { - [self webDialogDidCancel:webDialog]; - } else { - id completer = [[FBSDKLoginURLCompleter alloc] initWithURLParameters:results appID:[FBSDKSettings appID]]; - [completer completeLogIn:self withHandler:^(FBSDKLoginCompletionParameters *parameters) { - [self completeAuthentication:parameters expectChallenge:YES]; - }]; - [FBSDKInternalUtility unregisterTransientObject:self]; - } -} - -- (void)webDialog:(FBSDKWebDialog *)webDialog didFailWithError:(NSError *)error -{ - FBSDKLoginCompletionParameters *parameters = [[FBSDKLoginCompletionParameters alloc] initWithError:error]; - [self completeAuthentication:parameters expectChallenge:YES]; - [FBSDKInternalUtility unregisterTransientObject:self]; -} - -- (void)webDialogDidCancel:(FBSDKWebDialog *)webDialog -{ - FBSDKLoginCompletionParameters *parameters = [[FBSDKLoginCompletionParameters alloc] init]; - [self completeAuthentication:parameters expectChallenge:YES]; - [FBSDKInternalUtility unregisterTransientObject:self]; -} - -@end - -@implementation FBSDKLoginManagerSystemAccountState -@end diff --git a/FBSDKLoginKit/FBSDKLoginKit/Internal/FBSDKLoginCompletion+Internal.h b/FBSDKLoginKit/FBSDKLoginKit/Internal/FBSDKLoginCompletion+Internal.h index 6ddfa0db06..0ff9fd7678 100644 --- a/FBSDKLoginKit/FBSDKLoginKit/Internal/FBSDKLoginCompletion+Internal.h +++ b/FBSDKLoginKit/FBSDKLoginKit/Internal/FBSDKLoginCompletion+Internal.h @@ -30,7 +30,6 @@ @property (nonatomic, copy) NSError *error; -@property (nonatomic, assign, getter=isSystemAccount) BOOL systemAccount; @property (nonatomic, copy) NSDate *expirationDate; @property (nonatomic, copy) NSDate *dataAccessExpirationDate; diff --git a/FBSDKLoginKit/FBSDKLoginKit/Internal/FBSDKLoginCompletion.h b/FBSDKLoginKit/FBSDKLoginKit/Internal/FBSDKLoginCompletion.h index 30e0015097..dfcf8ac444 100644 --- a/FBSDKLoginKit/FBSDKLoginKit/Internal/FBSDKLoginCompletion.h +++ b/FBSDKLoginKit/FBSDKLoginKit/Internal/FBSDKLoginCompletion.h @@ -40,7 +40,6 @@ @property (nonatomic, copy, readonly) NSError *error; -@property (nonatomic, readonly, getter=isSystemAccount) BOOL systemAccount; @property (nonatomic, copy, readonly) NSDate *expirationDate; @property (nonatomic, copy, readonly) NSDate *dataAccessExpirationDate; @@ -75,30 +74,3 @@ - (instancetype)initWithURLParameters:(NSDictionary *)parameters appID:(NSString *)appID NS_DESIGNATED_INITIALIZER; @end - -/** - Requests the User ID, granted permissions and declined permissions from the server - using the given access token, which must occur before authentication can be completed. - - Completion occurs asynchronously. - */ -@interface FBSDKLoginSystemAccountCompleter : NSObject - -- (instancetype)init NS_UNAVAILABLE; -+ (instancetype)new NS_UNAVAILABLE; -- (instancetype)initWithTokenString:(NSString *)tokenString appID:(NSString *)appID NS_DESIGNATED_INITIALIZER; - -@end - -/** - Converts an Accounts framework error in to an error or cancellation result - - Completion occurs synchronously. - */ -@interface FBSDKLoginSystemAccountErrorCompleter : NSObject - -- (instancetype)init NS_UNAVAILABLE; -+ (instancetype)new NS_UNAVAILABLE; -- (instancetype)initWithError:(NSError *)accountStoreError permissions:(NSSet *)permissions NS_DESIGNATED_INITIALIZER; - -@end diff --git a/FBSDKLoginKit/FBSDKLoginKit/Internal/FBSDKLoginCompletion.m b/FBSDKLoginKit/FBSDKLoginKit/Internal/FBSDKLoginCompletion.m index 4ac8e1949e..0d35953b96 100644 --- a/FBSDKLoginKit/FBSDKLoginKit/Internal/FBSDKLoginCompletion.m +++ b/FBSDKLoginKit/FBSDKLoginKit/Internal/FBSDKLoginCompletion.m @@ -232,86 +232,3 @@ - (void)attemptBrowserLogIn:(FBSDKLoginManager *)loginManager { } @end - -@implementation FBSDKLoginSystemAccountCompleter -{ - FBSDKLoginCompletionParameters *_parameters; -} - -- (instancetype)initWithTokenString:(NSString *)tokenString appID:(NSString *)appID -{ - if ((self = [super init]) != nil) { - _parameters = [[FBSDKLoginCompletionParameters alloc] init]; - - _parameters.accessTokenString = tokenString; - _parameters.appID = appID; - - _parameters.systemAccount = YES; - } - return self; -} - -- (void)completeLogIn:(FBSDKLoginManager *)loginManager withHandler:(void(^)(FBSDKLoginCompletionParameters *parameters))handler -{ - void(^handlerCopy)(FBSDKLoginCompletionParameters *) = [handler copy]; - FBSDKLoginRequestMeAndPermissions(_parameters, ^{ - // Transform the FBSDKCoreKit error in to an FBSDKLoginKit error, if necessary. This specializes - // the graph errors in to User Checkpointed, Password Changed or Unconfirmed User. - // - // It's possible the graph error has a value set for NSRecoveryAttempterErrorKey but we don't - // have any login-specific attempter to provide since system auth succeeded and the error is a - // graph API error. - NSError *serverError = self->_parameters.error; - NSError *error = [NSError fbErrorFromServerError:serverError]; - if (error != nil) { - // In the event the user's password changed the Accounts framework will still return - // an access token but API calls will fail. Clear the access token from the result - // and use the special-case System Password changed error, which has different text - // to display to the user. - if (error.code == FBSDKLoginErrorPasswordChanged) { - [FBSDKSystemAccountStoreAdapter sharedInstance].forceBlockingRenew = YES; - - self->_parameters.accessTokenString = nil; - self->_parameters.appID = nil; - - error = [NSError fbErrorForSystemPasswordChange:serverError]; - } - - self->_parameters.error = error; - } - - handlerCopy(self->_parameters); - }); -} - -@end - -@implementation FBSDKLoginSystemAccountErrorCompleter -{ - FBSDKLoginCompletionParameters *_parameters; -} - -- (instancetype)initWithError:(NSError *)accountStoreError permissions:(NSSet *)permissions -{ - if ((self = [super init]) != nil) { - _parameters = [[FBSDKLoginCompletionParameters alloc] init]; - - NSError *error = [NSError fbErrorForSystemAccountStoreError:accountStoreError]; - if (error != nil) { - _parameters.error = error; - } else { - // The lack of an error indicates the user declined permissions - _parameters.declinedPermissions = permissions; - } - - _parameters.systemAccount = YES; - } - return self; -} - -- (void)completeLogIn:(FBSDKLoginManager *)loginManager withHandler:(void(^)(FBSDKLoginCompletionParameters *parameters))handler -{ - handler(_parameters); -} - -@end diff --git a/FBSDKLoginKit/FBSDKLoginKit/Internal/FBSDKLoginError.h b/FBSDKLoginKit/FBSDKLoginKit/Internal/FBSDKLoginError.h index 922cf68e8d..176c9cec8a 100644 --- a/FBSDKLoginKit/FBSDKLoginKit/Internal/FBSDKLoginError.h +++ b/FBSDKLoginKit/FBSDKLoginKit/Internal/FBSDKLoginError.h @@ -25,7 +25,6 @@ NS_ASSUME_NONNULL_BEGIN @interface NSError (FBSDKLoginError) + (NSError *)fbErrorForFailedLoginWithCode:(FBSDKLoginError)code; -+ (NSError *)fbErrorForSystemAccountStoreError:(NSError *)accountStoreError; + (NSError *)fbErrorForSystemPasswordChange:(NSError *)innerError; + (nullable NSError *)fbErrorFromReturnURLParameters:(NSDictionary *)parameters; diff --git a/FBSDKLoginKit/FBSDKLoginKit/Internal/FBSDKLoginError.m b/FBSDKLoginKit/FBSDKLoginKit/Internal/FBSDKLoginError.m index 91e23f355a..b77896f281 100644 --- a/FBSDKLoginKit/FBSDKLoginKit/Internal/FBSDKLoginError.m +++ b/FBSDKLoginKit/FBSDKLoginKit/Internal/FBSDKLoginError.m @@ -94,37 +94,6 @@ + (NSError *)fbErrorForFailedLoginWithCode:(FBSDKLoginError)code userInfo:userInfo]; } -+ (NSError *)fbErrorForSystemAccountStoreError:(NSError *)accountStoreError -{ - NSError *err = nil; - BOOL cancellation = NO; - - if ([accountStoreError.domain isEqualToString:FBSDKLoginErrorDomain] || - [accountStoreError.domain isEqualToString:FBSDKErrorDomain]) { - // If the requestAccess call results in a Facebook error, surface it as a top-level - // error. This implies it is not the typical user "disallows" case. - err = accountStoreError; - } else if ([accountStoreError.domain isEqualToString:@"com.apple.accounts"] && accountStoreError.code == 7) { - err = [self fbErrorWithSystemAccountStoreDeniedError:accountStoreError isCancellation:&cancellation]; - } - - if (err == nil && !cancellation) { - // create an error object with additional info regarding failed login - NSInteger errorCode = FBSDKLoginErrorSystemAccountUnavailable; - - NSString *errorDomain = accountStoreError.domain; - if ([errorDomain isEqualToString:NSURLErrorDomain] || - [errorDomain isEqualToString:@"kCFErrorDomainCFNetwork"]) { - errorCode = FBSDKErrorNetwork; - } - - err = [self fbErrorForFailedLoginWithCode:errorCode - innerError:accountStoreError]; - } - - return err; -} - + (NSError *)fbErrorForSystemPasswordChange:(NSError *)innerError { NSString *failureReasonAndDescription = diff --git a/FBSDKLoginKit/FBSDKLoginKit/Internal/FBSDKLoginManager+Internal.h b/FBSDKLoginKit/FBSDKLoginKit/Internal/FBSDKLoginManager+Internal.h index 77ddb6d7bd..7ca8bf7b91 100644 --- a/FBSDKLoginKit/FBSDKLoginKit/Internal/FBSDKLoginManager+Internal.h +++ b/FBSDKLoginKit/FBSDKLoginKit/Internal/FBSDKLoginManager+Internal.h @@ -25,12 +25,6 @@ @class FBSDKAccessToken; @class FBSDKLoginCompletionParameters; -@interface FBSDKLoginManagerSystemAccountState : NSObject -@property (nonatomic, assign) BOOL didShowDialog; -@property (nonatomic, getter=isReauthorize) BOOL reauthorize; -@property (nonatomic, getter=isUnTOSedDevice) BOOL unTOSedDevice; -@end - @interface FBSDKLoginManager () @property (nonatomic, weak) UIViewController *fromViewController; @property (nonatomic, readonly) NSSet *requestedPermissions; @@ -61,21 +55,3 @@ - (void)performBrowserLogInWithParameters:(NSDictionary *)loginParams handler:(void(^)(BOOL, NSString *,NSError*))handler; @end - -// the category is made available for testing only -@interface FBSDKLoginManager (Accounts) - -- (void)beginSystemLogIn; -- (void)performSystemLogIn; -- (void)continueSystemLogInWithTokenString:(NSString *)oauthToken error:(NSError *)accountStoreError state:(FBSDKLoginManagerSystemAccountState *)state; - -- (void)fallbackToNativeBehavior; - -@end - -// the category is made available for testing only -@interface FBSDKLoginManager (WebDialog) - -- (void)performWebLogInWithParameters:(NSDictionary *)loginParams handler:(void(^)(BOOL, NSError*))handler; - -@end diff --git a/FBSDKLoginKit/FBSDKLoginKit/Internal/FBSDKLoginManagerLogger.h b/FBSDKLoginKit/FBSDKLoginKit/Internal/FBSDKLoginManagerLogger.h index 640d47b109..ed6eb5488b 100644 --- a/FBSDKLoginKit/FBSDKLoginKit/Internal/FBSDKLoginManagerLogger.h +++ b/FBSDKLoginKit/FBSDKLoginKit/Internal/FBSDKLoginManagerLogger.h @@ -20,8 +20,6 @@ FOUNDATION_EXPORT NSString *const FBSDKLoginManagerLoggerAuthMethod_Native; FOUNDATION_EXPORT NSString *const FBSDKLoginManagerLoggerAuthMethod_Browser; -FOUNDATION_EXPORT NSString *const FBSDKLoginManagerLoggerAuthMethod_System; -FOUNDATION_EXPORT NSString *const FBSDKLoginManagerLoggerAuthMethod_Webview; FOUNDATION_EXPORT NSString *const FBSDKLoginManagerLoggerAuthMethod_SFVC; diff --git a/FBSDKLoginKit/FBSDKLoginKit/Internal/FBSDKLoginManagerLogger.m b/FBSDKLoginKit/FBSDKLoginKit/Internal/FBSDKLoginManagerLogger.m index a47015c828..31b3f38c23 100644 --- a/FBSDKLoginKit/FBSDKLoginKit/Internal/FBSDKLoginManagerLogger.m +++ b/FBSDKLoginKit/FBSDKLoginKit/Internal/FBSDKLoginManagerLogger.m @@ -25,8 +25,6 @@ NSString *const FBSDKLoginManagerLoggerAuthMethod_Native = @"fb_application_web_auth"; NSString *const FBSDKLoginManagerLoggerAuthMethod_Browser = @"browser_auth"; -NSString *const FBSDKLoginManagerLoggerAuthMethod_System = @"integrated_auth"; -NSString *const FBSDKLoginManagerLoggerAuthMethod_Webview = @"fallback_auth"; NSString *const FBSDKLoginManagerLoggerAuthMethod_SFVC = @"sfvc_auth"; static NSString *const FBSDKLoginManagerLoggingClientStateKey = @"state"; @@ -50,8 +48,6 @@ static NSString *const FBSDKLoginManagerLoggerTryNative = @"tryFBAppAuth"; static NSString *const FBSDKLoginManagerLoggerTryBrowser = @"trySafariAuth"; -static NSString *const FBSDKLoginManagerLoggerTrySystemAccount = @"tryIntegratedAuth"; -static NSString *const FBSDKLoginManagerLoggerTryWebView = @"tryFallback"; @implementation FBSDKLoginManagerLogger { @@ -98,8 +94,6 @@ - (void)startSessionForLoginManager:(FBSDKLoginManager *)loginManager BOOL isReauthorize = ([FBSDKAccessToken currentAccessToken] != nil); BOOL willTryNative = NO; BOOL willTryBrowser = NO; - BOOL willTrySystemAccount = NO; - BOOL willTryWebView = NO; NSString *behaviorString = nil; switch (loginManager.loginBehavior) { @@ -112,23 +106,11 @@ - (void)startSessionForLoginManager:(FBSDKLoginManager *)loginManager willTryBrowser = YES; behaviorString = @"FBSDKLoginBehaviorBrowser"; break; - case FBSDKLoginBehaviorSystemAccount: - willTryNative = YES; - willTryBrowser = YES; - willTrySystemAccount = YES; - behaviorString = @"FBSDKLoginBehaviorSystemAccount"; - break; - case FBSDKLoginBehaviorWeb: - willTryWebView = YES; - behaviorString = @"FBSDKLoginBehaviorWeb"; - break; } [_extras addEntriesFromDictionary:@{ FBSDKLoginManagerLoggerTryNative : @(willTryNative), FBSDKLoginManagerLoggerTryBrowser : @(willTryBrowser), - FBSDKLoginManagerLoggerTrySystemAccount : @(willTrySystemAccount), - FBSDKLoginManagerLoggerTryWebView : @(willTryWebView), @"isReauthorize" : @(isReauthorize), @"login_behavior" : behaviorString, @"default_audience" : [FBSDKLoginUtility stringForAudience:loginManager.defaultAudience],