Skip to content

Commit 72f1e5f

Browse files
committed
fix(google-signin): error class
1 parent b399e95 commit 72f1e5f

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

packages/google-signin/index.android.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { AndroidApplication, Application, AndroidActivityResultEventData, Utils } from '@nativescript/core';
22
import { colorSchemeProperty, ColorSchemeType, colorStyleProperty, ColorStyleType, Configuration, GoogleSignInButtonBase, IUser } from './common';
3-
import { GoogleError } from './index.ios';
43
import lazy from '@nativescript/core/utils/lazy';
54

65
const REQUEST_CODE_SIGNIN = 610210;
@@ -14,6 +13,21 @@ const COLOR_DARK = lazy(() => com.google.android.gms.common.SignInButton.COLOR_D
1413
const COLOR_LIGHT = lazy(() => com.google.android.gms.common.SignInButton.COLOR_LIGHT);
1514
const COLOR_AUTO = lazy(() => com.google.android.gms.common.SignInButton.COLOR_AUTO);
1615

16+
17+
export class GoogleError extends Error {
18+
#native: java.lang.Exception;
19+
static fromNative(native: java.lang.Exception, message?: string) {
20+
const error = new GoogleError(message || native?.getMessage?.());
21+
error.#native = native;
22+
return error;
23+
}
24+
25+
get native() {
26+
return this.#native;
27+
}
28+
}
29+
30+
1731
export class User implements IUser {
1832
#native: com.google.android.gms.auth.api.signin.GoogleSignInAccount;
1933
#grantedScopes: string[];

packages/google-signin/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@nativescript/google-signin",
3-
"version": "1.0.0-alpha.1",
3+
"version": "1.0.0-alpha.2",
44
"description": "Google Sign-in for your NativeScript applications",
55
"main": "index",
66
"typings": "index.d.ts",

0 commit comments

Comments
 (0)