Skip to content

Conversation

@OrangeAndGreen
Copy link
Contributor

@OrangeAndGreen OrangeAndGreen commented Feb 27, 2025

https://dimagi.atlassian.net/browse/CCCT-710

cross-request: dimagi/commcare-core#1455

Product Description

Changed messaging icon to be a chat bubble.
Drawing a red circle on the icon when there are unread messages or new channels.

New icons:
Picture2

Technical Summary

Replaced the existing drawables that used a bell icon.

Feature Flag

ConnectID Messaging

Safety Assurance

Safety story

Just a graphics change, should be pretty safe.

Automated test coverage

No automated tests for ConnectID yet.

QA Plan

Verify the new icon appears in the Connect home page, and includes a red dot when there are unread messages/channels.

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

Drawing a red circle on the icon when there are unread messages.
@coderabbitai
Copy link

coderabbitai bot commented Feb 27, 2025

📝 Walkthrough

Walkthrough

This pull request refactors and updates resources and notification handling related to messaging. Two drawable XML files (ic_connect_menu_notification.xml and ic_connect_menu_notification_none.xml) were removed, and two new ones (ic_connect_messaging_base.xml and ic_connect_messaging_unread.xml) were added to better represent messaging states. Menu XML files have been updated to reference the new messaging icons instead of the old notification icons. Additionally, new string resources for the messaging notification channel were introduced in multiple language files, with existing messaging notification titles updated to include bell emojis. In the Java code, a new constant and corresponding notification channel for messaging have been added to the notification manager, and the icon updating logic in ConnectActivity now uses these new resources based on message status. Finally, a utility method has been added in the Firebase messaging service to convert vector drawables to Bitmap, allowing for dynamic notification icon generation.

Sequence Diagram(s)

sequenceDiagram
    participant FMS as FirebaseMessagingService
    participant CF as CommCareFirebaseMessagingService
    participant NC as CommCareNoficationManager
    participant NM as NotificationManager

    FMS->>CF: Receive Push Message (with action type)
    alt Action is Messaging
        CF->>CF: Convert vector drawable to Bitmap
        CF->>NC: Select NOTIFICATION_CHANNEL_MESSAGING_ID and set priority to MAX
    else Default Notification
        CF->>NC: Select default notification channel and set high priority
    end
    CF->>NM: Build and send notification with selected channel and icon
    NM-->>CF: Notification displayed
Loading

Possibly related PRs

Suggested labels

product/invisible

Suggested reviewers

  • shubham1g5
  • pm-dimagi
✨ Finishing Touches
  • 📝 Generate Docstrings

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ 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.
    • Generate unit testing code for this file.
    • 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 generate unit testing code for this file.
    • @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 generate unit testing code.
    • @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.

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

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 15334bf and 4c0b6d7.

📒 Files selected for processing (12)
  • app/res/drawable/ic_connect_menu_notification.xml (0 hunks)
  • app/res/drawable/ic_connect_menu_notification_none.xml (0 hunks)
  • app/res/drawable/ic_connect_messaging_base.xml (1 hunks)
  • app/res/drawable/ic_connect_messaging_unread.xml (1 hunks)
  • app/res/menu/menu_connect.xml (1 hunks)
  • app/res/menu/menu_connect_messaging.xml (1 hunks)
  • app/res/values-pt/strings.xml (1 hunks)
  • app/res/values-ti/strings.xml (1 hunks)
  • app/res/values/strings.xml (2 hunks)
  • app/src/org/commcare/CommCareNoficationManager.java (2 hunks)
  • app/src/org/commcare/activities/connect/ConnectActivity.java (1 hunks)
  • app/src/org/commcare/services/CommCareFirebaseMessagingService.java (4 hunks)
💤 Files with no reviewable changes (2)
  • app/res/drawable/ic_connect_menu_notification_none.xml
  • app/res/drawable/ic_connect_menu_notification.xml
✅ Files skipped from review due to trivial changes (4)
  • app/res/drawable/ic_connect_messaging_unread.xml
  • app/res/menu/menu_connect.xml
  • app/res/drawable/ic_connect_messaging_base.xml
  • app/res/menu/menu_connect_messaging.xml
🔇 Additional comments (9)
app/src/org/commcare/activities/connect/ConnectActivity.java (1)

163-171: Icon resource changes look good.

The replacement of notification icons with dedicated messaging icons provides better context for the functionality, aligning with the PR objective to change from a bell icon to a chat bubble.

app/res/values-ti/strings.xml (1)

286-287: New localized strings for messaging notification channel added correctly.

The implementation adds proper Tigrinya translations for the messaging notification channel title and description, which is important for the full internationalization of the new messaging feature.

app/res/values-pt/strings.xml (1)

298-299: String resources properly added for messaging notification channel.

The new notification channel strings for Portuguese translation have been correctly implemented, aligning with the new messaging icon feature described in the PR objectives.

app/src/org/commcare/CommCareNoficationManager.java (2)

43-43: New messaging notification channel ID added.

This constant properly defines the channel ID for the new messaging notifications.


200-203: Notification channel created with highest priority.

The messaging notification channel is correctly configured with IMPORTANCE_MAX priority level, which is appropriate for immediate user attention to new messages.

app/src/org/commcare/services/CommCareFirebaseMessagingService.java (2)

102-111: Utility method added to convert vector drawables to bitmaps.

This method will enable dynamic generation of notification icons from vector drawables, supporting the new messaging icon feature.


214-222: Notification builder updated to use dynamic properties.

The notification builder has been correctly updated to use the dynamic notification channel and large icon based on the notification type.

app/res/values/strings.xml (2)

354-355: New string resources added for messaging notifications.

These strings properly define the title and description for the new messaging notification channel.


555-557: Bell emojis added to notification titles.

Adding bell emojis to the notification titles makes them more visually distinct and draws attention to these important alerts.

Comment on lines 123 to 134
String notificationChannel = CommCareNoficationManager.NOTIFICATION_CHANNEL_PUSH_NOTIFICATIONS_ID;
int priority = NotificationCompat.PRIORITY_HIGH;
Bitmap largeIcon = null;

if (hasCccAction(action)) {
FirebaseAnalyticsUtil.reportNotificationType(action);

if(action.equals(ConnectMessagingActivity.CCC_MESSAGE)) {
notificationChannel = CommCareNoficationManager.NOTIFICATION_CHANNEL_MESSAGING_ID;
priority = NotificationCompat.PRIORITY_MAX;
largeIcon = getBitmapFromVectorDrawable(this, R.drawable.commcare_actionbar_logo);

Copy link

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Notification properties set based on action type.

The code properly sets the notification channel and priority for messaging notifications, but there may be a minor inconsistency with the PR description.

The PR mentions changing to a chat bubble icon, but line 133 is using the CommCare action bar logo instead of a messaging-specific icon. Verify if this is intended or if the chat bubble should be used here as well.


🏁 Script executed:

#!/bin/bash
# Check if there are any drawable resources related to messaging icons
echo "Searching for messaging icon resources..."
find app/res -name "ic_connect_messaging*"

Length of output: 233


Update Notification Icon to Use Messaging-Specific Resource

  • The PR description indicates that notifications should use a chat bubble icon for messaging, yet the current code (line 133) still references the CommCare action bar logo.
  • The drawable resources search reveals available messaging icons (ic_connect_messaging_unread.xml and ic_connect_messaging_base.xml), which implies that one of these would be more appropriate.
  • Please verify which of these icons should be used and update the resource reference accordingly if the chat bubble icon was intended.

@shubham1g5
Copy link
Contributor

@OrangeAndGreen there is a bunch of common code between this and https://github.com/dimagi/commcare-android/pull/2966/files , think we should only be keeping the icon change in this PR and rest should form part of other part to keep it clean.

@OrangeAndGreen OrangeAndGreen changed the base branch from connect_qa to dv/notification_improvements March 3, 2025 13:36
@OrangeAndGreen
Copy link
Contributor Author

Ah, my mistake, I branched off of the branch for that other PR by mistake. I rebased this PR to that branch to isolate the changes for the icon. We'll be trying to get both of these merged pretty quickly for the next beta release.

@OrangeAndGreen OrangeAndGreen merged commit 44599a9 into dv/notification_improvements Mar 6, 2025
2 checks passed
@OrangeAndGreen OrangeAndGreen deleted the dv/messaging_icon branch March 6, 2025 15:59
@coderabbitai coderabbitai bot mentioned this pull request May 1, 2025
@coderabbitai coderabbitai bot mentioned this pull request Jun 24, 2025
@coderabbitai coderabbitai bot mentioned this pull request Jul 8, 2025
@coderabbitai coderabbitai bot mentioned this pull request Jul 23, 2025
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants