@@ -111,24 +111,49 @@ void main() {
111
111
required String expectedTagComponent,
112
112
}) {
113
113
final expectedTag = '${data .realmUri }|${data .userId }|$expectedTagComponent ' ;
114
+ final expectedGroupKey = '${data .realmUri }|${data .userId }' ;
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
- ..id.equals (expectedId)
120
- ..tag.equals (expectedTag)
121
- ..channelId.equals (NotificationChannelManager .kChannelId)
122
- ..contentTitle.equals (expectedTitle)
123
- ..contentText.equals (data.content)
124
- ..color.equals (kZulipBrandColor.value)
125
- ..smallIconResourceName.equals ('zulip_notification' )
126
- ..extras.isNull ()
127
- ..contentIntent.which ((it) => it.isNotNull ()
128
- ..requestCode.equals (expectedId)
129
- ..flags.equals (expectedIntentFlags)
130
- ..intentPayload.equals (jsonEncode (data.toJson ()))
131
- );
119
+
120
+ check (testBinding.androidNotificationHost.takeNotifyCalls ())
121
+ ..length.equals (2 )
122
+ ..containsInOrder ([
123
+ (Subject <AndroidNotificationHostApiNotifyCall > it) => it
124
+ ..id.equals (expectedId)
125
+ ..tag.equals (expectedTag)
126
+ ..channelId.equals (NotificationChannelManager .kChannelId)
127
+ ..contentTitle.equals (expectedTitle)
128
+ ..contentText.equals (data.content)
129
+ ..color.equals (kZulipBrandColor.value)
130
+ ..smallIconResourceName.equals ('zulip_notification' )
131
+ ..extras.isNull ()
132
+ ..groupKey.equals (expectedGroupKey)
133
+ ..isGroupSummary.isNull ()
134
+ ..inboxStyle.isNull ()
135
+ ..autoCancel.isNull ()
136
+ ..contentIntent.which ((it) => it.isNotNull ()
137
+ ..requestCode.equals (expectedId)
138
+ ..flags.equals (expectedIntentFlags)
139
+ ..intentPayload.equals (jsonEncode (data.toJson ()))),
140
+ (Subject <AndroidNotificationHostApiNotifyCall > it) => it
141
+ ..id.equals (NotificationDisplayManager .notificationIdAsHashOf (expectedGroupKey))
142
+ ..tag.equals (expectedGroupKey)
143
+ ..channelId.equals (NotificationChannelManager .kChannelId)
144
+ ..contentTitle.isNull ()
145
+ ..contentText.isNull ()
146
+ ..color.equals (kZulipBrandColor.value)
147
+ ..smallIconResourceName.equals ('zulip_notification' )
148
+ ..extras.isNull ()
149
+ ..groupKey.equals (expectedGroupKey)
150
+ ..isGroupSummary.equals (true )
151
+ ..inboxStyle.which ((it) => it.isNotNull ()
152
+ ..summaryText.equals (data.realmUri.toString ())
153
+ )
154
+ ..autoCancel.equals (true )
155
+ ..contentIntent.isNull ()
156
+ ]);
132
157
}
133
158
134
159
Future <void > checkNotifications (FakeAsync async , MessageFcmMessage data, {
@@ -376,10 +401,18 @@ extension on Subject<AndroidNotificationHostApiNotifyCall> {
376
401
Subject <String ?> get contentTitle => has ((x) => x.contentTitle, 'contentTitle' );
377
402
Subject <Map <String ?, String ?>?> get extras => has ((x) => x.extras, 'extras' );
378
403
Subject <String ?> get smallIconResourceName => has ((x) => x.smallIconResourceName, 'smallIconResourceName' );
404
+ Subject <String ?> get groupKey => has ((x) => x.groupKey, 'groupKey' );
405
+ Subject <bool ?> get isGroupSummary => has ((x) => x.isGroupSummary, 'isGroupSummary' );
406
+ Subject <InboxStyle ?> get inboxStyle => has ((x) => x.inboxStyle, 'inboxStyle' );
407
+ Subject <bool ?> get autoCancel => has ((x) => x.autoCancel, 'autoCancel' );
379
408
}
380
409
381
410
extension on Subject <PendingIntent > {
382
411
Subject <int > get requestCode => has ((x) => x.requestCode, 'requestCode' );
383
412
Subject <String > get intentPayload => has ((x) => x.intentPayload, 'intentPayload' );
384
413
Subject <int > get flags => has ((x) => x.flags, 'flags' );
385
414
}
415
+
416
+ extension on Subject <InboxStyle > {
417
+ Subject <String > get summaryText => has ((x) => x.summaryText, 'summaryText' );
418
+ }
0 commit comments