Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [3.0.0] - 2025-02-06

### Changed

- `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)
- Updated HyperTrack SDK iOS to [5.11.0](https://github.com/hypertrack/sdk-ios/releases/tag/5.11.0)
- Updated HyperTrack SDK Android to [7.11.0](https://github.com/hypertrack/sdk-android/releases/tag/7.11.0)

### Fixed

- Wrong order of Orders in `HyperTrack.getOrders()` on iOS
- Error on `HyperTrack.getOrders()`/`HyperTrack.subscribeToOrders()` on Android when assigning multiple orders to the worker

## [2.7.0] - 2025-01-21

### Added
Expand Down Expand Up @@ -502,3 +515,4 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
[2.6.0]: https://github.com/hypertrack/sdk-flutter/releases/tag/2.6.0
[2.6.1]: https://github.com/hypertrack/sdk-flutter/releases/tag/2.6.1
[2.7.0]: https://github.com/hypertrack/sdk-flutter/releases/tag/2.7.0
[3.0.0]: https://github.com/hypertrack/sdk-flutter/releases/tag/3.0.0
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ android {
disable 'InvalidPackage'
}
dependencies {
def hyperTrackVersion = "7.10.0"
def hyperTrackVersion = "7.11.0"
implementation "com.hypertrack:sdk-android:${hyperTrackVersion}"
implementation "com.hypertrack:activity-service-google:${hyperTrackVersion}"
implementation "com.hypertrack:location-services-google:${hyperTrackVersion}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,12 @@ public class HyperTrackPlugin :
HyperTrackSdkWrapper.getName()
}

SdkMethod.getOrderIsInsideGeofence -> {
withArgs<Map<String, Any?>>(call) { args ->
HyperTrackSdkWrapper.getOrderIsInsideGeofence(args)
}
}

SdkMethod.getOrders -> {
HyperTrackSdkWrapper.getOrders()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@ 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.deserializeOrderHandle
import com.hypertrack.sdk.flutter.common.Serialization.deserializeWorkerHandle
import com.hypertrack.sdk.flutter.common.Serialization.serializeAllowMockLocation
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.serializeIsInsideGeofence
import com.hypertrack.sdk.flutter.common.Serialization.serializeIsTracking
import com.hypertrack.sdk.flutter.common.Serialization.serializeLocationErrorFailure
import com.hypertrack.sdk.flutter.common.Serialization.serializeLocationResult
Expand Down Expand Up @@ -134,6 +136,20 @@ internal object HyperTrackSdkWrapper {
serializeOrders(HyperTrack.orders.values),
)

fun getOrderIsInsideGeofence(args: Serialized): WrapperResult<Serialized> =
deserializeOrderHandle(args)
.mapSuccess { orderHandle ->
HyperTrack
.orders
.values
.firstOrNull { it.orderHandle == orderHandle }
.let { order ->
order?.isInsideGeofence ?: Result.Success(false)
}.let {
serializeIsInsideGeofence(it)
}
}

fun getWorkerHandle(): WrapperResult<Serialized> =
Success(
serializeWorkerHandle(HyperTrack.workerHandle),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ internal enum class SdkMethod {
getLocation,
getMetadata,
getName,
getOrderIsInsideGeofence,
getOrders,
getWorkerHandle,
locate,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,14 @@ internal object Serialization {
.getOrThrow()
}

fun deserializeOrderHandle(map: Serialized): WrapperResult<String> =
parse(map) {
it.assertValue<String>(key = KEY_TYPE, value = TYPE_ORDER_HANDLE)
it
.get<String>(KEY_VALUE)
.getOrThrow()
}

fun deserializeWorkerHandle(map: Serialized): WrapperResult<String> =
parse(map) {
it.assertValue<String>(key = KEY_TYPE, value = TYPE_WORKER_HANDLE)
Expand Down Expand Up @@ -139,12 +147,40 @@ internal object Serialization {
serializeError(it)
}

fun serializeFailure(failure: List<Serialized>): Serialized =
mapOf(
KEY_TYPE to TYPE_RESULT_FAILURE,
KEY_VALUE to failure,
)

fun serializeFailure(failure: Serialized): Serialized =
mapOf(
KEY_TYPE to TYPE_RESULT_FAILURE,
KEY_VALUE to failure,
)

fun serializeIsAvailable(isAvailable: Boolean): Serialized =
mapOf(
KEY_TYPE to TYPE_IS_AVAILABLE,
KEY_VALUE to isAvailable,
)

fun serializeIsInsideGeofence(isInsideGeofence: Result<Boolean, HyperTrack.LocationError>): Serialized =
when (isInsideGeofence) {
is Result.Failure -> {
serializeFailure(serializeLocationError(isInsideGeofence.failure))
}

is Result.Success -> {
serializeSuccess(
mapOf(
KEY_TYPE to TYPE_IS_INSIDE_GEOFENCE,
KEY_VALUE to isInsideGeofence.success,
),
)
}
}

fun serializeIsTracking(isTracking: Boolean): Serialized =
mapOf(
KEY_TYPE to TYPE_IS_TRACKING,
Expand Down Expand Up @@ -173,7 +209,8 @@ internal object Serialization {
}
}

fun serializeLocationErrorFailure(locationError: HyperTrack.LocationError): Serialized = serializeFailure(serializeLocationError(locationError))
fun serializeLocationErrorFailure(locationError: HyperTrack.LocationError): Serialized =
serializeFailure(serializeLocationError(locationError))

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

Expand Down Expand Up @@ -204,11 +241,17 @@ internal object Serialization {
mapOf(
KEY_ORDER_HANDLE to order.orderHandle,
KEY_ORDER_INDEX to index,
KEY_ORDER_IS_INSIDE_GEOFENCE to serializeIsInsideGeofence(order.isInsideGeofence),
// beware not to call isInsideGeofence here, it's a computed property
)
},
)

fun serializeSuccess(success: Serialized): Serialized =
mapOf(
KEY_TYPE to TYPE_RESULT_SUCCESS,
KEY_VALUE to success,
)

fun serializeWorkerHandle(workerHandle: String): Serialized =
mapOf(
KEY_TYPE to TYPE_WORKER_HANDLE,
Expand Down Expand Up @@ -238,14 +281,6 @@ internal object Serialization {
}.getOrThrow()
}

private fun deserializeOrderHandle(map: Serialized): WrapperResult<String> =
parse(map) {
it.assertValue<String>(key = KEY_TYPE, value = TYPE_ORDER_HANDLE)
it
.get<String>(KEY_VALUE)
.getOrThrow()
}

private fun deserializeOrderStatus(map: Serialized): WrapperResult<HyperTrack.OrderStatus> =
parse(map) {
when (it.get<String>(KEY_TYPE).getOrThrow()) {
Expand All @@ -260,22 +295,6 @@ internal object Serialization {
}
}

private fun serializeIsInsideGeofence(isInsideGeofence: Result<Boolean, HyperTrack.LocationError>): Serialized =
when (isInsideGeofence) {
is Result.Failure -> {
serializeFailure(serializeLocationError(isInsideGeofence.failure))
}

is Result.Success -> {
serializeSuccess(
mapOf(
KEY_TYPE to TYPE_IS_INSIDE_GEOFENCE,
KEY_VALUE to isInsideGeofence.success,
),
)
}
}

private fun serializeLocation(location: HyperTrack.Location): Serialized =
mapOf(
KEY_TYPE to TYPE_LOCATION,
Expand All @@ -296,24 +315,6 @@ internal object Serialization {
),
)

private fun serializeFailure(failure: List<Serialized>): Serialized =
mapOf(
KEY_TYPE to TYPE_RESULT_FAILURE,
KEY_VALUE to failure,
)

private fun serializeFailure(failure: Serialized): Serialized =
mapOf(
KEY_TYPE to TYPE_RESULT_FAILURE,
KEY_VALUE to failure,
)

private fun serializeSuccess(success: Serialized): Serialized =
mapOf(
KEY_TYPE to TYPE_RESULT_SUCCESS,
KEY_VALUE to success,
)

private fun serializeLocationError(locationError: HyperTrack.LocationError): Serialized =
when (locationError) {
HyperTrack.LocationError.NotRunning -> {
Expand Down Expand Up @@ -449,8 +450,7 @@ internal object Serialization {
private const val KEY_GEOTAG_EXPECTED_LOCATION = "expectedLocation"
private const val KEY_GEOTAG_ORDER_HANDLE = "orderHandle"
private const val KEY_GEOTAG_ORDER_STATUS = "orderStatus"
private const val KEY_ORDER_IS_INSIDE_GEOFENCE = "isInsideGeofence"
private const val KEY_LOCATION = "location"
private const val KEY_ORDER_HANDLE = "orderHandle"
private const val KEY_ORDER_INDEX = "orderIndex"
private const val KEY_ORDER_INDEX = "index"
}
20 changes: 1 addition & 19 deletions docs/__404error.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,11 @@
<link rel="stylesheet" href="static-assets/github.css?v1">
<link rel="stylesheet" href="static-assets/styles.css?v1">
<link rel="icon" href="static-assets/favicon.png?v1">


</head>


<body data-base-href="" data-using-base-href="false" class="light-theme">

<div id="overlay-under-drawer"></div>

<header id="title">
<span id="sidenav-left-toggle" class="material-symbols-outlined" role="button" tabindex="0">menu</span>
<ol class="breadcrumbs gt-separated dark hidden-xs">
Expand All @@ -47,10 +43,8 @@
</div>
</header>
<main>

<div id="dartdoc-main-content" class="main-content">
<h1>404: Something's gone wrong :-(</h1>

<section class="desc">
<p>You've tried to visit a page that doesn't exist. Luckily this site
has other <a href="index.html">pages</a>.</p>
Expand All @@ -59,23 +53,19 @@ <h1>404: Something's gone wrong :-(</h1>
<input type="text" id="search-body" autocomplete="off" disabled class="form-control typeahead" placeholder="Loading search...">
</form>
</p>

</section>
</div> <!-- /.main-content -->

<div id="dartdoc-sidebar-left" class="sidebar sidebar-offcanvas-left">
<!-- The search input and breadcrumbs below are only responsively visible at low resolutions. -->
<header id="header-search-sidebar" class="hidden-l">
<form class="search-sidebar" role="search">
<input type="text" id="search-sidebar" autocomplete="off" disabled class="form-control typeahead" placeholder="Loading search...">
</form>
</header>

<ol class="breadcrumbs gt-separated dark hidden-l" id="sidebar-nav">
<li><a href="https://www.hypertrack.com/">hypertrack_plugin package</a></li>
</ol>


<h5><span class="package-name">hypertrack_plugin</span> <span class="package-kind">package</span></h5>
<ol>
<li class="section-title">Libraries</li>
Expand All @@ -91,29 +81,21 @@ <h5><span class="package-name">hypertrack_plugin</span> <span class="package-kin
</ol>

</div>

<div id="dartdoc-sidebar-right" class="sidebar sidebar-offcanvas-right">
</div>

</main>

<footer>
<span class="no-break">
hypertrack_plugin
2.7.0
3.0.0
</span>


</footer>



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



</body>

</html>

28 changes: 21 additions & 7 deletions docs/data_types_hypertrack_error/HyperTrackError-enum-sidebar.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<ol>

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

<li class="section-title"><a href="data_types_hypertrack_error/HyperTrackError.html#values">Values</a></li>
<li><a href="data_types_hypertrack_error/HyperTrackError.html#blockedFromRunning">blockedFromRunning</a></li>
Expand All @@ -23,18 +21,34 @@
<li class="section-title inherited">
<a href="data_types_hypertrack_error/HyperTrackError.html#instance-properties">Properties</a>
</li>
<li class="inherited"><a href="https://api.flutter.dev/flutter/dart-core/Object/hashCode.html">hashCode</a></li>
<li class="inherited"><a href="https://api.flutter.dev/flutter/dart-core/Enum/index.html">index</a></li>

<li class="inherited">
<a href="https://api.flutter.dev/flutter/dart-core/Object/hashCode.html">hashCode</a>
</li>

<li class="inherited">
<a href="https://api.flutter.dev/flutter/dart-core/Enum/index.html">index</a>
</li>

<li>
<a href="https://api.flutter.dev/flutter/dart-core/EnumName/name.html">name</a>
<sup
class="muted"
title="Available on Enum">(ext)</sup>
</li>


<li class="section-title inherited"><a href="data_types_hypertrack_error/HyperTrackError.html#operators">Operators</a></li>
<li class="inherited"><a href="https://api.flutter.dev/flutter/dart-core/Object/operator_equals.html">operator ==</a></li>

<li class="inherited">
<a href="https://api.flutter.dev/flutter/dart-core/Object/operator_equals.html">operator ==</a>
</li>






<li class="section-title"><a href="data_types_hypertrack_error/HyperTrackError.html#constants">Constants</a></li>
<li><a href="data_types_hypertrack_error/HyperTrackError/values-constant.html">values</a></li>
<li class="section-title"><a href="data_types_hypertrack_error/HyperTrackError.html#constants">Constants</a></li>
<li><a href="data_types_hypertrack_error/HyperTrackError/values-constant.html">values</a></li>
</ol>
Loading