Skip to content

Commit

Permalink
Merge pull request #374 from schlagmichdoch/pwa_standalone
Browse files Browse the repository at this point in the history
Enable standalone mode for PWA
  • Loading branch information
schlagmichdoch authored Feb 14, 2025
2 parents 8826893 + 1d0d3d0 commit eca41f3
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 5 deletions.
3 changes: 2 additions & 1 deletion public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<meta name="theme-color" content="#3367d6">
<meta name="color-scheme" content="dark light">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<meta name="apple-mobile-web-app-title" content="PairDrop">
<meta name="application-name" content="PairDrop">
<!-- Descriptions -->
Expand Down Expand Up @@ -841,4 +842,4 @@ <h3>PairDrop works only with JavaScript</h3>
</x-noscript>
</noscript>
</body>
</html>
</html>
2 changes: 1 addition & 1 deletion public/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
}
],
"background_color": "#efefef",
"display": "minimal-ui",
"display": "standalone",
"theme_color": "#3367d6",
"screenshots" : [
{
Expand Down
2 changes: 1 addition & 1 deletion public/scripts/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class PairDrop {
}

onPwaInstallable(e) {
if (!window.matchMedia('(display-mode: minimal-ui)').matches) {
if (!window.matchMedia('(display-mode: standalone)').matches) {
// only display install btn when not installed
this.$headerInstallBtn.removeAttribute('hidden');
this.$headerInstallBtn.addEventListener('click', () => {
Expand Down
1 change: 0 additions & 1 deletion public/scripts/ui-main.js
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,6 @@ class BackgroundCanvas {
this.w = document.documentElement.clientWidth;
this.h = document.documentElement.clientHeight;
this.offset = this.$footer.offsetHeight - 27;
if (this.h >= 800) this.offset += 10;

if (oldW === this.w && oldH === this.h && oldOffset === this.offset) return; // nothing has changed

Expand Down
9 changes: 8 additions & 1 deletion public/styles/styles-main.css
Original file line number Diff line number Diff line change
Expand Up @@ -899,7 +899,7 @@ x-peers:empty~x-instructions {

@media screen and (min-height: 800px) {
footer {
margin-bottom: 16px;
padding-bottom: 10px;
}
}

Expand All @@ -909,6 +909,13 @@ x-peers:empty~x-instructions {
}
}

/* PWA Standalone styles */
@media all and (display-mode: standalone) {
footer {
padding-bottom: 34px;
}
}

/* Constants */

:root {
Expand Down

0 comments on commit eca41f3

Please # to comment.