Skip to content

[helpers] new API for resolve phone number#398

Open
capcom6 wants to merge 1 commit into
masterfrom
helpers/resolve-phone-number
Open

[helpers] new API for resolve phone number#398
capcom6 wants to merge 1 commit into
masterfrom
helpers/resolve-phone-number

Conversation

@capcom6

@capcom6 capcom6 commented Jul 3, 2026

Copy link
Copy Markdown
Owner

Summary by CodeRabbit

  • Bug Fixes
    • Improved SIM card phone number retrieval across Android versions, resulting in more reliable phone numbers in the app.
    • Added safer handling when phone numbers cannot be read, reducing missing or incorrect values.
  • Permissions
    • Added the required permission to read SIM phone numbers so the app can display accurate phone numbers.

@coderabbitai

coderabbitai Bot commented Jul 3, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: de5e23e8-f801-497c-be7f-edab2d303f3e

📥 Commits

Reviewing files that changed from the base of the PR and between 69a081e and 33de68f.

📒 Files selected for processing (2)
  • app/src/main/AndroidManifest.xml
  • app/src/main/java/me/capcom/smsgateway/helpers/SubscriptionsHelper.kt
🚧 Files skipped from review as they are similar to previous changes (2)
  • app/src/main/java/me/capcom/smsgateway/helpers/SubscriptionsHelper.kt
  • app/src/main/AndroidManifest.xml

Walkthrough

This PR adds READ_PHONE_NUMBERS and updates SIM phone-number resolution to use SubscriptionManager.getPhoneNumber on Android 13+, with a fallback to SubscriptionInfo.number.

Changes

Phone number resolution update

Layer / File(s) Summary
Permission declaration
app/src/main/AndroidManifest.xml
Adds the READ_PHONE_NUMBERS permission to the manifest.
Resolver helper and its usages
app/src/main/java/me/capcom/smsgateway/helpers/SubscriptionsHelper.kt
Adds resolvePhoneNumber with safe Android 13+ lookup and fallback behavior, then uses it in getPhoneNumber and getActiveSimCards.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is related to the main change: adding a new phone-number resolution helper/API for SIM subscriptions.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch helpers/resolve-phone-number

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (2)
app/src/main/java/me/capcom/smsgateway/helpers/SubscriptionsHelper.kt (2)

158-158: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Prefer an import over the fully-qualified type reference.

android.telephony.SubscriptionInfo is used inline while the rest of the file relies on imports for other Android types.

♻️ Suggested tidy-up
+import android.telephony.SubscriptionInfo
...
     private fun resolvePhoneNumber(
         subscriptionManager: SubscriptionManager,
-        info: android.telephony.SubscriptionInfo,
+        info: SubscriptionInfo,
     ): String? {
🤖 Prompt for 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.

In `@app/src/main/java/me/capcom/smsgateway/helpers/SubscriptionsHelper.kt` at
line 158, The `SubscriptionsHelper` declaration still uses the fully qualified
`android.telephony.SubscriptionInfo` inline, unlike the rest of the file. Add an
import for `SubscriptionInfo` at the top of the file and update the affected
function signature to use the simple type name, keeping consistency with the
other imported Android types.

166-166: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Consider @Suppress("DEPRECATION") for consistency with the rest of the file.

info.number is a deprecated property; getSubscriptionsManager (line 14-19) already annotates its own deprecated-API usage with @Suppress("DEPRECATION") for a similar reason.

🤖 Prompt for 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.

In `@app/src/main/java/me/capcom/smsgateway/helpers/SubscriptionsHelper.kt` at
line 166, The fallback in the number lookup is using the deprecated
`info.number` property without matching the file’s existing deprecated-API
handling. Update the logic in `SubscriptionsHelper` around the
`info.number?.takeIf { it.isNotBlank() }` access to add
`@Suppress("DEPRECATION")` in the same style as `getSubscriptionsManager`,
keeping the deprecated usage explicit and consistent.
🤖 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.

Nitpick comments:
In `@app/src/main/java/me/capcom/smsgateway/helpers/SubscriptionsHelper.kt`:
- Line 158: The `SubscriptionsHelper` declaration still uses the fully qualified
`android.telephony.SubscriptionInfo` inline, unlike the rest of the file. Add an
import for `SubscriptionInfo` at the top of the file and update the affected
function signature to use the simple type name, keeping consistency with the
other imported Android types.
- Line 166: The fallback in the number lookup is using the deprecated
`info.number` property without matching the file’s existing deprecated-API
handling. Update the logic in `SubscriptionsHelper` around the
`info.number?.takeIf { it.isNotBlank() }` access to add
`@Suppress("DEPRECATION")` in the same style as `getSubscriptionsManager`,
keeping the deprecated usage explicit and consistent.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: b292d47f-7ff6-4f94-b9e7-7f2eb12d746f

📥 Commits

Reviewing files that changed from the base of the PR and between 11580ad and 08dc450.

📒 Files selected for processing (2)
  • app/src/main/AndroidManifest.xml
  • app/src/main/java/me/capcom/smsgateway/helpers/SubscriptionsHelper.kt

@capcom6 capcom6 added the ready label Jul 4, 2026
@capcom6 capcom6 marked this pull request as ready for review July 4, 2026 00:34
@github-actions

github-actions Bot commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

🤖 Pull request artifacts

file commit
app-release.apk 33de68f
app-release.aab 33de68f
app-insecure.apk 33de68f
app-insecure.aab 33de68f

@capcom6 capcom6 force-pushed the helpers/resolve-phone-number branch from 08dc450 to 69a081e Compare July 8, 2026 01:32
@github-actions github-actions Bot removed the ready label Jul 8, 2026
@capcom6 capcom6 added the ready label Jul 8, 2026
@capcom6 capcom6 force-pushed the helpers/resolve-phone-number branch from 69a081e to 33de68f Compare July 14, 2026 01:20
@github-actions github-actions Bot removed the ready label Jul 14, 2026
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