Skip to content

Commit

Permalink
Merge pull request #31663 from Expensify/arosiclair-fix-notif-click-t…
Browse files Browse the repository at this point in the history
…hrough

[CP Staging] Fix notification click through

(cherry picked from commit 424bbfe)
  • Loading branch information
luacmartins authored and OSBotify committed Nov 21, 2023
1 parent 16ffa1f commit fa8d53b
Showing 1 changed file with 14 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,20 @@ export default function subscribeToReportCommentPushNotifications() {
}

Log.info('[PushNotification] onSelected() - called', false, {reportID, reportActionID});
Navigation.isNavigationReady().then(() => {
try {
// If a chat is visible other than the one we are trying to navigate to, then we need to navigate back
if (Navigation.getActiveRoute().slice(1, 2) === ROUTES.REPORT && !Navigation.isActiveRoute(`r/${reportID}`)) {
Navigation.goBack(ROUTES.HOME);
}
Navigation.isNavigationReady()
.then(Navigation.waitForProtectedRoutes)
.then(() => {
try {
// If a chat is visible other than the one we are trying to navigate to, then we need to navigate back
if (Navigation.getActiveRoute().slice(1, 2) === ROUTES.REPORT && !Navigation.isActiveRoute(`r/${reportID}`)) {
Navigation.goBack(ROUTES.HOME);
}

Log.info('[PushNotification] onSelected() - Navigation is ready. Navigating...', false, {reportID, reportActionID});
Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(reportID));
} catch (error) {
Log.alert('[PushNotification] onSelected() - failed', {reportID, reportActionID, error: error.message});
}
});
Log.info('[PushNotification] onSelected() - Navigation is ready. Navigating...', false, {reportID, reportActionID});
Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(reportID));
} catch (error) {
Log.alert('[PushNotification] onSelected() - failed', {reportID, reportActionID, error: error.message});
}
});
});
}

0 comments on commit fa8d53b

Please sign in to comment.