Skip to content

Commit

Permalink
Add Motion Activity (#41)
Browse files Browse the repository at this point in the history
  • Loading branch information
pavel-kuznetsov-hypertrack authored Sep 12, 2024
1 parent de11673 commit 358af48
Show file tree
Hide file tree
Showing 6 changed files with 100 additions and 30 deletions.
42 changes: 36 additions & 6 deletions ios/Podfile
Original file line number Diff line number Diff line change
@@ -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
#
Expand Down
18 changes: 12 additions & 6 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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"

Expand All @@ -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
Expand Down Expand Up @@ -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
10 changes: 10 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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}}

Expand Down
10 changes: 6 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
12 changes: 12 additions & 0 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -361,6 +366,13 @@ const App = () => {
<View style={styles.buttonWrapper}>
<Button title="Get Orders" onPress={getOrders} />
</View>

<View style={styles.buttonWrapper}>
<Button
title="Request Motion Activity Permission"
onPress={requestMotionActivityPermission}
/>
</View>
</ScrollView>
</SafeAreaView>
);
Expand Down
38 changes: 24 additions & 14 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3637,20 +3637,25 @@ human-signals@^2.1.0:
resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-2.1.0.tgz#dc91fcba42e4d06e4abaed33b3e7a3c02f514ea0"
integrity sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==

hypertrack-sdk-react-native-plugin-android-location-services-google@13.5.0:
version "13.5.0"
resolved "https://registry.yarnpkg.com/hypertrack-sdk-react-native-plugin-android-location-services-google/-/hypertrack-sdk-react-native-plugin-android-location-services-google-13.5.0.tgz#95716f81c22be8088976cc256c152100d8b99640"
integrity sha512-fWlKcavfuieJtFjVvlOd2Gyl083xI3EZ+UZmhhkZe8QMqipwjXQorjgMGl5Nu4brsEF1IZQ/rCKs2lc/HSyBbw==

hypertrack-sdk-react-native-plugin-android-push-service-firebase@13.5.0:
version "13.5.0"
resolved "https://registry.yarnpkg.com/hypertrack-sdk-react-native-plugin-android-push-service-firebase/-/hypertrack-sdk-react-native-plugin-android-push-service-firebase-13.5.0.tgz#aeacfc24978384092faf4fb7e352d9e2167c9b30"
integrity sha512-14skLhOqeFVkuR8A94iuct/BXYIo8EQ41d18Jpb5lQ9WOUu2RhxNipN4oeY16LWlB5v+upipvBxSwnqkA+lRlw==

[email protected]:
version "13.5.0"
resolved "https://registry.yarnpkg.com/hypertrack-sdk-react-native/-/hypertrack-sdk-react-native-13.5.0.tgz#b53a29b2434cfbcba8af5879d50f04554d512f64"
integrity sha512-2ra9rkI5vggbVgje4jqYV4s6DJTu9svE5pQVHkLJMw6G2uqo84v80OY565LQUpOOVHpCi3+E+m3XdZjUdEuYBA==
hypertrack-sdk-react-native-plugin-android-activity-service-google@13.6.1:
version "13.6.1"
resolved "https://registry.yarnpkg.com/hypertrack-sdk-react-native-plugin-android-activity-service-google/-/hypertrack-sdk-react-native-plugin-android-activity-service-google-13.6.1.tgz#d3edce439d7007cdde5e5732cd9bd6c7e9985401"
integrity sha512-tQascAcgP48mq9M+G0xk/FNrbuVk/JZrRPA249/b5scthJ4QMwpflzFEM11wjMp5SbrA0NXqh7VsUvZEtwOntg==

hypertrack-sdk-react-native-plugin-android-location-services-google@13.6.1:
version "13.6.1"
resolved "https://registry.yarnpkg.com/hypertrack-sdk-react-native-plugin-android-location-services-google/-/hypertrack-sdk-react-native-plugin-android-location-services-google-13.6.1.tgz#509ec9402c47c9e48a0f7b781d07786dbcd7ca24"
integrity sha512-PLhMTaXHSCi7Urxq5xOWRnS/d951deKy5EgBsGxj8uLRTizyulmU4XqOmksytWPc1XF8we3v1wgalVG6Tu7+ZA==

hypertrack-sdk-react-native-plugin-android-push-service-firebase@13.6.1:
version "13.6.1"
resolved "https://registry.yarnpkg.com/hypertrack-sdk-react-native-plugin-android-push-service-firebase/-/hypertrack-sdk-react-native-plugin-android-push-service-firebase-13.6.1.tgz#e3790259a404744713570a84354e449563a4d220"
integrity sha512-jDIXjDtv0j/MvJTQjFxtdZyjH7qKlf0MlF302d5k5yALsblnLVik/RLQKqHzocBRy5JaAZgNRHmzqq9E3kD87Q==

[email protected]:
version "13.6.1"
resolved "https://registry.yarnpkg.com/hypertrack-sdk-react-native/-/hypertrack-sdk-react-native-13.6.1.tgz#bddd98e129954985517308e6e6df33b96ab568d4"
integrity sha512-24mYucoH+A3927FDRhGCOOmEte9eLbVci2r3ww7PSex6mTxiG1/WUI0lqt9LK/UIZRUvgM0rR4J084khzGuVOg==

ieee754@^1.1.13:
version "1.2.1"
Expand Down Expand Up @@ -5754,6 +5759,11 @@ react-is@^17.0.1:
resolved "https://registry.yarnpkg.com/react-is/-/react-is-17.0.2.tgz#e691d4a8e9c789365655539ab372762b0efb54f0"
integrity sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==

react-native-permissions@^4.1.5:
version "4.1.5"
resolved "https://registry.yarnpkg.com/react-native-permissions/-/react-native-permissions-4.1.5.tgz#db4d1ddbf076570043f4fd4168f54bb6020aec92"
integrity sha512-r6VMRacASmtRHS+GZ+5HQCp9p9kiE+UU9magHOZCXZLTJitdTuVHWZRrb4v4oqZGU+zAp3mZhTQftuMMv+WLUg==

[email protected]:
version "0.72.4"
resolved "https://registry.yarnpkg.com/react-native/-/react-native-0.72.4.tgz#97b57e22e4d7657eaf4d1f62a678511fcf9bdda7"
Expand Down

0 comments on commit 358af48

Please sign in to comment.