From f455462a6b8ba006909cb34c5b276f77e685df38 Mon Sep 17 00:00:00 2001 From: David Iglesias Date: Wed, 13 Dec 2023 12:54:26 -0800 Subject: [PATCH] [google_sign_in] Update (web) example app. (#5634) ## Changes **google_sign_in:** * Updates web bootstrap following [Flutter Web initialization docs](https://docs.flutter.dev/platform-integration/web/initialization#skipping-this-step). * Uses the recent [`web_only` library](https://pub.dev/documentation/google_sign_in_web/0.12.3/web_only/web_only-library.html) to `renderButton`. * Updates dependencies so it can compile with `--wasm`. (opportunistic weekend commit) **google_identity_services_web:** * Adds missing `CredentialSelectBy.fedcm_auto` enum value. * Bump patch version + changelog. ## Issues * Fixes https://github.com/flutter/flutter/issues/139852 * Missing bit of https://github.com/flutter/flutter/issues/138202 ## Testing * Deployed to: https://dit-gis-test.web.app --- .../google_identity_services_web/CHANGELOG.md | 5 +++++ .../lib/src/js_interop/shared.dart | 15 ++++++++++++--- .../google_identity_services_web/pubspec.yaml | 2 +- .../example/lib/src/sign_in_button/web.dart | 6 ++---- .../google_sign_in/example/pubspec.yaml | 7 +++---- .../google_sign_in/example/web/index.html | 11 ++++++++++- 6 files changed, 33 insertions(+), 13 deletions(-) diff --git a/packages/google_identity_services_web/CHANGELOG.md b/packages/google_identity_services_web/CHANGELOG.md index d63208d5af..92c96c07bd 100644 --- a/packages/google_identity_services_web/CHANGELOG.md +++ b/packages/google_identity_services_web/CHANGELOG.md @@ -1,3 +1,8 @@ +## 0.3.0+2 + +* Adds `fedcm_auto` to `CredentialSelectBy` enum. +* Adds `unknown_reason` to all `Moment*Reason` enums. + ## 0.3.0+1 * Corrects 0.3.0 changelog entry about the minimum Flutter/Dart dependencies. diff --git a/packages/google_identity_services_web/lib/src/js_interop/shared.dart b/packages/google_identity_services_web/lib/src/js_interop/shared.dart index a41b123b65..a564503832 100644 --- a/packages/google_identity_services_web/lib/src/js_interop/shared.dart +++ b/packages/google_identity_services_web/lib/src/js_interop/shared.dart @@ -118,7 +118,10 @@ enum MomentSkippedReason { tap_outside('tap_outside'), /// issuing_failed - issuing_failed('issuing_failed'); + issuing_failed('issuing_failed'), + + /// Unknown reason + unknown_reason('unknown_reason'); /// const MomentSkippedReason(String reason) : _reason = reason; @@ -137,7 +140,10 @@ enum MomentDismissedReason { cancel_called('cancel_called'), /// flow_restarted - flow_restarted('flow_restarted'); + flow_restarted('flow_restarted'), + + /// Unknown reason + unknown_reason('unknown_reason'); /// const MomentDismissedReason(String reason) : _reason = reason; @@ -207,7 +213,10 @@ enum CredentialSelectBy { btn_confirm_add_session('btn_confirm_add_session'), /// A user with an existing session used the browser's "FedCM" flow. - fedcm('fedcm'); + fedcm('fedcm'), + + /// A fedcm authentication without user intervention. + fedcm_auto('fedcm_auto'); /// const CredentialSelectBy(String selectBy) : _selectBy = selectBy; diff --git a/packages/google_identity_services_web/pubspec.yaml b/packages/google_identity_services_web/pubspec.yaml index 2d18e83a78..2f1e5b9139 100644 --- a/packages/google_identity_services_web/pubspec.yaml +++ b/packages/google_identity_services_web/pubspec.yaml @@ -2,7 +2,7 @@ name: google_identity_services_web description: A Dart JS-interop layer for Google Identity Services. Google's new sign-in SDK for Web that supports multiple types of credentials. repository: https://github.com/flutter/packages/tree/main/packages/google_identity_services_web issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+google_identiy_services_web%22 -version: 0.3.0+1 +version: 0.3.0+2 environment: sdk: ">=3.2.0 <4.0.0" diff --git a/packages/google_sign_in/google_sign_in/example/lib/src/sign_in_button/web.dart b/packages/google_sign_in/google_sign_in/example/lib/src/sign_in_button/web.dart index 4189fc6cd7..5c854fc470 100644 --- a/packages/google_sign_in/google_sign_in/example/lib/src/sign_in_button/web.dart +++ b/packages/google_sign_in/google_sign_in/example/lib/src/sign_in_button/web.dart @@ -3,13 +3,11 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:google_sign_in_platform_interface/google_sign_in_platform_interface.dart'; -import 'package:google_sign_in_web/google_sign_in_web.dart' as web; +import 'package:google_sign_in_web/web_only.dart' as web; import 'stub.dart'; /// Renders a web-only SIGN IN button. Widget buildSignInButton({HandleSignInFn? onPressed}) { - return (GoogleSignInPlatform.instance as web.GoogleSignInPlugin) - .renderButton(); + return web.renderButton(); } 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 c2558f5f6c..19a6bf6e94 100644 --- a/packages/google_sign_in/google_sign_in/example/pubspec.yaml +++ b/packages/google_sign_in/google_sign_in/example/pubspec.yaml @@ -3,8 +3,8 @@ description: Example of Google Sign-In plugin. publish_to: none environment: - sdk: ">=3.0.0 <4.0.0" - flutter: ">=3.10.0" + sdk: ^3.2.0 + flutter: ">=3.16.0" dependencies: flutter: @@ -16,8 +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.4.0 - google_sign_in_web: ^0.12.0 + google_sign_in_web: ^0.12.3 http: ">=0.13.0 <2.0.0" dev_dependencies: diff --git a/packages/google_sign_in/google_sign_in/example/web/index.html b/packages/google_sign_in/google_sign_in/example/web/index.html index 6bd23335f2..eff8f4effa 100644 --- a/packages/google_sign_in/google_sign_in/example/web/index.html +++ b/packages/google_sign_in/google_sign_in/example/web/index.html @@ -7,8 +7,17 @@ found in the LICENSE file. --> Google Sign-in Example + - +