refactor notification syncing

This commit is contained in:
Jon Staab
2026-01-27 17:15:22 -08:00
parent 143a1dd39b
commit bf6abd301c
6 changed files with 245 additions and 254 deletions
+12 -2
View File
@@ -27,7 +27,12 @@
import {setupAnalytics} from "@app/util/analytics"
import {authPolicy, blockPolicy, trustPolicy, mostlyRestrictedPolicy} from "@app/util/policies"
import {kv, db} from "@app/core/storage"
import {userSettingsValues, notificationSettings, notificationState} from "@app/core/state"
import {
device,
userSettingsValues,
notificationSettings,
notificationState,
} from "@app/core/state"
import {syncApplicationData} from "@app/core/sync"
import * as commands from "@app/core/commands"
import * as requests from "@app/core/requests"
@@ -87,6 +92,11 @@
// Sync stuff to localstorage
await Promise.all([
sync({
key: "device",
store: device,
storage: kv,
}),
sync({
key: "pubkey",
store: pubkey,
@@ -139,7 +149,7 @@
unsubscribers.push(syncKeyboard())
// Initialize background notifications
unsubscribers.push(notifications.Push.start())
unsubscribers.push(notifications.Push.sync())
// Listen for signer errors, report to user via toast
unsubscribers.push(
+1 -8
View File
@@ -39,18 +39,11 @@
settings.push = false
pushToast({
return pushToast({
theme: "error",
message: "Failed to request notification permissions.",
})
return
}
await Push.enable()
await Push.start()
} else {
await Push.disable()
}
if (!equals(muted_rooms, $userSettingsValues.muted_rooms)) {