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
This commit is contained in:
@@ -104,10 +104,17 @@
|
||||
:aria-checked="notifyingReminder"
|
||||
aria-label="Toggle reminder notifications"
|
||||
tabindex="0"
|
||||
@click="showReminderNotificationChoice()"
|
||||
@click.stop.prevent="showReminderNotificationChoice()"
|
||||
>
|
||||
<!-- input -->
|
||||
<input v-model="notifyingReminder" type="checkbox" class="sr-only" />
|
||||
<input
|
||||
:checked="notifyingReminder"
|
||||
type="checkbox"
|
||||
class="sr-only"
|
||||
readonly
|
||||
@click.stop.prevent
|
||||
@change.stop.prevent
|
||||
/>
|
||||
<!-- line -->
|
||||
<div class="block bg-slate-500 w-14 h-8 rounded-full"></div>
|
||||
<!-- dot -->
|
||||
@@ -1220,6 +1227,45 @@ export default class AccountViewView extends Vue {
|
||||
},
|
||||
);
|
||||
} else {
|
||||
// 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({
|
||||
@@ -1233,6 +1279,7 @@ export default class AccountViewView extends Vue {
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Edit existing reminder notification
|
||||
|
||||
Reference in New Issue
Block a user