From ca5fe70350c44d525ed491b0ee66dfa219b35469 Mon Sep 17 00:00:00 2001 From: Jan Nowakowski Date: Thu, 9 Jan 2025 15:20:11 +0100 Subject: [PATCH 01/11] Prevent app from crash when putting app in background from ND --- .../setupCustomAndroidBackHandler/index.android.ts | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/libs/Navigation/setupCustomAndroidBackHandler/index.android.ts b/src/libs/Navigation/setupCustomAndroidBackHandler/index.android.ts index d31c3693d495..bdea8c157425 100644 --- a/src/libs/Navigation/setupCustomAndroidBackHandler/index.android.ts +++ b/src/libs/Navigation/setupCustomAndroidBackHandler/index.android.ts @@ -1,5 +1,5 @@ import {findFocusedRoute, StackActions} from '@react-navigation/native'; -import {BackHandler, NativeModules} from 'react-native'; +import {BackHandler} from 'react-native'; import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import getTopmostCentralPaneRoute from '@navigation/getTopmostCentralPaneRoute'; import navigationRef from '@navigation/navigationRef'; @@ -22,12 +22,6 @@ function setupCustomAndroidBackHandler() { return false; } - const isLastScreenOnStack = bottomTabRoutes.length === 1 && rootState?.routes?.length === 1; - - if (NativeModules.HybridAppModule && isLastScreenOnStack) { - NativeModules.HybridAppModule.exitApp(); - } - // Handle back press on the search page. // We need to pop two screens, from the central pane and from the bottom tab. if (bottomTabRoutes[bottomTabRoutes.length - 1].name === SCREENS.SEARCH.BOTTOM_TAB && focusedRoute?.name === SCREENS.SEARCH.CENTRAL_PANE) { From d725507b8226c8fdb9e2b306e326eabf40e957ce Mon Sep 17 00:00:00 2001 From: war-in Date: Fri, 10 Jan 2025 14:26:37 +0100 Subject: [PATCH 02/11] remove pendingIntent functionality & clean exitApp method --- src/types/modules/react-native.d.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/types/modules/react-native.d.ts b/src/types/modules/react-native.d.ts index cbe3f10cbae8..ae63bf77b2a0 100644 --- a/src/types/modules/react-native.d.ts +++ b/src/types/modules/react-native.d.ts @@ -9,7 +9,6 @@ type HybridAppModule = { closeReactNativeApp: (shouldSignOut: boolean, shouldSetNVP: boolean) => void; completeOnboarding: (status: boolean) => void; switchAccount: (newDotCurrentAccountEmail: string, authToken: string, policyID: string, accountID: string) => void; - exitApp: () => void; }; type RNTextInputResetModule = { From 27d708fce981ff838961e3a096946fc7f2c06fec Mon Sep 17 00:00:00 2001 From: Jan Nowakowski Date: Tue, 14 Jan 2025 12:37:38 +0100 Subject: [PATCH 03/11] Do not duplicate isNavigationReady call --- .../subscribePushNotification/index.ts | 56 +++++++++---------- 1 file changed, 27 insertions(+), 29 deletions(-) diff --git a/src/libs/Notification/PushNotification/subscribePushNotification/index.ts b/src/libs/Notification/PushNotification/subscribePushNotification/index.ts index 237a615b570a..59f1384c0ce9 100644 --- a/src/libs/Notification/PushNotification/subscribePushNotification/index.ts +++ b/src/libs/Notification/PushNotification/subscribePushNotification/index.ts @@ -116,37 +116,35 @@ function navigateToReport({reportID, reportActionID}: ReportActionPushNotificati const policyEmployeeAccountIDs = policyID ? getPolicyEmployeeAccountIDs(policyID) : []; const reportBelongsToWorkspace = policyID && !isEmptyObject(report) && doesReportBelongToWorkspace(report, policyEmployeeAccountIDs, policyID); - Navigation.isNavigationReady() - .then(Navigation.waitForProtectedRoutes) - .then(() => { - // The attachment modal remains open when navigating to the report so we need to close it - Modal.close(() => { - try { - // Get rid of the transition screen, if it is on the top of the stack - if (NativeModules.HybridAppModule && Navigation.getActiveRoute().includes(ROUTES.TRANSITION_BETWEEN_APPS)) { - Navigation.goBack(); - } - // If a chat is visible other than the one we are trying to navigate to, then we need to navigate back - if (Navigation.getActiveRoute().slice(1, 2) === ROUTES.REPORT && !Navigation.isActiveRoute(`r/${reportID}`)) { - Navigation.goBack(); - } - - Log.info('[PushNotification] onSelected() - Navigation is ready. Navigating...', false, {reportID, reportActionID}); - if (!reportBelongsToWorkspace) { - Navigation.navigateWithSwitchPolicyID({route: ROUTES.HOME}); - } - Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(String(reportID))); - updateLastVisitedPath(ROUTES.REPORT_WITH_ID.getRoute(String(reportID))); - } catch (error) { - let errorMessage = String(error); - if (error instanceof Error) { - errorMessage = error.message; - } - - Log.alert('[PushNotification] onSelected() - failed', {reportID, reportActionID, error: errorMessage}); + Navigation.waitForProtectedRoutes().then(() => { + // The attachment modal remains open when navigating to the report so we need to close it + Modal.close(() => { + try { + // Get rid of the transition screen, if it is on the top of the stack + if (NativeModules.HybridAppModule && Navigation.getActiveRoute().includes(ROUTES.TRANSITION_BETWEEN_APPS)) { + Navigation.goBack(); } - }); + // If a chat is visible other than the one we are trying to navigate to, then we need to navigate back + if (Navigation.getActiveRoute().slice(1, 2) === ROUTES.REPORT && !Navigation.isActiveRoute(`r/${reportID}`)) { + Navigation.goBack(); + } + + Log.info('[PushNotification] onSelected() - Navigation is ready. Navigating...', false, {reportID, reportActionID}); + if (!reportBelongsToWorkspace) { + Navigation.navigateWithSwitchPolicyID({route: ROUTES.HOME}); + } + Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(String(reportID))); + updateLastVisitedPath(ROUTES.REPORT_WITH_ID.getRoute(String(reportID))); + } catch (error) { + let errorMessage = String(error); + if (error instanceof Error) { + errorMessage = error.message; + } + + Log.alert('[PushNotification] onSelected() - failed', {reportID, reportActionID, error: errorMessage}); + } }); + }); return Promise.resolve(); } From 6a587df4566ce868f7cfea751ea14b90a7d96fee Mon Sep 17 00:00:00 2001 From: war-in Date: Mon, 20 Jan 2025 15:39:52 +0100 Subject: [PATCH 04/11] fix crashes (util they're fixed on main) --- .../reactnativebackgroundtask/ReactNativeBackgroundTaskModule.kt | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/background-task/android/src/main/java/com/expensify/reactnativebackgroundtask/ReactNativeBackgroundTaskModule.kt b/modules/background-task/android/src/main/java/com/expensify/reactnativebackgroundtask/ReactNativeBackgroundTaskModule.kt index 47e4196f37c1..a76c45c7a8b7 100644 --- a/modules/background-task/android/src/main/java/com/expensify/reactnativebackgroundtask/ReactNativeBackgroundTaskModule.kt +++ b/modules/background-task/android/src/main/java/com/expensify/reactnativebackgroundtask/ReactNativeBackgroundTaskModule.kt @@ -14,6 +14,7 @@ import android.content.IntentFilter import android.os.Build import android.os.PersistableBundle import android.util.Log +import androidx.core.content.ContextCompat class ReactNativeBackgroundTaskModule internal constructor(context: ReactApplicationContext) : ReactNativeBackgroundTaskSpec(context) { From 88c6c6782c07e5102c43651578a3241aa98b0706 Mon Sep 17 00:00:00 2001 From: war-in Date: Tue, 21 Jan 2025 18:12:03 +0100 Subject: [PATCH 05/11] fix status bar color when returning to OD --- src/pages/settings/InitialSettingsPage.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/pages/settings/InitialSettingsPage.tsx b/src/pages/settings/InitialSettingsPage.tsx index 13d0d1d74802..e5b269a7be6e 100755 --- a/src/pages/settings/InitialSettingsPage.tsx +++ b/src/pages/settings/InitialSettingsPage.tsx @@ -8,6 +8,7 @@ import type {ValueOf} from 'type-fest'; import AccountSwitcher from '@components/AccountSwitcher'; import AccountSwitcherSkeletonView from '@components/AccountSwitcherSkeletonView'; import ConfirmModal from '@components/ConfirmModal'; +import CustomStatusBarAndBackgroundContext from '@components/CustomStatusBarAndBackground/CustomStatusBarAndBackgroundContext'; import DelegateNoAccessModal from '@components/DelegateNoAccessModal'; import Icon from '@components/Icon'; import * as Expensicons from '@components/Icon/Expensicons'; @@ -100,6 +101,7 @@ function InitialSettingsPage({currentUserPersonalDetails}: InitialSettingsPagePr const emojiCode = currentUserPersonalDetails?.status?.emojiCode ?? ''; const [allConnectionSyncProgresses] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY_CONNECTION_SYNC_PROGRESS}`); const {setInitialURL} = useContext(InitialURLContext); + const {setRootStatusBarEnabled} = useContext(CustomStatusBarAndBackgroundContext); const [privateSubscription] = useOnyx(ONYXKEYS.NVP_PRIVATE_SUBSCRIPTION); const subscriptionPlan = useSubscriptionPlan(); @@ -243,6 +245,7 @@ function InitialSettingsPage({currentUserPersonalDetails}: InitialSettingsPagePr action: () => { NativeModules.HybridAppModule.closeReactNativeApp(false, true); setInitialURL(undefined); + setRootStatusBarEnabled(false); }, } : { @@ -285,7 +288,7 @@ function InitialSettingsPage({currentUserPersonalDetails}: InitialSettingsPagePr }, ], }; - }, [styles.pt4, signOut, setInitialURL, shouldOpenBookACall, isActingAsDelegate]); + }, [styles.pt4, setInitialURL, setRootStatusBarEnabled, isActingAsDelegate, shouldOpenBookACall, signOut]); /** * Retuns JSX.Element with menu items From cbe158d1f37d69b5975ebcb7a34a10f7a1a3f45e Mon Sep 17 00:00:00 2001 From: war-in Date: Wed, 22 Jan 2025 15:58:55 +0100 Subject: [PATCH 06/11] don't show bootsplash when app in background --- src/App.tsx | 5 +++-- src/Expensify.tsx | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index f9403e258af1..df50bb1d3988 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -46,6 +46,7 @@ import {SplashScreenStateContextProvider} from './SplashScreenStateContext'; type AppProps = { /** URL passed to our top-level React Native component by HybridApp. Will always be undefined in "pure" NewDot builds. */ url?: Route; + withoutBootsplash?: boolean; }; LogBox.ignoreLogs([ @@ -61,7 +62,7 @@ const fill = {flex: 1}; const StrictModeWrapper = CONFIG.USE_REACT_STRICT_MODE_IN_DEV ? React.StrictMode : ({children}: {children: React.ReactElement}) => children; -function App({url}: AppProps) { +function App({url, withoutBootsplash}: AppProps) { useDefaultDragAndDrop(); OnyxUpdateManager(); @@ -105,7 +106,7 @@ function App({url}: AppProps) { - + diff --git a/src/Expensify.tsx b/src/Expensify.tsx index 1d0100add00f..0e9643aa6f3b 100644 --- a/src/Expensify.tsx +++ b/src/Expensify.tsx @@ -76,7 +76,7 @@ type ExpensifyProps = { /** Last visited path in the app */ lastVisitedPath: OnyxEntry; }; -function Expensify() { +function Expensify({withoutBootsplash = false}) { const appStateChangeListener = useRef(null); const [isNavigationReady, setIsNavigationReady] = useState(false); const [isOnyxMigrated, setIsOnyxMigrated] = useState(false); @@ -294,7 +294,7 @@ function Expensify() { shouldShowRequire2FAModal={shouldShowRequire2FAModal} /> )} - {shouldHideSplash && } + {shouldHideSplash && !withoutBootsplash && } ); } From fd5f2948d7d9b2b83b2a41cabebe074ad26d01a0 Mon Sep 17 00:00:00 2001 From: war-in Date: Wed, 22 Jan 2025 16:19:40 +0100 Subject: [PATCH 07/11] rename new prop --- src/App.tsx | 10 ++++++---- src/Expensify.tsx | 4 ++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index df50bb1d3988..c8b3744d7a7b 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -43,10 +43,12 @@ import type {Route} from './ROUTES'; import './setup/backgroundTask'; import {SplashScreenStateContextProvider} from './SplashScreenStateContext'; +/** Values passed to our top-level React Native component by HybridApp. Will always be undefined in "pure" NewDot builds. */ type AppProps = { - /** URL passed to our top-level React Native component by HybridApp. Will always be undefined in "pure" NewDot builds. */ + /** URL containing all necessary data to run React Native app (e.g. login data) */ url?: Route; - withoutBootsplash?: boolean; + /** Specifies if the SplashScreenHider should be mounted */ + withBootsplash?: boolean; }; LogBox.ignoreLogs([ @@ -62,7 +64,7 @@ const fill = {flex: 1}; const StrictModeWrapper = CONFIG.USE_REACT_STRICT_MODE_IN_DEV ? React.StrictMode : ({children}: {children: React.ReactElement}) => children; -function App({url, withoutBootsplash}: AppProps) { +function App({url, withBootsplash}: AppProps) { useDefaultDragAndDrop(); OnyxUpdateManager(); @@ -106,7 +108,7 @@ function App({url, withoutBootsplash}: AppProps) { - + diff --git a/src/Expensify.tsx b/src/Expensify.tsx index 0e9643aa6f3b..cfca5c93c0ef 100644 --- a/src/Expensify.tsx +++ b/src/Expensify.tsx @@ -76,7 +76,7 @@ type ExpensifyProps = { /** Last visited path in the app */ lastVisitedPath: OnyxEntry; }; -function Expensify({withoutBootsplash = false}) { +function Expensify({withBootsplash = true}) { const appStateChangeListener = useRef(null); const [isNavigationReady, setIsNavigationReady] = useState(false); const [isOnyxMigrated, setIsOnyxMigrated] = useState(false); @@ -294,7 +294,7 @@ function Expensify({withoutBootsplash = false}) { shouldShowRequire2FAModal={shouldShowRequire2FAModal} /> )} - {shouldHideSplash && !withoutBootsplash && } + {shouldHideSplash && withBootsplash && } ); } From 8a183d30a52cb678b557917e3392c0bc2e1d013d Mon Sep 17 00:00:00 2001 From: war-in Date: Thu, 23 Jan 2025 12:51:42 +0100 Subject: [PATCH 08/11] revert bootsplash changes --- src/App.tsx | 6 ++---- src/Expensify.tsx | 4 ++-- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index c8b3744d7a7b..3513cb23953b 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -47,8 +47,6 @@ import {SplashScreenStateContextProvider} from './SplashScreenStateContext'; type AppProps = { /** URL containing all necessary data to run React Native app (e.g. login data) */ url?: Route; - /** Specifies if the SplashScreenHider should be mounted */ - withBootsplash?: boolean; }; LogBox.ignoreLogs([ @@ -64,7 +62,7 @@ const fill = {flex: 1}; const StrictModeWrapper = CONFIG.USE_REACT_STRICT_MODE_IN_DEV ? React.StrictMode : ({children}: {children: React.ReactElement}) => children; -function App({url, withBootsplash}: AppProps) { +function App({url}: AppProps) { useDefaultDragAndDrop(); OnyxUpdateManager(); @@ -108,7 +106,7 @@ function App({url, withBootsplash}: AppProps) { - + diff --git a/src/Expensify.tsx b/src/Expensify.tsx index cfca5c93c0ef..1d0100add00f 100644 --- a/src/Expensify.tsx +++ b/src/Expensify.tsx @@ -76,7 +76,7 @@ type ExpensifyProps = { /** Last visited path in the app */ lastVisitedPath: OnyxEntry; }; -function Expensify({withBootsplash = true}) { +function Expensify() { const appStateChangeListener = useRef(null); const [isNavigationReady, setIsNavigationReady] = useState(false); const [isOnyxMigrated, setIsOnyxMigrated] = useState(false); @@ -294,7 +294,7 @@ function Expensify({withBootsplash = true}) { shouldShowRequire2FAModal={shouldShowRequire2FAModal} /> )} - {shouldHideSplash && withBootsplash && } + {shouldHideSplash && } ); } From 0b1755b649659b117527eb575cc32964866e2fd8 Mon Sep 17 00:00:00 2001 From: war-in Date: Mon, 27 Jan 2025 17:05:18 +0100 Subject: [PATCH 09/11] fix status bar on travel page --- src/components/ScreenWrapper.tsx | 3 +++ src/libs/actions/Travel.ts | 8 +++++++- src/pages/OnboardingEmployees/BaseOnboardingEmployees.tsx | 5 ++++- src/pages/Search/EmptySearchView.tsx | 6 ++++-- src/pages/Travel/ManageTrips.tsx | 6 ++++-- 5 files changed, 22 insertions(+), 6 deletions(-) diff --git a/src/components/ScreenWrapper.tsx b/src/components/ScreenWrapper.tsx index b22b4eac3fc6..3bf199057205 100644 --- a/src/components/ScreenWrapper.tsx +++ b/src/components/ScreenWrapper.tsx @@ -5,6 +5,7 @@ import type {StyleProp, ViewStyle} from 'react-native'; import {Keyboard, NativeModules, PanResponder, View} from 'react-native'; import {PickerAvoidingView} from 'react-native-picker-select'; import type {EdgeInsets} from 'react-native-safe-area-context'; +import CustomStatusBarAndBackgroundContext from '@components/CustomStatusBarAndBackground/CustomStatusBarAndBackgroundContext'; import useEnvironment from '@hooks/useEnvironment'; import useInitialDimensions from '@hooks/useInitialWindowDimensions'; import useResponsiveLayout from '@hooks/useResponsiveLayout'; @@ -152,6 +153,7 @@ function ScreenWrapper( const {windowHeight} = useWindowDimensions(shouldUseCachedViewportHeight); // since Modals are drawn in separate native view hierarchy we should always add paddings const ignoreInsetsConsumption = !useContext(ModalContext).default; + const {setRootStatusBarEnabled} = useContext(CustomStatusBarAndBackgroundContext); // We need to use isSmallScreenWidth instead of shouldUseNarrowLayout for a case where we want to show the offline indicator only on small screens // eslint-disable-next-line rulesdir/prefer-shouldUseNarrowLayout-instead-of-isSmallScreenWidth @@ -171,6 +173,7 @@ function ScreenWrapper( UNSTABLE_usePreventRemove(shouldReturnToOldDot, () => { NativeModules.HybridAppModule?.closeReactNativeApp(false, false); + setRootStatusBarEnabled(false); }); const panResponder = useRef( diff --git a/src/libs/actions/Travel.ts b/src/libs/actions/Travel.ts index 1886885587c4..2aeb04b60f1b 100644 --- a/src/libs/actions/Travel.ts +++ b/src/libs/actions/Travel.ts @@ -114,7 +114,12 @@ function provisionDomain(domain: string) { Navigation.navigate(ROUTES.TRAVEL_TCS.getRoute(domain)); } -function bookATrip(translate: LocaleContextProps['translate'], setCtaErrorMessage: Dispatch>, ctaErrorMessage = ''): void { +function bookATrip( + translate: LocaleContextProps['translate'], + setCtaErrorMessage: Dispatch>, + setRootStatusBarEnabled: (isEnabled: boolean) => void, + ctaErrorMessage = '', +): void { if (!activePolicyID) { return; } @@ -138,6 +143,7 @@ function bookATrip(translate: LocaleContextProps['translate'], setCtaErrorMessag Log.info('[HybridApp] Returning to OldDot after opening TravelDot'); NativeModules.HybridAppModule.closeReactNativeApp(false, false); + setRootStatusBarEnabled(false); }) ?.catch(() => { setCtaErrorMessage(translate('travel.errorMessage')); diff --git a/src/pages/OnboardingEmployees/BaseOnboardingEmployees.tsx b/src/pages/OnboardingEmployees/BaseOnboardingEmployees.tsx index 12722e87f05a..56cf4041c9c3 100644 --- a/src/pages/OnboardingEmployees/BaseOnboardingEmployees.tsx +++ b/src/pages/OnboardingEmployees/BaseOnboardingEmployees.tsx @@ -1,7 +1,8 @@ -import React, {useMemo, useState} from 'react'; +import React, {useContext, useMemo, useState} from 'react'; import {NativeModules} from 'react-native'; import {useOnyx} from 'react-native-onyx'; import Button from '@components/Button'; +import CustomStatusBarAndBackgroundContext from '@components/CustomStatusBarAndBackground/CustomStatusBarAndBackgroundContext'; import FormHelpMessage from '@components/FormHelpMessage'; import HeaderWithBackButton from '@components/HeaderWithBackButton'; import ScreenWrapper from '@components/ScreenWrapper'; @@ -34,6 +35,7 @@ function BaseOnboardingEmployees({shouldUseNativeStyles, route}: BaseOnboardingE const [onboardingPolicyID] = useOnyx(ONYXKEYS.ONBOARDING_POLICY_ID); const [onboardingAdminsChatReportID] = useOnyx(ONYXKEYS.ONBOARDING_ADMINS_CHAT_REPORT_ID); const [allPolicies] = useOnyx(ONYXKEYS.COLLECTION.POLICY); + const {setRootStatusBarEnabled} = useContext(CustomStatusBarAndBackgroundContext); const paidGroupPolicy = Object.values(allPolicies ?? {}).find(PolicyUtils.isPaidGroupPolicy); @@ -106,6 +108,7 @@ function BaseOnboardingEmployees({shouldUseNativeStyles, route}: BaseOnboardingE } NativeModules.HybridAppModule.closeReactNativeApp(false, true); + setRootStatusBarEnabled(false); }} pressOnEnter /> diff --git a/src/pages/Search/EmptySearchView.tsx b/src/pages/Search/EmptySearchView.tsx index c27edc2e70e2..9b38157dfcbb 100644 --- a/src/pages/Search/EmptySearchView.tsx +++ b/src/pages/Search/EmptySearchView.tsx @@ -1,8 +1,9 @@ -import React, {useMemo, useState} from 'react'; +import React, {useContext, useMemo, useState} from 'react'; import {Linking, View} from 'react-native'; import {useOnyx} from 'react-native-onyx'; import type {OnyxCollection} from 'react-native-onyx'; import ConfirmModal from '@components/ConfirmModal'; +import CustomStatusBarAndBackgroundContext from '@components/CustomStatusBarAndBackground/CustomStatusBarAndBackgroundContext'; import DotIndicatorMessage from '@components/DotIndicatorMessage'; import EmptyStateComponent from '@components/EmptyStateComponent'; import type {FeatureListItem} from '@components/FeatureList'; @@ -60,6 +61,7 @@ function EmptySearchView({type, hasResults}: EmptySearchViewProps) { const shouldRedirectToExpensifyClassic = useMemo(() => { return areAllGroupPoliciesExpenseChatDisabled((allPolicies as OnyxCollection) ?? {}); }, [allPolicies]); + const {setRootStatusBarEnabled} = useContext(CustomStatusBarAndBackgroundContext); const [ctaErrorMessage, setCtaErrorMessage] = useState(''); @@ -133,7 +135,7 @@ function EmptySearchView({type, hasResults}: EmptySearchViewProps) { buttons: [ { buttonText: translate('search.searchResults.emptyTripResults.buttonText'), - buttonAction: () => bookATrip(translate, setCtaErrorMessage, ctaErrorMessage), + buttonAction: () => bookATrip(translate, setCtaErrorMessage, setRootStatusBarEnabled, ctaErrorMessage), success: true, }, ], diff --git a/src/pages/Travel/ManageTrips.tsx b/src/pages/Travel/ManageTrips.tsx index ac427d1d56c9..9a9b59b002c1 100644 --- a/src/pages/Travel/ManageTrips.tsx +++ b/src/pages/Travel/ManageTrips.tsx @@ -1,6 +1,7 @@ -import React, {useState} from 'react'; +import React, {useContext, useState} from 'react'; import {Linking, View} from 'react-native'; import {useOnyx} from 'react-native-onyx'; +import CustomStatusBarAndBackgroundContext from '@components/CustomStatusBarAndBackground/CustomStatusBarAndBackgroundContext'; import type {FeatureListItem} from '@components/FeatureList'; import FeatureList from '@components/FeatureList'; import FullScreenLoadingIndicator from '@components/FullscreenLoadingIndicator'; @@ -34,6 +35,7 @@ function ManageTrips() { const {translate} = useLocalize(); const [activePolicyID] = useOnyx(ONYXKEYS.NVP_ACTIVE_POLICY_ID); const policy = usePolicy(activePolicyID); + const {setRootStatusBarEnabled} = useContext(CustomStatusBarAndBackgroundContext); const [ctaErrorMessage, setCtaErrorMessage] = useState(''); @@ -55,7 +57,7 @@ function ManageTrips() { ctaText={translate('travel.bookTravel')} ctaAccessibilityLabel={translate('travel.bookTravel')} onCtaPress={() => { - bookATrip(translate, setCtaErrorMessage, ctaErrorMessage); + bookATrip(translate, setCtaErrorMessage, setRootStatusBarEnabled, ctaErrorMessage); }} ctaErrorMessage={ctaErrorMessage} illustration={LottieAnimations.TripsEmptyState} From de06e4f31e86bff60d0cb995d668c70c0aaa2c38 Mon Sep 17 00:00:00 2001 From: war-in Date: Mon, 27 Jan 2025 17:41:37 +0100 Subject: [PATCH 10/11] fix lint --- src/components/ScreenWrapper.tsx | 2 +- .../BaseOnboardingEmployees.tsx | 20 +++++++++---------- src/pages/Search/EmptySearchView.tsx | 6 +++--- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/components/ScreenWrapper.tsx b/src/components/ScreenWrapper.tsx index 3bf199057205..638ef0737ed5 100644 --- a/src/components/ScreenWrapper.tsx +++ b/src/components/ScreenWrapper.tsx @@ -5,7 +5,6 @@ import type {StyleProp, ViewStyle} from 'react-native'; import {Keyboard, NativeModules, PanResponder, View} from 'react-native'; import {PickerAvoidingView} from 'react-native-picker-select'; import type {EdgeInsets} from 'react-native-safe-area-context'; -import CustomStatusBarAndBackgroundContext from '@components/CustomStatusBarAndBackground/CustomStatusBarAndBackgroundContext'; import useEnvironment from '@hooks/useEnvironment'; import useInitialDimensions from '@hooks/useInitialWindowDimensions'; import useResponsiveLayout from '@hooks/useResponsiveLayout'; @@ -20,6 +19,7 @@ import addViewportResizeListener from '@libs/VisualViewport'; import toggleTestToolsModal from '@userActions/TestTool'; import CONST from '@src/CONST'; import CustomDevMenu from './CustomDevMenu'; +import CustomStatusBarAndBackgroundContext from './CustomStatusBarAndBackground/CustomStatusBarAndBackgroundContext'; import FocusTrapForScreens from './FocusTrap/FocusTrapForScreen'; import type FocusTrapForScreenProps from './FocusTrap/FocusTrapForScreen/FocusTrapProps'; import HeaderGap from './HeaderGap'; diff --git a/src/pages/OnboardingEmployees/BaseOnboardingEmployees.tsx b/src/pages/OnboardingEmployees/BaseOnboardingEmployees.tsx index 56cf4041c9c3..2d951474f459 100644 --- a/src/pages/OnboardingEmployees/BaseOnboardingEmployees.tsx +++ b/src/pages/OnboardingEmployees/BaseOnboardingEmployees.tsx @@ -13,11 +13,11 @@ import Text from '@components/Text'; import useLocalize from '@hooks/useLocalize'; import useResponsiveLayout from '@hooks/useResponsiveLayout'; import useThemeStyles from '@hooks/useThemeStyles'; +import {completeOnboarding} from '@libs/actions/Report'; import Navigation from '@libs/Navigation/Navigation'; -import * as PolicyUtils from '@libs/PolicyUtils'; -import * as Policy from '@userActions/Policy/Policy'; -import * as Report from '@userActions/Report'; -import * as Welcome from '@userActions/Welcome'; +import {isPaidGroupPolicy} from '@libs/PolicyUtils'; +import {createWorkspace, generatePolicyID} from '@userActions/Policy/Policy'; +import {setOnboardingAdminsChatReportID, setOnboardingCompanySize, setOnboardingPolicyID} from '@userActions/Welcome'; import CONST from '@src/CONST'; import type {OnboardingCompanySize} from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; @@ -37,7 +37,7 @@ function BaseOnboardingEmployees({shouldUseNativeStyles, route}: BaseOnboardingE const [allPolicies] = useOnyx(ONYXKEYS.COLLECTION.POLICY); const {setRootStatusBarEnabled} = useContext(CustomStatusBarAndBackgroundContext); - const paidGroupPolicy = Object.values(allPolicies ?? {}).find(PolicyUtils.isPaidGroupPolicy); + const paidGroupPolicy = Object.values(allPolicies ?? {}).find(isPaidGroupPolicy); const {onboardingIsMediumOrLargerScreenWidth} = useResponsiveLayout(); const [selectedCompanySize, setSelectedCompanySize] = useState(onboardingCompanySize); @@ -71,19 +71,19 @@ function BaseOnboardingEmployees({shouldUseNativeStyles, route}: BaseOnboardingE setError(translate('onboarding.errorSelection')); return; } - Welcome.setOnboardingCompanySize(selectedCompanySize); + setOnboardingCompanySize(selectedCompanySize); const shouldCreateWorkspace = !onboardingPolicyID && !paidGroupPolicy; // We need `adminsChatReportID` for `Report.completeOnboarding`, but at the same time, we don't want to call `Policy.createWorkspace` more than once. // If we have already created a workspace, we want to reuse the `onboardingAdminsChatReportID` and `onboardingPolicyID`. const {adminsChatReportID, policyID} = shouldCreateWorkspace - ? Policy.createWorkspace(undefined, true, '', Policy.generatePolicyID(), CONST.ONBOARDING_CHOICES.MANAGE_TEAM) + ? createWorkspace(undefined, true, '', generatePolicyID(), CONST.ONBOARDING_CHOICES.MANAGE_TEAM) : {adminsChatReportID: onboardingAdminsChatReportID, policyID: onboardingPolicyID}; if (shouldCreateWorkspace) { - Welcome.setOnboardingAdminsChatReportID(adminsChatReportID); - Welcome.setOnboardingPolicyID(policyID); + setOnboardingAdminsChatReportID(adminsChatReportID); + setOnboardingPolicyID(policyID); } // For MICRO companies (1-10 employees), we want to remain on NewDot. @@ -95,7 +95,7 @@ function BaseOnboardingEmployees({shouldUseNativeStyles, route}: BaseOnboardingE // For other company sizes we want to complete onboarding here. // At this point `onboardingPurposeSelected` should always exist as we set it in `BaseOnboardingPurpose`. if (onboardingPurposeSelected) { - Report.completeOnboarding( + completeOnboarding( onboardingPurposeSelected, CONST.ONBOARDING_MESSAGES[onboardingPurposeSelected], undefined, diff --git a/src/pages/Search/EmptySearchView.tsx b/src/pages/Search/EmptySearchView.tsx index 9b38157dfcbb..8885c7c7be16 100644 --- a/src/pages/Search/EmptySearchView.tsx +++ b/src/pages/Search/EmptySearchView.tsx @@ -239,11 +239,11 @@ function EmptySearchView({type, hasResults}: EmptySearchViewProps) { styles.textAlignLeft, styles.emptyStateFolderWebStyles, subtitleComponent, - hasSeenTour, + hasResults, + setRootStatusBarEnabled, ctaErrorMessage, + hasSeenTour, navatticURL, - shouldRedirectToExpensifyClassic, - hasResults, viewTourTaskReport, canModifyTheTask, canActionTheTask, From 50078abc2f8a827e5b40e380ead05d3b1d2f8922 Mon Sep 17 00:00:00 2001 From: Jan Nowakowski Date: Fri, 31 Jan 2025 11:31:11 +0100 Subject: [PATCH 11/11] Adjust after cherry-picks --- .../ReactNativeBackgroundTaskModule.kt | 1 - src/pages/Search/EmptySearchView.tsx | 5 +++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/background-task/android/src/main/java/com/expensify/reactnativebackgroundtask/ReactNativeBackgroundTaskModule.kt b/modules/background-task/android/src/main/java/com/expensify/reactnativebackgroundtask/ReactNativeBackgroundTaskModule.kt index a76c45c7a8b7..47e4196f37c1 100644 --- a/modules/background-task/android/src/main/java/com/expensify/reactnativebackgroundtask/ReactNativeBackgroundTaskModule.kt +++ b/modules/background-task/android/src/main/java/com/expensify/reactnativebackgroundtask/ReactNativeBackgroundTaskModule.kt @@ -14,7 +14,6 @@ import android.content.IntentFilter import android.os.Build import android.os.PersistableBundle import android.util.Log -import androidx.core.content.ContextCompat class ReactNativeBackgroundTaskModule internal constructor(context: ReactApplicationContext) : ReactNativeBackgroundTaskSpec(context) { diff --git a/src/pages/Search/EmptySearchView.tsx b/src/pages/Search/EmptySearchView.tsx index 8885c7c7be16..7ab8268494f7 100644 --- a/src/pages/Search/EmptySearchView.tsx +++ b/src/pages/Search/EmptySearchView.tsx @@ -239,11 +239,12 @@ function EmptySearchView({type, hasResults}: EmptySearchViewProps) { styles.textAlignLeft, styles.emptyStateFolderWebStyles, subtitleComponent, - hasResults, + hasSeenTour, setRootStatusBarEnabled, ctaErrorMessage, - hasSeenTour, navatticURL, + shouldRedirectToExpensifyClassic, + hasResults, viewTourTaskReport, canModifyTheTask, canActionTheTask,