1515 */
1616package com .google .googlesignin ;
1717
18- import android .app .Activity ;
19- import android .os .Bundle ;
2018import android .os .CancellationSignal ;
2119import android .util .Log ;
2220
3735import com .google .android .gms .common .api .CommonStatusCodes ;
3836import com .google .android .gms .common .api .Scope ;
3937import com .google .android .gms .common .util .Strings ;
40- import com .google .android .gms .tasks .CancellationToken ;
4138import com .google .android .gms .tasks .OnCompleteListener ;
4239import com .google .android .gms .tasks .OnSuccessListener ;
43- import com .google .android .gms .tasks .OnTokenCanceledListener ;
4440import com .google .android .gms .tasks .SuccessContinuation ;
4541import com .google .android .gms .tasks .Task ;
4642import com .google .android .gms .tasks .TaskCompletionSource ;
@@ -73,14 +69,14 @@ public static void enableDebugLogging(boolean flag) {
7369 loggingEnabled = flag ;
7470 }
7571
76- private CancellationSignal cancellationSignal ;
77- private Task <AuthorizationResult > task ;
78- private Function <Boolean , Task <AuthorizationResult >> signInFunction ;
79- public boolean isPending () {
72+ private static CancellationSignal cancellationSignal ;
73+ private static Task <AuthorizationResult > task ;
74+ private static Function <Boolean , Task <AuthorizationResult >> signInFunction ;
75+ public static boolean isPending () {
8076 return task != null && !task .isComplete () && !task .isCanceled ();
8177 }
8278
83- public int getStatus () {
79+ public static int getStatus () {
8480 if (signInFunction == null )
8581 return CommonStatusCodes .DEVELOPER_ERROR ;
8682
@@ -125,7 +121,7 @@ public int getStatus() {
125121 * C++ code, this is used
126122 * to correlate the response with the request.
127123 */
128- public void configure (
124+ public static void configure (
129125 boolean useGamesConfig ,
130126 String webClientId ,
131127 boolean requestAuthCode ,
@@ -208,7 +204,7 @@ public Task<AuthorizationResult> then(GetCredentialResponse getCredentialRespons
208204 authorizationRequestBuilder .requestOfflineAccess (webClientId , forceRefreshToken );
209205
210206 int additionalCount = additionalScopes != null ? additionalScopes .length : 0 ;
211- List <Scope > scopes = new ArrayList <>(3 + additionalCount );
207+ List <Scope > scopes = new ArrayList <>(2 + additionalCount );
212208 scopes .add (new Scope (Scopes .PROFILE ));
213209 if (requestEmail )
214210 scopes .add (new Scope (Scopes .EMAIL ));
@@ -238,17 +234,17 @@ public void onComplete(@NonNull Task<AuthorizationResult> _unused) {
238234 };
239235 }
240236
241- public GoogleSignInHelper signIn () {
237+ public static Task < AuthorizationResult > signIn () {
242238 task = signInFunction .apply (false );
243- return this ;
239+ return task ;
244240 }
245241
246- public GoogleSignInHelper signInSilently () {
242+ public static Task < AuthorizationResult > signInSilently () {
247243 task = signInFunction .apply (true );
248- return this ;
244+ return task ;
249245 }
250246
251- public void cancel () {
247+ public static void cancel () {
252248 if (isPending () && cancellationSignal != null ){
253249 cancellationSignal .cancel ();
254250 cancellationSignal = null ;
@@ -257,7 +253,7 @@ public void cancel() {
257253 task = null ;
258254 }
259255
260- public void signOut () {
256+ public static void signOut () {
261257 cancel ();
262258
263259 CredentialManager .create (UnityPlayer .currentActivity ).clearCredentialStateAsync (new ClearCredentialStateRequest (),
0 commit comments