@@ -89,7 +89,7 @@ class NotificationDisplayManager {
8989 }
9090 }
9191
92- static void _onMessageFcmMessage (MessageFcmMessage data, Map <String , dynamic > dataJson) {
92+ static Future < void > _onMessageFcmMessage (MessageFcmMessage data, Map <String , dynamic > dataJson) async {
9393 assert (debugLog ('notif message content: ${data .content }' ));
9494 final zulipLocalizations = GlobalLocalizations .zulipLocalizations;
9595 final title = switch (data.recipient) {
@@ -103,13 +103,16 @@ class NotificationDisplayManager {
103103 FcmMessageDmRecipient () =>
104104 data.senderFullName,
105105 };
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 (
108110 // TODO the notification ID can be constant, instead of matching requestCode
109111 // (This is a legacy of `flutter_local_notifications`.)
110112 id: notificationIdAsHashOf (conversationKey),
111113 tag: conversationKey,
112114 channelId: NotificationChannelManager .kChannelId,
115+ groupKey: groupKey,
113116
114117 contentTitle: title,
115118 contentText: data.content,
@@ -139,6 +142,22 @@ class NotificationDisplayManager {
139142 // TODO this doesn't set the Intent flags we set in zulip-mobile; is that OK?
140143 // (This is a legacy of `flutter_local_notifications`.)
141144 ),
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 ,
142161 );
143162 }
144163
@@ -157,8 +176,7 @@ class NotificationDisplayManager {
157176 | ((bytes[3 ] & 0x7f ) << 24 );
158177 }
159178
160- static String _conversationKey (MessageFcmMessage data) {
161- final groupKey = _groupKey (data);
179+ static String _conversationKey (MessageFcmMessage data, String groupKey) {
162180 final conversation = switch (data.recipient) {
163181 FcmMessageStreamRecipient (: var streamId, : var topic) => 'stream:$streamId :$topic ' ,
164182 FcmMessageDmRecipient (: var allRecipientIds) => 'dm:${allRecipientIds .join (',' )}' ,
0 commit comments