Skip to content
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

notif: Support messaging-style notifications #718

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

rajveermalviya
Copy link
Collaborator

@rajveermalviya rajveermalviya commented Jun 3, 2024

after.mp4

Fixes: #128

@rajveermalviya rajveermalviya force-pushed the messaging-style-notif branch 4 times, most recently from cbab765 to 042a89e Compare June 25, 2024 18:15
@rajveermalviya rajveermalviya marked this pull request as ready for review June 25, 2024 18:20

fun toPigeonPerson(person: androidx.core.app.Person): Person {
return Person(
null, // TODO: Serialize icon maybe using content URI, mData is not exposed.
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Currently, we don't return Person's IconData back when returning active notification (via getActiveNotificationMessagingStyleByTag) because we don't seem to have an API to get data bytes back.

Fortunately though it doesn't seem to be necessary because in my local testing, the avatar is correctly visibile even when same sender has multiple messages, which makes sense because here's what ends up happening:

MessagingStyle(
  user: Person('You')
  messages: [
    MessagingStyleMessage(content: '...',
      person: Person(key: id1, name: 'John', iconData: null)), // Old, got from active notif
    MessagingStyleMessage(content: '...',
      person: Person(key: id1, name: 'John', iconData: null)),  // Old, got from active notif
    MessagingStyleMessage(content: '...',
      person: Person(key: id1, name: 'John', iconData: [...])), // Latest message, newly added
  ],
  ...
)

So, Android seems to be okay with older messages not having iconData for a specific Person.

@rajveermalviya rajveermalviya added the buddy review GSoC buddy review needed. label Jun 25, 2024
Copy link
Collaborator

@Khader-1 Khader-1 left a comment

Choose a reason for hiding this comment

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

Thank you, @rajveermalviya! The code looks good to me. The manual test as well as the attached video demonstrate that the behavior described in the issue has been correctly addressed.

@Khader-1 Khader-1 added mentor review GSoC mentor review needed. and removed buddy review GSoC buddy review needed. labels Jun 26, 2024
@gnprice gnprice requested a review from sumanthvrao June 26, 2024 16:10
Use messaging style notifications to display messages with
sender's name and avatars, along with support for displaying
multiple messages from a specific topic by updating existing
notification from notifications panel.

See:
  https://developer.android.com/develop/ui/views/notifications/build-notification#messaging-style

This change is similar to existing implementation in zulip-mobile:
  https://github.com/zulip/zulip-mobile/blob/e352f563ecf2fa9b09b688d5a65b6bc89b0358bc/android/app/src/main/java/com/zulipmobile/notifications/NotificationUiManager.kt#L177-L309

Fixes: zulip#128
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mentor review GSoC mentor review needed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Inbox-style notifications, like on Android in zulip-mobile
3 participants