From 4b445a813e7486ee78cfbf91262dd0e474fe2ee1 Mon Sep 17 00:00:00 2001 From: Matt Mathias Date: Fri, 1 Aug 2025 13:18:51 -0700 Subject: [PATCH 1/3] Assign to keychainStore asap in initializer --- GoogleSignIn/Sources/GIDSignIn.m | 3 ++- .../DaysUntilBirthday.xcodeproj/project.pbxproj | 6 +++--- .../Swift/DaysUntilBirthday/Shared/DaysUntilBirthday.swift | 1 + 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/GoogleSignIn/Sources/GIDSignIn.m b/GoogleSignIn/Sources/GIDSignIn.m index 48b6d749..4c9457da 100644 --- a/GoogleSignIn/Sources/GIDSignIn.m +++ b/GoogleSignIn/Sources/GIDSignIn.m @@ -541,6 +541,8 @@ - (instancetype)initWithKeychainStore:(GTMKeychainStore *)keychainStore authStateMigrationService:(GIDAuthStateMigration *)authStateMigrationService { self = [super init]; if (self) { + _keychainStore = keychainStore; + // Get the bundle of the current executable. NSBundle *bundle = NSBundle.mainBundle; @@ -564,7 +566,6 @@ - (instancetype)initWithKeychainStore:(GTMKeychainStore *)keychainStore _appAuthConfiguration = [[OIDServiceConfiguration alloc] initWithAuthorizationEndpoint:[NSURL URLWithString:authorizationEnpointURL] tokenEndpoint:[NSURL URLWithString:tokenEndpointURL]]; - _keychainStore = keychainStore; // Perform migration of auth state from old versions of the SDK if needed. [authStateMigrationService migrateIfNeededWithTokenURL:_appAuthConfiguration.tokenEndpoint callbackPath:kBrowserCallbackPath diff --git a/Samples/Swift/DaysUntilBirthday/DaysUntilBirthday.xcodeproj/project.pbxproj b/Samples/Swift/DaysUntilBirthday/DaysUntilBirthday.xcodeproj/project.pbxproj index 4c12414e..0db19efa 100644 --- a/Samples/Swift/DaysUntilBirthday/DaysUntilBirthday.xcodeproj/project.pbxproj +++ b/Samples/Swift/DaysUntilBirthday/DaysUntilBirthday.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 52; + objectVersion = 54; objects = { /* Begin PBXBuildFile section */ @@ -556,7 +556,7 @@ CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; DEVELOPMENT_ASSET_PATHS = "\"iOS/Preview Content\""; - DEVELOPMENT_TEAM = ""; + DEVELOPMENT_TEAM = 93P2X7NCZC; ENABLE_PREVIEWS = YES; INFOPLIST_FILE = iOS/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 14.0; @@ -580,7 +580,7 @@ CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; DEVELOPMENT_ASSET_PATHS = "\"iOS/Preview Content\""; - DEVELOPMENT_TEAM = ""; + DEVELOPMENT_TEAM = 93P2X7NCZC; ENABLE_PREVIEWS = YES; INFOPLIST_FILE = iOS/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 14.0; diff --git a/Samples/Swift/DaysUntilBirthday/Shared/DaysUntilBirthday.swift b/Samples/Swift/DaysUntilBirthday/Shared/DaysUntilBirthday.swift index afa3083f..c2a77433 100644 --- a/Samples/Swift/DaysUntilBirthday/Shared/DaysUntilBirthday.swift +++ b/Samples/Swift/DaysUntilBirthday/Shared/DaysUntilBirthday.swift @@ -26,6 +26,7 @@ struct DaysUntilBirthday: App { ContentView() .environmentObject(authViewModel) .onAppear { + GIDSignIn.sharedInstance.restorePreviousSignIn { user, error in if let user = user { self.authViewModel.state = .signedIn(user) From d70c48d7841eb1b3e297fcb35603bba79d89c007 Mon Sep 17 00:00:00 2001 From: Matt Mathias Date: Thu, 21 Aug 2025 12:20:03 -0700 Subject: [PATCH 2/3] Do not remove keychain entries on reinstall --- GoogleSignIn/Sources/GIDSignIn.m | 5 ----- .../DaysUntilBirthday.xcodeproj/project.pbxproj | 4 ++-- .../Swift/DaysUntilBirthday/Shared/DaysUntilBirthday.swift | 1 - 3 files changed, 2 insertions(+), 8 deletions(-) diff --git a/GoogleSignIn/Sources/GIDSignIn.m b/GoogleSignIn/Sources/GIDSignIn.m index 4c9457da..1c043735 100644 --- a/GoogleSignIn/Sources/GIDSignIn.m +++ b/GoogleSignIn/Sources/GIDSignIn.m @@ -554,11 +554,6 @@ - (instancetype)initWithKeychainStore:(GTMKeychainStore *)keychainStore // Check to see if the 3P app is being run for the first time after a fresh install. BOOL isFreshInstall = [self isFreshInstall]; - // If this is a fresh install, ensure that any pre-existing keychain data is purged. - if (isFreshInstall) { - [self removeAllKeychainEntries]; - } - NSString *authorizationEnpointURL = [NSString stringWithFormat:kAuthorizationURLTemplate, [GIDSignInPreferences googleAuthorizationServer]]; NSString *tokenEndpointURL = [NSString stringWithFormat:kTokenURLTemplate, diff --git a/Samples/Swift/DaysUntilBirthday/DaysUntilBirthday.xcodeproj/project.pbxproj b/Samples/Swift/DaysUntilBirthday/DaysUntilBirthday.xcodeproj/project.pbxproj index 0db19efa..53d18171 100644 --- a/Samples/Swift/DaysUntilBirthday/DaysUntilBirthday.xcodeproj/project.pbxproj +++ b/Samples/Swift/DaysUntilBirthday/DaysUntilBirthday.xcodeproj/project.pbxproj @@ -556,7 +556,7 @@ CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; DEVELOPMENT_ASSET_PATHS = "\"iOS/Preview Content\""; - DEVELOPMENT_TEAM = 93P2X7NCZC; + DEVELOPMENT_TEAM = ""; ENABLE_PREVIEWS = YES; INFOPLIST_FILE = iOS/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 14.0; @@ -580,7 +580,7 @@ CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; DEVELOPMENT_ASSET_PATHS = "\"iOS/Preview Content\""; - DEVELOPMENT_TEAM = 93P2X7NCZC; + DEVELOPMENT_TEAM = ""; ENABLE_PREVIEWS = YES; INFOPLIST_FILE = iOS/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 14.0; diff --git a/Samples/Swift/DaysUntilBirthday/Shared/DaysUntilBirthday.swift b/Samples/Swift/DaysUntilBirthday/Shared/DaysUntilBirthday.swift index c2a77433..afa3083f 100644 --- a/Samples/Swift/DaysUntilBirthday/Shared/DaysUntilBirthday.swift +++ b/Samples/Swift/DaysUntilBirthday/Shared/DaysUntilBirthday.swift @@ -26,7 +26,6 @@ struct DaysUntilBirthday: App { ContentView() .environmentObject(authViewModel) .onAppear { - GIDSignIn.sharedInstance.restorePreviousSignIn { user, error in if let user = user { self.authViewModel.state = .signedIn(user) From 5e8393adaa4bee2f1373ce3125e77d6f5d9cc11e Mon Sep 17 00:00:00 2001 From: Matt Mathias Date: Fri, 22 Aug 2025 15:41:16 -0700 Subject: [PATCH 3/3] Revert objectVersion increment in pbxproj --- .../DaysUntilBirthday.xcodeproj/project.pbxproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Samples/Swift/DaysUntilBirthday/DaysUntilBirthday.xcodeproj/project.pbxproj b/Samples/Swift/DaysUntilBirthday/DaysUntilBirthday.xcodeproj/project.pbxproj index 53d18171..4c12414e 100644 --- a/Samples/Swift/DaysUntilBirthday/DaysUntilBirthday.xcodeproj/project.pbxproj +++ b/Samples/Swift/DaysUntilBirthday/DaysUntilBirthday.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 54; + objectVersion = 52; objects = { /* Begin PBXBuildFile section */