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 33 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
6 changes: 4 additions & 2 deletions src/components/CustomStatusBarAndBackground/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -116,15 +116,17 @@ function CustomStatusBarAndBackground({isNested = false}: CustomStatusBarAndBack
return () => navigationRef.removeListener('state', listener);
}, [isDisabled, theme.appBG, updateStatusBarStyle]);

// Update the global background (on web) everytime the theme changes.
// Update the global background and status bar style (on web) everytime the theme changes.
// The background of the html element needs to be updated, otherwise you will see a big contrast when resizing the window or when the keyboard is open on iOS web.
// The status bar style needs to be updated when the user changes the theme, otherwise, the status bar will not change its color (mWeb iOS).
useEffect(() => {
if (isDisabled) {
return;
}

updateGlobalBackgroundColor(theme);
}, [isDisabled, theme]);
updateStatusBarStyle();
kosmydel marked this conversation as resolved.
Show resolved Hide resolved
}, [isDisabled, theme, updateStatusBarStyle]);
kosmydel marked this conversation as resolved.
Show resolved Hide resolved

if (isDisabled) {
return null;
Expand Down
2 changes: 1 addition & 1 deletion src/components/FeatureList.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const defaultProps = {
subtitle: '',
onCtaPress: () => {},
illustration: null,
illustrationBackgroundColor: '',
illustrationBackgroundColor: null,
illustrationStyle: [],
};

Expand Down
4 changes: 2 additions & 2 deletions src/components/Icon/Illustrations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ import MoneyWings from '@assets/images/simple-illustrations/simple-illustration_
import OpenSafe from '@assets/images/simple-illustrations/simple-illustration__opensafe.svg';
import PalmTree from '@assets/images/simple-illustrations/simple-illustration__palmtree.svg';
import Profile from '@assets/images/simple-illustrations/simple-illustration__profile.svg';
import QrCode from '@assets/images/simple-illustrations/simple-illustration__qr-code.svg';
import QRCode from '@assets/images/simple-illustrations/simple-illustration__qr-code.svg';
import SanFrancisco from '@assets/images/simple-illustrations/simple-illustration__sanfrancisco.svg';
import ShieldYellow from '@assets/images/simple-illustrations/simple-illustration__shield.svg';
import SmallRocket from '@assets/images/simple-illustrations/simple-illustration__smallrocket.svg';
Expand Down Expand Up @@ -127,5 +127,5 @@ export {
PalmTree,
LockClosed,
Gears,
QrCode,
QRCode,
};
9 changes: 7 additions & 2 deletions src/components/LottieAnimations/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import colors from '@styles/theme/colors';
import variables from '@styles/variables';
import type DotLottieAnimation from './types';

const DotLottieAnimations: Record<string, DotLottieAnimation> = {
const DotLottieAnimations = {
ExpensifyLounge: {
file: require('@assets/animations/ExpensifyLounge.lottie'),
w: 1920,
Expand All @@ -26,6 +27,7 @@ const DotLottieAnimations: Record<string, DotLottieAnimation> = {
file: require('@assets/animations/PreferencesDJ.lottie'),
w: 375,
h: 240,
backgroundColor: colors.blue500,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes it hard to use same illustration with a different background. Why don't we just pass illustrationBackgroundColor instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I theoretically couldn't use colors in components: DO NOT import colors.js into file stated in colors.js. So I put it here.

Currently, we didn't have any case where we changed the background color of illustration. If someone needs it, he can possibly do that by passing illustrationBackgroundColor.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should I move it anyway, and import colors? But personally I think, that background color is closely related to the illustration.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not.a blocker. Let's keep it as is for now

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! If internal decides we want to change it, I will do it as a follow-up!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tmight be nice to add this as a follow up but I would say once we will need this dynamic which we dont right now as far as I know

},
ReviewingBankInfo: {
file: require('@assets/animations/ReviewingBankInfo.lottie'),
Expand All @@ -36,6 +38,7 @@ const DotLottieAnimations: Record<string, DotLottieAnimation> = {
file: require('@assets/animations/WorkspacePlanet.lottie'),
w: 375,
h: 240,
backgroundColor: colors.pink800,
},
SaveTheWorld: {
file: require('@assets/animations/SaveTheWorld.lottie'),
Expand All @@ -46,6 +49,7 @@ const DotLottieAnimations: Record<string, DotLottieAnimation> = {
file: require('@assets/animations/Safe.lottie'),
w: 625,
h: 400,
backgroundColor: colors.ice500,
},
Magician: {
file: require('@assets/animations/Magician.lottie'),
Expand All @@ -61,7 +65,8 @@ const DotLottieAnimations: Record<string, DotLottieAnimation> = {
file: require('@assets/animations/Coin.lottie'),
w: 375,
h: 240,
backgroundColor: colors.yellow600,
},
};
} satisfies Record<string, DotLottieAnimation>;

export default DotLottieAnimations;
2 changes: 2 additions & 0 deletions src/components/LottieAnimations/types.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import type {LottieViewProps} from 'lottie-react-native';
import type {ColorValue} from '@styles/utils/types';

type DotLottieAnimation = {
file: LottieViewProps['source'];
w: number;
h: number;
backgroundColor?: ColorValue;
};

export default DotLottieAnimation;
9 changes: 8 additions & 1 deletion src/components/Section/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React from 'react';
import type {ReactNode} from 'react';
import type {StyleProp, TextStyle, ViewStyle} from 'react-native';
import {View} from 'react-native';
import type {ValueOf} from 'type-fest';
Expand Down Expand Up @@ -65,6 +66,9 @@ type SectionProps = ChildrenProps & {

/** Styles to apply to illustration component */
illustrationStyle?: StyleProp<ViewStyle>;

/** Overlay content to display on top of animation */
overlayContent?: () => ReactNode;
};

function Section({
Expand All @@ -84,13 +88,14 @@ function Section({
illustration,
illustrationBackgroundColor,
illustrationStyle,
overlayContent,
}: SectionProps) {
const styles = useThemeStyles();
const theme = useTheme();
const StyleUtils = useStyleUtils();
const {isSmallScreenWidth} = useWindowDimensions();

const illustrationContainerStyle: StyleProp<ViewStyle> = StyleUtils.getBackgroundColorStyle(illustrationBackgroundColor ?? theme.appBG);
const illustrationContainerStyle: StyleProp<ViewStyle> = StyleUtils.getBackgroundColorStyle(illustrationBackgroundColor ?? illustration?.backgroundColor ?? theme.appBG);

return (
<>
Expand All @@ -107,10 +112,12 @@ function Section({
<Lottie
source={illustration}
style={styles.h100}
webStyle={styles.h100}
autoPlay
loop
/>
</View>
{overlayContent?.()}
</View>
)}
<View style={[styles.w100, isCentralPane && (isSmallScreenWidth ? styles.p5 : styles.p8)]}>
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
12 changes: 12 additions & 0 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -719,6 +719,10 @@ export default {
subtitle: 'These details are used for travel and payments. They are never shown on your public profile.',
},
},
securityPage: {
title: 'Security options',
subtitle: 'Enable two-factor authentication to keep your account safe.',
},
shareCodePage: {
title: 'Your code',
subtitle: 'Invite members to Expensify by sharing your personal QR code or referral link.',
Expand Down Expand Up @@ -1052,6 +1056,14 @@ export default {
defaultPaymentMethod: 'Default',
},
preferencesPage: {
appSection: {
title: 'App preferences',
subtitle: 'Customize your Expensify account.',
},
testSection: {
title: 'Test preferences',
subtitle: 'Settings to help debug and test the app on staging.',
},
receiveRelevantFeatureUpdatesAndExpensifyNews: 'Receive relevant feature updates and Expensify news',
},
priorityModePage: {
Expand Down
12 changes: 12 additions & 0 deletions src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -713,6 +713,10 @@ export default {
subtitle: 'Estos detalles se utilizan para viajes y pagos. Nunca se mostrarán en tu perfil público.',
},
},
securityPage: {
title: 'Opciones de seguridad',
subtitle: 'Activa la autenticación de dos factores para mantener tu cuenta segura.',
},
shareCodePage: {
title: 'Tu código',
subtitle: 'Invita a miembros a Expensify compartiendo tu código QR personal o enlace de invitación.',
Expand Down Expand Up @@ -1050,6 +1054,14 @@ export default {
},
preferencesPage: {
receiveRelevantFeatureUpdatesAndExpensifyNews: 'Recibir noticias sobre Expensify y actualizaciones del producto',
appSection: {
title: 'Preferencias de la aplicación',
subtitle: 'Personaliza tu cuenta de Expensify.',
},
testSection: {
title: 'Preferencias para tests',
subtitle: 'Ajustes para ayudar a depurar y probar la aplicación en “staging”.',
},
},
priorityModePage: {
priorityMode: 'Modo prioridad',
Expand Down
2 changes: 1 addition & 1 deletion src/pages/ShareCodePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ function ShareCodePage({report, session, currentUserPersonalDetails}: ShareCodeP
title={translate('common.shareCode')}
onBackButtonPress={() => Navigation.goBack(isReport ? ROUTES.REPORT_WITH_ID_DETAILS.getRoute(report.reportID) : undefined)}
shouldShowBackButton={isReport || isSmallScreenWidth}
icon={Illustrations.QrCode}
icon={Illustrations.QRCode}
/>
<ScrollView style={[themeStyles.flex1, themeStyles.pt3]}>
<View style={[themeStyles.flex1, isSmallScreenWidth ? themeStyles.workspaceSectionMobile : themeStyles.workspaceSection]}>
Expand Down
Loading
Loading