Skip to content

Commit 6b74f4f

Browse files
committed
merge
2 parents d6cfd4e + e81db5b commit 6b74f4f

File tree

5 files changed

+31
-32
lines changed

5 files changed

+31
-32
lines changed

GoogleSignIn/Sources/GIDAuthStateMigration/Fake/GIDFakeAuthStateMigration.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16-
#import "GoogleSignIn/Sources/GIDAuthStateMigration/Fake/GIDFakeAuthStateMigration.h"
1716

17+
#import "GoogleSignIn/Sources/GIDAuthStateMigration/Fake/GIDFakeAuthStateMigration.h"
1818

1919
NS_ASSUME_NONNULL_BEGIN
2020

GoogleSignIn/Sources/GIDAuthStateMigration/Implementation/GIDAuthStateMigration.m

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
// limitations under the License.
1414

1515
#import "GoogleSignIn/Sources/GIDAuthStateMigration/GIDAuthStateMigration.h"
16-
1716
#import "GoogleSignIn/Sources/GIDSignInCallbackSchemes.h"
1817

1918
@import GTMAppAuth;
@@ -70,23 +69,23 @@ - (void)migrateIfNeededWithTokenURL:(NSURL *)tokenURL
7069
// performed.
7170
if (isFreshInstall) {
7271
NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults];
73-
#if TARGET_OS_OSX || TARGET_OS_MACCATALYST
72+
#if TARGET_OS_OSX
7473
[defaults setBool:YES forKey:kDataProtectedMigrationCheckPerformedKey];
75-
#elif TARGET_OS_IOS
74+
#elif TARGET_OS_IOS && !TARGET_OS_MACCATALYST
7675
[defaults setBool:YES forKey:kGTMAppAuthMigrationCheckPerformedKey];
77-
#endif // TARGET_OS_OSX || TARGET_OS_MACCATALYST
76+
#endif // TARGET_OS_OSX
7877
return;
7978
}
8079

81-
#if TARGET_OS_OSX || TARGET_OS_MACCATALYST
80+
#if TARGET_OS_OSX
8281
[self performDataProtectedMigrationIfNeeded];
83-
#elif TARGET_OS_IOS
82+
#elif TARGET_OS_IOS && !TARGET_OS_MACCATALYST
8483
[self performGIDMigrationIfNeededWithTokenURL:tokenURL
8584
callbackPath:callbackPath];
86-
#endif // TARGET_OS_OSX || TARGET_OS_MACCATALYST
85+
#endif // TARGET_OS_OSX
8786
}
8887

89-
#if TARGET_OS_OSX || TARGET_OS_MACCATALYST
88+
#if TARGET_OS_OSX
9089
// Migrate from the fileBasedKeychain to dataProtectedKeychain with GTMAppAuth 5.0.
9190
- (void)performDataProtectedMigrationIfNeeded {
9291
// See if we've performed the migration check previously.
@@ -112,7 +111,7 @@ - (void)performDataProtectedMigrationIfNeeded {
112111
[defaults setBool:YES forKey:kDataProtectedMigrationCheckPerformedKey];
113112
}
114113

115-
#elif TARGET_OS_IOS
114+
#elif TARGET_OS_IOS && !TARGET_OS_MACCATALYST
116115
// Migrate from GPPSignIn 1.x or GIDSignIn 1.0 - 4.x to the GTMAppAuth storage introduced in
117116
// GIDSignIn 5.0.
118117
- (void)performGIDMigrationIfNeededWithTokenURL:(NSURL *)tokenURL
@@ -235,7 +234,7 @@ + (nullable NSString *)passwordForService:(NSString *)service {
235234
NSString *password = [[NSString alloc] initWithData:passwordData encoding:NSUTF8StringEncoding];
236235
return password;
237236
}
238-
#endif // TARGET_OS_OSX || TARGET_OS_MACCATALYST
237+
#endif // TARGET_OS_OSX
239238

240239
@end
241240

GoogleSignIn/Sources/GIDSignIn.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -538,7 +538,7 @@ - (void)configureDebugProviderWithAPIKey:(NSString *)APIKey
538538
#pragma mark - Private methods
539539

540540
- (instancetype)initWithKeychainStore:(GTMKeychainStore *)keychainStore
541-
authStateMigrationService:(GIDAuthStateMigration *) authStateMigrationService {
541+
authStateMigrationService:(GIDAuthStateMigration *)authStateMigrationService {
542542
self = [super init];
543543
if (self) {
544544
// Get the bundle of the current executable.
@@ -575,7 +575,7 @@ - (instancetype)initWithKeychainStore:(GTMKeychainStore *)keychainStore
575575

576576
#if TARGET_OS_IOS && !TARGET_OS_MACCATALYST
577577
- (instancetype)initWithKeychainStore:(GTMKeychainStore *)keychainStore
578-
authStateMigrationService:(GIDAuthStateMigration *) authStateMigrationService
578+
authStateMigrationService:(GIDAuthStateMigration *)authStateMigrationService
579579
appCheck:(GIDAppCheck *)appCheck {
580580
self = [self initWithKeychainStore:keychainStore
581581
authStateMigrationService:authStateMigrationService];

GoogleSignIn/Sources/GIDSignIn_Private.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,12 @@ typedef void (^GIDDisconnectCompletion)(NSError *_Nullable error);
4848

4949
/// Private initializer taking a `GTMKeychainStore`.
5050
- (instancetype)initWithKeychainStore:(GTMKeychainStore *)keychainStore
51-
authStateMigrationService:(GIDAuthStateMigration *) authStateMigrationService;
51+
authStateMigrationService:(GIDAuthStateMigration *)authStateMigrationService;
5252

5353
#if TARGET_OS_IOS && !TARGET_OS_MACCATALYST
5454
/// Private initializer taking a `GTMKeychainStore` and `GIDAppCheckProvider`.
5555
- (instancetype)initWithKeychainStore:(GTMKeychainStore *)keychainStore
56-
authStateMigrationService:(GIDAuthStateMigration *) authStateMigrationService
56+
authStateMigrationService:(GIDAuthStateMigration *)authStateMigrationService
5757
appCheck:(GIDAppCheck *)appCheck
5858
API_AVAILABLE(ios(14));
5959
#endif // TARGET_OS_IOS || !TARGET_OS_MACCATALYST

GoogleSignIn/Tests/Unit/GIDAuthStateMigrationTest.m

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616

1717
#import "GoogleSignIn/Sources/GIDAuthStateMigration/GIDAuthStateMigration.h"
1818
#import "GoogleSignIn/Sources/GIDSignInCallbackSchemes.h"
19-
#if TARGET_OS_OSX || TARGET_OS_MACCATALYST
19+
#if TARGET_OS_OSX
2020
#import "GoogleSignIn/Tests/Unit/OIDAuthState+Testing.h"
21-
#endif // TARGET_OS_OSX || TARGET_OS_MACCATALYST
21+
#endif // TARGET_OS_OSX
2222

2323
@import GTMAppAuth;
2424

@@ -84,9 +84,9 @@ @implementation GIDAuthStateMigrationTest {
8484
id _mockNSBundle;
8585
id _mockGIDSignInCallbackSchemes;
8686
id _mockGTMOAuth2Compatibility;
87-
#if TARGET_OS_OSX || TARGET_OS_MACCATALYST
87+
#if TARGET_OS_OSX
8888
id _realLegacyGTMKeychainStore;
89-
#endif // TARGET_OS_OSX || TARGET_OS_MACCATALYST
89+
#endif // TARGET_OS_OSX
9090
}
9191

9292
- (void)setUp {
@@ -100,12 +100,12 @@ - (void)setUp {
100100
_mockNSBundle = OCMStrictClassMock([NSBundle class]);
101101
_mockGIDSignInCallbackSchemes = OCMStrictClassMock([GIDSignInCallbackSchemes class]);
102102
_mockGTMOAuth2Compatibility = OCMStrictClassMock([GTMOAuth2Compatibility class]);
103-
#if TARGET_OS_OSX || TARGET_OS_MACCATALYST
103+
#if TARGET_OS_OSX
104104
GTMKeychainAttribute *fileBasedKeychain = [GTMKeychainAttribute useFileBasedKeychain];
105105
NSSet *attributes = [NSSet setWithArray:@[fileBasedKeychain]];
106106
_realLegacyGTMKeychainStore = [[GTMKeychainStore alloc] initWithItemName:kKeychainName
107107
keychainAttributes:attributes];
108-
#endif // TARGET_OS_OSX || TARGET_OS_MACCATALYST
108+
#endif // TARGET_OS_OSX
109109
}
110110

111111
- (void)tearDown {
@@ -125,16 +125,16 @@ - (void)tearDown {
125125
[_mockGIDSignInCallbackSchemes stopMocking];
126126
[_mockGTMOAuth2Compatibility verify];
127127
[_mockGTMOAuth2Compatibility stopMocking];
128-
#if TARGET_OS_OSX || TARGET_OS_MACCATALYST
128+
#if TARGET_OS_OSX
129129
[_realLegacyGTMKeychainStore removeAuthSessionWithError:nil];
130-
#endif // TARGET_OS_OSX || TARGET_OS_MACCATALYST
130+
#endif // TARGET_OS_OSX
131131

132132
[super tearDown];
133133
}
134134

135135
#pragma mark - Tests
136136

137-
#if TARGET_OS_OSX || TARGET_OS_MACCATALYST
137+
#if TARGET_OS_OSX
138138
- (void)testMigrateIfNeeded_NoPreviousMigration_DataProtectedMigration {
139139
[[[_mockUserDefaults stub] andReturn:_mockUserDefaults] standardUserDefaults];
140140
[[[_mockUserDefaults expect] andReturnValue:@NO] boolForKey:kDataProtectedMigrationCheckPerformedKey];
@@ -182,7 +182,7 @@ - (void)testMigrateIfNeeded_KeychainFailure_DataProtectedMigration {
182182
XCTAssertNil([_realLegacyGTMKeychainStore retrieveAuthSessionWithError:nil]);
183183
}
184184

185-
#else
185+
#elif TARGET_OS_IOS && !TARGET_OS_MACCATALYST
186186
- (void)testMigrateIfNeeded_NoPreviousMigration_GTMAppAuthMigration {
187187
[[[_mockUserDefaults stub] andReturn:_mockUserDefaults] standardUserDefaults];
188188
[[[_mockUserDefaults expect] andReturnValue:@NO] boolForKey:kGTMAppAuthMigrationCheckPerformedKey];
@@ -238,17 +238,17 @@ - (void)testExtractAuthorization_HostedDomain {
238238

239239
XCTAssertNotNil(authorization);
240240
}
241-
#endif // TARGET_OS_OSX || TARGET_OS_MACCATALYST
241+
#endif // TARGET_OS_OSX
242242

243243
- (void)testMigrateIfNeeded_HasPreviousMigration {
244244
[[[_mockUserDefaults stub] andReturn:_mockUserDefaults] standardUserDefaults];
245-
#if TARGET_OS_OSX || TARGET_OS_MACCATALYST
245+
#if TARGET_OS_OSX
246246
[[[_mockUserDefaults expect] andReturnValue:@YES] boolForKey:kDataProtectedMigrationCheckPerformedKey];
247247
[[_mockUserDefaults reject] setBool:YES forKey:kDataProtectedMigrationCheckPerformedKey];
248-
#else
248+
#elif TARGET_OS_IOS && !TARGET_OS_MACCATALYST
249249
[[[_mockUserDefaults expect] andReturnValue:@YES] boolForKey:kGTMAppAuthMigrationCheckPerformedKey];
250250
[[_mockUserDefaults reject] setBool:YES forKey:kGTMAppAuthMigrationCheckPerformedKey];
251-
#endif // TARGET_OS_OSX || TARGET_OS_MACCATALYST
251+
#endif // TARGET_OS_OSX
252252

253253
GIDAuthStateMigration *migration =
254254
[[GIDAuthStateMigration alloc] initWithKeychainStore:_mockGTMKeychainStore];
@@ -259,11 +259,11 @@ - (void)testMigrateIfNeeded_HasPreviousMigration {
259259

260260
- (void)testMigrateIfNeeded_isFreshInstall {
261261
[[[_mockUserDefaults stub] andReturn:_mockUserDefaults] standardUserDefaults];
262-
#if TARGET_OS_OSX || TARGET_OS_MACCATALYST
262+
#if TARGET_OS_OSX
263263
[[_mockUserDefaults expect] setBool:YES forKey:kDataProtectedMigrationCheckPerformedKey];
264-
#else
264+
#elif TARGET_OS_IOS && !TARGET_OS_MACCATALYST
265265
[[_mockUserDefaults expect] setBool:YES forKey:kGTMAppAuthMigrationCheckPerformedKey];
266-
#endif // TARGET_OS_OSX || TARGET_OS_MACCATALYST
266+
#endif // TARGET_OS_OSX
267267

268268
GIDAuthStateMigration *migration =
269269
[[GIDAuthStateMigration alloc] initWithKeychainStore:_mockGTMKeychainStore];

0 commit comments

Comments
 (0)