Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Troubleshooting page & resetting Onyx state #35306

Merged
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
d1bf331
create empty troubleshooting page
TMisiukiewicz Jan 23, 2024
8f38e48
move test features from preferences to troubleshooting
TMisiukiewicz Jan 23, 2024
988e1d0
build troubleshooting menu
TMisiukiewicz Jan 23, 2024
8da95f5
basic implementation of "reset and refresh" option
TMisiukiewicz Jan 23, 2024
c9de6f5
update copies in troubleshooting section
TMisiukiewicz Jan 24, 2024
954a6dc
update page title
TMisiukiewicz Jan 24, 2024
192bfee
add new lottie animation for troubleshooting screen
TMisiukiewicz Jan 24, 2024
91c5973
update background color for troubleshoot page
TMisiukiewicz Jan 25, 2024
29d09d5
update lottie animation
TMisiukiewicz Jan 25, 2024
a983a2d
update type for menu items
TMisiukiewicz Jan 25, 2024
6fdda4d
update icon for troubleshoot
TMisiukiewicz Jan 26, 2024
59152dc
update cleared onyx keys when wiping app data
TMisiukiewicz Jan 26, 2024
89ec5ac
wrap clearOnyx with useCallback
TMisiukiewicz Jan 29, 2024
e18404e
remove console view button
TMisiukiewicz Jan 29, 2024
59ac3b3
update copies
TMisiukiewicz Jan 29, 2024
e2f6d9f
update list of preserved keys
TMisiukiewicz Jan 29, 2024
cbbfa51
update onyx cleaning method name
TMisiukiewicz Jan 29, 2024
1c79176
Merge branch 'main' into feat/troubleshooting-section
TMisiukiewicz Jan 29, 2024
9ee6198
Merge remote-tracking branch 'upstream/main' into feat/troubleshootin…
TMisiukiewicz Jan 31, 2024
d9c5ea4
update troubleshoot copies
TMisiukiewicz Jan 31, 2024
9656064
update spanish translations
TMisiukiewicz Jan 31, 2024
07ba7fe
update all keys to "troubleshoot"
TMisiukiewicz Feb 1, 2024
5c155a6
move reset action into menu item
TMisiukiewicz Feb 1, 2024
40a4206
Merge branch 'main' into feat/troubleshooting-section
TMisiukiewicz Feb 1, 2024
8b2aa12
prevent resetting the preferred theme
TMisiukiewicz Feb 1, 2024
93998ac
add confirmation modal for wiping data
TMisiukiewicz Feb 2, 2024
37a931f
Merge remote-tracking branch 'upstream/main' into feat/troubleshootin…
TMisiukiewicz Feb 2, 2024
15e50d3
add troubleshoot page to rhp mapping
TMisiukiewicz Feb 2, 2024
faa88d1
add screen to RHN and update preserved keys
TMisiukiewicz Feb 2, 2024
62e379a
update lottie file
TMisiukiewicz Feb 2, 2024
a88c265
Merge branch 'main' into feat/troubleshooting-section
TMisiukiewicz Feb 2, 2024
dabc9e5
Merge branch 'main' into feat/troubleshooting-section
TMisiukiewicz Feb 12, 2024
29e56a4
update copy for cache button
TMisiukiewicz Feb 12, 2024
f28c398
Merge remote-tracking branch 'origin/main' into feat/troubleshooting-…
TMisiukiewicz Feb 14, 2024
7accc17
Merge remote-tracking branch 'upstream/main' into feat/troubleshootin…
TMisiukiewicz Feb 14, 2024
4632e28
bring back test tool menu title
TMisiukiewicz Feb 14, 2024
319d378
Merge branch 'main' into feat/troubleshooting-section
TMisiukiewicz Feb 14, 2024
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
Binary file added assets/animations/Desk.lottie
Binary file not shown.
1 change: 1 addition & 0 deletions src/ROUTES.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ const ROUTES = {
SETTINGS_STATUS_CLEAR_AFTER: 'settings/profile/status/clear-after',
SETTINGS_STATUS_CLEAR_AFTER_DATE: 'settings/profile/status/clear-after/date',
SETTINGS_STATUS_CLEAR_AFTER_TIME: 'settings/profile/status/clear-after/time',
SETTINGS_TROUBLESHOOTING: 'settings/troubleshooting',

KEYBOARD_SHORTCUTS: 'keyboard-shortcuts',

Expand Down
1 change: 1 addition & 0 deletions src/SCREENS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ const SCREENS = {
CLOSE: 'Settings_Close',
TWO_FACTOR_AUTH: 'Settings_TwoFactorAuth',
REPORT_CARD_LOST_OR_DAMAGED: 'Settings_ReportCardLostOrDamaged',
TROUBLESHOOTING: 'Settings_Troubleshooting',

PROFILE: {
ROOT: 'Settings_Profile',
Expand Down
2 changes: 2 additions & 0 deletions src/components/Icon/Expensicons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ import Download from '@assets/images/download.svg';
import DragAndDrop from '@assets/images/drag-and-drop.svg';
import DragHandles from '@assets/images/drag-handles.svg';
import Emoji from '@assets/images/emoji.svg';
import Lightbulb from '@assets/images/emojiCategoryIcons/light-bulb.svg';
import EmptyStateAttachReceipt from '@assets/images/empty-state__attach-receipt.svg';
import EmptyStateRoutePending from '@assets/images/emptystate__routepending.svg';
import EReceiptIcon from '@assets/images/eReceiptIcon.svg';
Expand Down Expand Up @@ -270,4 +271,5 @@ export {
Instagram,
ChatBubbleAdd,
ChatBubbleUnread,
Lightbulb,
};
5 changes: 5 additions & 0 deletions src/components/LottieAnimations/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ const DotLottieAnimations: Record<string, DotLottieAnimation> = {
w: 375,
h: 240,
},
Desk: {
file: require('@assets/animations/Desk.lottie'),
w: 375,
h: 240,
},
};

export default DotLottieAnimations;
7 changes: 7 additions & 0 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -789,6 +789,7 @@ export default {
viewTheCode: 'View the code',
viewOpenJobs: 'View open jobs',
reportABug: 'Report a bug',
troubleshooting: 'Troubleshoot',
TMisiukiewicz marked this conversation as resolved.
Show resolved Hide resolved
},
appDownloadLinks: {
android: {
Expand All @@ -801,6 +802,12 @@ export default {
label: 'macOS',
},
},
troubleshooting: {
resetAndRefresh: 'Reset and refresh stashed data',
viewConsole: 'View debug console',
description: 'Use the tools below to help troubleshoot the Expensify experience. If you encounter any issues, please',
submitBug: 'submit a bug',
},
goToExpensifyClassic: 'Go to Expensify Classic',
security: 'Security',
signOut: 'Sign out',
Expand Down
7 changes: 7 additions & 0 deletions src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -783,6 +783,7 @@ export default {
viewTheCode: 'Ver código',
viewOpenJobs: 'Ver trabajos disponibles',
reportABug: 'Reportar un error',
troubleshooting: 'Solución de problemas',
TMisiukiewicz marked this conversation as resolved.
Show resolved Hide resolved
},
appDownloadLinks: {
android: {
Expand All @@ -795,6 +796,12 @@ export default {
label: 'macOS',
},
},
troubleshooting: {
resetAndRefresh: 'Restablecer y actualizar los datos almacenados',
viewConsole: 'Ver la consola de depuración',
description: 'Utilice las herramientas que aparecen a continuación para solucionar los problemas de Expensify. Si tiene algún problema, por favor',
submitBug: 'envíe un error',
},
security: 'Seguridad',
signOut: 'Desconectar',
signOutConfirmationText: 'Si cierras sesión perderás los cambios hechos mientras estabas desconectado',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ const SettingsModalStackNavigator = createModalStackNavigator<SettingsNavigatorP
[SCREENS.SETTINGS.ABOUT]: () => require('../../../pages/settings/AboutPage/AboutPage').default as React.ComponentType,
[SCREENS.SETTINGS.APP_DOWNLOAD_LINKS]: () => require('../../../pages/settings/AppDownloadLinks').default as React.ComponentType,
[SCREENS.SETTINGS.LOUNGE_ACCESS]: () => require('../../../pages/settings/Profile/LoungeAccessPage').default as React.ComponentType,
[SCREENS.SETTINGS.TROUBLESHOOTING]: () => require('../../../pages/settings/AboutPage/TroubleshootingPage').default as React.ComponentType,
[SCREENS.SETTINGS.WALLET.ROOT]: () => require('../../../pages/settings/Wallet/WalletPage').default as React.ComponentType,
[SCREENS.SETTINGS.WALLET.CARDS_DIGITAL_DETAILS_UPDATE_ADDRESS]: () => require('../../../pages/settings/Profile/PersonalDetails/AddressPage').default as React.ComponentType,
[SCREENS.SETTINGS.WALLET.DOMAIN_CARD]: () => require('../../../pages/settings/Wallet/ExpensifyCardPage').default as React.ComponentType,
Expand Down
4 changes: 4 additions & 0 deletions src/libs/Navigation/linkingConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,10 @@ const linkingConfig: LinkingOptions<RootStackParamList> = {
[SCREENS.SETTINGS.PROFILE.STATUS_CLEAR_AFTER_TIME]: {
path: ROUTES.SETTINGS_STATUS_CLEAR_AFTER_TIME,
},
[SCREENS.SETTINGS.TROUBLESHOOTING]: {
path: ROUTES.SETTINGS_TROUBLESHOOTING,
exact: true,
},
[SCREENS.WORKSPACE.INITIAL]: {
path: ROUTES.WORKSPACE_INITIAL.route,
},
Expand Down
5 changes: 5 additions & 0 deletions src/pages/settings/AboutPage/AboutPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,11 @@ function AboutPage() {
},
link: CONST.UPWORK_URL,
},
{
translationKey: 'initialSettingsPage.aboutPage.troubleshooting',
icon: Expensicons.Lightbulb,
action: waitForNavigate(() => Navigation.navigate(ROUTES.SETTINGS_TROUBLESHOOTING)),
},
{
translationKey: 'initialSettingsPage.aboutPage.reportABug',
icon: Expensicons.Bug,
Expand Down
105 changes: 105 additions & 0 deletions src/pages/settings/AboutPage/TroubleshootingPage.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
import React, {useCallback, useMemo} from 'react';
import {View} from 'react-native';
import Onyx from 'react-native-onyx';
import type {SvgProps} from 'react-native-svg';
import * as Expensicons from '@components/Icon/Expensicons';
import IllustratedHeaderPageLayout from '@components/IllustratedHeaderPageLayout';
import LottieAnimations from '@components/LottieAnimations';
import MenuItemList from '@components/MenuItemList';
import TestToolMenu from '@components/TestToolMenu';
import Text from '@components/Text';
import TextLink from '@components/TextLink';
import useEnvironment from '@hooks/useEnvironment';
import useLocalize from '@hooks/useLocalize';
import useTheme from '@hooks/useTheme';
import useThemeStyles from '@hooks/useThemeStyles';
import Navigation from '@libs/Navigation/Navigation';
import * as App from '@userActions/App';
import * as Report from '@userActions/Report';
import type {TranslationPaths} from '@src/languages/types';
import ONYXKEYS from '@src/ONYXKEYS';
import type {OnyxKey} from '@src/ONYXKEYS';
import ROUTES from '@src/ROUTES';
import SCREENS from '@src/SCREENS';

const keysToPreserve: OnyxKey[] = [
ONYXKEYS.ACCOUNT,
ONYXKEYS.IS_CHECKING_PUBLIC_ROOM,
ONYXKEYS.IS_LOADING_APP,
ONYXKEYS.IS_SIDEBAR_LOADED,
ONYXKEYS.MODAL,
ONYXKEYS.NETWORK,
ONYXKEYS.SESSION,
ONYXKEYS.SHOULD_SHOW_COMPOSE_INPUT,
ONYXKEYS.NVP_TRY_FOCUS_MODE,
];

type BaseMenuItem = {
translationKey: TranslationPaths;
icon: React.FC<SvgProps>;
action: () => void;
};

function TroubleshootingPage() {
const {translate} = useLocalize();
const theme = useTheme();
const styles = useThemeStyles();
const {isProduction} = useEnvironment();

const wipeOnyxData = useCallback(() => {
TMisiukiewicz marked this conversation as resolved.
Show resolved Hide resolved
Onyx.clear(keysToPreserve).then(() => {
App.openApp();
});
}, []);

const menuItems = useMemo(() => {
const baseMenuItems: BaseMenuItem[] = [
{
translationKey: 'initialSettingsPage.troubleshooting.resetAndRefresh',
icon: Expensicons.RotateLeft,
action: wipeOnyxData,
},
];

return baseMenuItems.map((item) => ({
key: item.translationKey,
title: translate(item.translationKey),
icon: item.icon,
onPress: item.action,
}));
}, [translate, wipeOnyxData]);

return (
<IllustratedHeaderPageLayout
title={translate('initialSettingsPage.aboutPage.troubleshooting')}
onBackButtonPress={() => Navigation.goBack(ROUTES.SETTINGS_ABOUT)}
backgroundColor={theme.PAGE_THEMES[SCREENS.SETTINGS.TROUBLESHOOTING].backgroundColor}
illustration={LottieAnimations.Desk}
>
<View style={[styles.settingsPageBody, styles.ph5]}>
<Text style={[styles.textHeadline, styles.mb1]}>{translate('initialSettingsPage.aboutPage.troubleshooting')}</Text>
<Text style={styles.mb4}>
<Text>{translate('initialSettingsPage.troubleshooting.description')}</Text>{' '}
<TextLink
style={styles.link}
onPress={() => Report.navigateToConciergeChat()}
TMisiukiewicz marked this conversation as resolved.
Show resolved Hide resolved
>
{translate('initialSettingsPage.troubleshooting.submitBug')}
</TextLink>
</Text>
</View>
<MenuItemList
menuItems={menuItems}
shouldUseSingleExecution
/>
{/* Enable additional test features in non-production environments */}
{!isProduction && (
<View style={[styles.ml5, styles.mr8, styles.mt6]}>
<TestToolMenu />
</View>
)}
</IllustratedHeaderPageLayout>
);
}

export default TroubleshootingPage;
9 changes: 0 additions & 9 deletions src/pages/settings/Preferences/PreferencesPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ import IllustratedHeaderPageLayout from '@components/IllustratedHeaderPageLayout
import LottieAnimations from '@components/LottieAnimations';
import MenuItemWithTopDescription from '@components/MenuItemWithTopDescription';
import Switch from '@components/Switch';
import TestToolMenu from '@components/TestToolMenu';
import Text from '@components/Text';
import useEnvironment from '@hooks/useEnvironment';
import useLocalize from '@hooks/useLocalize';
import useTheme from '@hooks/useTheme';
import useThemeStyles from '@hooks/useThemeStyles';
Expand Down Expand Up @@ -43,7 +41,6 @@ const defaultProps = {
function PreferencesPage(props) {
const theme = useTheme();
const styles = useThemeStyles();
const {isProduction} = useEnvironment();
const {translate, preferredLocale} = useLocalize();

return (
Expand Down Expand Up @@ -90,12 +87,6 @@ function PreferencesPage(props) {
description={translate('themePage.theme')}
onPress={() => Navigation.navigate(ROUTES.SETTINGS_THEME)}
/>
{/* Enable additional test features in non-production environments */}
{!isProduction && (
<View style={[styles.ml5, styles.mr8, styles.mt6]}>
<TestToolMenu />
</View>
)}
</View>
</IllustratedHeaderPageLayout>
);
Expand Down
4 changes: 4 additions & 0 deletions src/styles/theme/themes/dark.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,10 @@ const darkTheme = {
backgroundColor: colors.productDark200,
statusBarStyle: CONST.STATUS_BAR_STYLE.LIGHT_CONTENT,
},
[SCREENS.SETTINGS.TROUBLESHOOTING]: {
backgroundColor: colors.blue700,
statusBarStyle: CONST.STATUS_BAR_STYLE.LIGHT_CONTENT,
},
[SCREENS.SETTINGS.ABOUT]: {
backgroundColor: colors.yellow600,
statusBarStyle: CONST.STATUS_BAR_STYLE.LIGHT_CONTENT,
Expand Down
4 changes: 4 additions & 0 deletions src/styles/theme/themes/light.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,10 @@ const lightTheme = {
backgroundColor: colors.yellow600,
statusBarStyle: CONST.STATUS_BAR_STYLE.LIGHT_CONTENT,
},
[SCREENS.SETTINGS.TROUBLESHOOTING]: {
backgroundColor: colors.blue700,
statusBarStyle: CONST.STATUS_BAR_STYLE.LIGHT_CONTENT,
},
[SCREENS.REFERRAL_DETAILS]: {
backgroundColor: colors.pink800,
statusBarStyle: CONST.STATUS_BAR_STYLE.LIGHT_CONTENT,
Expand Down
Loading