diff --git a/src/libs/actions/App.js b/src/libs/actions/App.js index 77ba414bc8a23..d64d8dc122f62 100644 --- a/src/libs/actions/App.js +++ b/src/libs/actions/App.js @@ -92,7 +92,6 @@ AppState.addEventListener('change', (nextAppState) => { */ function getAppData(shouldSyncPolicyList = true) { User.getDomainInfo(); - PersonalDetails.fetchLocalCurrency(); BankAccounts.fetchUserWallet(); if (shouldSyncPolicyList) { diff --git a/src/libs/actions/PersonalDetails.js b/src/libs/actions/PersonalDetails.js index 5585082c0e7a1..65d84dc675236 100644 --- a/src/libs/actions/PersonalDetails.js +++ b/src/libs/actions/PersonalDetails.js @@ -282,19 +282,6 @@ function setPersonalDetails(details, shouldGrowl) { }); } -/** - * Sets the onyx with the currency list from the network - * @returns {Object} - */ -function getCurrencyList() { - return DeprecatedAPI.GetCurrencyList() - .then((data) => { - const currencyListObject = JSON.parse(data.currencyList); - Onyx.merge(ONYXKEYS.CURRENCY_LIST, currencyListObject); - return currencyListObject; - }); -} - /** * Fetches the local currency based on location and sets currency code/symbol to local storage */ @@ -310,7 +297,6 @@ function fetchLocalCurrency() { .then((data) => { currency = data.currency; }) - .then(getCurrencyList) .then(() => { Onyx.merge(ONYXKEYS.PERSONAL_DETAILS, {[currentUserEmail]: {localCurrencyCode: currency}}); }) @@ -366,7 +352,6 @@ export { setAvatar, deleteAvatar, fetchLocalCurrency, - getCurrencyList, getMaxCharacterError, extractFirstAndLastNameFromAvailableDetails, }; diff --git a/src/libs/deprecatedAPI.js b/src/libs/deprecatedAPI.js index cffdac6fdbd83..14205e33c2a19 100644 --- a/src/libs/deprecatedAPI.js +++ b/src/libs/deprecatedAPI.js @@ -638,21 +638,6 @@ function DeleteBankAccount(parameters) { return Network.post(commandName, parameters); } -/** - * @param {Object} parameters - * @returns {Promise} - */ -function Mobile_GetConstants(parameters) { - const commandName = 'Mobile_GetConstants'; - requireParameters(['data'], parameters, commandName); - - // Stringify the parameters object as we cannot send an object via FormData - const finalParameters = parameters; - finalParameters.data = JSON.stringify(parameters.data); - - return Network.post(commandName, finalParameters); -} - /** * @param {Object} parameters * @param {Number} [parameters.latitude] @@ -664,13 +649,6 @@ function GetLocalCurrency(parameters) { return Network.post(commandName, parameters); } -/** - * @returns {Promise} - */ -function GetCurrencyList() { - return Mobile_GetConstants({data: ['currencyList']}); -} - /** * @returns {Promise} */ @@ -881,7 +859,6 @@ export { Wallet_GetOnfidoSDKToken, TransferWalletBalance, GetLocalCurrency, - GetCurrencyList, Policy_Create, Policy_CustomUnit_Update, Policy_CustomUnitRate_Update, diff --git a/src/pages/iou/IOUCurrencySelection.js b/src/pages/iou/IOUCurrencySelection.js index 3ea4072c4e8b7..e800542a00a53 100644 --- a/src/pages/iou/IOUCurrencySelection.js +++ b/src/pages/iou/IOUCurrencySelection.js @@ -2,7 +2,6 @@ import React, {Component} from 'react'; import PropTypes from 'prop-types'; import {withOnyx} from 'react-native-onyx'; import _ from 'underscore'; -import * as PersonalDetails from '../../libs/actions/PersonalDetails'; import ONYXKEYS from '../../ONYXKEYS'; import * as OptionsListUtils from '../../libs/OptionsListUtils'; import OptionsSelector from '../../components/OptionsSelector'; @@ -15,7 +14,6 @@ import KeyboardAvoidingView from '../../components/KeyboardAvoidingView'; import * as IOU from '../../libs/actions/IOU'; import * as CurrencySymbolUtils from '../../libs/CurrencySymbolUtils'; import {withNetwork} from '../../components/OnyxProvider'; -import networkPropTypes from '../../components/networkPropTypes'; /** * IOU Currency selection for selecting currency @@ -33,10 +31,7 @@ const propTypes = { ISO4217: PropTypes.string, })), - /** Information about the network from Onyx */ - network: networkPropTypes.isRequired, ...withLocalizePropTypes, - }; const defaultProps = { @@ -59,18 +54,6 @@ class IOUCurrencySelection extends Component { this.changeSearchValue = this.changeSearchValue.bind(this); } - componentDidMount() { - this.fetchData(); - } - - componentDidUpdate(prevProps) { - if (!prevProps.network.isOffline || this.props.network.isOffline) { - return; - } - - this.fetchData(); - } - /** * Returns the sections needed for the OptionsSelector * @@ -101,10 +84,6 @@ class IOUCurrencySelection extends Component { })); } - fetchData() { - PersonalDetails.getCurrencyList(); - } - /** * Sets new search value * @param {String} searchValue diff --git a/src/pages/workspace/WorkspaceSettingsPage.js b/src/pages/workspace/WorkspaceSettingsPage.js index c9692d464ea49..3b20f0e86c39d 100644 --- a/src/pages/workspace/WorkspaceSettingsPage.js +++ b/src/pages/workspace/WorkspaceSettingsPage.js @@ -15,21 +15,15 @@ import AvatarWithImagePicker from '../../components/AvatarWithImagePicker'; import defaultTheme from '../../styles/themes/default'; import CONST from '../../CONST'; import Picker from '../../components/Picker'; -import * as PersonalDetails from '../../libs/actions/PersonalDetails'; import TextInput from '../../components/TextInput'; import FixedFooter from '../../components/FixedFooter'; import WorkspacePageWithSections from './WorkspacePageWithSections'; import FullScreenLoadingIndicator from '../../components/FullscreenLoadingIndicator'; import withFullPolicy, {fullPolicyPropTypes, fullPolicyDefaultProps} from './withFullPolicy'; import {withNetwork} from '../../components/OnyxProvider'; -import networkPropTypes from '../../components/networkPropTypes'; const propTypes = { - /** Information about the network from Onyx */ - network: networkPropTypes.isRequired, - ...fullPolicyPropTypes, - ...withLocalizePropTypes, }; @@ -54,18 +48,6 @@ class WorkspaceSettingsPage extends React.Component { this.validate = this.validate.bind(this); } - componentDidMount() { - this.fetchData(); - } - - componentDidUpdate(prevProps) { - if (!prevProps.network.isOffline || this.props.network.isOffline) { - return; - } - - this.fetchData(); - } - /** * @returns {Object[]} */ @@ -77,10 +59,6 @@ class WorkspaceSettingsPage extends React.Component { })); } - fetchData() { - PersonalDetails.getCurrencyList(); - } - removeAvatar() { this.setState({previewAvatarURL: ''}); Policy.update(this.props.policy.id, {avatarURL: ''}, true); diff --git a/tests/unit/CurrencySymbolUtilsTest.js b/tests/unit/CurrencySymbolUtilsTest.js index dc072a03fae8c..274a48aa0c910 100644 --- a/tests/unit/CurrencySymbolUtilsTest.js +++ b/tests/unit/CurrencySymbolUtilsTest.js @@ -2,9 +2,10 @@ import _ from 'underscore'; import * as CurrencySymbolUtils from '../../src/libs/CurrencySymbolUtils'; // This file can get outdated. In that case, you can follow these steps to update it: -// - in src/libs/API.js -// - call: GetCurrencyList().then(data => console.log(data.currencyList)); -// - copy the json from console and format it to valid json using some external tool +// - open your browser console and navigate to the Network tab +// - refresh the App +// - click on the OpenApp request and in the preview tab locate the key `currencyList` +// - copy the value and format it to valid json using some external tool // - update currencyList.json import currencyList from './currencyList.json'; @@ -35,4 +36,3 @@ describe('CurrencySymbolUtils', () => { }); }); }); -