Skip to content

Add ID confirmation dialog UI and improve project configuration - #254

Merged
amitsinghsutara merged 6 commits into
developfrom
AJ-651
May 26, 2026
Merged

Add ID confirmation dialog UI and improve project configuration#254
amitsinghsutara merged 6 commits into
developfrom
AJ-651

Conversation

@amitsinghsutara

@amitsinghsutara amitsinghsutara commented May 20, 2026

Copy link
Copy Markdown
Collaborator

Summary by CodeRabbit

  • New Features

    • Enhanced deep-link handling to process incoming links at startup and while running, including study enrollment parameters.
    • New ID confirmation dialog to set/confirm a user ID with localized prompts.
  • UI

    • New dialog and button visuals (rounded gradient backgrounds and styled input field).
    • Added user-facing strings for the confirmation flow.
  • Bug Fixes

    • More robust language parsing for deferred deep-links.

Review Change Stack

@amitsinghsutara
amitsinghsutara requested a review from dz4va May 20, 2026 15:52
@amitsinghsutara amitsinghsutara self-assigned this May 20, 2026
@coderabbitai

coderabbitai Bot commented May 20, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@amitsinghsutara, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 39 minutes and 12 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: d5df4ce3-fa5b-496e-bd8a-86bb98f5f870

📥 Commits

Reviewing files that changed from the base of the PR and between 17dfdfc and e8c949a.

📒 Files selected for processing (1)
  • app/src/main/AndroidManifest.xml
📝 Walkthrough

Walkthrough

MainActivity now routes startup and runtime deep-links through a unified handler that parses study parameters and, when present, shows a confirmation dialog to set a pseudo user ID and optional consent; UI state prevents conflicting popups while confirmation is active. New dialog layout, drawables, strings, and an App Links intent-filter were added.

Changes

ID Confirmation Deep-Link & Dialog Workflow

Layer / File(s) Summary
Intent handling, state, and dialog coordination
app/src/main/java/org/curiouslearning/container/MainActivity.java
Adds isHandlingIdConfirmation flag, routes startup intent via handleIncomingIntent(getIntent()), implements onNewIntent(Intent) to forward runtime intents, parses URI params (study_user_id, confirmation_message, study_consent, language), shows showConfirmIdDialog when appropriate, updates SharedPreferences (pseudoId, optional studyConsent) on confirm, logs cr_user_id_confirmed, triggers loadApps(selectedLanguage) or showLanguagePopup, and guards showLanguagePopup() to avoid UI conflicts. Also hardens Facebook deferred deep-link language capitalization against null/empty.
Confirmation dialog layout and styling; manifest and strings
app/src/main/res/layout/dialog_confirm_id.xml, app/src/main/res/drawable/bg_button_confirm.xml, app/src/main/res/drawable/bg_dialog.xml, app/src/main/res/drawable/bg_id_field.xml, app/src/main/AndroidManifest.xml, app/src/main/res/values/strings.xml
Adds dialog_confirm_id.xml with message, ID display and confirm button; three drawable resources for dialog, confirm button gradient, and ID field background; new string resources (confirm_id_message, confirm_id_placeholder, confirm_id_button_text, confirm_id_button_description); and an App Links VIEW intent-filter with android:autoVerify="true" for host curiousreader.curiouscontent.org.

Sequence Diagram

sequenceDiagram
  participant MainActivity
  participant handleIncomingIntent
  participant showConfirmIdDialog
  participant SharedPreferences
  participant AnalyticsUtils
  participant AppLoader
  MainActivity->>handleIncomingIntent: onCreate(getIntent()) / onNewIntent(intent)
  handleIncomingIntent->>handleIncomingIntent: parse study_user_id, study_consent, confirmation_message, language
  handleIncomingIntent->>showConfirmIdDialog: present confirmation UI when consent true & id provided
  showConfirmIdDialog->>SharedPreferences: save pseudoId (and studyConsent)
  showConfirmIdDialog->>AnalyticsUtils: log cr_user_id_confirmed
  showConfirmIdDialog->>AppLoader: loadApps(selectedLanguage) or call showLanguagePopup
  showConfirmIdDialog->>MainActivity: clear isHandlingIdConfirmation
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Suggested reviewers

  • dz4va
  • Rajesh1041

Poem

🐰 A link hops in beneath the moonlight,
A dialog blooms in rounded gradient light,
IDs settle into SharedPrefs' care,
Consent and analytics hum in the air,
A rabbit cheers: "Confirmed!" — then skips to bite a carrot.

🚥 Pre-merge checks | ✅ 4 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Tests & Lint & Coverage ⚠️ Warning No tests for new onNewIntent/handleIncomingIntent methods or ID dialog; no lint configuration or enforcement; no 70% coverage threshold exists or is enforced. Add tests for onNewIntent, handleIncomingIntent, ID confirmation dialog; configure Android lint; enforce 70% code coverage threshold in CI/CD pipeline.
✅ Passed checks (4 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 changes: adding an ID confirmation dialog UI and improving project configuration (deep-link handling and manifest updates).
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.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch AJ-651

Warning

Review ran into problems

🔥 Problems

Git: Failed to clone repository. Please run the @coderabbitai full review command to re-trigger a full review. If the issue persists, set path_filters to include or exclude specific files.


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.

@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.

Actionable comments posted: 4

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

Inline comments:
In `@app/src/main/java/org/curiouslearning/container/MainActivity.java`:
- Line 324: The log statement in MainActivity's handleIncomingIntent currently
prints the full deep-link URI (variable data) which may contain sensitive query
params like study_user_id and consent values; change the logging to avoid
exposing query/content by either logging only non-sensitive components (e.g.,
data.getScheme(), data.getHost(), data.getPath()) or by redacting/stripping the
query and fragment before logging (construct a sanitized Uri without query
parameters) and then use that sanitized value in the Log.d(TAG, ...) call
instead of the full data.toString().
- Around line 340-347: The isHandlingIdConfirmation flag is only cleared in the
confirm button listener causing it to stay true on dialog
dismiss/cancel/exception; update showConfirmIdDialog (or wherever the
AlertDialog/Dialog instance is built) to reset isHandlingIdConfirmation in an
OnDismissListener and an OnCancelListener attached to the dialog, and wrap
dialog creation/display in a try/catch that clears isHandlingIdConfirmation in
the catch block as well so every exit path (confirm, dismiss, cancel, exception)
resets the flag.
- Around line 355-358: The code reads language via
data.getQueryParameter("language") and immediately calls charAt(0)/substring(1)
to set selectedLanguage, which will throw if language is an empty string; change
the logic in the block that sets selectedLanguage to first check that language
is not null and not empty (e.g., language.length() > 0 or !language.isEmpty())
before accessing charAt(0)/substring(1), and if empty treat it as null or use a
safe default; apply the identical guard-and-fallback fix to the other identical
block that constructs selectedLanguage (the copy at the second occurrence).

In `@app/src/main/res/layout/dialog_confirm_id.xml`:
- Line 19: The dialog uses hardcoded strings and symbols which break
localization and accessibility; move the literal message, the placeholder ID
text, and the checkmark ("✔") into string resources (strings.xml) and reference
them via android:text="`@string/`..." in dialog_confirm_id.xml, and replace the
visual checkmark with a semantic confirm label (e.g., `@string/confirm`) or add
android:contentDescription referencing a string resource so screen readers get
meaningful text; update any TextView/Button attributes in dialog_confirm_id.xml
that currently contain the hardcoded text to use these new string resource
identifiers.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: f0a61cec-b195-4473-bf08-d840914b816c

📥 Commits

Reviewing files that changed from the base of the PR and between 67b7821 and 3c8ffc3.

📒 Files selected for processing (5)
  • app/src/main/java/org/curiouslearning/container/MainActivity.java
  • app/src/main/res/drawable/bg_button_confirm.xml
  • app/src/main/res/drawable/bg_dialog.xml
  • app/src/main/res/drawable/bg_id_field.xml
  • app/src/main/res/layout/dialog_confirm_id.xml

Comment thread app/src/main/java/org/curiouslearning/container/MainActivity.java Outdated
Comment thread app/src/main/java/org/curiouslearning/container/MainActivity.java
Comment thread app/src/main/java/org/curiouslearning/container/MainActivity.java Outdated
Comment thread app/src/main/res/layout/dialog_confirm_id.xml Outdated

@dz4va dz4va left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Let's also apply the Coderabbit suggestion fixes @amitsinghsutara

@amitsinghsutara

Copy link
Copy Markdown
Collaborator Author

Let's also apply the Coderabbit suggestion fixes @amitsinghsutara

Hey @dz4va ,
I have added the coderabbit suggestions 🙌

@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.

Actionable comments posted: 1

Caution

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

⚠️ Outside diff range comments (1)
app/src/main/java/org/curiouslearning/container/MainActivity.java (1)

355-365: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Avoid persisting or logging empty language values.

At Line 355 and Line 619 paths, an empty query value (?language=) is still treated as a value: it clears stored language, can trigger loadApps(""), and in the deferred flow can log a language_selected event with an empty language. Treat empty/blank as invalid and exit those branches without persisting or logging language selection.

Suggested fix
 // handleIncomingIntent(...)
 String language = data.getQueryParameter("language");
-if (language != null) {
-    if (language.length() > 0) {
+if (language != null && !language.trim().isEmpty()) {
+    if (language.length() > 0) {
         selectedLanguage = Character.toUpperCase(language.charAt(0))
                 + language.substring(1).toLowerCase();
-    } else {
-        selectedLanguage = "";
     }
     storeSelectLanguage(selectedLanguage);
     runOnUiThread(() -> {
         loadApps(selectedLanguage);
     });
+} else if (language != null) {
+    Log.w(TAG, "handleIncomingIntent: empty language ignored.");
 }
 // fetchFacebookDeferredData(...)
 validLanguage(language, "facebook", String.valueOf(deepLinkUri));
-String lang = "";
-if (language != null && language.length() > 0) {
+if (language == null || language.trim().isEmpty()) {
+    return; // validLanguage() already handles invalid language flow
+}
+String lang = "";
+if (language.length() > 0) {
     lang = Character.toUpperCase(language.charAt(0)) + language.substring(1).toLowerCase();
 }

Also applies to: 618-631

🤖 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/org/curiouslearning/container/MainActivity.java` around
lines 355 - 365, The code currently treats empty or blank language strings as
valid and persists/acts on them; modify the branches around selectedLanguage
handling (the block that calls storeSelectLanguage(selectedLanguage) and
runOnUiThread(() -> loadApps(selectedLanguage))) so you first trim the incoming
language, check if it's null or empty after trimming, and if so return/skip the
branch without calling storeSelectLanguage, loadApps, or emitting any
language_selected events; apply the same guard in the deferred/logging flow that
emits the language_selected event (ensure the event is only logged when the
trimmed selectedLanguage is non-empty).
🤖 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.

Inline comments:
In `@app/src/main/AndroidManifest.xml`:
- Around line 88-96: The intent-filter currently uses two separate <data>
elements which act as OR; replace them with a single <data> element that
includes both android:scheme="https" and
android:host="curiousreader.curiouscontent.org" so the filter only matches HTTPS
for that host (update the <intent-filter> block where the two <data> entries are
present and remove the standalone scheme-only and host-only <data> elements).

---

Outside diff comments:
In `@app/src/main/java/org/curiouslearning/container/MainActivity.java`:
- Around line 355-365: The code currently treats empty or blank language strings
as valid and persists/acts on them; modify the branches around selectedLanguage
handling (the block that calls storeSelectLanguage(selectedLanguage) and
runOnUiThread(() -> loadApps(selectedLanguage))) so you first trim the incoming
language, check if it's null or empty after trimming, and if so return/skip the
branch without calling storeSelectLanguage, loadApps, or emitting any
language_selected events; apply the same guard in the deferred/logging flow that
emits the language_selected event (ensure the event is only logged when the
trimmed selectedLanguage is non-empty).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: a0650c22-00b3-4351-8f7d-fef4448e8c6e

📥 Commits

Reviewing files that changed from the base of the PR and between 3c8ffc3 and 17dfdfc.

📒 Files selected for processing (4)
  • app/src/main/AndroidManifest.xml
  • app/src/main/java/org/curiouslearning/container/MainActivity.java
  • app/src/main/res/layout/dialog_confirm_id.xml
  • app/src/main/res/values/strings.xml

Comment thread app/src/main/AndroidManifest.xml
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.

2 participants