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 #3015

Closed
wants to merge 52 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 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
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"
}
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
56 changes: 43 additions & 13 deletions 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: 76669f87b4c276f5ae803cc0ddd1862a4c0e9dd8
Permission-LocationAlways: a274bc04bb386068782468dbdaca3859f51634ca
Permission-LocationWhenInUse: 3a2b0dbc167d79e8e920a4377ff9520cdc108407
Plaid: c02276ccc630a726a9ed790bf923d29839ff4017
PromisesObjC: 3113f7f76903778cf4a0586bd1ab89329a0b7b97
RCTRequired: 48884c74035a0b5b76dbb7a998bd93bcfc5f2047
Expand All @@ -680,14 +708,15 @@ SPEC CHECKSUMS:
React-jsiexecutor: b56c03e61c0dd5f5801255f2160a815f4a53d451
React-jsinspector: 8e68ffbfe23880d3ee9bafa8be2777f60b25cbe2
react-native-config: d8b45133fd13d4f23bd2064b72f6e2c08b2763ed
react-native-document-picker: b3e78a8f7fef98b5cb069f20fc35797d55e68e28
react-native-image-picker: 32d1ad2c0024ca36161ae0d5c2117e2d6c441f11
react-native-netinfo: 52cf0ee8342548a485e28f4b09e56b477567244d
react-native-document-picker: 0bba80cc56caab1f67dbaa81ff557e3a9b7f2b9f
react-native-geolocation-service: 7c9436da6dfdecd9526c62eac62ea2bc3f0cc8ea
react-native-image-picker: c6d75c4ab2cf46f9289f341242b219cb3c1180d3
react-native-netinfo: 30fb89fa913c342be82a887b56e96be6d71201dd
react-native-pdf: 4b5a9e4465a6a3b399e91dc4838eb44ddf716d1f
react-native-plaid-link-sdk: 1a6593e2d3d790e8113c29178d883eb883f8c032
react-native-progress-bar-android: ce95a69f11ac580799021633071368d08aaf9ad8
react-native-progress-view: 5816e8a6be812c2b122c6225a2a3db82d9008640
react-native-safe-area-context: 01158a92c300895d79dee447e980672dc3fb85a6
react-native-plaid-link-sdk: 59b7376efca9f00e9693321c5cf7c6ab2c567635
react-native-progress-bar-android: be43138ab7da30d51fc038bafa98e9ed594d0c40
react-native-progress-view: 21b1e29e70c7559c16c9e0a04c4adc19fce6ede2
react-native-safe-area-context: 79fea126c6830c85f65947c223a5e3058a666937
React-RCTActionSheet: 53ea72699698b0b47a6421cb1c8b4ab215a774aa
React-RCTAnimation: 1befece0b5183c22ae01b966f5583f42e69a83c2
React-RCTBlob: 0b284339cbe4b15705a05e2313a51c6d8b51fa40
Expand All @@ -699,22 +728,23 @@ SPEC CHECKSUMS:
React-RCTVibration: 8e9fb25724a0805107fc1acc9075e26f814df454
ReactCommon: 4167844018c9ed375cc01a843e9ee564399e53c3
rn-fetch-blob: f065bb7ab7fb48dd002629f8bdcb0336602d3cba
RNBootSplash: 3123ba68fe44d8be09a014e89cc8f0f55b68a521
RNCAsyncStorage: cb9a623793918c6699586281f0b51cbc38f046f9
RNCClipboard: 5e299c6df8e0c98f3d7416b86ae563d3a9f768a3
RNCMaskedView: f5c7d14d6847b7b44853f7acb6284c1da30a3459
RNBootSplash: 24175aa28fe203b10c48dc34e78d946fd33c77af
RNCAsyncStorage: b03032fdbdb725bea0bd9e5ec5a7272865ae7398
RNCClipboard: 41d8d918092ae8e676f18adada19104fa3e68495
RNCMaskedView: 5a8ec07677aa885546a0d98da336457e2bea557f
RNCPicker: 6780c753e9e674065db90d9c965920516402579d
RNFBAnalytics: 2dc4dd9e2445faffca041b10447a23a71dcdabf8
RNFBApp: 7eacc7da7ab19f96c05e434017d44a9f09410da8
RNFBCrashlytics: 4870c14cf8833053b6b5648911abefe1923854d2
RNGestureHandler: 9b7e605a741412e20e13c512738a31bd1611759b
RNPermissions: 4c8a37b4dde50f1f152bf8cd08c4a43d2355829e
RNReanimated: e03f7425cb7a38dcf1b644d680d1bfc91c3337ad
RNScreens: b6c9607e6fe47c1b6e2f1910d2acd46dd7ecea3a
RNSVG: ce9d996113475209013317e48b05c21ee988d42e
urbanairship-react-native: dfb6dc22b2f41ccaadd636b73d51b448cd1b2bbc
urbanairship-react-native: afab7684561909be2a6a2a52baa3435776d050de
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