From 5111c2dbe2274610738af2546e46df2c375d400d Mon Sep 17 00:00:00 2001 From: pavel-kuznetsov-hypertrack <78730314+pavel-kuznetsov-hypertrack@users.noreply.github.com> Date: Wed, 19 Jun 2024 18:36:46 +0300 Subject: [PATCH] Add worker handle support (#109) --- CHANGELOG.md | 13 ++++++++ README.md | 2 +- docs/assets/search.js | 2 +- docs/classes/HyperTrack.html | 20 ++++++++--- docs/enums/HyperTrackError.html | 4 +-- docs/index.html | 4 +-- docs/modules.html | 4 +-- docs/types/Errors.html | 2 +- docs/types/Failure.html | 2 +- docs/types/Location.html | 2 +- docs/types/LocationError.html | 2 +- docs/types/LocationWithDeviation.html | 2 +- docs/types/NotRunning.html | 2 +- docs/types/OrderStatus.html | 2 +- docs/types/Result.html | 2 +- docs/types/Starting.html | 2 +- docs/types/Success.html | 2 +- .../android/gradle.properties | 2 +- .../package.json | 2 +- .../android/gradle.properties | 2 +- .../package.json | 2 +- .../android/gradle.properties | 2 +- .../package.json | 2 +- sdk/android/gradle.properties | 2 +- .../HyperTrackReactNativePlugin.kt | 10 ++++++ .../common/HyperTrackSdkWrapper.kt | 15 +++++++++ .../common/SdkMethod.kt | 2 ++ .../common/Serialization.kt | 21 ++++++++++-- sdk/ios/HyperTrackReactNativePlugin.m | 7 ++++ sdk/ios/HyperTrackReactNativePlugin.swift | 33 +++++++++++++++++-- sdk/ios/common/HyperTrackSDKWrapper.swift | 30 +++++++++++------ sdk/ios/common/SDKMethod.swift | 2 ++ sdk/ios/common/Serialization.swift | 26 ++++++++++++--- sdk/package.json | 2 +- sdk/src/HyperTrack/HyperTrack.ts | 30 +++++++++++++++++ .../data_types/internal/WorkerHandle.ts | 4 +++ 36 files changed, 216 insertions(+), 49 deletions(-) create mode 100644 sdk/src/HyperTrack/data_types/internal/WorkerHandle.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index e16aacf..24037bb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [13.4.0] - 2024-06-13 + +### Added + +- New `setWorkerHandle` and `getWorkerHandle` can be used to identify workers + - We observed our customers identify worker devices via `HyperTrack.metadata`, so we decided to make it a first class citizen in our API. + - If you previously used `metadata` to identify workers, we suggest using `workerHandle` for this purpose instead. + +### Changed + +- Updated HyperTrack SDK Android to [7.6.0](https://github.com/hypertrack/sdk-android/releases/tag/7.6.0) + ## [13.3.5] - 2024-06-05 ### Changed @@ -856,3 +868,4 @@ Initial release. [13.3.3]: https://github.com/hypertrack/sdk-react-native/releases/tag/13.3.3 [13.3.4]: https://github.com/hypertrack/sdk-react-native/releases/tag/13.3.4 [13.3.5]: https://github.com/hypertrack/sdk-react-native/releases/tag/13.3.5 +[13.4.0]: https://github.com/hypertrack/sdk-react-native/releases/tag/13.4.0 diff --git a/README.md b/README.md index 4b0f5a3..4e94a38 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ [![GitHub](https://img.shields.io/github/license/hypertrack/sdk-react-native?color=orange)](./LICENSE) [![npm](https://img.shields.io/npm/v/hypertrack-sdk-react-native.svg)](https://www.npmjs.com/package/hypertrack-sdk-react-native) [![iOS SDK](https://img.shields.io/badge/iOS%20SDK-5.6.0-brightgreen.svg)](https://github.com/hypertrack/sdk-ios) -[![Android SDK](https://img.shields.io/badge/Android%20SDK-7.5.5-brightgreen.svg)](https://github.com/hypertrack/sdk-android) +[![Android SDK](https://img.shields.io/badge/Android%20SDK-7.6.0-brightgreen.svg)](https://github.com/hypertrack/sdk-android) [HyperTrack](https://www.hypertrack.com) lets you add live location tracking to your mobile app. Live location is made available along with ongoing activity, tracking controls and tracking outage with reasons. diff --git a/docs/assets/search.js b/docs/assets/search.js index b3de0eb..ac49ac9 100644 --- a/docs/assets/search.js +++ b/docs/assets/search.js @@ -1 +1 @@ -window.searchData = "data:application/octet-stream;base64,H4sIAAAAAAAAE61aWW/bRhD+L8qrqmgv2vJbiyRt0PRAkrYPgRHQ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QF2gOqZZb3B77DcvPLjNCyB0EDlv5viSQYo5qlYvysGX+F7ZA5c9plx0O3h63W2vu+V1+xecvSZgyxWF1Tx0u9R6zV2vueM164fbXkuALhUXvN7Xat/YfbNvDOgLoC8Y/Xv3dayot7T3qsAz57hXDOuPHaDvQFFIriqabTF8ZUlAWXKY+xeZoCRBug2r2GwbBekCs0pww6pWy9H+e2ACWBgzMJwaoCaNbMYul7fWwFHWNehozfVUq31o9gGBdIMgJNcZrXre7JQJuu07wBDoE8k1ytBQmZCNLgFKybVOZ6vaLxNX+2XAnAO1rLhibk18jYp7erCDYjS8le4FNxh0wL/h8pqkYbupxt0Hb7pdH7n79JihTTXg0kC9Ka7gkrQgbqsKJFZxiU3dC8C8eTUIrgi0t8ddEfhY3yY3aL7TgyhAyymu5QhLEdgkc5tmN2CTDDAO73DcLY4wbhMWgD0twCC4bsW1J2HwEW5CAebALVBx/UqYy+odI363YwSYBFWquMlHmuz3eABrYCKoCZwTuCmDgA3mguLmQtZ81wHVBorccGr5hJWKAPUguHrI2TWHAPQFRz/nVh0CwBYc7JxePQhAVXBUc2L9APgJjl8+sn4AwASb+W4zCBiWoK0119bdNuciPV4dCjCeBDeegAWGmQSzV3JTG5mh2ElQgZIbs8AKdYuX8EGIT0nzMRJUP9AzXCKOHu9AwLp5jNO6+XtZ//Wa4x5XjM3nJWAVlLDeNdrNasUjy9I+jT5Gj2FsB6l9EL1+efkfyvBlPl05AAA="; \ No newline at end of file diff --git a/docs/classes/HyperTrack.html b/docs/classes/HyperTrack.html index 56e7b40..d146027 100644 --- a/docs/classes/HyperTrack.html +++ b/docs/classes/HyperTrack.html @@ -1,4 +1,4 @@ -
Metadata JSON
Static
getStatic
locateRequests one-time location update and returns the location once it is available, or error.
+Static
getA primary identifier that uniquely identifies the worker outside of HyperTrack. +Example: email, phone number, database id +It is usually obtained and set when the worker logs into the app. +Set it to an empty string "" when the worker logs out of the app to un-bind the device from the worker and +avoid unintentional tracking.
+Static
locateRequests one-time location update and returns the location once it is available, or error.
Only one locate subscription can be active at a time. If you re-subscribe, the old EmitterSubscription will be automaticaly removed.
This method will start location tracking if called, and will stop it when the location is received or @@ -64,7 +71,12 @@
Static
setStatic
setStatic
subscribeStatic
setA primary identifier that uniquely identifies the worker outside of HyperTrack. +Example: email, phone number, database id +It is usually obtained and set when the worker logs into the app. +Set it to an empty string "" when the worker logs out of the app to un-bind the device from the worker and +avoid unintentional tracking.
+Static
subscribeSubscribe to tracking errors
EmitterSubscription
const subscription = HyperTrack.subscribeToErrors(errors => {
errors.forEach(error => {
// ... error
})
})
// later, to stop listening
subscription.remove()
@@ -80,4 +92,4 @@
EmitterSubscription
const subscription = HyperTrack.subscribeToLocation(location => {
...
})
// later, to stop listening
subscription.remove()
-[iOS only] The app is not authorized to use location services.
[Android only] The user denied notification permissions needed to display a persistent notification needed for foreground location tracking.
-
Gets the name that is set for the device