Skip to content

RR-T40 Moving phone permission check to voice call instead of startup.#105

Merged
ucswift merged 1 commit intomasterfrom
develop
Feb 6, 2026
Merged

RR-T40 Moving phone permission check to voice call instead of startup.#105
ucswift merged 1 commit intomasterfrom
develop

Conversation

@ucswift
Copy link
Member

@ucswift ucswift commented Feb 6, 2026

Summary by CodeRabbit

  • New Features
    • Improved Android phone call handling with on-demand permission requests for headset controls. Permissions are now requested just before making a call instead of during setup.

@coderabbitai
Copy link

coderabbitai bot commented Feb 6, 2026

📝 Walkthrough

Walkthrough

Adds behavioral guidance rules for AI problem-solving; refactors Android CallKeep permission handling from setup-time to on-demand via new requestPhonePermissions() method; adds corresponding iOS stub; integrates permission checks in LiveKit store before initiating voice calls.

Changes

Cohort / File(s) Summary
AI Behavioral Rules
.agent/rules/rules.md
Adds front matter trigger and multiple guidance blocks covering strict planning, certainty requirements, first-principles thinking, debugging protocols, anti-repetition strategies, token efficiency, and pre-flight verification.
CallKeep Permission Refactoring
src/services/callkeep.service.android.ts
Removes inline permission checks from setup flow and introduces new public method requestPhonePermissions() for on-demand Android API 30+ permission requests with dialog prompts and logging.
CallKeep iOS Compatibility
src/services/callkeep.service.ios.ts
Adds public method requestPhonePermissions() as a no-op returning true, indicating iOS requires no additional permissions.
LiveKit Store Integration
src/stores/app/livekit-store.ts
Integrates Android-specific permission checks before CallKeep initialization in both startup and room connection paths, with warning-only behavior on denial.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • Develop #100: Also modifies src/stores/app/livekit-store.ts to add platform-specific permission checks before CallKeep operations, though for microphone rather than phone permissions.

Poem

🐰 A permissions tale, now better told,
Android calls home before bells ring bold,
iOS shrugs—no fuss needed here,
LiveKit listens, step-by-step, crystal clear. 📱✨

🚥 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 title accurately describes the main change: deferring Android phone permission checks from application startup to the moment of initiating a voice call via CallKeep.
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
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch develop

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/services/callkeep.service.android.ts (1)

60-63: ⚠️ Potential issue | 🟠 Major

Remove READ_PHONE_NUMBERS from additionalPermissions in setup() to avoid conflicting with the on-demand request at call time.

The additionalPermissions array at lines 60–63 includes READ_PHONE_NUMBERS (on API 30+), which will trigger an Android runtime permission dialog during RNCallKeep.setup(). This conflicts with the stated goal in your comment (lines 78–79) to request phone permissions on-demand when connecting a voice call.

Since requestPhonePermissions() already handles the READ_PHONE_NUMBERS request at call time, remove it from additionalPermissions on API 30+:

Suggested change
          additionalPermissions: [
            PermissionsAndroid.PERMISSIONS.READ_PHONE_STATE,
-           ...(Platform.Version >= 30 ? [PermissionsAndroid.PERMISSIONS.READ_PHONE_NUMBERS] : []),
          ],

READ_PHONE_STATE can remain as it may be needed during setup, but READ_PHONE_NUMBERS should only be requested just before the call.

🧹 Nitpick comments (2)
src/services/callkeep.service.android.ts (2)

100-151: Core permission logic looks correct; fix formatting per linter.

The requestPhonePermissions() method is well-structured: early returns for non-Android / pre-API-30, check-before-request pattern, proper error handling, and non-blocking return values.

Static analysis flagged formatting issues (extra indentation) in the PermissionsAndroid.check and PermissionsAndroid.request call sites. Please fix to match project formatting rules.

🧹 Proposed formatting fix
       const hasPermission = await PermissionsAndroid.check(
-        PermissionsAndroid.PERMISSIONS.READ_PHONE_NUMBERS
-      );
+        PermissionsAndroid.PERMISSIONS.READ_PHONE_NUMBERS,
+      );

       // ...

       const result = await PermissionsAndroid.request(
-        PermissionsAndroid.PERMISSIONS.READ_PHONE_NUMBERS,
-        {
-          title: 'Phone Permission Required',
-          message: 'This app needs phone access to manage voice calls with your headset',
-          buttonPositive: 'Grant',
-          buttonNegative: 'Deny',
-        }
+        PermissionsAndroid.PERMISSIONS.READ_PHONE_NUMBERS,
+        {
+          title: 'Phone Permission Required',
+          message: 'This app needs phone access to manage voice calls with your headset',
+          buttonPositive: 'Grant',
+          buttonNegative: 'Deny',
+        },
       );

127-135: User-facing permission rationale strings are not internationalized.

The title, message, buttonPositive, and buttonNegative strings are hardcoded in English. Since the app is multi-lingual, these should be wrapped in t() from react-i18next for localization. As per coding guidelines: "The app is multi-lingual, so ensure all text is wrapped in t() from react-i18next for translations."

@ucswift
Copy link
Member Author

ucswift commented Feb 6, 2026

Approve

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR is approved.

@ucswift ucswift merged commit 90c1778 into master Feb 6, 2026
13 of 14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant