Fix splash screen background color and install title

This commit is contained in:
RobinLinus 2019-03-14 20:20:50 +01:00
parent 3ad1a6e0ef
commit b8b23cd807
3 changed files with 5 additions and 10 deletions

View file

@ -44,7 +44,7 @@
<use xlink:href="#notifications" /> <use xlink:href="#notifications" />
</svg> </svg>
</a> </a>
<a href="#" id="install" class="icon-button" title="Add to Homescreen"> <a href="#" id="install" class="icon-button" title="Install Snapdrop">
<svg class="icon"> <svg class="icon">
<use xlink:href="#homescreen" /> <use xlink:href="#homescreen" />
</svg> </svg>

View file

@ -22,7 +22,7 @@
"sizes": "512x512", "sizes": "512x512",
"type": "image/png" "type": "image/png"
}], }],
"background_color": "#3367d6", "background_color": "#efefef",
"start_url": "/", "start_url": "/",
"display": "minimal-ui", "display": "minimal-ui",
"theme_color": "#3367d6", "theme_color": "#3367d6",

View file

@ -526,18 +526,13 @@ if ('serviceWorker' in navigator) {
// don't display install banner when installed // don't display install banner when installed
window.addEventListener('beforeinstallprompt', e => { window.addEventListener('beforeinstallprompt', e => {
if (window.matchMedia('(display-mode: standalone)').matches) { if (window.matchMedia('(display-mode: standalone)').matches) {
return event.preventDefault(); return e.preventDefault();
} else { } else {
const deferredPrompt = e; const deferredPrompt = e;
const btn = document.querySelector('#install') const btn = document.querySelector('#install')
btn.hidden = false; btn.hidden = false;
btn.onclick = _ => { btn.onclick = _ => deferredPrompt.prompt();
deferredPrompt.prompt(); return e.preventDefault();
// Wait for the user to respond to the prompt
deferredPrompt.userChoice.then((resp) => {
console.log(JSON.stringify(resp));
});
}
} }
}); });
} }