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: 0 additions & 1 deletion src/libs/actions/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ AppState.addEventListener('change', (nextAppState) => {
*/
function getAppData(shouldSyncPolicyList = true) {
User.getDomainInfo();
PersonalDetails.fetchLocalCurrency();
BankAccounts.fetchUserWallet();

if (shouldSyncPolicyList) {
Expand Down
15 changes: 0 additions & 15 deletions src/libs/actions/PersonalDetails.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand All @@ -310,7 +297,6 @@ function fetchLocalCurrency() {
.then((data) => {
currency = data.currency;
})
.then(getCurrencyList)
.then(() => {
Onyx.merge(ONYXKEYS.PERSONAL_DETAILS, {[currentUserEmail]: {localCurrencyCode: currency}});
})
Expand Down Expand Up @@ -366,7 +352,6 @@ export {
setAvatar,
deleteAvatar,
fetchLocalCurrency,
getCurrencyList,
getMaxCharacterError,
extractFirstAndLastNameFromAvailableDetails,
};
23 changes: 0 additions & 23 deletions src/libs/deprecatedAPI.js
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -664,13 +649,6 @@ function GetLocalCurrency(parameters) {
return Network.post(commandName, parameters);
}

/**
* @returns {Promise}
*/
function GetCurrencyList() {
return Mobile_GetConstants({data: ['currencyList']});
}

/**
* @returns {Promise}
*/
Expand Down Expand Up @@ -881,7 +859,6 @@ export {
Wallet_GetOnfidoSDKToken,
TransferWalletBalance,
GetLocalCurrency,
GetCurrencyList,
Policy_Create,
Policy_CustomUnit_Update,
Policy_CustomUnitRate_Update,
Expand Down
21 changes: 0 additions & 21 deletions src/pages/iou/IOUCurrencySelection.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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
Expand All @@ -33,10 +31,7 @@ const propTypes = {
ISO4217: PropTypes.string,
})),

/** Information about the network from Onyx */
network: networkPropTypes.isRequired,
...withLocalizePropTypes,

};

const defaultProps = {
Expand All @@ -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
*
Expand Down Expand Up @@ -101,10 +84,6 @@ class IOUCurrencySelection extends Component {
}));
}

fetchData() {
PersonalDetails.getCurrencyList();
}

/**
* Sets new search value
* @param {String} searchValue
Expand Down
22 changes: 0 additions & 22 deletions src/pages/workspace/WorkspaceSettingsPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};

Expand All @@ -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[]}
*/
Expand All @@ -77,10 +59,6 @@ class WorkspaceSettingsPage extends React.Component {
}));
}

fetchData() {
PersonalDetails.getCurrencyList();
}

removeAvatar() {
this.setState({previewAvatarURL: ''});
Policy.update(this.props.policy.id, {avatarURL: ''}, true);
Expand Down
8 changes: 4 additions & 4 deletions tests/unit/CurrencySymbolUtilsTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -35,4 +36,3 @@ describe('CurrencySymbolUtils', () => {
});
});
});