From 88f69054f41f97cb176e0f410259e4aec2d837a3 Mon Sep 17 00:00:00 2001 From: Jose Olarte III Date: Wed, 28 Jan 2026 17:08:42 +0800 Subject: [PATCH] Update AccountViewView.vue fix(notifications): Reminder Notification toggle not turning off on native platforms The toggle wasn't turning off on iOS/Android because: 1. Checkbox was being toggled directly before dialog confirmation 2. turnOffNotifications only handles web push, not native notifications Fixed by: - Preventing direct checkbox toggling with readonly and event handlers - Adding native platform handling to cancel notifications via NotificationService.cancelDailyNotification() directly - Bypassing web push unsubscribe flow on native platforms --- src/views/AccountViewView.vue | 73 ++++++++++++++++++++++++++++------- 1 file changed, 60 insertions(+), 13 deletions(-) diff --git a/src/views/AccountViewView.vue b/src/views/AccountViewView.vue index 4130a980..a4130636 100644 --- a/src/views/AccountViewView.vue +++ b/src/views/AccountViewView.vue @@ -104,10 +104,17 @@ :aria-checked="notifyingReminder" aria-label="Toggle reminder notifications" tabindex="0" - @click="showReminderNotificationChoice()" + @click.stop.prevent="showReminderNotificationChoice()" > - +
@@ -1220,17 +1227,57 @@ export default class AccountViewView extends Vue { }, ); } else { - this.notify.notificationOff(DIRECT_PUSH_TITLE, async (success) => { - if (success) { - await this.$saveSettings({ - notifyingReminderMessage: "", - notifyingReminderTime: "", - }); - this.notifyingReminder = false; - this.notifyingReminderMessage = ""; - this.notifyingReminderTime = ""; - } - }); + // On native platforms, handle notification cancellation directly + // (bypassing web push unsubscribe flow which doesn't work on native) + if (this.isNativePlatform) { + // Show confirmation dialog + this.notify.confirm( + `Would you like to turn off ${DIRECT_PUSH_TITLE}?`, + async () => { + try { + // Cancel the native notification + const service = NotificationService.getInstance(); + await service.cancelDailyNotification(); + + // Update settings and state + await this.$saveSettings({ + notifyingReminderMessage: "", + notifyingReminderTime: "", + }); + this.notifyingReminder = false; + this.notifyingReminderMessage = ""; + this.notifyingReminderTime = ""; + + this.notify.success( + `${DIRECT_PUSH_TITLE} has been turned off.`, + TIMEOUTS.STANDARD, + ); + } catch (error) { + logger.error( + "[AccountViewView] Error canceling native notification:", + error, + ); + this.notify.error( + "Failed to turn off notification. Please try again.", + TIMEOUTS.STANDARD, + ); + } + }, + ); + } else { + // Web platform: use existing web push unsubscribe flow + this.notify.notificationOff(DIRECT_PUSH_TITLE, async (success) => { + if (success) { + await this.$saveSettings({ + notifyingReminderMessage: "", + notifyingReminderTime: "", + }); + this.notifyingReminder = false; + this.notifyingReminderMessage = ""; + this.notifyingReminderTime = ""; + } + }); + } } }