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-checked="notifyingReminder"
|
||||||
aria-label="Toggle reminder notifications"
|
aria-label="Toggle reminder notifications"
|
||||||
tabindex="0"
|
tabindex="0"
|
||||||
@click="showReminderNotificationChoice()"
|
@click.stop.prevent="showReminderNotificationChoice()"
|
||||||
>
|
>
|
||||||
<!-- input -->
|
<!-- 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 -->
|
<!-- line -->
|
||||||
<div class="block bg-slate-500 w-14 h-8 rounded-full"></div>
|
<div class="block bg-slate-500 w-14 h-8 rounded-full"></div>
|
||||||
<!-- dot -->
|
<!-- dot -->
|
||||||
@@ -1220,17 +1227,57 @@ export default class AccountViewView extends Vue {
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
this.notify.notificationOff(DIRECT_PUSH_TITLE, async (success) => {
|
// On native platforms, handle notification cancellation directly
|
||||||
if (success) {
|
// (bypassing web push unsubscribe flow which doesn't work on native)
|
||||||
await this.$saveSettings({
|
if (this.isNativePlatform) {
|
||||||
notifyingReminderMessage: "",
|
// Show confirmation dialog
|
||||||
notifyingReminderTime: "",
|
this.notify.confirm(
|
||||||
});
|
`Would you like to turn off ${DIRECT_PUSH_TITLE}?`,
|
||||||
this.notifyingReminder = false;
|
async () => {
|
||||||
this.notifyingReminderMessage = "";
|
try {
|
||||||
this.notifyingReminderTime = "";
|
// 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 = "";
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user