Skip to content

Commit

Permalink
Update HyperTrack SDK iOS to 5.5.1 and Android to 7.5.2 (#51)
Browse files Browse the repository at this point in the history
Add new Geotag api with `order_handle` and `order_status`.
Add opening Github release page on release.
Run `build` recipe before the release.
Add `open-docs` and `format` recipes.
  • Loading branch information
pavel-kuznetsov-hypertrack committed Apr 22, 2024
1 parent 9e54c49 commit 3354341
Show file tree
Hide file tree
Showing 124 changed files with 3,766 additions and 192 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [2.2.0] - 2024-04-22

### Changed

- New `addGeotag` and `addGeotagWithExpectedLocation` methods signature that have `orderHandle` and `orderStatus` parameters. You can use this API when users need to clock in/out of work in your app to honor their work time (see [Clock in/out Tagging](https://hypertrack.com/docs/clock-inout-tracking#add-clock-inout-events-to-a-shift-timeline) guide for more info)
- 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)

## [2.1.2] - 2024-02-27

### Changed
Expand Down Expand Up @@ -326,3 +334,4 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
[2.1.0]: https://github.com/hypertrack/sdk-flutter/releases/tag/2.1.0
[2.1.1]: https://github.com/hypertrack/sdk-flutter/releases/tag/2.1.1
[2.1.2]: https://github.com/hypertrack/sdk-flutter/releases/tag/2.1.2
[2.2.0]: https://github.com/hypertrack/sdk-flutter/releases/tag/2.2.0
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ android {
disable 'InvalidPackage'
}
dependencies {
def hyperTrackVersion = "7.4.3"
def hyperTrackVersion = "7.5.2"
implementation "com.hypertrack:sdk-android:${hyperTrackVersion}"
implementation "com.hypertrack:location-services-google:${hyperTrackVersion}"
implementation "com.hypertrack:push-service-firebase:${hyperTrackVersion}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ public class HyperTrackPlugin : FlutterPlugin, MethodCallHandler {
HyperTrackSdkWrapper.getDeviceId()
}

SdkMethod.getDynamicPublishableKey -> {
throw NotImplementedError("getDynamicPublishableKey is not implemented")
}

SdkMethod.getErrors -> {
HyperTrackSdkWrapper.getErrors()
}
Expand Down Expand Up @@ -125,6 +129,10 @@ public class HyperTrackPlugin : FlutterPlugin, MethodCallHandler {
Success(NotImplemented)
}

SdkMethod.setDynamicPublishableKey -> {
throw NotImplementedError("setDynamicPublishableKey is not implemented")
}

SdkMethod.setIsAvailable -> {
withArgs<Unit>(call) { args ->
HyperTrackSdkWrapper.setIsAvailable(args)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.hypertrack.sdk.flutter.common

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

/**
* The data that represents geotag to create
Expand All @@ -10,4 +11,6 @@ import android.location.Location
internal data class GeotagData(
val data: Map<String, Any?>,
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.flutter.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.flutter.common.Serialization.deserializeDynamicPublishableKey
import com.hypertrack.sdk.flutter.common.Serialization.deserializeGeotagData
import com.hypertrack.sdk.flutter.common.Serialization.deserializeIsAvailable
import com.hypertrack.sdk.flutter.common.Serialization.deserializeIsTracking
import com.hypertrack.sdk.flutter.common.Serialization.deserializeMetadata
import com.hypertrack.sdk.flutter.common.Serialization.deserializeName
import com.hypertrack.sdk.flutter.common.Serialization.serializeDeviceId
import com.hypertrack.sdk.flutter.common.Serialization.serializeDynamicPublishableKey
import com.hypertrack.sdk.flutter.common.Serialization.serializeErrors
import com.hypertrack.sdk.flutter.common.Serialization.serializeIsAvailable
import com.hypertrack.sdk.flutter.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.flutter.common
internal enum class SdkMethod {
addGeotag,
getDeviceID,
getDynamicPublishableKey,
getErrors,
getIsAvailable,
getIsTracking,
getLocation,
getMetadata,
getName,
locate,
setDynamicPublishableKey,
setIsAvailable,
setIsTracking,
setMetadata,
Expand Down

0 comments on commit 3354341

Please sign in to comment.