diff --git a/src/components/auth/LoginDialog.tsx b/src/components/auth/LoginDialog.tsx index ff16cb4..d428bb6 100644 --- a/src/components/auth/LoginDialog.tsx +++ b/src/components/auth/LoginDialog.tsx @@ -276,7 +276,7 @@ export const LoginDialog: React.FC = ({ isOpen, onClose, onLog amberStepRef.current = 'waiting'; setAmberStep('waiting'); - setAmberStatus('Waiting for Amber to approve...'); + setAmberStatus('Approve in Amber, then come back here.'); // Live relay subscription (works on web/PWA; may be backgrounded in Capacitor) const pool = new SimplePool(); @@ -316,10 +316,13 @@ export const LoginDialog: React.FC = ({ isOpen, onClose, onLog ); subRef.current = sub; - // Timeout after 20 seconds — show error, let user retry + // On Capacitor (native app) give 3 minutes — the visibility change handler does the real work + // after the user returns from Amber, so the live subscription just needs to stay alive. + // On web/PWA the live subscription fires instantly, so 3 min is still fine as a safety net. + const TIMEOUT_MS = isCapacitor ? 3 * 60 * 1000 : 3 * 60 * 1000; setTimeout(() => { if (!controller.signal.aborted) { - console.warn('[Amber] Timed out after 20s — no response received'); + console.warn('[Amber] Timed out — no response received'); controller.abort(); cleanup(); if (amberStepRef.current === 'waiting') { @@ -328,7 +331,7 @@ export const LoginDialog: React.FC = ({ isOpen, onClose, onLog setAmberStatus('Amber did not respond in time. Did you approve the connection?'); } } - }, 20 * 1000); + }, TIMEOUT_MS); }, [cleanup, completeLogin, toast]); const handleBunkerLogin = async () => {