diff --git a/.changes/2482-chat-notification.md b/.changes/2482-chat-notification.md new file mode 100644 index 000000000000..84a67dfde3e1 --- /dev/null +++ b/.changes/2482-chat-notification.md @@ -0,0 +1 @@ +- [Fix] : Chat screen opening twice when tap on chat message notification issue is fixed now, \ No newline at end of file diff --git a/packages/acter_notifify/lib/push.dart b/packages/acter_notifify/lib/push.dart index 6178c3a2a78e..3a126fa5562c 100644 --- a/packages/acter_notifify/lib/push.dart +++ b/packages/acter_notifify/lib/push.dart @@ -22,18 +22,22 @@ Future initializePush({ }) async { try { // Handle notification launching app from terminated state - Push.instance.notificationTapWhichLaunchedAppFromTerminated.then((data) { - if (data != null) { - _log.info('Notification tap launched app from terminated state:\n' - 'RemoteMessage: $data \n'); - handleMessageTap(data); - } - }); - // Handle notification taps - Push.instance.onNotificationTap.listen((data) { - handleMessageTap(data); - }); + //ON ANDROID: PUSH NOTIFICATION TAP IS MANAGED BY LOCAL PUSH NOTIFICATION TAP EVENT + if (!Platform.isAndroid) { + Push.instance.notificationTapWhichLaunchedAppFromTerminated.then((data) { + if (data != null) { + _log.info('Notification tap launched app from terminated state:\n' + 'RemoteMessage: $data \n'); + handleMessageTap(data); + } + }); + + // Handle notification taps + Push.instance.onNotificationTap.listen((data) { + handleMessageTap(data); + }); + } // Handle push notifications Push.instance.addOnMessage((message) async { @@ -68,7 +72,7 @@ Future initializePush({ // FIXME: how to identify which clients are connected to this? _log.info('Just got a new FCM registration token: $token'); final clients = - currentClientsGen == null ? [] : await currentClientsGen(); + currentClientsGen == null ? [] : await currentClientsGen(); for (final client in clients) { final deviceId = client.deviceId().toString(); try { @@ -89,8 +93,7 @@ Future initializePush({ } } -Future _handlePushMessage( - RemoteMessage message, { +Future _handlePushMessage(RemoteMessage message, { bool background = false, ShouldShowCheck? shouldShowCheck, }) async { @@ -102,8 +105,7 @@ Future _handlePushMessage( background: background, shouldShowCheck: shouldShowCheck); } -Future setupPushNotificationsForDevice( - Client client, { +Future setupPushNotificationsForDevice(Client client, { required String appName, required String appIdPrefix, required String pushServerUrl,