diff --git a/ios/Podfile b/ios/Podfile index e674bc6..92b55fe 100644 --- a/ios/Podfile +++ b/ios/Podfile @@ -1,13 +1,43 @@ -# Resolve react_native_pods.rb with node to allow for hoisting -require Pod::Executable.execute_command('node', ['-p', - 'require.resolve( - "react-native/scripts/react_native_pods.rb", - {paths: [process.argv[1]]}, - )', __dir__]).strip +# Transform this into a `node_require` generic function: +def node_require(script) + # Resolve script with node to allow for hoisting + require Pod::Executable.execute_command('node', ['-p', + "require.resolve( + '#{script}', + {paths: [process.argv[1]]}, + )", __dir__]).strip +end + +# Use it to require both react-native's and this package's scripts: +node_require('react-native/scripts/react_native_pods.rb') +node_require('react-native-permissions/scripts/setup.rb') platform :ios, min_ios_version_supported prepare_react_native_project! +setup_permissions([ + # 'AppTrackingTransparency', + # 'Bluetooth', + # 'Calendars', + # 'CalendarsWriteOnly', + # 'Camera', + # 'Contacts', + # 'FaceID', + # 'LocationAccuracy', + 'LocationAlways', + 'LocationWhenInUse', + # 'MediaLibrary', + # 'Microphone', + 'Motion', + # 'Notifications', + # 'PhotoLibrary', + # 'PhotoLibraryAddOnly', + # 'Reminders', + # 'Siri', + # 'SpeechRecognition', + # 'StoreKit', +]) + # If you are using a `react-native-flipper` your iOS build will fail when `NO_FLIPPER=1` is set. # because `react-native-flipper` depends on (FlipperKit,...) that will be excluded # diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 099a9ea..bdc8461 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -14,9 +14,9 @@ PODS: - hermes-engine (0.72.4): - hermes-engine/Pre-built (= 0.72.4) - hermes-engine/Pre-built (0.72.4) - - HyperTrack (5.7.0) - - hypertrack-sdk-react-native (13.5.0): - - HyperTrack (= 5.7.0) + - HyperTrack (5.8.0) + - hypertrack-sdk-react-native (13.6.1): + - HyperTrack (= 5.8.0) - React-Core - libevent (2.1.12) - RCT-Folly (2021.07.22.00): @@ -429,6 +429,8 @@ PODS: - React-jsi (= 0.72.4) - React-logger (= 0.72.4) - React-perflogger (= 0.72.4) + - RNPermissions (4.1.5): + - React-Core - SocketRocket (0.6.1) - Yoga (1.14.0) @@ -474,6 +476,7 @@ DEPENDENCIES: - React-runtimescheduler (from `../node_modules/react-native/ReactCommon/react/renderer/runtimescheduler`) - React-utils (from `../node_modules/react-native/ReactCommon/react/utils`) - ReactCommon/turbomodule/core (from `../node_modules/react-native/ReactCommon`) + - RNPermissions (from `../node_modules/react-native-permissions`) - Yoga (from `../node_modules/react-native/ReactCommon/yoga`) SPEC REPOS: @@ -563,6 +566,8 @@ EXTERNAL SOURCES: :path: "../node_modules/react-native/ReactCommon/react/utils" ReactCommon: :path: "../node_modules/react-native/ReactCommon" + RNPermissions: + :path: "../node_modules/react-native-permissions" Yoga: :path: "../node_modules/react-native/ReactCommon/yoga" @@ -574,8 +579,8 @@ SPEC CHECKSUMS: fmt: ff9d55029c625d3757ed641535fd4a75fedc7ce9 glog: 04b94705f318337d7ead9e6d17c019bd9b1f6b1b hermes-engine: 81191603c4eaa01f5e4ae5737a9efcf64756c7b2 - HyperTrack: 755bc0faa935302dfd5e11289b027bff7513bc26 - hypertrack-sdk-react-native: 7bc5935c925e41e96ff16363715b76c80f215e60 + HyperTrack: 900840194d24a21e393f306517e26519909b6d47 + hypertrack-sdk-react-native: 411fc41348403665230ce9ff2616877507d5dea9 libevent: 4049cae6c81cdb3654a443be001fb9bdceff7913 RCT-Folly: 424b8c9a7a0b9ab2886ffe9c3b041ef628fd4fb1 RCTRequired: c0569ecc035894e4a68baecb30fe6a7ea6e399f9 @@ -609,9 +614,10 @@ SPEC CHECKSUMS: React-runtimescheduler: 4941cc1b3cf08b792fbf666342c9fc95f1969035 React-utils: b79f2411931f9d3ea5781404dcbb2fa8a837e13a ReactCommon: 4b2bdcb50a3543e1c2b2849ad44533686610826d + RNPermissions: 14d1566e2e8696d188c01e176055fa77139cdebc SocketRocket: f32cd54efbe0f095c4d7594881e52619cfe80b17 Yoga: 3efc43e0d48686ce2e8c60f99d4e6bd349aff981 -PODFILE CHECKSUM: a1dac362169304a953679efa3eb46496e50113a7 +PODFILE CHECKSUM: 5f5c18bf029b4994fb513a74e6612e24ae5fc8e3 COCOAPODS: 1.15.2 diff --git a/justfile b/justfile index 2264731..d39a386 100644 --- a/justfile +++ b/justfile @@ -20,6 +20,7 @@ SDK_NAME := "HyperTrack SDK React Native" # \ are escaped SEMVER_REGEX := "(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?" +ACTIVITY_SERVICE_GOOGLE_PLUGIN_LOCAL_PATH := "../sdk-react-native/plugin_android_activity_service_google" LOCATION_SERVICES_GOOGLE_PLUGIN_LOCAL_PATH := "../sdk-react-native/plugin_android_location_services_google" LOCATION_SERVICES_GOOGLE_19_0_1_PLUGIN_LOCAL_PATH := "../sdk-react-native/plugin_android_location_services_google_19_0_1" PUSH_SERVICE_FIREBASE_PLUGIN_LOCAL_PATH := "../sdk-react-native/plugin_android_push_service_firebase" @@ -32,6 +33,9 @@ add-plugin version: hooks if grep -q '"hypertrack-sdk-react-native"' package.json; then yarn remove hypertrack-sdk-react-native fi + if grep -q '"hypertrack-sdk-react-native-plugin-android-activity-service-google"' package.json; then + yarn remove hypertrack-sdk-react-native-plugin-android-activity-service-google + fi if grep -q '"hypertrack-sdk-react-native-plugin-android-location-services-google"' package.json; then yarn remove hypertrack-sdk-react-native-plugin-android-location-services-google fi @@ -41,6 +45,7 @@ add-plugin version: hooks MAJOR_VERSION=$(echo {{version}} | grep -o '^[0-9]\+') if [ $MAJOR_VERSION -ge 12 ]; then + yarn add hypertrack-sdk-react-native-plugin-android-activity-service-google@{{version}} yarn add hypertrack-sdk-react-native-plugin-android-location-services-google@{{version}} yarn add hypertrack-sdk-react-native-plugin-android-push-service-firebase@{{version}} fi @@ -57,13 +62,18 @@ add-plugin-local: hooks if grep -q '"hypertrack-sdk-react-native"' package.json; then yarn remove hypertrack-sdk-react-native fi + if grep -q '"hypertrack-sdk-react-native-plugin-android-activity-service-google"' package.json; then + yarn remove hypertrack-sdk-react-native-plugin-android-activity-service-google + fi if grep -q '"hypertrack-sdk-react-native-plugin-android-location-services-google"' package.json; then yarn remove hypertrack-sdk-react-native-plugin-android-location-services-google fi if grep -q '"hypertrack-sdk-react-native-plugin-android-push-service-firebase"' package.json; then yarn remove hypertrack-sdk-react-native-plugin-android-push-service-firebase fi + yarn add hypertrack-sdk-react-native@file:{{SDK_PLUGIN_LOCAL_PATH}} + yarn add hypertrack-sdk-react-native-plugin-android-activity-service-google@file:{{ACTIVITY_SERVICE_GOOGLE_PLUGIN_LOCAL_PATH}} yarn add hypertrack-sdk-react-native-plugin-android-location-services-google@file:{{LOCATION_SERVICES_GOOGLE_PLUGIN_LOCAL_PATH}} yarn add hypertrack-sdk-react-native-plugin-android-push-service-firebase@file:{{PUSH_SERVICE_FIREBASE_PLUGIN_LOCAL_PATH}} diff --git a/package.json b/package.json index 0bc38d5..7f2d8e5 100644 --- a/package.json +++ b/package.json @@ -10,11 +10,13 @@ "test": "jest" }, "dependencies": { - "hypertrack-sdk-react-native": "13.5.0", - "hypertrack-sdk-react-native-plugin-android-location-services-google": "13.5.0", - "hypertrack-sdk-react-native-plugin-android-push-service-firebase": "13.5.0", + "hypertrack-sdk-react-native": "13.6.1", + "hypertrack-sdk-react-native-plugin-android-activity-service-google": "13.6.1", + "hypertrack-sdk-react-native-plugin-android-location-services-google": "13.6.1", + "hypertrack-sdk-react-native-plugin-android-push-service-firebase": "13.6.1", "react": "18.2.0", - "react-native": "0.72.4" + "react-native": "0.72.4", + "react-native-permissions": "^4.1.5" }, "devDependencies": { "@babel/core": "^7.20.0", diff --git a/src/App.tsx b/src/App.tsx index a99ebae..277e9ad 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -11,6 +11,7 @@ import { EmitterSubscription, } from 'react-native'; import {Platform} from 'react-native'; +import {check, PERMISSIONS, request, RESULTS} from 'react-native-permissions'; import HyperTrack, { HyperTrackError, @@ -270,6 +271,10 @@ const App = () => { console.log('Locate started'); }; + const requestMotionActivityPermission = async () => { + await request(PERMISSIONS.IOS.MOTION); + }; + const setIsAvailable = async (isAvailable: boolean) => { HyperTrack.setIsAvailable(isAvailable); console.log('setIsAvailable', isAvailable); @@ -361,6 +366,13 @@ const App = () => {