diff options
| author | Adam Soltys <[email protected]> | 2025-08-18 23:12:57 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2025-08-18 23:12:57 -0700 |
| commit | 41642852b636d2e07b9d72482b9a40328fc76903 (patch) | |
| tree | cbd938bf75e36c1f3b1ef79935ea89e181826069 | |
| parent | 89e536d64f3c10e93f9a73a9da9ee00b23ce53f0 (diff) | |
| download | coinos-ui-41642852b636d2e07b9d72482b9a40328fc76903.tar.gz coinos-ui-41642852b636d2e07b9d72482b9a40328fc76903.zip | |
clear notification badge on app open
| -rw-r--r-- | src/routes/+layout.svelte | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index 7e0d28a5..0d686f47 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -16,6 +16,11 @@ ? `http://${PUBLIC_DOMAIN}` : `https://${PUBLIC_DOMAIN}`; + function clearBadge() { + if ("clearAppBadge" in navigator) { + navigator.clearAppBadge().catch(() => {}); + } + } onMount(() => { if (!browser) return; @@ -25,6 +30,11 @@ $installPrompt = event; }); + clearBadge(); // first load + document.addEventListener("visibilitychange", () => { + if (document.visibilityState === "visible") clearBadge(); + }); + let hasNotch = typeof window.AndroidNotch !== "undefined"; if (hasNotch) { window.AndroidNotch.getInsetTop( |
