Files
webmail/lib/desktop/app-lock-state.ts
T
Linus Rath 335e1edc10 Merge branch 'feat/desktop-offline' into feat/do-app-lock
# Conflicts:
#	components/settings/general-settings.tsx
#	hooks/use-calendar-alerts.ts
#	lib/desktop/app-lock-state.ts
#	lib/desktop/policy-schema.ts
#	lib/desktop/types.ts
2026-11-03 17:52:30 +01:00

21 lines
805 B
TypeScript

/**
* Whether the app is locked, for everything that would show mail outside the app.
*
* lib/app-lock/controller.ts calls setAppLockCheck once, at the start of each page, with
* a function that answers from its own state, and calls bridge.os.setLocked(true) when it
* locks. components/desktop/desktop-os-host.tsx says it's open again when the app starts
* behind the lock. Main then clears the tray, the jump list and delivered toasts, and strips
* anything that still comes through. Main keeps its own answer too (the shell's
* app-lock-gate.ts), which stands over what any page says.
*/
let check: (() => boolean) | null = null;
export function setAppLockCheck(next: (() => boolean) | null): void {
check = next;
}
export function isAppLocked(): boolean {
return check?.() === true;
}