Skip to content

Commit 3354341

Browse files
Update HyperTrack SDK iOS to 5.5.1 and Android to 7.5.2 (#51)
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.
1 parent 9e54c49 commit 3354341

File tree

124 files changed

+3766
-192
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

124 files changed

+3766
-192
lines changed

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,14 @@
33
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
44
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
55

6+
## [2.2.0] - 2024-04-22
7+
8+
### Changed
9+
10+
- 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)
11+
- Updated HyperTrack SDK iOS to [5.5.1](https://github.com/hypertrack/sdk-ios/releases/tag/5.5.1)
12+
- Updated HyperTrack SDK Android to [7.5.2](https://github.com/hypertrack/sdk-android/releases/tag/7.5.2)
13+
614
## [2.1.2] - 2024-02-27
715

816
### Changed
@@ -326,3 +334,4 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
326334
[2.1.0]: https://github.com/hypertrack/sdk-flutter/releases/tag/2.1.0
327335
[2.1.1]: https://github.com/hypertrack/sdk-flutter/releases/tag/2.1.1
328336
[2.1.2]: https://github.com/hypertrack/sdk-flutter/releases/tag/2.1.2
337+
[2.2.0]: https://github.com/hypertrack/sdk-flutter/releases/tag/2.2.0

android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ android {
4343
disable 'InvalidPackage'
4444
}
4545
dependencies {
46-
def hyperTrackVersion = "7.4.3"
46+
def hyperTrackVersion = "7.5.2"
4747
implementation "com.hypertrack:sdk-android:${hyperTrackVersion}"
4848
implementation "com.hypertrack:location-services-google:${hyperTrackVersion}"
4949
implementation "com.hypertrack:push-service-firebase:${hyperTrackVersion}"

android/src/main/kotlin/com/hypertrack/sdk/flutter/HyperTrackPlugin.kt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,10 @@ public class HyperTrackPlugin : FlutterPlugin, MethodCallHandler {
9696
HyperTrackSdkWrapper.getDeviceId()
9797
}
9898

99+
SdkMethod.getDynamicPublishableKey -> {
100+
throw NotImplementedError("getDynamicPublishableKey is not implemented")
101+
}
102+
99103
SdkMethod.getErrors -> {
100104
HyperTrackSdkWrapper.getErrors()
101105
}
@@ -125,6 +129,10 @@ public class HyperTrackPlugin : FlutterPlugin, MethodCallHandler {
125129
Success(NotImplemented)
126130
}
127131

132+
SdkMethod.setDynamicPublishableKey -> {
133+
throw NotImplementedError("setDynamicPublishableKey is not implemented")
134+
}
135+
128136
SdkMethod.setIsAvailable -> {
129137
withArgs<Unit>(call) { args ->
130138
HyperTrackSdkWrapper.setIsAvailable(args)

android/src/main/kotlin/com/hypertrack/sdk/flutter/common/GeotagData.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.hypertrack.sdk.flutter.common
22

33
import android.location.Location
4+
import com.hypertrack.sdk.android.HyperTrack
45

56
/**
67
* The data that represents geotag to create
@@ -10,4 +11,6 @@ import android.location.Location
1011
internal data class GeotagData(
1112
val data: Map<String, Any?>,
1213
val expectedLocation: Location?,
14+
val orderHandle: String?,
15+
val orderStatus: HyperTrack.OrderStatus?,
1316
)

android/src/main/kotlin/com/hypertrack/sdk/flutter/common/HyperTrackSdkWrapper.kt

Lines changed: 40 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
package com.hypertrack.sdk.flutter.common
22

3-
import com.hypertrack.sdk.*
43
import com.hypertrack.sdk.android.HyperTrack
5-
import com.hypertrack.sdk.android.HyperTrack.metadata
64
import com.hypertrack.sdk.android.Json
75
import com.hypertrack.sdk.android.Result
6+
import com.hypertrack.sdk.flutter.common.Serialization.deserializeDynamicPublishableKey
87
import com.hypertrack.sdk.flutter.common.Serialization.deserializeGeotagData
98
import com.hypertrack.sdk.flutter.common.Serialization.deserializeIsAvailable
109
import com.hypertrack.sdk.flutter.common.Serialization.deserializeIsTracking
1110
import com.hypertrack.sdk.flutter.common.Serialization.deserializeMetadata
1211
import com.hypertrack.sdk.flutter.common.Serialization.deserializeName
1312
import com.hypertrack.sdk.flutter.common.Serialization.serializeDeviceId
13+
import com.hypertrack.sdk.flutter.common.Serialization.serializeDynamicPublishableKey
1414
import com.hypertrack.sdk.flutter.common.Serialization.serializeErrors
1515
import com.hypertrack.sdk.flutter.common.Serialization.serializeIsAvailable
1616
import com.hypertrack.sdk.flutter.common.Serialization.serializeIsTracking
@@ -42,9 +42,22 @@ internal object HyperTrackSdkWrapper {
4242
longitude = it.longitude,
4343
)
4444
}
45+
val orderHandle = geotag.orderHandle
46+
val orderStatus = geotag.orderStatus
4547
if (expectedLocation != null) {
46-
HyperTrack
47-
.addGeotag(geotagMetadata, expectedLocation)
48+
if (orderHandle != null || orderStatus != null) {
49+
if (orderHandle == null || orderStatus == null) {
50+
throw Error("orderHandle and orderStatus must be provided")
51+
}
52+
HyperTrack.addGeotag(
53+
orderHandle = orderHandle,
54+
orderStatus = orderStatus,
55+
expectedLocation = expectedLocation,
56+
metadata = geotagMetadata,
57+
)
58+
} else {
59+
HyperTrack.addGeotag(geotagMetadata, expectedLocation)
60+
}
4861
.let {
4962
when (it) {
5063
is Result.Failure -> {
@@ -57,8 +70,18 @@ internal object HyperTrackSdkWrapper {
5770
}
5871
}
5972
} else {
60-
HyperTrack
61-
.addGeotag(geotagMetadata)
73+
if (orderHandle != null || orderStatus != null) {
74+
if (orderHandle == null || orderStatus == null) {
75+
throw Error("orderHandle and orderStatus must be provided")
76+
}
77+
HyperTrack.addGeotag(
78+
orderHandle = orderHandle,
79+
orderStatus = orderStatus,
80+
metadata = geotagMetadata,
81+
)
82+
} else {
83+
HyperTrack.addGeotag(geotagMetadata)
84+
}
6285
.let { serializeLocationResult(it) }
6386
}.let {
6487
Success(it)
@@ -70,6 +93,10 @@ internal object HyperTrackSdkWrapper {
7093
return Success(serializeDeviceId(HyperTrack.deviceID))
7194
}
7295

96+
fun getDynamicPublishableKey(): WrapperResult<Serialized> {
97+
return Success(serializeDynamicPublishableKey(HyperTrack.dynamicPublishableKey))
98+
}
99+
73100
fun getErrors(): WrapperResult<List<Serialized>> {
74101
return Success(serializeErrors(HyperTrack.errors))
75102
}
@@ -110,6 +137,13 @@ internal object HyperTrackSdkWrapper {
110137
)
111138
}
112139

140+
fun setDynamicPublishableKey(args: Serialized): WrapperResult<Unit> {
141+
return deserializeDynamicPublishableKey(args)
142+
.mapSuccess { publishableKey ->
143+
HyperTrack.dynamicPublishableKey = publishableKey
144+
}
145+
}
146+
113147
fun setIsAvailable(args: Serialized): WrapperResult<Unit> {
114148
return deserializeIsAvailable(args)
115149
.mapSuccess { isAvailable ->

android/src/main/kotlin/com/hypertrack/sdk/flutter/common/SdkMethod.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,15 @@ package com.hypertrack.sdk.flutter.common
99
internal enum class SdkMethod {
1010
addGeotag,
1111
getDeviceID,
12+
getDynamicPublishableKey,
1213
getErrors,
1314
getIsAvailable,
1415
getIsTracking,
1516
getLocation,
1617
getMetadata,
1718
getName,
1819
locate,
20+
setDynamicPublishableKey,
1921
setIsAvailable,
2022
setIsTracking,
2123
setMetadata,

0 commit comments

Comments
 (0)