Skip to content

Conversation

@shubham1g5
Copy link
Contributor

Removes secondry phone number handling and mark it as deperecated.

Compilation should ensure good enough safety on code removal

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 12, 2025

📝 Walkthrough

Walkthrough

This change removes all secondary phone verification functionality from the codebase. It deletes methods and logic related to displaying, updating, and handling the secondary phone confirmation tile in the home screen and UI controller. Methods for managing secondary phone verification in the PersonalIdManager and related logic in the ConnectUserRecord model are eliminated. The PersonalIdActivity is updated to remove redirection logic for secondary phone verification tasks. Deprecated fields are retained in the model solely to avoid a database migration, but all related methods are removed.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant StandardHomeActivity
    participant UIController
    participant PersonalIdManager

    User->>StandardHomeActivity: Open Home Screen
    StandardHomeActivity->>UIController: (No longer calls updateSecondaryPhoneConfirmationTile)
    UIController--xPersonalIdManager: (No check for secondary phone verification)
    Note over StandardHomeActivity,UIController: Secondary phone verification UI and logic are skipped
Loading

Possibly related PRs

  • PM-Backmerge of Pm_qa_7735 #3094: Modifies the cancellability of a dialog in the beginSecondaryPhoneVerification method, which relates to the secondary phone verification feature that is being removed in this PR.

Suggested labels

skip-integration-tests

Suggested reviewers

  • pm-dimagi
  • OrangeAndGreen
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate Unit Tests
  • Create PR with Unit Tests
  • Commit Unit Tests in branch codeCleanUpAndFixes
  • 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: 1

🔭 Outside diff range comments (2)
app/src/org/commcare/activities/connect/PersonalIdActivity.java (2)

31-35: ⚠️ Potential issue

Potential NPE when the expected fragment is not active

getCurrentFragment() can return null; the comment even acknowledges the crash potential, yet the call to
getCurrentFragment().handleFinishedPinActivity(...) is unconditional.

-            getCurrentFragment().handleFinishedPinActivity(requestCode, resultCode, data);
+            PersonalIdBiometricConfigFragment frag = getCurrentFragment();
+            if (frag != null) {
+                frag.handleFinishedPinActivity(requestCode, resultCode, data);
+            }

This removes the crash risk without changing behaviour.


66-74: ⚠️ Potential issue

Illegal switch syntax – will not compile

case NotIntroduced, Registering: is only legal with the arrow (->) switch expression syntax (Java 14+).
With a colon switch statement you must repeat the case token:

-        switch (PersonalIdManager.getInstance().getStatus()) {
-            case NotIntroduced, Registering:
+        switch (PersonalIdManager.getInstance().getStatus()) {
+            case NotIntroduced:
+            case Registering:

Without this fix the class fails to build.

🧹 Nitpick comments (1)
app/src/org/commcare/activities/connect/PersonalIdActivity.java (1)

25-26: beginRegistration() invocation happens before navController is guaranteed to be ready

beginRegistration() eventually calls navController.navigate(), but navController is initialised by NavigationHostCommCareActivity after setContentView() in its own onCreate().
Because beginRegistration() is executed immediately after super.onCreate(savedInstanceState) we are safe only if the base-class initialises navController synchronously inside its onCreate() before control returns here.
If that implicit ordering ever changes, this will throw an NPE at app start-up.

Consider defensive-guarding or moving the call into onPostCreate().

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between c8ca1db and 9c85669.

📒 Files selected for processing (5)
  • app/src/org/commcare/activities/StandardHomeActivity.java (0 hunks)
  • app/src/org/commcare/activities/StandardHomeActivityUIController.java (0 hunks)
  • app/src/org/commcare/activities/connect/PersonalIdActivity.java (1 hunks)
  • app/src/org/commcare/android/database/connect/models/ConnectUserRecord.java (1 hunks)
  • app/src/org/commcare/connect/PersonalIdManager.java (0 hunks)
💤 Files with no reviewable changes (3)
  • app/src/org/commcare/activities/StandardHomeActivity.java
  • app/src/org/commcare/activities/StandardHomeActivityUIController.java
  • app/src/org/commcare/connect/PersonalIdManager.java

Comment on lines +58 to 69
/**
* @Deprecated should no longer be used, just here to avoid a db migration for the moment
*/
private boolean secondaryPhoneVerified;

@Persisting(12)
@MetaField(META_VERIFY_SECONDARY_PHONE_DATE)
@Deprecated
/**
* @Deprecated should no longer be used, just here to avoid a db migration for the moment
*/
private Date verifySecondaryPhoneByDate;
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Stale persisted columns still actively written

The deprecated fields remain persisted and are still assigned in:

  • default constructor (secondaryPhoneVerified = true, verifySecondaryPhoneByDate = new Date();)
  • fromV14() migration method.

If the intent is to freeze these columns, continuing to mutate them is misleading and bloats the on-disk diff set.
Either:

  1. Stop writing to them (simplest), or
  2. Remove them entirely and bump the DB version.

At minimum, add a comment explaining why they are still written while considered deprecated.

🤖 Prompt for AI Agents
In app/src/org/commcare/android/database/connect/models/ConnectUserRecord.java
around lines 58 to 69, the deprecated persisted fields secondaryPhoneVerified
and verifySecondaryPhoneByDate are still being assigned values in the default
constructor and fromV14() migration method, which is misleading and bloats the
on-disk diff. To fix this, stop assigning values to these deprecated fields in
the constructor and migration method if you want to freeze them, or
alternatively remove these fields entirely and increment the database version.
If you choose to keep writing to them temporarily, add a clear comment
explaining why they are still assigned despite being deprecated.

Copy link
Contributor

@pm-dimagi pm-dimagi left a comment

Choose a reason for hiding this comment

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

we can also clean the corresponding xml of standardHomeActivity

super.onCreate(savedInstanceState);
handleRedirection(getIntent());
updateBackButton();
beginRegistration();
Copy link
Contributor

Choose a reason for hiding this comment

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

@shubham1g5 Can we remove beginRegistration method also? Already app:startDestination="@id/personalid_phone_fragment" in nav graph.

@shubham1g5 shubham1g5 merged commit 31b6fda into commcare_2.57 Jun 12, 2025
1 of 2 checks passed
@shubham1g5 shubham1g5 deleted the codeCleanUpAndFixes branch June 12, 2025 07:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip-integration-tests Skip android tests.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants