From 1417f40dded4733b1ed20711089f5c50d5ad9297 Mon Sep 17 00:00:00 2001 From: 3dtours Date: Sat, 27 Jun 2026 20:32:59 +0700 Subject: [PATCH] fix: restore GoogleAuth.initialize on native to prevent startup NullPointerException crash --- frontend/dist/index.html | 2 +- frontend/src/utils/nativePatch.ts | 22 ++++++++++------------ 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/frontend/dist/index.html b/frontend/dist/index.html index 0b024a4..e979baf 100644 --- a/frontend/dist/index.html +++ b/frontend/dist/index.html @@ -21,7 +21,7 @@ - + diff --git a/frontend/src/utils/nativePatch.ts b/frontend/src/utils/nativePatch.ts index cf8b426..377b802 100644 --- a/frontend/src/utils/nativePatch.ts +++ b/frontend/src/utils/nativePatch.ts @@ -26,18 +26,16 @@ function rewriteUrls(obj: any, backendUrl: string): any { return obj; } -if (!Capacitor.isNativePlatform()) { - // Initialize Web/PWA Google Login client - try { - GoogleAuth.initialize({ - clientId: import.meta.env.VITE_GOOGLE_CLIENT_ID || '639044397050-7hair384u6lle941h033trut1s3q47l4.apps.googleusercontent.com', - scopes: ['profile', 'email'], - grantOfflineAccess: true, - }); - console.log('[Web OAuth] GoogleAuth initialized successfully.'); - } catch (e) { - console.error('[Web OAuth] Failed to initialize GoogleAuth client:', e); - } +// Initialize Google Login client to prevent NullPointerException crashes on Android +try { + GoogleAuth.initialize({ + clientId: import.meta.env.VITE_GOOGLE_CLIENT_ID || '639044397050-7hair384u6lle941h033trut1s3q47l4.apps.googleusercontent.com', + scopes: ['profile', 'email'], + grantOfflineAccess: true, + }); + console.log('[OAuth] GoogleAuth initialized successfully.'); +} catch (e) { + console.error('[OAuth] Failed to initialize GoogleAuth client:', e); } if (Capacitor.isNativePlatform()) {