Skip to content

Commit fc45624

Browse files
authored
[google_sign_in] Android: Move GoogleSignInWrapper to a separate file. (flutter#2636)
1 parent c03166b commit fc45624

File tree

4 files changed

+41
-26
lines changed

4 files changed

+41
-26
lines changed

packages/google_sign_in/google_sign_in/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 4.4.1
2+
3+
* Android: Move `GoogleSignInWrapper` to a separate class.
4+
15
## 4.4.0
26

37
* Migrate to Android v2 embedder.

packages/google_sign_in/google_sign_in/android/src/main/java/io/flutter/plugins/googlesignin/GoogleSignInPlugin.java

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -659,28 +659,3 @@ public boolean onActivityResult(int requestCode, int resultCode, Intent data) {
659659
}
660660
}
661661
}
662-
663-
/**
664-
* A wrapper object that calls static method in GoogleSignIn.
665-
*
666-
* <p>Because GoogleSignIn uses static method mostly, which is hard for unit testing. We use this
667-
* wrapper class to use instance method which calls the corresponding GoogleSignIn static methods.
668-
*
669-
* <p>Warning! This class should stay true that each method calls a GoogleSignIn static method with
670-
* the same name and same parameters.
671-
*/
672-
class GoogleSignInWrapper {
673-
674-
GoogleSignInAccount getLastSignedInAccount(Context context) {
675-
return GoogleSignIn.getLastSignedInAccount(context);
676-
}
677-
678-
boolean hasPermissions(GoogleSignInAccount account, Scope scope) {
679-
return GoogleSignIn.hasPermissions(account, scope);
680-
}
681-
682-
void requestPermissions(
683-
Activity activity, int requestCode, GoogleSignInAccount account, Scope[] scopes) {
684-
GoogleSignIn.requestPermissions(activity, requestCode, account, scopes);
685-
}
686-
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// Copyright 2020, the Flutter project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// BSD-style license that can be found in the LICENSE file.
4+
5+
package io.flutter.plugins.googlesignin;
6+
7+
import android.app.Activity;
8+
import android.content.Context;
9+
import com.google.android.gms.auth.api.signin.GoogleSignIn;
10+
import com.google.android.gms.auth.api.signin.GoogleSignInAccount;
11+
import com.google.android.gms.common.api.Scope;
12+
13+
/**
14+
* A wrapper object that calls static method in GoogleSignIn.
15+
*
16+
* <p>Because GoogleSignIn uses static method mostly, which is hard for unit testing. We use this
17+
* wrapper class to use instance method which calls the corresponding GoogleSignIn static methods.
18+
*
19+
* <p>Warning! This class should stay true that each method calls a GoogleSignIn static method with
20+
* the same name and same parameters.
21+
*/
22+
public class GoogleSignInWrapper {
23+
24+
GoogleSignInAccount getLastSignedInAccount(Context context) {
25+
return GoogleSignIn.getLastSignedInAccount(context);
26+
}
27+
28+
boolean hasPermissions(GoogleSignInAccount account, Scope scope) {
29+
return GoogleSignIn.hasPermissions(account, scope);
30+
}
31+
32+
void requestPermissions(
33+
Activity activity, int requestCode, GoogleSignInAccount account, Scope[] scopes) {
34+
GoogleSignIn.requestPermissions(activity, requestCode, account, scopes);
35+
}
36+
}

packages/google_sign_in/google_sign_in/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: google_sign_in
22
description: Flutter plugin for Google Sign-In, a secure authentication system
33
for signing in with a Google account on Android and iOS.
44
homepage: https://github.com/flutter/plugins/tree/master/packages/google_sign_in/google_sign_in
5-
version: 4.4.0
5+
version: 4.4.1
66

77
flutter:
88
plugin:

0 commit comments

Comments
 (0)