Skip to content

Commit

Permalink
Refactor code
Browse files Browse the repository at this point in the history
  • Loading branch information
mateuuszzzzz committed Feb 12, 2024
1 parent 1895d18 commit cc0d59f
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 14 deletions.
5 changes: 1 addition & 4 deletions src/components/PurposeForUsingExpensifyModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import type {MenuItemProps} from './MenuItem';
import MenuItemList from './MenuItemList';
import Modal from './Modal';
import Text from './Text';
import Navigation from '@libs/Navigation/Navigation';

// This is not translated because it is a message coming from concierge, which only supports english
const messageCopy = {
Expand Down Expand Up @@ -93,7 +92,7 @@ function PurposeForUsingExpensifyModal({isLoadingApp = false}: PurposeForUsingEx
const styles = useThemeStyles();
const {isSmallScreenWidth, windowHeight} = useWindowDimensions();
const navigation = useNavigation();
const [isModalOpen, setIsModalOpen] = useState(true);
const [isModalOpen, setIsModalOpen] = useState(false);
const theme = useTheme();

useEffect(() => {
Expand All @@ -111,13 +110,11 @@ function PurposeForUsingExpensifyModal({isLoadingApp = false}: PurposeForUsingEx
const closeModal = useCallback(() => {
Report.dismissEngagementModal();
setIsModalOpen(false);
Navigation.goBack();
}, []);

const completeModalAndClose = useCallback((message: string, choice: ValueOf<typeof CONST.INTRO_CHOICES>) => {
Report.completeEngagementModal(message, choice);
setIsModalOpen(false);
Navigation.goBack();
Report.navigateToConciergeChat();
}, []);

Expand Down
2 changes: 1 addition & 1 deletion src/components/WorkspaceSwitcherButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ function WorkspaceSwitcherButton({activeWorkspaceID, policy}: WorkspaceSwitcherB
accessible
onPress={() =>
interceptAnonymousUser(() => {
Navigation.navigate(ROUTES.WELCOME);
Navigation.navigate(ROUTES.WORKSPACE_SWITCHER);
})
}
>
Expand Down
3 changes: 0 additions & 3 deletions src/hooks/useWindowDimensions/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// eslint-disable-next-line no-restricted-imports
import {Dimensions, useWindowDimensions} from 'react-native';
import Log from '@libs/Log';
import variables from '@styles/variables';
import type WindowDimensions from './types';

Expand All @@ -16,8 +15,6 @@ export default function (): WindowDimensions {
const isMediumScreenWidth = windowWidth > variables.mobileResponsiveWidthBreakpoint && windowWidth <= variables.tabletResponsiveWidthBreakpoint;
const isLargeScreenWidth = windowWidth > variables.tabletResponsiveWidthBreakpoint;

Log.info(`WINDOW WIDTH ${windowWidth}`);

return {
windowWidth,
windowHeight,
Expand Down
6 changes: 0 additions & 6 deletions src/libs/Navigation/NavigationRoot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ function parseAndLogRoute(state: NavigationState) {
return;
}

Log.info(`Current state ${JSON.stringify(state)}`);

const currentPath = customGetPathFromState(state, linkingConfig.config);

const focusedRoute = findFocusedRoute(state);
Expand Down Expand Up @@ -76,8 +74,6 @@ function NavigationRoot({authenticated, lastVisitedPath, initialUrl, onReady}: N
return undefined;
}

return undefined;

const path = initialUrl ? getPathFromURL(initialUrl) : null;

// For non-nullable paths we don't want to set initial state
Expand Down Expand Up @@ -122,8 +118,6 @@ function NavigationRoot({authenticated, lastVisitedPath, initialUrl, onReady}: N
if (!state) {
return;
}
Log.info('STATE');
Log.info(JSON.stringify(state));
const activeWorkspaceID = getPolicyIDFromState(state as NavigationState<RootStackParamList>);
// Performance optimization to avoid context consumers to delay first render
setTimeout(() => {
Expand Down

0 comments on commit cc0d59f

Please sign in to comment.