fix(app): write Apple Reminders to default list instead of creating one per task#7287
fix(app): write Apple Reminders to default list instead of creating one per task#7287waffensam wants to merge 8 commits into
Conversation
Title matching ("Reminders") fails on non-English systems
(e.g. "提醒事项"), so the lookup branch never hit and every
addReminder call created a brand-new list. Fall back to
defaultCalendarForNewReminders() when no exact match exists,
matching the behavior of the FCM batch path.
Previously the wrapper always sent listName: 'Reminders' to the iOS side, forcing the title-match path. Send the key only when the caller passes one so iOS can use the user's default list.
Falls through to defaultCalendarForNewReminders() on iOS instead of asking for a 'Reminders'-titled list that may not exist.
Greptile SummaryThis PR fixes a long-standing localization bug where exporting tasks to Apple Reminders on non-English iOS devices created a new duplicate list for every task, because
Confidence Score: 3/5The The PR fixes the most visible symptom (duplicate list creation on every
Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["Dart: addReminder(title, notes, dueDate, listName?)"] --> B{listName != null?}
B -- Yes --> C["Include 'listName' in platform channel args"]
B -- No --> D["Omit 'listName' from args"]
C --> E["Swift: addReminder()"]
D --> E
E --> F{listName arg present and non-empty?}
F -- Yes --> G["Search calendars by title"]
G --> H{Match found?}
H -- Yes --> I["Use matched calendar"]
H -- No --> J["defaultCalendarForNewReminders()"]
F -- No --> J
J --> K{nil?}
I --> L["Save EKReminder → return calendarItemIdentifier"]
K -- No --> L
K -- Yes --> M["FlutterError: NO_CALENDAR"]
|
|
Thanks @greptile-apps — good catch on the sibling methods. Pushed two follow-up commits applying the same |
|
Both commits look good. The pattern is applied consistently across all three handlers now: Swift ( Dart ( The whole file is internally consistent now. The original bug and the sibling latent issues are all resolved. LGTM. Tip: You can customize Greptile's behavior for this repo with |
Summary
On non-English iOS systems, exporting tasks to Apple Reminders created a brand-new "Reminders" list for every task instead of writing into the user's existing list. Result: a "提醒事项" sidebar full of duplicate "Reminders" lists with one task each.
Root cause is in the single-reminder add path.
AppleRemindersService.addReminder()looked up the target calendar by exact title ("Reminders"), and on a miss fell into a "create a new list with that title" branch. The system list is localized (e.g."提醒事项"on zh,"Erinnerungen"on de), so the lookup never matched and a freshEKCalendarwas saved for every call.The FCM batch path (
syncBatchFromJSON) already does the right thing — it writes directly todefaultCalendarForNewReminders(). This change brings the single-add path in line with that.Fix
AppleRemindersService.swift): treatlistNameas opt-in. If the caller passes a name AND a calendar with that exact title exists, use it; otherwise fall back todefaultCalendarForNewReminders(). Never auto-create a new list.listName: 'Reminders'from all four call sites (apple_reminders_service.dart,apple_reminders_sync_service.dart,action_items_provider.dart,action_item_tile_widget.dart) and only forward the key to the platform channel when explicitly set.There is no UI today for selecting a target list, so dropping the hardcoded value is safe — no existing user configuration depends on it.
Verification
🤖 Generated with Claude Code