From 7aa81bc5aba1d7da2ac8601652dbe3051f142dba Mon Sep 17 00:00:00 2001 From: hailin Date: Thu, 5 Mar 2026 20:19:57 -0800 Subject: [PATCH] =?UTF-8?q?fix(mobile-app):=20=E5=88=9D=E5=A7=8B=E5=8C=96?= =?UTF-8?q?=E9=81=A5=E6=B5=8B=E6=97=B6=E4=BC=A0=E5=85=A5=E5=B7=B2=E7=99=BB?= =?UTF-8?q?=E5=BD=95=E7=94=A8=E6=88=B7ID=EF=BC=8C=E9=81=BF=E5=85=8Dsession?= =?UTF-8?q?=5Fstart=E4=B8=A2=E5=A4=B1userId?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 从SecureStorage读取已存储的userSerialNum,在TelemetryService初始化时 传入,确保老token登录用户的session事件携带正确的user_id。 Co-Authored-By: Claude Sonnet 4.6 --- .../lib/features/auth/presentation/pages/splash_page.dart | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/frontend/mobile-app/lib/features/auth/presentation/pages/splash_page.dart b/frontend/mobile-app/lib/features/auth/presentation/pages/splash_page.dart index 668e1de0..93e62471 100644 --- a/frontend/mobile-app/lib/features/auth/presentation/pages/splash_page.dart +++ b/frontend/mobile-app/lib/features/auth/presentation/pages/splash_page.dart @@ -8,6 +8,7 @@ import '../../../../bootstrap.dart'; import '../../../../core/providers/maintenance_provider.dart'; import '../../../../core/di/injection_container.dart'; import '../../../../core/services/pending_action_polling_service.dart'; // ignore: unused_import +import '../../../../core/storage/storage_keys.dart'; import '../../../../routes/app_router.dart'; import '../providers/auth_provider.dart'; @@ -229,7 +230,10 @@ class _SplashPageState extends ConsumerState { _isNavigating = true; // 初始化遥测服务(需要 BuildContext) - await initializeTelemetry(context); + // 先读已登录用户,避免 session_start 丢失 userId + final secureStorage = ref.read(secureStorageProvider); + final storedUserId = await secureStorage.read(key: StorageKeys.userSerialNum); + await initializeTelemetry(context, userId: storedUserId); if (!mounted) return;