Skip to content

Commit fee0bbf

Browse files
[google_sign_in] Remove the public iOS handleOpen helper (#13273)
Makes `handleOpen` a macOS-only `FlutterAppLifecycleDelegate` witness and moves shared GID URL forwarding into an internal helper. On iOS, scene URL handling and tests call that helper directly, so `handleOpen` is no longer part of the plugin's public API. The original Obj-C plugin did not expose this helper on iOS; it was added during the Swift migration. Fixes flutter/flutter#194462 ## Pre-Review Checklist **Note**: The Flutter team is currently trialing the use of [Gemini Code Assist for GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code). Comments from the `gemini-code-assist` bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, you can wait for a Flutter team member's review for guidance on which automated comments should be addressed. [^1]: Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling.
1 parent 437a0ff commit fee0bbf

4 files changed

Lines changed: 18 additions & 7 deletions

File tree

‎packages/google_sign_in/google_sign_in_ios/CHANGELOG.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 6.3.8
2+
3+
* Removes the public iOS `handleOpen` helper. On macOS `handleOpen` remains public because it implements `FlutterAppLifecycleDelegate`.
4+
15
## 6.3.7
26

37
* Converts the plugin to Swift-only by removing the Objective-C exception catcher. SDK configuration failures now crash natively instead of being reported as Dart errors.

‎packages/google_sign_in/google_sign_in_ios/darwin/Tests/GoogleSignInTests.swift‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -803,23 +803,23 @@ struct GoogleSignInPluginTests {
803803
}
804804
#endif
805805

806-
@Test func handleOpen() {
806+
@Test func handleOpenURLs() {
807807
let (plugin, fakeSignIn) = createTestPlugin()
808808
let firstURL = URL(string: "com.googleusercontent.apps.test:/oauthredirect")!
809809
let secondURL = URL(string: "com.googleusercontent.apps.test:/another")!
810810

811-
let handled = plugin.handleOpen([firstURL, secondURL])
811+
let handled = plugin.handleOpenURLs([firstURL, secondURL])
812812

813813
#expect(handled == true)
814814
#expect(fakeSignIn.handledURLs == [firstURL, secondURL])
815815
}
816816

817-
@Test func handleOpenReturnsHandleResult() {
817+
@Test func handleOpenURLsReturnsHandleResult() {
818818
let (plugin, fakeSignIn) = createTestPlugin()
819819
let url = URL(string: "com.googleusercontent.apps.test:/oauthredirect")!
820820
fakeSignIn.handleURLResult = false
821821

822-
let handled = plugin.handleOpen([url])
822+
let handled = plugin.handleOpenURLs([url])
823823

824824
#expect(handled == false)
825825
#expect(fakeSignIn.handledURLs == [url])

‎packages/google_sign_in/google_sign_in_ios/darwin/google_sign_in_ios/Sources/google_sign_in_ios/GoogleSignInPlugin.swift‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,12 +164,19 @@ public final class GoogleSignInPlugin: NSObject, FlutterPlugin, GoogleSignInApi
164164
}
165165
#endif
166166

167+
#if os(macOS)
168+
/// Implements `FlutterAppLifecycleDelegate.handleOpenURLs`.
169+
public func handleOpen(_ urls: [URL]) -> Bool {
170+
return handleOpenURLs(urls)
171+
}
172+
#endif
173+
167174
/// Forwards each URL to GIDSignIn.
168175
///
169176
/// Returns `true` if GIDSignIn handled any of the URLs. On iOS this is also
170177
/// used from scene URL handling so tests can cover that path without
171178
/// constructing `UIOpenURLContext`.
172-
public func handleOpen(_ urls: [URL]) -> Bool {
179+
func handleOpenURLs(_ urls: [URL]) -> Bool {
173180
var handled = false
174181
for url in urls {
175182
handled = signIn.handle(url) || handled
@@ -440,7 +447,7 @@ public final class GoogleSignInPlugin: NSObject, FlutterPlugin, GoogleSignInApi
440447
extension GoogleSignInPlugin: FlutterSceneLifeCycleDelegate {
441448
public func scene(_ scene: UIScene, openURLContexts urlContexts: Set<UIOpenURLContext>) -> Bool
442449
{
443-
return handleOpen(urlContexts.map { $0.url })
450+
return handleOpenURLs(urlContexts.map { $0.url })
444451
}
445452
}
446453
#endif

‎packages/google_sign_in/google_sign_in_ios/pubspec.yaml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: google_sign_in_ios
22
description: iOS implementation of the google_sign_in plugin.
33
repository: https://github.com/flutter/packages/tree/main/packages/google_sign_in/google_sign_in_ios
44
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+google_sign_in%22
5-
version: 6.3.7
5+
version: 6.3.8
66

77
environment:
88
sdk: ^3.11.0

0 commit comments

Comments
 (0)