Skip to content

Commit 3bea371

Browse files
Add worker handle support (#57)
1 parent f56c107 commit 3bea371

File tree

118 files changed

+263
-135
lines changed

Some content is hidden

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

118 files changed

+263
-135
lines changed

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
55

66
## [Unreleased]
77

8+
## [2.3.0] - 2024-06-22
9+
10+
### Added
11+
12+
- New `setWorkerHandle` and `getWorkerHandle` can be used to identify workers
13+
- We observed our customers identify worker devices via `HyperTrack.metadata`, so we decided to make it a first class citizen in our API.
14+
- If you previously used `metadata` to identify workers, we suggest using `workerHandle` for this purpose instead.
15+
16+
### Changed
17+
18+
- Updated HyperTrack SDK iOS to [5.6.0](https://github.com/hypertrack/sdk-ios/releases/tag/5.6.0)
19+
- Updated HyperTrack SDK Android to [7.6.0](https://github.com/hypertrack/sdk-android/releases/tag/7.6.0)
20+
821
## [2.2.3] - 2024-05-24
922

1023
### Changed
@@ -359,3 +372,4 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
359372
[2.2.1]: https://github.com/hypertrack/sdk-flutter/releases/tag/2.2.1
360373
[2.2.2]: https://github.com/hypertrack/sdk-flutter/releases/tag/2.2.2
361374
[2.2.3]: https://github.com/hypertrack/sdk-flutter/releases/tag/2.2.3
375+
[2.3.0]: https://github.com/hypertrack/sdk-flutter/releases/tag/2.3.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.5.5"
46+
def hyperTrackVersion = "7.6.0"
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: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,10 @@ public class HyperTrackPlugin : FlutterPlugin, MethodCallHandler {
124124
HyperTrackSdkWrapper.getName()
125125
}
126126

127+
SdkMethod.getWorkerHandle -> {
128+
HyperTrackSdkWrapper.getWorkerHandle()
129+
}
130+
127131
SdkMethod.locate -> {
128132
// locate is implemented as a EventChannel
129133
Success(NotImplemented)
@@ -156,6 +160,12 @@ public class HyperTrackPlugin : FlutterPlugin, MethodCallHandler {
156160
HyperTrackSdkWrapper.setName(args)
157161
}
158162
}
163+
164+
SdkMethod.setWorkerHandle -> {
165+
withArgs<Unit>(call) { args ->
166+
HyperTrackSdkWrapper.setWorkerHandle(args)
167+
}
168+
}
159169
}
160170
}
161171

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import com.hypertrack.sdk.flutter.common.Serialization.deserializeIsAvailable
99
import com.hypertrack.sdk.flutter.common.Serialization.deserializeIsTracking
1010
import com.hypertrack.sdk.flutter.common.Serialization.deserializeMetadata
1111
import com.hypertrack.sdk.flutter.common.Serialization.deserializeName
12+
import com.hypertrack.sdk.flutter.common.Serialization.deserializeWorkerHandle
1213
import com.hypertrack.sdk.flutter.common.Serialization.serializeDeviceId
1314
import com.hypertrack.sdk.flutter.common.Serialization.serializeDynamicPublishableKey
1415
import com.hypertrack.sdk.flutter.common.Serialization.serializeErrors
@@ -20,6 +21,7 @@ import com.hypertrack.sdk.flutter.common.Serialization.serializeLocationSuccess
2021
import com.hypertrack.sdk.flutter.common.Serialization.serializeLocationWithDeviationSuccess
2122
import com.hypertrack.sdk.flutter.common.Serialization.serializeMetadata
2223
import com.hypertrack.sdk.flutter.common.Serialization.serializeName
24+
import com.hypertrack.sdk.flutter.common.Serialization.serializeWorkerHandle
2325

2426
typealias Serialized = Map<String, Any?>
2527

@@ -137,6 +139,12 @@ internal object HyperTrackSdkWrapper {
137139
)
138140
}
139141

142+
fun getWorkerHandle(): WrapperResult<Serialized> {
143+
return Success(
144+
serializeWorkerHandle(HyperTrack.workerHandle),
145+
)
146+
}
147+
140148
fun setDynamicPublishableKey(args: Serialized): WrapperResult<Unit> {
141149
return deserializeDynamicPublishableKey(args)
142150
.mapSuccess { publishableKey ->
@@ -174,4 +182,11 @@ internal object HyperTrackSdkWrapper {
174182
HyperTrack.name = name
175183
}
176184
}
185+
186+
fun setWorkerHandle(args: Serialized): WrapperResult<Unit> {
187+
return deserializeWorkerHandle(args)
188+
.mapSuccess { workerHandle ->
189+
HyperTrack.workerHandle = workerHandle
190+
}
191+
}
177192
}

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
@@ -16,10 +16,12 @@ internal enum class SdkMethod {
1616
getLocation,
1717
getMetadata,
1818
getName,
19+
getWorkerHandle,
1920
locate,
2021
setDynamicPublishableKey,
2122
setIsAvailable,
2223
setIsTracking,
2324
setMetadata,
2425
setName,
26+
setWorkerHandle,
2527
}

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

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,15 @@ internal object Serialization {
8787
}
8888
}
8989

90+
fun deserializeWorkerHandle(map: Map<String, Any?>): WrapperResult<String> {
91+
return parse(map) {
92+
it.assertValue<String>(key = KEY_TYPE, value = TYPE_WORKER_HANDLE)
93+
it
94+
.get<String>(KEY_VALUE)
95+
.getOrThrow()
96+
}
97+
}
98+
9099
fun serializeDeviceId(deviceId: String): Map<String, Any?> {
91100
return mapOf(
92101
KEY_TYPE to TYPE_DEVICE_ID,
@@ -206,6 +215,13 @@ internal object Serialization {
206215
)
207216
}
208217

218+
fun serializeWorkerHandle(workerHandle: String): Map<String, Any?> {
219+
return mapOf(
220+
KEY_TYPE to TYPE_WORKER_HANDLE,
221+
KEY_VALUE to workerHandle,
222+
)
223+
}
224+
209225
private fun deserializeLocation(map: Map<String, Any?>): WrapperResult<Location> {
210226
return parse(map) {
211227
it.assertValue<String>(key = KEY_TYPE, value = TYPE_LOCATION)
@@ -397,10 +413,11 @@ internal object Serialization {
397413
private const val TYPE_ERROR = "error"
398414
private const val TYPE_IS_AVAILABLE = "isAvailable"
399415
private const val TYPE_IS_TRACKING = "isTracking"
400-
private const val TYPE_METADATA = "metadata"
401-
private const val TYPE_NAME = "name"
402416
private const val TYPE_LOCATION = "location"
403417
private const val TYPE_LOCATION_WITH_DEVIATION = "locationWithDeviation"
418+
private const val TYPE_METADATA = "metadata"
419+
private const val TYPE_NAME = "name"
420+
private const val TYPE_WORKER_HANDLE = "workerHandle"
404421

405422
private const val TYPE_LOCATION_ERROR_ERRORS = "errors"
406423
private const val TYPE_LOCATION_ERROR_NOT_RUNNING = "notRunning"

docs/__404error.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ <h5><span class="package-name">hypertrack_plugin</span> <span class="package-kin
9696
<footer>
9797
<span class="no-break">
9898
hypertrack_plugin
99-
2.2.3
99+
2.3.0
100100
</span>
101101

102102

docs/data_types_hypertrack_error/HyperTrackError.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ <h5>hypertrack_error library</h5>
430430
<footer>
431431
<span class="no-break">
432432
hypertrack_plugin
433-
2.2.3
433+
2.3.0
434434
</span>
435435

436436

docs/data_types_hypertrack_error/HyperTrackError/HyperTrackError.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ <h5>HyperTrackError enum</h5>
131131
<footer>
132132
<span class="no-break">
133133
hypertrack_plugin
134-
2.2.3
134+
2.3.0
135135
</span>
136136

137137

docs/data_types_hypertrack_error/HyperTrackError/values-constant.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ <h5>HyperTrackError enum</h5>
135135
<footer>
136136
<span class="no-break">
137137
hypertrack_plugin
138-
2.2.3
138+
2.3.0
139139
</span>
140140

141141

docs/data_types_hypertrack_error/data_types_hypertrack_error-library.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ <h5>hypertrack_error library</h5>
132132
<footer>
133133
<span class="no-break">
134134
hypertrack_plugin
135-
2.2.3
135+
2.3.0
136136
</span>
137137

138138

docs/data_types_json/JSON-class.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ <h5>json library</h5>
221221
<footer>
222222
<span class="no-break">
223223
hypertrack_plugin
224-
2.2.3
224+
2.3.0
225225
</span>
226226

227227

docs/data_types_json/JSON/JSON.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ <h5>JSON class</h5>
112112
<footer>
113113
<span class="no-break">
114114
hypertrack_plugin
115-
2.2.3
115+
2.3.0
116116
</span>
117117

118118

docs/data_types_json/JSON/fromMap.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ <h5>JSON class</h5>
127127
<footer>
128128
<span class="no-break">
129129
hypertrack_plugin
130-
2.2.3
130+
2.3.0
131131
</span>
132132

133133

docs/data_types_json/JSON/fromString.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ <h5>JSON class</h5>
127127
<footer>
128128
<span class="no-break">
129129
hypertrack_plugin
130-
2.2.3
130+
2.3.0
131131
</span>
132132

133133

docs/data_types_json/JSON/serialize.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ <h5>JSON class</h5>
120120
<footer>
121121
<span class="no-break">
122122
hypertrack_plugin
123-
2.2.3
123+
2.3.0
124124
</span>
125125

126126

docs/data_types_json/JSONArray-class.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ <h5>json library</h5>
207207
<footer>
208208
<span class="no-break">
209209
hypertrack_plugin
210-
2.2.3
210+
2.3.0
211211
</span>
212212

213213

docs/data_types_json/JSONArray/JSONArray.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ <h5>JSONArray class</h5>
118118
<footer>
119119
<span class="no-break">
120120
hypertrack_plugin
121-
2.2.3
121+
2.3.0
122122
</span>
123123

124124

docs/data_types_json/JSONArray/items.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ <h5>JSONArray class</h5>
118118
<footer>
119119
<span class="no-break">
120120
hypertrack_plugin
121-
2.2.3
121+
2.3.0
122122
</span>
123123

124124

docs/data_types_json/JSONArray/serialize.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ <h5>JSONArray class</h5>
129129
<footer>
130130
<span class="no-break">
131131
hypertrack_plugin
132-
2.2.3
132+
2.3.0
133133
</span>
134134

135135

docs/data_types_json/JSONBool-class.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ <h5>json library</h5>
207207
<footer>
208208
<span class="no-break">
209209
hypertrack_plugin
210-
2.2.3
210+
2.3.0
211211
</span>
212212

213213

docs/data_types_json/JSONBool/JSONBool.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ <h5>JSONBool class</h5>
118118
<footer>
119119
<span class="no-break">
120120
hypertrack_plugin
121-
2.2.3
121+
2.3.0
122122
</span>
123123

124124

docs/data_types_json/JSONBool/serialize.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ <h5>JSONBool class</h5>
129129
<footer>
130130
<span class="no-break">
131131
hypertrack_plugin
132-
2.2.3
132+
2.3.0
133133
</span>
134134

135135

docs/data_types_json/JSONBool/value.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ <h5>JSONBool class</h5>
118118
<footer>
119119
<span class="no-break">
120120
hypertrack_plugin
121-
2.2.3
121+
2.3.0
122122
</span>
123123

124124

docs/data_types_json/JSONNull-class.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ <h5>json library</h5>
186186
<footer>
187187
<span class="no-break">
188188
hypertrack_plugin
189-
2.2.3
189+
2.3.0
190190
</span>
191191

192192

docs/data_types_json/JSONNull/JSONNull.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ <h5>JSONNull class</h5>
113113
<footer>
114114
<span class="no-break">
115115
hypertrack_plugin
116-
2.2.3
116+
2.3.0
117117
</span>
118118

119119

docs/data_types_json/JSONNull/serialize.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ <h5>JSONNull class</h5>
125125
<footer>
126126
<span class="no-break">
127127
hypertrack_plugin
128-
2.2.3
128+
2.3.0
129129
</span>
130130

131131

docs/data_types_json/JSONNumber-class.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ <h5>json library</h5>
207207
<footer>
208208
<span class="no-break">
209209
hypertrack_plugin
210-
2.2.3
210+
2.3.0
211211
</span>
212212

213213

docs/data_types_json/JSONNumber/JSONNumber.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ <h5>JSONNumber class</h5>
118118
<footer>
119119
<span class="no-break">
120120
hypertrack_plugin
121-
2.2.3
121+
2.3.0
122122
</span>
123123

124124

docs/data_types_json/JSONNumber/serialize.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ <h5>JSONNumber class</h5>
129129
<footer>
130130
<span class="no-break">
131131
hypertrack_plugin
132-
2.2.3
132+
2.3.0
133133
</span>
134134

135135

docs/data_types_json/JSONNumber/value.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ <h5>JSONNumber class</h5>
118118
<footer>
119119
<span class="no-break">
120120
hypertrack_plugin
121-
2.2.3
121+
2.3.0
122122
</span>
123123

124124

docs/data_types_json/JSONObject-class.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ <h5>json library</h5>
207207
<footer>
208208
<span class="no-break">
209209
hypertrack_plugin
210-
2.2.3
210+
2.3.0
211211
</span>
212212

213213

docs/data_types_json/JSONObject/JSONObject.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ <h5>JSONObject class</h5>
118118
<footer>
119119
<span class="no-break">
120120
hypertrack_plugin
121-
2.2.3
121+
2.3.0
122122
</span>
123123

124124

0 commit comments

Comments
 (0)