Skip to content

Commit c435734

Browse files
author
Hayata Suenaga
authored
Merge pull request #24306 from Expensify/hayata-add-map
Integrate Mapbox in App
2 parents 08b75f3 + b68032f commit c435734

File tree

20 files changed

+1473
-58
lines changed

20 files changed

+1473
-58
lines changed

.github/actions/composite/buildAndroidAPK/action.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ runs:
1111
steps:
1212
- uses: Expensify/App/.github/actions/composite/setupNode@main
1313

14+
- name: Setup credentails for Mapbox SDK
15+
run: ./scripts/setup-mapbox-sdk.sh ${{ secrets.MAPBOX_SDK_DOWNLOAD_TOKEN }}
16+
shell: bash
17+
1418
- uses: ruby/setup-ruby@eae47962baca661befdfd24e4d6c34ade04858f7
1519
with:
1620
ruby-version: '2.7'

.github/workflows/platformDeploy.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,9 @@ jobs:
151151
ruby-version: '2.7'
152152
bundler-cache: true
153153

154+
- name: Setup credentails for Mapbox SDK
155+
run: ./scripts/setup-mapbox-sdk.sh ${{ secrets.MAPBOX_SDK_DOWNLOAD_TOKEN }}
156+
154157
- name: Install cocoapods
155158
uses: nick-invision/retry@0711ba3d7808574133d713a0d92d2941be03a350
156159
with:
@@ -241,6 +244,9 @@ jobs:
241244
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
242245
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
243246

247+
- name: Setup credentails for Mapbox SDK
248+
run: ./scripts/setup-mapbox-sdk.sh ${{ secrets.MAPBOX_SDK_DOWNLOAD_TOKEN }}
249+
244250
- name: Build web for production
245251
if: ${{ fromJSON(env.SHOULD_DEPLOY_PRODUCTION) }}
246252
run: npm run build

.github/workflows/testBuild.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ jobs:
8080
sed -i 's/ENVIRONMENT=staging/ENVIRONMENT=adhoc/' .env.adhoc
8181
echo "PULL_REQUEST_NUMBER=$PULL_REQUEST_NUMBER" >> .env.adhoc
8282
83-
- uses: Expensify/App/.github/actions/composite/setupNode@main
83+
- uses: ./.github/actions/composite/setupNode
8484

8585
- uses: ruby/setup-ruby@eae47962baca661befdfd24e4d6c34ade04858f7
8686
with:
@@ -103,6 +103,9 @@ jobs:
103103
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
104104
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
105105

106+
- name: Setup credentails for Mapbox SDK
107+
run: ./scripts/setup-mapbox-sdk.sh ${{ secrets.MAPBOX_SDK_DOWNLOAD_TOKEN }}
108+
106109
- name: Run Fastlane beta test
107110
id: runFastlaneBetaTest
108111
run: bundle exec fastlane android build_internal
@@ -148,6 +151,9 @@ jobs:
148151
ruby-version: '2.7'
149152
bundler-cache: true
150153

154+
- name: Setup credentails for Mapbox SDK
155+
run: ./scripts/setup-mapbox-sdk.sh ${{ secrets.MAPBOX_SDK_DOWNLOAD_TOKEN }}
156+
151157
- name: Install cocoapods
152158
uses: nick-invision/retry@0711ba3d7808574133d713a0d92d2941be03a350
153159
with:

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,14 @@ For an M1 Mac, read this [SO](https://stackoverflow.com/c/expensify/questions/11
5050
* Install project gems, including cocoapods, using bundler to ensure everyone uses the same versions. In the project root, run: `bundle install`
5151
* If you get the error `Could not find 'bundler'`, install the bundler gem first: `gem install bundler` and try again.
5252
* If you are using MacOS and get the error `Gem::FilePermissionError` when trying to install the bundler gem, you're likely using system Ruby, which requires administrator permission to modify. To get around this, install another version of Ruby with a version manager like [rbenv](https://github.com/rbenv/rbenv#installation).
53+
* Before installing iOS dependencies, you need to obtain a token from Mapbox to download their SDKs. Please run `npm run configure-mapbox` and follow the instructions.
5354
* To install the iOS dependencies, run: `npm install && npm run pod-install`
5455
* If you are an Expensify employee and want to point the emulator to your local VM, follow [this](https://stackoverflow.com/c/expensify/questions/7699)
5556
* To run a on a **Development Simulator**: `npm run ios`
5657
* Changes applied to Javascript will be applied automatically, any changes to native code will require a recompile
5758

5859
## Running the Android app 🤖
59-
* To install the Android dependencies, run: `npm install`
60+
* Before installing Android dependencies, you need to obtain a token from Mapbox to download their SDKs. Please run `npm run configure-mapbox` and follow the instructions. If you already did this step for iOS, there is no need to repeat this step.
6061
* Go through the instructions on [this SO post](https://stackoverflow.com/c/expensify/questions/13283/13284#13284) to start running the app on android.
6162
* For more information, go through the official React-Native instructions on [this page](https://reactnative.dev/docs/environment-setup#development-os) for "React Native CLI Quickstart" > Mac OS > Android
6263
* If you are an Expensify employee and want to point the emulator to your local VM, follow [this](https://stackoverflow.com/c/expensify/questions/7699)

android/build.gradle

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ buildscript {
1414
multiDexEnabled = true
1515
googlePlayServicesVersion = "17.0.0"
1616
kotlinVersion = '1.6.20'
17+
18+
// This property configures the type of Mapbox SDK used by the @rnmapbox/maps library.
19+
// "mapbox" indicates the usage of the Mapbox SDK.
20+
RNMapboxMapsImpl = "mapbox"
1721
}
1822
repositories {
1923
google()
@@ -48,5 +52,23 @@ allprojects {
4852
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
4953
url("$rootDir/../node_modules/react-native/android")
5054
}
55+
maven {
56+
// Mapbox SDK requires authentication to download from Mapbox's private Maven repository.
57+
url 'https://api.mapbox.com/downloads/v2/releases/maven'
58+
authentication {
59+
basic(BasicAuthentication)
60+
}
61+
credentials {
62+
// 'mapbox' is the fixed username for Mapbox's Maven repository.
63+
username = 'mapbox'
64+
65+
// The value for password is read from the 'MAPBOX_DOWNLOADS_TOKEN' gradle property.
66+
// Run "npm run setup-mapbox-sdk" to set this property in «USER_HOME»/.gradle/gradle.properties
67+
68+
// Example gradle.properties entry:
69+
// MAPBOX_DOWNLOADS_TOKEN=YOUR_SECRET_TOKEN_HERE
70+
password = project.properties['MAPBOX_DOWNLOADS_TOKEN'] ?: ""
71+
}
72+
}
5173
}
52-
}
74+
}
Lines changed: 43 additions & 0 deletions
Loading

ios/NewExpensify.xcodeproj/project.pbxproj

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,17 +384,27 @@
384384
);
385385
inputPaths = (
386386
"${PODS_ROOT}/Target Support Files/Pods-NewExpensify/Pods-NewExpensify-frameworks.sh",
387+
"${BUILT_PRODUCTS_DIR}/MapboxMaps/MapboxMaps.framework",
388+
"${BUILT_PRODUCTS_DIR}/Turf/Turf.framework",
387389
"${PODS_XCFRAMEWORKS_BUILD_DIR}/Flipper-DoubleConversion/double-conversion.framework/double-conversion",
388390
"${PODS_XCFRAMEWORKS_BUILD_DIR}/Flipper-Glog/glog.framework/glog",
391+
"${PODS_XCFRAMEWORKS_BUILD_DIR}/MapboxCommon/MapboxCommon.framework/MapboxCommon",
392+
"${PODS_XCFRAMEWORKS_BUILD_DIR}/MapboxCoreMaps/MapboxCoreMaps.framework/MapboxCoreMaps",
393+
"${PODS_XCFRAMEWORKS_BUILD_DIR}/MapboxMobileEvents/MapboxMobileEvents.framework/MapboxMobileEvents",
389394
"${PODS_XCFRAMEWORKS_BUILD_DIR}/Onfido/Onfido.framework/Onfido",
390395
"${PODS_XCFRAMEWORKS_BUILD_DIR}/OpenSSL-Universal/OpenSSL.framework/OpenSSL",
391396
"${PODS_XCFRAMEWORKS_BUILD_DIR}/Plaid/LinkKit.framework/LinkKit",
392397
"${PODS_XCFRAMEWORKS_BUILD_DIR}/hermes-engine/Pre-built/hermes.framework/hermes",
393398
);
394399
name = "[CP] Embed Pods Frameworks";
395400
outputPaths = (
401+
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MapboxMaps.framework",
402+
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Turf.framework",
396403
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/double-conversion.framework",
397404
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/glog.framework",
405+
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MapboxCommon.framework",
406+
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MapboxCoreMaps.framework",
407+
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MapboxMobileEvents.framework",
398408
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Onfido.framework",
399409
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/OpenSSL.framework",
400410
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/LinkKit.framework",
@@ -455,17 +465,27 @@
455465
);
456466
inputPaths = (
457467
"${PODS_ROOT}/Target Support Files/Pods-NewExpensify-NewExpensifyTests/Pods-NewExpensify-NewExpensifyTests-frameworks.sh",
468+
"${BUILT_PRODUCTS_DIR}/MapboxMaps/MapboxMaps.framework",
469+
"${BUILT_PRODUCTS_DIR}/Turf/Turf.framework",
458470
"${PODS_XCFRAMEWORKS_BUILD_DIR}/Flipper-DoubleConversion/double-conversion.framework/double-conversion",
459471
"${PODS_XCFRAMEWORKS_BUILD_DIR}/Flipper-Glog/glog.framework/glog",
472+
"${PODS_XCFRAMEWORKS_BUILD_DIR}/MapboxCommon/MapboxCommon.framework/MapboxCommon",
473+
"${PODS_XCFRAMEWORKS_BUILD_DIR}/MapboxCoreMaps/MapboxCoreMaps.framework/MapboxCoreMaps",
474+
"${PODS_XCFRAMEWORKS_BUILD_DIR}/MapboxMobileEvents/MapboxMobileEvents.framework/MapboxMobileEvents",
460475
"${PODS_XCFRAMEWORKS_BUILD_DIR}/Onfido/Onfido.framework/Onfido",
461476
"${PODS_XCFRAMEWORKS_BUILD_DIR}/OpenSSL-Universal/OpenSSL.framework/OpenSSL",
462477
"${PODS_XCFRAMEWORKS_BUILD_DIR}/Plaid/LinkKit.framework/LinkKit",
463478
"${PODS_XCFRAMEWORKS_BUILD_DIR}/hermes-engine/Pre-built/hermes.framework/hermes",
464479
);
465480
name = "[CP] Embed Pods Frameworks";
466481
outputPaths = (
482+
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MapboxMaps.framework",
483+
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Turf.framework",
467484
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/double-conversion.framework",
468485
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/glog.framework",
486+
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MapboxCommon.framework",
487+
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MapboxCoreMaps.framework",
488+
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MapboxMobileEvents.framework",
469489
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Onfido.framework",
470490
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/OpenSSL.framework",
471491
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/LinkKit.framework",

ios/Podfile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# Set the type of Mapbox SDK to use
2+
# This value is used by $RNMapboxMaps
3+
$RNMapboxMapsImpl = 'mapbox'
4+
15
# Resolve react_native_pods.rb with node to allow for hoisting
26
require Pod::Executable.execute_command('node', ['-p',
37
'require.resolve(
@@ -41,6 +45,11 @@ def __apply_Xcode_14_3_RC_post_install_workaround(installer)
4145
end
4246
end
4347

48+
# Configure Mapbox before installing dependencies
49+
pre_install do |installer|
50+
$RNMapboxMaps.pre_install(installer)
51+
end
52+
4453
target 'NewExpensify' do
4554
permissions_path = '../node_modules/react-native-permissions/ios'
4655

@@ -83,6 +92,9 @@ target 'NewExpensify' do
8392
end
8493

8594
post_install do |installer|
95+
# Configure Mapbox after installation
96+
$RNMapboxMaps.post_install(installer)
97+
8698
# https://github.com/facebook/react-native/blob/main/scripts/react_native_pods.rb#L197-L202
8799
react_native_post_install(
88100
installer,

ios/Podfile.lock

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,15 @@ PODS:
237237
- lottie-react-native (5.1.6):
238238
- lottie-ios (~> 3.4.0)
239239
- React-Core
240+
- MapboxCommon (23.6.0)
241+
- MapboxCoreMaps (10.14.0):
242+
- MapboxCommon (~> 23.6)
243+
- MapboxMaps (10.14.0):
244+
- MapboxCommon (= 23.6.0)
245+
- MapboxCoreMaps (= 10.14.0)
246+
- MapboxMobileEvents (= 1.0.10)
247+
- Turf (~> 2.0)
248+
- MapboxMobileEvents (1.0.10)
240249
- nanopb (2.30908.0):
241250
- nanopb/decode (= 2.30908.0)
242251
- nanopb/encode (= 2.30908.0)
@@ -759,6 +768,17 @@ PODS:
759768
- React-Core
760769
- RNLocalize (2.2.6):
761770
- React-Core
771+
- rnmapbox-maps (10.0.11):
772+
- MapboxMaps (~> 10.14.0)
773+
- React
774+
- React-Core
775+
- rnmapbox-maps/DynamicLibrary (= 10.0.11)
776+
- Turf
777+
- rnmapbox-maps/DynamicLibrary (10.0.11):
778+
- MapboxMaps (~> 10.14.0)
779+
- React
780+
- React-Core
781+
- Turf
762782
- RNPermissions (3.6.1):
763783
- React-Core
764784
- RNReactNativeHapticFeedback (1.14.0):
@@ -804,6 +824,7 @@ PODS:
804824
- libwebp (~> 1.0)
805825
- SDWebImage/Core (~> 5.10)
806826
- SocketRocket (0.6.1)
827+
- Turf (2.6.1)
807828
- VisionCamera (2.15.4):
808829
- React
809830
- React-callinvoker
@@ -917,6 +938,7 @@ DEPENDENCIES:
917938
- RNGestureHandler (from `../node_modules/react-native-gesture-handler`)
918939
- "RNGoogleSignin (from `../node_modules/@react-native-google-signin/google-signin`)"
919940
- RNLocalize (from `../node_modules/react-native-localize`)
941+
- "rnmapbox-maps (from `../node_modules/@rnmapbox/maps`)"
920942
- RNPermissions (from `../node_modules/react-native-permissions`)
921943
- RNReactNativeHapticFeedback (from `../node_modules/react-native-haptic-feedback`)
922944
- RNReanimated (from `../node_modules/react-native-reanimated`)
@@ -958,6 +980,10 @@ SPEC REPOS:
958980
- libevent
959981
- libwebp
960982
- lottie-ios
983+
- MapboxCommon
984+
- MapboxCoreMaps
985+
- MapboxMaps
986+
- MapboxMobileEvents
961987
- nanopb
962988
- Onfido
963989
- OpenSSL-Universal
@@ -966,6 +992,7 @@ SPEC REPOS:
966992
- SDWebImage
967993
- SDWebImageWebPCoder
968994
- SocketRocket
995+
- Turf
969996
- YogaKit
970997

971998
EXTERNAL SOURCES:
@@ -1130,6 +1157,8 @@ EXTERNAL SOURCES:
11301157
:path: "../node_modules/@react-native-google-signin/google-signin"
11311158
RNLocalize:
11321159
:path: "../node_modules/react-native-localize"
1160+
rnmapbox-maps:
1161+
:path: "../node_modules/@rnmapbox/maps"
11331162
RNPermissions:
11341163
:path: "../node_modules/react-native-permissions"
11351164
RNReactNativeHapticFeedback:
@@ -1185,6 +1214,10 @@ SPEC CHECKSUMS:
11851214
libwebp: f62cb61d0a484ba548448a4bd52aabf150ff6eef
11861215
lottie-ios: 8f97d3271e155c2d688875c29cd3c74908aef5f8
11871216
lottie-react-native: 8f9d4be452e23f6e5ca0fdc11669dc99ab52be81
1217+
MapboxCommon: 4a0251dd470ee37e7fadda8e285c01921a5e1eb0
1218+
MapboxCoreMaps: eb07203bbb0b1509395db5ab89cd3ad6c2e3c04c
1219+
MapboxMaps: af50ec61a7eb3b032c3f7962c6bd671d93d2a209
1220+
MapboxMobileEvents: de50b3a4de180dd129c326e09cd12c8adaaa46d6
11881221
nanopb: a0ba3315591a9ae0a16a309ee504766e90db0c96
11891222
Onfido: e36f284b865adcf99d9c905590a64ac09d4a576b
11901223
onfido-react-native-sdk: 4ecde1a97435dcff9f00a878e3f8d1eb14fabbdc
@@ -1262,6 +1295,7 @@ SPEC CHECKSUMS:
12621295
RNGestureHandler: dec4645026e7401a0899f2846d864403478ff6a5
12631296
RNGoogleSignin: ccaa4a81582cf713eea562c5dd9dc1961a715fd0
12641297
RNLocalize: d4b8af4e442d4bcca54e68fc687a2129b4d71a81
1298+
rnmapbox-maps: 6f638ec002aa6e906a6f766d69cd45f968d98e64
12651299
RNPermissions: dcdb7b99796bbeda6975a6e79ad519c41b251b1c
12661300
RNReactNativeHapticFeedback: 1e3efeca9628ff9876ee7cdd9edec1b336913f8c
12671301
RNReanimated: 020859659f64be2d30849a1fe88c821a7c3e0cbf
@@ -1270,10 +1304,11 @@ SPEC CHECKSUMS:
12701304
SDWebImage: a7f831e1a65eb5e285e3fb046a23fcfbf08e696d
12711305
SDWebImageWebPCoder: 908b83b6adda48effe7667cd2b7f78c897e5111d
12721306
SocketRocket: f32cd54efbe0f095c4d7594881e52619cfe80b17
1307+
Turf: 469ce2c3d22e5e8e4818d5a3b254699a5c89efa4
12731308
VisionCamera: d3ec8883417a6a4a0e3a6ba37d81d22db7611601
12741309
Yoga: 8796b55dba14d7004f980b54bcc9833ee45b28ce
12751310
YogaKit: f782866e155069a2cca2517aafea43200b01fd5a
12761311

1277-
PODFILE CHECKSUM: ff7c8276619cfa428c00b8439045ffd134df7eb8
1312+
PODFILE CHECKSUM: 845537d35601574adcd0794e17003ba7dbccdbfd
12781313

12791314
COCOAPODS: 1.12.1

0 commit comments

Comments
 (0)