主要变更: 1. 新增桌面端托盘图标支持深色/浅色主题切换 2. 重构应用锁、动画配置、小组件导航服务职责 3. 修复Riverpod初始化断言、防重复点击、工作台模式残留选中态问题 4. 优化诗词服务、阅读进度、搜索结果空状态体验 5. 完善macOS打包配置与错误静默处理逻辑 6. 新增快速卡片多语言适配与动画退出队列管理
42 lines
1.4 KiB
Dart
42 lines
1.4 KiB
Dart
/// ============================================================
|
|
/// 闲言APP — 小组件导航服务
|
|
/// 创建时间: 2026-06-22
|
|
/// 更新时间: 2026-06-22
|
|
/// 作用: 处理桌面小组件点击后的待处理导航
|
|
/// 上次更新: 从 app.dart 中提取小组件导航职责
|
|
/// ============================================================
|
|
|
|
import '../../core/router/app_router.dart' show appRouter, rootNavigatorKey;
|
|
import '../../core/router/ohos_nav_bridge.dart';
|
|
import '../../core/services/data/home_widget_service.dart';
|
|
import '../../core/utils/logger.dart';
|
|
import '../../core/utils/platform/platform_utils.dart' as pu;
|
|
|
|
/// 小组件导航服务
|
|
///
|
|
/// 负责处理桌面小组件点击后的待处理导航:
|
|
/// - 消费 HomeWidgetService 中缓存的待处理路由
|
|
/// - 根据平台选择导航方式(鸿蒙 vs 标准)
|
|
class WidgetNavigationService {
|
|
/// 处理待处理的小组件导航
|
|
///
|
|
/// 在应用从后台恢复时调用。
|
|
void handlePendingNavigation() {
|
|
final route = HomeWidgetService.consumePendingNavigation();
|
|
if (route == null) return;
|
|
|
|
final context = rootNavigatorKey.currentContext;
|
|
if (context == null) {
|
|
Log.w('WidgetNavigation: rootNavigatorKey context 不可用');
|
|
return;
|
|
}
|
|
|
|
Log.i('WidgetNavigation: 从小组件导航到 $route');
|
|
if (pu.isOhos) {
|
|
OhosNavBridge.go(context, route);
|
|
} else {
|
|
appRouter.push(route);
|
|
}
|
|
}
|
|
}
|