aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2025-08-18 23:12:57 -0700
committerAdam Soltys <[email protected]>2025-08-18 23:12:57 -0700
commit41642852b636d2e07b9d72482b9a40328fc76903 (patch)
treecbd938bf75e36c1f3b1ef79935ea89e181826069
parent89e536d64f3c10e93f9a73a9da9ee00b23ce53f0 (diff)
downloadcoinos-ui-41642852b636d2e07b9d72482b9a40328fc76903.tar.gz
coinos-ui-41642852b636d2e07b9d72482b9a40328fc76903.zip
clear notification badge on app open
-rw-r--r--src/routes/+layout.svelte10
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(