Skip to content

Commit

Permalink
Update HyperTrack SDK iOS to 5.5.1 and Android to 7.5.2 (#29)
Browse files Browse the repository at this point in the history
Add new Geotag api with `order_handle` and `order_status`.
  • Loading branch information
pavel-kuznetsov-hypertrack authored Apr 19, 2024
1 parent 5fd18d6 commit 05ae2ce
Show file tree
Hide file tree
Showing 34 changed files with 455 additions and 115 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [3.2.0] - 2024-04-19

### Fixed

- Added `kotlinOptions.jvmTarget` to fix the build error when updating to Gradle 8 and setting `compileOptions.targetCompatibility` to `17`

### Changed

- Updated HyperTrack SDK iOS to [5.5.1](https://github.com/hypertrack/sdk-ios/releases/tag/5.5.1)
- Updated HyperTrack SDK Android to [7.5.2](https://github.com/hypertrack/sdk-android/releases/tag/7.5.2)

## [3.1.3] - 2024-02-26

### Changed
Expand Down Expand Up @@ -160,3 +171,4 @@ We are excited to announce the release of HyperTrack Ionic Capacitor SDK 2.0.0,
[3.1.1]: https://github.com/hypertrack/sdk-ionic-capacitor/releases/tag/3.1.1
[3.1.2]: https://github.com/hypertrack/sdk-ionic-capacitor/releases/tag/3.1.2
[3.1.3]: https://github.com/hypertrack/sdk-ionic-capacitor/releases/tag/3.1.3
[3.2.0]: https://github.com/hypertrack/sdk-ionic-capacitor/releases/tag/3.2.0
2 changes: 1 addition & 1 deletion HypertrackSdkIonicCapacitor.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ Pod::Spec.new do |s|
s.ios.deployment_target = '12.0'
s.dependency 'Capacitor'
s.swift_version = '5.1'
s.dependency 'HyperTrack','5.4.1'
s.dependency 'HyperTrack','5.5.1'
end
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

[![GitHub](https://img.shields.io/github/license/hypertrack/sdk-ionic-capacitor.svg?color=orange)](./LICENSE)
[![npm](https://img.shields.io/npm/v/hypertrack-sdk-ionic-capacitor.svg)](https://www.npmjs.com/package/hypertrack-sdk-ionic-capacitor)
[![iOS SDK](https://img.shields.io/badge/iOS%20SDK-5.4.1-brightgreen.svg)](https://github.com/hypertrack/sdk-ios)
[![Android SDK](https://img.shields.io/badge/Android%20SDK-7.4.3-brightgreen.svg)](https://github.com/hypertrack/sdk-android)
[![iOS SDK](https://img.shields.io/badge/iOS%20SDK-5.5.1-brightgreen.svg)](https://github.com/hypertrack/sdk-ios)
[![Android SDK](https://img.shields.io/badge/Android%20SDK-7.5.2-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.

Expand Down
5 changes: 4 additions & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ ext {

buildscript {
ext.kotlin_version = "1.7.21"
ext.hypertrack_sdk_version = "7.4.3"
ext.hypertrack_sdk_version = "7.5.2"
ext.firebase_messaging_version = "23.1.1"

repositories {
Expand Down Expand Up @@ -46,6 +46,9 @@ android {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8
}
}

allprojects {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,10 @@ class HyperTrackCapacitorPlugin : Plugin() {
HyperTrackSdkWrapper.getDeviceId()
}

SdkMethod.getDynamicPublishableKey -> {
throw Error("Not implemented")
}

SdkMethod.getErrors -> {
HyperTrackSdkWrapper
.getErrors()
Expand Down Expand Up @@ -206,19 +210,27 @@ class HyperTrackCapacitorPlugin : Plugin() {
SdkMethod.getName -> {
HyperTrackSdkWrapper.getName()
}

SdkMethod.locate -> {
throw NotImplementedError("Locate is implemented in different way")
}

SdkMethod.setDynamicPublishableKey -> {
throw Error("Not implemented")
}

SdkMethod.setIsAvailable -> {
withArgs<Map<String, Any?>, Unit>(argsJson) { args ->
HyperTrackSdkWrapper.setIsAvailable(args)
}
}

SdkMethod.setIsTracking -> {
withArgs<Map<String, Any?>, Unit>(argsJson) { args ->
HyperTrackSdkWrapper.setIsTracking(args)
}
}

SdkMethod.setMetadata -> {
withArgs<Map<String, Any?>, Unit>(argsJson) { args ->
HyperTrackSdkWrapper.setMetadata(args)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.hypertrack.sdk.capacitor.common

import android.location.Location
import com.hypertrack.sdk.android.HyperTrack

/**
* The data that represents geotag to create
Expand All @@ -9,5 +10,7 @@ import android.location.Location
*/
internal data class GeotagData(
val data: Map<String, Any?>,
val expectedLocation: Location?
val expectedLocation: Location?,
val orderHandle: String?,
val orderStatus: HyperTrack.OrderStatus?,
)
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
package com.hypertrack.sdk.capacitor.common

import com.hypertrack.sdk.*
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.hypertrack.sdk.capacitor.common.Serialization.deserializeIsAvailable
import com.hypertrack.sdk.capacitor.common.Serialization.deserializeName
import com.hypertrack.sdk.capacitor.common.Serialization.deserializeDynamicPublishableKey
import com.hypertrack.sdk.capacitor.common.Serialization.deserializeGeotagData
import com.hypertrack.sdk.capacitor.common.Serialization.deserializeIsAvailable
import com.hypertrack.sdk.capacitor.common.Serialization.deserializeIsTracking
import com.hypertrack.sdk.capacitor.common.Serialization.deserializeMetadata
import com.hypertrack.sdk.capacitor.common.Serialization.deserializeName
import com.hypertrack.sdk.capacitor.common.Serialization.serializeDeviceId
import com.hypertrack.sdk.capacitor.common.Serialization.serializeDynamicPublishableKey
import com.hypertrack.sdk.capacitor.common.Serialization.serializeErrors
import com.hypertrack.sdk.capacitor.common.Serialization.serializeIsAvailable
import com.hypertrack.sdk.capacitor.common.Serialization.serializeIsTracking
Expand Down Expand Up @@ -42,9 +42,22 @@ internal object HyperTrackSdkWrapper {
longitude = it.longitude
)
}
val orderHandle = geotag.orderHandle
val orderStatus = geotag.orderStatus
if (expectedLocation != null) {
HyperTrack
.addGeotag(geotagMetadata, expectedLocation)
if (orderHandle != null || orderStatus != null) {
if (orderHandle == null || orderStatus == null) {
throw Error("orderHandle and orderStatus must be provided")
}
HyperTrack.addGeotag(
orderHandle = orderHandle,
orderStatus = orderStatus,
expectedLocation = expectedLocation,
metadata = geotagMetadata
)
} else {
HyperTrack.addGeotag(geotagMetadata, expectedLocation)
}
.let {
when (it) {
is Result.Failure -> {
Expand All @@ -57,8 +70,18 @@ internal object HyperTrackSdkWrapper {
}
}
} else {
HyperTrack
.addGeotag(geotagMetadata)
if (orderHandle != null || orderStatus != null) {
if (orderHandle == null || orderStatus == null) {
throw Error("orderHandle and orderStatus must be provided")
}
HyperTrack.addGeotag(
orderHandle = orderHandle,
orderStatus = orderStatus,
metadata = geotagMetadata
)
} else {
HyperTrack.addGeotag(geotagMetadata)
}
.let { serializeLocationResult(it) }
}.let {
Success(it)
Expand All @@ -70,6 +93,10 @@ internal object HyperTrackSdkWrapper {
return Success(serializeDeviceId(HyperTrack.deviceID))
}

fun getDynamicPublishableKey(): WrapperResult<Serialized> {
return Success(serializeDynamicPublishableKey(HyperTrack.dynamicPublishableKey))
}

fun getErrors(): WrapperResult<List<Serialized>> {
return Success(serializeErrors(HyperTrack.errors))
}
Expand Down Expand Up @@ -110,6 +137,13 @@ internal object HyperTrackSdkWrapper {
)
}

fun setDynamicPublishableKey(args: Serialized): WrapperResult<Unit> {
return deserializeDynamicPublishableKey(args)
.mapSuccess { publishableKey ->
HyperTrack.dynamicPublishableKey = publishableKey
}
}

fun setIsAvailable(args: Serialized): WrapperResult<Unit> {
return deserializeIsAvailable(args)
.mapSuccess { isAvailable ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,15 @@ package com.hypertrack.sdk.capacitor.common
internal enum class SdkMethod {
addGeotag,
getDeviceID,
getDynamicPublishableKey,
getErrors,
getIsAvailable,
getIsTracking,
getLocation,
getMetadata,
getName,
locate,
setDynamicPublishableKey,
setIsAvailable,
setIsTracking,
setMetadata,
Expand Down
Loading

0 comments on commit 05ae2ce

Please sign in to comment.