fix: preserve brief notification preferences
All checks were successful
CI / Lint, test, typecheck and build (push) Successful in 10m45s
All checks were successful
CI / Lint, test, typecheck and build (push) Successful in 10m45s
This commit is contained in:
@@ -428,14 +428,15 @@ export function SettingsPage() {
|
||||
setMorningBriefEnabled(enabled);
|
||||
if (!notificationsEnabled || !canUsePush || notificationStatus !== "granted") return;
|
||||
try {
|
||||
const preferences = useWeatherStore.getState();
|
||||
const registration = await navigator.serviceWorker?.getRegistration();
|
||||
const subscription = await registration?.pushManager.getSubscription();
|
||||
if (!subscription) return;
|
||||
await savePushSubscription(subscription, effectiveProvince, language, {
|
||||
region: selectedRegion,
|
||||
officialWarningsEnabled: canUseOfficialWarnings && notificationsEnabled,
|
||||
morningBriefEnabled: enabled,
|
||||
tomorrowBriefEnabled,
|
||||
morningBriefEnabled: preferences.morningBriefNotificationsEnabled,
|
||||
tomorrowBriefEnabled: preferences.tomorrowBriefNotificationsEnabled,
|
||||
latitude: notificationLatitude,
|
||||
longitude: notificationLongitude,
|
||||
locationName: notificationLocationName,
|
||||
@@ -453,14 +454,15 @@ export function SettingsPage() {
|
||||
setTomorrowBriefEnabled(enabled);
|
||||
if (!notificationsEnabled || !canUsePush || notificationStatus !== "granted") return;
|
||||
try {
|
||||
const preferences = useWeatherStore.getState();
|
||||
const registration = await navigator.serviceWorker?.getRegistration();
|
||||
const subscription = await registration?.pushManager.getSubscription();
|
||||
if (!subscription) return;
|
||||
await savePushSubscription(subscription, effectiveProvince, language, {
|
||||
region: selectedRegion,
|
||||
officialWarningsEnabled: canUseOfficialWarnings && notificationsEnabled,
|
||||
morningBriefEnabled,
|
||||
tomorrowBriefEnabled: enabled,
|
||||
morningBriefEnabled: preferences.morningBriefNotificationsEnabled,
|
||||
tomorrowBriefEnabled: preferences.tomorrowBriefNotificationsEnabled,
|
||||
latitude: notificationLatitude,
|
||||
longitude: notificationLongitude,
|
||||
locationName: notificationLocationName,
|
||||
|
||||
Reference in New Issue
Block a user