diff --git a/src/libs/actions/Session/index.ts b/src/libs/actions/Session/index.ts index e85fdc9d1531..de9d85917289 100644 --- a/src/libs/actions/Session/index.ts +++ b/src/libs/actions/Session/index.ts @@ -202,6 +202,11 @@ function signOutAndRedirectToSignIn(shouldResetToHome?: boolean, shouldStashSess Log.info('Redirecting to Sign In because signOut() was called'); hideContextMenu(false); if (!isAnonymousUser()) { + // In the HybridApp, we want the Old Dot to handle the sign out process + if (NativeModules.HybridAppModule) { + NativeModules.HybridAppModule.closeReactNativeApp(); + return; + } // We'll only call signOut if we're not stashing the session and this is not a supportal session, // otherwise we'll call the API to invalidate the autogenerated credentials used for infinite // session. diff --git a/src/pages/settings/InitialSettingsPage.tsx b/src/pages/settings/InitialSettingsPage.tsx index 8fa152d5c06a..564e595f745d 100755 --- a/src/pages/settings/InitialSettingsPage.tsx +++ b/src/pages/settings/InitialSettingsPage.tsx @@ -2,7 +2,7 @@ import {useRoute} from '@react-navigation/native'; import React, {useCallback, useContext, useEffect, useLayoutEffect, useMemo, useRef, useState} from 'react'; // eslint-disable-next-line no-restricted-imports import type {GestureResponderEvent, ScrollView as RNScrollView, ScrollViewProps, StyleProp, ViewStyle} from 'react-native'; -import {View} from 'react-native'; +import {NativeModules, View} from 'react-native'; import type {OnyxCollection, OnyxEntry} from 'react-native-onyx'; import {withOnyx} from 'react-native-onyx'; import type {ValueOf} from 'type-fest'; @@ -225,45 +225,46 @@ function InitialSettingsPage({session, userWallet, bankAccountList, fundList, wa */ const generalMenuItemsData: Menu = useMemo(() => { const signOutTranslationKey = Session.isSupportAuthToken() && Session.hasStashedSession() ? 'initialSettingsPage.restoreStashed' : 'initialSettingsPage.signOut'; + const commonItems: MenuData[] = [ + { + translationKey: 'initialSettingsPage.help', + icon: Expensicons.QuestionMark, + action: () => { + Link.openExternalLink(CONST.NEWHELP_URL); + }, + iconRight: Expensicons.NewWindow, + shouldShowRightIcon: true, + link: CONST.NEWHELP_URL, + }, + { + translationKey: 'initialSettingsPage.about', + icon: Expensicons.Info, + routeName: ROUTES.SETTINGS_ABOUT, + }, + { + translationKey: 'initialSettingsPage.aboutPage.troubleshoot', + icon: Expensicons.Lightbulb, + routeName: ROUTES.SETTINGS_TROUBLESHOOT, + }, + { + translationKey: 'sidebarScreen.saveTheWorld', + icon: Expensicons.Heart, + routeName: ROUTES.SETTINGS_SAVE_THE_WORLD, + }, + ]; + const signOutItem: MenuData = { + translationKey: signOutTranslationKey, + icon: Expensicons.Exit, + action: () => { + signOut(false); + }, + }; const defaultMenu: Menu = { sectionStyle: { ...styles.pt4, }, sectionTranslationKey: 'initialSettingsPage.general', - items: [ - { - translationKey: 'initialSettingsPage.help', - icon: Expensicons.QuestionMark, - action: () => { - Link.openExternalLink(CONST.NEWHELP_URL); - }, - iconRight: Expensicons.NewWindow, - shouldShowRightIcon: true, - link: CONST.NEWHELP_URL, - }, - { - translationKey: 'initialSettingsPage.about', - icon: Expensicons.Info, - routeName: ROUTES.SETTINGS_ABOUT, - }, - { - translationKey: 'initialSettingsPage.aboutPage.troubleshoot', - icon: Expensicons.Lightbulb, - routeName: ROUTES.SETTINGS_TROUBLESHOOT, - }, - { - translationKey: 'sidebarScreen.saveTheWorld', - icon: Expensicons.Heart, - routeName: ROUTES.SETTINGS_SAVE_THE_WORLD, - }, - { - translationKey: signOutTranslationKey, - icon: Expensicons.Exit, - action: () => { - signOut(false); - }, - }, - ], + items: NativeModules.HybridAppModule ? commonItems : [...commonItems, signOutItem], }; return defaultMenu;