@@ -2,12 +2,14 @@ import React from 'react';
22import useIsAuthenticated from '@hooks/useIsAuthenticated' ;
33import useLocalize from '@hooks/useLocalize' ;
44import useOnyx from '@hooks/useOnyx' ;
5+ import usePermissions from '@hooks/usePermissions' ;
56import useThemeStyles from '@hooks/useThemeStyles' ;
67import { isUsingStagingApi } from '@libs/ApiUtils' ;
78import { setShouldFailAllRequests , setShouldForceOffline , setShouldSimulatePoorConnection } from '@userActions/Network' ;
89import { expireSessionWithDelay , invalidateAuthToken , invalidateCredentials } from '@userActions/Session' ;
9- import { setIsDebugModeEnabled , setShouldUseStagingServer } from '@userActions/User' ;
10+ import { setIsDebugModeEnabled , setShouldBlockTransactionThreadReportCreation , setShouldUseStagingServer } from '@userActions/User' ;
1011import CONFIG from '@src/CONFIG' ;
12+ import CONST from '@src/CONST' ;
1113import ONYXKEYS from '@src/ONYXKEYS' ;
1214import type { Account as AccountOnyx } from '@src/types/onyx' ;
1315import Button from './Button' ;
@@ -27,11 +29,14 @@ const ACCOUNT_DEFAULT: AccountOnyx = {
2729} ;
2830
2931function TestToolMenu ( ) {
32+ const { isBetaEnabled} = usePermissions ( ) ;
3033 const [ network ] = useOnyx ( ONYXKEYS . NETWORK , { canBeMissing : true } ) ;
3134 const [ account = ACCOUNT_DEFAULT ] = useOnyx ( ONYXKEYS . ACCOUNT , { canBeMissing : true } ) ;
3235 const [ isUsingImportedState ] = useOnyx ( ONYXKEYS . IS_USING_IMPORTED_STATE , { canBeMissing : true } ) ;
3336 const shouldUseStagingServer = account ?. shouldUseStagingServer ?? isUsingStagingApi ( ) ;
3437 const isDebugModeEnabled = ! ! account ?. isDebugModeEnabled ;
38+ const shouldBlockTransactionThreadReportCreation = ! ! account ?. shouldBlockTransactionThreadReportCreation ;
39+ const shouldShowTransactionThreadReportToggle = isBetaEnabled ( CONST . BETAS . NO_OPTIMISTIC_TRANSACTION_THREADS ) ;
3540 const styles = useThemeStyles ( ) ;
3641 const { translate} = useLocalize ( ) ;
3742
@@ -48,6 +53,17 @@ function TestToolMenu() {
4853 </ Text >
4954 { isAuthenticated && (
5055 < >
56+ { /* When toggled, the app won't create the transaction thread report. It should be removed together with CONST.BETAS.NO_OPTIMISTIC_TRANSACTION_THREADS beta */ }
57+ { shouldShowTransactionThreadReportToggle && (
58+ < TestToolRow title = { translate ( 'initialSettingsPage.troubleshoot.shouldBlockTransactionThreadReportCreation' ) } >
59+ < Switch
60+ accessibilityLabel = { translate ( 'initialSettingsPage.troubleshoot.shouldBlockTransactionThreadReportCreation' ) }
61+ isOn = { shouldBlockTransactionThreadReportCreation }
62+ onToggle = { ( ) => setShouldBlockTransactionThreadReportCreation ( ! shouldBlockTransactionThreadReportCreation ) }
63+ />
64+ </ TestToolRow >
65+ ) }
66+
5167 { /* When toggled the app will be put into debug mode. */ }
5268 < TestToolRow title = { translate ( 'initialSettingsPage.troubleshoot.debugMode' ) } >
5369 < Switch
0 commit comments