update frontend
This commit is contained in:
parent
80d75a7a57
commit
5b3d35cd25
|
|
@ -1,24 +1,20 @@
|
||||||
// src/pwaInstall.js
|
// src/pwaInstall.js
|
||||||
let deferredPrompt = null;
|
let deferredPrompt = null;
|
||||||
|
|
||||||
// Stocke l'événement natif quand Chrome le déclenche
|
|
||||||
window.addEventListener('beforeinstallprompt', (e) => {
|
window.addEventListener('beforeinstallprompt', (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
deferredPrompt = e;
|
deferredPrompt = e;
|
||||||
console.log('PWA: Install prompt ready - button can trigger it');
|
console.log('PWA prompt ready');
|
||||||
});
|
});
|
||||||
|
|
||||||
// Fonction appelée par le bouton "Install"
|
|
||||||
export function promptInstall() {
|
export function promptInstall() {
|
||||||
if (deferredPrompt) {
|
if (deferredPrompt) {
|
||||||
console.log('PWA: Triggering native install prompt');
|
|
||||||
deferredPrompt.prompt();
|
deferredPrompt.prompt();
|
||||||
deferredPrompt.userChoice.then((choice) => {
|
deferredPrompt.userChoice.then((choice) => {
|
||||||
console.log('PWA Install outcome:', choice.outcome);
|
console.log('Install outcome:', choice.outcome);
|
||||||
deferredPrompt = null;
|
|
||||||
});
|
});
|
||||||
|
deferredPrompt = null;
|
||||||
} else {
|
} else {
|
||||||
console.log('PWA: No prompt ready yet - scroll/click more');
|
alert('Prompt not ready. Scroll the map, click a filter, then try again.');
|
||||||
alert('PWA not ready yet. Try scrolling the map, clicking filters or markers, then click Install again.');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue