[] = []
@@ -687,7 +581,7 @@ class WebNotifications implements IPushAdapter {
const {push, messages, mentions, spaces} = notificationSettings.get()
if (push && document.hidden && Notification?.permission === "granted") {
- if (messages && matchFilters(dmFilters, event)) {
+ if (messages && matchFilter({kinds: DM_KINDS}, event)) {
this._notify(event, "New direct message", "Someone sent you a direct message.")
} else if (
mentions &&
diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte
index 7de9b0a4..2bc6f345 100644
--- a/src/routes/+layout.svelte
+++ b/src/routes/+layout.svelte
@@ -142,12 +142,15 @@
// History, navigation, application data
unsubscribers.push(setupHistory(), setupAnalytics(), syncApplicationData())
- // Subscribe to badge count for changes
- unsubscribers.push(notifications.syncBadges)
-
// Initialize keyboard state tracking
unsubscribers.push(syncKeyboard())
+ // Subscribe to badge count for changes
+ unsubscribers.push(notifications.syncBadges())
+
+ // Subscribe to page history to update checked state
+ unsubscribers.push(notifications.syncChecked())
+
// Initialize background notifications
unsubscribers.push(notifications.Push.sync())
diff --git a/src/routes/chat/+page.svelte b/src/routes/chat/+page.svelte
index 6d6c2e18..e0974e8a 100644
--- a/src/routes/chat/+page.svelte
+++ b/src/routes/chat/+page.svelte
@@ -1,6 +1,4 @@
diff --git a/src/routes/chat/[chat]/+page.svelte b/src/routes/chat/[chat]/+page.svelte
index 6ef3563e..4239f43a 100644
--- a/src/routes/chat/[chat]/+page.svelte
+++ b/src/routes/chat/[chat]/+page.svelte
@@ -4,18 +4,10 @@
import {append, uniq} from "@welshman/lib"
import {pubkey} from "@welshman/app"
import Chat from "@app/components/Chat.svelte"
- import {notifications, setChecked} from "@app/util/notifications"
import {splitChatId} from "@app/core/state"
const {chat} = $page.params as MakeNonOptional
const pubkeys = uniq(append($pubkey!, splitChatId(chat)))
-
- // We have to watch this one, since on mobile the badge will be visible when active
- $effect(() => {
- if ($notifications.has($page.url.pathname)) {
- setChecked($page.url.pathname)
- }
- })
diff --git a/src/routes/spaces/[relay]/+layout.svelte b/src/routes/spaces/[relay]/+layout.svelte
index cc5748f9..512c5cc9 100644
--- a/src/routes/spaces/[relay]/+layout.svelte
+++ b/src/routes/spaces/[relay]/+layout.svelte
@@ -8,10 +8,8 @@
import SpaceAuthError from "@app/components/SpaceAuthError.svelte"
import SpaceTrustRelay from "@app/components/SpaceTrustRelay.svelte"
import {pushModal} from "@app/util/modal"
- import {setChecked} from "@app/util/notifications"
import {decodeRelay, relaysPendingTrust} from "@app/core/state"
import {deriveRelayAuthError} from "@app/core/commands"
- import {notifications} from "@app/util/notifications"
type Props = {
children?: Snippet
@@ -29,13 +27,6 @@
const showPendingTrust = once(() => pushModal(SpaceTrustRelay, {url}, {noEscape: true}))
- // We have to watch this one, since on mobile the badge will be visible when active
- $effect(() => {
- if ($notifications.has($page.url.pathname)) {
- setChecked($page.url.pathname)
- }
- })
-
// Watch for relay errors and notify the user
$effect(() => {
if ($authError) {
diff --git a/src/routes/spaces/[relay]/[h]/+page.svelte b/src/routes/spaces/[relay]/[h]/+page.svelte
index 820f99e8..e627d3bd 100644
--- a/src/routes/spaces/[relay]/[h]/+page.svelte
+++ b/src/routes/spaces/[relay]/[h]/+page.svelte
@@ -45,7 +45,7 @@
MESSAGE_KINDS,
userSettingsValues,
} from "@app/core/state"
- import {setChecked, checked} from "@app/util/notifications"
+ import {checked} from "@app/util/notifications"
import {canEnforceNip70, prependParent, publishDelete} from "@app/core/commands"
import {makeFeed} from "@app/core/requests"
import {popKey} from "@lib/implicit"
@@ -318,11 +318,6 @@
onDestroy(() => {
cleanup?.()
-
- // Sveltekit calls onDestroy at the beginning of the page load for some reason
- setTimeout(() => {
- setChecked($page.url.pathname)
- }, 800)
})
diff --git a/src/routes/spaces/[relay]/calendar/+page.svelte b/src/routes/spaces/[relay]/calendar/+page.svelte
index 65f109e8..298a6829 100644
--- a/src/routes/spaces/[relay]/calendar/+page.svelte
+++ b/src/routes/spaces/[relay]/calendar/+page.svelte
@@ -21,7 +21,6 @@
import {pushModal} from "@app/util/modal"
import {decodeRelay, makeCommentFilter} from "@app/core/state"
import {makeCalendarFeed} from "@app/core/requests"
- import {setChecked} from "@app/util/notifications"
const url = decodeRelay($page.params.relay!)
@@ -108,7 +107,6 @@
return () => {
feed.cleanup()
- setChecked($page.url.pathname)
}
})
diff --git a/src/routes/spaces/[relay]/calendar/[address]/+page.svelte b/src/routes/spaces/[relay]/calendar/[address]/+page.svelte
index 400249fe..f7ec14c2 100644
--- a/src/routes/spaces/[relay]/calendar/[address]/+page.svelte
+++ b/src/routes/spaces/[relay]/calendar/[address]/+page.svelte
@@ -25,7 +25,6 @@
import CalendarEventDate from "@app/components/CalendarEventDate.svelte"
import EventReply from "@app/components/EventReply.svelte"
import {deriveEvent, decodeRelay} from "@app/core/state"
- import {setChecked} from "@app/util/notifications"
const {relay, address} = $page.params as MakeNonOptional
const url = decodeRelay(relay)
@@ -57,7 +56,6 @@
return () => {
controller.abort()
- setChecked($page.url.pathname)
}
})
diff --git a/src/routes/spaces/[relay]/classifieds/+page.svelte b/src/routes/spaces/[relay]/classifieds/+page.svelte
index 213b1881..a274ddbe 100644
--- a/src/routes/spaces/[relay]/classifieds/+page.svelte
+++ b/src/routes/spaces/[relay]/classifieds/+page.svelte
@@ -17,7 +17,6 @@
import ClassifiedItem from "@app/components/ClassifiedItem.svelte"
import ClassifiedCreate from "@app/components/ClassifiedCreate.svelte"
import {decodeRelay} from "@app/core/state"
- import {setChecked} from "@app/util/notifications"
import {makeCommentFilter} from "@app/core/state"
import {makeFeed} from "@app/core/requests"
import {pushModal} from "@app/util/modal"
@@ -59,7 +58,6 @@
return () => {
feed.cleanup()
- setChecked($page.url.pathname)
}
})
diff --git a/src/routes/spaces/[relay]/classifieds/[address]/+page.svelte b/src/routes/spaces/[relay]/classifieds/[address]/+page.svelte
index dd1ba4f4..4265e8e8 100644
--- a/src/routes/spaces/[relay]/classifieds/[address]/+page.svelte
+++ b/src/routes/spaces/[relay]/classifieds/[address]/+page.svelte
@@ -22,7 +22,6 @@
import CommentActions from "@app/components/CommentActions.svelte"
import EventReply from "@app/components/EventReply.svelte"
import {deriveEvent, decodeRelay} from "@app/core/state"
- import {setChecked} from "@app/util/notifications"
const {relay, address} = $page.params as MakeNonOptional
const url = decodeRelay(relay)
@@ -54,7 +53,6 @@
return () => {
controller.abort()
- setChecked($page.url.pathname)
}
})
diff --git a/src/routes/spaces/[relay]/goals/+page.svelte b/src/routes/spaces/[relay]/goals/+page.svelte
index 77d74688..bd9c6a44 100644
--- a/src/routes/spaces/[relay]/goals/+page.svelte
+++ b/src/routes/spaces/[relay]/goals/+page.svelte
@@ -17,7 +17,6 @@
import GoalItem from "@app/components/GoalItem.svelte"
import GoalCreate from "@app/components/GoalCreate.svelte"
import {decodeRelay, makeCommentFilter} from "@app/core/state"
- import {setChecked} from "@app/util/notifications"
import {makeFeed} from "@app/core/requests"
import {pushModal} from "@app/util/modal"
@@ -58,7 +57,6 @@
return () => {
feed.cleanup()
- setChecked($page.url.pathname)
}
})
diff --git a/src/routes/spaces/[relay]/goals/[id]/+page.svelte b/src/routes/spaces/[relay]/goals/[id]/+page.svelte
index f2ba31b0..70bafb4c 100644
--- a/src/routes/spaces/[relay]/goals/[id]/+page.svelte
+++ b/src/routes/spaces/[relay]/goals/[id]/+page.svelte
@@ -22,7 +22,6 @@
import CommentActions from "@app/components/CommentActions.svelte"
import EventReply from "@app/components/EventReply.svelte"
import {deriveEvent, decodeRelay} from "@app/core/state"
- import {setChecked} from "@app/util/notifications"
const {relay, id} = $page.params as MakeNonOptional
const url = decodeRelay(relay)
@@ -55,7 +54,6 @@
return () => {
controller.abort()
- setChecked($page.url.pathname)
}
})
diff --git a/src/routes/spaces/[relay]/threads/+page.svelte b/src/routes/spaces/[relay]/threads/+page.svelte
index 485aa9b7..adddc5e0 100644
--- a/src/routes/spaces/[relay]/threads/+page.svelte
+++ b/src/routes/spaces/[relay]/threads/+page.svelte
@@ -17,7 +17,6 @@
import ThreadItem from "@app/components/ThreadItem.svelte"
import ThreadCreate from "@app/components/ThreadCreate.svelte"
import {decodeRelay} from "@app/core/state"
- import {setChecked} from "@app/util/notifications"
import {makeCommentFilter} from "@app/core/state"
import {makeFeed} from "@app/core/requests"
import {pushModal} from "@app/util/modal"
@@ -59,7 +58,6 @@
return () => {
feed.cleanup()
- setChecked($page.url.pathname)
}
})
diff --git a/src/routes/spaces/[relay]/threads/[id]/+page.svelte b/src/routes/spaces/[relay]/threads/[id]/+page.svelte
index 350651d8..d25ed0a3 100644
--- a/src/routes/spaces/[relay]/threads/[id]/+page.svelte
+++ b/src/routes/spaces/[relay]/threads/[id]/+page.svelte
@@ -22,7 +22,6 @@
import CommentActions from "@app/components/CommentActions.svelte"
import EventReply from "@app/components/EventReply.svelte"
import {deriveEvent, decodeRelay} from "@app/core/state"
- import {setChecked} from "@app/util/notifications"
const {relay, id} = $page.params as MakeNonOptional
const url = decodeRelay(relay)
@@ -54,7 +53,6 @@
return () => {
controller.abort()
- setChecked($page.url.pathname)
}
})