Skip to content

Commit

Permalink
Merge pull request #35672 from software-mansion-labs/update-account-s…
Browse files Browse the repository at this point in the history
…ettings/preferences
  • Loading branch information
mountiny authored Feb 13, 2024
2 parents 22d82d5 + 404b3c5 commit 4f1521c
Show file tree
Hide file tree
Showing 20 changed files with 256 additions and 175 deletions.
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();
}, [isDisabled, theme, updateStatusBarStyle]);

if (isDisabled) {
return null;
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,
},
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 @@ -718,6 +718,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 @@ -1051,6 +1055,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',
muteAllSounds: 'Mute all sounds from Expensify',
},
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 @@ -1049,6 +1053,14 @@ export default {
defaultPaymentMethod: 'Predeterminado',
},
preferencesPage: {
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”.',
},
receiveRelevantFeatureUpdatesAndExpensifyNews: 'Recibir noticias sobre Expensify y actualizaciones del producto',
muteAllSounds: 'Silenciar todos los sonidos de Expensify',
},
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

0 comments on commit 4f1521c

Please sign in to comment.