Repository navigation
省電力測位を両OSと端末の省電力モードに対応 - #6378
Merged
Merged
Conversation
Contributor
📝 WalkthroughWalkthrough省電力測位用の更新間隔と位置情報オプションを追加し、開発版アプリでは設定または端末の低電力モードに応じてバックグラウンド・フォアグラウンド更新へ適用します。切替条件のテスト、コメント、英日翻訳も更新されています。 Changes省電力測位
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant App as 開発版アプリ
participant Battery as 端末の低電力モード
participant Settings as 省電力測位設定
participant Location as Expo Location
App->>Battery: 低電力モードを取得
App->>Settings: 実験設定を取得
App->>Location: 省電力または通常のタスク設定で更新開始
App->>Location: 省電力または通常の監視設定で位置監視
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
TinyKitten
marked this pull request as ready for review
July 10, 2026 14:00
Contributor
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/hooks/useStartBackgroundLocationUpdates.ts`:
- Around line 32-47:
powerSavingEnabledの変化により最初のuseEffectがバックグラウンド測位を停止・再起動し、Battery.useLowPowerMode()の初期値反映時やトグル操作時に測位が瞬断されます。useStartBackgroundLocationUpdates内の依存関係と起動処理を見直し、低電力モードの変化ではタスクを再起動せず、次回の測位設定へ反映するよう調整してください。再起動を仕様とする場合は、初期値反映による二重起動を避けるガードと、ON/OFF時の瞬断を許容するテストを追加してください。
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 9a238b8e-64bc-4132-b3b4-b100ee3eda2c
📒 Files selected for processing (6)
assets/translations/en.jsonassets/translations/ja.jsonsrc/constants/location.tssrc/hooks/useStartBackgroundLocationUpdates.test.tsxsrc/hooks/useStartBackgroundLocationUpdates.tssrc/store/atoms/experimental.ts
This was referenced Jul 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概要
試験用の省電力測位モードをiOS限定の精度調整から、Android・iOS共通の省電力プロファイルへ拡張します。
devアプリでは端末側の省電力モードにも自動追従し、長時間乗車時の電池消費と発熱を抑えます。本番アプリには省電力プロファイルを適用しません。
変更の種類
変更内容
High(約10m)の測位精度を使用killServiceOnDestroyはstopLocationUpdatesAsyncを呼ばないため、測位タスク自体の登録解除を保証するものではない通常モードの測位条件と画面常時点灯の挙動は変更していません。
回帰リスク
更新頻度を下げるため、環境によって到着通知が通常モードより遅れる可能性があります。一方、駅間の短い都市部でも最寄り駅判定を維持できるよう、GPSを避ける
Balanced(約100m)は採用せず、高精度プロバイダを使うHighを維持します。設定説明に解除方法を記載し、通常モードへ戻せるようにしています。devアプリ・本番アプリ・省電力プロファイル・通常プロファイルの分岐をテストで固定しています。テスト
npm run lintが通ることnpm testが通ることnpm run typecheckが通ること実行結果:
npm run lint: 成功npx cross-env TZ=UTC jest --runInBand: 188スイート、2024テスト成功npm run typecheck: 成功Windowsではpackage.jsonの
TZ=UTCを直接解釈できないため、全テストは同等のcross-env経由で実行しました。関連Issue
なし
スクリーンショット(任意)
画面レイアウト変更なし(設定説明文のみ更新)
Summary by CodeRabbit
新機能
改善