Skip to content

[google_sign_in] Update (web) example app. #5634

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Dec 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions packages/google_identity_services_web/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion packages/google_identity_services_web/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
7 changes: 3 additions & 4 deletions packages/google_sign_in/google_sign_in/example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand Down
11 changes: 10 additions & 1 deletion packages/google_sign_in/google_sign_in/example/web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,17 @@
<meta charset="UTF-8">
<meta name="google-signin-client_id" content="your-client_id.apps.googleusercontent.com">
<title>Google Sign-in Example</title>
<script src="flutter.js" defer></script>
</head>
<body>
<script src="main.dart.js" type="application/javascript"></script>
<script>
window.addEventListener('load', function(ev) {
_flutter.loader.loadEntrypoint({
onEntrypointLoaded: function(engineInitializer) {
engineInitializer.autoStart();
}
});
});
</script>
</body>
</html>