@@ -89,7 +89,7 @@ class NotificationDisplayManager {
89
89
}
90
90
}
91
91
92
- static void _onMessageFcmMessage (MessageFcmMessage data, Map <String , dynamic > dataJson) {
92
+ static Future < void > _onMessageFcmMessage (MessageFcmMessage data, Map <String , dynamic > dataJson) async {
93
93
assert (debugLog ('notif message content: ${data .content }' ));
94
94
final zulipLocalizations = GlobalLocalizations .zulipLocalizations;
95
95
final title = switch (data.recipient) {
@@ -103,13 +103,16 @@ class NotificationDisplayManager {
103
103
FcmMessageDmRecipient () =>
104
104
data.senderFullName,
105
105
};
106
- final conversationKey = _conversationKey (data);
107
- ZulipBinding .instance.androidNotificationHost.notify (
106
+ final groupKey = _groupKey (data);
107
+ final conversationKey = _conversationKey (data, groupKey);
108
+
109
+ await ZulipBinding .instance.androidNotificationHost.notify (
108
110
// TODO the notification ID can be constant, instead of matching requestCode
109
111
// (This is a legacy of `flutter_local_notifications`.)
110
112
id: notificationIdAsHashOf (conversationKey),
111
113
tag: conversationKey,
112
114
channelId: NotificationChannelManager .kChannelId,
115
+ groupKey: groupKey,
113
116
114
117
contentTitle: title,
115
118
contentText: data.content,
@@ -139,6 +142,22 @@ class NotificationDisplayManager {
139
142
// TODO this doesn't set the Intent flags we set in zulip-mobile; is that OK?
140
143
// (This is a legacy of `flutter_local_notifications`.)
141
144
),
145
+ autoCancel: true ,
146
+ );
147
+
148
+ await ZulipBinding .instance.androidNotificationHost.notify (
149
+ id: notificationIdAsHashOf (groupKey),
150
+ channelId: NotificationChannelManager .kChannelId,
151
+ tag: groupKey,
152
+ groupKey: groupKey,
153
+ isGroupSummary: true ,
154
+ color: kZulipBrandColor.value,
155
+ // TODO vary notification icon for debug
156
+ smallIconResourceName: 'zulip_notification' , // This name must appear in keep.xml too: https://github.com/zulip/zulip-flutter/issues/528
157
+ inboxStyle: InboxStyle (
158
+ // TODO(#570) Show organization name, not URL
159
+ summaryText: data.realmUri.toString ()),
160
+ autoCancel: true ,
142
161
);
143
162
}
144
163
@@ -157,8 +176,7 @@ class NotificationDisplayManager {
157
176
| ((bytes[3 ] & 0x7f ) << 24 );
158
177
}
159
178
160
- static String _conversationKey (MessageFcmMessage data) {
161
- final groupKey = _groupKey (data);
179
+ static String _conversationKey (MessageFcmMessage data, String groupKey) {
162
180
final conversation = switch (data.recipient) {
163
181
FcmMessageStreamRecipient (: var streamId, : var topic) => 'stream:$streamId :$topic ' ,
164
182
FcmMessageDmRecipient (: var allRecipientIds) => 'dm:${allRecipientIds .join (',' )}' ,
0 commit comments