fix: resolve navigation-cache regressions and todo UX

This commit is contained in:
qzl
2026-03-20 16:45:08 +08:00
parent 3f1858d733
commit 55f3805ee9
15 changed files with 160 additions and 105 deletions
@@ -1,7 +1,5 @@
import 'dart:math';
import 'package:flutter/widgets.dart';
import '../data/services/calendar_service.dart';
import '../../../core/notifications/local_notification_service.dart';
import 'models/reminder_action.dart';
@@ -13,23 +11,16 @@ class ReminderActionExecutor {
final LocalNotificationService _notificationService;
final ReminderOutboxStore _outboxStore;
final Random _random;
final bool Function() _isAppActive;
ReminderActionExecutor({
required CalendarService calendarService,
required LocalNotificationService notificationService,
required ReminderOutboxStore outboxStore,
Random? random,
bool Function()? isAppActive,
}) : _calendarService = calendarService,
_notificationService = notificationService,
_outboxStore = outboxStore,
_random = random ?? Random(),
_isAppActive =
isAppActive ??
(() =>
WidgetsBinding.instance.lifecycleState ==
AppLifecycleState.resumed);
_random = random ?? Random();
Future<void> handleAction({
required ReminderAction action,
@@ -95,9 +86,11 @@ class ReminderActionExecutor {
}
Future<void> _archiveEvent(String eventId, ReminderAction action) async {
if (_isAppActive()) {
try {
await _calendarService.archiveEvent(eventId);
return;
} catch (_) {
// fall through to enqueue local outbox for retry
}
final opId =