Skip to content

Commit

Permalink
Update HyperTrack SDK iOS to 5.5.2 and Android to 7.5.3 (#102)
Browse files Browse the repository at this point in the history
Add docs links to addGeotag comments.
Fix order handle serialization.
Fix Kotlin formatting.
  • Loading branch information
pavel-kuznetsov-hypertrack authored Apr 24, 2024
1 parent f15988e commit 25a7407
Show file tree
Hide file tree
Showing 36 changed files with 236 additions and 167 deletions.
11 changes: 7 additions & 4 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,18 @@
root = true

[*]

indent_style = space
indent_size = 2

end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.{kt,kts}]
indent_style = space
[**/*.{kt,kts}]
indent_size = 4
indent_style = space
ktlint_standard_enum-entry-name-case = disabled
ktlint_standard_max-line-length = disabled
ktlint_standard_no-wildcard-imports = disabled
ktlint_standard_no-consecutive-blank-lines = disabled
ktlint_standard_no-consecutive-comments = disabled
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [13.3.1] - 2024-04-24

### Changed

- Updated HyperTrack SDK iOS to [5.5.2](https://github.com/hypertrack/sdk-ios/releases/tag/5.5.2)
- Updated HyperTrack SDK Android to [7.5.3](https://github.com/hypertrack/sdk-android/releases/tag/7.5.3)

## [13.3.0] - 2024-04-19

### Added
Expand Down Expand Up @@ -819,3 +826,4 @@ Initial release.
[13.2.2]: https://github.com/hypertrack/sdk-react-native/releases/tag/13.2.2
[13.2.3]: https://github.com/hypertrack/sdk-react-native/releases/tag/13.2.3
[13.3.0]: https://github.com/hypertrack/sdk-react-native/releases/tag/13.3.0
[13.3.1]: https://github.com/hypertrack/sdk-react-native/releases/tag/13.3.1
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

[![GitHub](https://img.shields.io/github/license/hypertrack/sdk-react-native?color=orange)](./LICENSE)
[![npm](https://img.shields.io/npm/v/hypertrack-sdk-react-native.svg)](https://www.npmjs.com/package/hypertrack-sdk-react-native)
[![iOS SDK](https://img.shields.io/badge/iOS%20SDK-5.5.1-brightgreen.svg)](https://github.com/hypertrack/sdk-ios)
[![Android SDK](https://img.shields.io/badge/Android%20SDK-7.5.2-brightgreen.svg)](https://github.com/hypertrack/sdk-android)
[![iOS SDK](https://img.shields.io/badge/iOS%20SDK-5.5.2-brightgreen.svg)](https://github.com/hypertrack/sdk-ios)
[![Android SDK](https://img.shields.io/badge/Android%20SDK-7.5.3-brightgreen.svg)](https://github.com/hypertrack/sdk-android)

[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.

Expand Down
4 changes: 2 additions & 2 deletions docs/classes/HyperTrack.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/enums/HyperTrackError.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/index.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/modules.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/types/Errors.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/types/Failure.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/types/Location.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/types/LocationError.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/types/LocationWithDeviation.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/types/NotRunning.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/types/OrderStatus.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/types/Result.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/types/Starting.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/types/Success.html

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion justfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
alias b := build
alias cnm := _clear-node-modules
alias d := docs
alias f := format
alias gd := get-dependencies
alias od := open-docs
alias pt := push-tag
Expand Down Expand Up @@ -41,7 +42,7 @@ _clear-node-modules:
rm -rf plugin_android_location_services_google_19_0_1/node_modules
rm -rf plugin_android_push_service_firebase/node_modules

docs:
docs: format
yarn --cwd sdk docs

get-dependencies:
Expand All @@ -56,6 +57,9 @@ _latest-android:
_latest-ios:
@curl -s https://cocoapods.org/pods/HyperTrack | grep -m 1 -o -E "HyperTrack <span>{{SEMVER_REGEX}}" | grep -o -E '{{SEMVER_REGEX}}' | head -n 1

format:
ktlint --format sdk/android/src/main/java/

open-docs: docs
open docs/index.html

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ PluginAndroidLocationServicesGoogle_minSdkVersion=21
PluginAndroidLocationServicesGoogle_targetSdkVersion=31
PluginAndroidLocationServicesGoogle_compileSdkVersion=31
PluginAndroidLocationServicesGoogle_ndkversion=21.4.7075529
PluginAndroidLocationServicesGoogle_HyperTrackSDKVersion=7.5.2
PluginAndroidLocationServicesGoogle_HyperTrackSDKVersion=7.5.3
2 changes: 1 addition & 1 deletion plugin_android_location_services_google/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hypertrack-sdk-react-native-plugin-android-location-services-google",
"version": "13.3.0",
"version": "13.3.1",
"description": "A wrapper around `Location Services Google` plugin for HyperTrack SDK Android that is used with `hypertrack-sdk-react-native`",
"main": "lib/commonjs/index",
"module": "lib/module/index",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ PluginAndroidLocationServicesGoogle1901_minSdkVersion=21
PluginAndroidLocationServicesGoogle1901_targetSdkVersion=31
PluginAndroidLocationServicesGoogle1901_compileSdkVersion=31
PluginAndroidLocationServicesGoogle1901_ndkversion=21.4.7075529
PluginAndroidLocationServicesGoogle1901_HyperTrackSDKVersion=7.5.2
PluginAndroidLocationServicesGoogle1901_HyperTrackSDKVersion=7.5.3
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hypertrack-sdk-react-native-plugin-android-location-services-google-19-0-1",
"version": "13.3.0",
"version": "13.3.1",
"description": "A wrapper around `Location Services Google 19.0.1` plugin for HyperTrack SDK Android that is used with `hypertrack-sdk-react-native`",
"main": "lib/commonjs/index",
"module": "lib/module/index",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ PluginAndroidPushServiceFirebase_minSdkVersion=21
PluginAndroidPushServiceFirebase_targetSdkVersion=31
PluginAndroidPushServiceFirebase_compileSdkVersion=31
PluginAndroidPushServiceFirebase_ndkversion=21.4.7075529
PluginAndroidPushServiceFirebase_HyperTrackSDKVersion=7.5.2
PluginAndroidPushServiceFirebase_HyperTrackSDKVersion=7.5.3
2 changes: 1 addition & 1 deletion plugin_android_push_service_firebase/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hypertrack-sdk-react-native-plugin-android-push-service-firebase",
"version": "13.3.0",
"version": "13.3.1",
"description": "A wrapper around `Push Service Firebase` plugin for HyperTrack SDK Android that is used with `hypertrack-sdk-react-native`",
"main": "lib/commonjs/index",
"module": "lib/module/index",
Expand Down
2 changes: 1 addition & 1 deletion sdk/android/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
HyperTrackSdk_kotlinVersion=1.6.21
HyperTrackSdk_HyperTrackSDKVersion=7.5.2
HyperTrackSdk_HyperTrackSDKVersion=7.5.3
android.useAndroidX=true
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,11 @@ import com.reactnativehypertracksdk.common.Serialization.serializeErrors
import com.reactnativehypertracksdk.common.Serialization.serializeIsAvailable
import com.reactnativehypertracksdk.common.Serialization.serializeIsTracking
import com.reactnativehypertracksdk.common.Serialization.serializeLocateResult
import com.reactnativehypertracksdk.common.Serialization.serializeLocation
import com.reactnativehypertracksdk.common.Serialization.serializeLocationResult

@ReactModule(name = HyperTrackReactNativePlugin.NAME)
class HyperTrackReactNativePlugin(reactContext: ReactApplicationContext?) :
ReactContextBaseJavaModule(reactContext) {

private var locateSubscription: HyperTrack.Cancellable? = null
private var subscriptions: List<HyperTrack.Cancellable>? = null

Expand Down Expand Up @@ -66,7 +64,10 @@ class HyperTrackReactNativePlugin(reactContext: ReactApplicationContext?) :
*/

@ReactMethod
fun addGeotag(args: ReadableMap, promise: Promise) {
fun addGeotag(
args: ReadableMap,
promise: Promise,
) {
HyperTrackSdkWrapper.addGeotag(args.toHashMap()).toPromise(promise)
}

Expand Down Expand Up @@ -113,9 +114,10 @@ class HyperTrackReactNativePlugin(reactContext: ReactApplicationContext?) :
@ReactMethod
fun locate(promise: Promise) {
locateSubscription?.cancel()
locateSubscription = HyperTrack.locate {
emitEvent(EVENT_LOCATE, serializeLocateResult(it).toWritableMap())
}
locateSubscription =
HyperTrack.locate {
emitEvent(EVENT_LOCATE, serializeLocateResult(it).toWritableMap())
}
Success(Unit).toPromise(promise)
}

Expand Down Expand Up @@ -172,14 +174,20 @@ class HyperTrackReactNativePlugin(reactContext: ReactApplicationContext?) :
}
}

private fun emitEvent(event: String, data: WritableMap) {
private fun emitEvent(
event: String,
data: WritableMap,
) {
reactApplicationContext
.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter::class.java)
.emit(event, data)
}

@Suppress("SameParameterValue")
private fun emitEvent(event: String, data: WritableArray) {
private fun emitEvent(
event: String,
data: WritableArray,
) {
reactApplicationContext
.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter::class.java)
.emit(event, data)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import com.facebook.react.bridge.Promise
import com.facebook.react.bridge.WritableArray
import com.facebook.react.bridge.WritableMap
import com.reactnativehypertracksdk.common.Failure
import com.reactnativehypertracksdk.common.WrapperResult
import com.reactnativehypertracksdk.common.Success
import com.reactnativehypertracksdk.common.WrapperResult

@Suppress("UNCHECKED_CAST")
internal fun <T> WrapperResult<T>.toPromise(promise: Promise) {
Expand Down Expand Up @@ -98,7 +98,7 @@ internal fun Map<String, Any?>.toWritableMap(): WritableMap {
is Double -> {
putDouble(key, value)
}

is Float -> {
putDouble(key, value.toDouble())
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,20 @@ typealias Serialized = Map<String, Any?>
* It receives serialized params.
*/
internal object HyperTrackSdkWrapper {

fun addGeotag(args: Serialized): WrapperResult<Serialized> {
return deserializeGeotagData(args)
.flatMapSuccess { geotag ->
// TODO: return proper error if JSON is wrong
val geotagMetadata = Json.fromMap(geotag.data)!!
val expectedLocation = geotag
.expectedLocation
?.let {
HyperTrack.Location(
latitude = it.latitude,
longitude = it.longitude
)
}
val expectedLocation =
geotag
.expectedLocation
?.let {
HyperTrack.Location(
latitude = it.latitude,
longitude = it.longitude,
)
}
val orderHandle = geotag.orderHandle
val orderStatus = geotag.orderStatus
if (expectedLocation != null) {
Expand All @@ -53,7 +53,7 @@ internal object HyperTrackSdkWrapper {
orderHandle = orderHandle,
orderStatus = orderStatus,
expectedLocation = expectedLocation,
metadata = geotagMetadata
metadata = geotagMetadata,
)
} else {
HyperTrack.addGeotag(geotagMetadata, expectedLocation)
Expand All @@ -77,7 +77,7 @@ internal object HyperTrackSdkWrapper {
HyperTrack.addGeotag(
orderHandle = orderHandle,
orderStatus = orderStatus,
metadata = geotagMetadata
metadata = geotagMetadata,
)
} else {
HyperTrack.addGeotag(geotagMetadata)
Expand All @@ -103,13 +103,13 @@ internal object HyperTrackSdkWrapper {

fun getIsAvailable(): WrapperResult<Serialized> {
return Success(
serializeIsAvailable(HyperTrack.isAvailable)
serializeIsAvailable(HyperTrack.isAvailable),
)
}

fun getIsTracking(): WrapperResult<Serialized> {
return Success(
serializeIsTracking(HyperTrack.isTracking)
serializeIsTracking(HyperTrack.isTracking),
)
}

Expand All @@ -127,13 +127,13 @@ internal object HyperTrackSdkWrapper {

fun getMetadata(): WrapperResult<Serialized> {
return Success(
serializeMetadata(HyperTrack.metadata.toMap())
serializeMetadata(HyperTrack.metadata.toMap()),
)
}

fun getName(): WrapperResult<Serialized> {
return Success(
serializeName(HyperTrack.name)
serializeName(HyperTrack.name),
)
}

Expand Down Expand Up @@ -174,5 +174,4 @@ internal object HyperTrackSdkWrapper {
HyperTrack.name = name
}
}

}
Loading

0 comments on commit 25a7407

Please sign in to comment.