diff --git a/src/libs/Navigation/AppNavigator/AuthScreens.tsx b/src/libs/Navigation/AppNavigator/AuthScreens.tsx index abeae7e42701..daf4debb4041 100644 --- a/src/libs/Navigation/AppNavigator/AuthScreens.tsx +++ b/src/libs/Navigation/AppNavigator/AuthScreens.tsx @@ -15,6 +15,7 @@ import useOnboardingFlowRouter from '@hooks/useOnboardingFlow'; import {ReportIDsContextProvider} from '@hooks/useReportIDs'; import useResponsiveLayout from '@hooks/useResponsiveLayout'; import useTheme from '@hooks/useTheme'; +import {connect} from '@libs/actions/Delegate'; import setFullscreenVisibility from '@libs/actions/setFullscreenVisibility'; import {READ_COMMANDS} from '@libs/API/types'; import HttpUtils from '@libs/HttpUtils'; @@ -276,11 +277,14 @@ function AuthScreens({session, lastOpenedPublicRoomID, initialLastUpdateIDApplie PusherConnectionManager.init(); initializePusher(); + const url = new URL(currentUrl); + const delegatorEmail = url.searchParams.get('delegatorEmail') ?? ''; + // In Hybrid App we decide to call one of those method when booting ND and we don't want to duplicate calls if (!CONFIG.IS_HYBRID_APP) { // If we are on this screen then we are "logged in", but the user might not have "just logged in". They could be reopening the app // or returning from background. If so, we'll assume they have some app data already and we can call reconnectApp() instead of openApp(). - if (SessionUtils.didUserLogInDuringSession()) { + if (SessionUtils.didUserLogInDuringSession() || delegatorEmail) { App.openApp(); } else { Log.info('[AuthScreens] Sending ReconnectApp'); @@ -292,6 +296,10 @@ function AuthScreens({session, lastOpenedPublicRoomID, initialLastUpdateIDApplie App.setUpPoliciesAndNavigate(session); + if (delegatorEmail) { + connect(delegatorEmail, true); + } + App.redirectThirdPartyDesktopSignIn(); if (lastOpenedPublicRoomID) { diff --git a/src/libs/Navigation/types.ts b/src/libs/Navigation/types.ts index 5f3c43e6ec2b..70df546df230 100644 --- a/src/libs/Navigation/types.ts +++ b/src/libs/Navigation/types.ts @@ -1787,6 +1787,7 @@ type SharedScreensParamList = { exitTo?: Routes | HybridAppRoute; shouldForceLogin: string; domain?: Routes; + delegatorEmail?: string; }; [SCREENS.VALIDATE_LOGIN]: { accountID: string; diff --git a/src/libs/actions/Delegate.ts b/src/libs/actions/Delegate.ts index da6e60717c4a..1454c949fe67 100644 --- a/src/libs/actions/Delegate.ts +++ b/src/libs/actions/Delegate.ts @@ -75,8 +75,8 @@ const KEYS_TO_PRESERVE_DELEGATE_ACCESS = [ ONYXKEYS.IS_SIDEBAR_LOADED, ]; -function connect(email: string) { - if (!delegatedAccess?.delegators) { +function connect(email: string, isFromOldDot = false) { + if (!delegatedAccess?.delegators && !isFromOldDot) { return; } @@ -142,7 +142,7 @@ function connect(email: string) { Onyx.update(failureData); return; } - if (!activePolicyID) { + if (!activePolicyID && CONFIG.IS_HYBRID_APP) { Log.alert('[Delegate] Unable to access activePolicyID'); Onyx.update(failureData); return; @@ -159,7 +159,7 @@ function connect(email: string) { NetworkStore.setAuthToken(response?.restrictedToken ?? null); confirmReadyToOpenApp(); openApp().then(() => { - if (!CONFIG.IS_HYBRID_APP) { + if (!CONFIG.IS_HYBRID_APP || !policyID) { return; } HybridAppModule.switchAccount({ diff --git a/src/pages/settings/ExitSurvey/ExitSurveyBookCall.tsx b/src/pages/settings/ExitSurvey/ExitSurveyBookCall.tsx index 10085dd7a569..eb6f596d79ee 100644 --- a/src/pages/settings/ExitSurvey/ExitSurveyBookCall.tsx +++ b/src/pages/settings/ExitSurvey/ExitSurveyBookCall.tsx @@ -1,7 +1,6 @@ import React from 'react'; import {View} from 'react-native'; import Button from '@components/Button'; -import DelegateNoAccessWrapper from '@components/DelegateNoAccessWrapper'; import FixedFooter from '@components/FixedFooter'; import HeaderWithBackButton from '@components/HeaderWithBackButton'; import ScreenWrapper from '@components/ScreenWrapper'; @@ -10,7 +9,7 @@ import useLocalize from '@hooks/useLocalize'; import useNetwork from '@hooks/useNetwork'; import useThemeStyles from '@hooks/useThemeStyles'; import Navigation from '@navigation/Navigation'; -import * as Link from '@userActions/Link'; +import {openExternalLink} from '@userActions/Link'; import * as Expensicons from '@src/components/Icon/Expensicons'; import CONST from '@src/CONST'; import ROUTES from '@src/ROUTES'; @@ -23,60 +22,58 @@ function ExitSurveyBookCallPage() { return ( - - Navigation.goBack()} + Navigation.goBack()} + /> + + {isOffline && } + {!isOffline && ( + <> + {translate('exitSurvey.bookACallTitle')} + {translate('exitSurvey.bookACallTextTop')} + + {Object.values(CONST.EXIT_SURVEY.BENEFIT).map((value) => { + return ( + + + {translate(`exitSurvey.benefits.${value}`)} + + ); + })} + + {translate('exitSurvey.bookACallTextBottom')} + + )} + + +