remove install prompt
This commit is contained in:
parent
0189a560fe
commit
b349fbb329
3 changed files with 3 additions and 69 deletions
|
|
@ -3095,13 +3095,6 @@
|
||||||
</div>
|
</div>
|
||||||
<button id="show-shortcuts-btn" class="btn-secondary">Show Shortcuts</button>
|
<button id="show-shortcuts-btn" class="btn-secondary">Show Shortcuts</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="setting-item" id="install-app-setting" style="display: none">
|
|
||||||
<div class="info">
|
|
||||||
<span class="label">Install App</span>
|
|
||||||
<span class="description">Install Monochrome as an app on your device</span>
|
|
||||||
</div>
|
|
||||||
<button id="manual-install-btn" class="btn-secondary">Install</button>
|
|
||||||
</div>
|
|
||||||
<div class="setting-item">
|
<div class="setting-item">
|
||||||
<div class="info">
|
<div class="info">
|
||||||
<span class="label">Cache</span>
|
<span class="label">Cache</span>
|
||||||
|
|
|
||||||
56
js/app.js
56
js/app.js
|
|
@ -1426,31 +1426,6 @@ document.addEventListener('DOMContentLoaded', async () => {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
let deferredPrompt;
|
|
||||||
window.addEventListener('beforeinstallprompt', (e) => {
|
|
||||||
e.preventDefault();
|
|
||||||
deferredPrompt = e;
|
|
||||||
|
|
||||||
// Show the manual install button in settings
|
|
||||||
const installSetting = document.getElementById('install-app-setting');
|
|
||||||
if (installSetting) installSetting.style.display = 'flex';
|
|
||||||
|
|
||||||
if (!localStorage.getItem('installPromptDismissed')) {
|
|
||||||
showInstallPrompt(deferredPrompt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
document.getElementById('manual-install-btn')?.addEventListener('click', async () => {
|
|
||||||
if (deferredPrompt) {
|
|
||||||
deferredPrompt.prompt();
|
|
||||||
const { outcome } = await deferredPrompt.userChoice;
|
|
||||||
console.log(`User response to install prompt: ${outcome}`);
|
|
||||||
deferredPrompt = null;
|
|
||||||
const installSetting = document.getElementById('install-app-setting');
|
|
||||||
if (installSetting) installSetting.style.display = 'none';
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
document.getElementById('show-shortcuts-btn')?.addEventListener('click', () => {
|
document.getElementById('show-shortcuts-btn')?.addEventListener('click', () => {
|
||||||
showKeyboardShortcuts();
|
showKeyboardShortcuts();
|
||||||
});
|
});
|
||||||
|
|
@ -1538,37 +1513,6 @@ function showUpdateNotification(updateCallback) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function showInstallPrompt(deferredPrompt) {
|
|
||||||
if (!deferredPrompt) return;
|
|
||||||
|
|
||||||
const notification = document.createElement('div');
|
|
||||||
notification.className = 'install-prompt';
|
|
||||||
notification.innerHTML = `
|
|
||||||
<div>
|
|
||||||
<strong>Install Monochrome</strong>
|
|
||||||
<p>Install this app for a better experience.</p>
|
|
||||||
</div>
|
|
||||||
<div style="display: flex; gap: 0.5rem;">
|
|
||||||
<button class="btn-primary" id="install-btn">Install</button>
|
|
||||||
<button class="btn-secondary" id="dismiss-install">Dismiss</button>
|
|
||||||
</div>
|
|
||||||
`;
|
|
||||||
document.body.appendChild(notification);
|
|
||||||
|
|
||||||
document.getElementById('install-btn').addEventListener('click', async () => {
|
|
||||||
notification.remove();
|
|
||||||
deferredPrompt.prompt();
|
|
||||||
const { outcome } = await deferredPrompt.userChoice;
|
|
||||||
console.log(`User response to install prompt: ${outcome}`);
|
|
||||||
deferredPrompt = null;
|
|
||||||
});
|
|
||||||
|
|
||||||
document.getElementById('dismiss-install').addEventListener('click', () => {
|
|
||||||
notification.remove();
|
|
||||||
localStorage.setItem('installPromptDismissed', 'true');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function showMissingTracksNotification(missingTracks) {
|
function showMissingTracksNotification(missingTracks) {
|
||||||
const modal = document.getElementById('missing-tracks-modal');
|
const modal = document.getElementById('missing-tracks-modal');
|
||||||
const listUl = document.getElementById('missing-tracks-list-ul');
|
const listUl = document.getElementById('missing-tracks-list-ul');
|
||||||
|
|
|
||||||
|
|
@ -3204,8 +3204,7 @@ input:checked + .slider::before {
|
||||||
}
|
}
|
||||||
|
|
||||||
.offline-notification,
|
.offline-notification,
|
||||||
.update-notification,
|
.update-notification {
|
||||||
.install-prompt {
|
|
||||||
position: fixed;
|
position: fixed;
|
||||||
bottom: 130px;
|
bottom: 130px;
|
||||||
right: 20px;
|
right: 20px;
|
||||||
|
|
@ -3227,8 +3226,7 @@ input:checked + .slider::before {
|
||||||
color: #f59e0b;
|
color: #f59e0b;
|
||||||
}
|
}
|
||||||
|
|
||||||
.update-notification,
|
.update-notification {
|
||||||
.install-prompt {
|
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: stretch;
|
align-items: stretch;
|
||||||
}
|
}
|
||||||
|
|
@ -4475,8 +4473,7 @@ img[src=''] {
|
||||||
}
|
}
|
||||||
|
|
||||||
.offline-notification,
|
.offline-notification,
|
||||||
.update-notification,
|
.update-notification {
|
||||||
.install-prompt {
|
|
||||||
left: 10px;
|
left: 10px;
|
||||||
right: 10px;
|
right: 10px;
|
||||||
max-width: none;
|
max-width: none;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue