-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #50629 from wildan-m/wildan/fix/48715-long-loading…
…-2nd-attempt (2nd) Fix long loading from public and redirect to last accessed report
- Loading branch information
Showing
7 changed files
with
81 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import getCurrentUrl from './currentUrl'; | ||
|
||
export default function shouldOpenOnAdminRoom() { | ||
const url = getCurrentUrl(); | ||
return url ? new URL(url).searchParams.get('openOnAdminRoom') === 'true' : false; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import ROUTES from '@src/ROUTES'; | ||
import * as Report from './actions/Report'; | ||
import Navigation from './Navigation/Navigation'; | ||
import shouldOpenOnAdminRoom from './Navigation/shouldOpenOnAdminRoom'; | ||
import * as ReportUtils from './ReportUtils'; | ||
|
||
const navigateAfterOnboarding = ( | ||
isSmallScreenWidth: boolean, | ||
shouldUseNarrowLayout: boolean, | ||
canUseDefaultRooms: boolean | undefined, | ||
onboardingPolicyID?: string, | ||
activeWorkspaceID?: string, | ||
backTo?: string, | ||
) => { | ||
Navigation.dismissModal(); | ||
|
||
// When hasCompletedGuidedSetupFlow is true, OnboardingModalNavigator in AuthScreen is removed from the navigation stack. | ||
// On small screens, this removal redirects navigation to HOME. Dismissing the modal doesn't work properly, | ||
// so we need to specifically navigate to the last accessed report. | ||
if (!isSmallScreenWidth) { | ||
return; | ||
} | ||
|
||
const lastAccessedReport = ReportUtils.findLastAccessedReport(!canUseDefaultRooms, shouldOpenOnAdminRoom(), activeWorkspaceID); | ||
const lastAccessedReportID = lastAccessedReport?.reportID; | ||
// we don't want to navigate to newly creaded workspace after onboarding completed. | ||
if (!lastAccessedReportID || lastAccessedReport.policyID === onboardingPolicyID) { | ||
// Only navigate to concierge chat when central pane is visible | ||
// Otherwise stay on the chats screen. | ||
if (!shouldUseNarrowLayout && !backTo) { | ||
Report.navigateToConciergeChat(); | ||
} | ||
return; | ||
} | ||
|
||
const lastAccessedReportRoute = ROUTES.REPORT_WITH_ID.getRoute(lastAccessedReportID ?? '-1'); | ||
Navigation.navigate(lastAccessedReportRoute); | ||
}; | ||
|
||
export default navigateAfterOnboarding; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters