Listen for beforeinstallprompt to trigger 'add to home'
This commit is contained in:
parent
1f604a8556
commit
0f6fd4dac5
2
client/css/bootstrap.css
vendored
2
client/css/bootstrap.css
vendored
@ -44,7 +44,7 @@ audio:not([controls]) {
|
||||
}
|
||||
[hidden],
|
||||
template {
|
||||
display: none;
|
||||
display: none !important;
|
||||
}
|
||||
a {
|
||||
background: transparent;
|
||||
|
@ -60,4 +60,9 @@
|
||||
};
|
||||
|
||||
window.addEventListener("error", window.g_LoungeErrorHandler);
|
||||
|
||||
// Trigger early service worker registration
|
||||
if ("serviceWorker" in navigator) {
|
||||
navigator.serviceWorker.register("service-worker.js");
|
||||
}
|
||||
})();
|
||||
|
@ -8,6 +8,18 @@ const webpush = require("../webpush");
|
||||
const connect = $("#connect");
|
||||
const utils = require("../utils");
|
||||
|
||||
window.addEventListener("beforeinstallprompt", (installPromptEvent) => {
|
||||
$("#webapp-install-button")
|
||||
.on("click", function() {
|
||||
if (installPromptEvent && installPromptEvent.prompt) {
|
||||
installPromptEvent.prompt();
|
||||
}
|
||||
|
||||
$(this).prop("hidden", true);
|
||||
})
|
||||
.prop("hidden", false);
|
||||
});
|
||||
|
||||
socket.on("configuration", function(data) {
|
||||
if (options.initialized) {
|
||||
// Likely a reconnect, request sync for possibly missed settings.
|
||||
|
@ -15,6 +15,8 @@
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<h2>Native app</h2>
|
||||
<button type="button" class="btn" id="webapp-install-button" hidden>Add The Lounge to Home screen</button>
|
||||
<button type="button" class="btn" id="make-default-client">Open irc:// URLs with The Lounge</button>
|
||||
</div>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user