forked from tvip/flutter-plugins
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[google_sign_in] Android: Move GoogleSignInWrapper to a separate file. (
- Loading branch information
1 parent
fc98623
commit dfbb988
Showing
4 changed files
with
41 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
## 4.4.1 | ||
|
||
* Android: Move `GoogleSignInWrapper` to a separate class. | ||
|
||
## 4.4.0 | ||
|
||
* Migrate to Android v2 embedder. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
...le_sign_in/android/src/main/java/io/flutter/plugins/googlesignin/GoogleSignInWrapper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// Copyright 2020, the Flutter project authors. Please see the AUTHORS file | ||
// for details. All rights reserved. Use of this source code is governed by a | ||
// BSD-style license that can be found in the LICENSE file. | ||
|
||
package io.flutter.plugins.googlesignin; | ||
|
||
import android.app.Activity; | ||
import android.content.Context; | ||
import com.google.android.gms.auth.api.signin.GoogleSignIn; | ||
import com.google.android.gms.auth.api.signin.GoogleSignInAccount; | ||
import com.google.android.gms.common.api.Scope; | ||
|
||
/** | ||
* A wrapper object that calls static method in GoogleSignIn. | ||
* | ||
* <p>Because GoogleSignIn uses static method mostly, which is hard for unit testing. We use this | ||
* wrapper class to use instance method which calls the corresponding GoogleSignIn static methods. | ||
* | ||
* <p>Warning! This class should stay true that each method calls a GoogleSignIn static method with | ||
* the same name and same parameters. | ||
*/ | ||
public class GoogleSignInWrapper { | ||
|
||
GoogleSignInAccount getLastSignedInAccount(Context context) { | ||
return GoogleSignIn.getLastSignedInAccount(context); | ||
} | ||
|
||
boolean hasPermissions(GoogleSignInAccount account, Scope scope) { | ||
return GoogleSignIn.hasPermissions(account, scope); | ||
} | ||
|
||
void requestPermissions( | ||
Activity activity, int requestCode, GoogleSignInAccount account, Scope[] scopes) { | ||
GoogleSignIn.requestPermissions(activity, requestCode, account, scopes); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters