Skip to content

Commit 2b735ec

Browse files
MOB-78 Update iOS SDK to 4.16.0 (#18)
Fix format for Kotlin files
1 parent 6c73f24 commit 2b735ec

File tree

8 files changed

+45
-25
lines changed

8 files changed

+45
-25
lines changed

.justfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
release:
2+
npm publish --dry-run
3+
@echo "THIS IS DRY RUN. Check if everything is ok and then run 'npm publish'. Checklist:"
4+
@echo "\t- check the release steps in CONTRIBUTING"

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@
33
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
44
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
55

6+
## [1.0.1] - 2023-06-01
7+
8+
### Changed
9+
- Updated HyperTrack iOS SDK to 4.16.0
10+
611
## [1.0.0] - 2023-02-10
712
### Changed
813
- Updated HyperTrack Android SDK to 6.4.0

CONTRIBUTING.md

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,16 @@
2020
- version
2121

2222
3. Update CHANGELOG
23-
4. Update README badge
24-
5. Create a version tag
25-
6. Commit and push
26-
7. Create a release
27-
- Release title - version
28-
8. npm publish
23+
24+
4. Update the README badge
25+
26+
5. Do the release dry run with `just release` and verify that the release is correct (checklist is in the command output)
27+
28+
6. Commit and merge to master
29+
30+
7. Create and push a new version tag
31+
32+
8. Create a Github repo release
33+
- Release title should be the current version tag
34+
35+
9. Run `npm publish` to publish the package to npm

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
![GitHub](https://img.shields.io/github/license/hypertrack/cordova-plugin-hypertrack.svg)
44
![npm](https://img.shields.io/npm/v/cordova-plugin-hypertrack-v3.svg)
5-
[![iOS SDK](https://img.shields.io/badge/iOS%20SDK-4.14.0-brightgreen.svg)](https://cocoapods.org/pods/HyperTrack)
5+
[![iOS SDK](https://img.shields.io/badge/iOS%20SDK-4.16.0-brightgreen.svg)](https://cocoapods.org/pods/HyperTrack)
66
![Android SDK](https://img.shields.io/badge/Android%20SDK-6.4.0-brightgreen.svg)
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.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "1.0.0",
2+
"version": "1.0.1",
33
"name": "cordova-plugin-hypertrack-v3",
44
"cordova_name": "Cordova HyperTrack Plugin",
55
"description": "Cordova Plugin for native HyperTrack SDKs",

plugin.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
<source url="https://cdn.cocoapods.org/" />
8181
</config>
8282
<pods use-frameworks="true">
83-
<pod name="HyperTrack" spec="4.14.0"/>
83+
<pod name="HyperTrack" spec="4.16.0"/>
8484
</pods>
8585
</podspec>
8686

src/android/HyperTrackCordovaPlugin.kt

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
11
package com.hypertrack.sdk.cordova.plugin
22

3-
import android.util.Log
43
import com.hypertrack.sdk.*
54
import com.hypertrack.sdk.cordova.plugin.common.*
6-
import com.hypertrack.sdk.cordova.plugin.common.HyperTrackSdkWrapper.initializeSdk
5+
76
import com.hypertrack.sdk.cordova.plugin.common.Result
87
import com.hypertrack.sdk.cordova.plugin.common.Serialization.serializeIsAvailable
98
import com.hypertrack.sdk.cordova.plugin.common.Serialization.serializeIsTracking
9+
import java.util.*
1010
import org.apache.cordova.CallbackContext
1111
import org.apache.cordova.CordovaPlugin
1212
import org.apache.cordova.PluginResult
1313
import org.json.JSONArray
1414
import org.json.JSONObject
15-
import java.util.*
1615

17-
class HyperTrackCordovaPlugin: CordovaPlugin() {
16+
class HyperTrackCordovaPlugin : CordovaPlugin() {
1817

1918
private var isTrackingEventStream: CallbackContext? = null
2019
private var isAvailableEventStream: CallbackContext? = null
@@ -33,7 +32,7 @@ class HyperTrackCordovaPlugin: CordovaPlugin() {
3332
argsJson: JSONArray,
3433
callbackContext: CallbackContext
3534
): Result<*> {
36-
return when(val method = SdkMethod.values().firstOrNull { it.name == methodName }) {
35+
return when (val method = SdkMethod.values().firstOrNull { it.name == methodName }) {
3736
SdkMethod.initialize -> {
3837
withArgs<Map<String, Any?>, Unit>(argsJson) { args ->
3938
HyperTrackSdkWrapper.initializeSdk(args).mapSuccess {
@@ -83,23 +82,23 @@ class HyperTrackCordovaPlugin: CordovaPlugin() {
8382
HyperTrackSdkWrapper.sync()
8483
}
8584
else -> {
86-
when(
85+
when (
8786
SubscriptionCall.values().firstOrNull {
8887
it.name == methodName
8988
}
9089
) {
9190
SubscriptionCall.subscribeToTracking -> {
9291
isTrackingEventStream?.let { disposeCallback(it) }
9392
isTrackingEventStream = callbackContext
94-
HyperTrackSdkWrapper.isTracking().mapSuccess {
93+
HyperTrackSdkWrapper.isTracking().mapSuccess {
9594
sendEvent(callbackContext, it)
9695
NoCallback
9796
}
9897
}
9998
SubscriptionCall.subscribeToAvailability -> {
10099
isAvailableEventStream?.let { disposeCallback(it) }
101100
isAvailableEventStream = callbackContext
102-
HyperTrackSdkWrapper.isAvailable().mapSuccess {
101+
HyperTrackSdkWrapper.isAvailable().mapSuccess {
103102
sendEvent(callbackContext, it)
104103
NoCallback
105104
}
@@ -129,7 +128,7 @@ class HyperTrackCordovaPlugin: CordovaPlugin() {
129128
}
130129
}
131130
}
132-
131+
133132
private fun sendEvent(callbackContext: CallbackContext, data: Any) {
134133
try {
135134
when (data) {
@@ -164,8 +163,11 @@ class HyperTrackCordovaPlugin: CordovaPlugin() {
164163
callbackContext.sendPluginResult(result)
165164
}
166165

167-
private inline fun <reified T, N> withArgs(args: JSONArray, crossinline sdkMethodCall: (T) -> Result<N>): Result<N> {
168-
return when(T::class) {
166+
private inline fun <reified T, N> withArgs(
167+
args: JSONArray,
168+
crossinline sdkMethodCall: (T) -> Result<N>
169+
): Result<N> {
170+
return when (T::class) {
169171
Map::class -> {
170172
try {
171173
Success(args.getJSONObject(0))
@@ -232,9 +234,9 @@ class HyperTrackCordovaPlugin: CordovaPlugin() {
232234
}
233235

234236
private fun <S> Result<S>.sendAsCallbackResult(callbackContext: CallbackContext): Boolean {
235-
return when(this) {
237+
return when (this) {
236238
is Success -> {
237-
when(val success = this.success) {
239+
when (val success = this.success) {
238240
is Map<*, *> -> {
239241
callbackContext.success(JSONObject(success))
240242
true
@@ -251,7 +253,9 @@ private fun <S> Result<S>.sendAsCallbackResult(callbackContext: CallbackContext)
251253
true
252254
}
253255
else -> {
254-
callbackContext.failure(IllegalArgumentException("Invalid response ${this.success}"))
256+
callbackContext.failure(
257+
IllegalArgumentException("Invalid response ${this.success}")
258+
)
255259
false
256260
}
257261
}
@@ -265,7 +269,7 @@ private fun <S> Result<S>.sendAsCallbackResult(callbackContext: CallbackContext)
265269

266270
private fun JSONObject.toMap(): Map<String, Any?> {
267271
return keys().asSequence().associateWith { key ->
268-
when(val value = this.get(key)) {
272+
when (val value = this.get(key)) {
269273
is Boolean,
270274
is String,
271275
is Double,

src/android/SubscriptionCall.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@ enum class SubscriptionCall {
1111
subscribeToAvailability,
1212
unsubscribeFromAvailability,
1313
subscribeToErrors,
14-
unsubscribeFromErrors,
14+
unsubscribeFromErrors
1515
}

0 commit comments

Comments
 (0)