Skip to content

Commit 6e6a576

Browse files
Update HyperTrack SDK iOS to 5.11.0 and Android to 7.11.0 (#68)
Fix wrong order of Orders in `HyperTrack.getOrders()` on iOS Fix error on `HyperTrack.getOrders()`/`HyperTrack.subscribeToOrders()` on Android when assigning multiple orders to the worker
1 parent 655dfb7 commit 6e6a576

File tree

157 files changed

+3328
-4718
lines changed

Some content is hidden

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

157 files changed

+3328
-4718
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+
## [3.0.0] - 2025-02-06
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+
16+
### Fixed
17+
18+
- Wrong order of Orders in `HyperTrack.getOrders()` on iOS
19+
- Error on `HyperTrack.getOrders()`/`HyperTrack.subscribeToOrders()` on Android when assigning multiple orders to the worker
20+
821
## [2.7.0] - 2025-01-21
922

1023
### Added
@@ -502,3 +515,4 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
502515
[2.6.0]: https://github.com/hypertrack/sdk-flutter/releases/tag/2.6.0
503516
[2.6.1]: https://github.com/hypertrack/sdk-flutter/releases/tag/2.6.1
504517
[2.7.0]: https://github.com/hypertrack/sdk-flutter/releases/tag/2.7.0
518+
[3.0.0]: https://github.com/hypertrack/sdk-flutter/releases/tag/3.0.0

android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ android {
4444
disable 'InvalidPackage'
4545
}
4646
dependencies {
47-
def hyperTrackVersion = "7.10.0"
47+
def hyperTrackVersion = "7.11.0"
4848
implementation "com.hypertrack:sdk-android:${hyperTrackVersion}"
4949
implementation "com.hypertrack:activity-service-google:${hyperTrackVersion}"
5050
implementation "com.hypertrack:location-services-google:${hyperTrackVersion}"

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,12 @@ public class HyperTrackPlugin :
136136
HyperTrackSdkWrapper.getName()
137137
}
138138

139+
SdkMethod.getOrderIsInsideGeofence -> {
140+
withArgs<Map<String, Any?>>(call) { args ->
141+
HyperTrackSdkWrapper.getOrderIsInsideGeofence(args)
142+
}
143+
}
144+
139145
SdkMethod.getOrders -> {
140146
HyperTrackSdkWrapper.getOrders()
141147
}

android/src/main/kotlin/com/hypertrack/sdk/flutter/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.flutter.common.Serialization.deserializeIsAvailable
1010
import com.hypertrack.sdk.flutter.common.Serialization.deserializeIsTracking
1111
import com.hypertrack.sdk.flutter.common.Serialization.deserializeMetadata
1212
import com.hypertrack.sdk.flutter.common.Serialization.deserializeName
13+
import com.hypertrack.sdk.flutter.common.Serialization.deserializeOrderHandle
1314
import com.hypertrack.sdk.flutter.common.Serialization.deserializeWorkerHandle
1415
import com.hypertrack.sdk.flutter.common.Serialization.serializeAllowMockLocation
1516
import com.hypertrack.sdk.flutter.common.Serialization.serializeDeviceId
1617
import com.hypertrack.sdk.flutter.common.Serialization.serializeDynamicPublishableKey
1718
import com.hypertrack.sdk.flutter.common.Serialization.serializeErrors
1819
import com.hypertrack.sdk.flutter.common.Serialization.serializeIsAvailable
20+
import com.hypertrack.sdk.flutter.common.Serialization.serializeIsInsideGeofence
1921
import com.hypertrack.sdk.flutter.common.Serialization.serializeIsTracking
2022
import com.hypertrack.sdk.flutter.common.Serialization.serializeLocationErrorFailure
2123
import com.hypertrack.sdk.flutter.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/kotlin/com/hypertrack/sdk/flutter/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/kotlin/com/hypertrack/sdk/flutter/common/Serialization.kt

Lines changed: 46 additions & 46 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,
@@ -173,7 +209,8 @@ internal object Serialization {
173209
}
174210
}
175211

176-
fun serializeLocationErrorFailure(locationError: HyperTrack.LocationError): Serialized = serializeFailure(serializeLocationError(locationError))
212+
fun serializeLocationErrorFailure(locationError: HyperTrack.LocationError): Serialized =
213+
serializeFailure(serializeLocationError(locationError))
177214

178215
fun serializeLocationSuccess(location: HyperTrack.Location): Serialized = serializeSuccess(serializeLocation(location))
179216

@@ -204,11 +241,17 @@ internal object Serialization {
204241
mapOf(
205242
KEY_ORDER_HANDLE to order.orderHandle,
206243
KEY_ORDER_INDEX to index,
207-
KEY_ORDER_IS_INSIDE_GEOFENCE to serializeIsInsideGeofence(order.isInsideGeofence),
244+
// beware not to call isInsideGeofence here, it's a computed property
208245
)
209246
},
210247
)
211248

249+
fun serializeSuccess(success: Serialized): Serialized =
250+
mapOf(
251+
KEY_TYPE to TYPE_RESULT_SUCCESS,
252+
KEY_VALUE to success,
253+
)
254+
212255
fun serializeWorkerHandle(workerHandle: String): Serialized =
213256
mapOf(
214257
KEY_TYPE to TYPE_WORKER_HANDLE,
@@ -238,14 +281,6 @@ internal object Serialization {
238281
}.getOrThrow()
239282
}
240283

241-
private fun deserializeOrderHandle(map: Serialized): WrapperResult<String> =
242-
parse(map) {
243-
it.assertValue<String>(key = KEY_TYPE, value = TYPE_ORDER_HANDLE)
244-
it
245-
.get<String>(KEY_VALUE)
246-
.getOrThrow()
247-
}
248-
249284
private fun deserializeOrderStatus(map: Serialized): WrapperResult<HyperTrack.OrderStatus> =
250285
parse(map) {
251286
when (it.get<String>(KEY_TYPE).getOrThrow()) {
@@ -260,22 +295,6 @@ internal object Serialization {
260295
}
261296
}
262297

263-
private fun serializeIsInsideGeofence(isInsideGeofence: Result<Boolean, HyperTrack.LocationError>): Serialized =
264-
when (isInsideGeofence) {
265-
is Result.Failure -> {
266-
serializeFailure(serializeLocationError(isInsideGeofence.failure))
267-
}
268-
269-
is Result.Success -> {
270-
serializeSuccess(
271-
mapOf(
272-
KEY_TYPE to TYPE_IS_INSIDE_GEOFENCE,
273-
KEY_VALUE to isInsideGeofence.success,
274-
),
275-
)
276-
}
277-
}
278-
279298
private fun serializeLocation(location: HyperTrack.Location): Serialized =
280299
mapOf(
281300
KEY_TYPE to TYPE_LOCATION,
@@ -296,24 +315,6 @@ internal object Serialization {
296315
),
297316
)
298317

299-
private fun serializeFailure(failure: List<Serialized>): Serialized =
300-
mapOf(
301-
KEY_TYPE to TYPE_RESULT_FAILURE,
302-
KEY_VALUE to failure,
303-
)
304-
305-
private fun serializeFailure(failure: Serialized): Serialized =
306-
mapOf(
307-
KEY_TYPE to TYPE_RESULT_FAILURE,
308-
KEY_VALUE to failure,
309-
)
310-
311-
private fun serializeSuccess(success: Serialized): Serialized =
312-
mapOf(
313-
KEY_TYPE to TYPE_RESULT_SUCCESS,
314-
KEY_VALUE to success,
315-
)
316-
317318
private fun serializeLocationError(locationError: HyperTrack.LocationError): Serialized =
318319
when (locationError) {
319320
HyperTrack.LocationError.NotRunning -> {
@@ -449,8 +450,7 @@ internal object Serialization {
449450
private const val KEY_GEOTAG_EXPECTED_LOCATION = "expectedLocation"
450451
private const val KEY_GEOTAG_ORDER_HANDLE = "orderHandle"
451452
private const val KEY_GEOTAG_ORDER_STATUS = "orderStatus"
452-
private const val KEY_ORDER_IS_INSIDE_GEOFENCE = "isInsideGeofence"
453453
private const val KEY_LOCATION = "location"
454454
private const val KEY_ORDER_HANDLE = "orderHandle"
455-
private const val KEY_ORDER_INDEX = "orderIndex"
455+
private const val KEY_ORDER_INDEX = "index"
456456
}

docs/__404error.html

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,11 @@
1616
<link rel="stylesheet" href="static-assets/github.css?v1">
1717
<link rel="stylesheet" href="static-assets/styles.css?v1">
1818
<link rel="icon" href="static-assets/favicon.png?v1">
19-
2019

2120
</head>
2221

23-
2422
<body data-base-href="" data-using-base-href="false" class="light-theme">
25-
2623
<div id="overlay-under-drawer"></div>
27-
2824
<header id="title">
2925
<span id="sidenav-left-toggle" class="material-symbols-outlined" role="button" tabindex="0">menu</span>
3026
<ol class="breadcrumbs gt-separated dark hidden-xs">
@@ -47,10 +43,8 @@
4743
</div>
4844
</header>
4945
<main>
50-
5146
<div id="dartdoc-main-content" class="main-content">
5247
<h1>404: Something's gone wrong :-(</h1>
53-
5448
<section class="desc">
5549
<p>You've tried to visit a page that doesn't exist. Luckily this site
5650
has other <a href="index.html">pages</a>.</p>
@@ -59,23 +53,19 @@ <h1>404: Something's gone wrong :-(</h1>
5953
<input type="text" id="search-body" autocomplete="off" disabled class="form-control typeahead" placeholder="Loading search...">
6054
</form>
6155
</p>
62-
6356
</section>
6457
</div> <!-- /.main-content -->
65-
6658
<div id="dartdoc-sidebar-left" class="sidebar sidebar-offcanvas-left">
6759
<!-- The search input and breadcrumbs below are only responsively visible at low resolutions. -->
6860
<header id="header-search-sidebar" class="hidden-l">
6961
<form class="search-sidebar" role="search">
7062
<input type="text" id="search-sidebar" autocomplete="off" disabled class="form-control typeahead" placeholder="Loading search...">
7163
</form>
7264
</header>
73-
7465
<ol class="breadcrumbs gt-separated dark hidden-l" id="sidebar-nav">
7566
<li><a href="https://www.hypertrack.com/">hypertrack_plugin package</a></li>
7667
</ol>
7768

78-
7969
<h5><span class="package-name">hypertrack_plugin</span> <span class="package-kind">package</span></h5>
8070
<ol>
8171
<li class="section-title">Libraries</li>
@@ -91,29 +81,21 @@ <h5><span class="package-name">hypertrack_plugin</span> <span class="package-kin
9181
</ol>
9282

9383
</div>
94-
9584
<div id="dartdoc-sidebar-right" class="sidebar sidebar-offcanvas-right">
9685
</div>
97-
9886
</main>
99-
10087
<footer>
10188
<span class="no-break">
10289
hypertrack_plugin
103-
2.7.0
90+
3.0.0
10491
</span>
105-
10692

10793
</footer>
10894

10995

110-
11196
<script src="static-assets/highlight.pack.js?v1"></script>
11297
<script src="static-assets/docs.dart.js"></script>
11398

114-
115-
11699
</body>
117-
118100
</html>
119101

docs/data_types_hypertrack_error/HyperTrackError-enum-sidebar.html

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
<ol>
22

3-
<li class="section-title"><a href="data_types_hypertrack_error/HyperTrackError.html#constructors">Constructors</a></li>
4-
<li><a href="data_types_hypertrack_error/HyperTrackError/HyperTrackError.html">HyperTrackError</a></li>
53

64
<li class="section-title"><a href="data_types_hypertrack_error/HyperTrackError.html#values">Values</a></li>
75
<li><a href="data_types_hypertrack_error/HyperTrackError.html#blockedFromRunning">blockedFromRunning</a></li>
@@ -23,18 +21,34 @@
2321
<li class="section-title inherited">
2422
<a href="data_types_hypertrack_error/HyperTrackError.html#instance-properties">Properties</a>
2523
</li>
26-
<li class="inherited"><a href="https://api.flutter.dev/flutter/dart-core/Object/hashCode.html">hashCode</a></li>
27-
<li class="inherited"><a href="https://api.flutter.dev/flutter/dart-core/Enum/index.html">index</a></li>
24+
25+
<li class="inherited">
26+
<a href="https://api.flutter.dev/flutter/dart-core/Object/hashCode.html">hashCode</a>
27+
</li>
28+
29+
<li class="inherited">
30+
<a href="https://api.flutter.dev/flutter/dart-core/Enum/index.html">index</a>
31+
</li>
32+
33+
<li>
34+
<a href="https://api.flutter.dev/flutter/dart-core/EnumName/name.html">name</a>
35+
<sup
36+
class="muted"
37+
title="Available on Enum">(ext)</sup>
38+
</li>
2839

2940

3041
<li class="section-title inherited"><a href="data_types_hypertrack_error/HyperTrackError.html#operators">Operators</a></li>
31-
<li class="inherited"><a href="https://api.flutter.dev/flutter/dart-core/Object/operator_equals.html">operator ==</a></li>
42+
43+
<li class="inherited">
44+
<a href="https://api.flutter.dev/flutter/dart-core/Object/operator_equals.html">operator ==</a>
45+
</li>
3246

3347

3448

3549

3650

3751

38-
<li class="section-title"><a href="data_types_hypertrack_error/HyperTrackError.html#constants">Constants</a></li>
39-
<li><a href="data_types_hypertrack_error/HyperTrackError/values-constant.html">values</a></li>
52+
<li class="section-title"><a href="data_types_hypertrack_error/HyperTrackError.html#constants">Constants</a></li>
53+
<li><a href="data_types_hypertrack_error/HyperTrackError/values-constant.html">values</a></li>
4054
</ol>

0 commit comments

Comments
 (0)