From 1914008f7b45f65ca148bfb1dfc95ea403e12f5c Mon Sep 17 00:00:00 2001 From: Neil Self Date: Tue, 4 Feb 2025 19:38:26 -0800 Subject: [PATCH 01/29] Add a sign-in field to allow Android clients to explicitly specify an account name. This capability is only available within Android for the underlying libraries. --- .../google_sign_in/example/pubspec.yaml | 5 + .../google_sign_in/lib/google_sign_in.dart | 5 + .../google_sign_in/pubspec.yaml | 5 + .../test/google_sign_in_test.dart | 17 ++ .../googlesignin/GoogleSignInPlugin.java | 5 + .../plugins/googlesignin/Messages.java | 157 ++++++++---------- .../googlesignin/GoogleSignInTest.java | 40 ++++- .../example/pubspec.yaml | 5 + .../lib/google_sign_in_android.dart | 3 + .../lib/src/messages.g.dart | 85 ++++------ .../pigeons/messages.dart | 2 + .../google_sign_in_android/pubspec.yaml | 5 + .../test/google_sign_in_android_test.dart | 2 + .../google_sign_in_ios/example/pubspec.yaml | 5 + .../lib/google_sign_in_ios.dart | 5 + .../google_sign_in_ios/pubspec.yaml | 5 + .../test/google_sign_in_ios_test.dart | 14 ++ .../src/method_channel_google_sign_in.dart | 5 +- .../lib/src/types.dart | 6 + .../method_channel_google_sign_in_test.dart | 8 +- .../google_sign_in_web_test.dart | 11 ++ .../google_sign_in_web/example/pubspec.yaml | 5 + .../lib/google_sign_in_web.dart | 3 + .../google_sign_in_web/pubspec.yaml | 5 + 24 files changed, 263 insertions(+), 145 deletions(-) diff --git a/packages/google_sign_in/google_sign_in/example/pubspec.yaml b/packages/google_sign_in/google_sign_in/example/pubspec.yaml index 5335068734a..8c77891dea3 100644 --- a/packages/google_sign_in/google_sign_in/example/pubspec.yaml +++ b/packages/google_sign_in/google_sign_in/example/pubspec.yaml @@ -28,3 +28,8 @@ dev_dependencies: flutter: uses-material-design: true + +# FOR TESTING AND INITIAL REVIEW ONLY. DO NOT MERGE. +# See https://github.com/flutter/flutter/blob/master/docs/ecosystem/contributing/README.md#changing-federated-plugins +dependency_overrides: + {google_sign_in_android: {path: ../../../../packages/google_sign_in/google_sign_in_android}, google_sign_in_ios: {path: ../../../../packages/google_sign_in/google_sign_in_ios}, google_sign_in_platform_interface: {path: ../../../../packages/google_sign_in/google_sign_in_platform_interface}} diff --git a/packages/google_sign_in/google_sign_in/lib/google_sign_in.dart b/packages/google_sign_in/google_sign_in/lib/google_sign_in.dart index ed11f0f512e..7e3a0891d05 100644 --- a/packages/google_sign_in/google_sign_in/lib/google_sign_in.dart +++ b/packages/google_sign_in/google_sign_in/lib/google_sign_in.dart @@ -187,6 +187,7 @@ class GoogleSignIn { this.clientId, this.serverClientId, this.forceCodeForRefreshToken = false, + this.forceAccountName, }) { // Start initializing. if (kIsWeb) { @@ -263,6 +264,9 @@ class GoogleSignIn { /// Force the authorization code to be valid for a refresh token every time. Only needed on Android. final bool forceCodeForRefreshToken; + /// Explicitly specifies the account name to be used in sign-in. Only used on Android. + final String? forceAccountName; + final StreamController _currentUserController = StreamController.broadcast(); @@ -317,6 +321,7 @@ class GoogleSignIn { clientId: clientId, serverClientId: serverClientId, forceCodeForRefreshToken: forceCodeForRefreshToken, + forceAccountName: forceAccountName, )); unawaited(GoogleSignInPlatform.instance.userDataEvents diff --git a/packages/google_sign_in/google_sign_in/pubspec.yaml b/packages/google_sign_in/google_sign_in/pubspec.yaml index ee1a1e0b61d..fbff11b81d7 100644 --- a/packages/google_sign_in/google_sign_in/pubspec.yaml +++ b/packages/google_sign_in/google_sign_in/pubspec.yaml @@ -49,3 +49,8 @@ false_secrets: - /example/ios/RunnerTests/GoogleService-Info.plist - /example/ios/RunnerTests/GoogleSignInTests.m - /example/macos/Runner/Info.plist + +# FOR TESTING AND INITIAL REVIEW ONLY. DO NOT MERGE. +# See https://github.com/flutter/flutter/blob/master/docs/ecosystem/contributing/README.md#changing-federated-plugins +dependency_overrides: + {google_sign_in_android: {path: ../../../packages/google_sign_in/google_sign_in_android}, google_sign_in_ios: {path: ../../../packages/google_sign_in/google_sign_in_ios}, google_sign_in_platform_interface: {path: ../../../packages/google_sign_in/google_sign_in_platform_interface}} diff --git a/packages/google_sign_in/google_sign_in/test/google_sign_in_test.dart b/packages/google_sign_in/google_sign_in/test/google_sign_in_test.dart index 9ca4124157f..6a3521ea306 100644 --- a/packages/google_sign_in/google_sign_in/test/google_sign_in_test.dart +++ b/packages/google_sign_in/google_sign_in/test/google_sign_in_test.dart @@ -113,6 +113,17 @@ void main() { verify(mockPlatform.signIn()); }); + test('forceAccountName sent with init method call', () async { + final GoogleSignIn googleSignIn = + GoogleSignIn(forceAccountName: 'fakeEmailAddress@google.com'); + + await googleSignIn.signIn(); + + _verifyInit(mockPlatform, + forceAccountName: 'fakeEmailAddress@google.com'); + verify(mockPlatform.signIn()); + }); + test('signOut', () async { final GoogleSignIn googleSignIn = GoogleSignIn(); @@ -447,6 +458,7 @@ void _verifyInit( String? clientId, String? serverClientId, bool forceCodeForRefreshToken = false, + String? forceAccountName, }) { verify(mockSignIn.initWithParams(argThat( isA() @@ -479,6 +491,11 @@ void _verifyInit( (SignInInitParameters p) => p.forceCodeForRefreshToken, 'forceCodeForRefreshToken', forceCodeForRefreshToken, + ) + .having( + (SignInInitParameters p) => p.forceAccountName, + 'forceAccountName', + forceAccountName, ), ))); } diff --git a/packages/google_sign_in/google_sign_in_android/android/src/main/java/io/flutter/plugins/googlesignin/GoogleSignInPlugin.java b/packages/google_sign_in/google_sign_in_android/android/src/main/java/io/flutter/plugins/googlesignin/GoogleSignInPlugin.java index 92f3f9927df..fb3fc08e720 100644 --- a/packages/google_sign_in/google_sign_in_android/android/src/main/java/io/flutter/plugins/googlesignin/GoogleSignInPlugin.java +++ b/packages/google_sign_in/google_sign_in_android/android/src/main/java/io/flutter/plugins/googlesignin/GoogleSignInPlugin.java @@ -259,6 +259,11 @@ public void init(@NonNull Messages.InitParams params) { optionsBuilder.setHostedDomain(params.getHostedDomain()); } + String forceAccountName = params.getForceAccountName(); + if (!Strings.isNullOrEmpty(forceAccountName)) { + optionsBuilder.setAccountName(forceAccountName); + } + signInClient = googleSignInWrapper.getClient(context, optionsBuilder.build()); } catch (Exception e) { throw new FlutterError(ERROR_REASON_EXCEPTION, e.getMessage(), null); diff --git a/packages/google_sign_in/google_sign_in_android/android/src/main/java/io/flutter/plugins/googlesignin/Messages.java b/packages/google_sign_in/google_sign_in_android/android/src/main/java/io/flutter/plugins/googlesignin/Messages.java index 2bf6b6c1e06..14b5ccbd911 100644 --- a/packages/google_sign_in/google_sign_in_android/android/src/main/java/io/flutter/plugins/googlesignin/Messages.java +++ b/packages/google_sign_in/google_sign_in_android/android/src/main/java/io/flutter/plugins/googlesignin/Messages.java @@ -1,7 +1,7 @@ // Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Autogenerated from Pigeon (v22.4.2), do not edit directly. +// Autogenerated from Pigeon (v22.7.4), do not edit directly. // See also: https://pub.dev/packages/pigeon package io.flutter.plugins.googlesignin; @@ -21,7 +21,11 @@ import java.lang.annotation.Target; import java.nio.ByteBuffer; import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashMap; import java.util.List; +import java.util.Map; import java.util.Objects; /** Generated class from Pigeon. */ @@ -37,7 +41,8 @@ public static class FlutterError extends RuntimeException { /** The error details. Must be a datatype supported by the api codec. */ public final Object details; - public FlutterError(@NonNull String code, @Nullable String message, @Nullable Object details) { + public FlutterError(@NonNull String code, @Nullable String message, @Nullable Object details) + { super(message); this.code = code; this.details = details; @@ -56,7 +61,7 @@ protected static ArrayList wrapError(@NonNull Throwable exception) { errorList.add(exception.toString()); errorList.add(exception.getClass().getSimpleName()); errorList.add( - "Cause: " + exception.getCause() + ", Stacktrace: " + Log.getStackTraceString(exception)); + "Cause: " + exception.getCause() + ", Stacktrace: " + Log.getStackTraceString(exception)); } return errorList; } @@ -82,9 +87,9 @@ public enum SignInType { /** * Pigeon version of SignInInitParams. * - *

See SignInInitParams for details. + * See SignInInitParams for details. * - *

Generated class from Pigeon that represents data sent in messages. + * Generated class from Pigeon that represents data sent in messages. */ public static final class InitParams { private @NonNull List scopes; @@ -156,30 +161,30 @@ public void setForceCodeForRefreshToken(@NonNull Boolean setterArg) { this.forceCodeForRefreshToken = setterArg; } + private @Nullable String forceAccountName; + + public @Nullable String getForceAccountName() { + return forceAccountName; + } + + public void setForceAccountName(@Nullable String setterArg) { + this.forceAccountName = setterArg; + } + /** Constructor is non-public to enforce null safety; use Builder. */ InitParams() {} @Override public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } + if (this == o) { return true; } + if (o == null || getClass() != o.getClass()) { return false; } InitParams that = (InitParams) o; - return scopes.equals(that.scopes) - && signInType.equals(that.signInType) - && Objects.equals(hostedDomain, that.hostedDomain) - && Objects.equals(clientId, that.clientId) - && Objects.equals(serverClientId, that.serverClientId) - && forceCodeForRefreshToken.equals(that.forceCodeForRefreshToken); + return scopes.equals(that.scopes) && signInType.equals(that.signInType) && Objects.equals(hostedDomain, that.hostedDomain) && Objects.equals(clientId, that.clientId) && Objects.equals(serverClientId, that.serverClientId) && forceCodeForRefreshToken.equals(that.forceCodeForRefreshToken) && Objects.equals(forceAccountName, that.forceAccountName); } @Override public int hashCode() { - return Objects.hash( - scopes, signInType, hostedDomain, clientId, serverClientId, forceCodeForRefreshToken); + return Objects.hash(scopes, signInType, hostedDomain, clientId, serverClientId, forceCodeForRefreshToken, forceAccountName); } public static final class Builder { @@ -232,6 +237,14 @@ public static final class Builder { return this; } + private @Nullable String forceAccountName; + + @CanIgnoreReturnValue + public @NonNull Builder setForceAccountName(@Nullable String setterArg) { + this.forceAccountName = setterArg; + return this; + } + public @NonNull InitParams build() { InitParams pigeonReturn = new InitParams(); pigeonReturn.setScopes(scopes); @@ -240,19 +253,21 @@ public static final class Builder { pigeonReturn.setClientId(clientId); pigeonReturn.setServerClientId(serverClientId); pigeonReturn.setForceCodeForRefreshToken(forceCodeForRefreshToken); + pigeonReturn.setForceAccountName(forceAccountName); return pigeonReturn; } } @NonNull ArrayList toList() { - ArrayList toListResult = new ArrayList<>(6); + ArrayList toListResult = new ArrayList<>(7); toListResult.add(scopes); toListResult.add(signInType); toListResult.add(hostedDomain); toListResult.add(clientId); toListResult.add(serverClientId); toListResult.add(forceCodeForRefreshToken); + toListResult.add(forceAccountName); return toListResult; } @@ -270,6 +285,8 @@ ArrayList toList() { pigeonResult.setServerClientId((String) serverClientId); Object forceCodeForRefreshToken = pigeonVar_list.get(5); pigeonResult.setForceCodeForRefreshToken((Boolean) forceCodeForRefreshToken); + Object forceAccountName = pigeonVar_list.get(6); + pigeonResult.setForceAccountName((String) forceAccountName); return pigeonResult; } } @@ -277,9 +294,9 @@ ArrayList toList() { /** * Pigeon version of GoogleSignInUserData. * - *

See GoogleSignInUserData for details. + * See GoogleSignInUserData for details. * - *

Generated class from Pigeon that represents data sent in messages. + * Generated class from Pigeon that represents data sent in messages. */ public static final class UserData { private @Nullable String displayName; @@ -353,19 +370,10 @@ public void setServerAuthCode(@Nullable String setterArg) { @Override public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } + if (this == o) { return true; } + if (o == null || getClass() != o.getClass()) { return false; } UserData that = (UserData) o; - return Objects.equals(displayName, that.displayName) - && email.equals(that.email) - && id.equals(that.id) - && Objects.equals(photoUrl, that.photoUrl) - && Objects.equals(idToken, that.idToken) - && Objects.equals(serverAuthCode, that.serverAuthCode); + return Objects.equals(displayName, that.displayName) && email.equals(that.email) && id.equals(that.id) && Objects.equals(photoUrl, that.photoUrl) && Objects.equals(idToken, that.idToken) && Objects.equals(serverAuthCode, that.serverAuthCode); } @Override @@ -473,11 +481,10 @@ private PigeonCodec() {} @Override protected Object readValueOfType(byte type, @NonNull ByteBuffer buffer) { switch (type) { - case (byte) 129: - { - Object value = readValue(buffer); - return value == null ? null : SignInType.values()[((Long) value).intValue()]; - } + case (byte) 129: { + Object value = readValue(buffer); + return value == null ? null : SignInType.values()[((Long) value).intValue()]; + } case (byte) 130: return InitParams.fromList((ArrayList) readValue(buffer)); case (byte) 131: @@ -504,6 +511,7 @@ protected void writeValue(@NonNull ByteArrayOutputStream stream, Object value) { } } + /** Asynchronous error handling return type for non-nullable API method returns. */ public interface Result { /** Success case callback method for handling returns. */ @@ -537,16 +545,18 @@ public interface GoogleSignInApi { /** Starts a sign in with user interaction. */ void signIn(@NonNull Result result); /** Requests the access token for the current sign in. */ - void getAccessToken( - @NonNull String email, @NonNull Boolean shouldRecoverAuth, @NonNull Result result); + void getAccessToken(@NonNull String email, @NonNull Boolean shouldRecoverAuth, @NonNull Result result); /** Signs out the current user. */ void signOut(@NonNull VoidResult result); /** Revokes scope grants to the application. */ void disconnect(@NonNull VoidResult result); /** Returns whether the user is currently signed in. */ - @NonNull + @NonNull Boolean isSignedIn(); - /** Clears the authentication caching for the given token, requiring a new sign in. */ + /** + * Clears the authentication caching for the given token, requiring a + * new sign in. + */ void clearAuthCache(@NonNull String token, @NonNull VoidResult result); /** Requests access to the given scopes. */ void requestScopes(@NonNull List scopes, @NonNull Result result); @@ -555,25 +565,16 @@ void getAccessToken( static @NonNull MessageCodec getCodec() { return PigeonCodec.INSTANCE; } - /** - * Sets up an instance of `GoogleSignInApi` to handle messages through the `binaryMessenger`. - */ + /**Sets up an instance of `GoogleSignInApi` to handle messages through the `binaryMessenger`. */ static void setUp(@NonNull BinaryMessenger binaryMessenger, @Nullable GoogleSignInApi api) { setUp(binaryMessenger, "", api); } - - static void setUp( - @NonNull BinaryMessenger binaryMessenger, - @NonNull String messageChannelSuffix, - @Nullable GoogleSignInApi api) { + static void setUp(@NonNull BinaryMessenger binaryMessenger, @NonNull String messageChannelSuffix, @Nullable GoogleSignInApi api) { messageChannelSuffix = messageChannelSuffix.isEmpty() ? "" : "." + messageChannelSuffix; { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.google_sign_in_android.GoogleSignInApi.init" - + messageChannelSuffix, - getCodec()); + binaryMessenger, "dev.flutter.pigeon.google_sign_in_android.GoogleSignInApi.init" + messageChannelSuffix, getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -583,7 +584,8 @@ static void setUp( try { api.init(paramsArg); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { wrapped = wrapError(exception); } reply.reply(wrapped); @@ -595,10 +597,7 @@ static void setUp( { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.google_sign_in_android.GoogleSignInApi.signInSilently" - + messageChannelSuffix, - getCodec()); + binaryMessenger, "dev.flutter.pigeon.google_sign_in_android.GoogleSignInApi.signInSilently" + messageChannelSuffix, getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -625,10 +624,7 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.google_sign_in_android.GoogleSignInApi.signIn" - + messageChannelSuffix, - getCodec()); + binaryMessenger, "dev.flutter.pigeon.google_sign_in_android.GoogleSignInApi.signIn" + messageChannelSuffix, getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -655,10 +651,7 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.google_sign_in_android.GoogleSignInApi.getAccessToken" - + messageChannelSuffix, - getCodec()); + binaryMessenger, "dev.flutter.pigeon.google_sign_in_android.GoogleSignInApi.getAccessToken" + messageChannelSuffix, getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -688,10 +681,7 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.google_sign_in_android.GoogleSignInApi.signOut" - + messageChannelSuffix, - getCodec()); + binaryMessenger, "dev.flutter.pigeon.google_sign_in_android.GoogleSignInApi.signOut" + messageChannelSuffix, getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -718,10 +708,7 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.google_sign_in_android.GoogleSignInApi.disconnect" - + messageChannelSuffix, - getCodec()); + binaryMessenger, "dev.flutter.pigeon.google_sign_in_android.GoogleSignInApi.disconnect" + messageChannelSuffix, getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -748,10 +735,7 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.google_sign_in_android.GoogleSignInApi.isSignedIn" - + messageChannelSuffix, - getCodec()); + binaryMessenger, "dev.flutter.pigeon.google_sign_in_android.GoogleSignInApi.isSignedIn" + messageChannelSuffix, getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -759,7 +743,8 @@ public void error(Throwable error) { try { Boolean output = api.isSignedIn(); wrapped.add(0, output); - } catch (Throwable exception) { + } + catch (Throwable exception) { wrapped = wrapError(exception); } reply.reply(wrapped); @@ -771,10 +756,7 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.google_sign_in_android.GoogleSignInApi.clearAuthCache" - + messageChannelSuffix, - getCodec()); + binaryMessenger, "dev.flutter.pigeon.google_sign_in_android.GoogleSignInApi.clearAuthCache" + messageChannelSuffix, getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -803,10 +785,7 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.google_sign_in_android.GoogleSignInApi.requestScopes" - + messageChannelSuffix, - getCodec()); + binaryMessenger, "dev.flutter.pigeon.google_sign_in_android.GoogleSignInApi.requestScopes" + messageChannelSuffix, getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { diff --git a/packages/google_sign_in/google_sign_in_android/android/src/test/java/io/flutter/plugins/googlesignin/GoogleSignInTest.java b/packages/google_sign_in/google_sign_in_android/android/src/test/java/io/flutter/plugins/googlesignin/GoogleSignInTest.java index 03853740b4e..d27988def50 100644 --- a/packages/google_sign_in/google_sign_in_android/android/src/test/java/io/flutter/plugins/googlesignin/GoogleSignInTest.java +++ b/packages/google_sign_in/google_sign_in_android/android/src/test/java/io/flutter/plugins/googlesignin/GoogleSignInTest.java @@ -284,6 +284,13 @@ public void init_PassesForceCodeForRefreshTokenTrueWithServerClientIdFromResourc initAndAssertForceCodeForRefreshToken(params, true); } + @Test + public void init_PassesForceAccountName() { + InitParams params = buildInitParams("fakeClientId", "fakeServerClientId", 'fakeEmailAddress@google.com'); + + initAndAssertForceAccountName(params, 'fakeEmailAddress@google.com'); + } + public void initAndAssertServerClientId(InitParams params, String serverClientId) { ArgumentCaptor optionsCaptor = ArgumentCaptor.forClass(GoogleSignInOptions.class); @@ -304,9 +311,20 @@ public void initAndAssertForceCodeForRefreshToken( forceCodeForRefreshToken, optionsCaptor.getValue().isForceCodeForRefreshToken()); } + public void initAndAssertForceAccountName( + InitParams params, String forceAccountName) { + ArgumentCaptor optionsCaptor = + ArgumentCaptor.forClass(GoogleSignInOptions.class); + when(mockGoogleSignIn.getClient(any(Context.class), optionsCaptor.capture())) + .thenReturn(mockClient); + plugin.init(params); + Assert.assertEquals( + forceAccountName, optionsCaptor.getValue().isForceAccountName()); + } + private static InitParams buildInitParams(String clientId, String serverClientId) { return buildInitParams( - Messages.SignInType.STANDARD, Collections.emptyList(), clientId, serverClientId, false); + Messages.SignInType.STANDARD, Collections.emptyList(), clientId, serverClientId, false, null); } private static InitParams buildInitParams( @@ -316,7 +334,19 @@ private static InitParams buildInitParams( Collections.emptyList(), clientId, serverClientId, - forceCodeForRefreshToken); + forceCodeForRefreshToken, + null); + } + + private static InitParams buildInitParams( + String clientId, String serverClientId, String forceAccountName) { + return buildInitParams( + Messages.SignInType.STANDARD, + Collections.emptyList(), + clientId, + serverClientId, + false, + forceAccountName); } private static InitParams buildInitParams( @@ -324,7 +354,8 @@ private static InitParams buildInitParams( List scopes, String clientId, String serverClientId, - boolean forceCodeForRefreshToken) { + boolean forceCodeForRefreshToken, + String forceAccountName) { InitParams.Builder builder = new InitParams.Builder(); builder.setSignInType(signInType); builder.setScopes(scopes); @@ -335,6 +366,9 @@ private static InitParams buildInitParams( builder.setServerClientId(serverClientId); } builder.setForceCodeForRefreshToken(forceCodeForRefreshToken); + if (forceAccountName != null) { + builder.setForceAccountName(forceAccountName); + } return builder.build(); } } diff --git a/packages/google_sign_in/google_sign_in_android/example/pubspec.yaml b/packages/google_sign_in/google_sign_in_android/example/pubspec.yaml index 0adb6d9f80f..8b69836ff95 100644 --- a/packages/google_sign_in/google_sign_in_android/example/pubspec.yaml +++ b/packages/google_sign_in/google_sign_in_android/example/pubspec.yaml @@ -28,3 +28,8 @@ dev_dependencies: flutter: uses-material-design: true + +# FOR TESTING AND INITIAL REVIEW ONLY. DO NOT MERGE. +# See https://github.com/flutter/flutter/blob/master/docs/ecosystem/contributing/README.md#changing-federated-plugins +dependency_overrides: + {google_sign_in_platform_interface: {path: ../../../../packages/google_sign_in/google_sign_in_platform_interface}} diff --git a/packages/google_sign_in/google_sign_in_android/lib/google_sign_in_android.dart b/packages/google_sign_in/google_sign_in_android/lib/google_sign_in_android.dart index fda32600fa9..a064fba20de 100644 --- a/packages/google_sign_in/google_sign_in_android/lib/google_sign_in_android.dart +++ b/packages/google_sign_in/google_sign_in_android/lib/google_sign_in_android.dart @@ -29,12 +29,14 @@ class GoogleSignInAndroid extends GoogleSignInPlatform { SignInOption signInOption = SignInOption.standard, String? hostedDomain, String? clientId, + String? forceAccountName, }) { return initWithParams(SignInInitParameters( signInOption: signInOption, scopes: scopes, hostedDomain: hostedDomain, clientId: clientId, + forceAccountName: forceAccountName, )); } @@ -47,6 +49,7 @@ class GoogleSignInAndroid extends GoogleSignInPlatform { clientId: params.clientId, serverClientId: params.serverClientId, forceCodeForRefreshToken: params.forceCodeForRefreshToken, + forceAccountName: params.forceAccountName, )); } diff --git a/packages/google_sign_in/google_sign_in_android/lib/src/messages.g.dart b/packages/google_sign_in/google_sign_in_android/lib/src/messages.g.dart index c5a7367318c..5d4ebf0c833 100644 --- a/packages/google_sign_in/google_sign_in_android/lib/src/messages.g.dart +++ b/packages/google_sign_in/google_sign_in_android/lib/src/messages.g.dart @@ -1,7 +1,7 @@ // Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Autogenerated from Pigeon (v22.4.2), do not edit directly. +// Autogenerated from Pigeon (v22.7.4), do not edit directly. // See also: https://pub.dev/packages/pigeon // ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, unused_shown_name, unnecessary_import, no_leading_underscores_for_local_identifiers @@ -22,7 +22,6 @@ PlatformException _createConnectionError(String channelName) { enum SignInType { /// Default configuration. standard, - /// Recommended configuration for game sign in. games, } @@ -38,6 +37,7 @@ class InitParams { this.clientId, this.serverClientId, this.forceCodeForRefreshToken = false, + this.forceAccountName, }); List scopes; @@ -52,6 +52,8 @@ class InitParams { bool forceCodeForRefreshToken; + String? forceAccountName; + Object encode() { return [ scopes, @@ -60,6 +62,7 @@ class InitParams { clientId, serverClientId, forceCodeForRefreshToken, + forceAccountName, ]; } @@ -72,6 +75,7 @@ class InitParams { clientId: result[3] as String?, serverClientId: result[4] as String?, forceCodeForRefreshToken: result[5]! as bool, + forceAccountName: result[6] as String?, ); } } @@ -125,6 +129,7 @@ class UserData { } } + class _PigeonCodec extends StandardMessageCodec { const _PigeonCodec(); @override @@ -132,13 +137,13 @@ class _PigeonCodec extends StandardMessageCodec { if (value is int) { buffer.putUint8(4); buffer.putInt64(value); - } else if (value is SignInType) { + } else if (value is SignInType) { buffer.putUint8(129); writeValue(buffer, value.index); - } else if (value is InitParams) { + } else if (value is InitParams) { buffer.putUint8(130); writeValue(buffer, value.encode()); - } else if (value is UserData) { + } else if (value is UserData) { buffer.putUint8(131); writeValue(buffer, value.encode()); } else { @@ -149,12 +154,12 @@ class _PigeonCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 129: + case 129: final int? value = readValue(buffer) as int?; return value == null ? null : SignInType.values[value]; - case 130: + case 130: return InitParams.decode(readValue(buffer)!); - case 131: + case 131: return UserData.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); @@ -166,11 +171,9 @@ class GoogleSignInApi { /// Constructor for [GoogleSignInApi]. The [binaryMessenger] named argument is /// available for dependency injection. If it is left null, the default /// BinaryMessenger will be used which routes to the host platform. - GoogleSignInApi( - {BinaryMessenger? binaryMessenger, String messageChannelSuffix = ''}) + GoogleSignInApi({BinaryMessenger? binaryMessenger, String messageChannelSuffix = ''}) : pigeonVar_binaryMessenger = binaryMessenger, - pigeonVar_messageChannelSuffix = - messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; + pigeonVar_messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; final BinaryMessenger? pigeonVar_binaryMessenger; static const MessageCodec pigeonChannelCodec = _PigeonCodec(); @@ -179,10 +182,8 @@ class GoogleSignInApi { /// Initializes a sign in request with the given parameters. Future init(InitParams params) async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.google_sign_in_android.GoogleSignInApi.init$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( + final String pigeonVar_channelName = 'dev.flutter.pigeon.google_sign_in_android.GoogleSignInApi.init$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -204,10 +205,8 @@ class GoogleSignInApi { /// Starts a silent sign in. Future signInSilently() async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.google_sign_in_android.GoogleSignInApi.signInSilently$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( + final String pigeonVar_channelName = 'dev.flutter.pigeon.google_sign_in_android.GoogleSignInApi.signInSilently$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -234,10 +233,8 @@ class GoogleSignInApi { /// Starts a sign in with user interaction. Future signIn() async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.google_sign_in_android.GoogleSignInApi.signIn$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( + final String pigeonVar_channelName = 'dev.flutter.pigeon.google_sign_in_android.GoogleSignInApi.signIn$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -264,16 +261,14 @@ class GoogleSignInApi { /// Requests the access token for the current sign in. Future getAccessToken(String email, bool shouldRecoverAuth) async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.google_sign_in_android.GoogleSignInApi.getAccessToken$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( + final String pigeonVar_channelName = 'dev.flutter.pigeon.google_sign_in_android.GoogleSignInApi.getAccessToken$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final List? pigeonVar_replyList = await pigeonVar_channel - .send([email, shouldRecoverAuth]) as List?; + final List? pigeonVar_replyList = + await pigeonVar_channel.send([email, shouldRecoverAuth]) as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -294,10 +289,8 @@ class GoogleSignInApi { /// Signs out the current user. Future signOut() async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.google_sign_in_android.GoogleSignInApi.signOut$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( + final String pigeonVar_channelName = 'dev.flutter.pigeon.google_sign_in_android.GoogleSignInApi.signOut$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -319,10 +312,8 @@ class GoogleSignInApi { /// Revokes scope grants to the application. Future disconnect() async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.google_sign_in_android.GoogleSignInApi.disconnect$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( + final String pigeonVar_channelName = 'dev.flutter.pigeon.google_sign_in_android.GoogleSignInApi.disconnect$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -344,10 +335,8 @@ class GoogleSignInApi { /// Returns whether the user is currently signed in. Future isSignedIn() async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.google_sign_in_android.GoogleSignInApi.isSignedIn$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( + final String pigeonVar_channelName = 'dev.flutter.pigeon.google_sign_in_android.GoogleSignInApi.isSignedIn$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -375,10 +364,8 @@ class GoogleSignInApi { /// Clears the authentication caching for the given token, requiring a /// new sign in. Future clearAuthCache(String token) async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.google_sign_in_android.GoogleSignInApi.clearAuthCache$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( + final String pigeonVar_channelName = 'dev.flutter.pigeon.google_sign_in_android.GoogleSignInApi.clearAuthCache$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -400,10 +387,8 @@ class GoogleSignInApi { /// Requests access to the given scopes. Future requestScopes(List scopes) async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.google_sign_in_android.GoogleSignInApi.requestScopes$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( + final String pigeonVar_channelName = 'dev.flutter.pigeon.google_sign_in_android.GoogleSignInApi.requestScopes$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, diff --git a/packages/google_sign_in/google_sign_in_android/pigeons/messages.dart b/packages/google_sign_in/google_sign_in_android/pigeons/messages.dart index 69a452277df..b3fc0e2d84d 100644 --- a/packages/google_sign_in/google_sign_in_android/pigeons/messages.dart +++ b/packages/google_sign_in/google_sign_in_android/pigeons/messages.dart @@ -33,6 +33,7 @@ class InitParams { this.clientId, this.serverClientId, this.forceCodeForRefreshToken = false, + this.forceAccountName, }); final List scopes; @@ -41,6 +42,7 @@ class InitParams { final String? clientId; final String? serverClientId; final bool forceCodeForRefreshToken; + final String? forceAccountName; } /// Pigeon version of GoogleSignInUserData. diff --git a/packages/google_sign_in/google_sign_in_android/pubspec.yaml b/packages/google_sign_in/google_sign_in_android/pubspec.yaml index b47fba90059..1d44c4bfec5 100644 --- a/packages/google_sign_in/google_sign_in_android/pubspec.yaml +++ b/packages/google_sign_in/google_sign_in_android/pubspec.yaml @@ -39,3 +39,8 @@ topics: false_secrets: - /example/android/app/google-services.json - /example/lib/main.dart + +# FOR TESTING AND INITIAL REVIEW ONLY. DO NOT MERGE. +# See https://github.com/flutter/flutter/blob/master/docs/ecosystem/contributing/README.md#changing-federated-plugins +dependency_overrides: + {google_sign_in_platform_interface: {path: ../../../packages/google_sign_in/google_sign_in_platform_interface}} diff --git a/packages/google_sign_in/google_sign_in_android/test/google_sign_in_android_test.dart b/packages/google_sign_in/google_sign_in_android/test/google_sign_in_android_test.dart index e53b9a8f546..3b1097c9b14 100644 --- a/packages/google_sign_in/google_sign_in_android/test/google_sign_in_android_test.dart +++ b/packages/google_sign_in/google_sign_in_android/test/google_sign_in_android_test.dart @@ -143,6 +143,7 @@ void main() { clientId: 'fakeClientId', serverClientId: 'fakeServerClientId', forceCodeForRefreshToken: true, + forceAccountName: 'fakeEmailAddress@google.com', ); await googleSignIn.initWithParams(initParams); @@ -156,6 +157,7 @@ void main() { expect(passedParams.serverClientId, initParams.serverClientId); expect(passedParams.forceCodeForRefreshToken, initParams.forceCodeForRefreshToken); + expect(passedParams.forceAccountName, initParams.forceAccountName); }); test('clearAuthCache passes arguments', () async { diff --git a/packages/google_sign_in/google_sign_in_ios/example/pubspec.yaml b/packages/google_sign_in/google_sign_in_ios/example/pubspec.yaml index 03c1172bde9..98071cf930c 100644 --- a/packages/google_sign_in/google_sign_in_ios/example/pubspec.yaml +++ b/packages/google_sign_in/google_sign_in_ios/example/pubspec.yaml @@ -27,3 +27,8 @@ dev_dependencies: flutter: uses-material-design: true + +# FOR TESTING AND INITIAL REVIEW ONLY. DO NOT MERGE. +# See https://github.com/flutter/flutter/blob/master/docs/ecosystem/contributing/README.md#changing-federated-plugins +dependency_overrides: + {google_sign_in_platform_interface: {path: ../../../../packages/google_sign_in/google_sign_in_platform_interface}} diff --git a/packages/google_sign_in/google_sign_in_ios/lib/google_sign_in_ios.dart b/packages/google_sign_in/google_sign_in_ios/lib/google_sign_in_ios.dart index 1ddaadfd759..22c6333dac9 100644 --- a/packages/google_sign_in/google_sign_in_ios/lib/google_sign_in_ios.dart +++ b/packages/google_sign_in/google_sign_in_ios/lib/google_sign_in_ios.dart @@ -46,6 +46,11 @@ class GoogleSignInIOS extends GoogleSignInPlatform { code: 'unsupported-options', message: 'Games sign in is not supported on iOS'); } + if (params.forceAccountName != null) { + throw PlatformException( + code: 'unsupported-options', + message: 'Force account name is not supported on iOS'); + } return _api.init(InitParams( scopes: params.scopes, hostedDomain: params.hostedDomain, diff --git a/packages/google_sign_in/google_sign_in_ios/pubspec.yaml b/packages/google_sign_in/google_sign_in_ios/pubspec.yaml index 8b64480c662..a7cb5aa604e 100644 --- a/packages/google_sign_in/google_sign_in_ios/pubspec.yaml +++ b/packages/google_sign_in/google_sign_in_ios/pubspec.yaml @@ -46,3 +46,8 @@ false_secrets: - /example/ios/Runner/Info.plist - /example/lib/main.dart - /example/macos/Runner/Info.plist + +# FOR TESTING AND INITIAL REVIEW ONLY. DO NOT MERGE. +# See https://github.com/flutter/flutter/blob/master/docs/ecosystem/contributing/README.md#changing-federated-plugins +dependency_overrides: + {google_sign_in_platform_interface: {path: ../../../packages/google_sign_in/google_sign_in_platform_interface}} diff --git a/packages/google_sign_in/google_sign_in_ios/test/google_sign_in_ios_test.dart b/packages/google_sign_in/google_sign_in_ios/test/google_sign_in_ios_test.dart index d76bc978fc7..3fad69e469e 100644 --- a/packages/google_sign_in/google_sign_in_ios/test/google_sign_in_ios_test.dart +++ b/packages/google_sign_in/google_sign_in_ios/test/google_sign_in_ios_test.dart @@ -52,6 +52,20 @@ void main() { (PlatformException e) => e.code, 'code', 'unsupported-options'))); }); + test('init throws for forceAccountName', () async { + expect( + () => googleSignIn.initWithParams( + SignInInitParameters( + hostedDomain: 'example.com', + signInOption: SignInOption.games, + clientId: 'fakeClientId', +// forceAccountName: 'fakeEmailAddress@google.com', + ), + ), + throwsA(isInstanceOf().having( + (PlatformException e) => e.code, 'code', 'unsupported-options'))); + }); + test('signInSilently transforms platform data to GoogleSignInUserData', () async { when(api.signInSilently()).thenAnswer((_) async => UserData( diff --git a/packages/google_sign_in/google_sign_in_platform_interface/lib/src/method_channel_google_sign_in.dart b/packages/google_sign_in/google_sign_in_platform_interface/lib/src/method_channel_google_sign_in.dart index fde29aeb8e4..447ec826ed7 100644 --- a/packages/google_sign_in/google_sign_in_platform_interface/lib/src/method_channel_google_sign_in.dart +++ b/packages/google_sign_in/google_sign_in_platform_interface/lib/src/method_channel_google_sign_in.dart @@ -24,12 +24,14 @@ class MethodChannelGoogleSignIn extends GoogleSignInPlatform { SignInOption signInOption = SignInOption.standard, String? hostedDomain, String? clientId, + String? forceAccountName, }) { return initWithParams(SignInInitParameters( scopes: scopes, signInOption: signInOption, hostedDomain: hostedDomain, - clientId: clientId)); + clientId: clientId, + forceAccountName: forceAccountName)); } @override @@ -41,6 +43,7 @@ class MethodChannelGoogleSignIn extends GoogleSignInPlatform { 'clientId': params.clientId, 'serverClientId': params.serverClientId, 'forceCodeForRefreshToken': params.forceCodeForRefreshToken, + 'forceAccountName': params.forceAccountName, }); } diff --git a/packages/google_sign_in/google_sign_in_platform_interface/lib/src/types.dart b/packages/google_sign_in/google_sign_in_platform_interface/lib/src/types.dart index 5c74450b480..14c7f9f17af 100644 --- a/packages/google_sign_in/google_sign_in_platform_interface/lib/src/types.dart +++ b/packages/google_sign_in/google_sign_in_platform_interface/lib/src/types.dart @@ -36,6 +36,7 @@ class SignInInitParameters { this.clientId, this.serverClientId, this.forceCodeForRefreshToken = false, + this.forceAccountName, }); /// The list of OAuth scope codes to request when signing in. @@ -78,6 +79,11 @@ class SignInInitParameters { /// /// This is only used on Android. final bool forceCodeForRefreshToken; + + /// Can be used to explicitly set an account name on the underlying platform sign-in API. + /// + /// This is only used on Android. + final String? forceAccountName; } /// Holds information about the signed in user. diff --git a/packages/google_sign_in/google_sign_in_platform_interface/test/method_channel_google_sign_in_test.dart b/packages/google_sign_in/google_sign_in_platform_interface/test/method_channel_google_sign_in_test.dart index 52e792a9c25..0ebfdd27b98 100644 --- a/packages/google_sign_in/google_sign_in_platform_interface/test/method_channel_google_sign_in_test.dart +++ b/packages/google_sign_in/google_sign_in_platform_interface/test/method_channel_google_sign_in_test.dart @@ -102,7 +102,8 @@ void main() { hostedDomain: 'example.com', scopes: ['two', 'scopes'], signInOption: SignInOption.games, - clientId: 'fakeClientId'); + clientId: 'fakeClientId', + forceAccountName: 'fakeEmailAddress@google.com'); }: isMethodCall('init', arguments: { 'hostedDomain': 'example.com', 'scopes': ['two', 'scopes'], @@ -110,6 +111,7 @@ void main() { 'clientId': 'fakeClientId', 'serverClientId': null, 'forceCodeForRefreshToken': false, + 'forceAccountName': 'fakeEmailAddress@google.com', }), () { googleSignIn.getTokens( @@ -158,7 +160,8 @@ void main() { signInOption: SignInOption.games, clientId: 'fakeClientId', serverClientId: 'fakeServerClientId', - forceCodeForRefreshToken: true)); + forceCodeForRefreshToken: true, + forceAccountName: 'fakeEmailAddress@google.com')); expect(log, [ isMethodCall('init', arguments: { 'hostedDomain': 'example.com', @@ -167,6 +170,7 @@ void main() { 'clientId': 'fakeClientId', 'serverClientId': 'fakeServerClientId', 'forceCodeForRefreshToken': true, + 'forceAccountName': 'fakeEmailAddress@google.com', }), ]); }); diff --git a/packages/google_sign_in/google_sign_in_web/example/integration_test/google_sign_in_web_test.dart b/packages/google_sign_in/google_sign_in_web/example/integration_test/google_sign_in_web_test.dart index 1b5f11d2f9d..696a7fb0c1c 100644 --- a/packages/google_sign_in/google_sign_in_web/example/integration_test/google_sign_in_web_test.dart +++ b/packages/google_sign_in/google_sign_in_web/example/integration_test/google_sign_in_web_test.dart @@ -107,6 +107,17 @@ void main() { }, throwsAssertionError); }); + testWidgets('asserts forceAccountName must be null', (_) async { + expect(() async { + await plugin.initWithParams( + const SignInInitParameters( + clientId: 'some-non-null-client-id', + forceAccountName: 'fakeEmailAddress@google.com', + ), + ); + }, throwsAssertionError); + }); + testWidgets('must be called for most of the API to work', (_) async { expect(() async { await plugin.signInSilently(); diff --git a/packages/google_sign_in/google_sign_in_web/example/pubspec.yaml b/packages/google_sign_in/google_sign_in_web/example/pubspec.yaml index 81b6dd8bad3..7875805adfc 100644 --- a/packages/google_sign_in/google_sign_in_web/example/pubspec.yaml +++ b/packages/google_sign_in/google_sign_in_web/example/pubspec.yaml @@ -26,3 +26,8 @@ dev_dependencies: flutter: uses-material-design: true + +# FOR TESTING AND INITIAL REVIEW ONLY. DO NOT MERGE. +# See https://github.com/flutter/flutter/blob/master/docs/ecosystem/contributing/README.md#changing-federated-plugins +dependency_overrides: + {google_sign_in_platform_interface: {path: ../../../../packages/google_sign_in/google_sign_in_platform_interface}} diff --git a/packages/google_sign_in/google_sign_in_web/lib/google_sign_in_web.dart b/packages/google_sign_in/google_sign_in_web/lib/google_sign_in_web.dart index a7ce3f43c6a..e6d3abc9e58 100644 --- a/packages/google_sign_in/google_sign_in_web/lib/google_sign_in_web.dart +++ b/packages/google_sign_in/google_sign_in_web/lib/google_sign_in_web.dart @@ -155,6 +155,9 @@ class GoogleSignInPlugin extends GoogleSignInPlatform { 'Check https://developers.google.com/identity/protocols/googlescopes ' 'for a list of valid OAuth 2.0 scopes.'); + assert(params.forceAccountName == null, + 'forceAccountName is not supported on Web.'); + _initCalled = Completer(); await _jsSdkLoadedFuture; diff --git a/packages/google_sign_in/google_sign_in_web/pubspec.yaml b/packages/google_sign_in/google_sign_in_web/pubspec.yaml index ef52f4f3e41..b138e5e19dc 100644 --- a/packages/google_sign_in/google_sign_in_web/pubspec.yaml +++ b/packages/google_sign_in/google_sign_in_web/pubspec.yaml @@ -34,3 +34,8 @@ dev_dependencies: topics: - authentication - google-sign-in + +# FOR TESTING AND INITIAL REVIEW ONLY. DO NOT MERGE. +# See https://github.com/flutter/flutter/blob/master/docs/ecosystem/contributing/README.md#changing-federated-plugins +dependency_overrides: + {google_sign_in_platform_interface: {path: ../../../packages/google_sign_in/google_sign_in_platform_interface}} From bdfe4926e57494ee253751ae9ad6d18d1081eb96 Mon Sep 17 00:00:00 2001 From: Neil Self Date: Tue, 4 Feb 2025 19:57:18 -0800 Subject: [PATCH 02/29] Update the changelog. --- packages/google_sign_in/google_sign_in/CHANGELOG.md | 3 ++- packages/google_sign_in/google_sign_in/pubspec.yaml | 2 +- packages/google_sign_in/google_sign_in_android/CHANGELOG.md | 4 ++++ packages/google_sign_in/google_sign_in_android/pubspec.yaml | 2 +- packages/google_sign_in/google_sign_in_ios/CHANGELOG.md | 3 ++- packages/google_sign_in/google_sign_in_ios/pubspec.yaml | 2 +- .../google_sign_in_platform_interface/CHANGELOG.md | 3 ++- .../google_sign_in_platform_interface/pubspec.yaml | 2 +- packages/google_sign_in/google_sign_in_web/CHANGELOG.md | 3 ++- packages/google_sign_in/google_sign_in_web/pubspec.yaml | 2 +- 10 files changed, 17 insertions(+), 9 deletions(-) diff --git a/packages/google_sign_in/google_sign_in/CHANGELOG.md b/packages/google_sign_in/google_sign_in/CHANGELOG.md index eee5a932cf6..e664dd7225c 100644 --- a/packages/google_sign_in/google_sign_in/CHANGELOG.md +++ b/packages/google_sign_in/google_sign_in/CHANGELOG.md @@ -1,5 +1,6 @@ -## NEXT +## 6.3.0 +* Add a sign-in field to allow Android clients to explicitly specify an account name. This capability is only available within Android for the underlying libraries. * Updates minimum supported SDK version to Flutter 3.22/Dart 3.4. ## 6.2.2 diff --git a/packages/google_sign_in/google_sign_in/pubspec.yaml b/packages/google_sign_in/google_sign_in/pubspec.yaml index fbff11b81d7..bc08d0fa3ca 100644 --- a/packages/google_sign_in/google_sign_in/pubspec.yaml +++ b/packages/google_sign_in/google_sign_in/pubspec.yaml @@ -3,7 +3,7 @@ description: Flutter plugin for Google Sign-In, a secure authentication system for signing in with a Google account. repository: https://github.com/flutter/packages/tree/main/packages/google_sign_in/google_sign_in issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+google_sign_in%22 -version: 6.2.2 +version: 6.3.0 environment: sdk: ^3.4.0 diff --git a/packages/google_sign_in/google_sign_in_android/CHANGELOG.md b/packages/google_sign_in/google_sign_in_android/CHANGELOG.md index 75dcc58af33..d69a41b7439 100644 --- a/packages/google_sign_in/google_sign_in_android/CHANGELOG.md +++ b/packages/google_sign_in/google_sign_in_android/CHANGELOG.md @@ -1,3 +1,7 @@ +## 6.2.0 + +* Add a sign-in field to allow Android clients to explicitly specify an account name. This capability is only available within Android for the underlying libraries. + ## 6.1.34 * Removes unnecessary native code. diff --git a/packages/google_sign_in/google_sign_in_android/pubspec.yaml b/packages/google_sign_in/google_sign_in_android/pubspec.yaml index 1d44c4bfec5..b67bddbc721 100644 --- a/packages/google_sign_in/google_sign_in_android/pubspec.yaml +++ b/packages/google_sign_in/google_sign_in_android/pubspec.yaml @@ -2,7 +2,7 @@ name: google_sign_in_android description: Android implementation of the google_sign_in plugin. repository: https://github.com/flutter/packages/tree/main/packages/google_sign_in/google_sign_in_android issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+google_sign_in%22 -version: 6.1.34 +version: 6.2.0 environment: sdk: ^3.5.0 diff --git a/packages/google_sign_in/google_sign_in_ios/CHANGELOG.md b/packages/google_sign_in/google_sign_in_ios/CHANGELOG.md index f7b0e561716..d9ba98e4edf 100644 --- a/packages/google_sign_in/google_sign_in_ios/CHANGELOG.md +++ b/packages/google_sign_in/google_sign_in_ios/CHANGELOG.md @@ -1,5 +1,6 @@ -## NEXT +## 5.8.0 +* Add a sign-in field to allow Android clients to explicitly specify an account name. This capability is only available within Android for the underlying libraries. * Updates minimum supported SDK version to Flutter 3.22/Dart 3.4. ## 5.7.8 diff --git a/packages/google_sign_in/google_sign_in_ios/pubspec.yaml b/packages/google_sign_in/google_sign_in_ios/pubspec.yaml index a7cb5aa604e..e784d52ca10 100644 --- a/packages/google_sign_in/google_sign_in_ios/pubspec.yaml +++ b/packages/google_sign_in/google_sign_in_ios/pubspec.yaml @@ -2,7 +2,7 @@ name: google_sign_in_ios description: iOS implementation of the google_sign_in plugin. repository: https://github.com/flutter/packages/tree/main/packages/google_sign_in/google_sign_in_ios issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+google_sign_in%22 -version: 5.7.8 +version: 5.8.0 environment: sdk: ^3.4.0 diff --git a/packages/google_sign_in/google_sign_in_platform_interface/CHANGELOG.md b/packages/google_sign_in/google_sign_in_platform_interface/CHANGELOG.md index fda47024354..987f6f2e197 100644 --- a/packages/google_sign_in/google_sign_in_platform_interface/CHANGELOG.md +++ b/packages/google_sign_in/google_sign_in_platform_interface/CHANGELOG.md @@ -1,5 +1,6 @@ -## NEXT +## 2.5.0 +* Add a sign-in field to allow Android clients to explicitly specify an account name. This capability is only available within Android for the underlying libraries. * Updates minimum supported SDK version to Flutter 3.22/Dart 3.4. ## 2.4.5 diff --git a/packages/google_sign_in/google_sign_in_platform_interface/pubspec.yaml b/packages/google_sign_in/google_sign_in_platform_interface/pubspec.yaml index 2581773c69d..d0156993eb3 100644 --- a/packages/google_sign_in/google_sign_in_platform_interface/pubspec.yaml +++ b/packages/google_sign_in/google_sign_in_platform_interface/pubspec.yaml @@ -4,7 +4,7 @@ repository: https://github.com/flutter/packages/tree/main/packages/google_sign_i issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+google_sign_in%22 # NOTE: We strongly prefer non-breaking changes, even at the expense of a # less-clean API. See https://flutter.dev/go/platform-interface-breaking-changes -version: 2.4.5 +version: 2.5.0 environment: sdk: ^3.4.0 diff --git a/packages/google_sign_in/google_sign_in_web/CHANGELOG.md b/packages/google_sign_in/google_sign_in_web/CHANGELOG.md index 52e161969d1..e1c192444d0 100644 --- a/packages/google_sign_in/google_sign_in_web/CHANGELOG.md +++ b/packages/google_sign_in/google_sign_in_web/CHANGELOG.md @@ -1,5 +1,6 @@ -## NEXT +## 0.12.5 +* Add a sign-in field to allow Android clients to explicitly specify an account name. This capability is only available within Android for the underlying libraries. * Updates minimum supported SDK version to Flutter 3.22/Dart 3.4. ## 0.12.4+3 diff --git a/packages/google_sign_in/google_sign_in_web/pubspec.yaml b/packages/google_sign_in/google_sign_in_web/pubspec.yaml index b138e5e19dc..ac3271277be 100644 --- a/packages/google_sign_in/google_sign_in_web/pubspec.yaml +++ b/packages/google_sign_in/google_sign_in_web/pubspec.yaml @@ -3,7 +3,7 @@ description: Flutter plugin for Google Sign-In, a secure authentication system for signing in with a Google account on Android, iOS and Web. repository: https://github.com/flutter/packages/tree/main/packages/google_sign_in/google_sign_in_web issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+google_sign_in%22 -version: 0.12.4+3 +version: 0.12.5 environment: sdk: ^3.4.0 From ccd527af386780b65343785a0d72c33d1a76ae8f Mon Sep 17 00:00:00 2001 From: Neil Self Date: Thu, 6 Feb 2025 12:49:06 -0800 Subject: [PATCH 03/29] Minor updates to fix broken checks/tests. --- .../io/flutter/plugins/googlesignin/GoogleSignInTest.java | 3 ++- .../google_sign_in_ios/test/google_sign_in_ios_test.dart | 5 ++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/google_sign_in/google_sign_in_android/android/src/test/java/io/flutter/plugins/googlesignin/GoogleSignInTest.java b/packages/google_sign_in/google_sign_in_android/android/src/test/java/io/flutter/plugins/googlesignin/GoogleSignInTest.java index d27988def50..edfb137ab47 100644 --- a/packages/google_sign_in/google_sign_in_android/android/src/test/java/io/flutter/plugins/googlesignin/GoogleSignInTest.java +++ b/packages/google_sign_in/google_sign_in_android/android/src/test/java/io/flutter/plugins/googlesignin/GoogleSignInTest.java @@ -286,7 +286,8 @@ public void init_PassesForceCodeForRefreshTokenTrueWithServerClientIdFromResourc @Test public void init_PassesForceAccountName() { - InitParams params = buildInitParams("fakeClientId", "fakeServerClientId", 'fakeEmailAddress@google.com'); + InitParams params = buildInitParams( + "fakeClientId", "fakeServerClientId", 'fakeEmailAddress@google.com'); initAndAssertForceAccountName(params, 'fakeEmailAddress@google.com'); } diff --git a/packages/google_sign_in/google_sign_in_ios/test/google_sign_in_ios_test.dart b/packages/google_sign_in/google_sign_in_ios/test/google_sign_in_ios_test.dart index 3fad69e469e..45b221614fe 100644 --- a/packages/google_sign_in/google_sign_in_ios/test/google_sign_in_ios_test.dart +++ b/packages/google_sign_in/google_sign_in_ios/test/google_sign_in_ios_test.dart @@ -55,11 +55,10 @@ void main() { test('init throws for forceAccountName', () async { expect( () => googleSignIn.initWithParams( - SignInInitParameters( + const SignInInitParameters( hostedDomain: 'example.com', - signInOption: SignInOption.games, clientId: 'fakeClientId', -// forceAccountName: 'fakeEmailAddress@google.com', + forceAccountName: 'fakeEmailAddress@google.com', ), ), throwsA(isInstanceOf().having( From 27f8b32d2b91ae2378da8497f57385aa769e3254 Mon Sep 17 00:00:00 2001 From: Neil Self Date: Thu, 6 Feb 2025 14:18:58 -0800 Subject: [PATCH 04/29] Fix string formatting in GoogleSignInTest. --- .../java/io/flutter/plugins/googlesignin/GoogleSignInTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google_sign_in/google_sign_in_android/android/src/test/java/io/flutter/plugins/googlesignin/GoogleSignInTest.java b/packages/google_sign_in/google_sign_in_android/android/src/test/java/io/flutter/plugins/googlesignin/GoogleSignInTest.java index edfb137ab47..2272118b9eb 100644 --- a/packages/google_sign_in/google_sign_in_android/android/src/test/java/io/flutter/plugins/googlesignin/GoogleSignInTest.java +++ b/packages/google_sign_in/google_sign_in_android/android/src/test/java/io/flutter/plugins/googlesignin/GoogleSignInTest.java @@ -287,7 +287,7 @@ public void init_PassesForceCodeForRefreshTokenTrueWithServerClientIdFromResourc @Test public void init_PassesForceAccountName() { InitParams params = buildInitParams( - "fakeClientId", "fakeServerClientId", 'fakeEmailAddress@google.com'); + "fakeClientId", "fakeServerClientId", "fakeEmailAddress@google.com"); initAndAssertForceAccountName(params, 'fakeEmailAddress@google.com'); } From 6c71c01a9f42e4f66608cc99ae0a400b70604909 Mon Sep 17 00:00:00 2001 From: Neil Self Date: Thu, 6 Feb 2025 14:33:13 -0800 Subject: [PATCH 05/29] Fix additional string formatting in GoogleSignInTest. --- .../java/io/flutter/plugins/googlesignin/GoogleSignInTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google_sign_in/google_sign_in_android/android/src/test/java/io/flutter/plugins/googlesignin/GoogleSignInTest.java b/packages/google_sign_in/google_sign_in_android/android/src/test/java/io/flutter/plugins/googlesignin/GoogleSignInTest.java index 2272118b9eb..ec43ea5f580 100644 --- a/packages/google_sign_in/google_sign_in_android/android/src/test/java/io/flutter/plugins/googlesignin/GoogleSignInTest.java +++ b/packages/google_sign_in/google_sign_in_android/android/src/test/java/io/flutter/plugins/googlesignin/GoogleSignInTest.java @@ -289,7 +289,7 @@ public void init_PassesForceAccountName() { InitParams params = buildInitParams( "fakeClientId", "fakeServerClientId", "fakeEmailAddress@google.com"); - initAndAssertForceAccountName(params, 'fakeEmailAddress@google.com'); + initAndAssertForceAccountName(params, "fakeEmailAddress@google.com"); } public void initAndAssertServerClientId(InitParams params, String serverClientId) { From 92654959fc444bc290e90435db8fbe12ad37cbd2 Mon Sep 17 00:00:00 2001 From: Neil Self Date: Thu, 6 Feb 2025 15:31:01 -0800 Subject: [PATCH 06/29] Format files that needed formatting. --- .../plugins/googlesignin/Messages.java | 454 ++++++++++-------- .../googlesignin/GoogleSignInTest.java | 85 ++-- .../lib/src/messages.g.dart | 78 +-- 3 files changed, 351 insertions(+), 266 deletions(-) diff --git a/packages/google_sign_in/google_sign_in_android/android/src/main/java/io/flutter/plugins/googlesignin/Messages.java b/packages/google_sign_in/google_sign_in_android/android/src/main/java/io/flutter/plugins/googlesignin/Messages.java index 14b5ccbd911..7b5b2335d2d 100644 --- a/packages/google_sign_in/google_sign_in_android/android/src/main/java/io/flutter/plugins/googlesignin/Messages.java +++ b/packages/google_sign_in/google_sign_in_android/android/src/main/java/io/flutter/plugins/googlesignin/Messages.java @@ -21,11 +21,7 @@ import java.lang.annotation.Target; import java.nio.ByteBuffer; import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.HashMap; import java.util.List; -import java.util.Map; import java.util.Objects; /** Generated class from Pigeon. */ @@ -41,8 +37,7 @@ public static class FlutterError extends RuntimeException { /** The error details. Must be a datatype supported by the api codec. */ public final Object details; - public FlutterError(@NonNull String code, @Nullable String message, @Nullable Object details) - { + public FlutterError(@NonNull String code, @Nullable String message, @Nullable Object details) { super(message); this.code = code; this.details = details; @@ -61,7 +56,7 @@ protected static ArrayList wrapError(@NonNull Throwable exception) { errorList.add(exception.toString()); errorList.add(exception.getClass().getSimpleName()); errorList.add( - "Cause: " + exception.getCause() + ", Stacktrace: " + Log.getStackTraceString(exception)); + "Cause: " + exception.getCause() + ", Stacktrace: " + Log.getStackTraceString(exception)); } return errorList; } @@ -87,9 +82,9 @@ public enum SignInType { /** * Pigeon version of SignInInitParams. * - * See SignInInitParams for details. + *

See SignInInitParams for details. * - * Generated class from Pigeon that represents data sent in messages. + *

Generated class from Pigeon that represents data sent in messages. */ public static final class InitParams { private @NonNull List scopes; @@ -176,15 +171,32 @@ public void setForceAccountName(@Nullable String setterArg) { @Override public boolean equals(Object o) { - if (this == o) { return true; } - if (o == null || getClass() != o.getClass()) { return false; } + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } InitParams that = (InitParams) o; - return scopes.equals(that.scopes) && signInType.equals(that.signInType) && Objects.equals(hostedDomain, that.hostedDomain) && Objects.equals(clientId, that.clientId) && Objects.equals(serverClientId, that.serverClientId) && forceCodeForRefreshToken.equals(that.forceCodeForRefreshToken) && Objects.equals(forceAccountName, that.forceAccountName); + return scopes.equals(that.scopes) + && signInType.equals(that.signInType) + && Objects.equals(hostedDomain, that.hostedDomain) + && Objects.equals(clientId, that.clientId) + && Objects.equals(serverClientId, that.serverClientId) + && forceCodeForRefreshToken.equals(that.forceCodeForRefreshToken) + && Objects.equals(forceAccountName, that.forceAccountName); } @Override public int hashCode() { - return Objects.hash(scopes, signInType, hostedDomain, clientId, serverClientId, forceCodeForRefreshToken, forceAccountName); + return Objects.hash( + scopes, + signInType, + hostedDomain, + clientId, + serverClientId, + forceCodeForRefreshToken, + forceAccountName); } public static final class Builder { @@ -294,9 +306,9 @@ ArrayList toList() { /** * Pigeon version of GoogleSignInUserData. * - * See GoogleSignInUserData for details. + *

See GoogleSignInUserData for details. * - * Generated class from Pigeon that represents data sent in messages. + *

Generated class from Pigeon that represents data sent in messages. */ public static final class UserData { private @Nullable String displayName; @@ -370,10 +382,19 @@ public void setServerAuthCode(@Nullable String setterArg) { @Override public boolean equals(Object o) { - if (this == o) { return true; } - if (o == null || getClass() != o.getClass()) { return false; } + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } UserData that = (UserData) o; - return Objects.equals(displayName, that.displayName) && email.equals(that.email) && id.equals(that.id) && Objects.equals(photoUrl, that.photoUrl) && Objects.equals(idToken, that.idToken) && Objects.equals(serverAuthCode, that.serverAuthCode); + return Objects.equals(displayName, that.displayName) + && email.equals(that.email) + && id.equals(that.id) + && Objects.equals(photoUrl, that.photoUrl) + && Objects.equals(idToken, that.idToken) + && Objects.equals(serverAuthCode, that.serverAuthCode); } @Override @@ -481,7 +502,8 @@ private PigeonCodec() {} @Override protected Object readValueOfType(byte type, @NonNull ByteBuffer buffer) { switch (type) { - case (byte) 129: { + case (byte) 129: + { Object value = readValue(buffer); return value == null ? null : SignInType.values()[((Long) value).intValue()]; } @@ -511,7 +533,6 @@ protected void writeValue(@NonNull ByteArrayOutputStream stream, Object value) { } } - /** Asynchronous error handling return type for non-nullable API method returns. */ public interface Result { /** Success case callback method for handling returns. */ @@ -520,6 +541,7 @@ public interface Result { /** Failure case callback method for handling errors. */ void error(@NonNull Throwable error); } + /** Asynchronous error handling return type for nullable API method returns. */ public interface NullableResult { /** Success case callback method for handling returns. */ @@ -528,6 +550,7 @@ public interface NullableResult { /** Failure case callback method for handling errors. */ void error(@NonNull Throwable error); } + /** Asynchronous error handling return type for void API method returns. */ public interface VoidResult { /** Success case callback method for handling returns. */ @@ -536,28 +559,35 @@ public interface VoidResult { /** Failure case callback method for handling errors. */ void error(@NonNull Throwable error); } + /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface GoogleSignInApi { /** Initializes a sign in request with the given parameters. */ void init(@NonNull InitParams params); + /** Starts a silent sign in. */ void signInSilently(@NonNull Result result); + /** Starts a sign in with user interaction. */ void signIn(@NonNull Result result); + /** Requests the access token for the current sign in. */ - void getAccessToken(@NonNull String email, @NonNull Boolean shouldRecoverAuth, @NonNull Result result); + void getAccessToken( + @NonNull String email, @NonNull Boolean shouldRecoverAuth, @NonNull Result result); + /** Signs out the current user. */ void signOut(@NonNull VoidResult result); + /** Revokes scope grants to the application. */ void disconnect(@NonNull VoidResult result); + /** Returns whether the user is currently signed in. */ - @NonNull + @NonNull Boolean isSignedIn(); - /** - * Clears the authentication caching for the given token, requiring a - * new sign in. - */ + + /** Clears the authentication caching for the given token, requiring a new sign in. */ void clearAuthCache(@NonNull String token, @NonNull VoidResult result); + /** Requests access to the given scopes. */ void requestScopes(@NonNull List scopes, @NonNull Result result); @@ -565,248 +595,280 @@ public interface GoogleSignInApi { static @NonNull MessageCodec getCodec() { return PigeonCodec.INSTANCE; } - /**Sets up an instance of `GoogleSignInApi` to handle messages through the `binaryMessenger`. */ + + /** + * Sets up an instance of `GoogleSignInApi` to handle messages through the `binaryMessenger`. + */ static void setUp(@NonNull BinaryMessenger binaryMessenger, @Nullable GoogleSignInApi api) { setUp(binaryMessenger, "", api); } - static void setUp(@NonNull BinaryMessenger binaryMessenger, @NonNull String messageChannelSuffix, @Nullable GoogleSignInApi api) { + + static void setUp( + @NonNull BinaryMessenger binaryMessenger, + @NonNull String messageChannelSuffix, + @Nullable GoogleSignInApi api) { messageChannelSuffix = messageChannelSuffix.isEmpty() ? "" : "." + messageChannelSuffix; { BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.google_sign_in_android.GoogleSignInApi.init" + messageChannelSuffix, getCodec()); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.google_sign_in_android.GoogleSignInApi.init" + + messageChannelSuffix, + getCodec()); if (api != null) { channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - ArrayList args = (ArrayList) message; - InitParams paramsArg = (InitParams) args.get(0); - try { - api.init(paramsArg); - wrapped.add(0, null); - } - catch (Throwable exception) { - wrapped = wrapError(exception); - } - reply.reply(wrapped); - }); + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + ArrayList args = (ArrayList) message; + InitParams paramsArg = (InitParams) args.get(0); + try { + api.init(paramsArg); + wrapped.add(0, null); + } catch (Throwable exception) { + wrapped = wrapError(exception); + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.google_sign_in_android.GoogleSignInApi.signInSilently" + messageChannelSuffix, getCodec()); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.google_sign_in_android.GoogleSignInApi.signInSilently" + + messageChannelSuffix, + getCodec()); if (api != null) { channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - Result resultCallback = - new Result() { - public void success(UserData result) { - wrapped.add(0, result); - reply.reply(wrapped); - } - - public void error(Throwable error) { - ArrayList wrappedError = wrapError(error); - reply.reply(wrappedError); - } - }; - - api.signInSilently(resultCallback); - }); + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + Result resultCallback = + new Result() { + public void success(UserData result) { + wrapped.add(0, result); + reply.reply(wrapped); + } + + public void error(Throwable error) { + ArrayList wrappedError = wrapError(error); + reply.reply(wrappedError); + } + }; + + api.signInSilently(resultCallback); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.google_sign_in_android.GoogleSignInApi.signIn" + messageChannelSuffix, getCodec()); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.google_sign_in_android.GoogleSignInApi.signIn" + + messageChannelSuffix, + getCodec()); if (api != null) { channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - Result resultCallback = - new Result() { - public void success(UserData result) { - wrapped.add(0, result); - reply.reply(wrapped); - } - - public void error(Throwable error) { - ArrayList wrappedError = wrapError(error); - reply.reply(wrappedError); - } - }; - - api.signIn(resultCallback); - }); + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + Result resultCallback = + new Result() { + public void success(UserData result) { + wrapped.add(0, result); + reply.reply(wrapped); + } + + public void error(Throwable error) { + ArrayList wrappedError = wrapError(error); + reply.reply(wrappedError); + } + }; + + api.signIn(resultCallback); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.google_sign_in_android.GoogleSignInApi.getAccessToken" + messageChannelSuffix, getCodec()); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.google_sign_in_android.GoogleSignInApi.getAccessToken" + + messageChannelSuffix, + getCodec()); if (api != null) { channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - ArrayList args = (ArrayList) message; - String emailArg = (String) args.get(0); - Boolean shouldRecoverAuthArg = (Boolean) args.get(1); - Result resultCallback = - new Result() { - public void success(String result) { - wrapped.add(0, result); - reply.reply(wrapped); - } - - public void error(Throwable error) { - ArrayList wrappedError = wrapError(error); - reply.reply(wrappedError); - } - }; - - api.getAccessToken(emailArg, shouldRecoverAuthArg, resultCallback); - }); + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + ArrayList args = (ArrayList) message; + String emailArg = (String) args.get(0); + Boolean shouldRecoverAuthArg = (Boolean) args.get(1); + Result resultCallback = + new Result() { + public void success(String result) { + wrapped.add(0, result); + reply.reply(wrapped); + } + + public void error(Throwable error) { + ArrayList wrappedError = wrapError(error); + reply.reply(wrappedError); + } + }; + + api.getAccessToken(emailArg, shouldRecoverAuthArg, resultCallback); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.google_sign_in_android.GoogleSignInApi.signOut" + messageChannelSuffix, getCodec()); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.google_sign_in_android.GoogleSignInApi.signOut" + + messageChannelSuffix, + getCodec()); if (api != null) { channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - VoidResult resultCallback = - new VoidResult() { - public void success() { - wrapped.add(0, null); - reply.reply(wrapped); - } - - public void error(Throwable error) { - ArrayList wrappedError = wrapError(error); - reply.reply(wrappedError); - } - }; - - api.signOut(resultCallback); - }); + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + VoidResult resultCallback = + new VoidResult() { + public void success() { + wrapped.add(0, null); + reply.reply(wrapped); + } + + public void error(Throwable error) { + ArrayList wrappedError = wrapError(error); + reply.reply(wrappedError); + } + }; + + api.signOut(resultCallback); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.google_sign_in_android.GoogleSignInApi.disconnect" + messageChannelSuffix, getCodec()); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.google_sign_in_android.GoogleSignInApi.disconnect" + + messageChannelSuffix, + getCodec()); if (api != null) { channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - VoidResult resultCallback = - new VoidResult() { - public void success() { - wrapped.add(0, null); - reply.reply(wrapped); - } - - public void error(Throwable error) { - ArrayList wrappedError = wrapError(error); - reply.reply(wrappedError); - } - }; - - api.disconnect(resultCallback); - }); + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + VoidResult resultCallback = + new VoidResult() { + public void success() { + wrapped.add(0, null); + reply.reply(wrapped); + } + + public void error(Throwable error) { + ArrayList wrappedError = wrapError(error); + reply.reply(wrappedError); + } + }; + + api.disconnect(resultCallback); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.google_sign_in_android.GoogleSignInApi.isSignedIn" + messageChannelSuffix, getCodec()); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.google_sign_in_android.GoogleSignInApi.isSignedIn" + + messageChannelSuffix, + getCodec()); if (api != null) { channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - Boolean output = api.isSignedIn(); - wrapped.add(0, output); - } - catch (Throwable exception) { - wrapped = wrapError(exception); - } - reply.reply(wrapped); - }); + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + Boolean output = api.isSignedIn(); + wrapped.add(0, output); + } catch (Throwable exception) { + wrapped = wrapError(exception); + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.google_sign_in_android.GoogleSignInApi.clearAuthCache" + messageChannelSuffix, getCodec()); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.google_sign_in_android.GoogleSignInApi.clearAuthCache" + + messageChannelSuffix, + getCodec()); if (api != null) { channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - ArrayList args = (ArrayList) message; - String tokenArg = (String) args.get(0); - VoidResult resultCallback = - new VoidResult() { - public void success() { - wrapped.add(0, null); - reply.reply(wrapped); - } - - public void error(Throwable error) { - ArrayList wrappedError = wrapError(error); - reply.reply(wrappedError); - } - }; - - api.clearAuthCache(tokenArg, resultCallback); - }); + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + ArrayList args = (ArrayList) message; + String tokenArg = (String) args.get(0); + VoidResult resultCallback = + new VoidResult() { + public void success() { + wrapped.add(0, null); + reply.reply(wrapped); + } + + public void error(Throwable error) { + ArrayList wrappedError = wrapError(error); + reply.reply(wrappedError); + } + }; + + api.clearAuthCache(tokenArg, resultCallback); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.google_sign_in_android.GoogleSignInApi.requestScopes" + messageChannelSuffix, getCodec()); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.google_sign_in_android.GoogleSignInApi.requestScopes" + + messageChannelSuffix, + getCodec()); if (api != null) { channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - ArrayList args = (ArrayList) message; - List scopesArg = (List) args.get(0); - Result resultCallback = - new Result() { - public void success(Boolean result) { - wrapped.add(0, result); - reply.reply(wrapped); - } - - public void error(Throwable error) { - ArrayList wrappedError = wrapError(error); - reply.reply(wrappedError); - } - }; - - api.requestScopes(scopesArg, resultCallback); - }); + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + ArrayList args = (ArrayList) message; + List scopesArg = (List) args.get(0); + Result resultCallback = + new Result() { + public void success(Boolean result) { + wrapped.add(0, result); + reply.reply(wrapped); + } + + public void error(Throwable error) { + ArrayList wrappedError = wrapError(error); + reply.reply(wrappedError); + } + }; + + api.requestScopes(scopesArg, resultCallback); + }); } else { channel.setMessageHandler(null); } diff --git a/packages/google_sign_in/google_sign_in_android/android/src/test/java/io/flutter/plugins/googlesignin/GoogleSignInTest.java b/packages/google_sign_in/google_sign_in_android/android/src/test/java/io/flutter/plugins/googlesignin/GoogleSignInTest.java index ec43ea5f580..7468e4ec126 100644 --- a/packages/google_sign_in/google_sign_in_android/android/src/test/java/io/flutter/plugins/googlesignin/GoogleSignInTest.java +++ b/packages/google_sign_in/google_sign_in_android/android/src/test/java/io/flutter/plugins/googlesignin/GoogleSignInTest.java @@ -98,7 +98,7 @@ public void requestScopes_RequestsPermissionIfNotGranted() { plugin.requestScopes(Collections.singletonList("requestedScope"), boolResult); verify(mockGoogleSignIn) - .requestPermissions(mockActivity, 53295, account, new Scope[] {requestedScope}); + .requestPermissions(mockActivity, 53295, account, new Scope[] {requestedScope}); } @Test @@ -111,9 +111,9 @@ public void requestScopes_ReturnsFalseIfPermissionDenied() { plugin.requestScopes(Collections.singletonList("requestedScope"), boolResult); plugin.onActivityResult( - GoogleSignInPlugin.Delegate.REQUEST_CODE_REQUEST_SCOPE, - Activity.RESULT_CANCELED, - new Intent()); + GoogleSignInPlugin.Delegate.REQUEST_CODE_REQUEST_SCOPE, + Activity.RESULT_CANCELED, + new Intent()); verify(boolResult).success(false); } @@ -128,7 +128,7 @@ public void requestScopes_ReturnsTrueIfPermissionGranted() { plugin.requestScopes(Collections.singletonList("requestedScope"), boolResult); plugin.onActivityResult( - GoogleSignInPlugin.Delegate.REQUEST_CODE_REQUEST_SCOPE, Activity.RESULT_OK, new Intent()); + GoogleSignInPlugin.Delegate.REQUEST_CODE_REQUEST_SCOPE, Activity.RESULT_OK, new Intent()); verify(boolResult).success(true); } @@ -144,10 +144,10 @@ public void requestScopes_mayBeCalledRepeatedly_ifAlreadyGranted() { plugin.requestScopes(requestedScopes, boolResult); plugin.onActivityResult( - GoogleSignInPlugin.Delegate.REQUEST_CODE_REQUEST_SCOPE, Activity.RESULT_OK, new Intent()); + GoogleSignInPlugin.Delegate.REQUEST_CODE_REQUEST_SCOPE, Activity.RESULT_OK, new Intent()); plugin.requestScopes(requestedScopes, boolResult); plugin.onActivityResult( - GoogleSignInPlugin.Delegate.REQUEST_CODE_REQUEST_SCOPE, Activity.RESULT_OK, new Intent()); + GoogleSignInPlugin.Delegate.REQUEST_CODE_REQUEST_SCOPE, Activity.RESULT_OK, new Intent()); verify(boolResult, times(2)).success(true); } @@ -160,10 +160,10 @@ public void requestScopes_mayBeCalledRepeatedly_ifNotSignedIn() { plugin.requestScopes(requestedScopes, boolResult); plugin.onActivityResult( - GoogleSignInPlugin.Delegate.REQUEST_CODE_REQUEST_SCOPE, Activity.RESULT_OK, new Intent()); + GoogleSignInPlugin.Delegate.REQUEST_CODE_REQUEST_SCOPE, Activity.RESULT_OK, new Intent()); plugin.requestScopes(requestedScopes, boolResult); plugin.onActivityResult( - GoogleSignInPlugin.Delegate.REQUEST_CODE_REQUEST_SCOPE, Activity.RESULT_OK, new Intent()); + GoogleSignInPlugin.Delegate.REQUEST_CODE_REQUEST_SCOPE, Activity.RESULT_OK, new Intent()); ArgumentCaptor resultCaptor = ArgumentCaptor.forClass(Throwable.class); verify(boolResult, times(2)).error(resultCaptor.capture()); @@ -180,20 +180,20 @@ public void requestScopes_mayBeCalledRepeatedly_ifNotSignedIn() { @Test(expected = IllegalStateException.class) public void signInThrowsWithoutActivity() { final GoogleSignInPlugin.Delegate plugin = - new GoogleSignInPlugin.Delegate(mock(Context.class), mock(GoogleSignInWrapper.class)); + new GoogleSignInPlugin.Delegate(mock(Context.class), mock(GoogleSignInWrapper.class)); plugin.signIn(userDataResult); } @Test public void signInSilentlyThatImmediatelyCompletesWithoutResultFinishesWithError() - throws ApiException { + throws ApiException { final String clientId = "fakeClientId"; InitParams params = buildInitParams(clientId, null); initAndAssertServerClientId(params, clientId); ApiException exception = - new ApiException(new Status(CommonStatusCodes.SIGN_IN_REQUIRED, "Error text")); + new ApiException(new Status(CommonStatusCodes.SIGN_IN_REQUIRED, "Error text")); when(mockClient.silentSignIn()).thenReturn(mockSignInTask); when(mockSignInTask.isComplete()).thenReturn(true); when(mockSignInTask.getResult(ApiException.class)).thenThrow(exception); @@ -204,7 +204,7 @@ public void signInSilentlyThatImmediatelyCompletesWithoutResultFinishesWithError FlutterError error = (FlutterError) resultCaptor.getValue(); Assert.assertEquals("sign_in_required", error.code); Assert.assertEquals( - "com.google.android.gms.common.api.ApiException: 4: Error text", error.getMessage()); + "com.google.android.gms.common.api.ApiException: 4: Error text", error.getMessage()); } @Test @@ -215,7 +215,7 @@ public void init_LoadsServerClientIdFromResources() { InitParams params = buildInitParams(null, null); when(mockContext.getPackageName()).thenReturn(packageName); when(mockResources.getIdentifier("default_web_client_id", "string", packageName)) - .thenReturn(resourceId); + .thenReturn(resourceId); when(mockContext.getString(resourceId)).thenReturn(serverClientId); initAndAssertServerClientId(params, serverClientId); } @@ -264,7 +264,7 @@ public void init_PassesForceCodeForRefreshTokenFalseWithServerClientIdFromResour InitParams params = buildInitParams(null, null, false); when(mockContext.getPackageName()).thenReturn(packageName); when(mockResources.getIdentifier("default_web_client_id", "string", packageName)) - .thenReturn(resourceId); + .thenReturn(resourceId); when(mockContext.getString(resourceId)).thenReturn(serverClientId); initAndAssertForceCodeForRefreshToken(params, false); @@ -278,7 +278,7 @@ public void init_PassesForceCodeForRefreshTokenTrueWithServerClientIdFromResourc InitParams params = buildInitParams(null, null, true); when(mockContext.getPackageName()).thenReturn(packageName); when(mockResources.getIdentifier("default_web_client_id", "string", packageName)) - .thenReturn(resourceId); + .thenReturn(resourceId); when(mockContext.getString(resourceId)).thenReturn(serverClientId); initAndAssertForceCodeForRefreshToken(params, true); @@ -286,56 +286,59 @@ public void init_PassesForceCodeForRefreshTokenTrueWithServerClientIdFromResourc @Test public void init_PassesForceAccountName() { - InitParams params = buildInitParams( - "fakeClientId", "fakeServerClientId", "fakeEmailAddress@google.com"); + InitParams params = + buildInitParams("fakeClientId", "fakeServerClientId", "fakeEmailAddress@google.com"); initAndAssertForceAccountName(params, "fakeEmailAddress@google.com"); } public void initAndAssertServerClientId(InitParams params, String serverClientId) { ArgumentCaptor optionsCaptor = - ArgumentCaptor.forClass(GoogleSignInOptions.class); + ArgumentCaptor.forClass(GoogleSignInOptions.class); when(mockGoogleSignIn.getClient(any(Context.class), optionsCaptor.capture())) - .thenReturn(mockClient); + .thenReturn(mockClient); plugin.init(params); Assert.assertEquals(serverClientId, optionsCaptor.getValue().getServerClientId()); } public void initAndAssertForceCodeForRefreshToken( - InitParams params, boolean forceCodeForRefreshToken) { + InitParams params, boolean forceCodeForRefreshToken) { ArgumentCaptor optionsCaptor = - ArgumentCaptor.forClass(GoogleSignInOptions.class); + ArgumentCaptor.forClass(GoogleSignInOptions.class); when(mockGoogleSignIn.getClient(any(Context.class), optionsCaptor.capture())) - .thenReturn(mockClient); + .thenReturn(mockClient); plugin.init(params); Assert.assertEquals( - forceCodeForRefreshToken, optionsCaptor.getValue().isForceCodeForRefreshToken()); + forceCodeForRefreshToken, optionsCaptor.getValue().isForceCodeForRefreshToken()); } - public void initAndAssertForceAccountName( - InitParams params, String forceAccountName) { + public void initAndAssertForceAccountName(InitParams params, String forceAccountName) { ArgumentCaptor optionsCaptor = ArgumentCaptor.forClass(GoogleSignInOptions.class); when(mockGoogleSignIn.getClient(any(Context.class), optionsCaptor.capture())) .thenReturn(mockClient); plugin.init(params); - Assert.assertEquals( - forceAccountName, optionsCaptor.getValue().isForceAccountName()); + Assert.assertEquals(forceAccountName, optionsCaptor.getValue().isForceAccountName()); } private static InitParams buildInitParams(String clientId, String serverClientId) { return buildInitParams( - Messages.SignInType.STANDARD, Collections.emptyList(), clientId, serverClientId, false, null); + Messages.SignInType.STANDARD, + Collections.emptyList(), + clientId, + serverClientId, + false, + null); } private static InitParams buildInitParams( - String clientId, String serverClientId, boolean forceCodeForRefreshToken) { + String clientId, String serverClientId, boolean forceCodeForRefreshToken) { return buildInitParams( - Messages.SignInType.STANDARD, - Collections.emptyList(), - clientId, - serverClientId, - forceCodeForRefreshToken, + Messages.SignInType.STANDARD, + Collections.emptyList(), + clientId, + serverClientId, + forceCodeForRefreshToken, null); } @@ -351,12 +354,12 @@ private static InitParams buildInitParams( } private static InitParams buildInitParams( - Messages.SignInType signInType, - List scopes, - String clientId, - String serverClientId, - boolean forceCodeForRefreshToken, - String forceAccountName) { + Messages.SignInType signInType, + List scopes, + String clientId, + String serverClientId, + boolean forceCodeForRefreshToken, + String forceAccountName) { InitParams.Builder builder = new InitParams.Builder(); builder.setSignInType(signInType); builder.setScopes(scopes); diff --git a/packages/google_sign_in/google_sign_in_android/lib/src/messages.g.dart b/packages/google_sign_in/google_sign_in_android/lib/src/messages.g.dart index 5d4ebf0c833..1091b0a63bf 100644 --- a/packages/google_sign_in/google_sign_in_android/lib/src/messages.g.dart +++ b/packages/google_sign_in/google_sign_in_android/lib/src/messages.g.dart @@ -22,6 +22,7 @@ PlatformException _createConnectionError(String channelName) { enum SignInType { /// Default configuration. standard, + /// Recommended configuration for game sign in. games, } @@ -129,7 +130,6 @@ class UserData { } } - class _PigeonCodec extends StandardMessageCodec { const _PigeonCodec(); @override @@ -137,13 +137,13 @@ class _PigeonCodec extends StandardMessageCodec { if (value is int) { buffer.putUint8(4); buffer.putInt64(value); - } else if (value is SignInType) { + } else if (value is SignInType) { buffer.putUint8(129); writeValue(buffer, value.index); - } else if (value is InitParams) { + } else if (value is InitParams) { buffer.putUint8(130); writeValue(buffer, value.encode()); - } else if (value is UserData) { + } else if (value is UserData) { buffer.putUint8(131); writeValue(buffer, value.encode()); } else { @@ -154,12 +154,12 @@ class _PigeonCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 129: + case 129: final int? value = readValue(buffer) as int?; return value == null ? null : SignInType.values[value]; - case 130: + case 130: return InitParams.decode(readValue(buffer)!); - case 131: + case 131: return UserData.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); @@ -171,9 +171,11 @@ class GoogleSignInApi { /// Constructor for [GoogleSignInApi]. The [binaryMessenger] named argument is /// available for dependency injection. If it is left null, the default /// BinaryMessenger will be used which routes to the host platform. - GoogleSignInApi({BinaryMessenger? binaryMessenger, String messageChannelSuffix = ''}) + GoogleSignInApi( + {BinaryMessenger? binaryMessenger, String messageChannelSuffix = ''}) : pigeonVar_binaryMessenger = binaryMessenger, - pigeonVar_messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; + pigeonVar_messageChannelSuffix = + messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; final BinaryMessenger? pigeonVar_binaryMessenger; static const MessageCodec pigeonChannelCodec = _PigeonCodec(); @@ -182,8 +184,10 @@ class GoogleSignInApi { /// Initializes a sign in request with the given parameters. Future init(InitParams params) async { - final String pigeonVar_channelName = 'dev.flutter.pigeon.google_sign_in_android.GoogleSignInApi.init$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + final String pigeonVar_channelName = + 'dev.flutter.pigeon.google_sign_in_android.GoogleSignInApi.init$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -205,8 +209,10 @@ class GoogleSignInApi { /// Starts a silent sign in. Future signInSilently() async { - final String pigeonVar_channelName = 'dev.flutter.pigeon.google_sign_in_android.GoogleSignInApi.signInSilently$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + final String pigeonVar_channelName = + 'dev.flutter.pigeon.google_sign_in_android.GoogleSignInApi.signInSilently$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -233,8 +239,10 @@ class GoogleSignInApi { /// Starts a sign in with user interaction. Future signIn() async { - final String pigeonVar_channelName = 'dev.flutter.pigeon.google_sign_in_android.GoogleSignInApi.signIn$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + final String pigeonVar_channelName = + 'dev.flutter.pigeon.google_sign_in_android.GoogleSignInApi.signIn$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -261,14 +269,16 @@ class GoogleSignInApi { /// Requests the access token for the current sign in. Future getAccessToken(String email, bool shouldRecoverAuth) async { - final String pigeonVar_channelName = 'dev.flutter.pigeon.google_sign_in_android.GoogleSignInApi.getAccessToken$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + final String pigeonVar_channelName = + 'dev.flutter.pigeon.google_sign_in_android.GoogleSignInApi.getAccessToken$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final List? pigeonVar_replyList = - await pigeonVar_channel.send([email, shouldRecoverAuth]) as List?; + final List? pigeonVar_replyList = await pigeonVar_channel + .send([email, shouldRecoverAuth]) as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -289,8 +299,10 @@ class GoogleSignInApi { /// Signs out the current user. Future signOut() async { - final String pigeonVar_channelName = 'dev.flutter.pigeon.google_sign_in_android.GoogleSignInApi.signOut$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + final String pigeonVar_channelName = + 'dev.flutter.pigeon.google_sign_in_android.GoogleSignInApi.signOut$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -312,8 +324,10 @@ class GoogleSignInApi { /// Revokes scope grants to the application. Future disconnect() async { - final String pigeonVar_channelName = 'dev.flutter.pigeon.google_sign_in_android.GoogleSignInApi.disconnect$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + final String pigeonVar_channelName = + 'dev.flutter.pigeon.google_sign_in_android.GoogleSignInApi.disconnect$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -335,8 +349,10 @@ class GoogleSignInApi { /// Returns whether the user is currently signed in. Future isSignedIn() async { - final String pigeonVar_channelName = 'dev.flutter.pigeon.google_sign_in_android.GoogleSignInApi.isSignedIn$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + final String pigeonVar_channelName = + 'dev.flutter.pigeon.google_sign_in_android.GoogleSignInApi.isSignedIn$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -364,8 +380,10 @@ class GoogleSignInApi { /// Clears the authentication caching for the given token, requiring a /// new sign in. Future clearAuthCache(String token) async { - final String pigeonVar_channelName = 'dev.flutter.pigeon.google_sign_in_android.GoogleSignInApi.clearAuthCache$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + final String pigeonVar_channelName = + 'dev.flutter.pigeon.google_sign_in_android.GoogleSignInApi.clearAuthCache$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -387,8 +405,10 @@ class GoogleSignInApi { /// Requests access to the given scopes. Future requestScopes(List scopes) async { - final String pigeonVar_channelName = 'dev.flutter.pigeon.google_sign_in_android.GoogleSignInApi.requestScopes$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + final String pigeonVar_channelName = + 'dev.flutter.pigeon.google_sign_in_android.GoogleSignInApi.requestScopes$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, From 97ada7f4ca6624a5a4c0bca9791d3c66afd06824 Mon Sep 17 00:00:00 2001 From: Neil Self Date: Thu, 6 Feb 2025 15:45:49 -0800 Subject: [PATCH 07/29] Additional formatting fixes for java files. --- .../plugins/googlesignin/Messages.java | 440 +++++++++--------- .../googlesignin/GoogleSignInTest.java | 102 ++-- 2 files changed, 271 insertions(+), 271 deletions(-) diff --git a/packages/google_sign_in/google_sign_in_android/android/src/main/java/io/flutter/plugins/googlesignin/Messages.java b/packages/google_sign_in/google_sign_in_android/android/src/main/java/io/flutter/plugins/googlesignin/Messages.java index 7b5b2335d2d..b5bb829bdf8 100644 --- a/packages/google_sign_in/google_sign_in_android/android/src/main/java/io/flutter/plugins/googlesignin/Messages.java +++ b/packages/google_sign_in/google_sign_in_android/android/src/main/java/io/flutter/plugins/googlesignin/Messages.java @@ -56,7 +56,7 @@ protected static ArrayList wrapError(@NonNull Throwable exception) { errorList.add(exception.toString()); errorList.add(exception.getClass().getSimpleName()); errorList.add( - "Cause: " + exception.getCause() + ", Stacktrace: " + Log.getStackTraceString(exception)); + "Cause: " + exception.getCause() + ", Stacktrace: " + Log.getStackTraceString(exception)); } return errorList; } @@ -179,24 +179,24 @@ public boolean equals(Object o) { } InitParams that = (InitParams) o; return scopes.equals(that.scopes) - && signInType.equals(that.signInType) - && Objects.equals(hostedDomain, that.hostedDomain) - && Objects.equals(clientId, that.clientId) - && Objects.equals(serverClientId, that.serverClientId) - && forceCodeForRefreshToken.equals(that.forceCodeForRefreshToken) - && Objects.equals(forceAccountName, that.forceAccountName); + && signInType.equals(that.signInType) + && Objects.equals(hostedDomain, that.hostedDomain) + && Objects.equals(clientId, that.clientId) + && Objects.equals(serverClientId, that.serverClientId) + && forceCodeForRefreshToken.equals(that.forceCodeForRefreshToken) + && Objects.equals(forceAccountName, that.forceAccountName); } @Override public int hashCode() { return Objects.hash( - scopes, - signInType, - hostedDomain, - clientId, - serverClientId, - forceCodeForRefreshToken, - forceAccountName); + scopes, + signInType, + hostedDomain, + clientId, + serverClientId, + forceCodeForRefreshToken, + forceAccountName); } public static final class Builder { @@ -390,11 +390,11 @@ public boolean equals(Object o) { } UserData that = (UserData) o; return Objects.equals(displayName, that.displayName) - && email.equals(that.email) - && id.equals(that.id) - && Objects.equals(photoUrl, that.photoUrl) - && Objects.equals(idToken, that.idToken) - && Objects.equals(serverAuthCode, that.serverAuthCode); + && email.equals(that.email) + && id.equals(that.id) + && Objects.equals(photoUrl, that.photoUrl) + && Objects.equals(idToken, that.idToken) + && Objects.equals(serverAuthCode, that.serverAuthCode); } @Override @@ -503,10 +503,10 @@ private PigeonCodec() {} protected Object readValueOfType(byte type, @NonNull ByteBuffer buffer) { switch (type) { case (byte) 129: - { - Object value = readValue(buffer); - return value == null ? null : SignInType.values()[((Long) value).intValue()]; - } + { + Object value = readValue(buffer); + return value == null ? null : SignInType.values()[((Long) value).intValue()]; + } case (byte) 130: return InitParams.fromList((ArrayList) readValue(buffer)); case (byte) 131: @@ -573,7 +573,7 @@ public interface GoogleSignInApi { /** Requests the access token for the current sign in. */ void getAccessToken( - @NonNull String email, @NonNull Boolean shouldRecoverAuth, @NonNull Result result); + @NonNull String email, @NonNull Boolean shouldRecoverAuth, @NonNull Result result); /** Signs out the current user. */ void signOut(@NonNull VoidResult result); @@ -604,271 +604,271 @@ static void setUp(@NonNull BinaryMessenger binaryMessenger, @Nullable GoogleSign } static void setUp( - @NonNull BinaryMessenger binaryMessenger, - @NonNull String messageChannelSuffix, - @Nullable GoogleSignInApi api) { + @NonNull BinaryMessenger binaryMessenger, + @NonNull String messageChannelSuffix, + @Nullable GoogleSignInApi api) { messageChannelSuffix = messageChannelSuffix.isEmpty() ? "" : "." + messageChannelSuffix; { BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.google_sign_in_android.GoogleSignInApi.init" - + messageChannelSuffix, - getCodec()); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.google_sign_in_android.GoogleSignInApi.init" + + messageChannelSuffix, + getCodec()); if (api != null) { channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - ArrayList args = (ArrayList) message; - InitParams paramsArg = (InitParams) args.get(0); - try { - api.init(paramsArg); - wrapped.add(0, null); - } catch (Throwable exception) { - wrapped = wrapError(exception); - } - reply.reply(wrapped); - }); + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + ArrayList args = (ArrayList) message; + InitParams paramsArg = (InitParams) args.get(0); + try { + api.init(paramsArg); + wrapped.add(0, null); + } catch (Throwable exception) { + wrapped = wrapError(exception); + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.google_sign_in_android.GoogleSignInApi.signInSilently" - + messageChannelSuffix, - getCodec()); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.google_sign_in_android.GoogleSignInApi.signInSilently" + + messageChannelSuffix, + getCodec()); if (api != null) { channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - Result resultCallback = - new Result() { - public void success(UserData result) { - wrapped.add(0, result); - reply.reply(wrapped); - } - - public void error(Throwable error) { - ArrayList wrappedError = wrapError(error); - reply.reply(wrappedError); - } - }; - - api.signInSilently(resultCallback); - }); + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + Result resultCallback = + new Result() { + public void success(UserData result) { + wrapped.add(0, result); + reply.reply(wrapped); + } + + public void error(Throwable error) { + ArrayList wrappedError = wrapError(error); + reply.reply(wrappedError); + } + }; + + api.signInSilently(resultCallback); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.google_sign_in_android.GoogleSignInApi.signIn" - + messageChannelSuffix, - getCodec()); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.google_sign_in_android.GoogleSignInApi.signIn" + + messageChannelSuffix, + getCodec()); if (api != null) { channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - Result resultCallback = - new Result() { - public void success(UserData result) { - wrapped.add(0, result); - reply.reply(wrapped); - } - - public void error(Throwable error) { - ArrayList wrappedError = wrapError(error); - reply.reply(wrappedError); - } - }; - - api.signIn(resultCallback); - }); + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + Result resultCallback = + new Result() { + public void success(UserData result) { + wrapped.add(0, result); + reply.reply(wrapped); + } + + public void error(Throwable error) { + ArrayList wrappedError = wrapError(error); + reply.reply(wrappedError); + } + }; + + api.signIn(resultCallback); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.google_sign_in_android.GoogleSignInApi.getAccessToken" - + messageChannelSuffix, - getCodec()); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.google_sign_in_android.GoogleSignInApi.getAccessToken" + + messageChannelSuffix, + getCodec()); if (api != null) { channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - ArrayList args = (ArrayList) message; - String emailArg = (String) args.get(0); - Boolean shouldRecoverAuthArg = (Boolean) args.get(1); - Result resultCallback = - new Result() { - public void success(String result) { - wrapped.add(0, result); - reply.reply(wrapped); - } - - public void error(Throwable error) { - ArrayList wrappedError = wrapError(error); - reply.reply(wrappedError); - } - }; - - api.getAccessToken(emailArg, shouldRecoverAuthArg, resultCallback); - }); + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + ArrayList args = (ArrayList) message; + String emailArg = (String) args.get(0); + Boolean shouldRecoverAuthArg = (Boolean) args.get(1); + Result resultCallback = + new Result() { + public void success(String result) { + wrapped.add(0, result); + reply.reply(wrapped); + } + + public void error(Throwable error) { + ArrayList wrappedError = wrapError(error); + reply.reply(wrappedError); + } + }; + + api.getAccessToken(emailArg, shouldRecoverAuthArg, resultCallback); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.google_sign_in_android.GoogleSignInApi.signOut" - + messageChannelSuffix, - getCodec()); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.google_sign_in_android.GoogleSignInApi.signOut" + + messageChannelSuffix, + getCodec()); if (api != null) { channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - VoidResult resultCallback = - new VoidResult() { - public void success() { - wrapped.add(0, null); - reply.reply(wrapped); - } - - public void error(Throwable error) { - ArrayList wrappedError = wrapError(error); - reply.reply(wrappedError); - } - }; - - api.signOut(resultCallback); - }); + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + VoidResult resultCallback = + new VoidResult() { + public void success() { + wrapped.add(0, null); + reply.reply(wrapped); + } + + public void error(Throwable error) { + ArrayList wrappedError = wrapError(error); + reply.reply(wrappedError); + } + }; + + api.signOut(resultCallback); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.google_sign_in_android.GoogleSignInApi.disconnect" - + messageChannelSuffix, - getCodec()); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.google_sign_in_android.GoogleSignInApi.disconnect" + + messageChannelSuffix, + getCodec()); if (api != null) { channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - VoidResult resultCallback = - new VoidResult() { - public void success() { - wrapped.add(0, null); - reply.reply(wrapped); - } - - public void error(Throwable error) { - ArrayList wrappedError = wrapError(error); - reply.reply(wrappedError); - } - }; - - api.disconnect(resultCallback); - }); + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + VoidResult resultCallback = + new VoidResult() { + public void success() { + wrapped.add(0, null); + reply.reply(wrapped); + } + + public void error(Throwable error) { + ArrayList wrappedError = wrapError(error); + reply.reply(wrappedError); + } + }; + + api.disconnect(resultCallback); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.google_sign_in_android.GoogleSignInApi.isSignedIn" - + messageChannelSuffix, - getCodec()); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.google_sign_in_android.GoogleSignInApi.isSignedIn" + + messageChannelSuffix, + getCodec()); if (api != null) { channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - Boolean output = api.isSignedIn(); - wrapped.add(0, output); - } catch (Throwable exception) { - wrapped = wrapError(exception); - } - reply.reply(wrapped); - }); + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + Boolean output = api.isSignedIn(); + wrapped.add(0, output); + } catch (Throwable exception) { + wrapped = wrapError(exception); + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.google_sign_in_android.GoogleSignInApi.clearAuthCache" - + messageChannelSuffix, - getCodec()); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.google_sign_in_android.GoogleSignInApi.clearAuthCache" + + messageChannelSuffix, + getCodec()); if (api != null) { channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - ArrayList args = (ArrayList) message; - String tokenArg = (String) args.get(0); - VoidResult resultCallback = - new VoidResult() { - public void success() { - wrapped.add(0, null); - reply.reply(wrapped); - } - - public void error(Throwable error) { - ArrayList wrappedError = wrapError(error); - reply.reply(wrappedError); - } - }; - - api.clearAuthCache(tokenArg, resultCallback); - }); + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + ArrayList args = (ArrayList) message; + String tokenArg = (String) args.get(0); + VoidResult resultCallback = + new VoidResult() { + public void success() { + wrapped.add(0, null); + reply.reply(wrapped); + } + + public void error(Throwable error) { + ArrayList wrappedError = wrapError(error); + reply.reply(wrappedError); + } + }; + + api.clearAuthCache(tokenArg, resultCallback); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.google_sign_in_android.GoogleSignInApi.requestScopes" - + messageChannelSuffix, - getCodec()); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.google_sign_in_android.GoogleSignInApi.requestScopes" + + messageChannelSuffix, + getCodec()); if (api != null) { channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - ArrayList args = (ArrayList) message; - List scopesArg = (List) args.get(0); - Result resultCallback = - new Result() { - public void success(Boolean result) { - wrapped.add(0, result); - reply.reply(wrapped); - } - - public void error(Throwable error) { - ArrayList wrappedError = wrapError(error); - reply.reply(wrappedError); - } - }; - - api.requestScopes(scopesArg, resultCallback); - }); + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + ArrayList args = (ArrayList) message; + List scopesArg = (List) args.get(0); + Result resultCallback = + new Result() { + public void success(Boolean result) { + wrapped.add(0, result); + reply.reply(wrapped); + } + + public void error(Throwable error) { + ArrayList wrappedError = wrapError(error); + reply.reply(wrappedError); + } + }; + + api.requestScopes(scopesArg, resultCallback); + }); } else { channel.setMessageHandler(null); } diff --git a/packages/google_sign_in/google_sign_in_android/android/src/test/java/io/flutter/plugins/googlesignin/GoogleSignInTest.java b/packages/google_sign_in/google_sign_in_android/android/src/test/java/io/flutter/plugins/googlesignin/GoogleSignInTest.java index 7468e4ec126..b1f9a181d78 100644 --- a/packages/google_sign_in/google_sign_in_android/android/src/test/java/io/flutter/plugins/googlesignin/GoogleSignInTest.java +++ b/packages/google_sign_in/google_sign_in_android/android/src/test/java/io/flutter/plugins/googlesignin/GoogleSignInTest.java @@ -98,7 +98,7 @@ public void requestScopes_RequestsPermissionIfNotGranted() { plugin.requestScopes(Collections.singletonList("requestedScope"), boolResult); verify(mockGoogleSignIn) - .requestPermissions(mockActivity, 53295, account, new Scope[] {requestedScope}); + .requestPermissions(mockActivity, 53295, account, new Scope[] {requestedScope}); } @Test @@ -111,9 +111,9 @@ public void requestScopes_ReturnsFalseIfPermissionDenied() { plugin.requestScopes(Collections.singletonList("requestedScope"), boolResult); plugin.onActivityResult( - GoogleSignInPlugin.Delegate.REQUEST_CODE_REQUEST_SCOPE, - Activity.RESULT_CANCELED, - new Intent()); + GoogleSignInPlugin.Delegate.REQUEST_CODE_REQUEST_SCOPE, + Activity.RESULT_CANCELED, + new Intent()); verify(boolResult).success(false); } @@ -128,7 +128,7 @@ public void requestScopes_ReturnsTrueIfPermissionGranted() { plugin.requestScopes(Collections.singletonList("requestedScope"), boolResult); plugin.onActivityResult( - GoogleSignInPlugin.Delegate.REQUEST_CODE_REQUEST_SCOPE, Activity.RESULT_OK, new Intent()); + GoogleSignInPlugin.Delegate.REQUEST_CODE_REQUEST_SCOPE, Activity.RESULT_OK, new Intent()); verify(boolResult).success(true); } @@ -144,10 +144,10 @@ public void requestScopes_mayBeCalledRepeatedly_ifAlreadyGranted() { plugin.requestScopes(requestedScopes, boolResult); plugin.onActivityResult( - GoogleSignInPlugin.Delegate.REQUEST_CODE_REQUEST_SCOPE, Activity.RESULT_OK, new Intent()); + GoogleSignInPlugin.Delegate.REQUEST_CODE_REQUEST_SCOPE, Activity.RESULT_OK, new Intent()); plugin.requestScopes(requestedScopes, boolResult); plugin.onActivityResult( - GoogleSignInPlugin.Delegate.REQUEST_CODE_REQUEST_SCOPE, Activity.RESULT_OK, new Intent()); + GoogleSignInPlugin.Delegate.REQUEST_CODE_REQUEST_SCOPE, Activity.RESULT_OK, new Intent()); verify(boolResult, times(2)).success(true); } @@ -160,10 +160,10 @@ public void requestScopes_mayBeCalledRepeatedly_ifNotSignedIn() { plugin.requestScopes(requestedScopes, boolResult); plugin.onActivityResult( - GoogleSignInPlugin.Delegate.REQUEST_CODE_REQUEST_SCOPE, Activity.RESULT_OK, new Intent()); + GoogleSignInPlugin.Delegate.REQUEST_CODE_REQUEST_SCOPE, Activity.RESULT_OK, new Intent()); plugin.requestScopes(requestedScopes, boolResult); plugin.onActivityResult( - GoogleSignInPlugin.Delegate.REQUEST_CODE_REQUEST_SCOPE, Activity.RESULT_OK, new Intent()); + GoogleSignInPlugin.Delegate.REQUEST_CODE_REQUEST_SCOPE, Activity.RESULT_OK, new Intent()); ArgumentCaptor resultCaptor = ArgumentCaptor.forClass(Throwable.class); verify(boolResult, times(2)).error(resultCaptor.capture()); @@ -180,20 +180,20 @@ public void requestScopes_mayBeCalledRepeatedly_ifNotSignedIn() { @Test(expected = IllegalStateException.class) public void signInThrowsWithoutActivity() { final GoogleSignInPlugin.Delegate plugin = - new GoogleSignInPlugin.Delegate(mock(Context.class), mock(GoogleSignInWrapper.class)); + new GoogleSignInPlugin.Delegate(mock(Context.class), mock(GoogleSignInWrapper.class)); plugin.signIn(userDataResult); } @Test public void signInSilentlyThatImmediatelyCompletesWithoutResultFinishesWithError() - throws ApiException { + throws ApiException { final String clientId = "fakeClientId"; InitParams params = buildInitParams(clientId, null); initAndAssertServerClientId(params, clientId); ApiException exception = - new ApiException(new Status(CommonStatusCodes.SIGN_IN_REQUIRED, "Error text")); + new ApiException(new Status(CommonStatusCodes.SIGN_IN_REQUIRED, "Error text")); when(mockClient.silentSignIn()).thenReturn(mockSignInTask); when(mockSignInTask.isComplete()).thenReturn(true); when(mockSignInTask.getResult(ApiException.class)).thenThrow(exception); @@ -204,7 +204,7 @@ public void signInSilentlyThatImmediatelyCompletesWithoutResultFinishesWithError FlutterError error = (FlutterError) resultCaptor.getValue(); Assert.assertEquals("sign_in_required", error.code); Assert.assertEquals( - "com.google.android.gms.common.api.ApiException: 4: Error text", error.getMessage()); + "com.google.android.gms.common.api.ApiException: 4: Error text", error.getMessage()); } @Test @@ -215,7 +215,7 @@ public void init_LoadsServerClientIdFromResources() { InitParams params = buildInitParams(null, null); when(mockContext.getPackageName()).thenReturn(packageName); when(mockResources.getIdentifier("default_web_client_id", "string", packageName)) - .thenReturn(resourceId); + .thenReturn(resourceId); when(mockContext.getString(resourceId)).thenReturn(serverClientId); initAndAssertServerClientId(params, serverClientId); } @@ -264,7 +264,7 @@ public void init_PassesForceCodeForRefreshTokenFalseWithServerClientIdFromResour InitParams params = buildInitParams(null, null, false); when(mockContext.getPackageName()).thenReturn(packageName); when(mockResources.getIdentifier("default_web_client_id", "string", packageName)) - .thenReturn(resourceId); + .thenReturn(resourceId); when(mockContext.getString(resourceId)).thenReturn(serverClientId); initAndAssertForceCodeForRefreshToken(params, false); @@ -278,7 +278,7 @@ public void init_PassesForceCodeForRefreshTokenTrueWithServerClientIdFromResourc InitParams params = buildInitParams(null, null, true); when(mockContext.getPackageName()).thenReturn(packageName); when(mockResources.getIdentifier("default_web_client_id", "string", packageName)) - .thenReturn(resourceId); + .thenReturn(resourceId); when(mockContext.getString(resourceId)).thenReturn(serverClientId); initAndAssertForceCodeForRefreshToken(params, true); @@ -287,79 +287,79 @@ public void init_PassesForceCodeForRefreshTokenTrueWithServerClientIdFromResourc @Test public void init_PassesForceAccountName() { InitParams params = - buildInitParams("fakeClientId", "fakeServerClientId", "fakeEmailAddress@google.com"); + buildInitParams("fakeClientId", "fakeServerClientId", "fakeEmailAddress@google.com"); initAndAssertForceAccountName(params, "fakeEmailAddress@google.com"); } public void initAndAssertServerClientId(InitParams params, String serverClientId) { ArgumentCaptor optionsCaptor = - ArgumentCaptor.forClass(GoogleSignInOptions.class); + ArgumentCaptor.forClass(GoogleSignInOptions.class); when(mockGoogleSignIn.getClient(any(Context.class), optionsCaptor.capture())) - .thenReturn(mockClient); + .thenReturn(mockClient); plugin.init(params); Assert.assertEquals(serverClientId, optionsCaptor.getValue().getServerClientId()); } public void initAndAssertForceCodeForRefreshToken( - InitParams params, boolean forceCodeForRefreshToken) { + InitParams params, boolean forceCodeForRefreshToken) { ArgumentCaptor optionsCaptor = - ArgumentCaptor.forClass(GoogleSignInOptions.class); + ArgumentCaptor.forClass(GoogleSignInOptions.class); when(mockGoogleSignIn.getClient(any(Context.class), optionsCaptor.capture())) - .thenReturn(mockClient); + .thenReturn(mockClient); plugin.init(params); Assert.assertEquals( - forceCodeForRefreshToken, optionsCaptor.getValue().isForceCodeForRefreshToken()); + forceCodeForRefreshToken, optionsCaptor.getValue().isForceCodeForRefreshToken()); } public void initAndAssertForceAccountName(InitParams params, String forceAccountName) { ArgumentCaptor optionsCaptor = - ArgumentCaptor.forClass(GoogleSignInOptions.class); + ArgumentCaptor.forClass(GoogleSignInOptions.class); when(mockGoogleSignIn.getClient(any(Context.class), optionsCaptor.capture())) - .thenReturn(mockClient); + .thenReturn(mockClient); plugin.init(params); Assert.assertEquals(forceAccountName, optionsCaptor.getValue().isForceAccountName()); } private static InitParams buildInitParams(String clientId, String serverClientId) { return buildInitParams( - Messages.SignInType.STANDARD, - Collections.emptyList(), - clientId, - serverClientId, - false, - null); + Messages.SignInType.STANDARD, + Collections.emptyList(), + clientId, + serverClientId, + false, + null); } private static InitParams buildInitParams( - String clientId, String serverClientId, boolean forceCodeForRefreshToken) { + String clientId, String serverClientId, boolean forceCodeForRefreshToken) { return buildInitParams( - Messages.SignInType.STANDARD, - Collections.emptyList(), - clientId, - serverClientId, - forceCodeForRefreshToken, - null); + Messages.SignInType.STANDARD, + Collections.emptyList(), + clientId, + serverClientId, + forceCodeForRefreshToken, + null); } private static InitParams buildInitParams( - String clientId, String serverClientId, String forceAccountName) { + String clientId, String serverClientId, String forceAccountName) { return buildInitParams( - Messages.SignInType.STANDARD, - Collections.emptyList(), - clientId, - serverClientId, - false, - forceAccountName); + Messages.SignInType.STANDARD, + Collections.emptyList(), + clientId, + serverClientId, + false, + forceAccountName); } private static InitParams buildInitParams( - Messages.SignInType signInType, - List scopes, - String clientId, - String serverClientId, - boolean forceCodeForRefreshToken, - String forceAccountName) { + Messages.SignInType signInType, + List scopes, + String clientId, + String serverClientId, + boolean forceCodeForRefreshToken, + String forceAccountName) { InitParams.Builder builder = new InitParams.Builder(); builder.setSignInType(signInType); builder.setScopes(scopes); From 596cf3489d064a76611740f9527e3ec852d4bed5 Mon Sep 17 00:00:00 2001 From: Neil Self Date: Thu, 6 Feb 2025 16:00:16 -0800 Subject: [PATCH 08/29] Specify NDK version according to checks. --- .../google_sign_in_android/example/android/app/build.gradle | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/google_sign_in/google_sign_in_android/example/android/app/build.gradle b/packages/google_sign_in/google_sign_in_android/example/android/app/build.gradle index 55b8f8a7ea2..c3d405d9b87 100644 --- a/packages/google_sign_in/google_sign_in_android/example/android/app/build.gradle +++ b/packages/google_sign_in/google_sign_in_android/example/android/app/build.gradle @@ -25,6 +25,7 @@ if (flutterVersionName == null) { android { namespace 'io.flutter.plugins.googlesigninexample' compileSdk flutter.compileSdkVersion + ndkVersion = "26.3.11579264" defaultConfig { From fc18808f49160beb6c5364fed8fae30e7d478700 Mon Sep 17 00:00:00 2001 From: Neil Self Date: Fri, 7 Feb 2025 16:11:24 -0800 Subject: [PATCH 09/29] Update GoogleSignInTest to fix a broken test. --- .../java/io/flutter/plugins/googlesignin/GoogleSignInTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google_sign_in/google_sign_in_android/android/src/test/java/io/flutter/plugins/googlesignin/GoogleSignInTest.java b/packages/google_sign_in/google_sign_in_android/android/src/test/java/io/flutter/plugins/googlesignin/GoogleSignInTest.java index b1f9a181d78..f410cae0cee 100644 --- a/packages/google_sign_in/google_sign_in_android/android/src/test/java/io/flutter/plugins/googlesignin/GoogleSignInTest.java +++ b/packages/google_sign_in/google_sign_in_android/android/src/test/java/io/flutter/plugins/googlesignin/GoogleSignInTest.java @@ -318,7 +318,7 @@ public void initAndAssertForceAccountName(InitParams params, String forceAccount when(mockGoogleSignIn.getClient(any(Context.class), optionsCaptor.capture())) .thenReturn(mockClient); plugin.init(params); - Assert.assertEquals(forceAccountName, optionsCaptor.getValue().isForceAccountName()); + Assert.assertEquals(forceAccountName, optionsCaptor.getValue().getAccount().name); } private static InitParams buildInitParams(String clientId, String serverClientId) { From 1e57cc205b240e7bb980df41ae4042a3bc6f7e9f Mon Sep 17 00:00:00 2001 From: Neil Self Date: Tue, 11 Feb 2025 16:12:33 -0800 Subject: [PATCH 10/29] Update GoogleSignInTest.init_PassesForceAccountName() to use MockedConstruction to test the account being constructed in the builder and then passed into GoogleSignInOptions. This is necessary as Account is an android class and cannot be instantiated normally in a unit test (the constructor will return null). --- .../googlesignin/GoogleSignInTest.java | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/packages/google_sign_in/google_sign_in_android/android/src/test/java/io/flutter/plugins/googlesignin/GoogleSignInTest.java b/packages/google_sign_in/google_sign_in_android/android/src/test/java/io/flutter/plugins/googlesignin/GoogleSignInTest.java index f410cae0cee..d63aa66e6ac 100644 --- a/packages/google_sign_in/google_sign_in_android/android/src/test/java/io/flutter/plugins/googlesignin/GoogleSignInTest.java +++ b/packages/google_sign_in/google_sign_in_android/android/src/test/java/io/flutter/plugins/googlesignin/GoogleSignInTest.java @@ -32,6 +32,8 @@ import org.junit.Test; import org.mockito.ArgumentCaptor; import org.mockito.Mock; +import org.mockito.MockedConstruction; +import org.mockito.Mockito; import org.mockito.MockitoAnnotations; import org.mockito.Spy; @@ -286,10 +288,19 @@ public void init_PassesForceCodeForRefreshTokenTrueWithServerClientIdFromResourc @Test public void init_PassesForceAccountName() { - InitParams params = - buildInitParams("fakeClientId", "fakeServerClientId", "fakeEmailAddress@google.com"); + String fakeAccountName = "fakeEmailAddress@google.com"; - initAndAssertForceAccountName(params, "fakeEmailAddress@google.com"); + try(MockedConstruction mocked = Mockito.mockConstruction(Account.class, (mock, context) -> { + when(mock.toString()).thenReturn(fakeAccountName); + })) { + InitParams params = + buildInitParams("fakeClientId", "fakeServerClientId2", fakeAccountName); + + initAndAssertForceAccountName(params, fakeAccountName); + + List constructed = mocked.constructed(); + Assert.assertEquals(1, constructed.size()); + } } public void initAndAssertServerClientId(InitParams params, String serverClientId) { @@ -318,7 +329,7 @@ public void initAndAssertForceAccountName(InitParams params, String forceAccount when(mockGoogleSignIn.getClient(any(Context.class), optionsCaptor.capture())) .thenReturn(mockClient); plugin.init(params); - Assert.assertEquals(forceAccountName, optionsCaptor.getValue().getAccount().name); + Assert.assertEquals(forceAccountName, optionsCaptor.getValue().getAccount().toString()); } private static InitParams buildInitParams(String clientId, String serverClientId) { From 2e91e38aab9bd0e5942bad445dff075997e3fd3a Mon Sep 17 00:00:00 2001 From: Neil Self Date: Wed, 12 Feb 2025 12:25:06 -0800 Subject: [PATCH 11/29] Fix missing import of Account. --- .../java/io/flutter/plugins/googlesignin/GoogleSignInTest.java | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/google_sign_in/google_sign_in_android/android/src/test/java/io/flutter/plugins/googlesignin/GoogleSignInTest.java b/packages/google_sign_in/google_sign_in_android/android/src/test/java/io/flutter/plugins/googlesignin/GoogleSignInTest.java index d63aa66e6ac..230f9892e22 100644 --- a/packages/google_sign_in/google_sign_in_android/android/src/test/java/io/flutter/plugins/googlesignin/GoogleSignInTest.java +++ b/packages/google_sign_in/google_sign_in_android/android/src/test/java/io/flutter/plugins/googlesignin/GoogleSignInTest.java @@ -10,6 +10,7 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; +import android.accounts.Account; import android.app.Activity; import android.content.Context; import android.content.Intent; From 923d2dac78f4e10e953feb84ebadae0826653275 Mon Sep 17 00:00:00 2001 From: Neil Self Date: Wed, 12 Feb 2025 13:09:59 -0800 Subject: [PATCH 12/29] Update formatting within GoogleSignInTest. --- .../plugins/googlesignin/GoogleSignInTest.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/packages/google_sign_in/google_sign_in_android/android/src/test/java/io/flutter/plugins/googlesignin/GoogleSignInTest.java b/packages/google_sign_in/google_sign_in_android/android/src/test/java/io/flutter/plugins/googlesignin/GoogleSignInTest.java index 230f9892e22..328fba7c2c8 100644 --- a/packages/google_sign_in/google_sign_in_android/android/src/test/java/io/flutter/plugins/googlesignin/GoogleSignInTest.java +++ b/packages/google_sign_in/google_sign_in_android/android/src/test/java/io/flutter/plugins/googlesignin/GoogleSignInTest.java @@ -291,11 +291,13 @@ public void init_PassesForceCodeForRefreshTokenTrueWithServerClientIdFromResourc public void init_PassesForceAccountName() { String fakeAccountName = "fakeEmailAddress@google.com"; - try(MockedConstruction mocked = Mockito.mockConstruction(Account.class, (mock, context) -> { - when(mock.toString()).thenReturn(fakeAccountName); - })) { - InitParams params = - buildInitParams("fakeClientId", "fakeServerClientId2", fakeAccountName); + try (MockedConstruction mocked = + Mockito.mockConstruction( + Account.class, + (mock, context) -> { + when(mock.toString()).thenReturn(fakeAccountName); + })) { + InitParams params = buildInitParams("fakeClientId", "fakeServerClientId2", fakeAccountName); initAndAssertForceAccountName(params, fakeAccountName); From c00f5d337669aa0dc5c2b799f341eecf8e37d717 Mon Sep 17 00:00:00 2001 From: Neil Self Date: Wed, 12 Feb 2025 15:42:30 -0800 Subject: [PATCH 13/29] Override dependencies in extension_google_sign_in_as_googleapis_auth due to platform interface changes in google_sign_in. --- .../example/pubspec.yaml | 4 ++++ .../extension_google_sign_in_as_googleapis_auth/pubspec.yaml | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/packages/extension_google_sign_in_as_googleapis_auth/example/pubspec.yaml b/packages/extension_google_sign_in_as_googleapis_auth/example/pubspec.yaml index 2cae99f0f90..4f089757bb6 100644 --- a/packages/extension_google_sign_in_as_googleapis_auth/example/pubspec.yaml +++ b/packages/extension_google_sign_in_as_googleapis_auth/example/pubspec.yaml @@ -26,3 +26,7 @@ dev_dependencies: flutter: uses-material-design: true +# FOR TESTING AND INITIAL REVIEW ONLY. DO NOT MERGE. +# See https://github.com/flutter/flutter/blob/master/docs/ecosystem/contributing/README.md#changing-federated-plugins +dependency_overrides: + google_sign_in: {path: ../../../packages/google_sign_in/google_sign_in} diff --git a/packages/extension_google_sign_in_as_googleapis_auth/pubspec.yaml b/packages/extension_google_sign_in_as_googleapis_auth/pubspec.yaml index 3a75e11a010..85d109b10a0 100644 --- a/packages/extension_google_sign_in_as_googleapis_auth/pubspec.yaml +++ b/packages/extension_google_sign_in_as_googleapis_auth/pubspec.yaml @@ -33,3 +33,7 @@ topics: false_secrets: - example/android/app/google-services.json - example/ios/Runner/GoogleService-Info.plist +# FOR TESTING AND INITIAL REVIEW ONLY. DO NOT MERGE. +# See https://github.com/flutter/flutter/blob/master/docs/ecosystem/contributing/README.md#changing-federated-plugins +dependency_overrides: + google_sign_in: {path: ../../packages/google_sign_in/google_sign_in} From 80b054a53bcbbb7a9de75195cb489612d678889b Mon Sep 17 00:00:00 2001 From: Neil Self Date: Wed, 12 Feb 2025 18:36:49 -0800 Subject: [PATCH 14/29] Override dependency in extension_google_sign_in_as_googleapis_auth due to platform interface changes in google_sign_in_platform_interface. --- .../extension_google_sign_in_as_googleapis_auth/pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/extension_google_sign_in_as_googleapis_auth/pubspec.yaml b/packages/extension_google_sign_in_as_googleapis_auth/pubspec.yaml index 85d109b10a0..2521dcaa3a3 100644 --- a/packages/extension_google_sign_in_as_googleapis_auth/pubspec.yaml +++ b/packages/extension_google_sign_in_as_googleapis_auth/pubspec.yaml @@ -36,4 +36,4 @@ false_secrets: # FOR TESTING AND INITIAL REVIEW ONLY. DO NOT MERGE. # See https://github.com/flutter/flutter/blob/master/docs/ecosystem/contributing/README.md#changing-federated-plugins dependency_overrides: - google_sign_in: {path: ../../packages/google_sign_in/google_sign_in} + google_sign_in_platform_interface: {path: ../../packages/google_sign_in/google_sign_in_platform_interface} From 68a20326372b47e8c66f1b458b791d3c9a0bdb4b Mon Sep 17 00:00:00 2001 From: Neil Self Date: Wed, 12 Feb 2025 20:06:59 -0800 Subject: [PATCH 15/29] Override dependency in extension_google_sign_in_as_googleapis_auth/example due to platform interface changes in google_sign_in_platform_interface. --- .../example/pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/extension_google_sign_in_as_googleapis_auth/example/pubspec.yaml b/packages/extension_google_sign_in_as_googleapis_auth/example/pubspec.yaml index 4f089757bb6..e8ec81cc0e6 100644 --- a/packages/extension_google_sign_in_as_googleapis_auth/example/pubspec.yaml +++ b/packages/extension_google_sign_in_as_googleapis_auth/example/pubspec.yaml @@ -29,4 +29,4 @@ flutter: # FOR TESTING AND INITIAL REVIEW ONLY. DO NOT MERGE. # See https://github.com/flutter/flutter/blob/master/docs/ecosystem/contributing/README.md#changing-federated-plugins dependency_overrides: - google_sign_in: {path: ../../../packages/google_sign_in/google_sign_in} + google_sign_in_platform_interface: {path: ../../../packages/google_sign_in/google_sign_in_platform_interface} From 9327b580b0afdc605514716325171839439b7b07 Mon Sep 17 00:00:00 2001 From: Neil Self Date: Wed, 12 Feb 2025 20:32:13 -0800 Subject: [PATCH 16/29] Update version/CHANGELOG for google_sign_in_ios and extension_google_sign_in_as_googleapis_auth for new change adding an optional account name field for Android sign-in. --- .../extension_google_sign_in_as_googleapis_auth/CHANGELOG.md | 3 ++- .../extension_google_sign_in_as_googleapis_auth/pubspec.yaml | 2 +- packages/google_sign_in/google_sign_in_ios/CHANGELOG.md | 4 ++++ packages/google_sign_in/google_sign_in_ios/pubspec.yaml | 2 +- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/packages/extension_google_sign_in_as_googleapis_auth/CHANGELOG.md b/packages/extension_google_sign_in_as_googleapis_auth/CHANGELOG.md index c5dc18b149b..b13034a0555 100644 --- a/packages/extension_google_sign_in_as_googleapis_auth/CHANGELOG.md +++ b/packages/extension_google_sign_in_as_googleapis_auth/CHANGELOG.md @@ -1,5 +1,6 @@ -## NEXT +## 2.1.0 +* Add a sign-in field to allow Android clients to explicitly specify an account name. This capability is only available within Android for the underlying libraries. * Updates minimum supported SDK version to Flutter 3.22/Dart 3.4. ## 2.0.12 diff --git a/packages/extension_google_sign_in_as_googleapis_auth/pubspec.yaml b/packages/extension_google_sign_in_as_googleapis_auth/pubspec.yaml index 2521dcaa3a3..a8d1509dd6b 100644 --- a/packages/extension_google_sign_in_as_googleapis_auth/pubspec.yaml +++ b/packages/extension_google_sign_in_as_googleapis_auth/pubspec.yaml @@ -8,7 +8,7 @@ name: extension_google_sign_in_as_googleapis_auth description: A bridge package between google_sign_in and googleapis_auth, to create Authenticated Clients from google_sign_in user credentials. repository: https://github.com/flutter/packages/tree/main/packages/extension_google_sign_in_as_googleapis_auth issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+extension_google_sign_in_as_googleapis_auth%22 -version: 2.0.12 +version: 2.1.0 environment: sdk: ^3.4.0 diff --git a/packages/google_sign_in/google_sign_in_ios/CHANGELOG.md b/packages/google_sign_in/google_sign_in_ios/CHANGELOG.md index 1f72da7904e..195e03c4cf9 100644 --- a/packages/google_sign_in/google_sign_in_ios/CHANGELOG.md +++ b/packages/google_sign_in/google_sign_in_ios/CHANGELOG.md @@ -1,3 +1,7 @@ +## 5.9.0 + +* Add a sign-in field to allow Android clients to explicitly specify an account name. This capability is only available within Android for the underlying libraries. + ## 5.8.0 * Add a sign-in field to allow Android clients to explicitly specify an account name. This capability is only available within Android for the underlying libraries. diff --git a/packages/google_sign_in/google_sign_in_ios/pubspec.yaml b/packages/google_sign_in/google_sign_in_ios/pubspec.yaml index e784d52ca10..5bd02cad1f7 100644 --- a/packages/google_sign_in/google_sign_in_ios/pubspec.yaml +++ b/packages/google_sign_in/google_sign_in_ios/pubspec.yaml @@ -2,7 +2,7 @@ name: google_sign_in_ios description: iOS implementation of the google_sign_in plugin. repository: https://github.com/flutter/packages/tree/main/packages/google_sign_in/google_sign_in_ios issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+google_sign_in%22 -version: 5.8.0 +version: 5.9.0 environment: sdk: ^3.4.0 From 6d4c3141e9f0a95eb3ec2d2928ac9b1d1326cfb3 Mon Sep 17 00:00:00 2001 From: Neil Self Date: Wed, 19 Feb 2025 17:15:35 -0800 Subject: [PATCH 17/29] Update isNullOrEmpty() usage to match new convention. --- .../io/flutter/plugins/googlesignin/GoogleSignInPlugin.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google_sign_in/google_sign_in_android/android/src/main/java/io/flutter/plugins/googlesignin/GoogleSignInPlugin.java b/packages/google_sign_in/google_sign_in_android/android/src/main/java/io/flutter/plugins/googlesignin/GoogleSignInPlugin.java index 3993eabe0f7..46294212703 100644 --- a/packages/google_sign_in/google_sign_in_android/android/src/main/java/io/flutter/plugins/googlesignin/GoogleSignInPlugin.java +++ b/packages/google_sign_in/google_sign_in_android/android/src/main/java/io/flutter/plugins/googlesignin/GoogleSignInPlugin.java @@ -256,7 +256,7 @@ public void init(@NonNull Messages.InitParams params) { } String forceAccountName = params.getForceAccountName(); - if (!Strings.isNullOrEmpty(forceAccountName)) { + if (!isNullOrEmpty(forceAccountName)) { optionsBuilder.setAccountName(forceAccountName); } From 473b5e7ccdd2e94c0fe573092cee8fb98a144a4c Mon Sep 17 00:00:00 2001 From: Neil Self Date: Thu, 20 Feb 2025 18:22:49 -0800 Subject: [PATCH 18/29] Revert changes to extension_google_sign_in_as_googleapis_auth package. --- .../CHANGELOG.md | 5 ++--- .../example/pubspec.yaml | 6 +----- .../pubspec.yaml | 10 +++------- 3 files changed, 6 insertions(+), 15 deletions(-) diff --git a/packages/extension_google_sign_in_as_googleapis_auth/CHANGELOG.md b/packages/extension_google_sign_in_as_googleapis_auth/CHANGELOG.md index b13034a0555..f6206c28632 100644 --- a/packages/extension_google_sign_in_as_googleapis_auth/CHANGELOG.md +++ b/packages/extension_google_sign_in_as_googleapis_auth/CHANGELOG.md @@ -1,6 +1,5 @@ -## 2.1.0 +## NEXT -* Add a sign-in field to allow Android clients to explicitly specify an account name. This capability is only available within Android for the underlying libraries. * Updates minimum supported SDK version to Flutter 3.22/Dart 3.4. ## 2.0.12 @@ -83,4 +82,4 @@ ## 1.0.0 -* First published version. +* First published version. \ No newline at end of file diff --git a/packages/extension_google_sign_in_as_googleapis_auth/example/pubspec.yaml b/packages/extension_google_sign_in_as_googleapis_auth/example/pubspec.yaml index e8ec81cc0e6..524401e7acb 100644 --- a/packages/extension_google_sign_in_as_googleapis_auth/example/pubspec.yaml +++ b/packages/extension_google_sign_in_as_googleapis_auth/example/pubspec.yaml @@ -25,8 +25,4 @@ dev_dependencies: sdk: flutter flutter: - uses-material-design: true -# FOR TESTING AND INITIAL REVIEW ONLY. DO NOT MERGE. -# See https://github.com/flutter/flutter/blob/master/docs/ecosystem/contributing/README.md#changing-federated-plugins -dependency_overrides: - google_sign_in_platform_interface: {path: ../../../packages/google_sign_in/google_sign_in_platform_interface} + uses-material-design: true \ No newline at end of file diff --git a/packages/extension_google_sign_in_as_googleapis_auth/pubspec.yaml b/packages/extension_google_sign_in_as_googleapis_auth/pubspec.yaml index a8d1509dd6b..963923ded0f 100644 --- a/packages/extension_google_sign_in_as_googleapis_auth/pubspec.yaml +++ b/packages/extension_google_sign_in_as_googleapis_auth/pubspec.yaml @@ -8,7 +8,7 @@ name: extension_google_sign_in_as_googleapis_auth description: A bridge package between google_sign_in and googleapis_auth, to create Authenticated Clients from google_sign_in user credentials. repository: https://github.com/flutter/packages/tree/main/packages/extension_google_sign_in_as_googleapis_auth issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+extension_google_sign_in_as_googleapis_auth%22 -version: 2.1.0 +version: 2.0.12 environment: sdk: ^3.4.0 @@ -31,9 +31,5 @@ topics: - google-sign-in false_secrets: - - example/android/app/google-services.json - - example/ios/Runner/GoogleService-Info.plist -# FOR TESTING AND INITIAL REVIEW ONLY. DO NOT MERGE. -# See https://github.com/flutter/flutter/blob/master/docs/ecosystem/contributing/README.md#changing-federated-plugins -dependency_overrides: - google_sign_in_platform_interface: {path: ../../packages/google_sign_in/google_sign_in_platform_interface} + - example/android/app/google-services.json + - example/ios/Runner/GoogleService-Info.plist \ No newline at end of file From c4fd24ccc4baf48c36a53e79f123effa7602bfb0 Mon Sep 17 00:00:00 2001 From: Neil Self Date: Thu, 20 Feb 2025 19:14:32 -0800 Subject: [PATCH 19/29] Minor updates to respond to PR review comments. --- packages/google_sign_in/google_sign_in/CHANGELOG.md | 3 ++- .../google_sign_in/lib/google_sign_in.dart | 2 +- .../google_sign_in/test/google_sign_in_test.dart | 4 ++-- .../google_sign_in/google_sign_in_android/CHANGELOG.md | 2 +- .../flutter/plugins/googlesignin/GoogleSignInTest.java | 2 +- .../example/android/app/build.gradle | 1 - .../test/google_sign_in_android_test.dart | 2 +- .../google_sign_in/google_sign_in_ios/CHANGELOG.md | 5 ++--- .../google_sign_in_ios/lib/google_sign_in_ios.dart | 4 +--- .../google_sign_in/google_sign_in_ios/pubspec.yaml | 2 +- .../test/google_sign_in_ios_test.dart | 2 +- .../lib/src/method_channel_google_sign_in.dart | 7 ++----- .../lib/src/types.dart | 2 +- .../test/method_channel_google_sign_in_test.dart | 10 +++------- .../google_sign_in/google_sign_in_web/CHANGELOG.md | 4 ++-- .../integration_test/google_sign_in_web_test.dart | 2 +- .../google_sign_in/google_sign_in_web/pubspec.yaml | 2 +- 17 files changed, 23 insertions(+), 33 deletions(-) diff --git a/packages/google_sign_in/google_sign_in/CHANGELOG.md b/packages/google_sign_in/google_sign_in/CHANGELOG.md index e664dd7225c..17f98cbaa1d 100644 --- a/packages/google_sign_in/google_sign_in/CHANGELOG.md +++ b/packages/google_sign_in/google_sign_in/CHANGELOG.md @@ -1,6 +1,7 @@ ## 6.3.0 -* Add a sign-in field to allow Android clients to explicitly specify an account name. This capability is only available within Android for the underlying libraries. +* Adds a sign-in field to allow Android clients to explicitly specify an account name. This + capability is only available within Android for the underlying libraries. * Updates minimum supported SDK version to Flutter 3.22/Dart 3.4. ## 6.2.2 diff --git a/packages/google_sign_in/google_sign_in/lib/google_sign_in.dart b/packages/google_sign_in/google_sign_in/lib/google_sign_in.dart index 7e3a0891d05..93565ad052b 100644 --- a/packages/google_sign_in/google_sign_in/lib/google_sign_in.dart +++ b/packages/google_sign_in/google_sign_in/lib/google_sign_in.dart @@ -264,7 +264,7 @@ class GoogleSignIn { /// Force the authorization code to be valid for a refresh token every time. Only needed on Android. final bool forceCodeForRefreshToken; - /// Explicitly specifies the account name to be used in sign-in. Only used on Android. + /// Explicitly specifies the account name to be used in sign-in. Must only be set on Android. final String? forceAccountName; final StreamController _currentUserController = diff --git a/packages/google_sign_in/google_sign_in/test/google_sign_in_test.dart b/packages/google_sign_in/google_sign_in/test/google_sign_in_test.dart index 6a3521ea306..0853691f6ba 100644 --- a/packages/google_sign_in/google_sign_in/test/google_sign_in_test.dart +++ b/packages/google_sign_in/google_sign_in/test/google_sign_in_test.dart @@ -115,12 +115,12 @@ void main() { test('forceAccountName sent with init method call', () async { final GoogleSignIn googleSignIn = - GoogleSignIn(forceAccountName: 'fakeEmailAddress@google.com'); + GoogleSignIn(forceAccountName: 'fakeEmailAddress@example.com'); await googleSignIn.signIn(); _verifyInit(mockPlatform, - forceAccountName: 'fakeEmailAddress@google.com'); + forceAccountName: 'fakeEmailAddress@example.com'); verify(mockPlatform.signIn()); }); diff --git a/packages/google_sign_in/google_sign_in_android/CHANGELOG.md b/packages/google_sign_in/google_sign_in_android/CHANGELOG.md index e40f2c2404a..f82950ea300 100644 --- a/packages/google_sign_in/google_sign_in_android/CHANGELOG.md +++ b/packages/google_sign_in/google_sign_in_android/CHANGELOG.md @@ -1,6 +1,6 @@ ## 6.2.0 -* Add a sign-in field to allow Android clients to explicitly specify an account name. This capability is only available within Android for the underlying libraries. +* Add a sign-in field to allow clients to explicitly specify an account name. ## 6.1.35 diff --git a/packages/google_sign_in/google_sign_in_android/android/src/test/java/io/flutter/plugins/googlesignin/GoogleSignInTest.java b/packages/google_sign_in/google_sign_in_android/android/src/test/java/io/flutter/plugins/googlesignin/GoogleSignInTest.java index 328fba7c2c8..32ade75d0cb 100644 --- a/packages/google_sign_in/google_sign_in_android/android/src/test/java/io/flutter/plugins/googlesignin/GoogleSignInTest.java +++ b/packages/google_sign_in/google_sign_in_android/android/src/test/java/io/flutter/plugins/googlesignin/GoogleSignInTest.java @@ -289,7 +289,7 @@ public void init_PassesForceCodeForRefreshTokenTrueWithServerClientIdFromResourc @Test public void init_PassesForceAccountName() { - String fakeAccountName = "fakeEmailAddress@google.com"; + String fakeAccountName = "fakeEmailAddress@example.com"; try (MockedConstruction mocked = Mockito.mockConstruction( diff --git a/packages/google_sign_in/google_sign_in_android/example/android/app/build.gradle b/packages/google_sign_in/google_sign_in_android/example/android/app/build.gradle index c3d405d9b87..55b8f8a7ea2 100644 --- a/packages/google_sign_in/google_sign_in_android/example/android/app/build.gradle +++ b/packages/google_sign_in/google_sign_in_android/example/android/app/build.gradle @@ -25,7 +25,6 @@ if (flutterVersionName == null) { android { namespace 'io.flutter.plugins.googlesigninexample' compileSdk flutter.compileSdkVersion - ndkVersion = "26.3.11579264" defaultConfig { diff --git a/packages/google_sign_in/google_sign_in_android/test/google_sign_in_android_test.dart b/packages/google_sign_in/google_sign_in_android/test/google_sign_in_android_test.dart index 3b1097c9b14..20cfb6a746e 100644 --- a/packages/google_sign_in/google_sign_in_android/test/google_sign_in_android_test.dart +++ b/packages/google_sign_in/google_sign_in_android/test/google_sign_in_android_test.dart @@ -143,7 +143,7 @@ void main() { clientId: 'fakeClientId', serverClientId: 'fakeServerClientId', forceCodeForRefreshToken: true, - forceAccountName: 'fakeEmailAddress@google.com', + forceAccountName: 'fakeEmailAddress@example.com', ); await googleSignIn.initWithParams(initParams); diff --git a/packages/google_sign_in/google_sign_in_ios/CHANGELOG.md b/packages/google_sign_in/google_sign_in_ios/CHANGELOG.md index 195e03c4cf9..ad6b725f944 100644 --- a/packages/google_sign_in/google_sign_in_ios/CHANGELOG.md +++ b/packages/google_sign_in/google_sign_in_ios/CHANGELOG.md @@ -1,10 +1,9 @@ -## 5.9.0 +## 5.8.0+1 -* Add a sign-in field to allow Android clients to explicitly specify an account name. This capability is only available within Android for the underlying libraries. +* Asserts that new `forceAccountName` parameter is null (not used in iOS). ## 5.8.0 -* Add a sign-in field to allow Android clients to explicitly specify an account name. This capability is only available within Android for the underlying libraries. * Updates minimum supported SDK version to Flutter 3.22/Dart 3.4. * Adds Swift Package Manager compatibility. diff --git a/packages/google_sign_in/google_sign_in_ios/lib/google_sign_in_ios.dart b/packages/google_sign_in/google_sign_in_ios/lib/google_sign_in_ios.dart index 22c6333dac9..652ead516a0 100644 --- a/packages/google_sign_in/google_sign_in_ios/lib/google_sign_in_ios.dart +++ b/packages/google_sign_in/google_sign_in_ios/lib/google_sign_in_ios.dart @@ -47,9 +47,7 @@ class GoogleSignInIOS extends GoogleSignInPlatform { message: 'Games sign in is not supported on iOS'); } if (params.forceAccountName != null) { - throw PlatformException( - code: 'unsupported-options', - message: 'Force account name is not supported on iOS'); + throw ArgumentError('Force account name is not supported on iOS'); } return _api.init(InitParams( scopes: params.scopes, diff --git a/packages/google_sign_in/google_sign_in_ios/pubspec.yaml b/packages/google_sign_in/google_sign_in_ios/pubspec.yaml index 5bd02cad1f7..317688edc82 100644 --- a/packages/google_sign_in/google_sign_in_ios/pubspec.yaml +++ b/packages/google_sign_in/google_sign_in_ios/pubspec.yaml @@ -2,7 +2,7 @@ name: google_sign_in_ios description: iOS implementation of the google_sign_in plugin. repository: https://github.com/flutter/packages/tree/main/packages/google_sign_in/google_sign_in_ios issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+google_sign_in%22 -version: 5.9.0 +version: 5.8.0+1 environment: sdk: ^3.4.0 diff --git a/packages/google_sign_in/google_sign_in_ios/test/google_sign_in_ios_test.dart b/packages/google_sign_in/google_sign_in_ios/test/google_sign_in_ios_test.dart index 45b221614fe..a2fb225054c 100644 --- a/packages/google_sign_in/google_sign_in_ios/test/google_sign_in_ios_test.dart +++ b/packages/google_sign_in/google_sign_in_ios/test/google_sign_in_ios_test.dart @@ -58,7 +58,7 @@ void main() { const SignInInitParameters( hostedDomain: 'example.com', clientId: 'fakeClientId', - forceAccountName: 'fakeEmailAddress@google.com', + forceAccountName: 'fakeEmailAddress@example.com', ), ), throwsA(isInstanceOf().having( diff --git a/packages/google_sign_in/google_sign_in_platform_interface/lib/src/method_channel_google_sign_in.dart b/packages/google_sign_in/google_sign_in_platform_interface/lib/src/method_channel_google_sign_in.dart index 447ec826ed7..656d736bfb9 100644 --- a/packages/google_sign_in/google_sign_in_platform_interface/lib/src/method_channel_google_sign_in.dart +++ b/packages/google_sign_in/google_sign_in_platform_interface/lib/src/method_channel_google_sign_in.dart @@ -24,14 +24,12 @@ class MethodChannelGoogleSignIn extends GoogleSignInPlatform { SignInOption signInOption = SignInOption.standard, String? hostedDomain, String? clientId, - String? forceAccountName, }) { return initWithParams(SignInInitParameters( scopes: scopes, signInOption: signInOption, hostedDomain: hostedDomain, - clientId: clientId, - forceAccountName: forceAccountName)); + clientId: clientId)); } @override @@ -43,7 +41,6 @@ class MethodChannelGoogleSignIn extends GoogleSignInPlatform { 'clientId': params.clientId, 'serverClientId': params.serverClientId, 'forceCodeForRefreshToken': params.forceCodeForRefreshToken, - 'forceAccountName': params.forceAccountName, }); } @@ -101,4 +98,4 @@ class MethodChannelGoogleSignIn extends GoogleSignInPlatform { >{'scopes': scopes}, ))!; } -} +} \ No newline at end of file diff --git a/packages/google_sign_in/google_sign_in_platform_interface/lib/src/types.dart b/packages/google_sign_in/google_sign_in_platform_interface/lib/src/types.dart index 14c7f9f17af..d9de482518e 100644 --- a/packages/google_sign_in/google_sign_in_platform_interface/lib/src/types.dart +++ b/packages/google_sign_in/google_sign_in_platform_interface/lib/src/types.dart @@ -82,7 +82,7 @@ class SignInInitParameters { /// Can be used to explicitly set an account name on the underlying platform sign-in API. /// - /// This is only used on Android. + /// This should only be set on Android; other platforms may assert. final String? forceAccountName; } diff --git a/packages/google_sign_in/google_sign_in_platform_interface/test/method_channel_google_sign_in_test.dart b/packages/google_sign_in/google_sign_in_platform_interface/test/method_channel_google_sign_in_test.dart index 0ebfdd27b98..a6f35a4aca2 100644 --- a/packages/google_sign_in/google_sign_in_platform_interface/test/method_channel_google_sign_in_test.dart +++ b/packages/google_sign_in/google_sign_in_platform_interface/test/method_channel_google_sign_in_test.dart @@ -102,8 +102,7 @@ void main() { hostedDomain: 'example.com', scopes: ['two', 'scopes'], signInOption: SignInOption.games, - clientId: 'fakeClientId', - forceAccountName: 'fakeEmailAddress@google.com'); + clientId: 'fakeClientId'); }: isMethodCall('init', arguments: { 'hostedDomain': 'example.com', 'scopes': ['two', 'scopes'], @@ -111,7 +110,6 @@ void main() { 'clientId': 'fakeClientId', 'serverClientId': null, 'forceCodeForRefreshToken': false, - 'forceAccountName': 'fakeEmailAddress@google.com', }), () { googleSignIn.getTokens( @@ -160,8 +158,7 @@ void main() { signInOption: SignInOption.games, clientId: 'fakeClientId', serverClientId: 'fakeServerClientId', - forceCodeForRefreshToken: true, - forceAccountName: 'fakeEmailAddress@google.com')); + forceCodeForRefreshToken: true)); expect(log, [ isMethodCall('init', arguments: { 'hostedDomain': 'example.com', @@ -170,9 +167,8 @@ void main() { 'clientId': 'fakeClientId', 'serverClientId': 'fakeServerClientId', 'forceCodeForRefreshToken': true, - 'forceAccountName': 'fakeEmailAddress@google.com', }), ]); }); }); -} +} \ No newline at end of file diff --git a/packages/google_sign_in/google_sign_in_web/CHANGELOG.md b/packages/google_sign_in/google_sign_in_web/CHANGELOG.md index e1c192444d0..0dd0d245abf 100644 --- a/packages/google_sign_in/google_sign_in_web/CHANGELOG.md +++ b/packages/google_sign_in/google_sign_in_web/CHANGELOG.md @@ -1,6 +1,6 @@ -## 0.12.5 +## 0.12.4+4 -* Add a sign-in field to allow Android clients to explicitly specify an account name. This capability is only available within Android for the underlying libraries. +* Asserts that new `forceAccountName` parameter is null (not used in web). * Updates minimum supported SDK version to Flutter 3.22/Dart 3.4. ## 0.12.4+3 diff --git a/packages/google_sign_in/google_sign_in_web/example/integration_test/google_sign_in_web_test.dart b/packages/google_sign_in/google_sign_in_web/example/integration_test/google_sign_in_web_test.dart index 696a7fb0c1c..88b69f26fb5 100644 --- a/packages/google_sign_in/google_sign_in_web/example/integration_test/google_sign_in_web_test.dart +++ b/packages/google_sign_in/google_sign_in_web/example/integration_test/google_sign_in_web_test.dart @@ -112,7 +112,7 @@ void main() { await plugin.initWithParams( const SignInInitParameters( clientId: 'some-non-null-client-id', - forceAccountName: 'fakeEmailAddress@google.com', + forceAccountName: 'fakeEmailAddress@example.com', ), ); }, throwsAssertionError); diff --git a/packages/google_sign_in/google_sign_in_web/pubspec.yaml b/packages/google_sign_in/google_sign_in_web/pubspec.yaml index ac3271277be..de9f9ff8cf4 100644 --- a/packages/google_sign_in/google_sign_in_web/pubspec.yaml +++ b/packages/google_sign_in/google_sign_in_web/pubspec.yaml @@ -3,7 +3,7 @@ description: Flutter plugin for Google Sign-In, a secure authentication system for signing in with a Google account on Android, iOS and Web. repository: https://github.com/flutter/packages/tree/main/packages/google_sign_in/google_sign_in_web issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+google_sign_in%22 -version: 0.12.5 +version: 0.12.4+4 environment: sdk: ^3.4.0 From 16438e20ab2f8191a68056df18f57ec8c9ca5df5 Mon Sep 17 00:00:00 2001 From: Neil Self Date: Thu, 20 Feb 2025 20:20:14 -0800 Subject: [PATCH 20/29] Revert changes in the extension_google_sign_in_as_googleapis_auth package. --- .../extension_google_sign_in_as_googleapis_auth/CHANGELOG.md | 2 +- .../example/pubspec.yaml | 2 +- .../extension_google_sign_in_as_googleapis_auth/pubspec.yaml | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/extension_google_sign_in_as_googleapis_auth/CHANGELOG.md b/packages/extension_google_sign_in_as_googleapis_auth/CHANGELOG.md index f6206c28632..c5dc18b149b 100644 --- a/packages/extension_google_sign_in_as_googleapis_auth/CHANGELOG.md +++ b/packages/extension_google_sign_in_as_googleapis_auth/CHANGELOG.md @@ -82,4 +82,4 @@ ## 1.0.0 -* First published version. \ No newline at end of file +* First published version. diff --git a/packages/extension_google_sign_in_as_googleapis_auth/example/pubspec.yaml b/packages/extension_google_sign_in_as_googleapis_auth/example/pubspec.yaml index 524401e7acb..2cae99f0f90 100644 --- a/packages/extension_google_sign_in_as_googleapis_auth/example/pubspec.yaml +++ b/packages/extension_google_sign_in_as_googleapis_auth/example/pubspec.yaml @@ -25,4 +25,4 @@ dev_dependencies: sdk: flutter flutter: - uses-material-design: true \ No newline at end of file + uses-material-design: true diff --git a/packages/extension_google_sign_in_as_googleapis_auth/pubspec.yaml b/packages/extension_google_sign_in_as_googleapis_auth/pubspec.yaml index 963923ded0f..3a75e11a010 100644 --- a/packages/extension_google_sign_in_as_googleapis_auth/pubspec.yaml +++ b/packages/extension_google_sign_in_as_googleapis_auth/pubspec.yaml @@ -31,5 +31,5 @@ topics: - google-sign-in false_secrets: - - example/android/app/google-services.json - - example/ios/Runner/GoogleService-Info.plist \ No newline at end of file + - example/android/app/google-services.json + - example/ios/Runner/GoogleService-Info.plist From 1acd5887179d767af4243fae494c99ee3fbfed87 Mon Sep 17 00:00:00 2001 From: Neil Self Date: Thu, 20 Feb 2025 20:32:59 -0800 Subject: [PATCH 21/29] Revert changes in method_channel_google_sign_in.dart and its test file. --- .../lib/src/method_channel_google_sign_in.dart | 2 +- .../test/method_channel_google_sign_in_test.dart | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/google_sign_in/google_sign_in_platform_interface/lib/src/method_channel_google_sign_in.dart b/packages/google_sign_in/google_sign_in_platform_interface/lib/src/method_channel_google_sign_in.dart index 656d736bfb9..fde29aeb8e4 100644 --- a/packages/google_sign_in/google_sign_in_platform_interface/lib/src/method_channel_google_sign_in.dart +++ b/packages/google_sign_in/google_sign_in_platform_interface/lib/src/method_channel_google_sign_in.dart @@ -98,4 +98,4 @@ class MethodChannelGoogleSignIn extends GoogleSignInPlatform { >{'scopes': scopes}, ))!; } -} \ No newline at end of file +} diff --git a/packages/google_sign_in/google_sign_in_platform_interface/test/method_channel_google_sign_in_test.dart b/packages/google_sign_in/google_sign_in_platform_interface/test/method_channel_google_sign_in_test.dart index a6f35a4aca2..52e792a9c25 100644 --- a/packages/google_sign_in/google_sign_in_platform_interface/test/method_channel_google_sign_in_test.dart +++ b/packages/google_sign_in/google_sign_in_platform_interface/test/method_channel_google_sign_in_test.dart @@ -171,4 +171,4 @@ void main() { ]); }); }); -} \ No newline at end of file +} From 18af9896be2fd068db13597b91f94037bc79b4b6 Mon Sep 17 00:00:00 2001 From: Neil Self Date: Thu, 20 Feb 2025 20:40:33 -0800 Subject: [PATCH 22/29] Updates the CHANGELOG for google_sign_in_android to better follow the style guide. --- packages/google_sign_in/google_sign_in_android/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google_sign_in/google_sign_in_android/CHANGELOG.md b/packages/google_sign_in/google_sign_in_android/CHANGELOG.md index f82950ea300..a051118da93 100644 --- a/packages/google_sign_in/google_sign_in_android/CHANGELOG.md +++ b/packages/google_sign_in/google_sign_in_android/CHANGELOG.md @@ -1,6 +1,6 @@ ## 6.2.0 -* Add a sign-in field to allow clients to explicitly specify an account name. +* Adds a sign-in field to allow clients to explicitly specify an account name. ## 6.1.35 From 9476549abc698ad4ca9a71c1f19241d3f1fc6ea9 Mon Sep 17 00:00:00 2001 From: Neil Self Date: Fri, 21 Feb 2025 14:21:07 -0800 Subject: [PATCH 23/29] Update exception type in google_sign_in_ios_test to match new exception thrown in corresponding code. --- .../google_sign_in_ios/test/google_sign_in_ios_test.dart | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/google_sign_in/google_sign_in_ios/test/google_sign_in_ios_test.dart b/packages/google_sign_in/google_sign_in_ios/test/google_sign_in_ios_test.dart index a2fb225054c..bd9d473a320 100644 --- a/packages/google_sign_in/google_sign_in_ios/test/google_sign_in_ios_test.dart +++ b/packages/google_sign_in/google_sign_in_ios/test/google_sign_in_ios_test.dart @@ -61,8 +61,10 @@ void main() { forceAccountName: 'fakeEmailAddress@example.com', ), ), - throwsA(isInstanceOf().having( - (PlatformException e) => e.code, 'code', 'unsupported-options'))); + throwsA(isInstanceOf().having( + (ArgumentError e) => e.message, + 'message', + 'Force account name is not supported on iOS'))); }); test('signInSilently transforms platform data to GoogleSignInUserData', From fca499153038b6950aa6f143a7f49043a73ae55d Mon Sep 17 00:00:00 2001 From: Neil Self Date: Thu, 27 Feb 2025 16:02:58 -0800 Subject: [PATCH 24/29] Update version number for google_sign_in_ios and some comment language for a method in google_sign_in_platform_interface based on PR comments. --- packages/google_sign_in/google_sign_in_ios/CHANGELOG.md | 2 +- packages/google_sign_in/google_sign_in_ios/pubspec.yaml | 2 +- .../google_sign_in_platform_interface/lib/src/types.dart | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/google_sign_in/google_sign_in_ios/CHANGELOG.md b/packages/google_sign_in/google_sign_in_ios/CHANGELOG.md index ad6b725f944..ccd7d19cfe5 100644 --- a/packages/google_sign_in/google_sign_in_ios/CHANGELOG.md +++ b/packages/google_sign_in/google_sign_in_ios/CHANGELOG.md @@ -1,4 +1,4 @@ -## 5.8.0+1 +## 5.8.1 * Asserts that new `forceAccountName` parameter is null (not used in iOS). diff --git a/packages/google_sign_in/google_sign_in_ios/pubspec.yaml b/packages/google_sign_in/google_sign_in_ios/pubspec.yaml index 317688edc82..95fa32ca925 100644 --- a/packages/google_sign_in/google_sign_in_ios/pubspec.yaml +++ b/packages/google_sign_in/google_sign_in_ios/pubspec.yaml @@ -2,7 +2,7 @@ name: google_sign_in_ios description: iOS implementation of the google_sign_in plugin. repository: https://github.com/flutter/packages/tree/main/packages/google_sign_in/google_sign_in_ios issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+google_sign_in%22 -version: 5.8.0+1 +version: 5.8.1 environment: sdk: ^3.4.0 diff --git a/packages/google_sign_in/google_sign_in_platform_interface/lib/src/types.dart b/packages/google_sign_in/google_sign_in_platform_interface/lib/src/types.dart index d9de482518e..057927d5164 100644 --- a/packages/google_sign_in/google_sign_in_platform_interface/lib/src/types.dart +++ b/packages/google_sign_in/google_sign_in_platform_interface/lib/src/types.dart @@ -82,7 +82,7 @@ class SignInInitParameters { /// Can be used to explicitly set an account name on the underlying platform sign-in API. /// - /// This should only be set on Android; other platforms may assert. + /// This should only be set on Android; other platforms may throw. final String? forceAccountName; } From 117ca4b9005a358973e0d7cecc08c4c23b08cedf Mon Sep 17 00:00:00 2001 From: Neil Self Date: Mon, 3 Mar 2025 14:12:40 -0800 Subject: [PATCH 25/29] 'Revert' changes to origin/main for google_sign_in_platform_interface subpackage now that those changes have been submitted in another PR. --- .../google_sign_in_platform_interface/CHANGELOG.md | 3 +-- .../google_sign_in_platform_interface/lib/src/types.dart | 6 ------ .../google_sign_in_platform_interface/pubspec.yaml | 2 +- 3 files changed, 2 insertions(+), 9 deletions(-) diff --git a/packages/google_sign_in/google_sign_in_platform_interface/CHANGELOG.md b/packages/google_sign_in/google_sign_in_platform_interface/CHANGELOG.md index 987f6f2e197..fda47024354 100644 --- a/packages/google_sign_in/google_sign_in_platform_interface/CHANGELOG.md +++ b/packages/google_sign_in/google_sign_in_platform_interface/CHANGELOG.md @@ -1,6 +1,5 @@ -## 2.5.0 +## NEXT -* Add a sign-in field to allow Android clients to explicitly specify an account name. This capability is only available within Android for the underlying libraries. * Updates minimum supported SDK version to Flutter 3.22/Dart 3.4. ## 2.4.5 diff --git a/packages/google_sign_in/google_sign_in_platform_interface/lib/src/types.dart b/packages/google_sign_in/google_sign_in_platform_interface/lib/src/types.dart index 057927d5164..5c74450b480 100644 --- a/packages/google_sign_in/google_sign_in_platform_interface/lib/src/types.dart +++ b/packages/google_sign_in/google_sign_in_platform_interface/lib/src/types.dart @@ -36,7 +36,6 @@ class SignInInitParameters { this.clientId, this.serverClientId, this.forceCodeForRefreshToken = false, - this.forceAccountName, }); /// The list of OAuth scope codes to request when signing in. @@ -79,11 +78,6 @@ class SignInInitParameters { /// /// This is only used on Android. final bool forceCodeForRefreshToken; - - /// Can be used to explicitly set an account name on the underlying platform sign-in API. - /// - /// This should only be set on Android; other platforms may throw. - final String? forceAccountName; } /// Holds information about the signed in user. diff --git a/packages/google_sign_in/google_sign_in_platform_interface/pubspec.yaml b/packages/google_sign_in/google_sign_in_platform_interface/pubspec.yaml index d0156993eb3..2581773c69d 100644 --- a/packages/google_sign_in/google_sign_in_platform_interface/pubspec.yaml +++ b/packages/google_sign_in/google_sign_in_platform_interface/pubspec.yaml @@ -4,7 +4,7 @@ repository: https://github.com/flutter/packages/tree/main/packages/google_sign_i issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+google_sign_in%22 # NOTE: We strongly prefer non-breaking changes, even at the expense of a # less-clean API. See https://flutter.dev/go/platform-interface-breaking-changes -version: 2.5.0 +version: 2.4.5 environment: sdk: ^3.4.0 From a3885ef07eb599e5bd456130217b921cb1b7ee2f Mon Sep 17 00:00:00 2001 From: Neil Self Date: Mon, 3 Mar 2025 14:25:20 -0800 Subject: [PATCH 26/29] Update pubspec.yaml files in google_sign_in to remove dependency overrides and depend on the new version of google_sign_in_platform_interface. --- .../google_sign_in/google_sign_in/example/pubspec.yaml | 5 ----- packages/google_sign_in/google_sign_in/pubspec.yaml | 7 +------ .../google_sign_in_android/example/pubspec.yaml | 7 +------ .../google_sign_in/google_sign_in_android/pubspec.yaml | 7 +------ .../google_sign_in/google_sign_in_ios/example/pubspec.yaml | 7 +------ packages/google_sign_in/google_sign_in_ios/pubspec.yaml | 7 +------ .../google_sign_in/google_sign_in_web/example/pubspec.yaml | 7 +------ packages/google_sign_in/google_sign_in_web/pubspec.yaml | 7 +------ 8 files changed, 7 insertions(+), 47 deletions(-) diff --git a/packages/google_sign_in/google_sign_in/example/pubspec.yaml b/packages/google_sign_in/google_sign_in/example/pubspec.yaml index 8c77891dea3..5335068734a 100644 --- a/packages/google_sign_in/google_sign_in/example/pubspec.yaml +++ b/packages/google_sign_in/google_sign_in/example/pubspec.yaml @@ -28,8 +28,3 @@ dev_dependencies: flutter: uses-material-design: true - -# FOR TESTING AND INITIAL REVIEW ONLY. DO NOT MERGE. -# See https://github.com/flutter/flutter/blob/master/docs/ecosystem/contributing/README.md#changing-federated-plugins -dependency_overrides: - {google_sign_in_android: {path: ../../../../packages/google_sign_in/google_sign_in_android}, google_sign_in_ios: {path: ../../../../packages/google_sign_in/google_sign_in_ios}, google_sign_in_platform_interface: {path: ../../../../packages/google_sign_in/google_sign_in_platform_interface}} diff --git a/packages/google_sign_in/google_sign_in/pubspec.yaml b/packages/google_sign_in/google_sign_in/pubspec.yaml index 37bc187701a..65a451a4869 100644 --- a/packages/google_sign_in/google_sign_in/pubspec.yaml +++ b/packages/google_sign_in/google_sign_in/pubspec.yaml @@ -26,7 +26,7 @@ dependencies: sdk: flutter google_sign_in_android: ^6.1.0 google_sign_in_ios: ^5.7.0 - google_sign_in_platform_interface: ^2.4.0 + google_sign_in_platform_interface: ^2.5.0 google_sign_in_web: ^0.12.0 dev_dependencies: @@ -47,8 +47,3 @@ false_secrets: - /example/ios/RunnerTests/GoogleService-Info.plist - /example/ios/RunnerTests/GoogleSignInTests.m - /example/macos/Runner/Info.plist - -# FOR TESTING AND INITIAL REVIEW ONLY. DO NOT MERGE. -# See https://github.com/flutter/flutter/blob/master/docs/ecosystem/contributing/README.md#changing-federated-plugins -dependency_overrides: - {google_sign_in_android: {path: ../../../packages/google_sign_in/google_sign_in_android}, google_sign_in_ios: {path: ../../../packages/google_sign_in/google_sign_in_ios}, google_sign_in_platform_interface: {path: ../../../packages/google_sign_in/google_sign_in_platform_interface}} diff --git a/packages/google_sign_in/google_sign_in_android/example/pubspec.yaml b/packages/google_sign_in/google_sign_in_android/example/pubspec.yaml index 8b69836ff95..0a2eb7e2358 100644 --- a/packages/google_sign_in/google_sign_in_android/example/pubspec.yaml +++ b/packages/google_sign_in/google_sign_in_android/example/pubspec.yaml @@ -16,7 +16,7 @@ dependencies: # The example app is bundled with the plugin so we use a path dependency on # the parent directory to use the current plugin's version. path: ../ - google_sign_in_platform_interface: ^2.2.0 + google_sign_in_platform_interface: ^2.5.0 http: ">=0.13.0 <2.0.0" dev_dependencies: @@ -28,8 +28,3 @@ dev_dependencies: flutter: uses-material-design: true - -# FOR TESTING AND INITIAL REVIEW ONLY. DO NOT MERGE. -# See https://github.com/flutter/flutter/blob/master/docs/ecosystem/contributing/README.md#changing-federated-plugins -dependency_overrides: - {google_sign_in_platform_interface: {path: ../../../../packages/google_sign_in/google_sign_in_platform_interface}} diff --git a/packages/google_sign_in/google_sign_in_android/pubspec.yaml b/packages/google_sign_in/google_sign_in_android/pubspec.yaml index 81c092f504d..3ab375d5bcb 100644 --- a/packages/google_sign_in/google_sign_in_android/pubspec.yaml +++ b/packages/google_sign_in/google_sign_in_android/pubspec.yaml @@ -20,7 +20,7 @@ flutter: dependencies: flutter: sdk: flutter - google_sign_in_platform_interface: ^2.2.0 + google_sign_in_platform_interface: ^2.5.0 dev_dependencies: build_runner: ^2.3.0 @@ -37,8 +37,3 @@ topics: false_secrets: - /example/android/app/google-services.json - /example/lib/main.dart - -# FOR TESTING AND INITIAL REVIEW ONLY. DO NOT MERGE. -# See https://github.com/flutter/flutter/blob/master/docs/ecosystem/contributing/README.md#changing-federated-plugins -dependency_overrides: - {google_sign_in_platform_interface: {path: ../../../packages/google_sign_in/google_sign_in_platform_interface}} diff --git a/packages/google_sign_in/google_sign_in_ios/example/pubspec.yaml b/packages/google_sign_in/google_sign_in_ios/example/pubspec.yaml index 98071cf930c..d687148ca0e 100644 --- a/packages/google_sign_in/google_sign_in_ios/example/pubspec.yaml +++ b/packages/google_sign_in/google_sign_in_ios/example/pubspec.yaml @@ -16,7 +16,7 @@ dependencies: # The example app is bundled with the plugin so we use a path dependency on # the parent directory to use the current plugin's version. path: ../ - google_sign_in_platform_interface: ^2.2.0 + google_sign_in_platform_interface: ^2.5.0 http: ">=0.13.0 <2.0.0" dev_dependencies: @@ -27,8 +27,3 @@ dev_dependencies: flutter: uses-material-design: true - -# FOR TESTING AND INITIAL REVIEW ONLY. DO NOT MERGE. -# See https://github.com/flutter/flutter/blob/master/docs/ecosystem/contributing/README.md#changing-federated-plugins -dependency_overrides: - {google_sign_in_platform_interface: {path: ../../../../packages/google_sign_in/google_sign_in_platform_interface}} diff --git a/packages/google_sign_in/google_sign_in_ios/pubspec.yaml b/packages/google_sign_in/google_sign_in_ios/pubspec.yaml index 48d7ee884e1..1a9dedf65d5 100644 --- a/packages/google_sign_in/google_sign_in_ios/pubspec.yaml +++ b/packages/google_sign_in/google_sign_in_ios/pubspec.yaml @@ -24,7 +24,7 @@ flutter: dependencies: flutter: sdk: flutter - google_sign_in_platform_interface: ^2.2.0 + google_sign_in_platform_interface: ^2.5.0 dev_dependencies: build_runner: ^2.4.6 @@ -44,8 +44,3 @@ false_secrets: - /example/ios/Runner/Info.plist - /example/lib/main.dart - /example/macos/Runner/Info.plist - -# FOR TESTING AND INITIAL REVIEW ONLY. DO NOT MERGE. -# See https://github.com/flutter/flutter/blob/master/docs/ecosystem/contributing/README.md#changing-federated-plugins -dependency_overrides: - {google_sign_in_platform_interface: {path: ../../../packages/google_sign_in/google_sign_in_platform_interface}} diff --git a/packages/google_sign_in/google_sign_in_web/example/pubspec.yaml b/packages/google_sign_in/google_sign_in_web/example/pubspec.yaml index 7875805adfc..fbc10d72532 100644 --- a/packages/google_sign_in/google_sign_in_web/example/pubspec.yaml +++ b/packages/google_sign_in/google_sign_in_web/example/pubspec.yaml @@ -10,7 +10,7 @@ dependencies: flutter: sdk: flutter google_identity_services_web: ^0.3.1 - google_sign_in_platform_interface: ^2.4.0 + google_sign_in_platform_interface: ^2.5.0 google_sign_in_web: path: ../ @@ -26,8 +26,3 @@ dev_dependencies: flutter: uses-material-design: true - -# FOR TESTING AND INITIAL REVIEW ONLY. DO NOT MERGE. -# See https://github.com/flutter/flutter/blob/master/docs/ecosystem/contributing/README.md#changing-federated-plugins -dependency_overrides: - {google_sign_in_platform_interface: {path: ../../../../packages/google_sign_in/google_sign_in_platform_interface}} diff --git a/packages/google_sign_in/google_sign_in_web/pubspec.yaml b/packages/google_sign_in/google_sign_in_web/pubspec.yaml index de9f9ff8cf4..9ddbd479d24 100644 --- a/packages/google_sign_in/google_sign_in_web/pubspec.yaml +++ b/packages/google_sign_in/google_sign_in_web/pubspec.yaml @@ -23,7 +23,7 @@ dependencies: flutter_web_plugins: sdk: flutter google_identity_services_web: ^0.3.1 - google_sign_in_platform_interface: ^2.4.0 + google_sign_in_platform_interface: ^2.5.0 http: ">=0.13.0 <2.0.0" web: ">=0.5.1 <2.0.0" @@ -34,8 +34,3 @@ dev_dependencies: topics: - authentication - google-sign-in - -# FOR TESTING AND INITIAL REVIEW ONLY. DO NOT MERGE. -# See https://github.com/flutter/flutter/blob/master/docs/ecosystem/contributing/README.md#changing-federated-plugins -dependency_overrides: - {google_sign_in_platform_interface: {path: ../../../packages/google_sign_in/google_sign_in_platform_interface}} From 697c55d7ec073a6693e4cb373d9724ece63984da Mon Sep 17 00:00:00 2001 From: Neil Self Date: Tue, 4 Mar 2025 12:42:49 -0800 Subject: [PATCH 27/29] Update formatting in Messages.java to match convention. --- .../src/main/java/io/flutter/plugins/googlesignin/Messages.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google_sign_in/google_sign_in_android/android/src/main/java/io/flutter/plugins/googlesignin/Messages.java b/packages/google_sign_in/google_sign_in_android/android/src/main/java/io/flutter/plugins/googlesignin/Messages.java index 06462943b1b..56adfecf16a 100644 --- a/packages/google_sign_in/google_sign_in_android/android/src/main/java/io/flutter/plugins/googlesignin/Messages.java +++ b/packages/google_sign_in/google_sign_in_android/android/src/main/java/io/flutter/plugins/googlesignin/Messages.java @@ -587,7 +587,7 @@ void getAccessToken( /** Clears the authentication caching for the given token, requiring a new sign in. */ void clearAuthCache(@NonNull String token); - + /** Requests access to the given scopes. */ void requestScopes(@NonNull List scopes, @NonNull Result result); From 6a8f83d7978b2fd6e543ea0f77241158ce96be50 Mon Sep 17 00:00:00 2001 From: Neil Self Date: Wed, 5 Mar 2025 13:56:27 -0800 Subject: [PATCH 28/29] Revert changes to app-facing package for this branch. --- .../google_sign_in/google_sign_in/CHANGELOG.md | 4 +--- .../google_sign_in/lib/google_sign_in.dart | 5 ----- .../google_sign_in/google_sign_in/pubspec.yaml | 4 ++-- .../test/google_sign_in_test.dart | 17 ----------------- 4 files changed, 3 insertions(+), 27 deletions(-) diff --git a/packages/google_sign_in/google_sign_in/CHANGELOG.md b/packages/google_sign_in/google_sign_in/CHANGELOG.md index 17f98cbaa1d..eee5a932cf6 100644 --- a/packages/google_sign_in/google_sign_in/CHANGELOG.md +++ b/packages/google_sign_in/google_sign_in/CHANGELOG.md @@ -1,7 +1,5 @@ -## 6.3.0 +## NEXT -* Adds a sign-in field to allow Android clients to explicitly specify an account name. This - capability is only available within Android for the underlying libraries. * Updates minimum supported SDK version to Flutter 3.22/Dart 3.4. ## 6.2.2 diff --git a/packages/google_sign_in/google_sign_in/lib/google_sign_in.dart b/packages/google_sign_in/google_sign_in/lib/google_sign_in.dart index 93565ad052b..ed11f0f512e 100644 --- a/packages/google_sign_in/google_sign_in/lib/google_sign_in.dart +++ b/packages/google_sign_in/google_sign_in/lib/google_sign_in.dart @@ -187,7 +187,6 @@ class GoogleSignIn { this.clientId, this.serverClientId, this.forceCodeForRefreshToken = false, - this.forceAccountName, }) { // Start initializing. if (kIsWeb) { @@ -264,9 +263,6 @@ class GoogleSignIn { /// Force the authorization code to be valid for a refresh token every time. Only needed on Android. final bool forceCodeForRefreshToken; - /// Explicitly specifies the account name to be used in sign-in. Must only be set on Android. - final String? forceAccountName; - final StreamController _currentUserController = StreamController.broadcast(); @@ -321,7 +317,6 @@ class GoogleSignIn { clientId: clientId, serverClientId: serverClientId, forceCodeForRefreshToken: forceCodeForRefreshToken, - forceAccountName: forceAccountName, )); unawaited(GoogleSignInPlatform.instance.userDataEvents diff --git a/packages/google_sign_in/google_sign_in/pubspec.yaml b/packages/google_sign_in/google_sign_in/pubspec.yaml index 65a451a4869..9f52c627db3 100644 --- a/packages/google_sign_in/google_sign_in/pubspec.yaml +++ b/packages/google_sign_in/google_sign_in/pubspec.yaml @@ -3,7 +3,7 @@ description: Flutter plugin for Google Sign-In, a secure authentication system for signing in with a Google account. repository: https://github.com/flutter/packages/tree/main/packages/google_sign_in/google_sign_in issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+google_sign_in%22 -version: 6.3.0 +version: 6.2.2 environment: sdk: ^3.4.0 @@ -26,7 +26,7 @@ dependencies: sdk: flutter google_sign_in_android: ^6.1.0 google_sign_in_ios: ^5.7.0 - google_sign_in_platform_interface: ^2.5.0 + google_sign_in_platform_interface: ^2.4.0 google_sign_in_web: ^0.12.0 dev_dependencies: diff --git a/packages/google_sign_in/google_sign_in/test/google_sign_in_test.dart b/packages/google_sign_in/google_sign_in/test/google_sign_in_test.dart index 0853691f6ba..9ca4124157f 100644 --- a/packages/google_sign_in/google_sign_in/test/google_sign_in_test.dart +++ b/packages/google_sign_in/google_sign_in/test/google_sign_in_test.dart @@ -113,17 +113,6 @@ void main() { verify(mockPlatform.signIn()); }); - test('forceAccountName sent with init method call', () async { - final GoogleSignIn googleSignIn = - GoogleSignIn(forceAccountName: 'fakeEmailAddress@example.com'); - - await googleSignIn.signIn(); - - _verifyInit(mockPlatform, - forceAccountName: 'fakeEmailAddress@example.com'); - verify(mockPlatform.signIn()); - }); - test('signOut', () async { final GoogleSignIn googleSignIn = GoogleSignIn(); @@ -458,7 +447,6 @@ void _verifyInit( String? clientId, String? serverClientId, bool forceCodeForRefreshToken = false, - String? forceAccountName, }) { verify(mockSignIn.initWithParams(argThat( isA() @@ -491,11 +479,6 @@ void _verifyInit( (SignInInitParameters p) => p.forceCodeForRefreshToken, 'forceCodeForRefreshToken', forceCodeForRefreshToken, - ) - .having( - (SignInInitParameters p) => p.forceAccountName, - 'forceAccountName', - forceAccountName, ), ))); } From 276938d4b845b400e9df898408db28e603b75446 Mon Sep 17 00:00:00 2001 From: Camille Simon <43054281+camsim99@users.noreply.github.com> Date: Thu, 6 Mar 2025 10:08:41 -0800 Subject: [PATCH 29/29] Remove extra space --- packages/google_sign_in/google_sign_in_android/CHANGELOG.md | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/google_sign_in/google_sign_in_android/CHANGELOG.md b/packages/google_sign_in/google_sign_in_android/CHANGELOG.md index be18325d1a6..97cc7f19158 100644 --- a/packages/google_sign_in/google_sign_in_android/CHANGELOG.md +++ b/packages/google_sign_in/google_sign_in_android/CHANGELOG.md @@ -6,7 +6,6 @@ * Updates compileSdk 34 to flutter.compileSdkVersion. - ## 6.1.35 * Removes the dependency on the Guava library.