-
-
Notifications
You must be signed in to change notification settings - Fork 45
Display message for no channels #3422
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
Conversation
📝 WalkthroughWalkthroughThis PR adds a "no channels" message feature to the messaging channel list UI. The changes include adding a new text view to the fragment layout, providing multi-language string translations for the message across ten language variants, and updating the fragment's refresh logic to conditionally display the message and hide the channel list RecyclerView when no channels are available. Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Areas requiring attention:
Possibly related PRs
Suggested reviewers
Pre-merge checks and finishing touches❌ Failed checks (2 warnings)
✅ Passed checks (1 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
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (11)
app/res/layout/fragment_channel_list.xml(2 hunks)app/res/values-es/strings.xml(1 hunks)app/res/values-fr/strings.xml(1 hunks)app/res/values-hi/strings.xml(1 hunks)app/res/values-lt/strings.xml(1 hunks)app/res/values-no/strings.xml(1 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/fragments/connectMessaging/ConnectMessageChannelListFragment.java(2 hunks)
🧰 Additional context used
🧠 Learnings (8)
📓 Common learnings
Learnt from: pm-dimagi
Repo: dimagi/commcare-android PR: 2956
File: app/src/org/commcare/fragments/connectMessaging/ConnectMessageChannelListFragment.java:58-60
Timestamp: 2025-02-19T15:15:01.935Z
Learning: Error handling for message retrieval in ConnectMessageChannelListFragment's retrieveMessages callback is not required as per user preference.
Learnt from: Jignesh-dimagi
Repo: dimagi/commcare-android PR: 0
File: :0-0
Timestamp: 2025-05-08T13:40:19.645Z
Learning: PR #3048 introduces a comprehensive messaging system in the Connect feature, implementing secure encryption using AES-GCM for message content, proper channel management with consent flows, and a well-designed UI separation between sent and received messages with real-time notification integration.
📚 Learning: 2025-05-22T14:32:53.133Z
Learnt from: OrangeAndGreen
Repo: dimagi/commcare-android PR: 3121
File: app/res/values-ti/strings.xml:350-350
Timestamp: 2025-05-22T14:32:53.133Z
Learning: PersonalID and Connect features haven't been translated to Spanish, Lithuanian, or Norwegian yet, so users with those language settings see the English strings by default.
Applied to files:
app/res/values-lt/strings.xmlapp/res/values-no/strings.xml
📚 Learning: 2025-02-19T15:15:01.935Z
Learnt from: pm-dimagi
Repo: dimagi/commcare-android PR: 2956
File: app/src/org/commcare/fragments/connectMessaging/ConnectMessageChannelListFragment.java:58-60
Timestamp: 2025-02-19T15:15:01.935Z
Learning: Error handling for message retrieval in ConnectMessageChannelListFragment's retrieveMessages callback is not required as per user preference.
Applied to files:
app/src/org/commcare/fragments/connectMessaging/ConnectMessageChannelListFragment.javaapp/res/layout/fragment_channel_list.xml
📚 Learning: 2025-05-09T10:57:41.073Z
Learnt from: Jignesh-dimagi
Repo: dimagi/commcare-android PR: 3093
File: app/res/navigation/nav_graph_connect_messaging.xml:41-45
Timestamp: 2025-05-09T10:57:41.073Z
Learning: In the CommCare Android codebase, the navigation graph for Connect messaging (`nav_graph_connect_messaging.xml`) intentionally uses `channel_id` as the argument name in the connectMessageFragment, despite using `channelId` in other parts of the same navigation graph. This naming difference is by design in the refactored code.
Applied to files:
app/src/org/commcare/fragments/connectMessaging/ConnectMessageChannelListFragment.javaapp/res/layout/fragment_channel_list.xml
📚 Learning: 2025-05-08T11:08:18.530Z
Learnt from: shubham1g5
Repo: dimagi/commcare-android PR: 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/connectMessaging/ConnectMessageChannelListFragment.javaapp/res/layout/fragment_channel_list.xml
📚 Learning: 2025-05-22T14:26:41.341Z
Learnt from: OrangeAndGreen
Repo: dimagi/commcare-android PR: 3121
File: app/src/org/commcare/fragments/SelectInstallModeFragment.java:201-205
Timestamp: 2025-05-22T14:26:41.341Z
Learning: In SelectInstallModeFragment.java, the showConnectErrorMessage method intentionally omits null checks because it's called at a specific point in the startup flow where UI is guaranteed to be loaded. It's designed to crash if activity or view is null to make potential issues immediately visible rather than hiding them with defensive programming.
Applied to files:
app/src/org/commcare/fragments/connectMessaging/ConnectMessageChannelListFragment.java
📚 Learning: 2025-05-22T14:28:35.959Z
Learnt from: OrangeAndGreen
Repo: dimagi/commcare-android PR: 3121
File: app/src/org/commcare/activities/CommCareSetupActivity.java:360-364
Timestamp: 2025-05-22T14:28:35.959Z
Learning: In CommCareSetupActivity.java, the call to installFragment.showConnectErrorMessage() after fragment transactions is intentionally unguarded with null checks. This follows the app's design pattern where critical error paths prefer immediate crashes over silent failures, making potential issues immediately visible during development rather than hiding them with defensive programming.
Applied to files:
app/res/layout/fragment_channel_list.xml
📚 Learning: 2025-07-29T14:14:07.954Z
Learnt from: OrangeAndGreen
Repo: dimagi/commcare-android PR: 3248
File: app/src/org/commcare/adapters/ConnectMessageAdapter.java:0-0
Timestamp: 2025-07-29T14:14:07.954Z
Learning: In the CommCare Android Connect messaging system (ConnectMessageAdapter.java), the team prefers to let getMessage() potentially return null and crash rather than adding defensive null checks. This follows the fail-fast philosophy used throughout the Connect feature to catch programming errors immediately during development.
Applied to files:
app/res/layout/fragment_channel_list.xml
⏰ 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 (12)
app/res/values-no/strings.xml (1)
124-124: LGTM (NO translation added).Reads naturally; matches intent.
app/res/values-es/strings.xml (1)
518-518: LGTM (ES translation added).Clear and consistent with other locales.
app/res/values/strings.xml (1)
694-694: LGTM (default string).Key name and copy look good.
app/src/org/commcare/fragments/connectMessaging/ConnectMessageChannelListFragment.java (1)
33-34: Use of static imports is fine.Improves readability for visibility toggles.
app/res/values-fr/strings.xml (1)
521-521: LGTM (FR translation added).Copy is correct and consistent.
app/res/values-ti/strings.xml (1)
509-509: LGTM (TI translation added).Key and placement are correct.
app/res/values-pt/strings.xml (1)
525-525: LGTM (PT translation added).Matches tone used elsewhere.
app/res/values-sw/strings.xml (1)
525-525: String resource correctly added. ✓The Swahili translation for the no-channel message is properly formatted and semantically appropriate.
app/res/values-lt/strings.xml (1)
124-124: Lithuanian translation correctly added. ✓String resource is properly formatted with appropriate translation for the no-channel message.
app/res/values-hi/strings.xml (1)
516-516: Hindi translation correctly added. ✓String resource is properly formatted with Devanagari script and appropriate translation.
app/res/layout/fragment_channel_list.xml (2)
1-7: Namespace declaration correctly added. ✓The
xmlns:appnamespace is properly declared and is necessary for the ConstraintLayout constraint attributes used by the new TextView.
16-27: TextView implementation is well-configured. ✓The new AppCompatTextView is properly set up:
- References the correct string resource (
@string/no_channel_msg)- Initial visibility is
gone—correct for conditional display- Constraint configuration centers the view in the parent layout
- Text size (20sp) and color are appropriately readable
| if (channels.size() > 0) { | ||
| channelAdapter.setChannels(channels); | ||
| } else { | ||
| binding.rvChannel.setVisibility(GONE); | ||
| binding.tvNoChannelMsg.setVisibility(VISIBLE); | ||
| } |
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.
Fix empty-state toggle: RecyclerView remains hidden when channels appear.
When list transitions from empty→non-empty, rvChannel isn’t made VISIBLE and tvNoChannelMsg isn’t hidden. Toggle both states in both branches.
Apply this diff:
- if (channels.size() > 0) {
- channelAdapter.setChannels(channels);
- } else {
- binding.rvChannel.setVisibility(GONE);
- binding.tvNoChannelMsg.setVisibility(VISIBLE);
- }
+ if (!channels.isEmpty()) {
+ channelAdapter.setChannels(channels);
+ binding.rvChannel.setVisibility(VISIBLE);
+ binding.tvNoChannelMsg.setVisibility(GONE);
+ } else {
+ binding.rvChannel.setVisibility(GONE);
+ binding.tvNoChannelMsg.setVisibility(VISIBLE);
+ }Optional: call refreshUi() once in onCreateView (or mirror the same visibility logic there) to set initial state when the app starts with zero channels.
🤖 Prompt for AI Agents
In
app/src/org/commcare/fragments/connectMessaging/ConnectMessageChannelListFragment.java
around lines 140 to 145, the empty-state branch only hides the RecyclerView but
the non-empty branch does not re-show it or hide the "no channels" message;
update both branches so when channels.size() > 0 you call
binding.rvChannel.setVisibility(VISIBLE) and
binding.tvNoChannelMsg.setVisibility(GONE), and when empty do the opposite
(rvChannel GONE, tvNoChannelMsg VISIBLE). Also ensure the same visibility logic
is invoked on initial load (call refreshUi() from onCreateView or duplicate the
toggle there) so the correct state is set when the fragment starts.
Technical Summary
https://dimagi.atlassian.net/browse/QA-8234
Display message for no channels.
Labels and Review