@@ -346,15 +346,15 @@ void main() {
346
346
const expectedPendingIntentFlags = PendingIntentFlag .immutable;
347
347
const expectedIntentFlags = IntentFlag .activityClearTop | IntentFlag .activityNewTask;
348
348
final expectedSelfUserKey = '${data .realmUrl }|${data .userId }' ;
349
- final expectedIntentDataUrl = NotificationOpenPayload (
349
+ final expectedIntentDataUrl = NotificationNavigationData (
350
350
realmUrl: data.realmUrl,
351
351
userId: data.userId,
352
352
narrow: switch (data.recipient) {
353
353
FcmMessageChannelRecipient (: var streamId, : var topic) =>
354
354
TopicNarrow (streamId, topic),
355
355
FcmMessageDmRecipient (: var allRecipientIds) =>
356
356
DmNarrow (allRecipientIds: allRecipientIds, selfUserId: data.userId),
357
- }).buildUrl ();
357
+ }).buildAndroidNotificationUrl ();
358
358
359
359
final messageStyleMessagesChecks =
360
360
messageStyleMessages.mapIndexed ((i, messageData) {
@@ -1072,15 +1072,15 @@ void main() {
1072
1072
1073
1073
Future <void > openNotification (WidgetTester tester, Account account, Message message) async {
1074
1074
final data = messageFcmMessage (message, account: account);
1075
- final intentDataUrl = NotificationOpenPayload (
1075
+ final intentDataUrl = NotificationNavigationData (
1076
1076
realmUrl: data.realmUrl,
1077
1077
userId: data.userId,
1078
1078
narrow: switch (data.recipient) {
1079
1079
FcmMessageChannelRecipient (: var streamId, : var topic) =>
1080
1080
TopicNarrow (streamId, topic),
1081
1081
FcmMessageDmRecipient (: var allRecipientIds) =>
1082
1082
DmNarrow (allRecipientIds: allRecipientIds, selfUserId: data.userId),
1083
- }).buildUrl ();
1083
+ }).buildAndroidNotificationUrl ();
1084
1084
unawaited (
1085
1085
WidgetsBinding .instance.handlePushRoute (intentDataUrl.toString ()));
1086
1086
await tester.idle (); // let navigateForNotification find navigator
@@ -1198,19 +1198,19 @@ void main() {
1198
1198
testWidgets ('at app launch' , (tester) async {
1199
1199
addTearDown (testBinding.reset);
1200
1200
// Set up a value for `PlatformDispatcher.defaultRouteName` to return,
1201
- // for determining the intial route.
1201
+ // for determining the initial route.
1202
1202
final account = eg.selfAccount;
1203
1203
final message = eg.streamMessage ();
1204
1204
final data = messageFcmMessage (message, account: account);
1205
- final intentDataUrl = NotificationOpenPayload (
1205
+ final intentDataUrl = NotificationNavigationData (
1206
1206
realmUrl: data.realmUrl,
1207
1207
userId: data.userId,
1208
1208
narrow: switch (data.recipient) {
1209
1209
FcmMessageChannelRecipient (: var streamId, : var topic) =>
1210
1210
TopicNarrow (streamId, topic),
1211
1211
FcmMessageDmRecipient (: var allRecipientIds) =>
1212
1212
DmNarrow (allRecipientIds: allRecipientIds, selfUserId: data.userId),
1213
- }).buildUrl ();
1213
+ }).buildAndroidNotificationUrl ();
1214
1214
addTearDown (tester.binding.platformDispatcher.clearDefaultRouteNameTestValue);
1215
1215
tester.binding.platformDispatcher.defaultRouteNameTestValue = intentDataUrl.toString ();
1216
1216
@@ -1235,15 +1235,15 @@ void main() {
1235
1235
await testBinding.globalStore.add (accountA, eg.initialSnapshot ());
1236
1236
await testBinding.globalStore.add (accountB, eg.initialSnapshot ());
1237
1237
1238
- final intentDataUrl = NotificationOpenPayload (
1238
+ final intentDataUrl = NotificationNavigationData (
1239
1239
realmUrl: data.realmUrl,
1240
1240
userId: data.userId,
1241
1241
narrow: switch (data.recipient) {
1242
1242
FcmMessageChannelRecipient (: var streamId, : var topic) =>
1243
1243
TopicNarrow (streamId, topic),
1244
1244
FcmMessageDmRecipient (: var allRecipientIds) =>
1245
1245
DmNarrow (allRecipientIds: allRecipientIds, selfUserId: data.userId),
1246
- }).buildUrl ();
1246
+ }).buildAndroidNotificationUrl ();
1247
1247
addTearDown (tester.binding.platformDispatcher.clearDefaultRouteNameTestValue);
1248
1248
tester.binding.platformDispatcher.defaultRouteNameTestValue = intentDataUrl.toString ();
1249
1249
@@ -1256,39 +1256,39 @@ void main() {
1256
1256
});
1257
1257
});
1258
1258
1259
- group ('NotificationOpenPayload ' , () {
1259
+ group ('NotificationNavigationData ' , () {
1260
1260
test ('smoke round-trip' , () {
1261
1261
// DM narrow
1262
- var payload = NotificationOpenPayload (
1262
+ var payload = NotificationNavigationData (
1263
1263
realmUrl: Uri .parse ('http://chat.example' ),
1264
1264
userId: 1001 ,
1265
1265
narrow: DmNarrow (allRecipientIds: [1001 , 1002 ], selfUserId: 1001 ),
1266
1266
);
1267
- var url = payload.buildUrl ();
1268
- check (NotificationOpenPayload . parseUrl (url))
1267
+ var url = payload.buildAndroidNotificationUrl ();
1268
+ check (NotificationNavigationData . parseAndroidNotificationUrl (url))
1269
1269
..realmUrl.equals (payload.realmUrl)
1270
1270
..userId.equals (payload.userId)
1271
1271
..narrow.equals (payload.narrow);
1272
1272
1273
1273
// Topic narrow
1274
- payload = NotificationOpenPayload (
1274
+ payload = NotificationNavigationData (
1275
1275
realmUrl: Uri .parse ('http://chat.example' ),
1276
1276
userId: 1001 ,
1277
1277
narrow: eg.topicNarrow (1 , 'topic A' ),
1278
1278
);
1279
- url = payload.buildUrl ();
1280
- check (NotificationOpenPayload . parseUrl (url))
1279
+ url = payload.buildAndroidNotificationUrl ();
1280
+ check (NotificationNavigationData . parseAndroidNotificationUrl (url))
1281
1281
..realmUrl.equals (payload.realmUrl)
1282
1282
..userId.equals (payload.userId)
1283
1283
..narrow.equals (payload.narrow);
1284
1284
});
1285
1285
1286
1286
test ('buildUrl: smoke DM' , () {
1287
- final url = NotificationOpenPayload (
1287
+ final url = NotificationNavigationData (
1288
1288
realmUrl: Uri .parse ('http://chat.example' ),
1289
1289
userId: 1001 ,
1290
1290
narrow: DmNarrow (allRecipientIds: [1001 , 1002 ], selfUserId: 1001 ),
1291
- ).buildUrl ();
1291
+ ).buildAndroidNotificationUrl ();
1292
1292
check (url)
1293
1293
..scheme.equals ('zulip' )
1294
1294
..host.equals ('notification' )
@@ -1301,11 +1301,11 @@ void main() {
1301
1301
});
1302
1302
1303
1303
test ('buildUrl: smoke topic' , () {
1304
- final url = NotificationOpenPayload (
1304
+ final url = NotificationNavigationData (
1305
1305
realmUrl: Uri .parse ('http://chat.example' ),
1306
1306
userId: 1001 ,
1307
1307
narrow: eg.topicNarrow (1 , 'topic A' ),
1308
- ).buildUrl ();
1308
+ ).buildAndroidNotificationUrl ();
1309
1309
check (url)
1310
1310
..scheme.equals ('zulip' )
1311
1311
..host.equals ('notification' )
@@ -1328,7 +1328,7 @@ void main() {
1328
1328
'narrow_type' : 'dm' ,
1329
1329
'all_recipient_ids' : '1001,1002' ,
1330
1330
});
1331
- check (NotificationOpenPayload . parseUrl (url))
1331
+ check (NotificationNavigationData . parseAndroidNotificationUrl (url))
1332
1332
..realmUrl.equals (Uri .parse ('http://chat.example' ))
1333
1333
..userId.equals (1001 )
1334
1334
..narrow.which ((it) => it.isA <DmNarrow >()
@@ -1347,7 +1347,7 @@ void main() {
1347
1347
'channel_id' : '1' ,
1348
1348
'topic' : 'topic A' ,
1349
1349
});
1350
- check (NotificationOpenPayload . parseUrl (url))
1350
+ check (NotificationNavigationData . parseAndroidNotificationUrl (url))
1351
1351
..realmUrl.equals (Uri .parse ('http://chat.example' ))
1352
1352
..userId.equals (1001 )
1353
1353
..narrow.which ((it) => it.isA <TopicNarrow >()
@@ -1406,7 +1406,7 @@ void main() {
1406
1406
},
1407
1407
];
1408
1408
for (final params in testCases) {
1409
- check (() => NotificationOpenPayload . parseUrl (Uri (
1409
+ check (() => NotificationNavigationData . parseAndroidNotificationUrl (Uri (
1410
1410
scheme: 'zulip' ,
1411
1411
host: 'notification' ,
1412
1412
queryParameters: params,
@@ -1432,7 +1432,7 @@ void main() {
1432
1432
'channel_id' : '1' ,
1433
1433
'topic' : 'topic A' ,
1434
1434
});
1435
- check (() => NotificationOpenPayload . parseUrl (url))
1435
+ check (() => NotificationNavigationData . parseAndroidNotificationUrl (url))
1436
1436
.throws <FormatException >();
1437
1437
});
1438
1438
@@ -1447,7 +1447,7 @@ void main() {
1447
1447
'channel_id' : '1' ,
1448
1448
'topic' : 'topic A' ,
1449
1449
});
1450
- check (() => NotificationOpenPayload . parseUrl (url))
1450
+ check (() => NotificationNavigationData . parseAndroidNotificationUrl (url))
1451
1451
.throws <FormatException >();
1452
1452
});
1453
1453
});
@@ -1531,7 +1531,7 @@ extension on Subject<StatusBarNotification> {
1531
1531
Subject <String > get tag => has ((x) => x.tag, 'tag' );
1532
1532
}
1533
1533
1534
- extension on Subject <NotificationOpenPayload > {
1534
+ extension on Subject <NotificationNavigationData > {
1535
1535
Subject <Uri > get realmUrl => has ((x) => x.realmUrl, 'realmUrl' );
1536
1536
Subject <int > get userId => has ((x) => x.userId, 'userId' );
1537
1537
Subject <Narrow > get narrow => has ((x) => x.narrow, 'narrow' );
0 commit comments