Files
social-app/docs/bugs/AuthSessionBootstrapper旧代码应删除.md
T

44 lines
1.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# AuthSessionBootstrapper 旧代码应删除
## 文件位置
`apps/lib/app/startup/auth_session_bootstrapper.dart`
## 问题描述
`AuthSessionBootstrapper` 是遗留代码,用于在用户登录时同步日历事件和通知提醒。
### 代码问题
```dart
Future<void> syncForAuthState(AuthState state) async {
if (state is! AuthAuthenticated) {
_syncedUserId = null;
return;
}
// 获取180天日历事件并重建通知提醒
final events = await _calendarService.getEventsForRange(start, end);
await _notificationService.rebuildUpcomingReminders(events);
...
}
```
1. **同步逻辑已迁移** - `CalendarService``LocalNotificationService` 应自己管理缓存生命周期,无需登录时手动触发
2. **内存缓存不可靠** - `_syncedUserId` 仅内存存储,App 重启后失效
3. **静默失败** - 同步失败被 `catch (_)` 吞掉,无日志无重试
4. **180 天硬编码** - 时间范围未从配置读取
## 处理方式
**直接删除**
- 删除 `apps/lib/app/startup/auth_session_bootstrapper.dart`
- 确认无调用处后,清理 `startup/` 目录(若为空)
## 相关文件
- `apps/lib/app/startup/auth_session_bootstrapper.dart`
## 修复优先级
**低** - 功能层面暂无影响,但属于应清理的技术债