Skip to content

Commit

Permalink
Merge pull request Expensify#24306 from Expensify/hayata-add-map
Browse files Browse the repository at this point in the history
Integrate Mapbox in App
  • Loading branch information
Hayata Suenaga authored Aug 18, 2023
2 parents 08b75f3 + b68032f commit c435734
Show file tree
Hide file tree
Showing 20 changed files with 1,473 additions and 58 deletions.
4 changes: 4 additions & 0 deletions .github/actions/composite/buildAndroidAPK/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ runs:
steps:
- uses: Expensify/App/.github/actions/composite/setupNode@main

- name: Setup credentails for Mapbox SDK
run: ./scripts/setup-mapbox-sdk.sh ${{ secrets.MAPBOX_SDK_DOWNLOAD_TOKEN }}
shell: bash

- uses: ruby/setup-ruby@eae47962baca661befdfd24e4d6c34ade04858f7
with:
ruby-version: '2.7'
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/platformDeploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,9 @@ jobs:
ruby-version: '2.7'
bundler-cache: true

- name: Setup credentails for Mapbox SDK
run: ./scripts/setup-mapbox-sdk.sh ${{ secrets.MAPBOX_SDK_DOWNLOAD_TOKEN }}

- name: Install cocoapods
uses: nick-invision/retry@0711ba3d7808574133d713a0d92d2941be03a350
with:
Expand Down Expand Up @@ -241,6 +244,9 @@ jobs:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}

- name: Setup credentails for Mapbox SDK
run: ./scripts/setup-mapbox-sdk.sh ${{ secrets.MAPBOX_SDK_DOWNLOAD_TOKEN }}

- name: Build web for production
if: ${{ fromJSON(env.SHOULD_DEPLOY_PRODUCTION) }}
run: npm run build
Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/testBuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ jobs:
sed -i 's/ENVIRONMENT=staging/ENVIRONMENT=adhoc/' .env.adhoc
echo "PULL_REQUEST_NUMBER=$PULL_REQUEST_NUMBER" >> .env.adhoc
- uses: Expensify/App/.github/actions/composite/setupNode@main
- uses: ./.github/actions/composite/setupNode

- uses: ruby/setup-ruby@eae47962baca661befdfd24e4d6c34ade04858f7
with:
Expand All @@ -103,6 +103,9 @@ jobs:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}

- name: Setup credentails for Mapbox SDK
run: ./scripts/setup-mapbox-sdk.sh ${{ secrets.MAPBOX_SDK_DOWNLOAD_TOKEN }}

- name: Run Fastlane beta test
id: runFastlaneBetaTest
run: bundle exec fastlane android build_internal
Expand Down Expand Up @@ -148,6 +151,9 @@ jobs:
ruby-version: '2.7'
bundler-cache: true

- name: Setup credentails for Mapbox SDK
run: ./scripts/setup-mapbox-sdk.sh ${{ secrets.MAPBOX_SDK_DOWNLOAD_TOKEN }}

- name: Install cocoapods
uses: nick-invision/retry@0711ba3d7808574133d713a0d92d2941be03a350
with:
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,14 @@ For an M1 Mac, read this [SO](https://stackoverflow.com/c/expensify/questions/11
* Install project gems, including cocoapods, using bundler to ensure everyone uses the same versions. In the project root, run: `bundle install`
* If you get the error `Could not find 'bundler'`, install the bundler gem first: `gem install bundler` and try again.
* 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).
* 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.
* To install the iOS dependencies, run: `npm install && npm run pod-install`
* 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)
* To run a on a **Development Simulator**: `npm run ios`
* Changes applied to Javascript will be applied automatically, any changes to native code will require a recompile

## Running the Android app 🤖
* To install the Android dependencies, run: `npm install`
* 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.
* Go through the instructions on [this SO post](https://stackoverflow.com/c/expensify/questions/13283/13284#13284) to start running the app on android.
* 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
* 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)
Expand Down
24 changes: 23 additions & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ buildscript {
multiDexEnabled = true
googlePlayServicesVersion = "17.0.0"
kotlinVersion = '1.6.20'

// This property configures the type of Mapbox SDK used by the @rnmapbox/maps library.
// "mapbox" indicates the usage of the Mapbox SDK.
RNMapboxMapsImpl = "mapbox"
}
repositories {
google()
Expand Down Expand Up @@ -48,5 +52,23 @@ allprojects {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url("$rootDir/../node_modules/react-native/android")
}
maven {
// Mapbox SDK requires authentication to download from Mapbox's private Maven repository.
url 'https://api.mapbox.com/downloads/v2/releases/maven'
authentication {
basic(BasicAuthentication)
}
credentials {
// 'mapbox' is the fixed username for Mapbox's Maven repository.
username = 'mapbox'

// The value for password is read from the 'MAPBOX_DOWNLOADS_TOKEN' gradle property.
// Run "npm run setup-mapbox-sdk" to set this property in «USER_HOME»/.gradle/gradle.properties

// Example gradle.properties entry:
// MAPBOX_DOWNLOADS_TOKEN=YOUR_SECRET_TOKEN_HERE
password = project.properties['MAPBOX_DOWNLOADS_TOKEN'] ?: ""
}
}
}
}
}
43 changes: 43 additions & 0 deletions assets/images/emptystate__routepending.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 20 additions & 0 deletions ios/NewExpensify.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -384,17 +384,27 @@
);
inputPaths = (
"${PODS_ROOT}/Target Support Files/Pods-NewExpensify/Pods-NewExpensify-frameworks.sh",
"${BUILT_PRODUCTS_DIR}/MapboxMaps/MapboxMaps.framework",
"${BUILT_PRODUCTS_DIR}/Turf/Turf.framework",
"${PODS_XCFRAMEWORKS_BUILD_DIR}/Flipper-DoubleConversion/double-conversion.framework/double-conversion",
"${PODS_XCFRAMEWORKS_BUILD_DIR}/Flipper-Glog/glog.framework/glog",
"${PODS_XCFRAMEWORKS_BUILD_DIR}/MapboxCommon/MapboxCommon.framework/MapboxCommon",
"${PODS_XCFRAMEWORKS_BUILD_DIR}/MapboxCoreMaps/MapboxCoreMaps.framework/MapboxCoreMaps",
"${PODS_XCFRAMEWORKS_BUILD_DIR}/MapboxMobileEvents/MapboxMobileEvents.framework/MapboxMobileEvents",
"${PODS_XCFRAMEWORKS_BUILD_DIR}/Onfido/Onfido.framework/Onfido",
"${PODS_XCFRAMEWORKS_BUILD_DIR}/OpenSSL-Universal/OpenSSL.framework/OpenSSL",
"${PODS_XCFRAMEWORKS_BUILD_DIR}/Plaid/LinkKit.framework/LinkKit",
"${PODS_XCFRAMEWORKS_BUILD_DIR}/hermes-engine/Pre-built/hermes.framework/hermes",
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MapboxMaps.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Turf.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/double-conversion.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/glog.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MapboxCommon.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MapboxCoreMaps.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MapboxMobileEvents.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Onfido.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/OpenSSL.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/LinkKit.framework",
Expand Down Expand Up @@ -455,17 +465,27 @@
);
inputPaths = (
"${PODS_ROOT}/Target Support Files/Pods-NewExpensify-NewExpensifyTests/Pods-NewExpensify-NewExpensifyTests-frameworks.sh",
"${BUILT_PRODUCTS_DIR}/MapboxMaps/MapboxMaps.framework",
"${BUILT_PRODUCTS_DIR}/Turf/Turf.framework",
"${PODS_XCFRAMEWORKS_BUILD_DIR}/Flipper-DoubleConversion/double-conversion.framework/double-conversion",
"${PODS_XCFRAMEWORKS_BUILD_DIR}/Flipper-Glog/glog.framework/glog",
"${PODS_XCFRAMEWORKS_BUILD_DIR}/MapboxCommon/MapboxCommon.framework/MapboxCommon",
"${PODS_XCFRAMEWORKS_BUILD_DIR}/MapboxCoreMaps/MapboxCoreMaps.framework/MapboxCoreMaps",
"${PODS_XCFRAMEWORKS_BUILD_DIR}/MapboxMobileEvents/MapboxMobileEvents.framework/MapboxMobileEvents",
"${PODS_XCFRAMEWORKS_BUILD_DIR}/Onfido/Onfido.framework/Onfido",
"${PODS_XCFRAMEWORKS_BUILD_DIR}/OpenSSL-Universal/OpenSSL.framework/OpenSSL",
"${PODS_XCFRAMEWORKS_BUILD_DIR}/Plaid/LinkKit.framework/LinkKit",
"${PODS_XCFRAMEWORKS_BUILD_DIR}/hermes-engine/Pre-built/hermes.framework/hermes",
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MapboxMaps.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Turf.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/double-conversion.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/glog.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MapboxCommon.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MapboxCoreMaps.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MapboxMobileEvents.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Onfido.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/OpenSSL.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/LinkKit.framework",
Expand Down
12 changes: 12 additions & 0 deletions ios/Podfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Set the type of Mapbox SDK to use
# This value is used by $RNMapboxMaps
$RNMapboxMapsImpl = 'mapbox'

# Resolve react_native_pods.rb with node to allow for hoisting
require Pod::Executable.execute_command('node', ['-p',
'require.resolve(
Expand Down Expand Up @@ -41,6 +45,11 @@ def __apply_Xcode_14_3_RC_post_install_workaround(installer)
end
end

# Configure Mapbox before installing dependencies
pre_install do |installer|
$RNMapboxMaps.pre_install(installer)
end

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

Expand Down Expand Up @@ -83,6 +92,9 @@ target 'NewExpensify' do
end

post_install do |installer|
# Configure Mapbox after installation
$RNMapboxMaps.post_install(installer)

# https://github.com/facebook/react-native/blob/main/scripts/react_native_pods.rb#L197-L202
react_native_post_install(
installer,
Expand Down
37 changes: 36 additions & 1 deletion ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,15 @@ PODS:
- lottie-react-native (5.1.6):
- lottie-ios (~> 3.4.0)
- React-Core
- MapboxCommon (23.6.0)
- MapboxCoreMaps (10.14.0):
- MapboxCommon (~> 23.6)
- MapboxMaps (10.14.0):
- MapboxCommon (= 23.6.0)
- MapboxCoreMaps (= 10.14.0)
- MapboxMobileEvents (= 1.0.10)
- Turf (~> 2.0)
- MapboxMobileEvents (1.0.10)
- nanopb (2.30908.0):
- nanopb/decode (= 2.30908.0)
- nanopb/encode (= 2.30908.0)
Expand Down Expand Up @@ -759,6 +768,17 @@ PODS:
- React-Core
- RNLocalize (2.2.6):
- React-Core
- rnmapbox-maps (10.0.11):
- MapboxMaps (~> 10.14.0)
- React
- React-Core
- rnmapbox-maps/DynamicLibrary (= 10.0.11)
- Turf
- rnmapbox-maps/DynamicLibrary (10.0.11):
- MapboxMaps (~> 10.14.0)
- React
- React-Core
- Turf
- RNPermissions (3.6.1):
- React-Core
- RNReactNativeHapticFeedback (1.14.0):
Expand Down Expand Up @@ -804,6 +824,7 @@ PODS:
- libwebp (~> 1.0)
- SDWebImage/Core (~> 5.10)
- SocketRocket (0.6.1)
- Turf (2.6.1)
- VisionCamera (2.15.4):
- React
- React-callinvoker
Expand Down Expand Up @@ -917,6 +938,7 @@ DEPENDENCIES:
- RNGestureHandler (from `../node_modules/react-native-gesture-handler`)
- "RNGoogleSignin (from `../node_modules/@react-native-google-signin/google-signin`)"
- RNLocalize (from `../node_modules/react-native-localize`)
- "rnmapbox-maps (from `../node_modules/@rnmapbox/maps`)"
- RNPermissions (from `../node_modules/react-native-permissions`)
- RNReactNativeHapticFeedback (from `../node_modules/react-native-haptic-feedback`)
- RNReanimated (from `../node_modules/react-native-reanimated`)
Expand Down Expand Up @@ -958,6 +980,10 @@ SPEC REPOS:
- libevent
- libwebp
- lottie-ios
- MapboxCommon
- MapboxCoreMaps
- MapboxMaps
- MapboxMobileEvents
- nanopb
- Onfido
- OpenSSL-Universal
Expand All @@ -966,6 +992,7 @@ SPEC REPOS:
- SDWebImage
- SDWebImageWebPCoder
- SocketRocket
- Turf
- YogaKit

EXTERNAL SOURCES:
Expand Down Expand Up @@ -1130,6 +1157,8 @@ EXTERNAL SOURCES:
:path: "../node_modules/@react-native-google-signin/google-signin"
RNLocalize:
:path: "../node_modules/react-native-localize"
rnmapbox-maps:
:path: "../node_modules/@rnmapbox/maps"
RNPermissions:
:path: "../node_modules/react-native-permissions"
RNReactNativeHapticFeedback:
Expand Down Expand Up @@ -1185,6 +1214,10 @@ SPEC CHECKSUMS:
libwebp: f62cb61d0a484ba548448a4bd52aabf150ff6eef
lottie-ios: 8f97d3271e155c2d688875c29cd3c74908aef5f8
lottie-react-native: 8f9d4be452e23f6e5ca0fdc11669dc99ab52be81
MapboxCommon: 4a0251dd470ee37e7fadda8e285c01921a5e1eb0
MapboxCoreMaps: eb07203bbb0b1509395db5ab89cd3ad6c2e3c04c
MapboxMaps: af50ec61a7eb3b032c3f7962c6bd671d93d2a209
MapboxMobileEvents: de50b3a4de180dd129c326e09cd12c8adaaa46d6
nanopb: a0ba3315591a9ae0a16a309ee504766e90db0c96
Onfido: e36f284b865adcf99d9c905590a64ac09d4a576b
onfido-react-native-sdk: 4ecde1a97435dcff9f00a878e3f8d1eb14fabbdc
Expand Down Expand Up @@ -1262,6 +1295,7 @@ SPEC CHECKSUMS:
RNGestureHandler: dec4645026e7401a0899f2846d864403478ff6a5
RNGoogleSignin: ccaa4a81582cf713eea562c5dd9dc1961a715fd0
RNLocalize: d4b8af4e442d4bcca54e68fc687a2129b4d71a81
rnmapbox-maps: 6f638ec002aa6e906a6f766d69cd45f968d98e64
RNPermissions: dcdb7b99796bbeda6975a6e79ad519c41b251b1c
RNReactNativeHapticFeedback: 1e3efeca9628ff9876ee7cdd9edec1b336913f8c
RNReanimated: 020859659f64be2d30849a1fe88c821a7c3e0cbf
Expand All @@ -1270,10 +1304,11 @@ SPEC CHECKSUMS:
SDWebImage: a7f831e1a65eb5e285e3fb046a23fcfbf08e696d
SDWebImageWebPCoder: 908b83b6adda48effe7667cd2b7f78c897e5111d
SocketRocket: f32cd54efbe0f095c4d7594881e52619cfe80b17
Turf: 469ce2c3d22e5e8e4818d5a3b254699a5c89efa4
VisionCamera: d3ec8883417a6a4a0e3a6ba37d81d22db7611601
Yoga: 8796b55dba14d7004f980b54bcc9833ee45b28ce
YogaKit: f782866e155069a2cca2517aafea43200b01fd5a

PODFILE CHECKSUM: ff7c8276619cfa428c00b8439045ffd134df7eb8
PODFILE CHECKSUM: 845537d35601574adcd0794e17003ba7dbccdbfd

COCOAPODS: 1.12.1
Loading

0 comments on commit c435734

Please sign in to comment.