-
-
Notifications
You must be signed in to change notification settings - Fork 45
Added messaging menu item to app home menu #3281
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
Logic for showing/hiding, choosing icon, and updating icon when message received. Extracted new common getMessagingIcon function.
📝 WalkthroughWalkthroughThis change introduces a messaging feature to the app's home screen. A new messaging menu item is added to the home menu XML, and Sequence Diagram(s)sequenceDiagram
participant User
participant StandardHomeActivity
participant MessageManager
participant ConnectNavHelper
participant LocalBroadcastManager
User->>StandardHomeActivity: App resumes
StandardHomeActivity->>MessageManager: getMessagingIcon(context)
MessageManager->>StandardHomeActivity: Returns icon (unread/read)
StandardHomeActivity->>LocalBroadcastManager: Register updateReceiver
LocalBroadcastManager-->>StandardHomeActivity: MESSAGING_UPDATE_BROADCAST
StandardHomeActivity->>MessageManager: getMessagingIcon(context)
MessageManager->>StandardHomeActivity: Returns updated icon
User->>StandardHomeActivity: Selects messaging menu item
StandardHomeActivity->>ConnectNavHelper: goToMessaging(this)
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~15 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Note ⚡️ Unit Test Generation is now available in beta!Learn more here, or try it out under "Finishing Touches" below. 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (4)
🧰 Additional context used🧠 Learnings (28)📓 Common learnings📚 Learning: in the commcare android codebase, the navigation graph for connect messaging (`nav_graph_connect_mes...Applied to files:
📚 Learning: pr #3048 "phase 4 connect pr" introduces a substantial feature called "connect" to the commcare andr...Applied to files:
📚 Learning: pr #3048 introduces a comprehensive messaging system in the connect feature, implementing secure enc...Applied to files:
📚 Learning: in the commcare android connect messaging system (connectmessageadapter.java), the team prefers to l...Applied to files:
📚 Learning: in commcaresetupactivity.java, the call to installfragment.showconnecterrormessage() after fragment ...Applied to files:
📚 Learning: error handling for message retrieval in connectmessagechannellistfragment's retrievemessages callbac...Applied to files:
📚 Learning: the commcare android app doesn't require backward compatibility for support library features like th...Applied to files:
📚 Learning: in the commcare android connect feature, the json object passed to `connectjobdeliveryflagrecord.fro...Applied to files:
📚 Learning: in the connect error handling flow of commcare android, error messages are shown once and then autom...Applied to files:
📚 Learning: the connectloginjoblistmodel class in app/src/org/commcare/models/connect/connectloginjoblistmodel.j...Applied to files:
📚 Learning: in connectunlockfragment.java, the user prefers to let getarguments() potentially throw nullpointere...Applied to files:
📚 Learning: in connectdownloadingfragment.java and similar connect-related code, the team prefers to let "should...Applied to files:
📚 Learning: in the commcare android connect messaging system, message retry logic is implemented at the messagem...Applied to files:
📚 Learning: in selectinstallmodefragment.java, the showconnecterrormessage method intentionally omits null check...Applied to files:
📚 Learning: in connectunlockfragment.java, opportunityid values are expected to always contain valid integer str...Applied to files:
📚 Learning: for drawables in the commcare android codebase, the preferred approach is to let consuming layouts e...Applied to files:
📚 Learning: the commcare android app uses minsdkversion 21 (android 5.0 lollipop), so api 21+ attributes like pa...Applied to files:
📚 Learning: for `personalidapihandler`, the team’s convention is to propagate `jsonexception` as an unchecked `r...Applied to files:
📚 Learning: the connectid api service methods should use map for request bodies and responsebody...Applied to files:
📚 Learning: direct jsonobject parsing is acceptable for handling user data responses in connectidpinfragment, as...Applied to files:
📚 Learning: in connectjobslistsfragment.java, the team intentionally uses different error handling strategies: j...Applied to files:
📚 Learning: in the connectid api service, map is intentionally used for request bodies and respo...Applied to files:
📚 Learning: in the commcare android connect messaging system (messagemanager.java), the error handling logic in ...Applied to files:
📚 Learning: in connectmessagingmessagerecord, decryption failures are expected in some scenarios and are handled...Applied to files:
📚 Learning: request codes used for startactivityforresult should be unique throughout the application, even if t...Applied to files:
📚 Learning: in the commcare android connect module, job.getlearnappinfo() and getlearnmodules() should never ret...Applied to files:
📚 Learning: in the commcare android codebase, use org.jetbrains.annotations.notnull for null-safety annotations....Applied to files:
🔇 Additional comments (11)
✨ Finishing Touches
🧪 Generate unit tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed 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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
…android into dv/app_home_messaging2
https://dimagi.atlassian.net/browse/CCCT-707
Reviving changes from this PR which was accidentally closed before
Product Description
Messaging icon shown at top of app home page when PersonalID is configured
Technical Summary
Adding the messaging menu option and handling
Demo videos showing various login scenarios (Login + Job list, Wifi + No Wifi):
Demo 1
Demo 2
Note about the different possible ways to learn about a new message:
PersonalID sends an FCM push notification to the mobile device when a new channel/message is ready. However, for various reasons that notification may be delayed or may never arrive. Some common delay is always expected as the notification travels through servers and across the internet, but other issues such as poor network connectivity, disabled push notifications for the app can also result in the notification not arriving as expected.
So in addition, there is also a retrieve_messages API call that mobile can make to PersonalID to retrieve the latest messages.
This means that while on a page that interacts with messaging (channel list, channel page, or any page that shows the messaging icon, there are two ways we can learn about new channels/messages:
Example 1:
A user is on the app home page with no unread messages (no red dot on messaging icon)
Then the device receives an FCM notification for a new received PersonalID message, so FirebaseMessagingUtil broadcasts and the home page automatically updates to show the red dot.
Example 2:
A user is on the app home page with no unread messages (no red dot on messaging icon)
They haven't received the FCM notification about a new message yet, but they refresh the page (in this case logout and back in for example), and the retrieve_messages API call learns about a new received PersonalID message, so the home page shows the red dot.
Feature Flag
PersonalID Messaging
Safety Assurance
Safety story
Tested by dev, requires QA.
Automated test coverage
None
QA Plan
Verify messaging icon does not show in app home when PersonalID is not configured
Verify messaging icon is shown in app home when PersonalID is configured
Verify clicking the messaging icon navigates to the channel list page
Verify that a red dot appears on the icon when unread messages are present