forked from coracle/flotilla
refactor notification syncing
This commit is contained in:
@@ -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(
|
||||
|
||||
@@ -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)) {
|
||||
|
||||
Reference in New Issue
Block a user