From e21bf1fb7294fea58d55d97f3e55a14401e83797 Mon Sep 17 00:00:00 2001 From: pavel-kuznetsov-hypertrack <78730314+pavel-kuznetsov-hypertrack@users.noreply.github.com> Date: Thu, 25 Jan 2024 14:53:53 +0200 Subject: [PATCH] Add dynamic pubishable key API (#93) Update HyperTrack SDK iOS to 5.3.0 and Android to 7.3.0 --------- Co-authored-by: Fero --- CHANGELOG.md | 16 ++++++++ README.md | 4 +- docs/assets/search.js | 2 +- docs/classes/HyperTrack.html | 18 +++++---- 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/Result.html | 2 +- docs/types/Starting.html | 2 +- docs/types/Success.html | 2 +- justfile | 6 +-- .../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 | 13 +++++++ .../common/SdkMethod.kt | 2 + .../common/Serialization.kt | 17 +++++++++ sdk/hypertrack-sdk-react-native.podspec | 2 +- sdk/ios/HyperTrackReactNativePlugin.m | 7 ++++ sdk/ios/HyperTrackReactNativePlugin.swift | 27 ++++++++++++++ sdk/ios/common/HyperTrackSDKWrapper.swift | 11 ++++++ sdk/ios/common/SDKMethod.swift | 2 + sdk/ios/common/Serialization.swift | 19 ++++++++++ sdk/package.json | 2 +- sdk/src/HyperTrack/HyperTrack.ts | 37 +++++++++++++++++-- .../internal/DynamicPublishableKey.ts | 4 ++ 37 files changed, 201 insertions(+), 42 deletions(-) create mode 100644 sdk/src/HyperTrack/data_types/internal/DynamicPublishableKey.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index 510179f6..264d30dc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [13.0.0] - 2024-01-24 + +### Added + +- New Dynamic publishable key API allows to set the publishable key later in the app lifecycle. It should be used only when there is no other way around it and it's impossible to know the publishable key in advance at the build time. Please contact us if this matches your use case + +### Changed + +- Updated HyperTrack SDK iOS to 5.3.0 +- Updated HyperTrack SDK Android to 7.3.0 + +### Fixed + +- Remove async from `setIsAvailable`, `setIsTracking`, `setMetadata`, `setName` methods + ## [12.1.0] - 2024-01-17 ### Fixed @@ -754,3 +769,4 @@ Initial release. [11.0.11]: https://github.com/hypertrack/sdk-react-native/releases/tag/11.0.11 [12.0.0]: https://github.com/hypertrack/sdk-react-native/releases/tag/12.0.0 [12.1.0]: https://github.com/hypertrack/sdk-react-native/releases/tag/12.1.0 +[13.0.0]: https://github.com/hypertrack/sdk-react-native/releases/tag/13.0.0 diff --git a/README.md b/README.md index 6eee1873..a002a800 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,8 @@ [![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.2.0-brightgreen.svg)](https://github.com/hypertrack/sdk-ios) -[![Android SDK](https://img.shields.io/badge/Android%20SDK-7.2.0-brightgreen.svg)](https://github.com/hypertrack/sdk-android) +[![iOS SDK](https://img.shields.io/badge/iOS%20SDK-5.3.0-brightgreen.svg)](https://github.com/hypertrack/sdk-ios) +[![Android SDK](https://img.shields.io/badge/Android%20SDK-7.3.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 9b7483bb..7b48c0a9 100644 --- a/docs/assets/search.js +++ b/docs/assets/search.js @@ -1 +1 @@ -window.searchData = "data:application/octet-stream;base64,H4sIAAAAAAAAE62aW4+jxhKA/wv76njdN2zPW6LN5qxOEkW7Oec8rEYrxjAzaDGMuEwSjea/n27AUIWrMAx+soG6UV9VdwP94uXZX4V38/XF+x6noXcj5G7lpcEx8m68f/3zFOV/5sHhu7fyqjyxpw5JUBRR8b6/tH4sj4m93l6xMt7rqrO2kbozl2SHoIy+VHfFIY+fyjhLL5l9R6r0nsoi/CEufnjK42crZi89BXmUljj0Phq50f3NBWH4S5SVwcPFIKAkuMtZ3h6i8kP0HB+iT+FFf1h2gcef8zzLiyn+OskF3j4VPz4HcRLcJdEUl1h8kd9aIk4vkxxKL/D6q6vMKSWMZRd4/C0qgzAogykegewCj7+7fxO8tXJv9dQ0+cSxYIGfYl6Nnokv8ju5RofSC7xOrpjiKhVTTKyYYnHFFM2EcBf9mU0c4yiNK3ifVU+c2lXimF5fjNYVopg8JtI6MyIwQnYBHLK0KPPqUGb5RcdYdoZDalFUF1LnMkqrI3RYXx1fHPmd0Ts7uH2Pwo95dvxcpSnkyNt9R2pduqkmajKKOH0Okjj8o7pL4uLRVee/o3+mBMIpLoglaevit/oWpwRxpnEF71+i3C3Eig9x4e5qVhyE7hUj+k8anI08M4LC6teIK35Ig+TXrChnhQO1FkSRZj//HR3rBwTXDT9Z6Yc8q9LwSxnk5efINn18cFeLKdHNsrYgaityjIvCGToNgx+iNJ5WZmPK143pU1pU9/fxIbZmPmZ5n443hjlm77qR/57ZJ6nSnU/fnNShjetG+EeePcfuTJC8MT5s4brRfY7C6hCFPx4OlVWeNBVMsnLtKJuGfDNiZOA6sdmqiW2J1+aLNzU1bWFudHKz3wrTL5as1eECo7TKxfv+wuiaxTdG9Tf87ZtTHrf0rhOiYwcRMe+NJvtYT3S0bkPi01QP9OdJOp1emiJk51KCulimp4eyP56cTuNiak5Ng1e/jV90bTRJQ6uDx7jGXHNy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yoQRh+NDujOs9yd6RZPTaD9f3eXbMT2+jgQEBLAjGBPqS3+vaJUanK/aMbrfk7/Vsijs9X7F63TuYXlPrXlNzHqP29SZQAw41l6f705Mj0AM3aDh3D1EZ1jsI4xDVACgBXpOIFYTK68UF+KQMMgviHVMuu60ovS6oWZ/X7d/U9ZrbXnPLax67TU+95q7X3PGazXNfrwWocFAe3UeastlN2yuCMuC6rFeMmnfuoFWAuuT0290ZT/3ujO9udwawAluWq8X+fRooDAiXVWz37YEmBVELLupGrUBbf4EJYGHMwLBZQQvoXTvKjUZgDZxlXQHa+pL7Y7sdBaQbBCG5RjypF+2GjbDbRQIMgcaUXGcODVUp2aYSoJRco3a26m0bSb1tA5gA7Sq5fj2Z+CsuH+nxFBSj5q1071mBJvBvuLymWXTa2+Gmn7tu80HhvoDlaG8HuDUwnkhuQEmzkpjNFEis4hILvvueEhS2n3xBEGBoktzYRFiKwX6L+yy/A/stgHFQ05Ibwgjj9qZDsD0C3DdocsW1GGHwCe5nAOZAxyuu5whzebP5IOg2HwCToNIUN3qRJvvtAsAanF256gPWUvh9/xy2Ar2tuN7O208EoAdAoRpOrWAnawHHVS7LBTddC5BQwSW0oKddAdInuPQV5xOvAHkS7A13n/NBgkE3Ka6buo2qZXa+LBKgswXX2cACl3MwbAluwENmyNwD8IIboYAVanYUICWCT0n7OQkUHdAzXCLOHkhAwKp98NCb9le3U3N73udKsf1AAEIBBaxNa6Wd6H2yJO3z01P8FCV2/LKPTrevr/8H/2rQLxM1AAA="; \ No newline at end of file +window.searchData = "data:application/octet-stream;base64,H4sIAAAAAAAAE62aWXOcSBKA/wt+7WmrLtStt9nweNexMxMT9uzug0PhQA2SCNOg4NCMQ6H/vlWcmXQmDaKfuoG8yK8yq4B68fLsr8K7+frifY/T0LsRcrfx0uAYeTfev348RfmfeXD47m28Kk/sqUMSFEVUvB8ubR/LY2Kvt1esjPe66a1dSd2bS7JDUEZfqrvikMdPZZyl58y+I1UGT2UR/hQXPz3l8bMVs5eegj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AKIDKvYbnAE6QLFILhiaNQKtF8bmAAWpgyMqx4O5qu2XXJ56wycZF0D75oryU772O6VAekGQUiupDr1ot1NEvZbXIAhUF2SK6+xoSolC1UClJIrt95WvackqfeUABOg7CRXd52Jv+LykW7MsE/xVvqXwEAT+DdcXtMs6jaeuHnsrt8ZUbjPcznaeAJuDfQFyTWGNCuJaVGBxCouseCjdJegsP0eDSyBXqG4ZkFYisFmkPssvwObQYBxMKYVV1KEcXvTIdi7AQyC1qS4EiMMPsHNFsAcnAW5miPM5c3OiKDfGQFMgpGmuO5Fmhz2MgBroKoVN/qAtRRuPiBgg9pWXG3n7fcLUANgoBpOrZixWhAAn+DwFey8LwAuweEquJlfADKCI1PQM7gAHATHoSDmcJBwwWau37QAUg7KUnNl2W/HLbPTFZYALUJwLQJY4HIO+p/gOicyQ+YejCDBtTpghZpmJUiJ5FPSfjQDS02gZ7hEnDwigYBV+yikZfvrt3N8e97nhmL7GQRQBQNYX7fa7YrBJ4ekfaJ7ip+ixDZC+zB3+/r6f8epCZoRNwAA"; \ No newline at end of file diff --git a/docs/classes/HyperTrack.html b/docs/classes/HyperTrack.html index fe4aa789..cda3f1d2 100644 --- a/docs/classes/HyperTrack.html +++ b/docs/classes/HyperTrack.html @@ -1,7 +1,8 @@ -HyperTrack | HyperTrack React Native SDK API - v12.1.0

Constructors

constructor +HyperTrack | HyperTrack React Native SDK API - v13.0.0

Returns Promise<Result<LocationWithDeviation, LocationError>>

location with deviation if success or LocationError if failure

  • Returns a string that is used to uniquely identify the device

    Returns Promise<string>

    Device ID

    -
  • Returns a list of errors that blocks SDK from tracking

    +
  • Returns Promise<string>

  • Reflects availability of the device for the Nearby search

    Returns Promise<boolean>

    true when is available or false when unavailable

    @@ -46,12 +48,12 @@

Parameters

Returns EmitterSubscription

EmitterSubscription

Example

const subscription = HyperTrack.locate(location => {
...
})

// to unsubscribe
subscription.remove()
-
  • Sets the availability of the device for the Nearby search

    -

    Parameters

    • isAvailable: boolean

    Returns Promise<void>

  • Sets the tracking intent for the device

    -

    Parameters

    • isTracking: boolean

    Returns Promise<void>

  • Sets the metadata for the device

    +
  • Parameters

    • dynamicPublishableKey: string

    Returns void

  • Sets the availability of the device for the Nearby search

    +

    Parameters

    • isAvailable: boolean

    Returns void

  • Sets the tracking intent for the device

    +

    Parameters

    • isTracking: boolean

    Returns void

  • Sets the metadata for the device

    Parameters

    • data: Object

      Metadata JSON

      -

    Returns Promise<void>

  • Sets the name for the device

    -

    Parameters

    • name: string

    Returns Promise<void>

  • Subscribe to tracking errors

    +

Returns void

  • Sets the name for the device

    +

    Parameters

    • name: string

    Returns void

  • Subscribe to tracking errors

    Parameters

    • listener: ((errors) => void)

    Returns EmitterSubscription

    EmitterSubscription

    Example

    const subscription = HyperTrack.subscribeToErrors(errors => {
    errors.forEach(error => {
    // ... error
    })
    })

    // later, to stop listening
    subscription.remove()
    @@ -67,4 +69,4 @@

    Parameters

    Returns EmitterSubscription

    EmitterSubscription

    Example

    const subscription = HyperTrack.subscribeToLocation(location => {
    ...
    })

    // later, to stop listening
    subscription.remove()
    -
\ No newline at end of file +
\ No newline at end of file diff --git a/docs/enums/HyperTrackError.html b/docs/enums/HyperTrackError.html index c205aef9..8ada428e 100644 --- a/docs/enums/HyperTrackError.html +++ b/docs/enums/HyperTrackError.html @@ -1,4 +1,4 @@ -HyperTrackError | HyperTrack React Native SDK API - v12.1.0

Enumeration Members

blockedFromRunning +HyperTrackError | HyperTrack React Native SDK API - v13.0.0

Enumeration Members

permissionsLocationRestricted: "permissions.location.restricted"

[iOS only] The app is not authorized to use location services.

permissionsNotificationsDenied: "permissions.notifications.denied"

[Android only] The user denied notification permissions needed to display a persistent notification needed for foreground location tracking.

-
\ No newline at end of file +
\ No newline at end of file diff --git a/docs/index.html b/docs/index.html index 6860e3ca..e16a50ac 100644 --- a/docs/index.html +++ b/docs/index.html @@ -1,2 +1,2 @@ -HyperTrack React Native SDK API - v12.1.0

HyperTrack React Native SDK API - v12.1.0

hypertrack-sdk-react-native

The main package for HyperTrack SDK React Native.

-
\ No newline at end of file +HyperTrack React Native SDK API - v13.0.0

HyperTrack React Native SDK API - v13.0.0

hypertrack-sdk-react-native

The main package for HyperTrack SDK React Native.

+
\ No newline at end of file diff --git a/docs/modules.html b/docs/modules.html index c7158d96..fd4a503c 100644 --- a/docs/modules.html +++ b/docs/modules.html @@ -1,4 +1,4 @@ -HyperTrack React Native SDK API - v12.1.0

HyperTrack React Native SDK API - v12.1.0

References

default +HyperTrack React Native SDK API - v13.0.0

HyperTrack React Native SDK API - v13.0.0

References

Enumerations

Classes

Type Aliases

Location @@ -10,4 +10,4 @@ Result NotRunning Starting -

References

Renames and re-exports HyperTrack
\ No newline at end of file +

References

Renames and re-exports HyperTrack
\ No newline at end of file diff --git a/docs/types/Errors.html b/docs/types/Errors.html index 92036ba6..917bd386 100644 --- a/docs/types/Errors.html +++ b/docs/types/Errors.html @@ -1 +1 @@ -Errors | HyperTrack React Native SDK API - v12.1.0
Errors: {
    type: "errors";
    value: HyperTrackError[];
}

Type declaration

\ No newline at end of file +Errors | HyperTrack React Native SDK API - v13.0.0
Errors: {
    type: "errors";
    value: HyperTrackError[];
}

Type declaration

\ No newline at end of file diff --git a/docs/types/Failure.html b/docs/types/Failure.html index c9b2cfed..a63a16b3 100644 --- a/docs/types/Failure.html +++ b/docs/types/Failure.html @@ -1 +1 @@ -Failure | HyperTrack React Native SDK API - v12.1.0
Failure<F>: {
    type: "failure";
    value: F;
}

Type Parameters

  • F

Type declaration

  • type: "failure"
  • value: F
\ No newline at end of file +Failure | HyperTrack React Native SDK API - v13.0.0
Failure<F>: {
    type: "failure";
    value: F;
}

Type Parameters

  • F

Type declaration

  • type: "failure"
  • value: F
\ No newline at end of file diff --git a/docs/types/Location.html b/docs/types/Location.html index e260c088..b65ce028 100644 --- a/docs/types/Location.html +++ b/docs/types/Location.html @@ -1 +1 @@ -Location | HyperTrack React Native SDK API - v12.1.0
Location: {
    latitude: number;
    longitude: number;
}

Type declaration

  • latitude: number
  • longitude: number
\ No newline at end of file +Location | HyperTrack React Native SDK API - v13.0.0
Location: {
    latitude: number;
    longitude: number;
}

Type declaration

  • latitude: number
  • longitude: number
\ No newline at end of file diff --git a/docs/types/LocationError.html b/docs/types/LocationError.html index 0cd5cccd..03356860 100644 --- a/docs/types/LocationError.html +++ b/docs/types/LocationError.html @@ -1 +1 @@ -LocationError | HyperTrack React Native SDK API - v12.1.0
\ No newline at end of file +LocationError | HyperTrack React Native SDK API - v13.0.0
\ No newline at end of file diff --git a/docs/types/LocationWithDeviation.html b/docs/types/LocationWithDeviation.html index 0188a60f..82edb17f 100644 --- a/docs/types/LocationWithDeviation.html +++ b/docs/types/LocationWithDeviation.html @@ -1 +1 @@ -LocationWithDeviation | HyperTrack React Native SDK API - v12.1.0
LocationWithDeviation: {
    location: Location;
    deviation: number;
}

Type declaration

\ No newline at end of file +LocationWithDeviation | HyperTrack React Native SDK API - v13.0.0
LocationWithDeviation: {
    location: Location;
    deviation: number;
}

Type declaration

\ No newline at end of file diff --git a/docs/types/NotRunning.html b/docs/types/NotRunning.html index 5e6c3de6..13b22563 100644 --- a/docs/types/NotRunning.html +++ b/docs/types/NotRunning.html @@ -1 +1 @@ -NotRunning | HyperTrack React Native SDK API - v12.1.0
NotRunning: {
    type: "notRunning";
}

Type declaration

  • type: "notRunning"
\ No newline at end of file +NotRunning | HyperTrack React Native SDK API - v13.0.0
NotRunning: {
    type: "notRunning";
}

Type declaration

  • type: "notRunning"
\ No newline at end of file diff --git a/docs/types/Result.html b/docs/types/Result.html index e57a70a1..35e9ed9a 100644 --- a/docs/types/Result.html +++ b/docs/types/Result.html @@ -1 +1 @@ -Result | HyperTrack React Native SDK API - v12.1.0
Result<S, F>: Success<S> | Failure<F>

Type Parameters

  • S

  • F

\ No newline at end of file +Result | HyperTrack React Native SDK API - v13.0.0
Result<S, F>: Success<S> | Failure<F>

Type Parameters

  • S

  • F

\ No newline at end of file diff --git a/docs/types/Starting.html b/docs/types/Starting.html index 79735886..c8b17766 100644 --- a/docs/types/Starting.html +++ b/docs/types/Starting.html @@ -1 +1 @@ -Starting | HyperTrack React Native SDK API - v12.1.0
Starting: {
    type: "starting";
}

Type declaration

  • type: "starting"
\ No newline at end of file +Starting | HyperTrack React Native SDK API - v13.0.0
Starting: {
    type: "starting";
}

Type declaration

  • type: "starting"
\ No newline at end of file diff --git a/docs/types/Success.html b/docs/types/Success.html index 14f694d6..1f7d598a 100644 --- a/docs/types/Success.html +++ b/docs/types/Success.html @@ -1 +1 @@ -Success | HyperTrack React Native SDK API - v12.1.0
Success<S>: {
    type: "success";
    value: S;
}

Type Parameters

  • S

Type declaration

  • type: "success"
  • value: S
\ No newline at end of file +Success | HyperTrack React Native SDK API - v13.0.0
Success<S>: {
    type: "success";
    value: S;
}

Type Parameters

  • S

Type declaration

  • type: "success"
  • value: S
\ No newline at end of file diff --git a/justfile b/justfile index fd858425..355aaa50 100644 --- a/justfile +++ b/justfile @@ -119,7 +119,7 @@ update-sdk-ios-latest wrapper_version commit="true" branch="true": LATEST_IOS=$(just latest-ios) just update-sdk-ios {{wrapper_version}} $LATEST_IOS {{commit}} {{branch}} -update-sdk wrapper_version ios_version android_version commit="true" branch="true": +update-sdk wrapper_version ios_version android_version commit="true" branch="true": build #!/usr/bin/env sh set -euo pipefail if [ "{{branch}}" = "true" ] ; then @@ -141,7 +141,7 @@ update-sdk wrapper_version ios_version android_version commit="true" branch="tru git commit -m "Update HyperTrack SDK iOS to {{ios_version}} and Android to {{android_version}}" fi -update-sdk-android wrapper_version android_version commit="true" branch="true": +update-sdk-android wrapper_version android_version commit="true" branch="true": build #!/usr/bin/env sh set -euo pipefail if [ "{{branch}}" = "true" ] ; then @@ -159,7 +159,7 @@ update-sdk-android wrapper_version android_version commit="true" branch="true": git commit -m "Update HyperTrack SDK Android to {{android_version}}" fi -update-sdk-ios wrapper_version ios_version commit="true" branch="true": +update-sdk-ios wrapper_version ios_version commit="true" branch="true": build #!/usr/bin/env sh set -euo pipefail if [ "{{branch}}" = "true" ] ; then diff --git a/plugin_android_location_services_google/android/gradle.properties b/plugin_android_location_services_google/android/gradle.properties index c23c70f3..6c047e02 100644 --- a/plugin_android_location_services_google/android/gradle.properties +++ b/plugin_android_location_services_google/android/gradle.properties @@ -3,4 +3,4 @@ PluginAndroidLocationServicesGoogle_minSdkVersion=21 PluginAndroidLocationServicesGoogle_targetSdkVersion=31 PluginAndroidLocationServicesGoogle_compileSdkVersion=31 PluginAndroidLocationServicesGoogle_ndkversion=21.4.7075529 -PluginAndroidLocationServicesGoogle_HyperTrackSDKVersion=7.2.0 +PluginAndroidLocationServicesGoogle_HyperTrackSDKVersion=7.3.0 diff --git a/plugin_android_location_services_google/package.json b/plugin_android_location_services_google/package.json index 452e6ed9..bc495418 100644 --- a/plugin_android_location_services_google/package.json +++ b/plugin_android_location_services_google/package.json @@ -1,6 +1,6 @@ { "name": "hypertrack-sdk-react-native-plugin-android-location-services-google", - "version": "12.1.0", + "version": "13.0.0", "description": "A wrapper around `Location Services Google` plugin for HyperTrack SDK Android that is used with `hypertrack-sdk-react-native`", "main": "lib/commonjs/index", "module": "lib/module/index", diff --git a/plugin_android_location_services_google_19_0_1/android/gradle.properties b/plugin_android_location_services_google_19_0_1/android/gradle.properties index c3778331..0b3646ea 100644 --- a/plugin_android_location_services_google_19_0_1/android/gradle.properties +++ b/plugin_android_location_services_google_19_0_1/android/gradle.properties @@ -3,4 +3,4 @@ PluginAndroidLocationServicesGoogle1901_minSdkVersion=21 PluginAndroidLocationServicesGoogle1901_targetSdkVersion=31 PluginAndroidLocationServicesGoogle1901_compileSdkVersion=31 PluginAndroidLocationServicesGoogle1901_ndkversion=21.4.7075529 -PluginAndroidLocationServicesGoogle1901_HyperTrackSDKVersion=7.2.0 +PluginAndroidLocationServicesGoogle1901_HyperTrackSDKVersion=7.3.0 diff --git a/plugin_android_location_services_google_19_0_1/package.json b/plugin_android_location_services_google_19_0_1/package.json index 7d986ddc..4a0c7714 100644 --- a/plugin_android_location_services_google_19_0_1/package.json +++ b/plugin_android_location_services_google_19_0_1/package.json @@ -1,6 +1,6 @@ { "name": "hypertrack-sdk-react-native-plugin-android-location-services-google-19-0-1", - "version": "12.1.0", + "version": "13.0.0", "description": "A wrapper around `Location Services Google 19.0.1` plugin for HyperTrack SDK Android that is used with `hypertrack-sdk-react-native`", "main": "lib/commonjs/index", "module": "lib/module/index", diff --git a/plugin_android_push_service_firebase/android/gradle.properties b/plugin_android_push_service_firebase/android/gradle.properties index ccb27f49..30a24cee 100644 --- a/plugin_android_push_service_firebase/android/gradle.properties +++ b/plugin_android_push_service_firebase/android/gradle.properties @@ -3,4 +3,4 @@ PluginAndroidPushServiceFirebase_minSdkVersion=21 PluginAndroidPushServiceFirebase_targetSdkVersion=31 PluginAndroidPushServiceFirebase_compileSdkVersion=31 PluginAndroidPushServiceFirebase_ndkversion=21.4.7075529 -PluginAndroidPushServiceFirebase_HyperTrackSDKVersion=7.2.0 +PluginAndroidPushServiceFirebase_HyperTrackSDKVersion=7.3.0 diff --git a/plugin_android_push_service_firebase/package.json b/plugin_android_push_service_firebase/package.json index 5860f37c..60287d20 100644 --- a/plugin_android_push_service_firebase/package.json +++ b/plugin_android_push_service_firebase/package.json @@ -1,6 +1,6 @@ { "name": "hypertrack-sdk-react-native-plugin-android-push-service-firebase", - "version": "12.1.0", + "version": "13.0.0", "description": "A wrapper around `Push Service Firebase` plugin for HyperTrack SDK Android that is used with `hypertrack-sdk-react-native`", "main": "lib/commonjs/index", "module": "lib/module/index", diff --git a/sdk/android/gradle.properties b/sdk/android/gradle.properties index 5ef572b1..388005c8 100644 --- a/sdk/android/gradle.properties +++ b/sdk/android/gradle.properties @@ -1,3 +1,3 @@ HyperTrackSdk_kotlinVersion=1.6.21 -HyperTrackSdk_HyperTrackSDKVersion=7.2.0 +HyperTrackSdk_HyperTrackSDKVersion=7.3.0 android.useAndroidX=true diff --git a/sdk/android/src/main/java/com/reactnativehypertracksdk/HyperTrackReactNativePlugin.kt b/sdk/android/src/main/java/com/reactnativehypertracksdk/HyperTrackReactNativePlugin.kt index 8186ab09..616c3017 100644 --- a/sdk/android/src/main/java/com/reactnativehypertracksdk/HyperTrackReactNativePlugin.kt +++ b/sdk/android/src/main/java/com/reactnativehypertracksdk/HyperTrackReactNativePlugin.kt @@ -75,6 +75,11 @@ class HyperTrackReactNativePlugin(reactContext: ReactApplicationContext?) : HyperTrackSdkWrapper.getDeviceId().toPromise(promise) } + @ReactMethod + fun getDynamicPublishableKey(promise: Promise) { + HyperTrackSdkWrapper.getDynamicPublishableKey().toPromise(promise) + } + @ReactMethod fun getErrors(promise: Promise) { HyperTrackSdkWrapper.getErrors().toPromise(promise) @@ -114,6 +119,11 @@ class HyperTrackReactNativePlugin(reactContext: ReactApplicationContext?) : Success(Unit).toPromise(promise) } + @ReactMethod + fun setDynamicPublishableKey(args: ReadableMap) { + HyperTrackSdkWrapper.setDynamicPublishableKey(args.toHashMap()) + } + @ReactMethod fun setIsAvailable(args: ReadableMap) { HyperTrackSdkWrapper.setIsAvailable(args.toHashMap()) diff --git a/sdk/android/src/main/java/com/reactnativehypertracksdk/common/HyperTrackSdkWrapper.kt b/sdk/android/src/main/java/com/reactnativehypertracksdk/common/HyperTrackSdkWrapper.kt index b59ddafa..583a48f2 100644 --- a/sdk/android/src/main/java/com/reactnativehypertracksdk/common/HyperTrackSdkWrapper.kt +++ b/sdk/android/src/main/java/com/reactnativehypertracksdk/common/HyperTrackSdkWrapper.kt @@ -5,12 +5,14 @@ import com.hypertrack.sdk.android.HyperTrack import com.hypertrack.sdk.android.HyperTrack.metadata import com.hypertrack.sdk.android.Json import com.hypertrack.sdk.android.Result +import com.reactnativehypertracksdk.common.Serialization.deserializeDynamicPublishableKey import com.reactnativehypertracksdk.common.Serialization.deserializeIsAvailable import com.reactnativehypertracksdk.common.Serialization.deserializeName import com.reactnativehypertracksdk.common.Serialization.deserializeGeotagData import com.reactnativehypertracksdk.common.Serialization.deserializeIsTracking import com.reactnativehypertracksdk.common.Serialization.deserializeMetadata import com.reactnativehypertracksdk.common.Serialization.serializeDeviceId +import com.reactnativehypertracksdk.common.Serialization.serializeDynamicPublishableKey import com.reactnativehypertracksdk.common.Serialization.serializeErrors import com.reactnativehypertracksdk.common.Serialization.serializeIsAvailable import com.reactnativehypertracksdk.common.Serialization.serializeIsTracking @@ -70,6 +72,10 @@ internal object HyperTrackSdkWrapper { return Success(serializeDeviceId(HyperTrack.deviceID)) } + fun getDynamicPublishableKey(): WrapperResult { + return Success(serializeDynamicPublishableKey(HyperTrack.dynamicPublishableKey)) + } + fun getErrors(): WrapperResult> { return Success(serializeErrors(HyperTrack.errors)) } @@ -110,6 +116,13 @@ internal object HyperTrackSdkWrapper { ) } + fun setDynamicPublishableKey(args: Serialized): WrapperResult { + return deserializeDynamicPublishableKey(args) + .mapSuccess { publishableKey -> + HyperTrack.dynamicPublishableKey = publishableKey + } + } + fun setIsAvailable(args: Serialized): WrapperResult { return deserializeIsAvailable(args) .mapSuccess { isAvailable -> diff --git a/sdk/android/src/main/java/com/reactnativehypertracksdk/common/SdkMethod.kt b/sdk/android/src/main/java/com/reactnativehypertracksdk/common/SdkMethod.kt index 13fde756..3d6ddd9f 100644 --- a/sdk/android/src/main/java/com/reactnativehypertracksdk/common/SdkMethod.kt +++ b/sdk/android/src/main/java/com/reactnativehypertracksdk/common/SdkMethod.kt @@ -9,6 +9,7 @@ package com.reactnativehypertracksdk.common internal enum class SdkMethod { addGeotag, getDeviceID, + getDynamicPublishableKey, getErrors, getIsAvailable, getIsTracking, @@ -16,6 +17,7 @@ internal enum class SdkMethod { getMetadata, getName, locate, + setDynamicPublishableKey, setIsAvailable, setIsTracking, setMetadata, diff --git a/sdk/android/src/main/java/com/reactnativehypertracksdk/common/Serialization.kt b/sdk/android/src/main/java/com/reactnativehypertracksdk/common/Serialization.kt index 189cd7ed..55154906 100644 --- a/sdk/android/src/main/java/com/reactnativehypertracksdk/common/Serialization.kt +++ b/sdk/android/src/main/java/com/reactnativehypertracksdk/common/Serialization.kt @@ -10,6 +10,15 @@ import com.hypertrack.sdk.android.Result */ internal object Serialization { + fun deserializeDynamicPublishableKey(args: Serialized): WrapperResult { + return parse(args) { + it.assertValue(key = KEY_TYPE, value = TYPE_DYNAMIC_PUBLISHABLE_KEY) + it + .get(KEY_VALUE) + .getOrThrow() + } + } + fun deserializeIsAvailable(isAvailable: Map): WrapperResult { return parse(isAvailable) { it.assertValue(key = KEY_TYPE, value = TYPE_IS_AVAILABLE) @@ -66,6 +75,13 @@ internal object Serialization { ) } + fun serializeDynamicPublishableKey(publishableKey: String): Serialized { + return mapOf( + KEY_TYPE to TYPE_DYNAMIC_PUBLISHABLE_KEY, + KEY_VALUE to publishableKey + ) + } + fun serializeError(error: HyperTrack.Error): Map { return mapOf( KEY_TYPE to TYPE_ERROR, @@ -340,6 +356,7 @@ internal object Serialization { private const val TYPE_RESULT_SUCCESS = "success" private const val TYPE_DEVICE_ID = "deviceID" + private const val TYPE_DYNAMIC_PUBLISHABLE_KEY = "dynamicPublishableKey" private const val TYPE_ERROR = "error" private const val TYPE_IS_AVAILABLE = "isAvailable" private const val TYPE_IS_TRACKING = "isTracking" diff --git a/sdk/hypertrack-sdk-react-native.podspec b/sdk/hypertrack-sdk-react-native.podspec index 5b0588e7..ef2ca32d 100644 --- a/sdk/hypertrack-sdk-react-native.podspec +++ b/sdk/hypertrack-sdk-react-native.podspec @@ -18,7 +18,7 @@ Pod::Spec.new do |s| s.source_files = "ios/**/*.{h,m,mm,swift}" s.dependency "React-Core" - s.dependency 'HyperTrack', '5.2.0' + s.dependency 'HyperTrack', '5.3.0' # Don't install the dependencies when we run `pod install` in the old architecture. if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then diff --git a/sdk/ios/HyperTrackReactNativePlugin.m b/sdk/ios/HyperTrackReactNativePlugin.m index 42355ded..952ac841 100644 --- a/sdk/ios/HyperTrackReactNativePlugin.m +++ b/sdk/ios/HyperTrackReactNativePlugin.m @@ -16,6 +16,9 @@ @interface RCT_EXTERN_MODULE(HyperTrackReactNativePlugin, RCTEventEmitter) RCT_EXTERN_METHOD(getDeviceId:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) +RCT_EXTERN_METHOD(getDynamicPublishableKey:(RCTPromiseResolveBlock)resolve + rejecter:(RCTPromiseRejectBlock)reject) + RCT_EXTERN_METHOD(getErrors:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) @@ -37,6 +40,10 @@ @interface RCT_EXTERN_MODULE(HyperTrackReactNativePlugin, RCTEventEmitter) RCT_EXTERN_METHOD(locate:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) +RCT_EXTERN_METHOD(setDynamicPublishableKey:(NSDictionary *)args + resolver:(RCTPromiseResolveBlock)resolve + rejecter:(RCTPromiseRejectBlock)reject) + RCT_EXTERN_METHOD(setIsAvailable:(NSDictionary *)args resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) diff --git a/sdk/ios/HyperTrackReactNativePlugin.swift b/sdk/ios/HyperTrackReactNativePlugin.swift index fd998564..2c66df65 100644 --- a/sdk/ios/HyperTrackReactNativePlugin.swift +++ b/sdk/ios/HyperTrackReactNativePlugin.swift @@ -84,6 +84,18 @@ class HyperTrackReactNativePlugin: RCTEventEmitter { ) } + @objc func getDynamicPublishableKey( + _ resolve: RCTPromiseResolveBlock, + rejecter reject: RCTPromiseRejectBlock + ) { + sendAsPromise( + .success(.dict(["dynamicPublishableKey": HyperTrack.dynamicPublishableKey])), + method: .getDynamicPublishableKey, + resolve, + reject + ) + } + @objc func getErrors( _ resolve: RCTPromiseResolveBlock, rejecter reject: RCTPromiseRejectBlock @@ -174,6 +186,21 @@ class HyperTrackReactNativePlugin: RCTEventEmitter { ) } + @objc func setDynamicPublishableKey( + _ args: NSDictionary, + resolver resolve: RCTPromiseResolveBlock, + rejecter reject: RCTPromiseRejectBlock + ) { + sendAsPromise( + hypertrack_sdk_react_native.setDynamicPublishableKey( + args as! [String: Any] + ), + method: .setDynamicPublishableKey, + resolve, + reject + ) + } + @objc func setIsAvailable( _ args: NSDictionary, resolver resolve: RCTPromiseResolveBlock, diff --git a/sdk/ios/common/HyperTrackSDKWrapper.swift b/sdk/ios/common/HyperTrackSDKWrapper.swift index edde36a1..e76e3d3f 100644 --- a/sdk/ios/common/HyperTrackSDKWrapper.swift +++ b/sdk/ios/common/HyperTrackSDKWrapper.swift @@ -31,6 +31,10 @@ func getDeviceID() -> Result { .success(.dict(serializeDeviceID(HyperTrack.deviceID))) } +func getDynamicPublishableKey() -> Result { + .success(.dict(serializeDynamicPublishableKey(HyperTrack.dynamicPublishableKey))) +} + func getErrors() -> Result { .success(.array(serializeErrors(HyperTrack.errors))) } @@ -51,6 +55,13 @@ func getIsAvailable() -> Result { .success(.dict(serializeIsAvailable(HyperTrack.isAvailable))) } +func setDynamicPublishableKey(_ args: [String: Any]) -> Result { + deserializeDynamicPublishableKey(args).flatMap { (dynamicPublishableKey: String) in + HyperTrack.dynamicPublishableKey = dynamicPublishableKey + return .success(.void) + } +} + func setIsAvailable(_ args: [String: Any]) -> Result { deserializeIsAvailable(args).flatMap { (isAvailable: Bool) in HyperTrack.isAvailable = isAvailable diff --git a/sdk/ios/common/SDKMethod.swift b/sdk/ios/common/SDKMethod.swift index a8b3c412..e7c0cd4f 100644 --- a/sdk/ios/common/SDKMethod.swift +++ b/sdk/ios/common/SDKMethod.swift @@ -1,6 +1,7 @@ enum SDKMethod: String { case addGeotag case getDeviceID + case getDynamicPublishableKey case getErrors case getIsAvailable case getIsTracking @@ -8,6 +9,7 @@ enum SDKMethod: String { case getMetadata case getName case locate + case setDynamicPublishableKey case setIsAvailable case setIsTracking case setMetadata diff --git a/sdk/ios/common/Serialization.swift b/sdk/ios/common/Serialization.swift index aa81d0a2..f1b4804d 100644 --- a/sdk/ios/common/Serialization.swift +++ b/sdk/ios/common/Serialization.swift @@ -14,6 +14,18 @@ private let typeMetadata = "metadata" private let typeName = "name" private let typeSuccess = "success" +func deserializeDynamicPublishableKey( + _ args: [String: Any] +) -> Result { + if args[keyType] as? String != "dynamicPublishableKey" { + return .failure(.fatalError(getParseError(args, key: keyType))) + } + guard let value = args[keyValue] as? String else { + return .failure(.fatalError(getParseError(args, key: keyValue))) + } + return .success(value) +} + func deserializeGeotagData( _ args: [String: Any] ) -> Result { @@ -96,6 +108,13 @@ func serializeDeviceID(_ deviceID: String) -> [String: Any] { ] } +func serializeDynamicPublishableKey(_ dynamicPublishableKey: String) -> [String: Any] { + return [ + keyType: "dynamicPublishableKey", + keyValue: dynamicPublishableKey, + ] +} + func serializeError(_ error: HyperTrack.Error) -> [String: Any] { let value: String switch error { diff --git a/sdk/package.json b/sdk/package.json index 1820af05..80c88ba4 100644 --- a/sdk/package.json +++ b/sdk/package.json @@ -1,6 +1,6 @@ { "name": "hypertrack-sdk-react-native", - "version": "12.1.0", + "version": "13.0.0", "description": "React Native HyperTrack SDK is a wrapper around native iOS and Android SDKs that allows to integrate HyperTrack into React Native apps.", "main": "lib/commonjs/index", "module": "lib/module/index", diff --git a/sdk/src/HyperTrack/HyperTrack.ts b/sdk/src/HyperTrack/HyperTrack.ts index def7c826..e24ce00d 100644 --- a/sdk/src/HyperTrack/HyperTrack.ts +++ b/sdk/src/HyperTrack/HyperTrack.ts @@ -19,6 +19,7 @@ import type { Result } from './data_types/Result'; import type { LocationInternal } from './data_types/internal/LocationInternal'; import type { LocationWithDeviationInternal } from './data_types/internal/LocationWithDeviationInternal'; import type { Metadata } from './data_types/internal/Metadata'; +import type { DynamicPublishableKey } from './data_types/internal/DynamicPublishableKey'; const EVENT_ERRORS = 'errors'; const EVENT_IS_AVAILABLE = 'isAvailable'; @@ -125,6 +126,13 @@ export default class HyperTrack { ); } + static async getDynamicPublishableKey(): Promise { + return HyperTrackSdk.getDynamicPublishableKey().then( + (dynamicPublishableKey: DynamicPublishableKey) => + this.deserializeDynamicPublishableKey(dynamicPublishableKey) + ); + } + /** * Returns a list of errors that blocks SDK from tracking * @@ -229,12 +237,19 @@ export default class HyperTrack { return this.locateSubscription; } + static setDynamicPublishableKey(dynamicPublishableKey: string) { + HyperTrackSdk.setDynamicPublishableKey({ + type: 'dynamicPublishableKey', + value: dynamicPublishableKey, + } as DynamicPublishableKey); + } + /** * Sets the availability of the device for the Nearby search * * @param availability true when is available or false when unavailable */ - static async setIsAvailable(isAvailable: boolean) { + static setIsAvailable(isAvailable: boolean) { HyperTrackSdk.setIsAvailable({ type: 'isAvailable', value: isAvailable, @@ -246,7 +261,7 @@ export default class HyperTrack { * * @param {boolean} isTracking */ - static async setIsTracking(isTracking: boolean): Promise { + static setIsTracking(isTracking: boolean) { HyperTrackSdk.setIsTracking({ type: 'isTracking', value: isTracking, @@ -258,7 +273,7 @@ export default class HyperTrack { * * @param {Object} data - Metadata JSON */ - static async setMetadata(data: Object) { + static setMetadata(data: Object) { HyperTrackSdk.setMetadata({ type: 'metadata', value: data, @@ -270,7 +285,7 @@ export default class HyperTrack { * * @param {string} name */ - static async setName(name: string) { + static setName(name: string) { HyperTrackSdk.setName({ type: 'name', value: name, @@ -387,6 +402,20 @@ export default class HyperTrack { ); } + /** @ignore */ + private static deserializeDynamicPublishableKey( + dynamicPublishableKey: DynamicPublishableKey + ): string { + if (dynamicPublishableKey.type != 'dynamicPublishableKey') { + throw new Error( + `Invalid dynamicPublishableKey: ${JSON.stringify( + dynamicPublishableKey + )}` + ); + } + return dynamicPublishableKey.value; + } + /** @ignore */ private static deserializeHyperTrackErrors( errors: HyperTrackErrorInternal[] diff --git a/sdk/src/HyperTrack/data_types/internal/DynamicPublishableKey.ts b/sdk/src/HyperTrack/data_types/internal/DynamicPublishableKey.ts new file mode 100644 index 00000000..ee2f57c8 --- /dev/null +++ b/sdk/src/HyperTrack/data_types/internal/DynamicPublishableKey.ts @@ -0,0 +1,4 @@ +export type DynamicPublishableKey = { + type: 'dynamicPublishableKey'; + value: string; +};