From dab503d8c2fa94b8eecf15d12d075ff42933b756 Mon Sep 17 00:00:00 2001 From: Kushdeep Singh Date: Tue, 24 Dec 2024 18:51:31 +0530 Subject: [PATCH] DMAPP-135: Integrate chat notification - Fixed navigation issue triggered on notification press. --- src/contexts/NotificationContext.tsx | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/contexts/NotificationContext.tsx b/src/contexts/NotificationContext.tsx index 9672d1575..1a7550263 100644 --- a/src/contexts/NotificationContext.tsx +++ b/src/contexts/NotificationContext.tsx @@ -319,14 +319,17 @@ export const NotificationContextProvider = ({ threadhash: parsedDetails?.info?.threadhash, }); if (singleChatParams) { - if (getCurrentRouteName() === GLOBALS.SCREENS.SINGLE_CHAT) { - // If Single chat screen is already active then update params data + if ( + getCurrentRouteName() === GLOBALS.SCREENS.SINGLE_CHAT && + getCurrentRouteParams()?.chatId !== parsedDetails?.info?.chatId + ) { + // If Single/Group chat screen is already active with different chatId then update params data replaceRoute(GLOBALS.SCREENS.SINGLE_CHAT, singleChatParams); - setTempNotificationData(null); - } else { + } else if ( + getCurrentRouteName() !== GLOBALS.SCREENS.SINGLE_CHAT + ) { // Navigate to Single/Group chat screen navigate(GLOBALS.SCREENS.SINGLE_CHAT, singleChatParams); - setTempNotificationData(null); } } } else if ( @@ -339,6 +342,7 @@ export const NotificationContextProvider = ({ pkey, }); } + setTempNotificationData(null); } catch (error) { console.log('Notification Route ERROR', error); }