@@ -110,12 +110,14 @@ void main() {
110
110
required String expectedTitle,
111
111
required String expectedTagComponent,
112
112
}) {
113
- final expectedTag = '${data .realmUri }|${data .userId }|$expectedTagComponent ' ;
113
+ final expectedGroupKey = '${data .realmUri }|${data .userId }' ;
114
+ final expectedTag = '$expectedGroupKey |$expectedTagComponent ' ;
114
115
final expectedId =
115
116
NotificationDisplayManager .notificationIdAsHashOf (expectedTag);
116
117
const expectedIntentFlags =
117
118
PendingIntentFlag .immutable | PendingIntentFlag .updateCurrent;
118
- check (testBinding.androidNotificationHost.takeNotifyCalls ()).single
119
+ final calls = testBinding.androidNotificationHost.takeNotifyCalls ();
120
+ check (calls[0 ])
119
121
..id.equals (expectedId)
120
122
..tag.equals (expectedTag)
121
123
..channelId.equals (NotificationChannelManager .kChannelId)
@@ -124,11 +126,31 @@ void main() {
124
126
..color.equals (kZulipBrandColor.value)
125
127
..smallIconResourceName.equals ('zulip_notification' )
126
128
..extras.isNull ()
129
+ ..groupKey.equals (expectedGroupKey)
130
+ ..isGroupSummary.isNull ()
131
+ ..inboxStyle.isNull ()
132
+ ..autoCancel.equals (true )
127
133
..contentIntent.which ((it) => it.isNotNull ()
128
134
..requestCode.equals (expectedId)
129
135
..flags.equals (expectedIntentFlags)
130
136
..intentPayload.equals (jsonEncode (data.toJson ()))
131
137
);
138
+ check (calls[1 ])
139
+ ..id.equals (NotificationDisplayManager .notificationIdAsHashOf (expectedGroupKey))
140
+ ..tag.equals (expectedGroupKey)
141
+ ..channelId.equals (NotificationChannelManager .kChannelId)
142
+ ..contentTitle.isNull ()
143
+ ..contentText.isNull ()
144
+ ..color.equals (kZulipBrandColor.value)
145
+ ..smallIconResourceName.equals ('zulip_notification' )
146
+ ..extras.isNull ()
147
+ ..groupKey.equals (expectedGroupKey)
148
+ ..isGroupSummary.equals (true )
149
+ ..inboxStyle.which ((it) => it.isNotNull ()
150
+ ..summaryText.equals (data.realmUri.toString ())
151
+ )
152
+ ..autoCancel.equals (true )
153
+ ..contentIntent.isNull ();
132
154
}
133
155
134
156
Future <void > checkNotifications (FakeAsync async , MessageFcmMessage data, {
@@ -157,7 +179,7 @@ void main() {
157
179
final stream = eg.stream ();
158
180
final message = eg.streamMessage (stream: stream);
159
181
await checkNotifications (async , messageFcmMessage (message, streamName: stream.name),
160
- expectedTitle: '${stream .name } > ${message .subject }' ,
182
+ expectedTitle: '# ${stream .name } > ${message .subject }' ,
161
183
expectedTagComponent: 'stream:${message .streamId }:${message .subject }' );
162
184
}));
163
185
@@ -166,7 +188,7 @@ void main() {
166
188
final stream = eg.stream ();
167
189
final message = eg.streamMessage (stream: stream);
168
190
await checkNotifications (async , messageFcmMessage (message, streamName: null ),
169
- expectedTitle: '(unknown stream) > ${message .subject }' ,
191
+ expectedTitle: '# (unknown stream) > ${message .subject }' ,
170
192
expectedTagComponent: 'stream:${message .streamId }:${message .subject }' );
171
193
}));
172
194
@@ -376,10 +398,18 @@ extension on Subject<AndroidNotificationHostApiNotifyCall> {
376
398
Subject <String ?> get contentTitle => has ((x) => x.contentTitle, 'contentTitle' );
377
399
Subject <Map <String ?, String ?>?> get extras => has ((x) => x.extras, 'extras' );
378
400
Subject <String ?> get smallIconResourceName => has ((x) => x.smallIconResourceName, 'smallIconResourceName' );
401
+ Subject <String ?> get groupKey => has ((x) => x.groupKey, 'groupKey' );
402
+ Subject <bool ?> get isGroupSummary => has ((x) => x.isGroupSummary, 'isGroupSummary' );
403
+ Subject <InboxStyle ?> get inboxStyle => has ((x) => x.inboxStyle, 'inboxStyle' );
404
+ Subject <bool ?> get autoCancel => has ((x) => x.autoCancel, 'autoCancel' );
379
405
}
380
406
381
407
extension on Subject <PendingIntent > {
382
408
Subject <int > get requestCode => has ((x) => x.requestCode, 'requestCode' );
383
409
Subject <String > get intentPayload => has ((x) => x.intentPayload, 'intentPayload' );
384
410
Subject <int > get flags => has ((x) => x.flags, 'flags' );
385
411
}
412
+
413
+ extension on Subject <InboxStyle > {
414
+ Subject <String > get summaryText => has ((x) => x.summaryText, 'summaryText' );
415
+ }
0 commit comments