diff --git a/apps/mobile/lib/callContext.tsx b/apps/mobile/lib/callContext.tsx index a4eba04..7a3b22b 100644 --- a/apps/mobile/lib/callContext.tsx +++ b/apps/mobile/lib/callContext.tsx @@ -62,6 +62,12 @@ function randomCallId(): string { return 'call-' + Math.random().toString(36).slice(2, 10) + '-' + Date.now().toString(36); } +// Time the call state lingers in `ended` so the UI can render a transient +// status pill ("Anruf abgelehnt", "Anruf beendet") before snapping back +// to idle. Keep this comfortably above the user's reaction time but short +// enough that returning to a chat feels snappy. +const ENDED_STATE_LINGER_MS = 2500; + export function CallProvider({ children }: { children: React.ReactNode }) { const { user } = useAuth(); const myUserId = user?.id ?? null; @@ -353,13 +359,13 @@ export function CallProvider({ children }: { children: React.ReactNode }) { } }, [state]); - // Drift `ended` back to `idle` after a short pause so the UI can show - // a brief status pill ("Anruf abgelehnt") before snapping back. + // Drift `ended` back to `idle` after the linger window so the UI can + // show a brief status pill before snapping back. useEffect(() => { if (state.kind !== 'ended') return; const t = setTimeout(() => { setState({ kind: 'idle' }); - }, 2500); + }, ENDED_STATE_LINGER_MS); return () => clearTimeout(t); }, [state]);