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; + } });