Skip to content

Conversation

@shubham1g5
Copy link
Contributor

@shubham1g5 shubham1g5 commented Jun 11, 2025

Product Description

Remove unused strings
rename to use personalId_ prefix

Review by Commit.
Doing this on connect beta first in order to correctly identify unused strings with connect code
Will duplicate this to commcare_2.57 once merged.

Labels and Review

  • Do we need to enhance the manual QA test coverage ? If yes, the "QA Note" label is set correctly
  • Does the PR introduce any major changes worth communicating ? If yes, the "Release Note" label is set and a "Release Note" is specified in PR description.
  • Risk label is set correctly
  • The set of people pinged as reviewers is appropriate for the level of risk of the change

@coderabbitai
Copy link

coderabbitai bot commented Jun 11, 2025

📝 Walkthrough

Walkthrough

This set of changes focuses on renaming, consolidating, and removing string resources across the application—primarily those related to PersonalId (formerly ConnectId) authentication features, camera permissions, and error messages. Many string resources with generic or legacy keys have been deleted and replaced with new keys prefixed by "personalid_". Corresponding updates were made in layout XML files and Java classes to reference the new string resource keys. Additionally, large numbers of localized string entries in several languages were removed or similarly renamed to match the new conventions. No functional logic or control flow was changed in the Java code; all updates are limited to text resource management and UI string references.

Sequence Diagram(s)

No sequence diagrams are generated for these changes, as all modifications are limited to string resource references and do not affect the application's control flow or introduce new interactive features.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate Unit Tests
  • Create PR with Unit Tests
  • Commit Unit Tests in branch stringCleanup
  • Post Copyable Unit Tests in Comment

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai auto-generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

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: 3

🧹 Nitpick comments (2)
app/src/org/commcare/activities/LoginActivity.java (1)

531-533: Use new string resource for failed login message
Switched the error message key to personalid_failed_to_login_with_connectid. After merging, remove the old failed_to_login_with_connectid entry from your string resources to avoid dead code.

app/res/layout/screen_personalid_name.xml (1)

37-37: Prefix subtitle with PersonalId namespace
Changed the subtitle TextView to use @string/personalid_name_fragment_subtitle. Don't forget to delete the old name_fragment_subtitle resource if it's no longer used.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8987bd1 and 643b419.

📒 Files selected for processing (20)
  • app/res/layout/fragment_recovery_code.xml (2 hunks)
  • app/res/layout/screen_login.xml (2 hunks)
  • app/res/layout/screen_personalid_name.xml (2 hunks)
  • app/res/layout/screen_personalid_photo_capture.xml (3 hunks)
  • app/res/values-es/strings.xml (0 hunks)
  • app/res/values-fr/strings.xml (1 hunks)
  • app/res/values-lt/strings.xml (0 hunks)
  • app/res/values-no/strings.xml (0 hunks)
  • app/res/values-pt/strings.xml (1 hunks)
  • app/res/values-sw/strings.xml (1 hunks)
  • app/res/values-ti/strings.xml (1 hunks)
  • app/res/values/strings.xml (1 hunks)
  • app/src/org/commcare/activities/LoginActivity.java (1 hunks)
  • app/src/org/commcare/fragments/MicroImageActivity.java (1 hunks)
  • app/src/org/commcare/fragments/personalId/PersonalIdBackupCodeFragment.java (2 hunks)
  • app/src/org/commcare/fragments/personalId/PersonalIdBiometricConfigFragment.java (2 hunks)
  • app/src/org/commcare/fragments/personalId/PersonalIdPhoneFragment.java (2 hunks)
  • app/src/org/commcare/fragments/personalId/PersonalIdPhoneVerificationFragment.java (1 hunks)
  • app/src/org/commcare/fragments/personalId/PersonalIdPhotoCaptureFragment.java (1 hunks)
  • app/src/org/commcare/utils/BiometricsHelper.java (1 hunks)
💤 Files with no reviewable changes (3)
  • app/res/values-lt/strings.xml
  • app/res/values-es/strings.xml
  • app/res/values-no/strings.xml
🧰 Additional context used
🧬 Code Graph Analysis (1)
app/src/org/commcare/utils/BiometricsHelper.java (1)
app/src/org/commcare/android/database/connect/models/PersonalIdSessionData.kt (2)
  • requiredLock (9-38)
  • PIN (30-32)
🔇 Additional comments (25)
app/res/layout/screen_login.xml (2)

136-136: Update login_via_connect text to new PersonalId string
Ensures the login_via_connect TextView now references the newly prefixed personalid_login_via_connect. Confirm that this resource is defined and translated for all supported locales.


278-278: No-op closing tag change
The closing </LinearLayout> was updated but carries no functional change.

app/res/layout/screen_personalid_photo_capture.xml (4)

21-29: Rename title string to PersonalId variant
Updated the @+id/title TextView to use @string/personalid_photo_capture_title. Confirm that this key exists and is localized.


31-39: Rename subtitle string to PersonalId variant
Switched the @+id/subtitle TextView to @string/personalid_photo_capture_subtitle. Ensure translations are in sync.


52-60: Rename take-photo button text
Changed the take-photo button to @string/personalid_photo_capture_take_photo_button. Verify that it's defined across all language packs.


60-67: Rename save-photo button text
Updated the save-photo button to @string/personalid_photo_capture_save_photo_button. Check that the disabled/enabled states still make sense with the new resource.

app/src/org/commcare/fragments/MicroImageActivity.java (1)

115-116: Switch to namespaced permission rationale strings
The permission rationale dialog now correctly uses personalid_camera_permission_title and personalid_camera_permission_msg to align with the PersonalId resource prefix.

app/src/org/commcare/fragments/personalId/PersonalIdBiometricConfigFragment.java (2)

35-35: Trivial cleanup of an empty line/import removal; no action needed.


277-277: Use updated PersonalId-specific error title
The security configuration failure dialog now references personalid_configuration_process_failed_title, matching the new resource namespace.

app/res/layout/fragment_recovery_code.xml (1)

188-188: Update to personalid_ namespaced string resource
The "Not me" TextView now points to @string/personalid_this_is_not_me, ensuring consistency with PersonalId branding.

app/src/org/commcare/fragments/personalId/PersonalIdPhoneFragment.java (2)

227-227: Use namespaced subtitle string for configuration failure
Switched to personalid_configuration_process_failed_subtitle for the failure message to keep resource keys consistent.


256-256: Use namespaced title string for configuration failure dialog
Updated to personalid_configuration_process_failed_title in the navigation action, aligning with the refactoring.

app/src/org/commcare/fragments/personalId/PersonalIdPhoneVerificationFragment.java (1)

108-111: Switch OTP error messages to personalid_ resources
Updated the OTP failure cases (INVALID_CREDENTIAL, TOO_MANY_REQUESTS, MISSING_ACTIVITY, VERIFICATION_FAILED) to use the new personalid_ prefixed string keys.

app/src/org/commcare/utils/BiometricsHelper.java (3)

237-237: Consistent string resource usage in default switch
The new yield call uses R.string.personalid_configuration_process_failed_server_msg, aligning with the PersonalId prefix refactor.


248-248: String resource update approved for PIN hardware error
Switched to the new personalid_configuration_process_failed_security_subtitle key for PIN errors.


252-252: String resource update approved for biometric hardware error
Switched to the new personalid_configuration_process_failed_security_subtitle key for biometric errors.

app/src/org/commcare/fragments/personalId/PersonalIdBackupCodeFragment.java (2)

89-89: Welcome back message updated to new resource
Using R.string.personalid_welcome_back_msg with the correct prefix ensures consistency with the PersonalId namespace.


182-183: Recovery failure dialog strings updated correctly
The dialog now references personalid_recovery_failed_title and personalid_recovery_failed_message, matching the renamed resources.

app/res/values-sw/strings.xml (1)

429-433: Add new Swahili OTP error strings
Introduces personalid_-prefixed OTP error and status messages for Swahili locale.

app/res/values-fr/strings.xml (1)

422-426: Add new French OTP error strings
Introduces personalid_-prefixed OTP error and status messages for French locale.

app/res/values-ti/strings.xml (1)

406-411: Approved: New PersonalID OTP strings added
The newly introduced personalid_ prefixed keys for OTP errors are consistent with the pattern in other locales.

app/res/values-pt/strings.xml (1)

420-425: Approved: Localized PersonalID OTP error strings
The added personalid_ keys and their Portuguese translations align with the default and other language files.

app/res/values/strings.xml (3)

588-588: Approved: Generic PersonalID error string
Adding personalid_generic_error gives a clear fallback message—good improvement.


608-621: Approved: Remaining PersonalID string additions
The other personalid_ keys for camera permissions, capture actions, and OTP verification align with naming conventions. Confirm that code correctly handles %s and %d placeholders.


595-607: ⚠️ Potential issue

Fix formatting and quoting issues

  • personalid_login_via_connect contains an explicit \n; remove it or verify it's rendered correctly.
  • personalid_photo_upload_failure value is wrapped in extraneous quotes—remove leading/trailing " to avoid literal quotes in UI.
  • Strings containing HTML tags or escape sequences (<u>…</u>, \n) should declare formatted="false" or wrap content in CDATA.

Suggested diff:

- <string name="personalid_photo_upload_failure">"Failed to save photo. Please check your internet and try again. "</string>
+ <string name="personalid_photo_upload_failure" formatted="false">Failed to save photo. Please check your internet and try again.</string>
- <string name="personalid_login_via_connect">Ready to login!\n</string>
+ <string name="personalid_login_via_connect" formatted="false">Ready to login!</string>
- <string name="personalid_this_is_not_me"><u>This is not me</u></string>
+ <string name="personalid_this_is_not_me" formatted="false"><![CDATA[<u>This is not me</u>]]></string>

Likely an incorrect or invalid review comment.

case VERIFICATION_FAILED -> getString(R.string.personalid_otp_verification_failed);
default ->
getString(R.string.otp_verification_failed) + errorMessage != null ? errorMessage : "Unknown error";
getString(R.string.personalid_otp_verification_failed_generic) + errorMessage != null ? errorMessage : "Unknown error";
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fix operator precedence in default OTP error handling
The concatenation with the ternary is parsed incorrectly, causing userMessage to be null. Parenthesize the conditional:

- getString(R.string.personalid_otp_verification_failed_generic) + errorMessage != null ? errorMessage : "Unknown error"
+ getString(R.string.personalid_otp_verification_failed_generic) + (errorMessage != null ? errorMessage : "Unknown error");
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
getString(R.string.personalid_otp_verification_failed_generic) + errorMessage != null ? errorMessage : "Unknown error";
getString(R.string.personalid_otp_verification_failed_generic)
+ (errorMessage != null ? errorMessage : "Unknown error");
🤖 Prompt for AI Agents
In
app/src/org/commcare/fragments/personalId/PersonalIdPhoneVerificationFragment.java
at line 113, the concatenation with the ternary operator is parsed incorrectly
due to operator precedence, causing userMessage to be null. Fix this by adding
parentheses around the ternary expression to ensure it evaluates correctly
before concatenation.


private static void crashWithInvalidSecurityTypeException(Activity activity, String requiredLock) {
new RuntimeException(activity.getString(R.string.configuration_process_failed_server_msg, requiredLock));
new RuntimeException(activity.getString(R.string.personalid_configuration_process_failed_server_msg, requiredLock));
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Missing throw on RuntimeException
The helper instantiates a RuntimeException but never throws it. Change to throw new RuntimeException(...) to actually crash on invalid security type.

🤖 Prompt for AI Agents
In app/src/org/commcare/utils/BiometricsHelper.java at line 243, the code
creates a new RuntimeException but does not throw it, so the exception is never
triggered. Fix this by adding the `throw` keyword before `new
RuntimeException(...)` to ensure the exception is properly thrown and the
program crashes on invalid security type.

@shubham1g5
Copy link
Contributor Author

Did a separate PR for CR comments above - #3182

@shubham1g5 shubham1g5 merged commit 5ee26c5 into connect_beta_june Jun 11, 2025
1 check passed
@shubham1g5 shubham1g5 deleted the stringCleanup branch June 11, 2025 09:05
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.

3 participants