-
-
Notifications
You must be signed in to change notification settings - Fork 45
CCCT-1773 Tweak Message Card Banner Colors #3385
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CCCT-1773 Tweak Message Card Banner Colors #3385
Conversation
Fixed a non-English translation for the banner text.
Added logic to change banner colors to positive color scheme.
Refactored the updateConnectJobMessage function to be a bit more readable.
Refactored the updateConnectJobMessage function again to be a bit more readable.
Refactored function and variable names to reflect the fact that a card message is not always a warning or negative. Formatted code and optimized imports.
Refactored the updateCardMessage function to be a bit more readable.
…nto task/CCCT-1773-tweak-successful-learn-task-completion-banner-color
Tweaked the message text color and background color.
📝 WalkthroughWalkthroughThis PR refactors the Connect job delivery messaging system from warning-focused to a generic card message approach. It updates the Tigrinya language translation for a delivery readiness message, renames Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Possibly related PRs
Suggested labels
Suggested reviewers
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this 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
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
app/src/org/commcare/activities/StandardHomeActivityUIController.java (1)
154-157: RecyclerView can stay hidden after state change to DELIVERING.You only set GONE when not delivering/finished; there’s no else to restore VISIBLE when the job later becomes deliverable. Add an else branch.
RecyclerView recyclerView = viewJobCard.findViewById(R.id.rdDeliveryTypeList); if (job.getStatus() != STATUS_DELIVERING || job.isFinished()) { recyclerView.setVisibility(View.GONE); +} else { + recyclerView.setVisibility(View.VISIBLE); }
🧹 Nitpick comments (2)
app/src/org/commcare/activities/StandardHomeActivityUIController.java (2)
105-113: Redundant app-record fetch used only as a gate; align behavior with fragment.You fetch ConnectAppRecord solely to gate message rendering, but the record isn’t otherwise used. This performs an extra DB read and creates divergence from ConnectDeliveryProgressFragment (which doesn’t gate). Either:
- Gate explicitly on login/eligibility (e.g., PersonalIdManager) and document it, or
- Drop the gate and rely on job.getCardMessageText(...) being null when nothing should show.
Consider simplifying:
-String messageText = null; -String appId = CommCareApplication.instance().getCurrentApp().getUniqueId(); -ConnectAppRecord record = ConnectJobUtils.getAppRecord(activity, appId); -ConnectJobRecord job = activity.getActiveJob(); - -if (job != null && record != null) { - messageText = job.getCardMessageText(activity); -} +ConnectJobRecord job = activity.getActiveJob(); +String messageText = job != null ? job.getCardMessageText(activity) : null;If you keep the gate, please ensure it’s intentional and consistent with the fragment.
115-135: Guard against empty strings and consider extracting shared color logic.Use TextUtils.isEmpty to avoid rendering blank messages, and consider extracting the color-pick logic into a helper to reuse in fragments.
+import android.text.TextUtils; @@ - if (messageText != null) { + if (!TextUtils.isEmpty(messageText)) { @ColorInt int textColor; @ColorInt int backgroundColor; @@ connectMessageCard.setVisibility(View.VISIBLE); } else { connectMessageCard.setVisibility(View.GONE); }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
app/res/values-ti/strings.xml(1 hunks)app/src/org/commcare/activities/StandardHomeActivityUIController.java(2 hunks)app/src/org/commcare/android/database/connect/models/ConnectJobRecord.java(9 hunks)app/src/org/commcare/fragments/connect/ConnectDeliveryProgressFragment.java(6 hunks)
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2025-07-29T14:11:36.386Z
Learnt from: OrangeAndGreen
PR: dimagi/commcare-android#3248
File: app/src/org/commcare/fragments/connect/ConnectJobsListsFragment.java:0-0
Timestamp: 2025-07-29T14:11:36.386Z
Learning: In ConnectJobsListsFragment.java error handling for JSON parsing, if the JSONObject obj is null when passed to handleCorruptJob(), the team prefers to let the code crash rather than adding defensive null checks. This follows the fail-fast philosophy used throughout the Connect feature to catch programming errors immediately rather than masking them.
Applied to files:
app/src/org/commcare/android/database/connect/models/ConnectJobRecord.java
📚 Learning: 2025-05-08T11:08:18.530Z
Learnt from: shubham1g5
PR: dimagi/commcare-android#0
File: :0-0
Timestamp: 2025-05-08T11:08:18.530Z
Learning: PR #3048 "Phase 4 Connect PR" introduces a substantial feature called "Connect" to the CommCare Android app, which includes messaging, job management, delivery tracking, payment processing, authentication flows, and learning modules. It follows a modern architecture using Navigation Components with three navigation graphs, segregated business logic in Manager classes, and proper database persistence.
Applied to files:
app/src/org/commcare/fragments/connect/ConnectDeliveryProgressFragment.java
🧬 Code graph analysis (1)
app/src/org/commcare/activities/StandardHomeActivityUIController.java (2)
app/src/org/commcare/CommCareApplication.java (1)
CommCareApplication(157-1279)app/src/org/commcare/connect/database/ConnectJobUtils.java (1)
ConnectJobUtils(25-383)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Lint Code Base
🔇 Additional comments (2)
app/res/values-ti/strings.xml (1)
327-327: Verify translation intent and duplication with connect_progress_warning_not_started.The new Tigrinya for connect_progress_ready_for_transition_to_delivery looks positive, but connect_progress_warning_not_started (Line 326) currently shows identical text. These keys convey different states; they likely shouldn't be the same. Please confirm with localization and adjust if needed. Also ensure punctuation/spacing matches project conventions.
app/src/org/commcare/android/database/connect/models/ConnectJobRecord.java (1)
617-636: Verify old getWarningMessages() method has been fully migrated.The search returned no references to the old
getWarningMessages()method, which suggests the migration may be complete. However, this cannot be definitively confirmed through automated search. Please manually verify that:
- The old
getWarningMessages(Context)method has been removed or properly deprecated inConnectJobRecord.java- All call sites have been migrated to use the new
getCardMessageText(Context)method- No dynamic or reflection-based invocations remain
app/src/org/commcare/fragments/connect/ConnectDeliveryProgressFragment.java
Show resolved
Hide resolved
OrangeAndGreen
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks pretty good and thanks for also addressing some lint. One question to check on.
app/src/org/commcare/activities/StandardHomeActivityUIController.java
Outdated
Show resolved
Hide resolved
app/src/org/commcare/fragments/connect/ConnectDeliveryProgressFragment.java
Show resolved
Hide resolved
shubham1g5
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nothing blocking from me.
Moved repeated logic for grabbing colors out of a conditional.
Reverted any changes made to rearrange imports.
|
@damagatchi retest this please |
2 similar comments
|
@damagatchi retest this please |
|
@damagatchi retest this please |
|
@damagatchi retest this please |
…nto task/CCCT-1773-tweak-successful-learn-task-completion-banner-color
…-completion-banner-color
CCCT-1773
Product Description
I tweaked the message card colors in the event that the user is returning to a Learn app after successfully completing the associated assessment.
Technical Summary
The main issue here is that we perviously assumed that all messages to be displayed on the message card are warning messages or negative in a sense. So I refactored the code a bit to reflect the fact that the message card is not always a warning or negative.
Also, I noticed that we had an incorrect non-English translation for this particular message card - so I went ahead and updated that.
Safety Assurance
Safety story
I verified that both the text color and the background color of the message card were updated.
QA Plan
I think that it would be worth it for QA to test all paths/flows where this message card banner appears to ensure we are always displaying the correct color scheme (whether that be a positive color scheme or a negative color scheme).