From 30b0f430cb5ec08b2372dacd84d42d39801648ed Mon Sep 17 00:00:00 2001 From: Vitor Pamplona Date: Mon, 16 Mar 2020 15:36:07 -0400 Subject: [PATCH] Andynuzzo/fix require cycles + Clearing all Warnings and Bug Fixes for iOS (#67) * updated README.md Made changes for developers on macOS with Xcode 10+ * Fixed Async storage, request cycles warnings * using patch-package to work around RNFetchBlob recursive importing * saving patch for RNFetchBlob recursive importing * Putting native background geo back. * re-fix AsyncStorage * Fixing Background services not existing on iOS * Fixing Internationalization on Xcode * Import Alert and add stationarylocation logging * capitalize L Co-authored-by: Andy Nuzzo <36167533+andreanuzzo@users.noreply.github.com> Co-authored-by: philrouge Co-authored-by: Abhishek Singh --- README.md | 11 +- android/app/build.gradle | 1 - android/settings.gradle | 4 +- app/helpers/General.js | 2 +- app/services/LocationService.js | 24 ++-- dev_setup2.sh | 176 +++++++++++++++++++++++ ios/Podfile.lock | 38 +++++ ios/PrivateKit.xcodeproj/project.pbxproj | 42 +----- package.json | 12 +- patches/rn-fetch-blob+0.12.0.patch | 62 ++++++++ yarn.lock | 109 +++++++++++++- 11 files changed, 419 insertions(+), 62 deletions(-) create mode 100644 dev_setup2.sh create mode 100644 patches/rn-fetch-blob+0.12.0.patch diff --git a/README.md b/README.md index 02b21c480d..1f9769af7b 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ A personal location vault that nobody else can access. Log your location privately every five minutes. No information will leave the phone. -**Downloads:** [Google Play](https://play.google.com/store/apps/details?id=edu.mit.privatekit) | Apple App Stored - coming soon! +**Downloads:** [Google Play](https://play.google.com/store/apps/details?id=edu.mit.privatekit) | Apple App Store - coming soon! **Home page:** http://privatekit.mit.edu @@ -24,15 +24,14 @@ Refer to and run the dev_setup.sh for needed tools. ### iOS Configuration - First Time Setup -1. pod install in `ios` directory -2. Open `.workspace` file in the iOS directory and run `build` -3. If you have any trouble with packages not round, try `react-native link` from project directory. -4. Look at running commands below. +1. Move to `ios` directory and run `pod install` +2. If you have any trouble with packages not round, try `react-native link` from project directory. +3. Look at running commands below. ## Running Install modules: -```npm install``` or ```yarn install``` +```npm install``` or ```yarn install``` (note ```yarn``` does a better job at installing dependencies on macOS) To run, do: ``` diff --git a/android/app/build.gradle b/android/app/build.gradle index 7b9f99295d..9248f7da4f 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -194,7 +194,6 @@ dependencies { implementation project(':react-native-webview') implementation fileTree(dir: "libs", include: ["*.jar"]) implementation "com.facebook.react:react-native:+" // From node_modules - implementation project(':@mauron85_react-native-background-geolocation') implementation "androidx.annotation:annotation:1.1.0" compile project(':react-native-fs') diff --git a/android/settings.gradle b/android/settings.gradle index c37c8f224a..802caf4718 100644 --- a/android/settings.gradle +++ b/android/settings.gradle @@ -5,9 +5,9 @@ include ':react-native-zip-archive' project(':react-native-zip-archive').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-zip-archive/android') include ':react-native-webview' project(':react-native-webview').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-webview/android') -include ':@mauron85_react-native-background-geolocation-common' -project(':@mauron85_react-native-background-geolocation-common').projectDir = new File(rootProject.projectDir, '../node_modules/@mauron85/react-native-background-geolocation/android/common') include ':@mauron85_react-native-background-geolocation' project(':@mauron85_react-native-background-geolocation').projectDir = new File(rootProject.projectDir, '../node_modules/@mauron85/react-native-background-geolocation/android/lib') +include ':@mauron85_react-native-background-geolocation-common' +project(':@mauron85_react-native-background-geolocation-common').projectDir = new File(rootProject.projectDir, '../node_modules/@mauron85/react-native-background-geolocation/android/common') apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings) include ':app' diff --git a/app/helpers/General.js b/app/helpers/General.js index 27fbd06722..6f0805edd4 100644 --- a/app/helpers/General.js +++ b/app/helpers/General.js @@ -1,4 +1,4 @@ -import {AsyncStorage} from 'react-native'; +import AsyncStorage from '@react-native-community/async-storage'; import _ from 'lodash'; /** diff --git a/app/services/LocationService.js b/app/services/LocationService.js index 0b80ad50a1..86392e14c3 100644 --- a/app/services/LocationService.js +++ b/app/services/LocationService.js @@ -110,13 +110,16 @@ export default class LocationServices { }); }); - BackgroundGeolocation.headlessTask(async (event) => { - // Application was shutdown, but the headless mechanism allows us - // to capture events in the background. (On Android, at least) - if (event.name === 'location' || event.name === 'stationary') { - saveLocation(event.params); - } - }); + if (Platform.OS === 'android') { + // This feature only is present on Android. + BackgroundGeolocation.headlessTask(async (event) => { + // Application was shutdown, but the headless mechanism allows us + // to capture events in the background. (On Android, at least) + if (event.name === 'location' || event.name === 'stationary') { + saveLocation(event.params); + } + }); + } BackgroundGeolocation.on('stationary', (stationaryLocation) => { // handle stationary locations here @@ -125,7 +128,12 @@ export default class LocationServices { // execute long running task // eg. ajax post location // IMPORTANT: task has to be ended by endTask - saveLocation(location); + + // For capturing stationaryLocation. Note that it hasn't been + // tested as I couldn't produce stationaryLocation callback in emulator + // but since the plugin documentation mentions it, no reason to keep + // it empty I believe. + saveLocation(stationaryLocation); BackgroundGeolocation.endTask(taskKey); }); console.log('[INFO] stationaryLocation:', stationaryLocation); diff --git a/dev_setup2.sh b/dev_setup2.sh new file mode 100644 index 0000000000..7713df2299 --- /dev/null +++ b/dev_setup2.sh @@ -0,0 +1,176 @@ +function show_help() { + echo " +Usage: dev_setup.sh [options] + Configures a Linux or MacOS machine for working with the code in this repo. +Options: + -ni Non-interactive mode, auto answers Yes to all questions. + -h, --help Show this message +" +} + +for var in "$@" ; do + if [[ $var == '-h' || $var == '--help' || $var == '-?' ]] ; then + show_help + exit 0 + elif [[ $var == '-ni' ]] ; then + non_interactive="Y" + else + echo "Unknown option: $var" + show_help + exit 1 + fi +done + + +function found_exe() { + hash "$1" 2>/dev/null +} + +if found_exe tput ; then + if [[ $(tput colors) != "-1" ]]; then + # Get some colors we can use to spice up messages! + GREEN=$(tput setaf 2) + BLUE=$(tput setaf 4) + CYAN=$(tput setaf 6) + YELLOW=$(tput setaf 3) + RESET=$(tput sgr0) + HIGHLIGHT=$YELLOW + fi +fi + + +############################################################################### +## Main setup + +# Need Node.js (8.3 or newer) +#TODO: Check nodejs version? (nodejs --version) +if ! found_exe nodejs ; then + echo "${BLUE}Installing Node.js v13.x...${RESET}" + curl -sL https://deb.nodesource.com/setup_13.x | sudo -E bash - + sudo apt-get install -y nodejs + echo "${GREEN}Node.js installed!${RESET}" +fi + + +# Need JDK (v8 or newer) +# TODO: Check java version (java -version) +if ! found_exe java ; then + echo "${BLUE}Installing AdoptOpenJDK...${RESET}" + + # Add GPG key + wget -qO - https://adoptopenjdk.jfrog.io/adoptopenjdk/api/gpg/key/public | sudo apt-key add - + sudo add-apt-repository --yes https://adoptopenjdk.jfrog.io/adoptopenjdk/deb/ + + # Import repo + sudo apt-get install -y software-properties-common + sudo add-apt-repository --yes https://adoptopenjdk.jfrog.io/adoptopenjdk/deb/ + sudo apt-get update + + # Install + sudo apt-get -y install adoptopenjdk-8-hotspot + echo "${GREEN}AdoptOpenJDK installed!${RESET}" +fi + + +## Need Android Studio (interactive for now) +#if ! found_exe android-studio ; then +# echo "${YELLOW}Install Android Studio from https://developer.android.com/studio/index.html${RESET}" +# echo "You can also use your software store to install." +# echo "${BLUE}Press RETURN after completing this step.${RESET}" +# read + +# if ! found_exe android-studio ; then +# echo "Not able to find Android Studio still, aborting." +# exit 1 +# fi + +# # Need Android 9 (Pie) SDK +# echo "We need the Android 9 (Pie) SDK. Please follow these steps:" +# echo "1) Open Android Studio" +# echo "2) At bottom of the 'Welcome to Android Studio' screen click on Configure > SDK Manager" +# echo " NOTE: You might need to close and reopent Android Studio the first time to see this." +# echo " * Under the SDK Platforms tab, click Show Package Details" +# echo " * Expand the 'Android 9.0 (Pie)' entry" +# echo " - Check: Android SDK Platform 29" +# echo " - Check: Intel x86 Atom_64 System Image or Google APIs Intel x86 Atom System Image" +# echo " * Under the SDK Tools tab, check 'Show Package Details'" +# echo " * Expand the 'Android SDK Build-Tools' entry" +# echo " - Check: 28.0.3" +# echo " * Press Apply button, then OK and agree to terms to download necessary pieces." +# echo " * Press Finish button, then OK button after downloads complete." +# echo "" +# echo "${BLUE}Press RETURN after completing these steps.${RESET}" + +# echo "${BLUE}Adding environment variables via ~/.profile_mobileapp${RESET}" + +# echo "# ==== Added by PrivateKit/mobileapp's dev_setup.sh ====" >> ~/.profile_mobileapp +# echo "export ANDROID_HOME=\$HOME/Android/Sdk" >> ~/.profile_mobileapp +# echo "export PATH=\$PATH:\$ANDROID_HOME/emulator" >> ~/.profile_mobileapp +# echo "export PATH=\$PATH:\$ANDROID_HOME/tools" >> ~/.profile_mobileapp +# echo "export PATH=\$PATH:\$ANDROID_HOME/tools/bin" >> ~/.profile_mobileapp +# echo "export PATH=\$PATH:\$ANDROID_HOME/platform-tools" >> ~/.profile_mobileapp + +# echo "source ~/.profile_mobileapp" >> ~/.profile +# +# echo "${GREEN}Android Studio installed!${RESET}" +# echo "${YELLOW}You will need to start a new terminal session for this to apply.${RESET}" +#fi + + +# Need Watchman v4.9+ (watchman --version) +if ! found_exe watchman ; then + echo "${BLUE}Installing Watchman, this is going to take a little bit...${RESET}" + echo "${YELLOW}TODO: Watchman setup...is it necessary?${RESET}" + +# if ! found_exe brew ; then +# # Use the linuxbrew system to install 'watchman' +# sudo apt-get install linuxbrew-wrapper +# export PATH="$HOME/.linuxbrew/bin:$PATH" +# export MANPATH="$HOME/.linuxbrew/share/man:$MANPATH" +# export INFOPATH="$HOME/.linuxbrew/share/info:$INFOPATH" +# fi +# brew update && brew upgrade +# +# brew install --HEAD watchman +# +# # Then increase the amount of inotify user instances, user watches and queued events +# echo fs.inotify.max_user_instances=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p +# echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p +# echo fs.inotify.max_queued_events=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p + + +# SSP: This is the source-code version that didn't quite work +# pushd ~ +# git clone https://github.com/facebook/watchman.git +# cd watchman/ +# git checkout v4.9.0 +# sudo apt-get install -y autoconf automake build-essential python-dev libtool m4 +# ./autogen.sh +# ./configure --enable-lenient +# make +# sudo make install +# popd # Return to where we were +fi + + +if ! found_exe react-native ; then + echo "${BLUE}Installing React Native tool...${RESET}" + sudo npm install -g react-native-cli + npm install + echo "${GREEN}React Native tools installed!${RESET}" +fi + + +echo "${GREEN}You are now ready to go!${RESET}" +echo +echo "Try this to get started:" +echo +echo " Run Android Studio then:" +echo " * Select 'Configure > AVD Manager' at the bottom" +echo " * Create and run a virtula device, such as a Pixel 2" +echo +echo " In a terminal run:" +echo " $ ~/mobileapp/1_start_react.sh" +echo " In a second terminal:" +echo " $ ~/mobileapp/2_start_android_app.sh" +echo " You can edit files and repeat step 2 again as necessary to debug." diff --git a/ios/Podfile.lock b/ios/Podfile.lock index fbbbab8619..640a07aa20 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -223,12 +223,28 @@ PODS: - React-cxxreact (= 0.61.5) - React-jsi (= 0.61.5) - ReactCommon/jscallinvoker (= 0.61.5) + - rn-fetch-blob (0.12.0): + - React-Core + - RNCAsyncStorage (1.8.1): + - React - RNCMaskedView (0.1.5): - React + - RNFS (2.16.6): + - React - RNGestureHandler (1.5.6): - React - RNScreens (2.0.0-alpha.12): - React + - RNShare (3.0.0): + - React + - RNZipArchive (5.0.1): + - React + - RNZipArchive/Core (= 5.0.1) + - SSZipArchive (= 2.2.2) + - RNZipArchive/Core (5.0.1): + - React + - SSZipArchive (= 2.2.2) + - SSZipArchive (2.2.2) - Yoga (1.14.0) DEPENDENCIES: @@ -262,14 +278,20 @@ DEPENDENCIES: - React-RCTVibration (from `../node_modules/react-native/Libraries/Vibration`) - ReactCommon/jscallinvoker (from `../node_modules/react-native/ReactCommon`) - ReactCommon/turbomodule/core (from `../node_modules/react-native/ReactCommon`) + - rn-fetch-blob (from `../node_modules/rn-fetch-blob`) + - "RNCAsyncStorage (from `../node_modules/@react-native-community/async-storage`)" - "RNCMaskedView (from `../node_modules/@react-native-community/masked-view`)" + - RNFS (from `../node_modules/react-native-fs`) - RNGestureHandler (from `../node_modules/react-native-gesture-handler`) - RNScreens (from `../node_modules/react-native-screens`) + - RNShare (from `../node_modules/react-native-share`) + - RNZipArchive (from `../node_modules/react-native-zip-archive`) - Yoga (from `../node_modules/react-native/ReactCommon/yoga`) SPEC REPOS: trunk: - boost-for-react-native + - SSZipArchive EXTERNAL SOURCES: "@mauron85_react-native-background-geolocation": @@ -326,12 +348,22 @@ EXTERNAL SOURCES: :path: "../node_modules/react-native/Libraries/Vibration" ReactCommon: :path: "../node_modules/react-native/ReactCommon" + rn-fetch-blob: + :path: "../node_modules/rn-fetch-blob" + RNCAsyncStorage: + :path: "../node_modules/@react-native-community/async-storage" RNCMaskedView: :path: "../node_modules/@react-native-community/masked-view" + RNFS: + :path: "../node_modules/react-native-fs" RNGestureHandler: :path: "../node_modules/react-native-gesture-handler" RNScreens: :path: "../node_modules/react-native-screens" + RNShare: + :path: "../node_modules/react-native-share" + RNZipArchive: + :path: "../node_modules/react-native-zip-archive" Yoga: :path: "../node_modules/react-native/ReactCommon/yoga" @@ -364,9 +396,15 @@ SPEC CHECKSUMS: React-RCTText: 9ccc88273e9a3aacff5094d2175a605efa854dbe React-RCTVibration: a49a1f42bf8f5acf1c3e297097517c6b3af377ad ReactCommon: 198c7c8d3591f975e5431bec1b0b3b581aa1c5dd + rn-fetch-blob: f065bb7ab7fb48dd002629f8bdcb0336602d3cba + RNCAsyncStorage: e0dd7c8a36543b4ef84969acd9f8aceba3a92dc2 RNCMaskedView: dd13f9f7b146a9ad82f9b7eb6c9b5548fcf6e990 + RNFS: 2bd9eb49dc82fa9676382f0585b992c424cd59df RNGestureHandler: 911d3b110a7a233a34c4f800e7188a84b75319c6 RNScreens: 254da4b84f25971cbb30ed3ddc84131f23cac812 + RNShare: 0e19ddb0bf338b62702ce1d9e001ee14effa68a8 + RNZipArchive: 87111bb6130a38edd68c8d2059d46ac94d53ffe4 + SSZipArchive: fa16b8cc4cdeceb698e5e5d9f67e9558532fbf23 Yoga: f2a7cd4280bfe2cca5a7aed98ba0eb3d1310f18b PODFILE CHECKSUM: a72444a1c8c7fce528829dd576584854ab2bb99a diff --git a/ios/PrivateKit.xcodeproj/project.pbxproj b/ios/PrivateKit.xcodeproj/project.pbxproj index a781f11efb..67aa3b5fcb 100644 --- a/ios/PrivateKit.xcodeproj/project.pbxproj +++ b/ios/PrivateKit.xcodeproj/project.pbxproj @@ -24,13 +24,6 @@ remoteGlobalIDString = 13B07F861A680F5B00A75B9A; remoteInfo = PrivateKit; }; - 4E865ED2241AD04900A4B803 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 4E865ECD241AD04800A4B803 /* RCTBackgroundGeolocation.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 418F75461D02DC3D0045FEA0; - remoteInfo = RCTBackgroundGeolocation; - }; /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ @@ -47,7 +40,6 @@ 13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = PrivateKit/Info.plist; sourceTree = ""; }; 13B07FB71A68108700A75B9A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = PrivateKit/main.m; sourceTree = ""; }; 3E10CA5A72D06133B886B461 /* libPods-PrivateKit-tvOSTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-PrivateKit-tvOSTests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; - 4E865ECD241AD04800A4B803 /* RCTBackgroundGeolocation.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTBackgroundGeolocation.xcodeproj; path = "../node_modules/@mauron85/react-native-background-geolocation/ios/RCTBackgroundGeolocation.xcodeproj"; sourceTree = ""; }; 5BB8E05EB6A91794343D2430 /* libPods-PrivateKitTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-PrivateKitTests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 71D1C872DB0CCC3BBC3D907E /* Pods-PrivateKit.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-PrivateKit.debug.xcconfig"; path = "Target Support Files/Pods-PrivateKit/Pods-PrivateKit.debug.xcconfig"; sourceTree = ""; }; 9440D638E4331481079AE235 /* Pods-PrivateKit.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-PrivateKit.release.xcconfig"; path = "Target Support Files/Pods-PrivateKit/Pods-PrivateKit.release.xcconfig"; sourceTree = ""; }; @@ -141,18 +133,9 @@ name = Frameworks; sourceTree = ""; }; - 4E865ECE241AD04800A4B803 /* Products */ = { - isa = PBXGroup; - children = ( - 4E865ED3241AD04900A4B803 /* libRCTBackgroundGeolocation.a */, - ); - name = Products; - sourceTree = ""; - }; 832341AE1AAA6A7D00B99B32 /* Libraries */ = { isa = PBXGroup; children = ( - 4E865ECD241AD04800A4B803 /* RCTBackgroundGeolocation.xcodeproj */, ); name = Libraries; sourceTree = ""; @@ -229,7 +212,7 @@ 83CBB9F71A601CBA00E9B192 /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0940; + LastUpgradeCheck = 940; ORGANIZATIONNAME = Facebook; TargetAttributes = { 00E356ED1AD99517003FC87E = { @@ -243,22 +226,15 @@ }; buildConfigurationList = 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "PrivateKit" */; compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; + developmentRegion = en; hasScannedForEncodings = 0; knownRegions = ( - English, en, Base, ); mainGroup = 83CBB9F61A601CBA00E9B192; productRefGroup = 83CBBA001A601CBA00E9B192 /* Products */; projectDirPath = ""; - projectReferences = ( - { - ProductGroup = 4E865ECE241AD04800A4B803 /* Products */; - ProjectRef = 4E865ECD241AD04800A4B803 /* RCTBackgroundGeolocation.xcodeproj */; - }, - ); projectRoot = ""; targets = ( 13B07F861A680F5B00A75B9A /* PrivateKit */, @@ -267,16 +243,6 @@ }; /* End PBXProject section */ -/* Begin PBXReferenceProxy section */ - 4E865ED3241AD04900A4B803 /* libRCTBackgroundGeolocation.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libRCTBackgroundGeolocation.a; - remoteRef = 4E865ED2241AD04900A4B803 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; -/* End PBXReferenceProxy section */ - /* Begin PBXResourcesBuildPhase section */ 00E356EC1AD99517003FC87E /* Resources */ = { isa = PBXResourcesBuildPhase; @@ -426,6 +392,7 @@ "DEBUG=1", "$(inherited)", ); + HEADER_SEARCH_PATHS = "$(inherited)"; INFOPLIST_FILE = PrivateKitTests/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; @@ -446,6 +413,7 @@ buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; COPY_PHASE_STRIP = NO; + HEADER_SEARCH_PATHS = "$(inherited)"; INFOPLIST_FILE = PrivateKitTests/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; @@ -468,6 +436,7 @@ CURRENT_PROJECT_VERSION = 5; DEAD_CODE_STRIPPING = NO; DEVELOPMENT_TEAM = A35W4MM59Y; + HEADER_SEARCH_PATHS = "$(inherited)"; INFOPLIST_FILE = PrivateKit/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; OTHER_LDFLAGS = ( @@ -489,6 +458,7 @@ CURRENT_PROJECT_VERSION = 5; DEAD_CODE_STRIPPING = YES; DEVELOPMENT_TEAM = A35W4MM59Y; + HEADER_SEARCH_PATHS = "$(inherited)"; INFOPLIST_FILE = PrivateKit/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; OTHER_LDFLAGS = ( diff --git a/package.json b/package.json index 28343eb9cd..3b5ece9220 100644 --- a/package.json +++ b/package.json @@ -3,27 +3,27 @@ "version": "0.5.0", "private": true, "scripts": { - "android": "react-native run-android", - "ios": "react-native run-ios", - "start": "react-native start", - "test": "jest", - "lint": "eslint ." + "postinstall": "patch-package" }, "dependencies": { + "@react-native-community/cli-platform-ios": "^3.0.0", "@mauron85/react-native-background-geolocation": "^0.6.3", + "@react-native-community/async-storage": "^1.8.1", "@react-native-community/masked-view": "0.1.5", "@react-navigation/native": "5.0.9", "@react-navigation/stack": "5.1.1", "lodash": "4.17.15", + "patch-package": "^6.2.1", + "postinstall-postinstall": "^2.0.0", "react": "16.9.0", "react-native": "0.61.5", "react-native-fs": "^2.16.6", "react-native-gesture-handler": "~1.5.0", "react-native-safe-area-context": "0.6.0", "react-native-screens": "2.0.0-alpha.12", - "react-native-zip-archive": "^5.0.1", "react-native-share": "^3.0.0", "react-native-webview": "^8.1.2", + "react-native-zip-archive": "^5.0.1", "rn-fetch-blob": "^0.12.0" }, "devDependencies": { diff --git a/patches/rn-fetch-blob+0.12.0.patch b/patches/rn-fetch-blob+0.12.0.patch new file mode 100644 index 0000000000..a2cc93064b --- /dev/null +++ b/patches/rn-fetch-blob+0.12.0.patch @@ -0,0 +1,62 @@ +diff --git a/node_modules/rn-fetch-blob/polyfill/Blob.js b/node_modules/rn-fetch-blob/polyfill/Blob.js +index 53662a7..dd3a340 100644 +--- a/node_modules/rn-fetch-blob/polyfill/Blob.js ++++ b/node_modules/rn-fetch-blob/polyfill/Blob.js +@@ -2,7 +2,8 @@ + // Use of this source code is governed by a MIT-style license that can be + // found in the LICENSE file. + +-import RNFetchBlob from '../index.js' ++// import RNFetchBlob from '../index.js' ++import {NativeModules} from 'react-native'; + import fs from '../fs.js' + import getUUID from '../utils/uuid' + import Log from '../utils/log.js' +@@ -10,6 +11,7 @@ import EventTarget from './EventTarget' + + const log = new Log('Blob') + const blobCacheDir = fs.dirs.DocumentDir + '/RNFetchBlob-blobs/' ++const RNFetchBlob = NativeModules.RNFetchBlob + + log.disable() + // log.level(3) +diff --git a/node_modules/rn-fetch-blob/polyfill/Fetch.js b/node_modules/rn-fetch-blob/polyfill/Fetch.js +index 3ecb591..45c1307 100644 +--- a/node_modules/rn-fetch-blob/polyfill/Fetch.js ++++ b/node_modules/rn-fetch-blob/polyfill/Fetch.js +@@ -1,10 +1,12 @@ +-import RNFetchBlob from '../index.js' ++// import RNFetchBlob from '../index.js' ++import {NativeModules} from 'react-native'; + import Log from '../utils/log.js' + import fs from '../fs' + import unicode from '../utils/unicode' + import Blob from './Blob' + + const log = new Log('FetchPolyfill') ++const RNFetchBlob = NativeModules.RNFetchBlob + + log.disable() + // log.level(3) +diff --git a/node_modules/rn-fetch-blob/polyfill/XMLHttpRequest.js b/node_modules/rn-fetch-blob/polyfill/XMLHttpRequest.js +index 9036b2b..1ba2fef 100644 +--- a/node_modules/rn-fetch-blob/polyfill/XMLHttpRequest.js ++++ b/node_modules/rn-fetch-blob/polyfill/XMLHttpRequest.js +@@ -2,7 +2,8 @@ + // Use of this source code is governed by a MIT-style license that can be + // found in the LICENSE file. + +-import RNFetchBlob from '../index.js' ++// import RNFetchBlob from '../index.js' ++import {NativeModules} from 'react-native'; + import XMLHttpRequestEventTarget from './XMLHttpRequestEventTarget.js' + import Log from '../utils/log.js' + import Blob from './Blob.js' +@@ -10,6 +11,7 @@ import ProgressEvent from './ProgressEvent.js' + import URIUtil from '../utils/uri' + + const log = new Log('XMLHttpRequest') ++const RNFetchBlob = NativeModules.RNFetchBlob + + log.disable() + // log.level(3) diff --git a/yarn.lock b/yarn.lock index a6d08e927c..cfa6e164b4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -942,6 +942,11 @@ dependencies: plist "^3.0.1" +"@react-native-community/async-storage@^1.8.1": + version "1.8.1" + resolved "https://registry.yarnpkg.com/@react-native-community/async-storage/-/async-storage-1.8.1.tgz#c93e69dcf948667b207e409b8039b7edf199159b" + integrity sha512-MA1fTp4SB7OOtDmNAwds6jIpiwwty1NIoFboWjEWkoyWW35zIuxlhHxD4joSy21aWEzUVwvv6JJ2hSsP/HTb7A== + "@react-native-community/cli-debugger-ui@^3.0.0": version "3.0.0" resolved "https://registry.yarnpkg.com/@react-native-community/cli-debugger-ui/-/cli-debugger-ui-3.0.0.tgz#d01d08d1e5ddc1633d82c7d84d48fff07bd39416" @@ -1238,6 +1243,11 @@ lodash.unescape "4.0.1" semver "5.5.0" +"@yarnpkg/lockfile@^1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@yarnpkg/lockfile/-/lockfile-1.1.0.tgz#e77a97fbd345b76d83245edcd17d393b1b41fb31" + integrity sha512-GpSwvyXOcOOlV70vbnzjj4fW5xW/FdUF6nQEt1ENy7m4ZCczi1+/buVUPAqmGfqznsORNFzUMjctTIp8a9tuCQ== + abab@^2.0.0: version "2.0.3" resolved "https://registry.yarnpkg.com/abab/-/abab-2.0.3.tgz#623e2075e02eb2d3f2475e49f99c91846467907a" @@ -1646,6 +1656,11 @@ balanced-match@^1.0.0: resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767" integrity sha1-ibTRmasr7kneFk6gK4nORi1xt2c= +base-64@0.1.0, base-64@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/base-64/-/base-64-0.1.0.tgz#780a99c84e7d600260361511c4877613bf24f6bb" + integrity sha1-eAqZyE59YAJgNhURxId2E78k9rs= + base64-js@^1.1.2, base64-js@^1.2.3: version "1.3.1" resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.3.1.tgz#58ece8cb75dd07e71ed08c736abc5fac4dbf8df1" @@ -2946,6 +2961,14 @@ find-up@^4.0.0, find-up@^4.1.0: locate-path "^5.0.0" path-exists "^4.0.0" +find-yarn-workspace-root@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/find-yarn-workspace-root/-/find-yarn-workspace-root-1.2.1.tgz#40eb8e6e7c2502ddfaa2577c176f221422f860db" + integrity sha512-dVtfb0WuQG+8Ag2uWkbG79hOUzEsRrhBzgfn86g2sJPkzmcpGdghbNTfUKGTxymFrY/tLIodDzLoW9nOJ4FY8Q== + dependencies: + fs-extra "^4.0.3" + micromatch "^3.1.4" + flat-cache@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-2.0.1.tgz#5d296d6f04bda44a4630a301413bdbc2ec085ec0" @@ -3000,6 +3023,15 @@ fs-extra@^1.0.0: jsonfile "^2.1.0" klaw "^1.0.0" +fs-extra@^4.0.3: + version "4.0.3" + resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-4.0.3.tgz#0d852122e5bc5beb453fb028e9c0c9bf36340c94" + integrity sha512-q6rbdDd1o2mAnQreO7YADIxf/Whx4AHBiRf6d+/cVT8h44ss+lHgxf1FemcqDnQt9X3ct4McHr+JMGlYSsK7Cg== + dependencies: + graceful-fs "^4.1.2" + jsonfile "^4.0.0" + universalify "^0.1.0" + fs-extra@^7.0.1: version "7.0.1" resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-7.0.1.tgz#4f189c44aa123b895f722804f55ea23eadc348e9" @@ -3095,6 +3127,18 @@ glob-parent@^5.0.0: dependencies: is-glob "^4.0.1" +glob@7.0.6: + version "7.0.6" + resolved "https://registry.yarnpkg.com/glob/-/glob-7.0.6.tgz#211bafaf49e525b8cd93260d14ab136152b3f57a" + integrity sha1-IRuvr0nlJbjNkyYNFKsTYVKz9Xo= + dependencies: + fs.realpath "^1.0.0" + inflight "^1.0.4" + inherits "2" + minimatch "^3.0.2" + once "^1.3.0" + path-is-absolute "^1.0.0" + glob@^7.1.1, glob@^7.1.2, glob@^7.1.3, glob@^7.1.4: version "7.1.6" resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.6.tgz#141f33b81a7c2492e125594307480c46679278a6" @@ -4275,6 +4319,13 @@ kind-of@^6.0.0, kind-of@^6.0.2: resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-6.0.3.tgz#07c05034a6c349fa06e24fa35aa76db4580ce4dd" integrity sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw== +klaw-sync@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/klaw-sync/-/klaw-sync-6.0.0.tgz#1fd2cfd56ebb6250181114f0a581167099c2b28c" + integrity sha512-nIeuVSzdCCs6TDPTqI8w1Yre34sSq7AkZ4B3sfOBbI2CgVSB4Du4aLQijFU2+lhAFCwt9+42Hel6lQNIv6AntQ== + dependencies: + graceful-fs "^4.1.11" + klaw@^1.0.0: version "1.3.1" resolved "https://registry.yarnpkg.com/klaw/-/klaw-1.3.1.tgz#4088433b46b3b1ba259d78785d8e96f73ba02439" @@ -4804,7 +4855,7 @@ mimic-fn@^2.0.0, mimic-fn@^2.1.0: resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-2.1.0.tgz#7ed2c2ccccaf84d3ffcb7a69b57711fc2083401b" integrity sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg== -minimatch@^3.0.4: +minimatch@^3.0.2, minimatch@^3.0.4: version "3.0.4" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083" integrity sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA== @@ -5310,6 +5361,24 @@ pascalcase@^0.1.1: resolved "https://registry.yarnpkg.com/pascalcase/-/pascalcase-0.1.1.tgz#b363e55e8006ca6fe21784d2db22bd15d7917f14" integrity sha1-s2PlXoAGym/iF4TS2yK9FdeRfxQ= +patch-package@^6.2.1: + version "6.2.1" + resolved "https://registry.yarnpkg.com/patch-package/-/patch-package-6.2.1.tgz#e3c55cf09dffd3984dd300e30d842672b604307f" + integrity sha512-dfCtQor63PPij6DDYtCzBRoO5nNAcMSg7Cmh+DLhR+s3t0OLQBdvFxJksZHBe1J2MjsSWDjTF4+oQKFbdkssIg== + dependencies: + "@yarnpkg/lockfile" "^1.1.0" + chalk "^2.4.2" + cross-spawn "^6.0.5" + find-yarn-workspace-root "^1.2.1" + fs-extra "^7.0.1" + is-ci "^2.0.0" + klaw-sync "^6.0.0" + minimist "^1.2.0" + rimraf "^2.6.3" + semver "^5.6.0" + slash "^2.0.0" + tmp "^0.0.33" + path-exists@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-3.0.0.tgz#ce0ebeaa5f78cb18925ea7d810d7b59b010fd515" @@ -5418,6 +5487,11 @@ posix-character-classes@^0.1.0: resolved "https://registry.yarnpkg.com/posix-character-classes/-/posix-character-classes-0.1.1.tgz#01eac0fe3b5af71a2a6c02feabb8c1fef7e00eab" integrity sha1-AerA/jta9xoqbAL+q7jB/vfgDqs= +postinstall-postinstall@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/postinstall-postinstall/-/postinstall-postinstall-2.0.0.tgz#7ba6711b4420575c4f561638836a81faad47f43f" + integrity sha512-3f6qWexsHiT4WKtZc5DRb0FPLilHtARi5KpY4fqban/DJNn8/YhZH8U7dVKVz51WbOxEnR31gV+qYQhvEdHtdQ== + prelude-ls@~1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54" @@ -5542,6 +5616,14 @@ react-is@^16.12.0, react-is@^16.8.1, react-is@^16.8.4, react-is@^16.9.0: resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.13.0.tgz#0f37c3613c34fe6b37cd7f763a0d6293ab15c527" integrity sha512-GFMtL0vHkiBv9HluwNZTggSn/sCyEt9n02aM0dSAjGGyqyNlAyftYm4phPxdvCigG15JreC5biwxCgTAJZ7yAA== +react-native-fs@^2.16.6: + version "2.16.6" + resolved "https://registry.yarnpkg.com/react-native-fs/-/react-native-fs-2.16.6.tgz#2901789a43210a35a0ef0a098019bbef3af395fd" + integrity sha512-ZWOooD1AuFoAGY3HS2GY7Qx2LZo4oIg6AK0wbC68detxwvX75R/q9lRqThXNKP6vIo2VHWa0fYUo/SrLw80E8w== + dependencies: + base-64 "^0.1.0" + utf8 "^3.0.0" + react-native-gesture-handler@~1.5.0: version "1.5.6" resolved "https://registry.yarnpkg.com/react-native-gesture-handler/-/react-native-gesture-handler-1.5.6.tgz#5d90145f624e3707db2930f43ab41579683e2375" @@ -5570,6 +5652,11 @@ react-native-screens@2.0.0-alpha.12: dependencies: debounce "^1.2.0" +react-native-share@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/react-native-share/-/react-native-share-3.0.0.tgz#5e158f773ebc91e35fbe48ffe21c0073c2c8f41a" + integrity sha512-5P/Fhou5jW1yY475h+wIR+VZAUZ1Gnx8N4QKGToOLNo1yUhDeLxYRhm3bGCcS/MEy35NOZ222/43SQGfUzCl/g== + react-native-webview@^8.1.2: version "8.1.2" resolved "https://registry.yarnpkg.com/react-native-webview/-/react-native-webview-8.1.2.tgz#c2ddb1e82d1c294f8f68a13be5d0536f7808f377" @@ -5578,6 +5665,11 @@ react-native-webview@^8.1.2: escape-string-regexp "2.0.0" invariant "2.2.4" +react-native-zip-archive@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/react-native-zip-archive/-/react-native-zip-archive-5.0.1.tgz#fb99e3f6191d0d542a3d5db8ee9f1b43dd2b65dc" + integrity sha512-dcr5UoMnji7fwxwNYtA8GZyg31DAoCuO2O7L2FLvxVTgs1iZOHHsRRKTxK53bkGN4bwh1t24rwGW3HfDokddUQ== + react-native@0.61.5: version "0.61.5" resolved "https://registry.yarnpkg.com/react-native/-/react-native-0.61.5.tgz#6e21acb56cbd75a3baeb1f70201a66f42600bba8" @@ -5874,7 +5966,7 @@ rimraf@2.6.3: dependencies: glob "^7.1.3" -rimraf@^2.5.4: +rimraf@^2.5.4, rimraf@^2.6.3: version "2.7.1" resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.7.1.tgz#35797f13a7fdadc566142c29d4f07ccad483e3ec" integrity sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w== @@ -5893,6 +5985,14 @@ rimraf@~2.2.6: resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.2.8.tgz#e439be2aaee327321952730f99a8929e4fc50582" integrity sha1-5Dm+Kq7jJzIZUnMPmaiSnk/FBYI= +rn-fetch-blob@^0.12.0: + version "0.12.0" + resolved "https://registry.yarnpkg.com/rn-fetch-blob/-/rn-fetch-blob-0.12.0.tgz#ec610d2f9b3f1065556b58ab9c106eeb256f3cba" + integrity sha512-+QnR7AsJ14zqpVVUbzbtAjq0iI8c9tCg49tIoKO2ezjzRunN7YL6zFSFSWZm6d+mE/l9r+OeDM3jmb2tBb2WbA== + dependencies: + base-64 "0.1.0" + glob "7.0.6" + rsvp@^4.8.4: version "4.8.5" resolved "https://registry.yarnpkg.com/rsvp/-/rsvp-4.8.5.tgz#c8f155311d167f68f21e168df71ec5b083113734" @@ -6805,6 +6905,11 @@ use@^3.1.0: resolved "https://registry.yarnpkg.com/use/-/use-3.1.1.tgz#d50c8cac79a19fbc20f2911f56eb973f4e10070f" integrity sha512-cwESVXlO3url9YWlFW/TA9cshCEhtu7IKJ/p5soJ/gGpj7vbvFrAY/eIioQ6Dw23KjZhYgiIo8HOs1nQ2vr/oQ== +utf8@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/utf8/-/utf8-3.0.0.tgz#f052eed1364d696e769ef058b183df88c87f69d1" + integrity sha512-E8VjFIQ/TyQgp+TZfS6l8yp/xWppSAHzidGiRrqe4bK4XP9pTRyKFgGJpO3SN7zdX4DeomTrwaseCHovfpFcqQ== + util-deprecate@~1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf"