Ver código fonte

Fix splash screen background color and install title

RobinLinus 6 anos atrás
pai
commit
b8b23cd807
3 arquivos alterados com 5 adições e 10 exclusões
  1. 1 1
      client/index.html
  2. 1 1
      client/manifest.json
  3. 3 8
      client/scripts/ui.js

+ 1 - 1
client/index.html

@@ -44,7 +44,7 @@
                 <use xlink:href="#notifications" />
             </svg>
         </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">
                 <use xlink:href="#homescreen" />
             </svg>

+ 1 - 1
client/manifest.json

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

+ 3 - 8
client/scripts/ui.js

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