Skip to content
Merged
Show file tree
Hide file tree
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
4 changes: 0 additions & 4 deletions src/ROUTES.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1938,10 +1938,6 @@ const ROUTES = {
getRoute: (backTo?: string) => getUrlWithBackToParam('change-workspace-educational', backTo),
},
TRAVEL_MY_TRIPS: 'travel',
TRAVEL_DOT_LINK_WEB_VIEW: {
route: 'travel-dot-link',
getRoute: (token: string, isTestAccount?: boolean) => `travel-dot-link?token=${token}&isTestAccount=${isTestAccount}` as const,
},
TRAVEL_TCS: {
route: 'travel/terms/:domain/accept',
getRoute: (domain: string, backTo?: string) => getUrlWithBackToParam(`travel/terms/${domain}/accept`, backTo),
Expand Down
1 change: 0 additions & 1 deletion src/SCREENS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ const SCREENS = {
DOMAIN_PERMISSION_INFO: 'Travel_DomainPermissionInfo',
PUBLIC_DOMAIN_ERROR: 'Travel_PublicDomainError',
WORKSPACE_ADDRESS: 'Travel_WorkspaceAddress',
TRAVEL_DOT_LINK_WEB_VIEW: 'Travel_DotLinkWebView',
},
SEARCH: {
ROOT: 'Search_Root',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ const MoneyRequestModalStackNavigator = createModalStackNavigator<MoneyRequestNa

const TravelModalStackNavigator = createModalStackNavigator<TravelNavigatorParamList>({
[SCREENS.TRAVEL.MY_TRIPS]: () => require<ReactComponentModule>('../../../../pages/Travel/MyTripsPage').default,
[SCREENS.TRAVEL.TRAVEL_DOT_LINK_WEB_VIEW]: () => require<ReactComponentModule>('../../../../pages/Travel/TravelDotLinkWebview').default,
[SCREENS.TRAVEL.TCS]: () => require<ReactComponentModule>('../../../../pages/Travel/TravelTerms').default,
[SCREENS.TRAVEL.UPGRADE]: () => require<ReactComponentModule>('../../../../pages/Travel/TravelUpgrade').default,
[SCREENS.TRAVEL.TRIP_SUMMARY]: () => require<ReactComponentModule>('../../../../pages/Travel/TripSummaryPage').default,
Expand Down
1 change: 0 additions & 1 deletion src/libs/Navigation/linkingConfig/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1489,7 +1489,6 @@ const config: LinkingOptions<RootNavigatorParamList>['config'] = {
[SCREENS.RIGHT_MODAL.TRAVEL]: {
screens: {
[SCREENS.TRAVEL.MY_TRIPS]: ROUTES.TRAVEL_MY_TRIPS,
[SCREENS.TRAVEL.TRAVEL_DOT_LINK_WEB_VIEW]: ROUTES.TRAVEL_DOT_LINK_WEB_VIEW.route,
[SCREENS.TRAVEL.UPGRADE]: ROUTES.TRAVEL_UPGRADE.route,
[SCREENS.TRAVEL.TCS]: ROUTES.TRAVEL_TCS.route,
[SCREENS.TRAVEL.TRIP_SUMMARY]: ROUTES.TRAVEL_TRIP_SUMMARY.route,
Expand Down
4 changes: 0 additions & 4 deletions src/libs/Navigation/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1718,10 +1718,6 @@ type RightModalNavigatorParamList = {

type TravelNavigatorParamList = {
[SCREENS.TRAVEL.MY_TRIPS]: undefined;
[SCREENS.TRAVEL.TRAVEL_DOT_LINK_WEB_VIEW]: {
token: string;
isTestAccount?: boolean;
};
[SCREENS.TRAVEL.TRIP_SUMMARY]: {
reportID: string;
transactionID: string;
Expand Down
31 changes: 1 addition & 30 deletions src/libs/actions/Link.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@
import {canAnonymousUserAccessRoute, isAnonymousUser, signOutAndRedirectToSignIn} from './Session';

let isNetworkOffline = false;
Onyx.connect({

Check warning on line 18 in src/libs/actions/Link.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.NETWORK,
callback: (value) => (isNetworkOffline = value?.isOffline ?? false),
});

let currentUserEmail = '';
let currentUserAccountID: number = CONST.DEFAULT_NUMBER_ID;
Onyx.connect({

Check warning on line 25 in src/libs/actions/Link.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.SESSION,
callback: (value) => {
currentUserEmail = value?.email ?? '';
Expand Down Expand Up @@ -219,33 +219,4 @@
);
}

function getTravelDotLink(policyID: OnyxEntry<string>) {
if (policyID === null || policyID === undefined) {
return Promise.reject(new Error('Policy ID is required'));
}

const parameters: GenerateSpotnanaTokenParams = {
policyID,
};

// eslint-disable-next-line rulesdir/no-api-side-effects-method
return API.makeRequestWithSideEffects(SIDE_EFFECT_REQUEST_COMMANDS.GENERATE_SPOTNANA_TOKEN, parameters, {}).then((response) => {
if (!response?.spotnanaToken) {
throw new Error('Failed to generate spotnana token.');
}
return response;
});
}

export {
buildOldDotURL,
openOldDotLink,
openExternalLink,
openLink,
getInternalNewExpensifyPath,
getInternalExpensifyPath,
openTravelDotLink,
buildTravelDotURL,
openExternalLinkWithToken,
getTravelDotLink,
};
export {buildOldDotURL, openOldDotLink, openExternalLink, openLink, getInternalNewExpensifyPath, getInternalExpensifyPath, openTravelDotLink, buildTravelDotURL, openExternalLinkWithToken};
20 changes: 0 additions & 20 deletions src/libs/openTravelDotLink/index.native.ts

This file was deleted.

13 changes: 0 additions & 13 deletions src/libs/openTravelDotLink/index.ts

This file was deleted.

41 changes: 0 additions & 41 deletions src/pages/Travel/TravelDotLinkWebview.tsx

This file was deleted.

13 changes: 8 additions & 5 deletions src/pages/home/sidebar/FloatingActionButtonAndPopover.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import useTheme from '@hooks/useTheme';
import useThemeStyles from '@hooks/useThemeStyles';
import useWindowDimensions from '@hooks/useWindowDimensions';
import {startMoneyRequest} from '@libs/actions/IOU';
import {openOldDotLink} from '@libs/actions/Link';
import {openOldDotLink, openTravelDotLink} from '@libs/actions/Link';
import {navigateToQuickAction} from '@libs/actions/QuickActionNavigation';
import {createNewReport, startNewChat} from '@libs/actions/Report';
import {isAnonymousUser} from '@libs/actions/Session';
Expand All @@ -33,7 +33,6 @@ import interceptAnonymousUser from '@libs/interceptAnonymousUser';
import navigateAfterInteraction from '@libs/Navigation/navigateAfterInteraction';
import Navigation from '@libs/Navigation/Navigation';
import {hasSeenTourSelector} from '@libs/onboardingSelectors';
import openTravelDotLink from '@libs/openTravelDotLink';
import {
areAllGroupPoliciesExpenseChatDisabled,
canSendInvoice as canSendInvoicePolicyUtils,
Expand Down Expand Up @@ -390,10 +389,14 @@ function FloatingActionButtonAndPopover({onHideCreateMenu, onShowCreateMenu, isT

const openTravel = useCallback(() => {
if (isTravelEnabled) {
openTravelDotLink(activePolicy?.id);
return;
openTravelDotLink(activePolicy?.id)
?.then(() => {})
?.catch(() => {
Navigation.navigate(ROUTES.TRAVEL_MY_TRIPS);
});
} else {
Navigation.navigate(ROUTES.TRAVEL_MY_TRIPS);
}
Navigation.navigate(ROUTES.TRAVEL_MY_TRIPS);
}, [activePolicy, isTravelEnabled]);

const menuItems = [
Expand Down
Loading