From cc1688110c19d433241a3fa2571a981365a4c359 Mon Sep 17 00:00:00 2001 From: MrPiglr Date: Thu, 12 Feb 2026 20:38:28 -0700 Subject: [PATCH] modified: client/src/main.tsx --- client/src/lib/platform.ts | 24 ++++++++++++------------ client/src/main.tsx | 18 ++++++++---------- 2 files changed, 20 insertions(+), 22 deletions(-) diff --git a/client/src/lib/platform.ts b/client/src/lib/platform.ts index e461f10..3c59979 100644 --- a/client/src/lib/platform.ts +++ b/client/src/lib/platform.ts @@ -36,19 +36,19 @@ export function detectPlatform(): PlatformType { return cachedPlatform; } - // Capacitor check - sometimes injected late, so don't cache 'web' result immediately - // IMPORTANT: Capacitor has a web implementation that creates window.Capacitor - // We need to check if we're in a REAL native app, not just the web polyfill + // Capacitor check - only detect mobile on actual native platforms if (window.Capacitor !== undefined) { - // Check if we're actually in a native app by checking for native platform - const isRealNative = (window.Capacitor as any)?.getPlatform && - (window.Capacitor as any).getPlatform() !== 'web'; - if (isRealNative) { - console.log('[Platform] Detected: mobile (Capacitor native)'); - cachedPlatform = 'mobile'; - return cachedPlatform; - } else { - console.log('[Platform] Capacitor detected but running on web - treating as web'); + try { + // Capacitor has getPlatform() that returns 'android', 'ios', or 'web' + const capacitorPlatform = (window.Capacitor as any).getPlatform?.(); + if (capacitorPlatform === 'android' || capacitorPlatform === 'ios') { + console.log('[Platform] Detected: mobile (Capacitor on ' + capacitorPlatform + ')'); + cachedPlatform = 'mobile'; + return cachedPlatform; + } + console.log('[Platform] Capacitor running on web platform - ignoring'); + } catch (e) { + console.log('[Platform] Capacitor check failed - treating as web'); } } diff --git a/client/src/main.tsx b/client/src/main.tsx index e93a14c..4e46299 100644 --- a/client/src/main.tsx +++ b/client/src/main.tsx @@ -7,13 +7,13 @@ const App = lazy(() => import("./App")); const LoadingScreen = () => (
( const renderApp = () => { console.log('[AeThexOS] Starting RenderApp...'); - // Immediate visual feedback that JS is executing - document.body.style.backgroundColor = 'purple'; - + const rootElement = document.getElementById("root"); if (rootElement) {