Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CP Staging] Fix notification click through #31663

Merged
merged 1 commit into from
Nov 21, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NAB: I think this is redundant as it's promised in Navigation.waitForProtectedRoutes already.
But let's leave as is for now for safety.

.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});
}
});
});
}
Loading