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

Create currency modal with react-native-permissions and geolocation #2194

Merged
merged 64 commits into from
May 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
3696362
Install react-native-permissions and Geolocation
rameshhpathak Apr 1, 2021
2c293e2
Add currency selection page
rameshhpathak Apr 1, 2021
5875377
Set up currency modal
rameshhpathak Apr 1, 2021
50dc09e
Configure pod file and prop type for IOU Amount
rameshhpathak Apr 1, 2021
39aeaac
Switch library for geolocation to better optimized library
rameshhpathak Apr 1, 2021
0c00dd8
Add mockups for jest
rameshhpathak Apr 1, 2021
b930a2b
Remove swift bridging files
rameshhpathak Apr 2, 2021
be12f2a
Resolve comments
rameshhpathak Apr 2, 2021
52d245c
Merge with master to resolve conflicts
rameshhpathak Apr 2, 2021
e17c506
Fix styling issues and IOS build error
rameshhpathak Apr 12, 2021
f6dde51
Merge-Commit with upstream/master
rameshhpathak Apr 12, 2021
5b262e8
Set up react-native-permissions mock
rameshhpathak Apr 12, 2021
71b9bf7
Add select currency page to be outside the IOUModal
rameshhpathak Apr 12, 2021
4b3bb6c
solve the unit test error
rameshhpathak Apr 12, 2021
add51fb
Fix android importerror
rameshhpathak Apr 12, 2021
290f38e
Address comments
rameshhpathak Apr 14, 2021
ba22a44
Merge changes with master
rameshhpathak Apr 14, 2021
6bc4aba
Revert from dgoBack to dismissModal
rameshhpathak Apr 14, 2021
de04535
change the function bool
rameshhpathak Apr 14, 2021
51b0eda
Merge branch master into setup-currency-modal
rameshhpathak Apr 14, 2021
8684d28
Merge with main
rameshhpathak Apr 20, 2021
763454c
Merge branch 'main' into setup-currency-modal
rameshhpathak Apr 22, 2021
8a2e8b8
Merge with main and resolve conflicts
rameshhpathak Apr 27, 2021
791d4b6
Merge with main
rameshhpathak Apr 27, 2021
eb2a508
Merge with main
rameshhpathak Apr 30, 2021
6babb66
Make separate modal
rameshhpathak Apr 30, 2021
b849c7b
Cache currency options in modal
rameshhpathak Apr 30, 2021
c0b333c
Update option list util
rameshhpathak Apr 30, 2021
c70c9aa
Go back on confirmation
rameshhpathak Apr 30, 2021
ff6e21f
Revert sidescreen route typo
rameshhpathak Apr 30, 2021
48f38f4
Fix currency bug
rameshhpathak May 3, 2021
c308528
Resolve comments
rameshhpathak May 4, 2021
4a02fb5
Fix issue comments
rameshhpathak May 5, 2021
0f09fb2
Make changes according to comments
rameshhpathak May 9, 2021
bfa5e91
Merge with main
rameshhpathak May 9, 2021
ada2257
Remove extra space
rameshhpathak May 9, 2021
be3f3c1
Delete console log
rameshhpathak May 9, 2021
0ea067b
Address changes
rameshhpathak May 12, 2021
105313b
Merge with main
rameshhpathak May 12, 2021
238e9f5
Handle dynamic routes
rameshhpathak May 12, 2021
f959560
Merge branch main into setup-currency-modal
rameshhpathak May 13, 2021
e8ea91b
Revert sidebar screen changes
rameshhpathak May 13, 2021
8e91f40
Fix changes
rameshhpathak May 13, 2021
2a89f8e
Make changes in stack routes
rameshhpathak May 13, 2021
e890fd2
Make changes according to comments
rameshhpathak May 19, 2021
0789409
Merge branch 'main' into setup-currency-modal
rameshhpathak May 19, 2021
54a21d9
Fix minor issues
rameshhpathak May 19, 2021
c47c964
Install pods
rameshhpathak May 19, 2021
23315b3
Change error message
rameshhpathak May 19, 2021
e02e54d
Merge branch 'main' into ramesh-currency-modal
Jag96 May 19, 2021
6d2dc56
fix broken xcodeproj file
Jag96 May 19, 2021
0c72d22
group pod declarations
Jag96 May 19, 2021
66cb7f3
Internalize currencies
rameshhpathak May 19, 2021
0de1e61
Merge branch main into setup-currency-modal
rameshhpathak May 20, 2021
0783d38
Change formatted text
rameshhpathak May 20, 2021
efd43dc
Merge branch 'main' into setup-currency-modal
rameshhpathak May 20, 2021
8943eaf
Fix currency code bug
rameshhpathak May 20, 2021
5cbc17a
Change the confirmation list /100 to not dividing
rameshhpathak May 20, 2021
bd78fce
Revert back to New Chat
rameshhpathak May 20, 2021
5400055
Fix amount problem
rameshhpathak May 20, 2021
9f96d08
Prompt to ask user their location when they go to currency selection
rameshhpathak May 20, 2021
af1b5c5
Revert back changes
rameshhpathak May 20, 2021
13b161d
Change option row prop validation as per suggestion
rameshhpathak May 20, 2021
b88b3ce
Pod install and push changes
rameshhpathak May 20, 2021
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
9 changes: 9 additions & 0 deletions __mocks__/react-native-geolocation-service.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export default {
addListener: jest.fn(),
getCurrentPosition: jest.fn(),
removeListeners: jest.fn(),
requestAuthorization: jest.fn(),
setConfiguration: jest.fn(),
startObserving: jest.fn(),
stopObserving: jest.fn(),
};
65 changes: 65 additions & 0 deletions __mocks__/react-native-permissions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
const {PERMISSIONS} = require('react-native-permissions/dist/commonjs/permissions');
const {RESULTS} = require('react-native-permissions/dist/commonjs/results');

export {PERMISSIONS, RESULTS};

export const openLimitedPhotoLibraryPicker = jest.fn((() => {}));
export const openSettings = jest.fn(() => {});
export const check = jest.fn(() => RESULTS.GRANTED);
export const request = jest.fn(() => RESULTS.GRANTED);
export const checkLocationAccuracy = jest.fn(() => 'full');
export const requestLocationAccuracy = jest.fn(() => 'full');

const notificationOptions = ['alert', 'badge', 'sound', 'carPlay', 'criticalAlert', 'provisional'];

const notificationSettings = {
alert: true,
badge: true,
sound: true,
carPlay: true,
criticalAlert: true,
provisional: true,
lockScreen: true,
notificationCenter: true,
};

export const checkNotifications = jest.fn(() => ({
status: RESULTS.GRANTED,
settings: notificationSettings,
}));

export const requestNotifications = jest.fn(options => ({
status: RESULTS.GRANTED,
settings: options
.filter(option => notificationOptions.includes(option))
.reduce((acc, option) => ({...acc, [option]: true}), {
lockScreen: true,
notificationCenter: true,
}),
}));

export const checkMultiple = jest.fn(permissions => permissions.reduce((acc, permission) => ({
...acc,
[permission]: RESULTS.GRANTED,
})));

export const requestMultiple = jest.fn(permissions => permissions.reduce((acc, permission) => ({
...acc,
[permission]: RESULTS.GRANTED,
})));

export default {
PERMISSIONS,
RESULTS,

check,
checkLocationAccuracy,
checkMultiple,
checkNotifications,
openLimitedPhotoLibraryPicker,
openSettings,
request,
requestLocationAccuracy,
requestMultiple,
requestNotifications,
};
1 change: 1 addition & 0 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<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
1 change: 1 addition & 0 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ buildscript {
targetSdkVersion = 30
androidXCore = "1.0.2"
multiDexEnabled = true
googlePlayServicesVersion = "17.0.0"
Julesssss marked this conversation as resolved.
Show resolved Hide resolved
}
repositories {
google()
Expand Down
2 changes: 2 additions & 0 deletions android/settings.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
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
8 changes: 8 additions & 0 deletions ios/BridgingFile.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
//
// BridgingFile.swift
// ExpensifyCash
//
// Needed because iOS implementation is written in Swift.
//

import Foundation
2 changes: 2 additions & 0 deletions ios/ExpensifyCash-Bridging-Header.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
//
// Use this file to import your target's public headers that you would like to expose to Swift.
184 changes: 96 additions & 88 deletions ios/ExpensifyCash.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions ios/ExpensifyCash/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@
</array>
<key>UIBackgroundModes</key>
<array>
<string>location</string>
<string>remote-notification</string>
</array>
<key>UIFileSharingEnabled</key>
Expand Down
7 changes: 6 additions & 1 deletion ios/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,14 @@ require_relative '../node_modules/@react-native-community/cli-platform-ios/nativ
platform :ios, '11.0'

target 'ExpensifyCash' do
permissions_path = '../node_modules/react-native-permissions/ios'

pod 'Plaid', '~> 2.1.2'
config = use_native_modules!
pod 'Permission-LocationAccuracy', :path => "#{permissions_path}/LocationAccuracy"
pod 'Permission-LocationAlways', :path => "#{permissions_path}/LocationAlways"
pod 'Permission-LocationWhenInUse', :path => "#{permissions_path}/LocationWhenInUse"

config = use_native_modules!
use_react_native!(:path => config["reactNativePath"])

target 'ExpensifyCashTests' do
Expand Down
32 changes: 31 additions & 1 deletion ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,12 @@ PODS:
- nanopb/decode (1.30906.0)
- nanopb/encode (1.30906.0)
- OpenSSL-Universal (1.1.180)
- Permission-LocationAccuracy (3.0.1):
- RNPermissions
- Permission-LocationAlways (3.0.1):
- RNPermissions
- Permission-LocationWhenInUse (3.0.1):
- RNPermissions
- Plaid (2.1.2)
- PromisesObjC (1.2.12)
- RCTRequired (0.63.3)
Expand Down Expand Up @@ -325,6 +331,8 @@ 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 @@ -425,6 +433,8 @@ PODS:
- RNFBApp
- RNGestureHandler (1.9.0):
- React-Core
- RNPermissions (3.0.1):
- React-Core
- RNReanimated (1.13.2):
- React-Core
- RNScreens (2.17.1):
Expand Down Expand Up @@ -463,6 +473,9 @@ DEPENDENCIES:
- FlipperKit/SKIOSNetworkPlugin (= 0.75.1)
- Folly (from `../node_modules/react-native/third-party-podspecs/Folly.podspec`)
- glog (from `../node_modules/react-native/third-party-podspecs/glog.podspec`)
- Permission-LocationAccuracy (from `../node_modules/react-native-permissions/ios/LocationAccuracy`)
- Permission-LocationAlways (from `../node_modules/react-native-permissions/ios/LocationAlways`)
- Permission-LocationWhenInUse (from `../node_modules/react-native-permissions/ios/LocationWhenInUse`)
- Plaid (~> 2.1.2)
- RCTRequired (from `../node_modules/react-native/Libraries/RCTRequired`)
- RCTTypeSafety (from `../node_modules/react-native/Libraries/TypeSafety`)
Expand All @@ -478,6 +491,7 @@ 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 @@ -505,6 +519,7 @@ DEPENDENCIES:
- "RNFBApp (from `../node_modules/@react-native-firebase/app`)"
- "RNFBCrashlytics (from `../node_modules/@react-native-firebase/crashlytics`)"
- RNGestureHandler (from `../node_modules/react-native-gesture-handler`)
- RNPermissions (from `../node_modules/react-native-permissions`)
- RNReanimated (from `../node_modules/react-native-reanimated`)
- RNScreens (from `../node_modules/react-native-screens`)
- RNSVG (from `../node_modules/react-native-svg`)
Expand Down Expand Up @@ -550,6 +565,12 @@ EXTERNAL SOURCES:
:podspec: "../node_modules/react-native/third-party-podspecs/Folly.podspec"
glog:
:podspec: "../node_modules/react-native/third-party-podspecs/glog.podspec"
Permission-LocationAccuracy:
:path: "../node_modules/react-native-permissions/ios/LocationAccuracy"
Permission-LocationAlways:
:path: "../node_modules/react-native-permissions/ios/LocationAlways"
Permission-LocationWhenInUse:
:path: "../node_modules/react-native-permissions/ios/LocationWhenInUse"
RCTRequired:
:path: "../node_modules/react-native/Libraries/RCTRequired"
RCTTypeSafety:
Expand All @@ -574,6 +595,8 @@ 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 @@ -628,6 +651,8 @@ EXTERNAL SOURCES:
:path: "../node_modules/@react-native-firebase/crashlytics"
RNGestureHandler:
:path: "../node_modules/react-native-gesture-handler"
RNPermissions:
:path: "../node_modules/react-native-permissions"
RNReanimated:
:path: "../node_modules/react-native-reanimated"
RNScreens:
Expand Down Expand Up @@ -667,6 +692,9 @@ SPEC CHECKSUMS:
libevent: 4049cae6c81cdb3654a443be001fb9bdceff7913
nanopb: 59317e09cf1f1a0af72f12af412d54edf52603fc
OpenSSL-Universal: 1aa4f6a6ee7256b83db99ec1ccdaa80d10f9af9b
Permission-LocationAccuracy: e8adff9ede1b23b43b7054a4500113d515fc87a8
Permission-LocationAlways: 7f7f373d086af7a81b2f4f20d65d29266ca2043b
Permission-LocationWhenInUse: 3ae82a9feb5da4e94e386dba17c7dd3531af9feb
Plaid: c02276ccc630a726a9ed790bf923d29839ff4017
PromisesObjC: 3113f7f76903778cf4a0586bd1ab89329a0b7b97
RCTRequired: 48884c74035a0b5b76dbb7a998bd93bcfc5f2047
Expand All @@ -681,6 +709,7 @@ SPEC CHECKSUMS:
React-jsinspector: 8e68ffbfe23880d3ee9bafa8be2777f60b25cbe2
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 Expand Up @@ -708,13 +737,14 @@ SPEC CHECKSUMS:
RNFBApp: 7eacc7da7ab19f96c05e434017d44a9f09410da8
RNFBCrashlytics: 4870c14cf8833053b6b5648911abefe1923854d2
RNGestureHandler: 9b7e605a741412e20e13c512738a31bd1611759b
RNPermissions: eb94f9fdc0a8ecd02fcce0676d56ffb1395d41e1
RNReanimated: e03f7425cb7a38dcf1b644d680d1bfc91c3337ad
RNScreens: b6c9607e6fe47c1b6e2f1910d2acd46dd7ecea3a
RNSVG: ce9d996113475209013317e48b05c21ee988d42e
urbanairship-react-native: dfb6dc22b2f41ccaadd636b73d51b448cd1b2bbc
Yoga: 7d13633d129fd179e01b8953d38d47be90db185a
YogaKit: f782866e155069a2cca2517aafea43200b01fd5a

PODFILE CHECKSUM: 6eb5d43e785faa9b1fe52688d5bf7a328bd1b1cf
PODFILE CHECKSUM: e2cbcef0a80ad10b622900511a519e73949d415d

COCOAPODS: 1.10.1
10 changes: 10 additions & 0 deletions package-lock.json

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

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,15 @@
"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",
"react-native-keyboard-spacer": "^0.4.1",
"react-native-modal": "^11.5.6",
"react-native-onyx": "git+https://github.com/Expensify/react-native-onyx.git#586c76e7b90dbbde051d7ec7adbc4d53b2d51cd1",
"react-native-pdf": "^6.2.2",
"react-native-permissions": "^3.0.1",
"react-native-picker-select": "8.0.4",
"react-native-plaid-link-sdk": "^7.0.5",
"react-native-reanimated": "1.13.2",
Expand Down
4 changes: 4 additions & 0 deletions src/ONYXKEYS.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ export default {
// Contains all the personalDetails the user has access to
PERSONAL_DETAILS: 'personalDetails',

// Contains a list of all currencies available to the user - user can
// select a currency based on the list
CURRENCY_LIST: 'currencyList',

// Indicates whether an update is available and ready to beinstalled.
UPDATE_AVAILABLE: 'updateAvailable',

Expand Down
6 changes: 5 additions & 1 deletion src/ROUTES.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,13 @@ export default {
REPORT,
REPORT_WITH_ID: 'r/:reportID',
getReportRoute: reportID => `r/${reportID}`,
IOU_BILL_CURRENCY: 'iou/split/:reportID/currency',
IOU_REQUEST_CURRENCY: 'iou/request/:reportID/currency',
getIouRequestCurrencyRoute: reportID => `iou/request/${reportID}/currency`,
getIouBillCurrencyRoute: reportID => `iou/split/${reportID}/currency`,
IOU_REQUEST: 'iou/request/:reportID',
getIouRequestRoute: reportID => `iou/request/${reportID}`,
IOU_BILL: 'iou/split/:reportID',
getIouRequestRoute: reportID => `iou/request/${reportID}`,
getIouSplitRoute: reportID => `iou/split/${reportID}`,
IOU_DETAILS: 'iou/details',
IOU_DETAILS_WITH_IOU_REPORT_ID: 'iou/details/:chatReportID/:iouReportID/',
Expand Down
Loading