From 27a6b49b3704bcbde2f7ca18d9e3880fe412d083 Mon Sep 17 00:00:00 2001 From: Barely Removable Date: Sat, 22 Aug 2026 09:40:43 -0700 Subject: [PATCH] Surface install-prompt failures instead of failing silently --- static/app.js | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/static/app.js b/static/app.js index 59936b1..c00a7ed 100644 --- a/static/app.js +++ b/static/app.js @@ -572,9 +572,18 @@ window.addEventListener('beforeinstallprompt', (e) => { document.addEventListener('click', async (e) => { if (!e.target.closest('#btn-install')) return; - if (!deferredInstall) return; - deferredInstall.prompt(); - await deferredInstall.userChoice; - deferredInstall = null; - $('#btn-install').hidden = true; + if (!deferredInstall) { + banner("No install prompt available — try Chrome's own menu (⋮ → Install app) instead.", true); + return; + } + try { + await deferredInstall.prompt(); + const choice = await deferredInstall.userChoice; + if (choice.outcome !== 'accepted') banner(`Install ${choice.outcome}.`); + } catch (err) { + banner(`Install failed: ${err.message}`, true); + } finally { + deferredInstall = null; + $('#btn-install').hidden = true; + } });