Skip to content

notifee使用箇所の修正 - #5192

Merged
TinyKitten merged 2 commits into
devfrom
fix/android-notifee
Jan 27, 2026
Merged

TinyKitten merged 2 commits into
devfrom
fix/android-notifee

Conversation

@TinyKitten

@TinyKitten TinyKitten commented Jan 27, 2026 •

Copy link
Copy Markdown
Member

#5133
必要のない時に動いてたし、なんだったらクラッシュしてた

Summary by CodeRabbit

  • 新機能
    • フォアグラウンドサービスを追加しました。位置情報トラッキングとメディア再生に対応し、ユーザー設定と端末の位置権限に基づいて起動します。
  • テスト
    • 非同期ストレージのモックをテスト環境に追加し、ストレージ依存のテストを安定化しました。

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai

coderabbitai Bot commented Jan 27, 2026 •

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

AndroidManifestにForegroundService宣言を追加し、AsyncStorageのBG_TTS_ENABLEDフラグと位置情報のバックグラウンド権限を並列で確認してからフォアグラウンドサービスを起動するガードロジックをTypeScriptで導入しました(テスト用にAsyncStorageのJestモックも追加)。

Changes

Cohort / File(s) 変更内容
Android マニフェスト設定
android/app/src/main/AndroidManifest.xml
ForegroundService宣言を追加(android:name="app.notifee.core.ForegroundService"、`android:foregroundServiceType="location
Foreground Service モジュール
src/utils/native/android/foregroundServiceModule.ts
新しい内部ヘルパー shouldStartForegroundService を追加。AsyncStorage の BG_TTS_ENABLED フラグと expo-location のバックグラウンド権限を並列でチェックし、両方が許可されている場合のみ startForegroundService を続行するよう起動判定を導入
テストセットアップ(モック追加)
jest.setup.js
@react-native-async-storage/async-storage のモック実装を追加(getItem/setItem 等の非同期メソッドを解決済みのPromiseで返す)

Sequence Diagram(s)

sequenceDiagram
  participant JS as App JS
  participant AS as AsyncStorage
  participant LOC as expo-location
  participant OS as Android OS

  JS->>AS: getItem(BG_TTS_ENABLED)
  JS->>LOC: getBackgroundPermissionsAsync()
  AS-->>JS: "true" / "false"
  LOC-->>JS: granted / denied
  alt BG_TTS_ENABLED == "true" and granted
    JS->>OS: createNotificationChannel()
    JS->>OS: startForegroundService(Intent -> ForegroundService)
    OS-->>JS: service started
  else otherwise
    JS-->>JS: abort start
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰 ぽかぽか朝のコード畑、
フラグと権限をにんじんで確かめ、
小さなサービス跳ねて出るよ、
マニフェストに花が咲いたら、
ふわりとバグは逃げてゆくよ ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title 'notifee使用箇所の修正' (Fix notifee usage) accurately reflects the main changes: adding foreground service configuration, implementing conditional service startup logic, and adding AsyncStorage mocks to support the fix. The title is concise and directly related to the core change.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant