fix(mobile): with the lock on, the app switcher shows no panes

The phone keeps a picture of an app as it leaves, for its app switcher.
With the lock on, that picture showed whatever pane was open. The app is
now covered as it goes, and uncovered — or locked — as it comes back.
This commit is contained in:
l0ng-ai
2026-10-03 20:27:44 +08:00
parent 26c9ca2900
commit 0b444ce1f0
+12 -1
View File
@@ -233,11 +233,22 @@ function suggestions(typed: string, limit = 12) {
let onResume: (() => void) | null = null;
let onLeave: (() => void) | null = null;
// Locked, the app is covered as it goes, so the picture the phone keeps for
// its app switcher shows nothing of the panes.
let shade: HTMLElement | null = null;
document.addEventListener("visibilitychange", () => {
if (document.visibilityState === "visible") {
shade?.remove();
shade = null;
if (prefs.lock && Date.now() - hiddenAt > LOCK_AFTER_MS) lock();
onResume?.();
} else hiddenAt = Date.now();
} else {
hiddenAt = Date.now();
if (prefs.lock && !shade) {
shade = h("div", { class: "lock-cover" }, h("img", { class: "empty-mark", src: logoUrl, alt: "" }));
document.body.append(shade);
}
}
});
// The app lock: a cover over everything until Face ID or the passcode says