Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions src/ROUTES.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ const ROUTES = {
SETTINGS_SUBSCRIPTION_REQUEST_EARLY_CANCELLATION: 'settings/subscription/request-early-cancellation-survey',
SETTINGS_PRIORITY_MODE: 'settings/preferences/priority-mode',
SETTINGS_LANGUAGE: 'settings/preferences/language',
SETTINGS_PAYMENT_CURRENCY: 'setting/preferences/payment-currency',
SETTINGS_THEME: 'settings/preferences/theme',
SETTINGS_WORKSPACES: {route: 'settings/workspaces', getRoute: (backTo?: string) => getUrlWithBackToParam('settings/workspaces', backTo)},
SETTINGS_SECURITY: 'settings/security',
Expand Down
1 change: 1 addition & 0 deletions src/SCREENS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ const SCREENS = {
PRIORITY_MODE: 'Settings_Preferences_PriorityMode',
LANGUAGE: 'Settings_Preferences_Language',
THEME: 'Settings_Preferences_Theme',
PAYMENT_CURRENCY: 'Settings_Payment_Currency',
},

WALLET: {
Expand Down
1 change: 1 addition & 0 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1437,6 +1437,7 @@ const translations = {
changeBillingCurrency: 'Change billing currency',
changePaymentCurrency: 'Change payment currency',
paymentCurrency: 'Payment currency',
paymentCurrencyDescription: 'Select a standardized currency that all personal expenses should be converted to.',
note: 'Note: Changing your payment currency can impact how much you’ll pay for Expensify. Refer to our',
noteLink: 'pricing page',
noteDetails: 'for full details.',
Expand Down
1 change: 1 addition & 0 deletions src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1436,6 +1436,7 @@ const translations = {
changePaymentCurrency: 'Cambiar moneda de facturación',
changeBillingCurrency: 'Cambiar la moneda de pago',
paymentCurrency: 'Moneda de pago',
paymentCurrencyDescription: 'Selecciona una moneda estándar a la que se deben convertir todos los gastos personales.',
note: 'Nota: Cambiar tu moneda de pago puede afectar cuánto pagarás por Expensify. Consulta nuestra',
noteLink: 'página de precios',
noteDetails: 'para conocer todos los detalles.',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,7 @@ const SettingsModalStackNavigator = createModalStackNavigator<SettingsNavigatorP
[SCREENS.WORKSPACE.ACCOUNTING.ROOT]: () => require<ReactComponentModule>('../../../../pages/workspace/accounting/PolicyAccountingPage').default,
[SCREENS.SETTINGS.PREFERENCES.LANGUAGE]: () => require<ReactComponentModule>('../../../../pages/settings/Preferences/LanguagePage').default,
[SCREENS.SETTINGS.PREFERENCES.THEME]: () => require<ReactComponentModule>('../../../../pages/settings/Preferences/ThemePage').default,
[SCREENS.SETTINGS.PREFERENCES.PAYMENT_CURRENCY]: () => require<ReactComponentModule>('../../../../pages/settings/Preferences/PaymentCurrencyPage').default,
[SCREENS.SETTINGS.CLOSE]: () => require<ReactComponentModule>('../../../../pages/settings/Security/CloseAccountPage').default,
[SCREENS.SETTINGS.APP_DOWNLOAD_LINKS]: () => require<ReactComponentModule>('../../../../pages/settings/AppDownloadLinks').default,
[SCREENS.SETTINGS.CONSOLE]: () => require<ReactComponentModule>('../../../../pages/settings/AboutPage/ConsolePage').default,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,12 @@ const CENTRAL_PANE_TO_RHP_MAPPING: Partial<Record<keyof SettingsSplitNavigatorPa
SCREENS.SETTINGS.EXIT_SURVEY.RESPONSE,
SCREENS.SETTINGS.EXIT_SURVEY.CONFIRM,
],
[SCREENS.SETTINGS.PREFERENCES.ROOT]: [SCREENS.SETTINGS.PREFERENCES.PRIORITY_MODE, SCREENS.SETTINGS.PREFERENCES.LANGUAGE, SCREENS.SETTINGS.PREFERENCES.THEME],
[SCREENS.SETTINGS.PREFERENCES.ROOT]: [
SCREENS.SETTINGS.PREFERENCES.PRIORITY_MODE,
SCREENS.SETTINGS.PREFERENCES.LANGUAGE,
SCREENS.SETTINGS.PREFERENCES.THEME,
SCREENS.SETTINGS.PREFERENCES.PAYMENT_CURRENCY,
],
[SCREENS.SETTINGS.WALLET.ROOT]: [
SCREENS.SETTINGS.WALLET.DOMAIN_CARD,
SCREENS.SETTINGS.WALLET.TRANSFER_BALANCE,
Expand Down
4 changes: 4 additions & 0 deletions src/libs/Navigation/linkingConfig/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,10 @@ const config: LinkingOptions<RootNavigatorParamList>['config'] = {
path: ROUTES.SETTINGS_THEME,
exact: true,
},
[SCREENS.SETTINGS.PREFERENCES.PAYMENT_CURRENCY]: {
path: ROUTES.SETTINGS_PAYMENT_CURRENCY,
exact: true,
},
[SCREENS.SETTINGS.CLOSE]: {
path: ROUTES.SETTINGS_CLOSE,
exact: true,
Expand Down
1 change: 1 addition & 0 deletions src/libs/Navigation/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ type SettingsNavigatorParamList = {
forwardTo?: Routes;
};
[SCREENS.SETTINGS.PREFERENCES.PRIORITY_MODE]: undefined;
[SCREENS.SETTINGS.PREFERENCES.PAYMENT_CURRENCY]: undefined;
[SCREENS.SETTINGS.PREFERENCES.LANGUAGE]: undefined;
[SCREENS.SETTINGS.PREFERENCES.THEME]: undefined;
[SCREENS.SETTINGS.CLOSE]: undefined;
Expand Down
60 changes: 60 additions & 0 deletions src/pages/settings/Preferences/PaymentCurrencyPage.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import React from 'react';
import CurrencySelectionList from '@components/CurrencySelectionList';
import type {CurrencyListItem} from '@components/CurrencySelectionList/types';
import HeaderWithBackButton from '@components/HeaderWithBackButton';
import ScreenWrapper from '@components/ScreenWrapper';
import Text from '@components/Text';
import useLocalize from '@hooks/useLocalize';
import usePolicy from '@hooks/usePolicy';
import useThemeStyles from '@hooks/useThemeStyles';
import {updateGeneralSettings} from '@libs/actions/Policy/Policy';
import Navigation from '@libs/Navigation/Navigation';
import {getPersonalPolicy} from '@libs/PolicyUtils';
import CONST from '@src/CONST';

function PaymentCurrencyPage() {
const styles = useThemeStyles();
const {translate} = useLocalize();
const personalPolicyID = getPersonalPolicy()?.id;
const personalPolicy = usePolicy(personalPolicyID);

const paymentCurrency = personalPolicy?.outputCurrency ?? CONST.CURRENCY.USD;

return (
<ScreenWrapper
includeSafeAreaPaddingBottom={false}
testID={PaymentCurrencyPage.displayName}
>
{({didScreenTransitionEnd}) => (
<>
<HeaderWithBackButton
title={translate('billingCurrency.paymentCurrency')}
shouldShowBackButton
onBackButtonPress={() => Navigation.goBack()}
/>

<Text style={[styles.mh5, styles.mv4]}>{translate('billingCurrency.paymentCurrencyDescription')}</Text>

<CurrencySelectionList
recentlyUsedCurrencies={[]}
searchInputLabel={translate('common.search')}
onSelect={(option: CurrencyListItem) => {
if (!didScreenTransitionEnd) {
return;
}
if (option.currencyCode !== paymentCurrency) {
updateGeneralSettings(personalPolicyID, personalPolicy?.name ?? '', option.currencyCode);
}
Navigation.goBack();
}}
initiallySelectedCurrencyCode={paymentCurrency}
/>
</>
)}
</ScreenWrapper>
);
}

PaymentCurrencyPage.displayName = 'PaymentCurrencyPage';

export default PaymentCurrencyPage;
19 changes: 16 additions & 3 deletions src/pages/settings/Preferences/PreferencesPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,15 @@ import Section from '@components/Section';
import Switch from '@components/Switch';
import Text from '@components/Text';
import useLocalize from '@hooks/useLocalize';
import usePolicy from '@hooks/usePolicy';
import useResponsiveLayout from '@hooks/useResponsiveLayout';
import useThemeStyles from '@hooks/useThemeStyles';
import {togglePlatformMute, updateNewsletterSubscription} from '@libs/actions/User';
import {getCurrencySymbol} from '@libs/CurrencyUtils';
import getPlatform from '@libs/getPlatform';
import LocaleUtils from '@libs/LocaleUtils';
import Navigation from '@libs/Navigation/Navigation';
import * as User from '@userActions/User';
import {getPersonalPolicy} from '@libs/PolicyUtils';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import ROUTES from '@src/ROUTES';
Expand All @@ -29,6 +32,9 @@ function PreferencesPage() {
const isPlatformMuted = mutedPlatforms[platform];
const [user] = useOnyx(ONYXKEYS.USER);
const [preferredTheme] = useOnyx(ONYXKEYS.PREFERRED_THEME);
const personalPolicy = usePolicy(getPersonalPolicy()?.id);

const paymentCurrency = personalPolicy?.outputCurrency ?? CONST.CURRENCY.USD;

const styles = useThemeStyles();
const {translate, preferredLocale} = useLocalize();
Expand Down Expand Up @@ -66,7 +72,7 @@ function PreferencesPage() {
<Switch
accessibilityLabel={translate('preferencesPage.receiveRelevantFeatureUpdatesAndExpensifyNews')}
isOn={user?.isSubscribedToNewsletter ?? true}
onToggle={User.updateNewsletterSubscription}
onToggle={updateNewsletterSubscription}
/>
</View>
</View>
Expand All @@ -78,7 +84,7 @@ function PreferencesPage() {
<Switch
accessibilityLabel={translate('preferencesPage.muteAllSounds')}
isOn={isPlatformMuted ?? false}
onToggle={() => User.togglePlatformMute(platform, mutedPlatforms)}
onToggle={() => togglePlatformMute(platform, mutedPlatforms)}
/>
</View>
</View>
Expand All @@ -96,6 +102,13 @@ function PreferencesPage() {
onPress={() => Navigation.navigate(ROUTES.SETTINGS_LANGUAGE)}
wrapperStyle={styles.sectionMenuItemTopDescription}
/>
<MenuItemWithTopDescription
shouldShowRightIcon
title={`${paymentCurrency} - ${getCurrencySymbol(paymentCurrency)}`}
description={translate('billingCurrency.paymentCurrency')}
onPress={() => Navigation.navigate(ROUTES.SETTINGS_PAYMENT_CURRENCY)}
wrapperStyle={styles.sectionMenuItemTopDescription}
/>
<MenuItemWithTopDescription
shouldShowRightIcon
title={translate(`themePage.themes.${preferredTheme ?? CONST.THEME.DEFAULT}.label`)}
Expand Down