Skip to content

Commit 272f918

Browse files
authored
Update HyperTrack SDK iOS to 5.8.1 and Android to 7.8.4 (#44)
1 parent 422517e commit 272f918

27 files changed

+198
-241
lines changed

CHANGELOG.md

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

66
## [Unreleased]
77

8+
## [3.6.3] - 2024-11-13
9+
10+
### Changed
11+
12+
- Updated HyperTrack SDK iOS to [5.8.1](https://github.com/hypertrack/sdk-ios/releases/tag/5.8.1)
13+
- Updated HyperTrack SDK Android to [7.8.4](https://github.com/hypertrack/sdk-android/releases/tag/7.8.4)
14+
815
## [3.6.2] - 2024-09-24
916

1017
### Changed
@@ -309,3 +316,4 @@ We are excited to announce the release of HyperTrack Ionic Capacitor SDK 2.0.0,
309316
[3.6.0]: https://github.com/hypertrack/sdk-ionic-capacitor/releases/tag/3.6.0
310317
[3.6.1]: https://github.com/hypertrack/sdk-ionic-capacitor/releases/tag/3.6.1
311318
[3.6.2]: https://github.com/hypertrack/sdk-ionic-capacitor/releases/tag/3.6.2
319+
[3.6.3]: https://github.com/hypertrack/sdk-ionic-capacitor/releases/tag/3.6.3

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.8.0'
17+
s.dependency 'HyperTrack','5.8.1'
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.8.0-brightgreen.svg)](https://github.com/hypertrack/sdk-ios)
6-
[![Android SDK](https://img.shields.io/badge/Android%20SDK-7.8.3-brightgreen.svg)](https://github.com/hypertrack/sdk-android)
5+
[![iOS SDK](https://img.shields.io/badge/iOS%20SDK-5.8.1-brightgreen.svg)](https://github.com/hypertrack/sdk-ios)
6+
[![Android SDK](https://img.shields.io/badge/Android%20SDK-7.8.4-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/.editorconfig

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[**/*.kt]
2+
# TODO: use explicit instead of wildcard imports
3+
ktlint_standard_no-wildcard-imports = disabled
4+
# TODO: align with standard enum case naming
5+
ktlint_standard_enum-entry-name-case = disabled

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.8.3"
10+
ext.hypertrack_sdk_version = "7.8.4"
1111
ext.firebase_messaging_version = "23.1.1"
1212

1313
repositories {

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

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,17 @@ import com.getcapacitor.JSObject
55
import com.getcapacitor.PluginCall
66
import com.hypertrack.sdk.capacitor.common.Failure
77
import com.hypertrack.sdk.capacitor.common.Serialized
8-
import com.hypertrack.sdk.capacitor.common.WrapperResult
98
import com.hypertrack.sdk.capacitor.common.Success
9+
import com.hypertrack.sdk.capacitor.common.WrapperResult
1010
import org.json.JSONArray
1111
import org.json.JSONObject
1212

1313
private const val KEY_ERRORS = "errors"
1414

15-
fun serializeErrorsForCapacitor(errors: List<Serialized>): Serialized {
16-
return mapOf(
17-
KEY_ERRORS to errors
15+
fun serializeErrorsForCapacitor(errors: List<Serialized>): Serialized =
16+
mapOf(
17+
KEY_ERRORS to errors,
1818
)
19-
}
2019

2120
@Suppress("UNCHECKED_CAST")
2221
internal fun <T> WrapperResult<T>.toPluginCall(call: PluginCall) {
@@ -47,8 +46,8 @@ internal fun <T> WrapperResult<T>.toPluginCall(call: PluginCall) {
4746
}
4847

4948
@Suppress("UNCHECKED_CAST")
50-
internal fun List<Any>.toJSArray(): JSArray {
51-
return JSArray().also { writableArray ->
49+
internal fun List<Any>.toJSArray(): JSArray =
50+
JSArray().also { writableArray ->
5251
forEach {
5352
when (it) {
5453
is Map<*, *> -> {
@@ -63,7 +62,6 @@ internal fun List<Any>.toJSArray(): JSArray {
6362
}
6463
}
6564
}
66-
}
6765

6866
@Suppress("UNCHECKED_CAST")
6967
internal fun Map<String, Any?>.toJSObject(): JSObject {
@@ -91,7 +89,7 @@ internal fun Map<String, Any?>.toJSObject(): JSObject {
9189
}
9290
null -> {
9391
throw IllegalArgumentException(
94-
"Invalid JSON: $this \n Null JSON values are not supported"
92+
"Invalid JSON: $this \n Null JSON values are not supported",
9593
)
9694
}
9795
else -> {
@@ -102,13 +100,14 @@ internal fun Map<String, Any?>.toJSObject(): JSObject {
102100
}
103101
}
104102

105-
fun JSONObject.toMap(): Map<String, Any?> {
106-
return keys().asSequence().associateWith { key ->
103+
fun JSONObject.toMap(): Map<String, Any?> =
104+
keys().asSequence().associateWith { key ->
107105
when (val value = this.get(key)) {
108106
is Boolean,
109107
is Double,
110108
is Int,
111-
is String -> {
109+
is String,
110+
-> {
112111
value
113112
}
114113
is JSONArray -> {
@@ -122,15 +121,15 @@ fun JSONObject.toMap(): Map<String, Any?> {
122121
}
123122
}
124123
}
125-
}
126124

127-
private fun JSONArray.toList(): List<Any> {
128-
return (0..length()).mapNotNull { index ->
125+
private fun JSONArray.toList(): List<Any> =
126+
(0..length()).mapNotNull { index ->
129127
when (val value = this.get(index)) {
130128
is Boolean,
131129
is Double,
132130
is Int,
133-
is String -> {
131+
is String,
132+
-> {
134133
value
135134
}
136135
is JSONArray -> {
@@ -144,4 +143,3 @@ private fun JSONArray.toList(): List<Any> {
144143
}
145144
}
146145
}
147-
}

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

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import com.hypertrack.sdk.capacitor.common.Serialization.serializeOrders
1414

1515
@CapacitorPlugin(name = "HyperTrackCapacitorPlugin")
1616
class HyperTrackCapacitorPlugin : Plugin() {
17-
1817
private var locateSubscription: HyperTrack.Cancellable? = null
1918

2019
init {
@@ -114,9 +113,10 @@ class HyperTrackCapacitorPlugin : Plugin() {
114113
@PluginMethod
115114
fun onSubscribedToLocate(call: PluginCall) {
116115
locateSubscription?.cancel()
117-
locateSubscription = HyperTrack.locate { result ->
118-
sendLocateEvent(result)
119-
}
116+
locateSubscription =
117+
HyperTrack.locate { result ->
118+
sendLocateEvent(result)
119+
}
120120
}
121121

122122
@PluginMethod
@@ -132,42 +132,42 @@ class HyperTrackCapacitorPlugin : Plugin() {
132132
private fun sendErrorsEvent(errors: Set<HyperTrack.Error>) {
133133
sendEvent(
134134
EVENT_ERRORS,
135-
serializeErrorsForCapacitor(serializeErrors(errors)).toJSObject()
135+
serializeErrorsForCapacitor(serializeErrors(errors)).toJSObject(),
136136
)
137137
}
138138

139139
private fun sendIsAvailableEvent(isAvailable: Boolean) {
140140
sendEvent(
141141
EVENT_IS_AVAILABLE,
142-
Serialization.serializeIsAvailable(isAvailable).toJSObject()
142+
Serialization.serializeIsAvailable(isAvailable).toJSObject(),
143143
)
144144
}
145145

146146
private fun sendIsTrackingEvent(isTracking: Boolean) {
147147
sendEvent(
148148
EVENT_IS_TRACKING,
149-
Serialization.serializeIsTracking(isTracking).toJSObject()
149+
Serialization.serializeIsTracking(isTracking).toJSObject(),
150150
)
151151
}
152152

153153
private fun sendLocationEvent(locationResult: Result<HyperTrack.Location, HyperTrack.LocationError>) {
154154
sendEvent(
155155
EVENT_LOCATION,
156-
Serialization.serializeLocationResult(locationResult).toJSObject()
156+
Serialization.serializeLocationResult(locationResult).toJSObject(),
157157
)
158158
}
159159

160160
private fun sendLocateEvent(locateResult: Result<HyperTrack.Location, Set<HyperTrack.Error>>) {
161161
sendEvent(
162162
EVENT_LOCATE,
163-
Serialization.serializeLocateResult(locateResult).toJSObject()
163+
Serialization.serializeLocateResult(locateResult).toJSObject(),
164164
)
165165
}
166166

167167
private fun sendOrdersEvent(orders: Collection<HyperTrack.Order>) {
168168
sendEvent(
169169
EVENT_ORDERS,
170-
serializeOrders(orders).toJSObject()
170+
serializeOrders(orders).toJSObject(),
171171
)
172172
}
173173

@@ -195,7 +195,7 @@ class HyperTrackCapacitorPlugin : Plugin() {
195195

196196
private fun invokeSdkMethod(
197197
method: SdkMethod,
198-
call: PluginCall
198+
call: PluginCall,
199199
): WrapperResult<*> {
200200
val argsJson = call.data
201201
return when (method) {
@@ -290,15 +290,19 @@ class HyperTrackCapacitorPlugin : Plugin() {
290290
}
291291
}
292292

293-
private fun sendEvent(eventName: String, data: JSObject, retainUntilConsumed: Boolean = false) {
293+
private fun sendEvent(
294+
eventName: String,
295+
data: JSObject,
296+
retainUntilConsumed: Boolean = false,
297+
) {
294298
notifyListeners(eventName, data, retainUntilConsumed)
295299
}
296300

297301
private inline fun <reified T, N> withArgs(
298302
args: JSObject,
299-
crossinline sdkMethodCall: (T) -> WrapperResult<N>
300-
): WrapperResult<N> {
301-
return when (T::class) {
303+
crossinline sdkMethodCall: (T) -> WrapperResult<N>,
304+
): WrapperResult<N> =
305+
when (T::class) {
302306
Map::class -> {
303307
sdkMethodCall.invoke(args.toMap() as T)
304308
}
@@ -307,7 +311,6 @@ class HyperTrackCapacitorPlugin : Plugin() {
307311
Failure(IllegalArgumentException(args.toString()))
308312
}
309313
}
310-
}
311314

312315
companion object {
313316
private const val EVENT_ERRORS = "errors"

0 commit comments

Comments
 (0)