From f49659aae35eec44b42b4eff25d8825584dd34ab Mon Sep 17 00:00:00 2001 From: Andrew Gable Date: Wed, 9 Jun 2021 17:53:08 -0600 Subject: [PATCH 1/9] Remove persistant location --- ios/ExpensifyCash/Info.plist | 1 - 1 file changed, 1 deletion(-) diff --git a/ios/ExpensifyCash/Info.plist b/ios/ExpensifyCash/Info.plist index 5420ad9ae1eb..70ce5cbd5409 100644 --- a/ios/ExpensifyCash/Info.plist +++ b/ios/ExpensifyCash/Info.plist @@ -90,7 +90,6 @@ UIBackgroundModes - location remote-notification UIFileSharingEnabled From df018cdee540c360a720969fcebf4fbdc76ffb09 Mon Sep 17 00:00:00 2001 From: Jules Rosser Date: Thu, 10 Jun 2021 12:26:35 +0100 Subject: [PATCH 2/9] remove geolocation library --- package-lock.json | 5 ----- package.json | 1 - 2 files changed, 6 deletions(-) diff --git a/package-lock.json b/package-lock.json index 6216280967b0..c33717b8d10a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -33777,11 +33777,6 @@ "resolved": "https://registry.npmjs.org/react-native-document-picker/-/react-native-document-picker-4.0.0.tgz", "integrity": "sha512-tjIOBBcyjv4j5E1MDL2OvEKNpXxQybLNkjjfpTyDUzek7grZ5eOvSlp6i/Y3EfuIGLByeaw++9R1SZtOij6R7w==" }, - "react-native-geolocation-service": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/react-native-geolocation-service/-/react-native-geolocation-service-5.2.0.tgz", - "integrity": "sha512-ai7xd6QbLl6WMyEbPfXSaXyYQ/L6CDcPjOZAJYboqwNPclAqxGkzJHJQyvBNy9J410EIrDJg0p9KyaciXmxyCw==" - }, "react-native-gesture-handler": { "version": "1.9.0", "resolved": "https://registry.npmjs.org/react-native-gesture-handler/-/react-native-gesture-handler-1.9.0.tgz", diff --git a/package.json b/package.json index c63abaee41cb..eb1e1c29b3a0 100644 --- a/package.json +++ b/package.json @@ -74,7 +74,6 @@ "react-native-bootsplash": "^3.2.0", "react-native-config": "^1.4.0", "react-native-document-picker": "^4.0.0", - "react-native-geolocation-service": "^5.2.0", "react-native-gesture-handler": "1.9.0", "react-native-image-pan-zoom": "^2.1.12", "react-native-image-picker": "^2.3.3", From 47c3fd33aac48d82c5c2eabbf531acef593c5f2c Mon Sep 17 00:00:00 2001 From: Jules Rosser Date: Thu, 10 Jun 2021 12:35:28 +0100 Subject: [PATCH 3/9] remove Geolocation usage --- src/libs/actions/PersonalDetails.js | 17 +---------------- src/pages/iou/IOUCurrencySelection.js | 2 +- 2 files changed, 2 insertions(+), 17 deletions(-) diff --git a/src/libs/actions/PersonalDetails.js b/src/libs/actions/PersonalDetails.js index 4f65c96b2ee7..9e828d331380 100644 --- a/src/libs/actions/PersonalDetails.js +++ b/src/libs/actions/PersonalDetails.js @@ -2,7 +2,6 @@ import _ from 'underscore'; import lodashGet from 'lodash/get'; import lodashMerge from 'lodash/merge'; import Onyx from 'react-native-onyx'; -import Geolocation from 'react-native-geolocation-service'; import Str from 'expensify-common/lib/str'; import ONYXKEYS from '../../ONYXKEYS'; import md5 from '../md5'; @@ -252,25 +251,11 @@ function getCurrencyList() { /** * Fetches the Currency preferences based on location - * @param {bool} withLocation */ -function fetchCurrencyPreferences(withLocation) { +function fetchCurrencyPreferences() { let coords = {}; let currency = ''; - if (withLocation) { - Geolocation.getCurrentPosition((position) => { - coords = { - longitude: position.coords.longitude, - latitude: position.coords.latitude, - }; - }); - Onyx.merge(ONYXKEYS.MY_PERSONAL_DETAILS, - { - isCurrencyPreferencesSaved: true, - }); - } - API.GetPreferredCurrency({...coords}) .then((data) => { currency = data.currency; diff --git a/src/pages/iou/IOUCurrencySelection.js b/src/pages/iou/IOUCurrencySelection.js index 0a911c5de452..53ee5e6a0f73 100644 --- a/src/pages/iou/IOUCurrencySelection.js +++ b/src/pages/iou/IOUCurrencySelection.js @@ -80,7 +80,7 @@ class IOUCurrencySelection extends Component { componentDidMount() { getCurrencyList(); if (!this.props.myPersonalDetails.isCurrencyPreferencesSaved) { - fetchCurrencyPreferences(true); + fetchCurrencyPreferences(); } } From ad763ddd7a9ddb82830f7d9aa70c36b94ec35b7a Mon Sep 17 00:00:00 2001 From: Jules Rosser Date: Thu, 10 Jun 2021 12:41:40 +0100 Subject: [PATCH 4/9] remove Android Gelocation library changes --- android/app/src/main/AndroidManifest.xml | 1 - android/settings.gradle | 2 -- 2 files changed, 3 deletions(-) diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 8b7e639b1993..01f2ba8ded56 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -6,7 +6,6 @@ - Date: Thu, 10 Jun 2021 14:23:10 +0100 Subject: [PATCH 5/9] remove geolocation library from iOS podfile --- ios/Podfile.lock | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 80f75b7712b9..d4bd063c42dc 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -353,8 +353,6 @@ PODS: - React-Core - react-native-document-picker (4.0.0): - React-Core - - react-native-geolocation-service (5.2.0): - - React - react-native-image-picker (2.3.4): - React-Core - react-native-netinfo (5.9.10): @@ -545,7 +543,6 @@ DEPENDENCIES: - React-jsinspector (from `../node_modules/react-native/ReactCommon/jsinspector`) - react-native-config (from `../node_modules/react-native-config`) - react-native-document-picker (from `../node_modules/react-native-document-picker`) - - react-native-geolocation-service (from `../node_modules/react-native-geolocation-service`) - react-native-image-picker (from `../node_modules/react-native-image-picker`) - "react-native-netinfo (from `../node_modules/@react-native-community/netinfo`)" - react-native-pdf (from `../node_modules/react-native-pdf`) @@ -654,8 +651,6 @@ EXTERNAL SOURCES: :path: "../node_modules/react-native-config" react-native-document-picker: :path: "../node_modules/react-native-document-picker" - react-native-geolocation-service: - :path: "../node_modules/react-native-geolocation-service" react-native-image-picker: :path: "../node_modules/react-native-image-picker" react-native-netinfo: @@ -731,9 +726,9 @@ SPEC CHECKSUMS: Airship: 02ad73780f9eed21870e36b0aaab327acda6a102 boost-for-react-native: 39c7adb57c4e60d6c5479dd8623128eb5b3f0f2c CocoaAsyncSocket: 065fd1e645c7abab64f7a6a2007a48038fdc6a99 - DoubleConversion: cde416483dac037923206447da6e1454df403714 + DoubleConversion: cf9b38bf0b2d048436d9a82ad2abe1404f11e7de FBLazyVector: 7b423f9e248eae65987838148c36eec1dbfe0b53 - FBReactNativeSpec: 884d4cc2b011759361797a4035c47e10099393b5 + FBReactNativeSpec: fc439e6acc4ae4bb40105318e8ee1d099f4932d2 Firebase: c23a36d9e4cdf7877dfcba8dd0c58add66358999 FirebaseAnalytics: 3bb096873ee0d7fa4b6c70f5e9166b6da413cc7f FirebaseCore: d3a978a3cfa3240bf7e4ba7d137fdf5b22b628ec @@ -747,7 +742,7 @@ SPEC CHECKSUMS: Flipper-PeerTalk: 116d8f857dc6ef55c7a5a75ea3ceaafe878aadc9 Flipper-RSocket: 127954abe8b162fcaf68d2134d34dc2bd7076154 FlipperKit: 8a20b5c5fcf9436cac58551dc049867247f64b00 - glog: 40a13f7840415b9a77023fbcae0f1e6f43192af3 + glog: 73c2498ac6884b13ede40eda8228cb1eee9d9d62 GoogleAppMeasurement: a6a3a066369828db64eda428cb2856dc1cdc7c4e GoogleDataTransport: f56af7caa4ed338dc8e138a5d7c5973e66440833 GoogleUtilities: 7f2f5a07f888cdb145101d6042bc4422f57e70b3 @@ -774,7 +769,6 @@ SPEC CHECKSUMS: React-jsinspector: 500a59626037be5b3b3d89c5151bc3baa9abf1a9 react-native-config: d8b45133fd13d4f23bd2064b72f6e2c08b2763ed react-native-document-picker: b3e78a8f7fef98b5cb069f20fc35797d55e68e28 - react-native-geolocation-service: 7c9436da6dfdecd9526c62eac62ea2bc3f0cc8ea react-native-image-picker: 32d1ad2c0024ca36161ae0d5c2117e2d6c441f11 react-native-netinfo: 52cf0ee8342548a485e28f4b09e56b477567244d react-native-pdf: 4b5a9e4465a6a3b399e91dc4838eb44ddf716d1f From e74a10c22412301b6f11103412fb17bec9a470ce Mon Sep 17 00:00:00 2001 From: Jules Rosser Date: Thu, 10 Jun 2021 14:50:10 +0100 Subject: [PATCH 6/9] remove a literally useless function --- src/libs/actions/IOU.js | 13 ------------- src/pages/iou/IOUModal.js | 6 ++---- 2 files changed, 2 insertions(+), 17 deletions(-) diff --git a/src/libs/actions/IOU.js b/src/libs/actions/IOU.js index 3e64047eedc8..c53e15553a8c 100644 --- a/src/libs/actions/IOU.js +++ b/src/libs/actions/IOU.js @@ -8,18 +8,6 @@ import * as API from '../API'; import {getSimplifiedIOUReport, fetchChatReportsByIDs, fetchIOUReportByIDAndUpdateChatReport} from './Report'; import Navigation from '../Navigation/Navigation'; -/** - * Retrieve the users preferred currency - */ -function getPreferredCurrency() { - Onyx.merge(ONYXKEYS.IOU, {loading: true}); - - // fake loading timer, to be replaced with actual network request - setTimeout(() => { - Onyx.merge(ONYXKEYS.IOU, {loading: false}); - }, 1600); -} - /** * @param {Object[]} requestParams * @param {Number} requestParams.reportID the ID of the IOU report @@ -229,7 +217,6 @@ function payIOUReport({ } export { - getPreferredCurrency, createIOUTransaction, createIOUSplit, rejectTransaction, diff --git a/src/pages/iou/IOUModal.js b/src/pages/iou/IOUModal.js index c12ce48a61e0..a3d4fdd62e81 100755 --- a/src/pages/iou/IOUModal.js +++ b/src/pages/iou/IOUModal.js @@ -9,7 +9,7 @@ import IOUConfirmPage from './steps/IOUConfirmPage'; import Header from '../../components/Header'; import styles from '../../styles/styles'; import Icon from '../../components/Icon'; -import {createIOUSplit, createIOUTransaction, getPreferredCurrency} from '../../libs/actions/IOU'; +import {createIOUSplit, createIOUTransaction} from '../../libs/actions/IOU'; import {Close, BackArrow} from '../../components/Icon/Expensicons'; import Navigation from '../../libs/Navigation/Navigation'; import ONYXKEYS from '../../ONYXKEYS'; @@ -146,12 +146,10 @@ class IOUModal extends Component { } } - getReady() { - getPreferredCurrency(); + // TODO, get currency } - /** * Retrieve title for current step, based upon current step and type of IOU * From ca9ee58bb0305d0d9bd6655ed5276057bc2bc0d5 Mon Sep 17 00:00:00 2001 From: Jules Rosser Date: Thu, 10 Jun 2021 14:56:54 +0100 Subject: [PATCH 7/9] get current currency when opening IOU Modal --- src/pages/iou/IOUModal.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/pages/iou/IOUModal.js b/src/pages/iou/IOUModal.js index a3d4fdd62e81..35d73f7dad16 100755 --- a/src/pages/iou/IOUModal.js +++ b/src/pages/iou/IOUModal.js @@ -9,6 +9,7 @@ import IOUConfirmPage from './steps/IOUConfirmPage'; import Header from '../../components/Header'; import styles from '../../styles/styles'; import Icon from '../../components/Icon'; +import * as PersonalDetails from '../../libs/actions/PersonalDetails'; import {createIOUSplit, createIOUTransaction} from '../../libs/actions/IOU'; import {Close, BackArrow} from '../../components/Icon/Expensicons'; import Navigation from '../../libs/Navigation/Navigation'; @@ -147,7 +148,7 @@ class IOUModal extends Component { } getReady() { - // TODO, get currency + PersonalDetails.fetchCurrencyPreferences(); } /** From d47763e77b2fd73e98c184d29872821f2c87f55c Mon Sep 17 00:00:00 2001 From: Jules Rosser Date: Thu, 10 Jun 2021 15:02:13 +0100 Subject: [PATCH 8/9] remove unnecessary preferred currency retrieval --- src/libs/actions/PersonalDetails.js | 4 ++-- src/pages/iou/IOUCurrencySelection.js | 8 +------- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/src/libs/actions/PersonalDetails.js b/src/libs/actions/PersonalDetails.js index 9e828d331380..fff00ea6a2d7 100644 --- a/src/libs/actions/PersonalDetails.js +++ b/src/libs/actions/PersonalDetails.js @@ -250,10 +250,10 @@ function getCurrencyList() { } /** - * Fetches the Currency preferences based on location + * Fetches the Currency preferences based on location and sets currency code/symbol to local storage */ function fetchCurrencyPreferences() { - let coords = {}; + const coords = {}; let currency = ''; API.GetPreferredCurrency({...coords}) diff --git a/src/pages/iou/IOUCurrencySelection.js b/src/pages/iou/IOUCurrencySelection.js index 53ee5e6a0f73..3218b62f2f2b 100644 --- a/src/pages/iou/IOUCurrencySelection.js +++ b/src/pages/iou/IOUCurrencySelection.js @@ -4,7 +4,7 @@ import PropTypes from 'prop-types'; import Onyx, {withOnyx} from 'react-native-onyx'; import _ from 'underscore'; import styles from '../../styles/styles'; -import {fetchCurrencyPreferences, getCurrencyList} from '../../libs/actions/PersonalDetails'; +import {getCurrencyList} from '../../libs/actions/PersonalDetails'; import ONYXKEYS from '../../ONYXKEYS'; import {getCurrencyListForSections} from '../../libs/OptionsListUtils'; import Text from '../../components/Text'; @@ -31,9 +31,6 @@ const propTypes = { // Currency Symbol of the Preferred Currency preferredCurrencySymbol: PropTypes.string, - - // Whether preferences for the currency are saved - isCurrencyPreferencesSaved: PropTypes.bool, }), // The currency list constant object from Onyx @@ -79,9 +76,6 @@ class IOUCurrencySelection extends Component { componentDidMount() { getCurrencyList(); - if (!this.props.myPersonalDetails.isCurrencyPreferencesSaved) { - fetchCurrencyPreferences(); - } } /** From b413d2fcdfb7847c2f789d3cf0715e705bf7d6b8 Mon Sep 17 00:00:00 2001 From: Jules Rosser Date: Thu, 10 Jun 2021 15:08:48 +0100 Subject: [PATCH 9/9] clean up a few comments left on contributor PR --- src/libs/API.js | 2 +- src/libs/Navigation/AppNavigator/AuthScreens.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libs/API.js b/src/libs/API.js index 5a3918173bbf..72acc4efe6f8 100644 --- a/src/libs/API.js +++ b/src/libs/API.js @@ -821,7 +821,7 @@ function Mobile_GetConstants(parameters) { const commandName = 'Mobile_GetConstants'; requireParameters(['data'], parameters, commandName); - // For some reason, the Mobile_GetConstants endpoint requires a JSON string, so we need to stringify the data param + // Stringinfy the parameters object as we cannot send an object via FormData const finalParameters = parameters; finalParameters.data = JSON.stringify(parameters.data); diff --git a/src/libs/Navigation/AppNavigator/AuthScreens.js b/src/libs/Navigation/AppNavigator/AuthScreens.js index a032193f97f8..adce58171903 100644 --- a/src/libs/Navigation/AppNavigator/AuthScreens.js +++ b/src/libs/Navigation/AppNavigator/AuthScreens.js @@ -121,7 +121,7 @@ class AuthScreens extends React.Component { User.getUserDetails(); User.getBetas(); PersonalDetails.fetchCurrencyPreferences(); - fetchAllReports(true, true, true); + fetchAllReports(true, true); fetchCountryCodeByRequestIP(); UnreadIndicatorUpdater.listenForReportChanges(); getPolicySummaries();