fix(location): use native cached location fallback - #339
Conversation
4d8e99f to
922b2b7
Compare
|
@fennoai /review |
Review Complete
|
There was a problem hiding this comment.
Reviewed the Android native cached-location module, JavaScript fallback/provider and geofence integration, assistant location timeout, and development-build configuration. The location fallback contracts and timeout behavior are coherent, but the new Compose configuration introduces a fresh-checkout startup regression described in the inline finding below. Focused Jest and TypeScript verification could not run in this workspace because the local node_modules executables are absent/non-executable; the review otherwise used the fixed PR diff and affected callers.
922b2b7 to
0dee55e
Compare
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
已审查 Android native last-known location、JS bridge/probe、Expo provider、geofence monitor 和两条语音启动超时链路。整体 fallback 与异常收敛契约一致,但 native provider 读取前的 enabled 检查会漏掉系统仍保留的缓存位置。
验证方面,已核对固定范围 2c1d7f4ed983bd37001869ac27811efb56effeb5...0dee55e98c75eaf72b9c6b61e675863d3ef13ba8 的全部 20 个文件;本地 checkout 未安装 Jest 包,因此无法复跑前端测试(npm 首先报可执行权限错误,直接通过 Node 调用时确认 node_modules/jest 不存在)。
e841ae8 to
5fe6618
Compare
|
已补充修复并推送到提交 \5fe6618\:
验证结果:Vitest 87/87、Jest 626/626、Android :timeflow-alarm:testDebugUnitTest\、TypeScript、ESLint、Codecov 和全部 PR CI 均通过。现有 review thread 均已解决。 |
5fe6618 to
6c43662
Compare
关联 Issue 与前置工作
Closes #338
本 PR 为 Android 增加 native last-known location 兜底。当 Expo 缓存或实时定位不可用时,语音握手和 geofence 仍可使用符合时效与精度要求的系统缓存位置;定位不可用或响应过慢时,不阻塞语音连接。
当前提交:
6c43662fix(location): use native cached location fallback当前分支:
背景与目标
Android 系统可能已经保存了可用的 last-known location,但 Expo
getCurrentPositionAsync仍可能返回ERR_CURRENT_LOCATION_IS_UNAVAILABLE。此前业务无法继续读取系统缓存位置,导致语音握手和 geofence 初始化获得null;实时定位响应较慢时,还会延迟语音连接。本 PR 目标:
完整流程
位置获取流程:
语音启动流程:
主要改动
Android native location
新增
TimeflowLocationnative module:network、passive、gps和fusedprovider 读取 last-known location;涉及文件:
LocationModule.ktLocationSnapshotReader.ktLocationSnapshotSelector.ktAlarmPackage.ktJavaScript native fallback
新增
NativeLocationFallback.ts:TimeflowLocationnative module;LocationSample;null;Expo location provider
更新
ExpoLocationProvider.ts:null,不主动弹出权限请求。Geofence monitor
更新
ExpoLocationMonitor.ts:lastSample;Assistant conversation
更新:
AssistantConversationService.tsAssistantContinuousConversationService.ts将语音启动阶段的定位等待上限从 2000ms 调整为 500ms。定位超时只省略本次位置,不阻塞语音连接。
Development build
增加:
expo-dev-client;timeflowURL scheme;精确坐标仅允许由受
__DEV__和EXPO_PUBLIC_LOCATION_PROBE_ON_START双重控制的开发探针输出。验收行为
null测试覆盖
新增或更新:
LocationSnapshotReaderTest.javaLocationSnapshotSelectorTest.javanativeLocationFallback.test.tsexpoLocationProvider.test.tsexpoLocationMonitor.test.tsAssistantConversationService.test.tsAssistantContinuousConversationService.test.ts覆盖内容:
当前验证结果
本地验证:
npm run lintnpm run typecheck./gradlew :timeflow-alarm:testDebugUnitTest:BUILD SUCCESSFULgit diff --checkGitHub CI:
codecov/patch范围与非目标
本 PR 不处理:
ACCESS_BACKGROUND_LOCATION;docker-compose.yml配置调整。风险与兼容性
Review Checklist
Closes #338关联 Issue。docker-compose.yml未包含在 PR 中。