15
15
*/
16
16
package com .google .googlesignin ;
17
17
18
- import android .app .Activity ;
19
- import android .os .Bundle ;
20
18
import android .os .CancellationSignal ;
21
19
import android .util .Log ;
22
20
37
35
import com .google .android .gms .common .api .CommonStatusCodes ;
38
36
import com .google .android .gms .common .api .Scope ;
39
37
import com .google .android .gms .common .util .Strings ;
40
- import com .google .android .gms .tasks .CancellationToken ;
41
38
import com .google .android .gms .tasks .OnCompleteListener ;
42
39
import com .google .android .gms .tasks .OnSuccessListener ;
43
- import com .google .android .gms .tasks .OnTokenCanceledListener ;
44
40
import com .google .android .gms .tasks .SuccessContinuation ;
45
41
import com .google .android .gms .tasks .Task ;
46
42
import com .google .android .gms .tasks .TaskCompletionSource ;
@@ -73,14 +69,14 @@ public static void enableDebugLogging(boolean flag) {
73
69
loggingEnabled = flag ;
74
70
}
75
71
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 () {
80
76
return task != null && !task .isComplete () && !task .isCanceled ();
81
77
}
82
78
83
- public int getStatus () {
79
+ public static int getStatus () {
84
80
if (signInFunction == null )
85
81
return CommonStatusCodes .DEVELOPER_ERROR ;
86
82
@@ -125,7 +121,7 @@ public int getStatus() {
125
121
* C++ code, this is used
126
122
* to correlate the response with the request.
127
123
*/
128
- public void configure (
124
+ public static void configure (
129
125
boolean useGamesConfig ,
130
126
String webClientId ,
131
127
boolean requestAuthCode ,
@@ -208,7 +204,7 @@ public Task<AuthorizationResult> then(GetCredentialResponse getCredentialRespons
208
204
authorizationRequestBuilder .requestOfflineAccess (webClientId , forceRefreshToken );
209
205
210
206
int additionalCount = additionalScopes != null ? additionalScopes .length : 0 ;
211
- List <Scope > scopes = new ArrayList <>(3 + additionalCount );
207
+ List <Scope > scopes = new ArrayList <>(2 + additionalCount );
212
208
scopes .add (new Scope (Scopes .PROFILE ));
213
209
if (requestEmail )
214
210
scopes .add (new Scope (Scopes .EMAIL ));
@@ -238,17 +234,17 @@ public void onComplete(@NonNull Task<AuthorizationResult> _unused) {
238
234
};
239
235
}
240
236
241
- public GoogleSignInHelper signIn () {
237
+ public static Task < AuthorizationResult > signIn () {
242
238
task = signInFunction .apply (false );
243
- return this ;
239
+ return task ;
244
240
}
245
241
246
- public GoogleSignInHelper signInSilently () {
242
+ public static Task < AuthorizationResult > signInSilently () {
247
243
task = signInFunction .apply (true );
248
- return this ;
244
+ return task ;
249
245
}
250
246
251
- public void cancel () {
247
+ public static void cancel () {
252
248
if (isPending () && cancellationSignal != null ){
253
249
cancellationSignal .cancel ();
254
250
cancellationSignal = null ;
@@ -257,7 +253,7 @@ public void cancel() {
257
253
task = null ;
258
254
}
259
255
260
- public void signOut () {
256
+ public static void signOut () {
261
257
cancel ();
262
258
263
259
CredentialManager .create (UnityPlayer .currentActivity ).clearCredentialStateAsync (new ClearCredentialStateRequest (),
0 commit comments