feat(reminder): add Baidu location module and native monitor - #239
feat(reminder): add Baidu location module and native monitor#239gac0812 wants to merge 4 commits into
Conversation
Ship the Android Baidu LocationClient bridge and request launch location permissions so place reminders can watch geofences without Google geofencing.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…rvice Start a location-type FGS with the LocationClient, and document that the AK must match expo.android.package (com.anonymous.timeflow).
|
@fennoai /review |
Review CompleteSubmitted a non-blocking PR review with 3 inline findings:
Validation: inspected the fixed SHA range and ran |
Gate SDK init on explicit consent, keep samples in WGS84, and rebuild location watches with a single native sync.
|
@fennoai /review |
Review CompleteThe previous findings were addressed in
The updated review contains 2 remaining P1 findings:
Validation passed: |
| } | ||
| const agreed = await confirmBaiduPrivacy(); | ||
| if (!agreed) return; | ||
| await persistBaiduPrivacyConsent(true); |
There was a problem hiding this comment.
P1 — Re-sync location monitoring after first-time consent. A location runtime can start while this async launch hook is waiting for the foreground/background permission prompts and the Baidu privacy dialog. In that case NativeLocationMonitor.syncMonitoring() sees no persisted consent, baiduInit()/baiduStartUpdating() return false, and the monitor remains stopped. After the user taps 同意, this code only persists consent and sets the SDK flag; it never asks the existing monitor/runtime to retry, so location reminders stay disabled until another rebuild or app-state transition. Trigger a monitor resync (or defer runtime start) after consent succeeds.
| if (!updating) { | ||
| try { | ||
| BaiduLocationForegroundService.start(reactContext.applicationContext) | ||
| } catch (error: Exception) { |
There was a problem hiding this comment.
P1 — Do not continue location updates when the foreground service cannot start. If startForegroundService() throws (for example because Android rejects a background FGS start), this catch only logs the error and the code still calls locationClient.start() and resolves success. The JS monitor then marks itself started even though no location FGS protects the process, so background reminders can silently stop once the app is backgrounded. Propagate the failure and avoid starting the client, or provide an explicit service-start acknowledgement before reporting success.
Summary
frontend/modules/timeflow-baidu-locationAndroid 模块与 Expo pluginwithTimeflowBaiduLocationBaiduLocationBridge/NativeLocationMonitor:百度连续定位 + Haversine 进出圈createAppServices将location接到NativeLocationMonitoruseLocationPermissionsOnLaunch,启动时申请前台/后台定位权限Merge Order
Scope
frontend/modules/timeflow-baidu-location/**frontend/plugins/withTimeflowBaiduLocation.jsfrontend/react-native.config.jsfrontend/app.json、frontend/package.json、frontend/eslint.config.jsfrontend/src/infrastructure/location/native/BaiduLocationBridge.tsfrontend/src/infrastructure/location/NativeLocationMonitor.tsfrontend/src/features/reminder/presentation/useLocationPermissionsOnLaunch.tsfrontend/src/app/composition/createAppServices.ts(仅 location 接线)frontend/src/app/AppProviders.tsx(启动定位权限)frontend/tests/unit/infrastructure/location/**frontend/tests/unit/features/reminder/useLocationPermissionsOnLaunch.test.tsOut of scope
timeflow-alarm原生模块(见 feat(reminder): add timeflow-alarm native module and Expo wiring #237)LocalReminderApplication组合根(见 feat(reminder): wire LocalReminderApplication with in-memory adapters #238)Verification
npm run checknpm ciCloses #234