1+ // @ts -nocheck
12import { AndroidApplication , Application , AndroidActivityResultEventData , Utils } from '@nativescript/core' ;
23import { colorSchemeProperty , ColorSchemeType , colorStyleProperty , ColorStyleType , Configuration , GoogleSignInButtonBase , IUser } from './common' ;
34import lazy from '@nativescript/core/utils/lazy' ;
@@ -13,7 +14,6 @@ const COLOR_DARK = lazy(() => com.google.android.gms.common.SignInButton.COLOR_D
1314const COLOR_LIGHT = lazy ( ( ) => com . google . android . gms . common . SignInButton . COLOR_LIGHT ) ;
1415const COLOR_AUTO = lazy ( ( ) => com . google . android . gms . common . SignInButton . COLOR_AUTO ) ;
1516
16-
1717export class GoogleError extends Error {
1818 #native: java . lang . Exception ;
1919 static fromNative ( native : java . lang . Exception , message ?: string ) {
@@ -27,13 +27,12 @@ export class GoogleError extends Error {
2727 }
2828}
2929
30-
3130export class User implements IUser {
32- #native: com . google . android . gms . auth . api . signin . GoogleSignInAccount ;
31+ #native: com . google . android . gms . auth . api . identity . SignInCredential ;
3332 #grantedScopes: string [ ] ;
3433 #accessToken: string ;
35- static fromNative ( account : com . google . android . gms . auth . api . signin . GoogleSignInAccount , accessToken : string = null ) {
36- if ( account instanceof com . google . android . gms . auth . api . signin . GoogleSignInAccount ) {
34+ static fromNative ( account : com . google . android . gms . auth . api . identity . SignInCredential , accessToken : string = null ) {
35+ if ( account instanceof com . google . android . gms . auth . api . identity . SignInCredential ) {
3736 const user = new User ( ) ;
3837 user . #native = account ;
3938 user . #accessToken = accessToken ;
@@ -51,7 +50,8 @@ export class User implements IUser {
5150 }
5251
5352 get email ( ) {
54- return this . native . getEmail ( ) ;
53+ console . log ( 'request scope for access.' ) ;
54+ return '' ;
5555 }
5656
5757 get givenName ( ) {
@@ -63,7 +63,7 @@ export class User implements IUser {
6363 }
6464
6565 get idToken ( ) {
66- return this . native . getIdToken ( ) ;
66+ return this . native . getGoogleIdToken ( ) ;
6767 }
6868
6969 get accessToken ( ) {
@@ -72,16 +72,17 @@ export class User implements IUser {
7272
7373 get grantedScopes ( ) {
7474 if ( ! this . #grantedScopes) {
75- const grantedScopes = [ ] ;
76- const scopes = this . native . getGrantedScopes ( ) . toArray ( ) ;
77- const length = scopes . length ;
78- for ( let i = 0 ; i < length ; i ++ ) {
79- const scope = scopes [ i ] ?. toString ?.( ) ;
80- if ( scope ) {
81- grantedScopes . push ( scope ) ;
82- }
83- }
84- this . #grantedScopes = grantedScopes ;
75+ // removed.
76+ // const grantedScopes = [];
77+ // const scopes = this.native.getGrantedScopes().toArray();
78+ // const length = scopes.length;
79+ // for (let i = 0; i < length; i++) {
80+ // const scope = scopes[i]?.toString?.();
81+ // if (scope) {
82+ // grantedScopes.push(scope);
83+ // }
84+ // }
85+ // this.#grantedScopes = grantedScopes;
8586 }
8687 return this . #grantedScopes;
8788 }
@@ -91,7 +92,7 @@ export class User implements IUser {
9192 }
9293
9394 get serverAuthCode ( ) {
94- return this . native . getServerAuthCode ( ) ;
95+ // return this.native.getServerAuthCode();
9596 }
9697
9798 requestScopes ( scopes : string [ ] ) : Promise < User > {
@@ -248,7 +249,7 @@ export class GoogleSignin {
248249 static playServicesAvailable ( ) {
249250 return new Promise ( ( resolve , reject ) => {
250251 resolve ( org . nativescript . plugins . googlesignin . GoogleSignIn . playServicesAvailable ( false , Application . android . foregroundActivity || Application . android . startActivity ) ) ;
251- } )
252+ } ) ;
252253 }
253254}
254255
0 commit comments