modified: client/src/main.tsx

This commit is contained in:
MrPiglr 2026-02-12 20:38:28 -07:00
parent afb0b13ef6
commit cc1688110c
2 changed files with 20 additions and 22 deletions

View file

@ -36,19 +36,19 @@ export function detectPlatform(): PlatformType {
return cachedPlatform; return cachedPlatform;
} }
// Capacitor check - sometimes injected late, so don't cache 'web' result immediately // Capacitor check - only detect mobile on actual native platforms
// 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
if (window.Capacitor !== undefined) { if (window.Capacitor !== undefined) {
// Check if we're actually in a native app by checking for native platform try {
const isRealNative = (window.Capacitor as any)?.getPlatform && // Capacitor has getPlatform() that returns 'android', 'ios', or 'web'
(window.Capacitor as any).getPlatform() !== 'web'; const capacitorPlatform = (window.Capacitor as any).getPlatform?.();
if (isRealNative) { if (capacitorPlatform === 'android' || capacitorPlatform === 'ios') {
console.log('[Platform] Detected: mobile (Capacitor native)'); console.log('[Platform] Detected: mobile (Capacitor on ' + capacitorPlatform + ')');
cachedPlatform = 'mobile'; cachedPlatform = 'mobile';
return cachedPlatform; return cachedPlatform;
} else { }
console.log('[Platform] Capacitor detected but running on web - treating as web'); console.log('[Platform] Capacitor running on web platform - ignoring');
} catch (e) {
console.log('[Platform] Capacitor check failed - treating as web');
} }
} }

View file

@ -7,13 +7,13 @@ const App = lazy(() => import("./App"));
const LoadingScreen = () => ( const LoadingScreen = () => (
<div style={{ <div style={{
height: '100vh', height: '100vh',
width: '100vw', width: '100vw',
backgroundColor: 'blue', backgroundColor: '#0a0a0a',
display: 'flex', display: 'flex',
alignItems: 'center', alignItems: 'center',
justifyContent: 'center', justifyContent: 'center',
color: 'white', color: 'white',
fontSize: '24px', fontSize: '24px',
fontFamily: 'monospace', fontFamily: 'monospace',
position: 'fixed', position: 'fixed',
@ -27,9 +27,7 @@ const LoadingScreen = () => (
const renderApp = () => { const renderApp = () => {
console.log('[AeThexOS] Starting RenderApp...'); console.log('[AeThexOS] Starting RenderApp...');
// Immediate visual feedback that JS is executing
document.body.style.backgroundColor = 'purple';
const rootElement = document.getElementById("root"); const rootElement = document.getElementById("root");
if (rootElement) { if (rootElement) {