Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

Commit c777100

Browse files
committed
[force-code-for-refresh-token-platform-interface] Address PR feedback
1 parent 1e662ad commit c777100

File tree

5 files changed

+21
-34
lines changed

5 files changed

+21
-34
lines changed

packages/google_sign_in/google_sign_in_platform_interface/AUTHORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,3 +64,4 @@ Aleksandr Yurkovskiy <sanekyy@gmail.com>
6464
Anton Borries <mail@antonborri.es>
6565
Alex Li <google@alexv525.com>
6666
Rahul Raj <64.rahulraj@gmail.com>
67+
Twin Sun, LLC <google-contrib@twinsunsolutions.com>

packages/google_sign_in/google_sign_in_platform_interface/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
## 2.1.3
22

3-
* Add `SignInInitParameters` class to hold all sign in params, including the new `forceCodeForRefreshToken`.
3+
* Adds `SignInInitParameters` class to hold all sign in params, including the new `forceCodeForRefreshToken`.
44

55
## 2.1.2
66

packages/google_sign_in/google_sign_in_platform_interface/lib/google_sign_in_platform_interface.dart

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -86,14 +86,7 @@ abstract class GoogleSignInPlatform {
8686
String? hostedDomain,
8787
String? clientId,
8888
}) async {
89-
await initWithParams(
90-
SignInInitParameters(
91-
scopes: scopes,
92-
signInOption: signInOption,
93-
hostedDomain: hostedDomain,
94-
clientId: clientId,
95-
),
96-
);
89+
throw UnimplementedError('init() has not been implemented.');
9790
}
9891

9992
/// Initializes the plugin. You must call this method before calling other
@@ -106,7 +99,12 @@ abstract class GoogleSignInPlatform {
10699
///
107100
/// * [SignInInitParameters]
108101
Future<void> initWithParams(SignInInitParameters params) async {
109-
throw UnimplementedError('initWithParams() has not been implemented');
102+
await init(
103+
scopes: params.scopes,
104+
signInOption: params.signInOption,
105+
hostedDomain: params.hostedDomain,
106+
clientId: params.clientId,
107+
);
110108
}
111109

112110
/// Attempts to reuse pre-existing credentials to sign in again, without user interaction.

packages/google_sign_in/google_sign_in_platform_interface/lib/src/types.dart

Lines changed: 11 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5+
import 'package:flutter/widgets.dart';
56
import 'package:quiver/core.dart';
67

78
/// Default configuration options to use when signing in.
@@ -24,26 +25,12 @@ enum SignInOption {
2425

2526
/// The parameters to use when initializing the sign in process.
2627
///
27-
/// The [hostedDomain] argument specifies a hosted domain restriction. By
28-
/// setting this, sign in will be restricted to accounts of the user in the
29-
/// specified domain. By default, the list of accounts will not be restricted.
30-
///
31-
/// The list of [scopes] are OAuth scope codes to request when signing in.
32-
/// These scope codes will determine the level of data access that is granted
33-
/// to your application by the user. The full list of available scopes can be
34-
/// found here: <https://developers.google.com/identity/protocols/googlescopes>
35-
///
36-
/// The [signInOption] determines the user experience. [SigninOption.games] is
37-
/// only supported on Android.
38-
///
39-
/// The [forceCodeForRefreshToken] is used on Android to ensure the authentication
40-
/// code can be exchanged for a refresh token after the first request.
41-
///
4228
/// See:
4329
/// https://developers.google.com/identity/sign-in/web/reference#gapiauth2initparams
30+
@immutable
4431
class SignInInitParameters {
4532
/// The parameters to use when initializing the sign in process.
46-
SignInInitParameters({
33+
const SignInInitParameters({
4734
this.scopes = const <String>[],
4835
this.signInOption = SignInOption.standard,
4936
this.hostedDomain,
@@ -52,23 +39,24 @@ class SignInInitParameters {
5239
});
5340

5441
/// The list of OAuth scope codes to request when signing in.
55-
List<String> scopes;
42+
final List<String> scopes;
5643

5744
/// The user experience to use when signing in. [SignInOption.games] is
5845
/// only supported on Android.
59-
SignInOption signInOption;
46+
final SignInOption signInOption;
6047

61-
/// Restricted sign in to accounts of the user in the specified domain.
48+
/// Restricts sign in to accounts of the user in the specified domain.
6249
/// By default, the list of accounts will not be restricted.
63-
String? hostedDomain;
50+
final String? hostedDomain;
6451

6552
/// The client ID to use when signing in.
66-
String? clientId;
53+
final String? clientId;
6754

68-
/// Ensure the authorization code can be exchanged for an access token.
55+
/// If true, ensures the authorization code can be exchanged for an access
56+
/// token.
6957
///
7058
/// This is only used on Android.
71-
bool forceCodeForRefreshToken;
59+
final bool forceCodeForRefreshToken;
7260
}
7361

7462
/// Holds information about the signed in user.

packages/google_sign_in/google_sign_in_platform_interface/test/method_channel_google_sign_in_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ void main() {
140140
});
141141

142142
test('initWithParams passes through arguments to the channel', () async {
143-
await googleSignIn.initWithParams(SignInInitParameters(
143+
await googleSignIn.initWithParams(const SignInInitParameters(
144144
hostedDomain: 'example.com',
145145
scopes: <String>['two', 'scopes'],
146146
signInOption: SignInOption.games,

0 commit comments

Comments
 (0)