-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Unify hybrid & standalone deeplink navigation #64056
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
Changes from all commits
6cbb3d2
c432ca9
d54130c
888aec3
85c74a7
a900bcf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
| @@ -1,28 +1,12 @@ | ||||
| import {findFocusedRoute} from '@react-navigation/native'; | ||||
| import {Linking} from 'react-native'; | ||||
| import Navigation, {navigationRef} from '@navigation/Navigation'; | ||||
| import Navigation from '@navigation/Navigation'; | ||||
| import {openReportFromDeepLink} from '@userActions/Report'; | ||||
| import CONFIG from '@src/CONFIG'; | ||||
| import type {Route} from '@src/ROUTES'; | ||||
| import ROUTES from '@src/ROUTES'; | ||||
| import SCREENS from '@src/SCREENS'; | ||||
|
|
||||
| if (CONFIG.IS_HYBRID_APP) { | ||||
| Linking.addEventListener('url', (state) => { | ||||
| handleHybridUrlNavigation(state.url as Route); | ||||
| }); | ||||
| } | ||||
|
|
||||
| function handleHybridUrlNavigation(url: Route) { | ||||
| const parsedUrl = Navigation.parseHybridAppUrl(url); | ||||
|
|
||||
| Navigation.isNavigationReady().then(() => { | ||||
| if (parsedUrl.startsWith(`/${ROUTES.SHARE_ROOT}`)) { | ||||
| const focusRoute = findFocusedRoute(navigationRef.getRootState()); | ||||
| if (focusRoute?.name === SCREENS.SHARE.SHARE_DETAILS || focusRoute?.name === SCREENS.SHARE.SUBMIT_DETAILS) { | ||||
| Navigation.goBack(ROUTES.SHARE_ROOT); | ||||
| return; | ||||
| } | ||||
| } | ||||
| Navigation.navigate(parsedUrl); | ||||
| const parsedUrl = Navigation.parseHybridAppUrl(state.url as Route); | ||||
| openReportFromDeepLink(parsedUrl); | ||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This opens the URL after onboarding. The logic itself wasn't wrong, but it conflicted with the test drive modal, which also opens after onboarding. (See issue #65508) App/src/libs/actions/Report.ts Line 3453 in 139b41c
Fixed in PRs https://github.com/Expensify/Mobile-Expensify/pull/13613 and #65615.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @QichenZhu thanks for an update! I agree it wasn't perfect and that's why we created another PR to improve it. It was merged yesterday |
||||
| }); | ||||
| } | ||||
Uh oh!
There was an error while loading. Please reload this page.