--- ## 6. 日历提醒未使用自定义提示音 **文件**: `apps/lib/core/notification/services/reminder_scheduler_service.dart` **问题描述**: 已添加 `apps/assets/reminder_sound/1.WAV` 自定义提示音文件,但代码中未使用,仍使用系统默认铃声: ```dart // 当前代码 const androidDetails = AndroidNotificationDetails( _channelId, _channelName, // ... playSound: true, // 使用系统默认 // 没有 customSound 配置 ); ``` **根因**: 添加了资源文件但未在通知配置中引用。 **建议修复**: 1. 在 `pubspec.yaml` 添加 assets 路径: ```yaml flutter: assets: - assets/reminder_sound/ ``` 2. 在通知配置中引用自定义铃声: ```dart // Android final androidDetails = AndroidNotificationDetails( _channelId, _channelName, playSound: true, sound: RawResourceAndroidNotificationSound('reminder_sound/1'), // ... ); // iOS const iosDetails = DarwinNotificationDetails( presentSound: true, sound: 'reminder_sound_1.wav', // ... ); ``` --- ## 7. 通知调度缺少变化检测(重复重建) **文件**: `apps/lib/core/notification/services/reminder_scheduler_service.dart` **问题描述**: 每次获取日历事件都会调用 `upsertEventReminders`,内部执行 `cancelEventReminders` + 重建,即使事件没变化: ```dart Future upsertEventReminders(event) async { await cancelEventReminders(event.eventId); // 总是先取消 for (alarm in buildAlarmsForEvent(event)) { await _scheduleAlarm(alarm); // 总是重建 } } ``` **影响**: - 通知 ID 变化导致系统重新调度,浪费资源 - 用户频繁访问日历时产生不必要的操作 **建议修复**: ```dart Future upsertEventReminders(event) async { final existing = await _getScheduledAlarm(event.eventId); if (existing != null && _isSameAlarm(existing, event)) { return; // 跳过,没变化 } await cancelEventReminders(event.eventId); for (alarm in buildAlarmsForEvent(event)) { await _scheduleAlarm(alarm); } } ``` ## 相关文件 - `apps/lib/app/app.dart` - `apps/lib/data/cache/cache_scope.dart` - `apps/lib/data/cache/cache_store.dart` - `apps/lib/data/cache/cached_repository.dart` - `apps/lib/core/inbox/inbox_sync_store.dart` - `apps/lib/features/chat/presentation/bloc/chat_bloc.dart` - `apps/lib/app/services/app_prewarm_orchestrator.dart` - `apps/lib/core/notification/services/reminder_scheduler_service.dart` - `apps/lib/core/notification/services/reminder_permission_service.dart` - `apps/lib/core/notification/services/reminder_reconcile_service.dart` - `apps/assets/reminder_sound/`