fix: preserve brief notification preferences
All checks were successful
CI / Lint, test, typecheck and build (push) Successful in 10m45s

This commit is contained in:
zv
2026-07-04 15:28:58 +02:00
parent b1cbc771f8
commit f15ebd28dc
4 changed files with 53 additions and 8 deletions

View File

@@ -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,