Skip to content

Commit 5b30eb9

Browse files
authored
Remove keychain name param (#530)
1 parent e81db5b commit 5b30eb9

File tree

7 files changed

+6
-21
lines changed

7 files changed

+6
-21
lines changed

GoogleSignIn/Sources/GIDAuthStateMigration/Fake/GIDFakeAuthStateMigration.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121

2222
/// Callback that is called when `migrateIfNeededWithTokenURL` is invoked.
2323
@property (nonatomic, nullable) void (^migrationInvokedCallback)
24-
(NSURL * _Nullable tokenURL, NSString * _Nullable callbackPath, NSString * _Nullable keychainName,
25-
BOOL isFreshInstall);
24+
(NSURL * _Nullable tokenURL, NSString * _Nullable callbackPath, BOOL isFreshInstall);
2625

2726
@end

GoogleSignIn/Sources/GIDAuthStateMigration/Fake/GIDFakeAuthStateMigration.m

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,9 @@ - (instancetype)initWithKeychainStore:(GTMKeychainStore *)keychainStore {
2929

3030
- (void)migrateIfNeededWithTokenURL:(NSURL *)tokenURL
3131
callbackPath:(NSString *)callbackPath
32-
keychainName:(NSString *)keychainName
3332
isFreshInstall:(BOOL)isFreshInstall {
3433
if (_migrationInvokedCallback) {
35-
_migrationInvokedCallback(tokenURL, callbackPath, keychainName, isFreshInstall);
34+
_migrationInvokedCallback(tokenURL, callbackPath, isFreshInstall);
3635
}
3736
return;
3837
}

GoogleSignIn/Sources/GIDAuthStateMigration/GIDAuthStateMigration.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ NS_ASSUME_NONNULL_BEGIN
3030
/// Perform necessary migrations from legacy auth state storage to most recent GTMAppAuth version.
3131
- (void)migrateIfNeededWithTokenURL:(NSURL *)tokenURL
3232
callbackPath:(NSString *)callbackPath
33-
keychainName:(NSString *)keychainName
3433
isFreshInstall:(BOOL)isFreshInstall;
3534

3635
@end

GoogleSignIn/Sources/GIDAuthStateMigration/Implementation/GIDAuthStateMigration.m

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ - (instancetype)init {
6464

6565
- (void)migrateIfNeededWithTokenURL:(NSURL *)tokenURL
6666
callbackPath:(NSString *)callbackPath
67-
keychainName:(NSString *)keychainName
6867
isFreshInstall:(BOOL)isFreshInstall {
6968
// If this is a fresh install, take no action and mark the migration checks as having been
7069
// performed.
@@ -82,8 +81,7 @@ - (void)migrateIfNeededWithTokenURL:(NSURL *)tokenURL
8281
[self performDataProtectedMigrationIfNeeded];
8382
#elif TARGET_OS_IOS && !TARGET_OS_MACCATALYST
8483
[self performGIDMigrationIfNeededWithTokenURL:tokenURL
85-
callbackPath:callbackPath
86-
keychainName:keychainName];
84+
callbackPath:callbackPath];
8785
#endif // TARGET_OS_OSX
8886
}
8987

@@ -117,8 +115,7 @@ - (void)performDataProtectedMigrationIfNeeded {
117115
// Migrate from GPPSignIn 1.x or GIDSignIn 1.0 - 4.x to the GTMAppAuth storage introduced in
118116
// GIDSignIn 5.0.
119117
- (void)performGIDMigrationIfNeededWithTokenURL:(NSURL *)tokenURL
120-
callbackPath:(NSString *)callbackPath
121-
keychainName:(NSString *)keychainName {
118+
callbackPath:(NSString *)callbackPath {
122119
// See if we've performed the migration check previously.
123120
NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults];
124121
if ([defaults boolForKey:kGTMAppAuthMigrationCheckPerformedKey]) {

GoogleSignIn/Sources/GIDSignIn.m

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,6 @@ - (instancetype)initWithKeychainStore:(GTMKeychainStore *)keychainStore
568568
// Perform migration of auth state from old versions of the SDK if needed.
569569
[authStateMigrationService migrateIfNeededWithTokenURL:_appAuthConfiguration.tokenEndpoint
570570
callbackPath:kBrowserCallbackPath
571-
keychainName:kGTMAppAuthKeychainName
572571
isFreshInstall:isFreshInstall];
573572
}
574573
return self;

GoogleSignIn/Tests/Unit/GIDAuthStateMigrationTest.m

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,6 @@ - (void)testMigrateIfNeeded_NoPreviousMigration_DataProtectedMigration {
154154
[[GIDAuthStateMigration alloc] initWithKeychainStore:_mockGTMKeychainStore];
155155
[migration migrateIfNeededWithTokenURL:[NSURL URLWithString:kTokenURL]
156156
callbackPath:kCallbackPath
157-
keychainName:kKeychainName
158157
isFreshInstall:NO];
159158

160159
// verify that the auth session was removed during migration
@@ -179,7 +178,6 @@ - (void)testMigrateIfNeeded_KeychainFailure_DataProtectedMigration {
179178
[[GIDAuthStateMigration alloc] initWithKeychainStore:_mockGTMKeychainStore];
180179
[migration migrateIfNeededWithTokenURL:[NSURL URLWithString:kTokenURL]
181180
callbackPath:kCallbackPath
182-
keychainName:kKeychainName
183181
isFreshInstall:NO];
184182
XCTAssertNil([_realLegacyGTMKeychainStore retrieveAuthSessionWithError:nil]);
185183
}
@@ -198,7 +196,6 @@ - (void)testMigrateIfNeeded_NoPreviousMigration_GTMAppAuthMigration {
198196
[[GIDAuthStateMigration alloc] initWithKeychainStore:_mockGTMKeychainStore];
199197
[migration migrateIfNeededWithTokenURL:[NSURL URLWithString:kTokenURL]
200198
callbackPath:kCallbackPath
201-
keychainName:kKeychainName
202199
isFreshInstall:NO];
203200
}
204201

@@ -215,7 +212,6 @@ - (void)testMigrateIfNeeded_KeychainFailure_GTMAppAuthMigration {
215212
[[GIDAuthStateMigration alloc] initWithKeychainStore:_mockGTMKeychainStore];
216213
[migration migrateIfNeededWithTokenURL:[NSURL URLWithString:kTokenURL]
217214
callbackPath:kCallbackPath
218-
keychainName:kKeychainName
219215
isFreshInstall:NO];
220216
}
221217

@@ -258,7 +254,6 @@ - (void)testMigrateIfNeeded_HasPreviousMigration {
258254
[[GIDAuthStateMigration alloc] initWithKeychainStore:_mockGTMKeychainStore];
259255
[migration migrateIfNeededWithTokenURL:[NSURL URLWithString:kTokenURL]
260256
callbackPath:kCallbackPath
261-
keychainName:kKeychainName
262257
isFreshInstall:NO];
263258
}
264259

@@ -274,7 +269,6 @@ - (void)testMigrateIfNeeded_isFreshInstall {
274269
[[GIDAuthStateMigration alloc] initWithKeychainStore:_mockGTMKeychainStore];
275270
[migration migrateIfNeededWithTokenURL:[NSURL URLWithString:kTokenURL]
276271
callbackPath:kCallbackPath
277-
keychainName:kKeychainName
278272
isFreshInstall:YES];
279273
}
280274

GoogleSignIn/Tests/Unit/GIDSignInTest.m

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -498,16 +498,14 @@ - (void)testInitWithKeychainStore_invalidConfig {
498498
}
499499

500500
- (void)testInitWithKeychainStore_attemptsMigration {
501-
NSString *expectedKeychainName = @"foo";
502-
503501
XCTestExpectation *expectation = [self expectationWithDescription:@"Callback should be called."];
504502
_authStateMigrationService.migrationInvokedCallback =
505-
^(NSURL *tokenURL, NSString *callbackPath, NSString *keychainName, BOOL isFreshInstall) {
503+
^(NSURL *tokenURL, NSString *callbackPath, BOOL isFreshInstall) {
506504
XCTAssertFalse(isFreshInstall);
507505
[expectation fulfill];
508506
};
509507

510-
GTMKeychainStore *store = [[GTMKeychainStore alloc] initWithItemName:expectedKeychainName];
508+
GTMKeychainStore *store = [[GTMKeychainStore alloc] initWithItemName:kKeychainName];
511509
GIDSignIn *signIn = [[GIDSignIn alloc] initWithKeychainStore:store
512510
authStateMigrationService:_authStateMigrationService];
513511

0 commit comments

Comments
 (0)