fix(ios): show reminder dialog and prevent duplicate notifications

- Show reminder dialog on iOS when app is opened with pending reminders
  (Android still skips dialog since native notification actions work in background)
- Skip scheduling past reminders to prevent duplicate notifications when
  the effect runs after a reminder has already fired
This commit is contained in:
johannesjo 2026-01-16 16:09:22 +01:00
parent 9d19a481c8
commit 28da8999f2
2 changed files with 12 additions and 2 deletions

View file

@ -112,6 +112,12 @@ export class AndroidEffects {
// Schedule each reminder using the platform-appropriate method
for (const task of tasksWithReminders) {
// Skip reminders that are already in the past (already fired)
// These will be handled by the dialog when the user opens the app
if (task.remindAt! < Date.now()) {
continue;
}
const id = generateNotificationId(task.id);
await this._reminderService.scheduleReminder({
notificationId: id,

View file

@ -3,7 +3,11 @@ import { CommonModule } from '@angular/common';
import { ReminderService } from './reminder.service';
import { MatDialog } from '@angular/material/dialog';
import { IS_ELECTRON } from '../../app.constants';
import { IS_NATIVE_PLATFORM, IS_IOS_NATIVE } from '../../util/is-native-platform';
import {
IS_NATIVE_PLATFORM,
IS_IOS_NATIVE,
IS_ANDROID_NATIVE,
} from '../../util/is-native-platform';
import {
concatMap,
delay,
@ -109,7 +113,7 @@ export class ReminderModule {
// app state. The reminder will be cancelled when the task is marked done in the app.
// To fully fix: Add onReminderDone$ subject to android-interface.ts and wire it up
// in the Kotlin ReminderBroadcastReceiver to call dismissReminderOnly action.
if (IS_NATIVE_PLATFORM) {
if (IS_ANDROID_NATIVE) {
return;
}