@@ -92,6 +92,22 @@ RemoveFcmMessage removeFcmMessage(List<Message> zulipMessages, {Account? account
92
92
}) as RemoveFcmMessage ;
93
93
}
94
94
95
+ Future <void > openNotification (WidgetTester tester, Account account, Message message) async {
96
+ final data = messageFcmMessage (message, account: account);
97
+ final intentDataUrl = NotificationOpenPayload (
98
+ realmUrl: data.realmUrl,
99
+ userId: data.userId,
100
+ narrow: switch (data.recipient) {
101
+ FcmMessageChannelRecipient (: var streamId, : var topic) =>
102
+ TopicNarrow (streamId, topic),
103
+ FcmMessageDmRecipient (: var allRecipientIds) =>
104
+ DmNarrow (allRecipientIds: allRecipientIds, selfUserId: data.userId),
105
+ }).buildUrl ();
106
+ unawaited (
107
+ WidgetsBinding .instance.handlePushRoute (intentDataUrl.toString ()));
108
+ await tester.idle (); // let navigateForNotification find navigator
109
+ }
110
+
95
111
void main () {
96
112
TestZulipBinding .ensureInitialized ();
97
113
final zulipLocalizations = GlobalLocalizations .zulipLocalizations;
@@ -958,22 +974,6 @@ void main() {
958
974
check (pushedRoutes).isEmpty ();
959
975
}
960
976
961
- Future <void > openNotification (WidgetTester tester, Account account, Message message) async {
962
- final data = messageFcmMessage (message, account: account);
963
- final intentDataUrl = NotificationOpenPayload (
964
- realmUrl: data.realmUrl,
965
- userId: data.userId,
966
- narrow: switch (data.recipient) {
967
- FcmMessageChannelRecipient (: var streamId, : var topic) =>
968
- TopicNarrow (streamId, topic),
969
- FcmMessageDmRecipient (: var allRecipientIds) =>
970
- DmNarrow (allRecipientIds: allRecipientIds, selfUserId: data.userId),
971
- }).buildUrl ();
972
- unawaited (
973
- WidgetsBinding .instance.handlePushRoute (intentDataUrl.toString ()));
974
- await tester.idle (); // let navigateForNotification find navigator
975
- }
976
-
977
977
void matchesNavigation (Subject <Route <void >> route, Account account, Message message) {
978
978
route.isA <MaterialAccountWidgetRoute >()
979
979
..accountId.equals (account.id)
0 commit comments