diff --git a/GoogleSignIn/Sources/GIDAuthStateMigration/Fake/GIDFakeAuthStateMigration.h b/GoogleSignIn/Sources/GIDAuthStateMigration/Fake/GIDFakeAuthStateMigration.h index fc611e53..24555f30 100644 --- a/GoogleSignIn/Sources/GIDAuthStateMigration/Fake/GIDFakeAuthStateMigration.h +++ b/GoogleSignIn/Sources/GIDAuthStateMigration/Fake/GIDFakeAuthStateMigration.h @@ -21,7 +21,6 @@ /// Callback that is called when `migrateIfNeededWithTokenURL` is invoked. @property (nonatomic, nullable) void (^migrationInvokedCallback) - (NSURL * _Nullable tokenURL, NSString * _Nullable callbackPath, NSString * _Nullable keychainName, - BOOL isFreshInstall); + (NSURL * _Nullable tokenURL, NSString * _Nullable callbackPath, BOOL isFreshInstall); @end diff --git a/GoogleSignIn/Sources/GIDAuthStateMigration/Fake/GIDFakeAuthStateMigration.m b/GoogleSignIn/Sources/GIDAuthStateMigration/Fake/GIDFakeAuthStateMigration.m index 0346dba1..b753b814 100644 --- a/GoogleSignIn/Sources/GIDAuthStateMigration/Fake/GIDFakeAuthStateMigration.m +++ b/GoogleSignIn/Sources/GIDAuthStateMigration/Fake/GIDFakeAuthStateMigration.m @@ -29,10 +29,9 @@ - (instancetype)initWithKeychainStore:(GTMKeychainStore *)keychainStore { - (void)migrateIfNeededWithTokenURL:(NSURL *)tokenURL callbackPath:(NSString *)callbackPath - keychainName:(NSString *)keychainName isFreshInstall:(BOOL)isFreshInstall { if (_migrationInvokedCallback) { - _migrationInvokedCallback(tokenURL, callbackPath, keychainName, isFreshInstall); + _migrationInvokedCallback(tokenURL, callbackPath, isFreshInstall); } return; } diff --git a/GoogleSignIn/Sources/GIDAuthStateMigration/GIDAuthStateMigration.h b/GoogleSignIn/Sources/GIDAuthStateMigration/GIDAuthStateMigration.h index 738368fc..3f246b77 100644 --- a/GoogleSignIn/Sources/GIDAuthStateMigration/GIDAuthStateMigration.h +++ b/GoogleSignIn/Sources/GIDAuthStateMigration/GIDAuthStateMigration.h @@ -30,7 +30,6 @@ NS_ASSUME_NONNULL_BEGIN /// Perform necessary migrations from legacy auth state storage to most recent GTMAppAuth version. - (void)migrateIfNeededWithTokenURL:(NSURL *)tokenURL callbackPath:(NSString *)callbackPath - keychainName:(NSString *)keychainName isFreshInstall:(BOOL)isFreshInstall; @end diff --git a/GoogleSignIn/Sources/GIDAuthStateMigration/Implementation/GIDAuthStateMigration.m b/GoogleSignIn/Sources/GIDAuthStateMigration/Implementation/GIDAuthStateMigration.m index b5c21773..e9c1c107 100644 --- a/GoogleSignIn/Sources/GIDAuthStateMigration/Implementation/GIDAuthStateMigration.m +++ b/GoogleSignIn/Sources/GIDAuthStateMigration/Implementation/GIDAuthStateMigration.m @@ -64,7 +64,6 @@ - (instancetype)init { - (void)migrateIfNeededWithTokenURL:(NSURL *)tokenURL callbackPath:(NSString *)callbackPath - keychainName:(NSString *)keychainName isFreshInstall:(BOOL)isFreshInstall { // If this is a fresh install, take no action and mark the migration checks as having been // performed. @@ -82,8 +81,7 @@ - (void)migrateIfNeededWithTokenURL:(NSURL *)tokenURL [self performDataProtectedMigrationIfNeeded]; #elif TARGET_OS_IOS && !TARGET_OS_MACCATALYST [self performGIDMigrationIfNeededWithTokenURL:tokenURL - callbackPath:callbackPath - keychainName:keychainName]; + callbackPath:callbackPath]; #endif // TARGET_OS_OSX } @@ -117,8 +115,7 @@ - (void)performDataProtectedMigrationIfNeeded { // Migrate from GPPSignIn 1.x or GIDSignIn 1.0 - 4.x to the GTMAppAuth storage introduced in // GIDSignIn 5.0. - (void)performGIDMigrationIfNeededWithTokenURL:(NSURL *)tokenURL - callbackPath:(NSString *)callbackPath - keychainName:(NSString *)keychainName { + callbackPath:(NSString *)callbackPath { // See if we've performed the migration check previously. NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults]; if ([defaults boolForKey:kGTMAppAuthMigrationCheckPerformedKey]) { diff --git a/GoogleSignIn/Sources/GIDSignIn.m b/GoogleSignIn/Sources/GIDSignIn.m index ef7ac3eb..48b6d749 100644 --- a/GoogleSignIn/Sources/GIDSignIn.m +++ b/GoogleSignIn/Sources/GIDSignIn.m @@ -568,7 +568,6 @@ - (instancetype)initWithKeychainStore:(GTMKeychainStore *)keychainStore // Perform migration of auth state from old versions of the SDK if needed. [authStateMigrationService migrateIfNeededWithTokenURL:_appAuthConfiguration.tokenEndpoint callbackPath:kBrowserCallbackPath - keychainName:kGTMAppAuthKeychainName isFreshInstall:isFreshInstall]; } return self; diff --git a/GoogleSignIn/Tests/Unit/GIDAuthStateMigrationTest.m b/GoogleSignIn/Tests/Unit/GIDAuthStateMigrationTest.m index 20b16451..1504224a 100644 --- a/GoogleSignIn/Tests/Unit/GIDAuthStateMigrationTest.m +++ b/GoogleSignIn/Tests/Unit/GIDAuthStateMigrationTest.m @@ -154,7 +154,6 @@ - (void)testMigrateIfNeeded_NoPreviousMigration_DataProtectedMigration { [[GIDAuthStateMigration alloc] initWithKeychainStore:_mockGTMKeychainStore]; [migration migrateIfNeededWithTokenURL:[NSURL URLWithString:kTokenURL] callbackPath:kCallbackPath - keychainName:kKeychainName isFreshInstall:NO]; // verify that the auth session was removed during migration @@ -179,7 +178,6 @@ - (void)testMigrateIfNeeded_KeychainFailure_DataProtectedMigration { [[GIDAuthStateMigration alloc] initWithKeychainStore:_mockGTMKeychainStore]; [migration migrateIfNeededWithTokenURL:[NSURL URLWithString:kTokenURL] callbackPath:kCallbackPath - keychainName:kKeychainName isFreshInstall:NO]; XCTAssertNil([_realLegacyGTMKeychainStore retrieveAuthSessionWithError:nil]); } @@ -198,7 +196,6 @@ - (void)testMigrateIfNeeded_NoPreviousMigration_GTMAppAuthMigration { [[GIDAuthStateMigration alloc] initWithKeychainStore:_mockGTMKeychainStore]; [migration migrateIfNeededWithTokenURL:[NSURL URLWithString:kTokenURL] callbackPath:kCallbackPath - keychainName:kKeychainName isFreshInstall:NO]; } @@ -215,7 +212,6 @@ - (void)testMigrateIfNeeded_KeychainFailure_GTMAppAuthMigration { [[GIDAuthStateMigration alloc] initWithKeychainStore:_mockGTMKeychainStore]; [migration migrateIfNeededWithTokenURL:[NSURL URLWithString:kTokenURL] callbackPath:kCallbackPath - keychainName:kKeychainName isFreshInstall:NO]; } @@ -258,7 +254,6 @@ - (void)testMigrateIfNeeded_HasPreviousMigration { [[GIDAuthStateMigration alloc] initWithKeychainStore:_mockGTMKeychainStore]; [migration migrateIfNeededWithTokenURL:[NSURL URLWithString:kTokenURL] callbackPath:kCallbackPath - keychainName:kKeychainName isFreshInstall:NO]; } @@ -274,7 +269,6 @@ - (void)testMigrateIfNeeded_isFreshInstall { [[GIDAuthStateMigration alloc] initWithKeychainStore:_mockGTMKeychainStore]; [migration migrateIfNeededWithTokenURL:[NSURL URLWithString:kTokenURL] callbackPath:kCallbackPath - keychainName:kKeychainName isFreshInstall:YES]; } diff --git a/GoogleSignIn/Tests/Unit/GIDSignInTest.m b/GoogleSignIn/Tests/Unit/GIDSignInTest.m index eb367322..71974e0f 100644 --- a/GoogleSignIn/Tests/Unit/GIDSignInTest.m +++ b/GoogleSignIn/Tests/Unit/GIDSignInTest.m @@ -498,16 +498,14 @@ - (void)testInitWithKeychainStore_invalidConfig { } - (void)testInitWithKeychainStore_attemptsMigration { - NSString *expectedKeychainName = @"foo"; - XCTestExpectation *expectation = [self expectationWithDescription:@"Callback should be called."]; _authStateMigrationService.migrationInvokedCallback = - ^(NSURL *tokenURL, NSString *callbackPath, NSString *keychainName, BOOL isFreshInstall) { + ^(NSURL *tokenURL, NSString *callbackPath, BOOL isFreshInstall) { XCTAssertFalse(isFreshInstall); [expectation fulfill]; }; - GTMKeychainStore *store = [[GTMKeychainStore alloc] initWithItemName:expectedKeychainName]; + GTMKeychainStore *store = [[GTMKeychainStore alloc] initWithItemName:kKeychainName]; GIDSignIn *signIn = [[GIDSignIn alloc] initWithKeychainStore:store authStateMigrationService:_authStateMigrationService];