rwadurian/frontend/mobile-app/lib/features
hailin 8f8a9230d0 fix(mobile-app): 修复多账号切换数据串号问题,完善存储隔离与状态重置
问题:
多账号切换时,前一个账号的推荐码、种植省市、缓存数据等会串到下一个账号,
同时定时器(钱包轮询、通知刷新、遥测上传)未正确停止/重启,
导致旧账号的 API 请求混入新账号上下文。

修复内容:

1. StorageKeys 补充种植省市常量(storage_keys.dart)
   - 新增 plantingProvinceName/Code、plantingCityName/Code 4个常量
   - 将硬编码的 key 统一收口,确保隔离列表引用一致

2. MultiAccountService 补全隔离列表(multi_account_service.dart)
   - _accountSecureKeys 新增 inviterReferralCode(修复邀请码串号)
   - _accountLocalKeys 新增 4个种植省市key + cachedAppAssets +
     cachedCustomerServiceContacts(修复种植/缓存数据串号)
   - switchToAccount() 新增 onBeforeRestore 回调参数,用于在
     storage清空后、恢复新数据前 停止定时器

3. AccountSwitchPage 三层状态重置(account_switch_page.dart)
   - _switchToAccount: onBeforeRestore 内停止 walletStatus 轮询、
     pendingAction 轮询、telemetry 上传;返回后 invalidate
     authProvider/walletStatusProvider/notificationBadgeProvider,
     最后 resumeAfterLogin 恢复遥测
   - _addNewAccount: 退出前停止定时器,退出后 invalidate Provider

4. ProfilePage 退出登录补全清理(profile_page.dart)
   - _performLogout: 退出前停止 walletStatus/pendingAction 轮询,
     退出后 invalidate 三个 Provider

5. 页面 key 统一引用 StorageKeys 常量
   - planting_location_page.dart 和 authorization_apply_page.dart
     将硬编码 key 替换为 StorageKeys.plantingXxx 常量

关键时序(switchToAccount 内部):
  save → clear → onBeforeRestore(停timer) → restore → 返回
  → invalidate Provider(此时storage已恢复新数据)→ resume telemetry → navigate

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 06:13:05 -08:00
..
account/presentation/pages fix(mobile-app): 修复多账号切换数据串号问题,完善存储隔离与状态重置 2026-02-25 06:13:05 -08:00
auth/presentation feat(app-assets): 应用图片管理 — 开屏图/引导图可从 admin-web 配置 2026-02-04 11:20:26 -08:00
authorization/presentation fix(mobile-app): 修复多账号切换数据串号问题,完善存储隔离与状态重置 2026-02-25 06:13:05 -08:00
contract_signing/presentation feat(mobile-app): 增强合同PDF下载可靠性和用户体验 2026-01-09 07:12:21 -08:00
deposit/presentation/pages fix(mobile-app): fetch wallet address from server API instead of local storage 2026-01-04 10:00:33 -08:00
home/presentation chore(mobile-app): 减少频繁轮询产生的调试日志 2025-12-28 06:54:16 -08:00
kyc feat(mobile-app): KYC成功后自动跳转合同签署页面 2025-12-25 07:07:43 -08:00
mining/presentation/pages feat(mobile-app): 为3个主导航页面添加下拉刷新功能 2026-02-05 21:50:43 -08:00
notification/presentation/pages feat(mobile-app,admin): 添加系统维护功能和通知徽章功能 2025-12-27 23:26:01 -08:00
pending_actions/presentation/pages fix(mobile-app): 修复认种订单解析和状态检查问题 2026-01-09 02:49:31 -08:00
planting/presentation fix(mobile-app): 修复多账号切换数据串号问题,完善存储隔离与状态重置 2026-02-25 06:13:05 -08:00
pre_planting/presentation/pages feat(pre-planting): Mobile App 预种合并详情页完整实现 2026-02-18 05:43:17 -08:00
profile/presentation fix(mobile-app): 修复多账号切换数据串号问题,完善存储隔离与状态重置 2026-02-25 06:13:05 -08:00
ranking/presentation/pages feat(mobile-app): 为3个主导航页面添加下拉刷新功能 2026-02-05 21:50:43 -08:00
security/presentation/pages feat(email): 实现邮箱绑定/解绑功能 2025-12-23 20:53:20 -08:00
share/presentation/pages feat(frontend): 多项功能改进 2025-12-15 04:04:21 -08:00
trading/presentation/pages feat(mobile-app): 为3个主导航页面添加下拉刷新功能 2026-02-05 21:50:43 -08:00
transfer/presentation/pages style(transfer): 树转让 3 页面从暗夜主题改为 App 标准浅色棕金主题 2026-02-23 20:25:25 -08:00
withdraw/presentation/pages feat(fiat-withdrawal): add complete fiat withdrawal system 2026-01-03 06:39:11 -08:00