Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Geolocation library for initial IOU release #3514

Merged
merged 11 commits into from
Jun 11, 2021
1 change: 0 additions & 1 deletion android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

<application
android:name=".MainApplication"
Expand Down
2 changes: 0 additions & 2 deletions android/settings.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
rootProject.name = 'ExpensifyCash'
include ':@react-native-community_geolocation'
project(':@react-native-community_geolocation').projectDir = new File(rootProject.projectDir, '../node_modules/@react-native-community/geolocation/android')
include ':react-native-config'
project(':react-native-config').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-config/android')
include ':@react-native-community_async-storage'
Expand Down
1 change: 0 additions & 1 deletion ios/ExpensifyCash/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@
</array>
<key>UIBackgroundModes</key>
<array>
<string>location</string>
<string>remote-notification</string>
</array>
<key>UIFileSharingEnabled</key>
Expand Down
8 changes: 1 addition & 7 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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`)
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -733,7 +728,7 @@ SPEC CHECKSUMS:
CocoaAsyncSocket: 065fd1e645c7abab64f7a6a2007a48038fdc6a99
DoubleConversion: cf9b38bf0b2d048436d9a82ad2abe1404f11e7de
FBLazyVector: 7b423f9e248eae65987838148c36eec1dbfe0b53
FBReactNativeSpec: 825b0f0851f5cc5c6268a920286281f62fc96c37
FBReactNativeSpec: fc439e6acc4ae4bb40105318e8ee1d099f4932d2
Firebase: c23a36d9e4cdf7877dfcba8dd0c58add66358999
FirebaseAnalytics: 3bb096873ee0d7fa4b6c70f5e9166b6da413cc7f
FirebaseCore: d3a978a3cfa3240bf7e4ba7d137fdf5b22b628ec
Expand Down Expand Up @@ -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
Expand Down
5 changes: 0 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion src/libs/API.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion src/libs/Navigation/AppNavigator/AuthScreens.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
13 changes: 0 additions & 13 deletions src/libs/actions/IOU.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -229,7 +217,6 @@ function payIOUReport({
}

export {
getPreferredCurrency,
createIOUTransaction,
createIOUSplit,
rejectTransaction,
Expand Down
21 changes: 3 additions & 18 deletions src/libs/actions/PersonalDetails.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -251,26 +250,12 @@ function getCurrencyList() {
}

/**
* Fetches the Currency preferences based on location
* @param {bool} withLocation
* Fetches the Currency preferences based on location and sets currency code/symbol to local storage
*/
function fetchCurrencyPreferences(withLocation) {
let coords = {};
function fetchCurrencyPreferences() {
const 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;
Expand Down
8 changes: 1 addition & 7 deletions src/pages/iou/IOUCurrencySelection.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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
Expand Down Expand Up @@ -79,9 +76,6 @@ class IOUCurrencySelection extends Component {

componentDidMount() {
getCurrencyList();
if (!this.props.myPersonalDetails.isCurrencyPreferencesSaved) {
fetchCurrencyPreferences(true);
}
}

/**
Expand Down
7 changes: 3 additions & 4 deletions src/pages/iou/IOUModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ 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 * 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';
import ONYXKEYS from '../../ONYXKEYS';
Expand Down Expand Up @@ -146,12 +147,10 @@ class IOUModal extends Component {
}
}


getReady() {
getPreferredCurrency();
PersonalDetails.fetchCurrencyPreferences();
}


/**
* Retrieve title for current step, based upon current step and type of IOU
*
Expand Down