Skip to content

Commit a75fd26

Browse files
committed
Add toggle to manually control the transaction thread report creation
1 parent b559786 commit a75fd26

18 files changed

Lines changed: 45 additions & 6 deletions

File tree

src/components/TestToolMenu.tsx

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@ import React from 'react';
22
import useIsAuthenticated from '@hooks/useIsAuthenticated';
33
import useLocalize from '@hooks/useLocalize';
44
import useOnyx from '@hooks/useOnyx';
5+
import usePermissions from '@hooks/usePermissions';
56
import useThemeStyles from '@hooks/useThemeStyles';
67
import {isUsingStagingApi} from '@libs/ApiUtils';
78
import {setShouldFailAllRequests, setShouldForceOffline, setShouldSimulatePoorConnection} from '@userActions/Network';
89
import {expireSessionWithDelay, invalidateAuthToken, invalidateCredentials} from '@userActions/Session';
9-
import {setIsDebugModeEnabled, setShouldUseStagingServer} from '@userActions/User';
10+
import {setIsDebugModeEnabled, setShouldBlockTransactionThreadReportCreation, setShouldUseStagingServer} from '@userActions/User';
1011
import CONFIG from '@src/CONFIG';
12+
import CONST from '@src/CONST';
1113
import ONYXKEYS from '@src/ONYXKEYS';
1214
import type {Account as AccountOnyx} from '@src/types/onyx';
1315
import Button from './Button';
@@ -27,11 +29,14 @@ const ACCOUNT_DEFAULT: AccountOnyx = {
2729
};
2830

2931
function 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

src/languages/de.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1577,6 +1577,7 @@ const translations = {
15771577
testCrash: 'Testabsturz',
15781578
resetToOriginalState: 'Auf den ursprünglichen Zustand zurücksetzen',
15791579
usingImportedState: 'Sie verwenden importierten Status. Drücken Sie hier, um ihn zu löschen.',
1580+
shouldBlockTransactionThreadReportCreation: 'Erstellung von Transaktions-Thread-Berichten blockieren',
15801581
debugMode: 'Debug-Modus',
15811582
invalidFile: 'Ungültige Datei',
15821583
invalidFileDescription: 'Die Datei, die Sie importieren möchten, ist ungültig. Bitte versuchen Sie es erneut.',

src/languages/en.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1561,6 +1561,7 @@ const translations = {
15611561
testCrash: 'Test crash',
15621562
resetToOriginalState: 'Reset to original state',
15631563
usingImportedState: 'You are using imported state. Press here to clear it.',
1564+
shouldBlockTransactionThreadReportCreation: 'Block transaction thread report creation',
15641565
debugMode: 'Debug mode',
15651566
invalidFile: 'Invalid file',
15661567
invalidFileDescription: 'The file you are trying to import is not valid. Please try again.',

src/languages/es.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1554,6 +1554,7 @@ const translations = {
15541554
testCrash: 'Prueba de fallo',
15551555
resetToOriginalState: 'Restablecer al estado original',
15561556
usingImportedState: 'Estás utilizando el estado importado. Pulsa aquí para borrarlo.',
1557+
shouldBlockTransactionThreadReportCreation: 'Bloquear la creación de informes de hilos de transacciones',
15571558
debugMode: 'Modo depuración',
15581559
invalidFile: 'Archivo inválido',
15591560
invalidFileDescription: 'El archivo que ests intentando importar no es válido. Por favor, inténtalo de nuevo.',

src/languages/fr.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1578,6 +1578,7 @@ const translations = {
15781578
testCrash: 'Test crash',
15791579
resetToOriginalState: "Réinitialiser à l'état d'origine",
15801580
usingImportedState: 'Vous utilisez un état importé. Appuyez ici pour le réinitialiser.',
1581+
shouldBlockTransactionThreadReportCreation: 'Bloquer la création de rapports de fil de transaction',
15811582
debugMode: 'Mode débogage',
15821583
invalidFile: 'Fichier invalide',
15831584
invalidFileDescription: "Le fichier que vous essayez d'importer n'est pas valide. Veuillez réessayer.",

src/languages/it.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1571,6 +1571,7 @@ const translations = {
15711571
testCrash: 'Test crash',
15721572
resetToOriginalState: 'Ripristina allo stato originale',
15731573
usingImportedState: 'Stai utilizzando uno stato importato. Premi qui per cancellarlo.',
1574+
shouldBlockTransactionThreadReportCreation: 'Blocca la creazione di report del thread di transazione',
15741575
debugMode: 'Modalità debug',
15751576
invalidFile: 'File non valido',
15761577
invalidFileDescription: 'Il file che stai cercando di importare non è valido. Per favore riprova.',

src/languages/ja.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1571,6 +1571,7 @@ const translations = {
15711571
testCrash: 'クラッシュのテスト',
15721572
resetToOriginalState: '元の状態にリセット',
15731573
usingImportedState: 'インポートされた状態を使用しています。ここを押してクリアしてください。',
1574+
shouldBlockTransactionThreadReportCreation: 'トランザクションスレッドレポートの作成をブロック',
15741575
debugMode: 'デバッグモード',
15751576
invalidFile: '無効なファイル',
15761577
invalidFileDescription: 'インポートしようとしているファイルは無効です。もう一度お試しください。',

src/languages/nl.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1573,6 +1573,7 @@ const translations = {
15731573
testCrash: 'Test crash',
15741574
resetToOriginalState: 'Reset naar oorspronkelijke staat',
15751575
usingImportedState: 'U gebruikt geïmporteerde status. Druk hier om het te wissen.',
1576+
shouldBlockTransactionThreadReportCreation: 'Creatie van transactie thread rapporten blokkeren',
15761577
debugMode: 'Debug-modus',
15771578
invalidFile: 'Ongeldig bestand',
15781579
invalidFileDescription: 'Het bestand dat je probeert te importeren is niet geldig. Probeer het opnieuw.',

src/languages/pl.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1569,6 +1569,7 @@ const translations = {
15691569
testCrash: 'Test awarii',
15701570
resetToOriginalState: 'Przywróć do stanu początkowego',
15711571
usingImportedState: 'Używasz zaimportowanego stanu. Naciśnij tutaj, aby go wyczyścić.',
1572+
shouldBlockTransactionThreadReportCreation: 'Blokuj tworzenie raportów wątku transakcji',
15721573
debugMode: 'Tryb debugowania',
15731574
invalidFile: 'Nieprawidłowy plik',
15741575
invalidFileDescription: 'Plik, który próbujesz zaimportować, jest nieprawidłowy. Spróbuj ponownie.',

src/languages/pt-BR.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1570,6 +1570,7 @@ const translations = {
15701570
testCrash: 'Teste de falha',
15711571
resetToOriginalState: 'Redefinir para o estado original',
15721572
usingImportedState: 'Você está usando um estado importado. Clique aqui para limpá-lo.',
1573+
shouldBlockTransactionThreadReportCreation: 'Bloquear a criação de relatórios de thread de transação',
15731574
debugMode: 'Modo de depuração',
15741575
invalidFile: 'Arquivo inválido',
15751576
invalidFileDescription: 'O arquivo que você está tentando importar não é válido. Por favor, tente novamente.',

0 commit comments

Comments
 (0)