web: the offer to install is made once, and the answer is kept

This commit is contained in:
2026-10-01 07:46:10 +07:00
parent 7b6a1a805f
commit 31435aac77
3 changed files with 62 additions and 11 deletions
+4 -4
View File
@@ -5,8 +5,8 @@ import {
canInstall,
dismissInstall,
dismissed,
isInstalled,
isIosSafari,
isStandalone,
promptInstall,
subscribe,
} from '../pwa/install';
@@ -30,7 +30,7 @@ export function InstallPrompt() {
useEffect(() => {
// An installed app has nothing to offer, and a refusal is final — the visitor
// said no to this dialog, not to this session.
if (isStandalone() || dismissed()) return;
if (isInstalled() || dismissed()) return;
const manual = isIosSafari();
let waited = false;
@@ -86,8 +86,8 @@ export function InstallPrompt() {
type="button"
className="btn primary"
data-key="install-yes"
// Not a dismissal: taking the offer and waving the browser's own sheet
// away are different answers, and the app's own button can still ask.
// `promptInstall` records the browser's answer itself: accepted means the
// app is installed, waved away means the offer was spent and refused.
onClick={() => {
void promptInstall();
setFace(null);