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

[Update Account Settings] Preferences, About, Security #35672

Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
0f80d69
redesign preferences page
kosmydel Feb 2, 2024
d836214
Merge branch 'Expensify:main' into update-account-settings/preferences
kosmydel Feb 5, 2024
bd0d930
new about page design
kosmydel Feb 5, 2024
beebe04
add english copy
kosmydel Feb 6, 2024
1b2d2a7
add Spanish copy
kosmydel Feb 7, 2024
9571905
Merge branch 'main' into update-account-settings/preferences
kosmydel Feb 7, 2024
4397fc5
rename
kosmydel Feb 7, 2024
3124444
small fixes
kosmydel Feb 7, 2024
3a8cd2d
fix icon
kosmydel Feb 7, 2024
330fb72
fix illustration height
kosmydel Feb 8, 2024
9f2b8f8
Merge branch 'main' into update-account-settings/preferences
kosmydel Feb 8, 2024
1d0e5a9
fix statusbar color on mWeb iOS
kosmydel Feb 8, 2024
c74a873
fix lint
kosmydel Feb 8, 2024
715eacd
improve types
kosmydel Feb 8, 2024
426632c
fix workspace list empty state
kosmydel Feb 8, 2024
b6d1789
fix
kosmydel Feb 8, 2024
3601b3f
Merge remote-tracking branch 'origin-swm/update-account-settings/abou…
kosmydel Feb 8, 2024
3e44c6f
fix About page status bar
kosmydel Feb 8, 2024
3769321
Security page update
filip-solecki Feb 8, 2024
028d355
fix lint issues
kosmydel Feb 8, 2024
eab2a13
Adjust illustration background color logic
filip-solecki Feb 8, 2024
479203f
add missing icons
kosmydel Feb 8, 2024
56fd657
address review
kosmydel Feb 9, 2024
42d1233
Merge branch 'Expensify:main' into update-account-settings/preferences
kosmydel Feb 9, 2024
782d2ca
add comment
kosmydel Feb 9, 2024
8941626
Merge branch 'Expensify:main' into update-account-settings/preferences
kosmydel Feb 9, 2024
31e513d
Merge branch 'Expensify:main' into update-account-settings/preferences
kosmydel Feb 9, 2024
a33f3a8
remove shouldEnableMaxHeight
kosmydel Feb 9, 2024
5f13923
Merge branch 'main' into update-account-settings/preferences
kosmydel Feb 9, 2024
1743d97
Revert "address review"
kosmydel Feb 9, 2024
0375e27
Rename text styles
filip-solecki Feb 9, 2024
0993456
fix centering
kosmydel Feb 9, 2024
a9ef0cc
Merge branch 'main' into update-account-settings/preferences
filip-solecki Feb 9, 2024
f2ca240
Merge branch 'Expensify:main' into update-account-settings/preferences
kosmydel Feb 12, 2024
5e5bce0
attempt to fix the SignInPage-perf test
kosmydel Feb 12, 2024
4f30355
fix perf tests
kosmydel Feb 12, 2024
404b3c5
Merge branch 'main' into update-account-settings/preferences
filip-solecki Feb 13, 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
12 changes: 6 additions & 6 deletions src/components/Section/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import type {StyleProp, ViewStyle} from 'react-native';
import type {StyleProp, TextStyle, ViewStyle} from 'react-native';
import {View} from 'react-native';
import type {ValueOf} from 'type-fest';
import Lottie from '@components/Lottie';
Expand Down Expand Up @@ -42,8 +42,8 @@ type SectionProps = ChildrenProps & {
/** Customize the Section container */
containerStyles?: StyleProp<ViewStyle>;

/** Customize the Section container */
titleStyles?: StyleProp<ViewStyle>;
/** Customize the Section title */
titleStyles?: StyleProp<TextStyle>;

/** Customize the Section container */
subtitleStyles?: StyleProp<ViewStyle>;
Expand Down Expand Up @@ -114,9 +114,9 @@ function Section({
</View>
)}
<View style={[styles.w100, isCentralPane && (isSmallScreenWidth ? styles.p5 : styles.p8)]}>
<View style={[styles.flexRow, styles.alignItemsCenter, styles.w100, cardLayout === CARD_LAYOUT.ICON_ON_TOP && styles.mh1, titleStyles]}>
<View style={[styles.flexRow, styles.alignItemsCenter, styles.w100, cardLayout === CARD_LAYOUT.ICON_ON_TOP && styles.mh1]}>
<View style={[styles.flexShrink1]}>
<Text style={[styles.textHeadline, styles.cardSectionTitle]}>{title}</Text>
<Text style={[styles.textHeadline, styles.cardSectionTitle, titleStyles]}>{title}</Text>
</View>
{cardLayout === CARD_LAYOUT.ICON_ON_RIGHT && (
<IconSection
Expand All @@ -127,7 +127,7 @@ function Section({
</View>

{!!subtitle && (
<View style={[styles.flexRow, styles.alignItemsCenter, styles.w100, cardLayout === CARD_LAYOUT.ICON_ON_TOP ? [styles.mt1, styles.mh1] : styles.mt4, subtitleStyles]}>
<View style={[styles.flexRow, styles.alignItemsCenter, styles.w100, cardLayout === CARD_LAYOUT.ICON_ON_TOP ? [styles.mt1, styles.mh1] : styles.mt2, subtitleStyles]}>
<Text style={[styles.textNormal, subtitleMuted && styles.colorMuted]}>{subtitle}</Text>
</View>
)}
Expand Down
10 changes: 0 additions & 10 deletions src/components/TestToolMenu.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React from 'react';
import type {OnyxEntry} from 'react-native-onyx';
import {withOnyx} from 'react-native-onyx';
import useThemeStyles from '@hooks/useThemeStyles';
import * as ApiUtils from '@libs/ApiUtils';
import compose from '@libs/compose';
import * as Network from '@userActions/Network';
Expand All @@ -14,7 +13,6 @@ import Button from './Button';
import {withNetwork} from './OnyxProvider';
import Switch from './Switch';
import TestToolRow from './TestToolRow';
import Text from './Text';

type TestToolMenuOnyxProps = {
/** User object in Onyx */
Expand All @@ -29,17 +27,9 @@ const USER_DEFAULT: UserOnyx = {shouldUseStagingServer: undefined, isSubscribedT

function TestToolMenu({user = USER_DEFAULT, network}: TestToolMenuProps) {
const shouldUseStagingServer = user?.shouldUseStagingServer ?? ApiUtils.isUsingStagingApi();
const styles = useThemeStyles();

return (
<>
<Text
style={[styles.textLabelSupporting, styles.mb4]}
numberOfLines={1}
>
Test Preferences
</Text>

{/* Option to switch between staging and default api endpoints.
This enables QA, internal testers and external devs to take advantage of sandbox environments for 3rd party services like Plaid and Onfido.
This toggle is not rendered for internal devs as they make environment changes directly to the .env file. */}
Expand Down
2 changes: 1 addition & 1 deletion src/components/TestToolRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ type TestToolRowProps = {
function TestToolRow({title, children}: TestToolRowProps) {
const styles = useThemeStyles();
return (
<View style={[styles.flexRow, styles.mb6, styles.justifyContentBetween, styles.alignItemsCenter, styles.mnw120]}>
<View style={styles.testRowContainer}>
<View style={styles.flex2}>
<Text>{title}</Text>
</View>
Expand Down
16 changes: 16 additions & 0 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -711,6 +711,14 @@ export default {
offline: 'Offline',
syncing: 'Syncing',
profileAvatar: 'Profile avatar',
publicSection: {
title: 'Public',
subtitle: 'These details are displayed on your public profile, available for people to see.',
},
privateSection: {
title: 'Private',
subtitle: 'These details are used for travel and payments. They are never shown on your public profile.',
},
},
loungeAccessPage: {
loungeAccess: 'Lounge access',
Expand Down Expand Up @@ -1037,6 +1045,14 @@ export default {
defaultPaymentMethod: 'Default',
},
preferencesPage: {
appSection: {
title: 'App preferences',
subtitle: 'That is when you can experience true joy, when you have no fear.',
},
testSection: {
title: 'Test preferences',
subtitle: 'That is when you can experience true joy, when you have no fear.',
},
kosmydel marked this conversation as resolved.
Show resolved Hide resolved
receiveRelevantFeatureUpdatesAndExpensifyNews: 'Receive relevant feature updates and Expensify news',
},
priorityModePage: {
Expand Down
8 changes: 8 additions & 0 deletions src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -705,6 +705,14 @@
offline: 'Desconectado',
syncing: 'Sincronizando',
profileAvatar: 'Perfil avatar',
publicSection: {
title: 'Público',
subtitle: 'Estos detalles se muestran en tu perfil público, a disposición de los demás.',
},
privateSection: {
title: 'Privada',
subtitle: 'Estos detalles se utilizan para viajes y pagos. Nunca se mostrarán en tu perfil público.',
},
},
loungeAccessPage: {
loungeAccess: 'Acceso a la sala vip',
Expand Down Expand Up @@ -1033,7 +1041,7 @@
addFirstPaymentMethod: 'Añade un método de pago para enviar y recibir pagos directamente desde la aplicación.',
defaultPaymentMethod: 'Predeterminado',
},
preferencesPage: {

Check failure on line 1044 in src/languages/es.ts

View workflow job for this annotation

GitHub Actions / typecheck

Type '{ receiveRelevantFeatureUpdatesAndExpensifyNews: string; }' is missing the following properties from type '{ appSection: { title: string; subtitle: string; }; testSection: { title: string; subtitle: string; }; receiveRelevantFeatureUpdatesAndExpensifyNews: string; }': appSection, testSection
receiveRelevantFeatureUpdatesAndExpensifyNews: 'Recibir noticias sobre Expensify y actualizaciones del producto',
},
priorityModePage: {
Expand Down
132 changes: 81 additions & 51 deletions src/pages/settings/Preferences/PreferencesPage.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import lodashGet from 'lodash/get';
import PropTypes from 'prop-types';
import React from 'react';
import {View} from 'react-native';
import {ScrollView, View} from 'react-native';
import {withOnyx} from 'react-native-onyx';
import IllustratedHeaderPageLayout from '@components/IllustratedHeaderPageLayout';
import HeaderWithBackButton from '@components/HeaderWithBackButton';
import LottieAnimations from '@components/LottieAnimations';
import MenuItemWithTopDescription from '@components/MenuItemWithTopDescription';
import ScreenWrapper from '@components/ScreenWrapper';
import Section from '@components/Section';
import Switch from '@components/Switch';
import TestToolMenu from '@components/TestToolMenu';
import Text from '@components/Text';
Expand Down Expand Up @@ -49,58 +51,86 @@ function PreferencesPage(props) {
const {isSmallScreenWidth} = useWindowDimensions();

return (
<IllustratedHeaderPageLayout
title={translate('common.preferences')}
backgroundColor={theme.PAGE_THEMES[SCREENS.SETTINGS.PREFERENCES.ROOT].backgroundColor}
illustration={LottieAnimations.PreferencesDJ}
shouldShowBackButton={isSmallScreenWidth}
<ScreenWrapper
includeSafeAreaPaddingBottom={false}
shouldEnablePickerAvoiding={false}
shouldEnableMaxHeight
kosmydel marked this conversation as resolved.
Show resolved Hide resolved
shouldShowOfflineIndicatorInWideScreen
>
<View style={styles.mb6}>
<Text
style={[styles.textLabelSupporting, styles.mb2, styles.ml5, styles.mr8]}
numberOfLines={1}
>
{translate('common.notifications')}
</Text>
<View style={[styles.flexRow, styles.mb4, styles.justifyContentBetween, styles.ml5, styles.mr8]}>
<View style={styles.flex4}>
<Text>{translate('preferencesPage.receiveRelevantFeatureUpdatesAndExpensifyNews')}</Text>
</View>
<View style={[styles.flex1, styles.alignItemsEnd]}>
<Switch
accessibilityLabel={translate('preferencesPage.receiveRelevantFeatureUpdatesAndExpensifyNews')}
isOn={lodashGet(props.user, 'isSubscribedToNewsletter', true)}
onToggle={User.updateNewsletterSubscription}
/>
</View>
<HeaderWithBackButton
title={translate('common.workspaces')}
shouldShowBackButton={isSmallScreenWidth}
onBackButtonPress={() => Navigation.goBack()}
/>
<ScrollView contentContainerStyle={styles.pt3}>
<View style={[styles.flex1, isSmallScreenWidth ? styles.workspaceSectionMobile : styles.workspaceSection]}>
<Section
title={translate('preferencesPage.appSection.title')}
subtitle={translate('preferencesPage.appSection.subtitle')}
isCentralPane
subtitleMuted
illustration={LottieAnimations.PreferencesDJ}
illustrationBackgroundColor={theme.PAGE_THEMES[SCREENS.SETTINGS.PREFERENCES.ROOT].backgroundColor}
titleStyles={styles.accountSettingsSectionTitle}
>
<View style={[styles.flex1, styles.mt5]}>
<Text
style={[styles.textLabelSupporting, styles.mb2]}
numberOfLines={1}
>
{translate('common.notifications')}
</Text>
<View style={[styles.flexRow, styles.mb4, styles.justifyContentBetween, styles.sectionMenuItemTopDescription]}>
<View style={styles.flex4}>
<Text>{translate('preferencesPage.receiveRelevantFeatureUpdatesAndExpensifyNews')}</Text>
</View>
<View style={[styles.flex1, styles.alignItemsEnd]}>
<Switch
accessibilityLabel={translate('preferencesPage.receiveRelevantFeatureUpdatesAndExpensifyNews')}
isOn={lodashGet(props.user, 'isSubscribedToNewsletter', true)}
onToggle={User.updateNewsletterSubscription}
/>
</View>
</View>
<MenuItemWithTopDescription
shouldShowRightIcon
title={translate(`priorityModePage.priorityModes.${props.priorityMode}.label`)}
description={translate('priorityModePage.priorityMode')}
onPress={() => Navigation.navigate(ROUTES.SETTINGS_PRIORITY_MODE)}
wrapperStyle={styles.sectionMenuItemTopDescription}
/>
<MenuItemWithTopDescription
shouldShowRightIcon
title={translate(`languagePage.languages.${preferredLocale}.label`)}
description={translate('languagePage.language')}
onPress={() => Navigation.navigate(ROUTES.SETTINGS_LANGUAGE)}
wrapperStyle={styles.sectionMenuItemTopDescription}
/>
<MenuItemWithTopDescription
shouldShowRightIcon
title={translate(`themePage.themes.${props.preferredTheme || CONST.THEME.DEFAULT}.label`)}
description={translate('themePage.theme')}
onPress={() => Navigation.navigate(ROUTES.SETTINGS_THEME)}
wrapperStyle={styles.sectionMenuItemTopDescription}
/>
</View>
</Section>
{!isProduction && (
<Section
title={translate('preferencesPage.testSection.title')}
subtitle={translate('preferencesPage.testSection.subtitle')}
isCentralPane
subtitleMuted
titleStyles={styles.accountSettingsSectionTitle}
>
<View style={styles.mt5}>
<TestToolMenu />
</View>
</Section>
)}
</View>
<MenuItemWithTopDescription
shouldShowRightIcon
title={translate(`priorityModePage.priorityModes.${props.priorityMode}.label`)}
description={translate('priorityModePage.priorityMode')}
onPress={() => Navigation.navigate(ROUTES.SETTINGS_PRIORITY_MODE)}
/>
<MenuItemWithTopDescription
shouldShowRightIcon
title={translate(`languagePage.languages.${preferredLocale}.label`)}
description={translate('languagePage.language')}
onPress={() => Navigation.navigate(ROUTES.SETTINGS_LANGUAGE)}
/>
<MenuItemWithTopDescription
shouldShowRightIcon
title={translate(`themePage.themes.${props.preferredTheme || CONST.THEME.DEFAULT}.label`)}
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>
</ScrollView>
</ScreenWrapper>
);
}

Expand Down
Loading
Loading