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
18 changes: 3 additions & 15 deletions src/components/TestToolsModal.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import React, {useMemo} from 'react';
import React from 'react';
import {useOnyx} from 'react-native-onyx';
import useIsAuthenticated from '@hooks/useIsAuthenticated';
import useLocalize from '@hooks/useLocalize';
import useResponsiveLayout from '@hooks/useResponsiveLayout';
import useStyleUtils from '@hooks/useStyleUtils';
import useThemeStyles from '@hooks/useThemeStyles';
import useWindowDimensions from '@hooks/useWindowDimensions';
import {getBrowser, isChromeIOS} from '@libs/Browser';
import Navigation from '@navigation/Navigation';
import toggleTestToolsModal from '@userActions/TestTool';
import toggleTestToolsModal, {shouldShowProfileTool} from '@userActions/TestTool';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import ROUTES from '@src/ROUTES';
Expand Down Expand Up @@ -39,17 +38,6 @@ function TestToolsModal() {
const isAuthenticated = useIsAuthenticated();
const route = getRouteBasedOnAuthStatus(isAuthenticated, activeRoute);

const shouldShowProfileTool = useMemo(() => {
const browser = getBrowser();
const isSafariOrFirefox = browser === CONST.BROWSER.SAFARI || browser === CONST.BROWSER.FIREFOX;

if (isSafariOrFirefox || isChromeIOS()) {
return false;
}

return true;
}, []);

return (
<Modal
isVisible={!!isTestToolsModalOpen}
Expand All @@ -67,7 +55,7 @@ function TestToolsModal() {
>
{translate('initialSettingsPage.troubleshoot.releaseOptions')}
</Text>
{shouldShowProfileTool && <ProfilingToolMenu />}
{shouldShowProfileTool() && <ProfilingToolMenu />}
<ClientSideLoggingToolMenu />
{!!shouldStoreLogs && (
<TestToolRow title={translate('initialSettingsPage.troubleshoot.debugConsole')}>
Expand Down
16 changes: 14 additions & 2 deletions src/libs/actions/TestTool.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import throttle from 'lodash/throttle';
import Onyx from 'react-native-onyx';
import {getBrowser, isChromeIOS} from '@libs/Browser';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import * as Modal from './Modal';
import {close} from './Modal';

let isTestToolsModalOpen = false;
Onyx.connect({
Expand All @@ -20,7 +21,7 @@ function toggleTestToolsModal() {
Onyx.set(ONYXKEYS.IS_TEST_TOOLS_MODAL_OPEN, !isTestToolsModalOpen);
};
if (!isTestToolsModalOpen) {
Modal.close(toggleIsTestToolsModalOpen);
close(toggleIsTestToolsModalOpen);
return;
}
toggleIsTestToolsModalOpen();
Expand All @@ -29,4 +30,15 @@ function toggleTestToolsModal() {
throttledToggle();
}

function shouldShowProfileTool() {
const browser = getBrowser();
const isSafariOrFirefox = browser === CONST.BROWSER.SAFARI || browser === CONST.BROWSER.FIREFOX;

if (isSafariOrFirefox || isChromeIOS()) {
return false;
}
return true;
}

export {shouldShowProfileTool};
export default toggleTestToolsModal;
7 changes: 5 additions & 2 deletions src/pages/settings/Troubleshoot/TroubleshootPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import ImportOnyxState from '@components/ImportOnyxState';
import LottieAnimations from '@components/LottieAnimations';
import MenuItemList from '@components/MenuItemList';
import {useOptionsList} from '@components/OptionListContextProvider';
import ProfilingToolMenu from '@components/ProfilingToolMenu';
import ScreenWrapper from '@components/ScreenWrapper';
import ScrollView from '@components/ScrollView';
import Section from '@components/Section';
Expand All @@ -29,7 +30,8 @@ import {setShouldMaskOnyxState} from '@libs/actions/MaskOnyx';
import ExportOnyxState from '@libs/ExportOnyxState';
import Navigation from '@libs/Navigation/Navigation';
import {clearOnyxAndResetApp} from '@userActions/App';
import * as Report from '@userActions/Report';
import {navigateToConciergeChat} from '@userActions/Report';
import {shouldShowProfileTool} from '@userActions/TestTool';
import type {TranslationPaths} from '@src/languages/types';
import ONYXKEYS from '@src/ONYXKEYS';
import ROUTES from '@src/ROUTES';
Expand Down Expand Up @@ -126,7 +128,7 @@ function TroubleshootPage() {
<Text style={[styles.textNormal, styles.colorMuted]}>{translate('initialSettingsPage.troubleshoot.description')}</Text>{' '}
<TextLink
style={styles.link}
onPress={() => Report.navigateToConciergeChat()}
onPress={() => navigateToConciergeChat()}
>
{translate('initialSettingsPage.troubleshoot.submitBug')}
</TextLink>
Expand All @@ -136,6 +138,7 @@ function TroubleshootPage() {
>
<View style={[styles.flex1, styles.mt5]}>
<View>
{shouldShowProfileTool() && <ProfilingToolMenu />}
<ClientSideLoggingToolMenu />
<TestToolRow title={translate('initialSettingsPage.troubleshoot.maskExportOnyxStateData')}>
<Switch
Expand Down