From 310a26897f9cf5a8fa0209b99b10a92f77586387 Mon Sep 17 00:00:00 2001 From: xyven1 Date: Thu, 5 Oct 2023 12:45:55 +0000 Subject: [PATCH] fix dom typing and removed install shim --- src/ambient.d.ts | 9 +++++---- src/views/Home.vue | 4 ++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/ambient.d.ts b/src/ambient.d.ts index d1b3ba2..92a9a6b 100644 --- a/src/ambient.d.ts +++ b/src/ambient.d.ts @@ -28,8 +28,9 @@ interface BeforeInstallPromptEvent extends Event { prompt(): Promise; } -declare global { - interface WindowEventMap { - beforeinstallprompt: BeforeInstallPromptEvent; - } +declare interface WindowEventMap { + beforeinstallprompt: BeforeInstallPromptEvent; +} +declare interface Navigator { + getInstalledRelatedApps: () => Promise>; } diff --git a/src/views/Home.vue b/src/views/Home.vue index 7e944c3..e089999 100644 --- a/src/views/Home.vue +++ b/src/views/Home.vue @@ -96,7 +96,7 @@ const unknownInstallOverlay = ref(false); let installPromptEvent: BeforeInstallPromptEvent | null = null; window.addEventListener("beforeinstallprompt", (e) => { e.preventDefault(); - installPromptEvent = e as BeforeInstallPromptEvent; + installPromptEvent = e; }); const isInStandaloneMode = window.matchMedia( "(display-mode: standalone)", @@ -108,7 +108,7 @@ async function installPWA() { const relatedApps = await navigator.getInstalledRelatedApps(); installed = relatedApps.length > 0; } - if (installed || true) { + if (installed) { alreadyInstalledOverlay.value = true; } else if (platform.value.ios) { iosInstallOverlay.value = true;