add note to install as an app

This commit is contained in:
2023-12-27 14:46:10 -07:00
parent 051a0a97d8
commit 75d15ddeb9
4 changed files with 33 additions and 12 deletions

View File

@@ -10,6 +10,21 @@
<!-- show the actions for recognizing a give -->
<div class="mb-8">
<div
v-if="!isInstalled()"
class="bg-amber-200 rounded-md overflow-hidden text-center px-4 py-3 mb-4"
>
<p>
You should install this as an app.
<router-link
:to="{ name: 'help-notifications' }"
class="text-blue-500"
>
Go here for instructions.
</router-link>
</p>
</div>
<div
v-if="!activeDid"
class="bg-amber-200 rounded-md overflow-hidden text-center px-4 py-3 mb-4"
@@ -249,6 +264,18 @@ export default class HomeView extends Vue {
}
}
// from https://benborgers.com/posts/pwa-detect-installed
isInstalled() {
// For iOS
if ("standalone" in window.navigator) return true;
// For Android
if (window.matchMedia("(display-mode: standalone)").matches) return true;
// If neither is true, it's not installed
return false;
}
public async buildHeaders() {
const headers: HeadersInit = {
"Content-Type": "application/json",