Skip to content

Commit fa5d30b

Browse files
author
Michael Klimushyn
authored
[google_sign_in_platform_interface] Add missing docs (flutter-team-archive#2359)
1 parent 1d4877f commit fa5d30b

7 files changed

Lines changed: 78 additions & 15 deletions

File tree

packages/google_sign_in/google_sign_in_platform_interface/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 1.0.2
2+
3+
* Add missing documentation.
4+
15
## 1.0.1
26

37
* Switch away from quiver_hashcode.

packages/google_sign_in/google_sign_in_platform_interface/analysis_options.yaml

Lines changed: 0 additions & 10 deletions
This file was deleted.

packages/google_sign_in/google_sign_in_platform_interface/lib/google_sign_in_platform_interface.dart

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,23 @@ abstract class GoogleSignInPlatform {
6161
/// if the provided instance is a class implemented with `implements`.
6262
void _verifyProvidesDefaultImplementations() {}
6363

64-
/// Initializes the plugin. You must call this method before calling other methods.
65-
/// See: https://developers.google.com/identity/sign-in/web/reference#gapiauth2initparams
64+
/// Initializes the plugin. You must call this method before calling other
65+
/// methods.
66+
///
67+
/// The [hostedDomain] argument specifies a hosted domain restriction. By
68+
/// setting this, sign in will be restricted to accounts of the user in the
69+
/// specified domain. By default, the list of accounts will not be restricted.
70+
///
71+
/// The list of [scopes] are OAuth scope codes to request when signing in.
72+
/// These scope codes will determine the level of data access that is granted
73+
/// to your application by the user. The full list of available scopes can be
74+
/// found here: <https://developers.google.com/identity/protocols/googlescopes>
75+
///
76+
/// The [signInOption] determines the user experience. [SigninOption.games] is
77+
/// only supported on Android.
78+
///
79+
/// See:
80+
/// https://developers.google.com/identity/sign-in/web/reference#gapiauth2initparams
6681
Future<void> init(
6782
{@required String hostedDomain,
6883
List<String> scopes,

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ import 'utils.dart';
1313

1414
/// An implementation of [GoogleSignInPlatform] that uses method channels.
1515
class MethodChannelGoogleSignIn extends GoogleSignInPlatform {
16+
/// This is only exposed for test purposes. It shouldn't be used by clients of
17+
/// the plugin as it may break or change at any time.
1618
@visibleForTesting
1719
MethodChannel channel =
1820
const MethodChannel('plugins.flutter.io/google_sign_in');

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

Lines changed: 54 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,62 @@
44

55
import 'package:quiver/core.dart';
66

7-
enum SignInOption { standard, games }
7+
/// Default configuration options to use when signing in.
8+
///
9+
/// See also https://developers.google.com/android/reference/com/google/android/gms/auth/api/signin/GoogleSignInOptions
10+
enum SignInOption {
11+
/// Default configuration. Provides stable user ID and basic profile information.
12+
///
13+
/// See also https://developers.google.com/android/reference/com/google/android/gms/auth/api/signin/GoogleSignInOptions.html#DEFAULT_SIGN_IN.
14+
standard,
815

16+
/// Recommended configuration for Games sign in.
17+
///
18+
/// This is currently only supported on Android and will throw an error if used
19+
/// on other platforms.
20+
///
21+
/// See also https://developers.google.com/android/reference/com/google/android/gms/auth/api/signin/GoogleSignInOptions.html#public-static-final-googlesigninoptions-default_games_sign_in.
22+
games
23+
}
24+
25+
/// Holds information about the signed in user.
926
class GoogleSignInUserData {
27+
/// Uses the given data to construct an instance. Any of these parameters
28+
/// could be null.
1029
GoogleSignInUserData(
1130
{this.displayName, this.email, this.id, this.photoUrl, this.idToken});
31+
32+
/// The display name of the signed in user.
33+
///
34+
/// Not guaranteed to be present for all users, even when configured.
1235
String displayName;
36+
37+
/// The email address of the signed in user.
38+
///
39+
/// Applications should not key users by email address since a Google account's
40+
/// email address can change. Use [id] as a key instead.
41+
///
42+
/// _Important_: Do not use this returned email address to communicate the
43+
/// currently signed in user to your backend server. Instead, send an ID token
44+
/// which can be securely validated on the server. See [idToken].
1345
String email;
46+
47+
/// The unique ID for the Google account.
48+
///
49+
/// This is the preferred unique key to use for a user record.
50+
///
51+
/// _Important_: Do not use this returned Google ID to communicate the
52+
/// currently signed in user to your backend server. Instead, send an ID token
53+
/// which can be securely validated on the server. See [idToken].
1454
String id;
55+
56+
/// The photo url of the signed in user if the user has a profile picture.
57+
///
58+
/// Not guaranteed to be present for all users, even when configured.
1559
String photoUrl;
60+
61+
/// A token that can be sent to your own server to verify the authentication
62+
/// data.
1663
String idToken;
1764

1865
@override
@@ -32,9 +79,15 @@ class GoogleSignInUserData {
3279
}
3380
}
3481

82+
/// Holds authentication data after sign in.
3583
class GoogleSignInTokenData {
84+
/// Either or both parameters may be null.
3685
GoogleSignInTokenData({this.idToken, this.accessToken});
86+
87+
/// An OpenID Connect ID token for the authenticated user.
3788
String idToken;
89+
90+
/// The OAuth2 access token used to access Google services.
3891
String accessToken;
3992

4093
@override

packages/google_sign_in/google_sign_in_platform_interface/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ author: Flutter Team <flutter-dev@googlegroups.com>
44
homepage: https://github.com/flutter/plugins/tree/master/packages/google_sign_in/google_sign_in_platform_interface
55
# NOTE: We strongly prefer non-breaking changes, even at the expense of a
66
# less-clean API. See https://flutter.dev/go/platform-interface-breaking-changes
7-
version: 1.0.1
7+
version: 1.0.2
88

99
dependencies:
1010
flutter:

script/incremental_build.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ CUSTOM_ANALYSIS_PLUGINS=(
1717
"in_app_purchase"
1818
"camera"
1919
"google_sign_in/google_sign_in"
20-
"google_sign_in/google_sign_in_platform_interface"
2120
"google_sign_in/google_sign_in_web"
2221
)
2322
# Comma-separated string of the list above

0 commit comments

Comments
 (0)