-
Notifications
You must be signed in to change notification settings - Fork 113
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
base: main
Are you sure you want to change the base?
Conversation
0e3d32c
to
b61ad25
Compare
cbab765
to
042a89e
Compare
|
||
fun toPigeonPerson(person: androidx.core.app.Person): Person { | ||
return Person( | ||
null, // TODO: Serialize icon maybe using content URI, mData is not exposed. |
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.
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.
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.
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.
Add methods and types for creating messaging style notifications: https://developer.android.com/develop/ui/views/notifications/build-notification#messaging-style
042a89e
to
1998fb1
Compare
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
1998fb1
to
3285d57
Compare
after.mp4
Fixes: #128