Skip to content

Commit 655dfb7

Browse files
Add Allow mock location methods (#66)
Update HyperTrack SDK iOS to 5.10.0 and Android to 7.10.0. Adapt project to Gradle 8.
1 parent b6b684c commit 655dfb7

File tree

133 files changed

+9081
-11079
lines changed

Some content is hidden

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

133 files changed

+9081
-11079
lines changed

CHANGELOG.md

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

66
## [Unreleased]
77

8+
## [2.7.0] - 2025-01-21
9+
10+
### Added
11+
12+
- New `HyperTrack.allowMockLocation` and `HyperTrack.setAllowMockLocation()` methods which can be used to allow mocking location data.
13+
- Check the [Test with mock locations](https://hypertrack.com/docs/mock-location) guide for more information.
14+
- Note: To avoid issues related to race conditions in your code use this API **only if** modifying the compiled `HyperTrackAllowMockLocation` AndroidManifest.xml/Info.plist value is insufficient for your needs.
15+
- Example: if for some reason you aren't able to recompile with `HyperTrackAllowMockLocation` set to `YES`/`true` for your prod app QA mock location tests and need to set up the value in runtime.
16+
- Gradle 8 support
17+
18+
### Changed
19+
20+
- Updated HyperTrack SDK iOS to [5.10.0](https://github.com/hypertrack/sdk-ios/releases/tag/5.10.0)
21+
- Updated HyperTrack SDK Android to [7.10.0](https://github.com/hypertrack/sdk-android/releases/tag/7.10.0)
22+
823
## [2.6.1] - 2024-12-05
924

1025
### Changed
@@ -486,3 +501,4 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
486501
[2.5.2]: https://github.com/hypertrack/sdk-flutter/releases/tag/2.5.2
487502
[2.6.0]: https://github.com/hypertrack/sdk-flutter/releases/tag/2.6.0
488503
[2.6.1]: https://github.com/hypertrack/sdk-flutter/releases/tag/2.6.1
504+
[2.7.0]: https://github.com/hypertrack/sdk-flutter/releases/tag/2.7.0

android/build.gradle

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ apply plugin: 'kotlin-android'
3131

3232
android {
3333
compileSdkVersion 31
34+
namespace "com.hypertrack.sdk.flutter"
3435

3536
sourceSets {
3637
main.java.srcDirs += 'src/main/kotlin'
@@ -43,7 +44,7 @@ android {
4344
disable 'InvalidPackage'
4445
}
4546
dependencies {
46-
def hyperTrackVersion = "7.9.1"
47+
def hyperTrackVersion = "7.10.0"
4748
implementation "com.hypertrack:sdk-android:${hyperTrackVersion}"
4849
implementation "com.hypertrack:activity-service-google:${hyperTrackVersion}"
4950
implementation "com.hypertrack:location-services-google:${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
@@ -100,6 +100,10 @@ public class HyperTrackPlugin :
100100
}
101101
}
102102

103+
SdkMethod.getAllowMockLocation -> {
104+
HyperTrackSdkWrapper.getAllowMockLocation()
105+
}
106+
103107
SdkMethod.getDeviceID -> {
104108
HyperTrackSdkWrapper.getDeviceId()
105109
}
@@ -145,6 +149,12 @@ public class HyperTrackPlugin :
145149
Success(NotImplemented)
146150
}
147151

152+
SdkMethod.setAllowMockLocation -> {
153+
withArgs<Unit>(call) { args ->
154+
HyperTrackSdkWrapper.setAllowMockLocation(args)
155+
}
156+
}
157+
148158
SdkMethod.setDynamicPublishableKey -> {
149159
throw NotImplementedError("setDynamicPublishableKey is not implemented")
150160
}

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,15 @@ package com.hypertrack.sdk.flutter.common
33
import com.hypertrack.sdk.android.HyperTrack
44
import com.hypertrack.sdk.android.Json
55
import com.hypertrack.sdk.android.Result
6+
import com.hypertrack.sdk.flutter.common.Serialization.deserializeAllowMockLocation
67
import com.hypertrack.sdk.flutter.common.Serialization.deserializeDynamicPublishableKey
78
import com.hypertrack.sdk.flutter.common.Serialization.deserializeGeotagData
89
import com.hypertrack.sdk.flutter.common.Serialization.deserializeIsAvailable
910
import com.hypertrack.sdk.flutter.common.Serialization.deserializeIsTracking
1011
import com.hypertrack.sdk.flutter.common.Serialization.deserializeMetadata
1112
import com.hypertrack.sdk.flutter.common.Serialization.deserializeName
1213
import com.hypertrack.sdk.flutter.common.Serialization.deserializeWorkerHandle
14+
import com.hypertrack.sdk.flutter.common.Serialization.serializeAllowMockLocation
1315
import com.hypertrack.sdk.flutter.common.Serialization.serializeDeviceId
1416
import com.hypertrack.sdk.flutter.common.Serialization.serializeDynamicPublishableKey
1517
import com.hypertrack.sdk.flutter.common.Serialization.serializeErrors
@@ -89,6 +91,8 @@ internal object HyperTrackSdkWrapper {
8991
}
9092
}
9193

94+
fun getAllowMockLocation(): WrapperResult<Serialized> = Success(serializeAllowMockLocation(HyperTrack.allowMockLocation))
95+
9296
fun getDeviceId(): WrapperResult<Serialized> = Success(serializeDeviceId(HyperTrack.deviceID))
9397

9498
fun getDynamicPublishableKey(): WrapperResult<Serialized> = Success(serializeDynamicPublishableKey(HyperTrack.dynamicPublishableKey))
@@ -135,6 +139,12 @@ internal object HyperTrackSdkWrapper {
135139
serializeWorkerHandle(HyperTrack.workerHandle),
136140
)
137141

142+
fun setAllowMockLocation(args: Serialized): WrapperResult<Unit> =
143+
deserializeAllowMockLocation(args)
144+
.mapSuccess { allowMockLocation ->
145+
HyperTrack.allowMockLocation = allowMockLocation
146+
}
147+
138148
fun setDynamicPublishableKey(args: Serialized): WrapperResult<Unit> =
139149
deserializeDynamicPublishableKey(args)
140150
.mapSuccess { publishableKey ->

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
@@ -8,6 +8,7 @@ package com.hypertrack.sdk.flutter.common
88
*/
99
internal enum class SdkMethod {
1010
addGeotag,
11+
getAllowMockLocation,
1112
getDeviceID,
1213
getDynamicPublishableKey,
1314
getErrors,
@@ -19,6 +20,7 @@ internal enum class SdkMethod {
1920
getOrders,
2021
getWorkerHandle,
2122
locate,
23+
setAllowMockLocation,
2224
setDynamicPublishableKey,
2325
setIsAvailable,
2426
setIsTracking,

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

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,14 @@ import com.hypertrack.sdk.android.Result
99
* to Map<String, T> or List<T> where T is any JSON-compatible type
1010
*/
1111
internal object Serialization {
12+
fun deserializeAllowMockLocation(allowMockLocation: Serialized): WrapperResult<Boolean> =
13+
parse(allowMockLocation) {
14+
it.assertValue<String>(key = KEY_TYPE, value = TYPE_ALLOW_MOCK_LOCATION)
15+
it
16+
.get<Boolean>(KEY_VALUE)
17+
.getOrThrow()
18+
}
19+
1220
fun deserializeDynamicPublishableKey(args: Serialized): WrapperResult<String> =
1321
parse(args) {
1422
it.assertValue<String>(key = KEY_TYPE, value = TYPE_DYNAMIC_PUBLISHABLE_KEY)
@@ -89,6 +97,12 @@ internal object Serialization {
8997
.getOrThrow()
9098
}
9199

100+
fun serializeAllowMockLocation(allowMockLocation: Boolean): Serialized =
101+
mapOf(
102+
KEY_TYPE to TYPE_ALLOW_MOCK_LOCATION,
103+
KEY_VALUE to allowMockLocation,
104+
)
105+
92106
fun serializeDeviceId(deviceId: String): Serialized =
93107
mapOf(
94108
KEY_TYPE to TYPE_DEVICE_ID,
@@ -159,8 +173,7 @@ internal object Serialization {
159173
}
160174
}
161175

162-
fun serializeLocationErrorFailure(locationError: HyperTrack.LocationError): Serialized =
163-
serializeFailure(serializeLocationError(locationError))
176+
fun serializeLocationErrorFailure(locationError: HyperTrack.LocationError): Serialized = serializeFailure(serializeLocationError(locationError))
164177

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

@@ -405,6 +418,7 @@ internal object Serialization {
405418
private const val TYPE_RESULT_FAILURE = "failure"
406419
private const val TYPE_RESULT_SUCCESS = "success"
407420

421+
private const val TYPE_ALLOW_MOCK_LOCATION = "allowMockLocation"
408422
private const val TYPE_DEVICE_ID = "deviceID"
409423
private const val TYPE_DYNAMIC_PUBLISHABLE_KEY = "dynamicPublishableKey"
410424
private const val TYPE_ERROR = "error"

docs/__404error.html

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,14 @@
44
<meta charset="utf-8">
55
<meta http-equiv="X-UA-Compatible" content="IE=edge">
66
<meta name="viewport" content="width=device-width, height=device-height, initial-scale=1, user-scalable=no">
7-
<meta name="generator" content="made with love by dartdoc 6.0.0">
87
<meta name="description" content="hypertrack_plugin API docs, for the Dart programming language.">
98
<title>hypertrack_plugin - Dart API docs</title>
109

1110

1211

1312
<link rel="preconnect" href="https://fonts.gstatic.com">
1413
<link href="https://fonts.googleapis.com/css2?family=Roboto+Mono:ital,wght@0,300;0,400;0,500;0,700;1,400&display=swap" rel="stylesheet">
15-
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
14+
<link href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@24,400,0,0" rel="stylesheet">
1615

1716
<link rel="stylesheet" href="static-assets/github.css?v1">
1817
<link rel="stylesheet" href="static-assets/styles.css?v1">
@@ -22,24 +21,33 @@
2221
</head>
2322

2423

25-
<body data-base-href="" data-using-base-href="false">
24+
<body data-base-href="" data-using-base-href="false" class="light-theme">
2625

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

2928
<header id="title">
30-
<button id="sidenav-left-toggle" type="button">&nbsp;</button>
29+
<span id="sidenav-left-toggle" class="material-symbols-outlined" role="button" tabindex="0">menu</span>
3130
<ol class="breadcrumbs gt-separated dark hidden-xs">
3231
<li><a href="https://www.hypertrack.com/">hypertrack_plugin package</a></li>
3332
</ol>
3433
<div class="self-name">hypertrack_plugin</div>
3534
<form class="search navbar-right" role="search">
3635
<input type="text" id="search-box" autocomplete="off" disabled class="form-control typeahead" placeholder="Loading search...">
3736
</form>
37+
<div class="toggle" id="theme-button" title="Toggle brightness">
38+
<label for="theme">
39+
<input type="checkbox" id="theme" value="light-theme">
40+
<span id="dark-theme-button" class="material-symbols-outlined">
41+
dark_mode
42+
</span>
43+
<span id="light-theme-button" class="material-symbols-outlined">
44+
light_mode
45+
</span>
46+
</label>
47+
</div>
3848
</header>
39-
4049
<main>
4150

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

@@ -56,29 +64,30 @@ <h1>404: Something's gone wrong :-(</h1>
5664
</div> <!-- /.main-content -->
5765

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

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

6978

7079
<h5><span class="package-name">hypertrack_plugin</span> <span class="package-kind">package</span></h5>
7180
<ol>
7281
<li class="section-title">Libraries</li>
82+
<li><a href="data_types_hypertrack_error/data_types_hypertrack_error-library.html">data_types/hypertrack_error</a></li>
83+
<li><a href="data_types_json/data_types_json-library.html">data_types/json</a></li>
84+
<li><a href="data_types_location/data_types_location-library.html">data_types/location</a></li>
85+
<li><a href="data_types_location_error/data_types_location_error-library.html">data_types/location_error</a></li>
86+
<li><a href="data_types_location_with_deviation/data_types_location_with_deviation-library.html">data_types/location_with_deviation</a></li>
87+
<li><a href="data_types_order/data_types_order-library.html">data_types/order</a></li>
88+
<li><a href="data_types_order_status/data_types_order_status-library.html">data_types/order_status</a></li>
89+
<li><a href="data_types_result/data_types_result-library.html">data_types/result</a></li>
7390
<li><a href="hypertrack/hypertrack-library.html">hypertrack</a></li>
74-
<li><a href="data_types_hypertrack_error/data_types_hypertrack_error-library.html">hypertrack_error</a></li>
75-
<li><a href="data_types_json/data_types_json-library.html">json</a></li>
76-
<li><a href="data_types_location/data_types_location-library.html">location</a></li>
77-
<li><a href="data_types_location_error/data_types_location_error-library.html">location_error</a></li>
78-
<li><a href="data_types_location_with_deviation/data_types_location_with_deviation-library.html">location_with_deviation</a></li>
79-
<li><a href="data_types_order/data_types_order-library.html">order</a></li>
80-
<li><a href="data_types_order_status/data_types_order_status-library.html">order_status</a></li>
81-
<li><a href="data_types_result/data_types_result-library.html">result</a></li>
8291
</ol>
8392

8493
</div>
@@ -91,7 +100,7 @@ <h5><span class="package-name">hypertrack_plugin</span> <span class="package-kin
91100
<footer>
92101
<span class="no-break">
93102
hypertrack_plugin
94-
2.6.1
103+
2.7.0
95104
</span>
96105

97106

0 commit comments

Comments
 (0)