Skip to content

Commit 138b9d6

Browse files
Update HyperTrack SDK iOS to 5.11.0 and Android to 7.11.0 (#48)
1 parent 422b93b commit 138b9d6

36 files changed

+153
-83
lines changed

CHANGELOG.md

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

66
## [Unreleased]
77

8+
## [4.0.0] - 2025-02-03
9+
10+
### Changed
11+
12+
- `Order.isInsideGeofence` is now an async fuction that returns the value at the moment when it called (instead of the constant value at the time of `getOrders` being called)
13+
- Updated HyperTrack SDK iOS to [5.11.0](https://github.com/hypertrack/sdk-ios/releases/tag/5.11.0)
14+
- Updated HyperTrack SDK Android to [7.11.0](https://github.com/hypertrack/sdk-android/releases/tag/7.11.0)
15+
816
## [3.8.0] - 2025-01-17
917

1018
### Added
@@ -348,3 +356,4 @@ We are excited to announce the release of HyperTrack Ionic Capacitor SDK 2.0.0,
348356
[3.7.0]: https://github.com/hypertrack/sdk-ionic-capacitor/releases/tag/3.7.0
349357
[3.7.1]: https://github.com/hypertrack/sdk-ionic-capacitor/releases/tag/3.7.1
350358
[3.8.0]: https://github.com/hypertrack/sdk-ionic-capacitor/releases/tag/3.8.0
359+
[4.0.0]: https://github.com/hypertrack/sdk-ionic-capacitor/releases/tag/4.0.0

HypertrackSdkIonicCapacitor.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@ Pod::Spec.new do |s|
1414
s.ios.deployment_target = '12.0'
1515
s.dependency 'Capacitor'
1616
s.swift_version = '5.1'
17-
s.dependency 'HyperTrack','5.10.0'
17+
s.dependency 'HyperTrack','5.11.0'
1818
end

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
[![GitHub](https://img.shields.io/github/license/hypertrack/sdk-ionic-capacitor.svg?color=orange)](./LICENSE)
44
[![npm](https://img.shields.io/npm/v/hypertrack-sdk-ionic-capacitor.svg)](https://www.npmjs.com/package/hypertrack-sdk-ionic-capacitor)
5-
[![iOS SDK](https://img.shields.io/badge/iOS%20SDK-5.10.0-brightgreen.svg)](https://github.com/hypertrack/sdk-ios)
6-
[![Android SDK](https://img.shields.io/badge/Android%20SDK-7.10.0-brightgreen.svg)](https://github.com/hypertrack/sdk-android)
5+
[![iOS SDK](https://img.shields.io/badge/iOS%20SDK-5.11.0-brightgreen.svg)](https://github.com/hypertrack/sdk-ios)
6+
[![Android SDK](https://img.shields.io/badge/Android%20SDK-7.11.0-brightgreen.svg)](https://github.com/hypertrack/sdk-android)
77

88
[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.
99

android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ ext {
77

88
buildscript {
99
ext.kotlin_version = project.hasProperty('kotlin_version') ? rootProject.ext.kotlin_version : '1.9.10'
10-
ext.hypertrack_sdk_version = "7.10.0"
10+
ext.hypertrack_sdk_version = "7.11.0"
1111
ext.firebase_messaging_version = "23.1.1"
1212

1313
repositories {

android/src/main/java/com/hypertrack/sdk/capacitor/HyperTrackCapacitorPlugin.kt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,11 @@ class HyperTrackCapacitorPlugin : Plugin() {
6565
invokeSdkMethod(SdkMethod.getName, call).toPluginCall(call)
6666
}
6767

68+
@PluginMethod
69+
fun getOrderIsInsideGeofence(call: PluginCall) {
70+
invokeSdkMethod(SdkMethod.getOrderIsInsideGeofence, call).toPluginCall(call)
71+
}
72+
6873
@PluginMethod
6974
fun getOrders(call: PluginCall) {
7075
invokeSdkMethod(SdkMethod.getOrders, call).toPluginCall(call)
@@ -255,6 +260,12 @@ class HyperTrackCapacitorPlugin : Plugin() {
255260
HyperTrackSdkWrapper.getName()
256261
}
257262

263+
SdkMethod.getOrderIsInsideGeofence -> {
264+
withArgs<Map<String, Any?>, Map<String, Any?>>(argsJson) { args ->
265+
HyperTrackSdkWrapper.getOrderIsInsideGeofence(args)
266+
}
267+
}
268+
258269
SdkMethod.getOrders -> {
259270
HyperTrackSdkWrapper
260271
.getOrders()

android/src/main/java/com/hypertrack/sdk/capacitor/common/HyperTrackSdkWrapper.kt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,14 @@ import com.hypertrack.sdk.capacitor.common.Serialization.deserializeIsAvailable
1010
import com.hypertrack.sdk.capacitor.common.Serialization.deserializeIsTracking
1111
import com.hypertrack.sdk.capacitor.common.Serialization.deserializeMetadata
1212
import com.hypertrack.sdk.capacitor.common.Serialization.deserializeName
13+
import com.hypertrack.sdk.capacitor.common.Serialization.deserializeOrderHandle
1314
import com.hypertrack.sdk.capacitor.common.Serialization.deserializeWorkerHandle
1415
import com.hypertrack.sdk.capacitor.common.Serialization.serializeAllowMockLocation
1516
import com.hypertrack.sdk.capacitor.common.Serialization.serializeDeviceId
1617
import com.hypertrack.sdk.capacitor.common.Serialization.serializeDynamicPublishableKey
1718
import com.hypertrack.sdk.capacitor.common.Serialization.serializeErrors
1819
import com.hypertrack.sdk.capacitor.common.Serialization.serializeIsAvailable
20+
import com.hypertrack.sdk.capacitor.common.Serialization.serializeIsInsideGeofence
1921
import com.hypertrack.sdk.capacitor.common.Serialization.serializeIsTracking
2022
import com.hypertrack.sdk.capacitor.common.Serialization.serializeLocationErrorFailure
2123
import com.hypertrack.sdk.capacitor.common.Serialization.serializeLocationResult
@@ -134,6 +136,20 @@ internal object HyperTrackSdkWrapper {
134136
serializeOrders(HyperTrack.orders.values),
135137
)
136138

139+
fun getOrderIsInsideGeofence(args: Serialized): WrapperResult<Serialized> =
140+
deserializeOrderHandle(args)
141+
.mapSuccess { orderHandle ->
142+
HyperTrack
143+
.orders
144+
.values
145+
.firstOrNull { it.orderHandle == orderHandle }
146+
.let { order ->
147+
order?.isInsideGeofence ?: Result.Success(false)
148+
}.let {
149+
serializeIsInsideGeofence(it)
150+
}
151+
}
152+
137153
fun getWorkerHandle(): WrapperResult<Serialized> =
138154
Success(
139155
serializeWorkerHandle(HyperTrack.workerHandle),

android/src/main/java/com/hypertrack/sdk/capacitor/common/SdkMethod.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ internal enum class SdkMethod {
1717
getLocation,
1818
getMetadata,
1919
getName,
20+
getOrderIsInsideGeofence,
2021
getOrders,
2122
getWorkerHandle,
2223
locate,

android/src/main/java/com/hypertrack/sdk/capacitor/common/Serialization.kt

Lines changed: 43 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,14 @@ internal object Serialization {
8989
.getOrThrow()
9090
}
9191

92+
fun deserializeOrderHandle(map: Serialized): WrapperResult<String> =
93+
parse(map) {
94+
it.assertValue<String>(key = KEY_TYPE, value = TYPE_ORDER_HANDLE)
95+
it
96+
.get<String>(KEY_VALUE)
97+
.getOrThrow()
98+
}
99+
92100
fun deserializeWorkerHandle(map: Serialized): WrapperResult<String> =
93101
parse(map) {
94102
it.assertValue<String>(key = KEY_TYPE, value = TYPE_WORKER_HANDLE)
@@ -139,12 +147,40 @@ internal object Serialization {
139147
serializeError(it)
140148
}
141149

150+
fun serializeFailure(failure: List<Serialized>): Serialized =
151+
mapOf(
152+
KEY_TYPE to TYPE_RESULT_FAILURE,
153+
KEY_VALUE to failure,
154+
)
155+
156+
fun serializeFailure(failure: Serialized): Serialized =
157+
mapOf(
158+
KEY_TYPE to TYPE_RESULT_FAILURE,
159+
KEY_VALUE to failure,
160+
)
161+
142162
fun serializeIsAvailable(isAvailable: Boolean): Serialized =
143163
mapOf(
144164
KEY_TYPE to TYPE_IS_AVAILABLE,
145165
KEY_VALUE to isAvailable,
146166
)
147167

168+
fun serializeIsInsideGeofence(isInsideGeofence: Result<Boolean, HyperTrack.LocationError>): Serialized =
169+
when (isInsideGeofence) {
170+
is Result.Failure -> {
171+
serializeFailure(serializeLocationError(isInsideGeofence.failure))
172+
}
173+
174+
is Result.Success -> {
175+
serializeSuccess(
176+
mapOf(
177+
KEY_TYPE to TYPE_IS_INSIDE_GEOFENCE,
178+
KEY_VALUE to isInsideGeofence.success,
179+
),
180+
)
181+
}
182+
}
183+
148184
fun serializeIsTracking(isTracking: Boolean): Serialized =
149185
mapOf(
150186
KEY_TYPE to TYPE_IS_TRACKING,
@@ -205,11 +241,17 @@ internal object Serialization {
205241
mapOf(
206242
KEY_ORDER_HANDLE to order.orderHandle,
207243
KEY_ORDER_INDEX to index,
208-
KEY_ORDER_IS_INSIDE_GEOFENCE to serializeIsInsideGeofence(order.isInsideGeofence),
244+
// beware not to call isInsideGeofence here, it's a computed property
209245
)
210246
},
211247
)
212248

249+
fun serializeSuccess(success: Serialized): Serialized =
250+
mapOf(
251+
KEY_TYPE to TYPE_RESULT_SUCCESS,
252+
KEY_VALUE to success,
253+
)
254+
213255
fun serializeWorkerHandle(workerHandle: String): Serialized =
214256
mapOf(
215257
KEY_TYPE to TYPE_WORKER_HANDLE,
@@ -239,14 +281,6 @@ internal object Serialization {
239281
}.getOrThrow()
240282
}
241283

242-
private fun deserializeOrderHandle(map: Serialized): WrapperResult<String> =
243-
parse(map) {
244-
it.assertValue<String>(key = KEY_TYPE, value = TYPE_ORDER_HANDLE)
245-
it
246-
.get<String>(KEY_VALUE)
247-
.getOrThrow()
248-
}
249-
250284
private fun deserializeOrderStatus(map: Serialized): WrapperResult<HyperTrack.OrderStatus> =
251285
parse(map) {
252286
when (it.get<String>(KEY_TYPE).getOrThrow()) {
@@ -261,22 +295,6 @@ internal object Serialization {
261295
}
262296
}
263297

264-
private fun serializeIsInsideGeofence(isInsideGeofence: Result<Boolean, HyperTrack.LocationError>): Serialized =
265-
when (isInsideGeofence) {
266-
is Result.Failure -> {
267-
serializeFailure(serializeLocationError(isInsideGeofence.failure))
268-
}
269-
270-
is Result.Success -> {
271-
serializeSuccess(
272-
mapOf(
273-
KEY_TYPE to TYPE_IS_INSIDE_GEOFENCE,
274-
KEY_VALUE to isInsideGeofence.success,
275-
),
276-
)
277-
}
278-
}
279-
280298
private fun serializeLocation(location: HyperTrack.Location): Serialized =
281299
mapOf(
282300
KEY_TYPE to TYPE_LOCATION,
@@ -297,24 +315,6 @@ internal object Serialization {
297315
),
298316
)
299317

300-
private fun serializeFailure(failure: List<Serialized>): Serialized =
301-
mapOf(
302-
KEY_TYPE to TYPE_RESULT_FAILURE,
303-
KEY_VALUE to failure,
304-
)
305-
306-
private fun serializeFailure(failure: Serialized): Serialized =
307-
mapOf(
308-
KEY_TYPE to TYPE_RESULT_FAILURE,
309-
KEY_VALUE to failure,
310-
)
311-
312-
private fun serializeSuccess(success: Serialized): Serialized =
313-
mapOf(
314-
KEY_TYPE to TYPE_RESULT_SUCCESS,
315-
KEY_VALUE to success,
316-
)
317-
318318
private fun serializeLocationError(locationError: HyperTrack.LocationError): Serialized =
319319
when (locationError) {
320320
HyperTrack.LocationError.NotRunning -> {
@@ -450,7 +450,6 @@ internal object Serialization {
450450
private const val KEY_GEOTAG_EXPECTED_LOCATION = "expectedLocation"
451451
private const val KEY_GEOTAG_ORDER_HANDLE = "orderHandle"
452452
private const val KEY_GEOTAG_ORDER_STATUS = "orderStatus"
453-
private const val KEY_ORDER_IS_INSIDE_GEOFENCE = "isInsideGeofence"
454453
private const val KEY_LOCATION = "location"
455454
private const val KEY_ORDER_HANDLE = "orderHandle"
456455
private const val KEY_ORDER_INDEX = "orderIndex"

docs/assets/search.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)