Skip to content

Commit 97cf4bd

Browse files
authored
Merge pull request #4193 from Expensify/cherry-pick-staging-4019
2 parents 1d2ce1d + 91f797b commit 97cf4bd

File tree

18 files changed

+125
-139
lines changed

18 files changed

+125
-139
lines changed

android/app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,8 @@ android {
149149
minSdkVersion rootProject.ext.minSdkVersion
150150
targetSdkVersion rootProject.ext.targetSdkVersion
151151
multiDexEnabled rootProject.ext.multiDexEnabled
152-
versionCode 1001007903
153-
versionName "1.0.79-3"
152+
versionCode 1001007904
153+
versionName "1.0.79-4"
154154
}
155155
splits {
156156
abi {

ios/ExpensifyCash/Info.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
</dict>
3131
</array>
3232
<key>CFBundleVersion</key>
33-
<string>1.0.79.3</string>
33+
<string>1.0.79.4</string>
3434
<key>ITSAppUsesNonExemptEncryption</key>
3535
<false/>
3636
<key>LSApplicationQueriesSchemes</key>

ios/ExpensifyCashTests/Info.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@
1919
<key>CFBundleSignature</key>
2020
<string>????</string>
2121
<key>CFBundleVersion</key>
22-
<string>1.0.79.3</string>
22+
<string>1.0.79.4</string>
2323
</dict>
2424
</plist>

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "expensify.cash",
3-
"version": "1.0.79-3",
3+
"version": "1.0.79-4",
44
"author": "Expensify, Inc.",
55
"homepage": "https://new.expensify.com",
66
"description": "Expensify.cash is the next generation of Expensify: a reimagination of payments based atop a foundation of chat.",

src/CONST.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/components/IOUConfirmationList.js

Lines changed: 30 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,12 @@ import SafeAreaInsetPropTypes from '../pages/SafeAreaInsetPropTypes';
1919
import withWindowDimensions, {windowDimensionsPropTypes} from './withWindowDimensions';
2020
import compose from '../libs/compose';
2121
import FixedFooter from './FixedFooter';
22+
import CONST from '../CONST';
2223

2324
const propTypes = {
2425
/** Callback to inform parent modal of success */
2526
onConfirm: PropTypes.func.isRequired,
2627

27-
// User's currency preference
28-
selectedCurrency: PropTypes.shape({
29-
// Currency code for the selected currency
30-
currencyCode: PropTypes.string,
31-
32-
// Currency symbol for the selected currency
33-
currencySymbol: PropTypes.string,
34-
}).isRequired,
35-
3628
// Callback to update comment from IOUModal
3729
onUpdateComment: PropTypes.func,
3830

@@ -80,20 +72,33 @@ const propTypes = {
8072

8173
/** Primary login of the user */
8274
login: PropTypes.string,
83-
}).isRequired,
75+
}),
8476

8577
/** Holds data related to IOU view state, rather than the underlying IOU data. */
8678
iou: PropTypes.shape({
8779

8880
/** Whether or not the IOU step is loading (creating the IOU Report) */
8981
loading: PropTypes.bool,
82+
83+
// Selected Currency Code of the current IOU
84+
selectedCurrencyCode: PropTypes.string,
85+
}),
86+
87+
/** Information about the network */
88+
network: PropTypes.shape({
89+
/** Is the network currently offline or not */
90+
isOffline: PropTypes.bool,
9091
}),
9192
};
9293

9394
const defaultProps = {
94-
iou: {},
95+
iou: {
96+
selectedCurrencyCode: CONST.CURRENCY.USD,
97+
},
9598
onUpdateComment: null,
9699
comment: '',
100+
network: {},
101+
myPersonalDetails: {},
97102
};
98103

99104
// Gives minimum height to offset the height of
@@ -115,14 +120,14 @@ class IOUConfirmationList extends Component {
115120
this.props.myPersonalDetails,
116121
this.props.numberFormat(this.calculateAmount() / 100, {
117122
style: 'currency',
118-
currency: this.props.selectedCurrency.currencyCode,
123+
currency: this.props.iou.selectedCurrencyCode,
119124
}),
120125
);
121126

122127
const formattedParticipants = getIOUConfirmationOptionsFromParticipants(this.props.participants,
123128
this.props.numberFormat(this.calculateAmount() / 100, {
124129
style: 'currency',
125-
currency: this.props.selectedCurrency.currencyCode,
130+
currency: this.props.iou.selectedCurrencyCode,
126131
}));
127132

128133
sections.push({
@@ -141,7 +146,7 @@ class IOUConfirmationList extends Component {
141146
const formattedParticipants = getIOUConfirmationOptionsFromParticipants(this.props.participants,
142147
this.props.numberFormat(this.props.iouAmount, {
143148
style: 'currency',
144-
currency: this.props.selectedCurrency.currencyCode,
149+
currency: this.props.iou.selectedCurrencyCode,
145150
}));
146151

147152
sections.push({
@@ -237,7 +242,7 @@ class IOUConfirmationList extends Component {
237242
this.props.hasMultipleParticipants ? 'iou.split' : 'iou.request', {
238243
amount: this.props.numberFormat(
239244
this.props.iouAmount,
240-
{style: 'currency', currency: this.props.selectedCurrency.currencyCode},
245+
{style: 'currency', currency: this.props.iou.selectedCurrencyCode},
241246
),
242247
},
243248
);
@@ -274,10 +279,16 @@ class IOUConfirmationList extends Component {
274279
</View>
275280
</ScrollView>
276281
<FixedFooter>
282+
{this.props.network.isOffline && (
283+
<Text style={[styles.formError, styles.pb2]}>
284+
{this.props.translate('session.offlineMessage')}
285+
</Text>
286+
)}
277287
<Button
278288
success
289+
isDisabled={this.props.network.isOffline}
279290
style={[styles.w100]}
280-
isLoading={this.props.iou.loading}
291+
isLoading={this.props.iou.loading && !this.props.network.isOffline}
281292
text={buttonText}
282293
onPress={() => this.props.onConfirm(this.getSplits())}
283294
pressOnEnter
@@ -301,5 +312,8 @@ export default compose(
301312
myPersonalDetails: {
302313
key: ONYXKEYS.MY_PERSONAL_DETAILS,
303314
},
315+
network: {
316+
key: ONYXKEYS.NETWORK,
317+
},
304318
}),
305319
)(IOUConfirmationList);

src/languages/en.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,8 @@ export default {
456456
},
457457
},
458458
session: {
459-
offlineMessage: 'Looks like you\'re offline. Please check your connection and try again.',
459+
offlineMessageRetry: 'Looks like you\'re offline. Please check your connection and try again.',
460+
offlineMessage: 'Looks like you\'re offline.',
460461
},
461462
workspace: {
462463
common: {

src/languages/es.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,8 @@ export default {
373373
},
374374
},
375375
session: {
376-
offlineMessage: 'Parece que estás desconectado. Por favor chequea tu conexión e inténtalo otra vez',
376+
offlineMessageRetry: 'Parece que estás desconectado. Por favor chequea tu conexión e inténtalo otra vez',
377+
offlineMessage: 'Parece que estás desconectado.',
377378
},
378379
workspace: {
379380
common: {

src/libs/Navigation/AppNavigator/AuthScreens.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ class AuthScreens extends React.Component {
153153
User.getUserDetails();
154154
User.getBetas();
155155
User.getDomainInfo();
156-
PersonalDetails.fetchCurrencyPreferences();
156+
PersonalDetails.fetchLocalCurrency();
157157
fetchAllReports(true, true);
158158
fetchCountryCodeByRequestIP();
159159
UnreadIndicatorUpdater.listenForReportChanges();

src/libs/OptionsListUtils.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -679,7 +679,6 @@ function getHeaderMessage(hasSelectableOptions, hasUserToInvite, searchValue, ma
679679
*
680680
* @param {Object} currencyOptions
681681
* @param {String} searchValue
682-
* @param {Object} selectedCurrency
683682
* @returns {Array}
684683
*/
685684
function getCurrencyListForSections(currencyOptions, searchValue) {

src/libs/actions/IOU.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,15 @@ function rejectTransaction({
152152
});
153153
}
154154

155+
/**
156+
* Sets IOU'S selected currency
157+
*
158+
* @param {String} selectedCurrencyCode
159+
*/
160+
function setIOUSelectedCurrency(selectedCurrencyCode) {
161+
Onyx.merge(ONYXKEYS.IOU, {selectedCurrencyCode});
162+
}
163+
155164
/**
156165
* @private
157166
*
@@ -239,4 +248,5 @@ export {
239248
createIOUSplit,
240249
rejectTransaction,
241250
payIOUReport,
251+
setIOUSelectedCurrency,
242252
};

src/libs/actions/PersonalDetails.js

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -233,9 +233,9 @@ function getCurrencyList() {
233233
}
234234

235235
/**
236-
* Fetches the Currency preferences based on location and sets currency code/symbol to local storage
236+
* Fetches the local currency based on location and sets currency code/symbol to local storage
237237
*/
238-
function fetchCurrencyPreferences() {
238+
function fetchLocalCurrency() {
239239
const coords = {};
240240
let currency = '';
241241

@@ -247,14 +247,9 @@ function fetchCurrencyPreferences() {
247247
.then((data) => {
248248
currency = data.currency;
249249
})
250-
.then(API.GetCurrencyList)
251250
.then(getCurrencyList)
252-
.then((currencyList) => {
253-
Onyx.merge(ONYXKEYS.MY_PERSONAL_DETAILS,
254-
{
255-
preferredCurrencyCode: currency,
256-
preferredCurrencySymbol: currencyList[currency].symbol,
257-
});
251+
.then(() => {
252+
Onyx.merge(ONYXKEYS.MY_PERSONAL_DETAILS, {localCurrencyCode: currency});
258253
})
259254
.catch(error => console.debug(`Error fetching currency preference: , ${error}`))
260255
.finally(() => {
@@ -302,6 +297,6 @@ export {
302297
setPersonalDetails,
303298
setAvatar,
304299
deleteAvatar,
305-
fetchCurrencyPreferences,
300+
fetchLocalCurrency,
306301
getCurrencyList,
307302
};

src/libs/actions/Session.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ function fetchAccountDetails(login) {
135135
Onyx.merge(ONYXKEYS.ACCOUNT, {error: response.message});
136136
})
137137
.catch(() => {
138-
Onyx.merge(ONYXKEYS.ACCOUNT, {error: translateLocal('session.offlineMessage')});
138+
Onyx.merge(ONYXKEYS.ACCOUNT, {error: translateLocal('session.offlineMessageRetry')});
139139
})
140140
.finally(() => {
141141
Onyx.merge(ONYXKEYS.ACCOUNT, {loading: false});

0 commit comments

Comments
 (0)