hypertrack-sdk-react-native 13.2.3 → 13.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/.gradle/7.2/dependencies-accessors/dependencies-accessors.lock +0 -0
- package/android/.gradle/7.2/dependencies-accessors/gc.properties +0 -0
- package/android/.gradle/7.2/fileChanges/last-build.bin +0 -0
- package/android/.gradle/7.2/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/7.2/gc.properties +0 -0
- package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- package/android/.gradle/buildOutputCleanup/cache.properties +2 -0
- package/android/.gradle/checksums/checksums.lock +0 -0
- package/android/.gradle/vcs-1/gc.properties +0 -0
- package/android/.idea/gradle.xml +15 -0
- package/android/.idea/misc.xml +9 -0
- package/android/.idea/vcs.xml +6 -0
- package/android/gradle.properties +1 -1
- package/android/local.properties +8 -0
- package/android/src/main/java/com/reactnativehypertracksdk/HyperTrackReactNativePlugin.kt +16 -8
- package/android/src/main/java/com/reactnativehypertracksdk/ReactNativeSerialization.kt +2 -2
- package/android/src/main/java/com/reactnativehypertracksdk/common/GeotagData.kt +4 -1
- package/android/src/main/java/com/reactnativehypertracksdk/common/HyperTrackSdkWrapper.kt +41 -21
- package/android/src/main/java/com/reactnativehypertracksdk/common/Serialization.kt +156 -112
- package/android/src/main/java/com/reactnativehypertracksdk/common/WrapperResult.kt +3 -4
- package/hypertrack-sdk-react-native.podspec +1 -1
- package/ios/common/GeotagData.swift +10 -1
- package/ios/common/HyperTrackSDKWrapper.swift +33 -4
- package/ios/common/Serialization.swift +71 -2
- package/lib/commonjs/HyperTrack/HyperTrack.js +67 -6
- package/lib/commonjs/HyperTrack/HyperTrack.js.map +1 -1
- package/lib/commonjs/HyperTrack/data_types/OrderStatus.js +2 -0
- package/lib/commonjs/HyperTrack/data_types/OrderStatus.js.map +1 -0
- package/lib/commonjs/HyperTrack/data_types/internal/GeotagData.js.map +1 -1
- package/lib/commonjs/HyperTrack/data_types/internal/OrderHandle.js +2 -0
- package/lib/commonjs/HyperTrack/data_types/internal/OrderHandle.js.map +1 -0
- package/lib/commonjs/index.js +7 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/HyperTrack/HyperTrack.js +67 -6
- package/lib/module/HyperTrack/HyperTrack.js.map +1 -1
- package/lib/module/HyperTrack/data_types/OrderStatus.js +2 -0
- package/lib/module/HyperTrack/data_types/OrderStatus.js.map +1 -0
- package/lib/module/HyperTrack/data_types/internal/GeotagData.js.map +1 -1
- package/lib/module/HyperTrack/data_types/internal/OrderHandle.js +2 -0
- package/lib/module/HyperTrack/data_types/internal/OrderHandle.js.map +1 -0
- package/lib/module/index.js +1 -0
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/HyperTrack/HyperTrack.d.ts +24 -0
- package/lib/typescript/HyperTrack/data_types/OrderStatus.d.ts +8 -0
- package/lib/typescript/HyperTrack/data_types/internal/GeotagData.d.ts +4 -0
- package/lib/typescript/HyperTrack/data_types/internal/OrderHandle.d.ts +4 -0
- package/lib/typescript/index.d.ts +1 -0
- package/package.json +1 -1
- package/src/HyperTrack/HyperTrack.ts +102 -6
- package/src/HyperTrack/data_types/OrderStatus.ts +11 -0
- package/src/HyperTrack/data_types/internal/GeotagData.ts +4 -0
- package/src/HyperTrack/data_types/internal/OrderHandle.ts +4 -0
- package/src/index.tsx +1 -0
|
File without changes
|
|
Binary file
|
|
Binary file
|
|
File without changes
|
|
Binary file
|
|
Binary file
|
|
File without changes
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<project version="4">
|
|
3
|
+
<component name="GradleMigrationSettings" migrationVersion="1" />
|
|
4
|
+
<component name="GradleSettings">
|
|
5
|
+
<option name="linkedExternalProjectsSettings">
|
|
6
|
+
<GradleProjectSettings>
|
|
7
|
+
<option name="testRunner" value="GRADLE" />
|
|
8
|
+
<option name="distributionType" value="DEFAULT_WRAPPED" />
|
|
9
|
+
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
|
10
|
+
<option name="gradleHome" value="/usr/local/Cellar/gradle/8.2/libexec" />
|
|
11
|
+
<option name="gradleJvm" value="jbr-17" />
|
|
12
|
+
</GradleProjectSettings>
|
|
13
|
+
</option>
|
|
14
|
+
</component>
|
|
15
|
+
</project>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<project version="4">
|
|
2
|
+
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
|
3
|
+
<component name="ProjectRootManager" version="2" project-jdk-name="jbr-17" project-jdk-type="JavaSDK">
|
|
4
|
+
<output url="file://$PROJECT_DIR$/build/classes" />
|
|
5
|
+
</component>
|
|
6
|
+
<component name="ProjectType">
|
|
7
|
+
<option name="id" value="Android" />
|
|
8
|
+
</component>
|
|
9
|
+
</project>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
## This file must *NOT* be checked into Version Control Systems,
|
|
2
|
+
# as it contains information specific to your local configuration.
|
|
3
|
+
#
|
|
4
|
+
# Location of the SDK. This is only used by Gradle.
|
|
5
|
+
# For customization when using a Version Control System, please read the
|
|
6
|
+
# header note.
|
|
7
|
+
#Mon Apr 08 21:32:54 EEST 2024
|
|
8
|
+
sdk.dir=/opt/homebrew/share/android-commandlinetools
|
|
@@ -10,13 +10,11 @@ import com.reactnativehypertracksdk.common.Serialization.serializeErrors
|
|
|
10
10
|
import com.reactnativehypertracksdk.common.Serialization.serializeIsAvailable
|
|
11
11
|
import com.reactnativehypertracksdk.common.Serialization.serializeIsTracking
|
|
12
12
|
import com.reactnativehypertracksdk.common.Serialization.serializeLocateResult
|
|
13
|
-
import com.reactnativehypertracksdk.common.Serialization.serializeLocation
|
|
14
13
|
import com.reactnativehypertracksdk.common.Serialization.serializeLocationResult
|
|
15
14
|
|
|
16
15
|
@ReactModule(name = HyperTrackReactNativePlugin.NAME)
|
|
17
16
|
class HyperTrackReactNativePlugin(reactContext: ReactApplicationContext?) :
|
|
18
17
|
ReactContextBaseJavaModule(reactContext) {
|
|
19
|
-
|
|
20
18
|
private var locateSubscription: HyperTrack.Cancellable? = null
|
|
21
19
|
private var subscriptions: List<HyperTrack.Cancellable>? = null
|
|
22
20
|
|
|
@@ -66,7 +64,10 @@ class HyperTrackReactNativePlugin(reactContext: ReactApplicationContext?) :
|
|
|
66
64
|
*/
|
|
67
65
|
|
|
68
66
|
@ReactMethod
|
|
69
|
-
fun addGeotag(
|
|
67
|
+
fun addGeotag(
|
|
68
|
+
args: ReadableMap,
|
|
69
|
+
promise: Promise,
|
|
70
|
+
) {
|
|
70
71
|
HyperTrackSdkWrapper.addGeotag(args.toHashMap()).toPromise(promise)
|
|
71
72
|
}
|
|
72
73
|
|
|
@@ -113,9 +114,10 @@ class HyperTrackReactNativePlugin(reactContext: ReactApplicationContext?) :
|
|
|
113
114
|
@ReactMethod
|
|
114
115
|
fun locate(promise: Promise) {
|
|
115
116
|
locateSubscription?.cancel()
|
|
116
|
-
locateSubscription =
|
|
117
|
-
|
|
118
|
-
|
|
117
|
+
locateSubscription =
|
|
118
|
+
HyperTrack.locate {
|
|
119
|
+
emitEvent(EVENT_LOCATE, serializeLocateResult(it).toWritableMap())
|
|
120
|
+
}
|
|
119
121
|
Success(Unit).toPromise(promise)
|
|
120
122
|
}
|
|
121
123
|
|
|
@@ -172,14 +174,20 @@ class HyperTrackReactNativePlugin(reactContext: ReactApplicationContext?) :
|
|
|
172
174
|
}
|
|
173
175
|
}
|
|
174
176
|
|
|
175
|
-
private fun emitEvent(
|
|
177
|
+
private fun emitEvent(
|
|
178
|
+
event: String,
|
|
179
|
+
data: WritableMap,
|
|
180
|
+
) {
|
|
176
181
|
reactApplicationContext
|
|
177
182
|
.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter::class.java)
|
|
178
183
|
.emit(event, data)
|
|
179
184
|
}
|
|
180
185
|
|
|
181
186
|
@Suppress("SameParameterValue")
|
|
182
|
-
private fun emitEvent(
|
|
187
|
+
private fun emitEvent(
|
|
188
|
+
event: String,
|
|
189
|
+
data: WritableArray,
|
|
190
|
+
) {
|
|
183
191
|
reactApplicationContext
|
|
184
192
|
.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter::class.java)
|
|
185
193
|
.emit(event, data)
|
|
@@ -5,8 +5,8 @@ import com.facebook.react.bridge.Promise
|
|
|
5
5
|
import com.facebook.react.bridge.WritableArray
|
|
6
6
|
import com.facebook.react.bridge.WritableMap
|
|
7
7
|
import com.reactnativehypertracksdk.common.Failure
|
|
8
|
-
import com.reactnativehypertracksdk.common.WrapperResult
|
|
9
8
|
import com.reactnativehypertracksdk.common.Success
|
|
9
|
+
import com.reactnativehypertracksdk.common.WrapperResult
|
|
10
10
|
|
|
11
11
|
@Suppress("UNCHECKED_CAST")
|
|
12
12
|
internal fun <T> WrapperResult<T>.toPromise(promise: Promise) {
|
|
@@ -98,7 +98,7 @@ internal fun Map<String, Any?>.toWritableMap(): WritableMap {
|
|
|
98
98
|
is Double -> {
|
|
99
99
|
putDouble(key, value)
|
|
100
100
|
}
|
|
101
|
-
|
|
101
|
+
|
|
102
102
|
is Float -> {
|
|
103
103
|
putDouble(key, value.toDouble())
|
|
104
104
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
package com.reactnativehypertracksdk.common
|
|
2
2
|
|
|
3
3
|
import android.location.Location
|
|
4
|
+
import com.hypertrack.sdk.android.HyperTrack
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* The data that represents geotag to create
|
|
@@ -9,5 +10,7 @@ import android.location.Location
|
|
|
9
10
|
*/
|
|
10
11
|
internal data class GeotagData(
|
|
11
12
|
val data: Map<String, Any?>,
|
|
12
|
-
val expectedLocation: Location
|
|
13
|
+
val expectedLocation: Location?,
|
|
14
|
+
val orderHandle: String?,
|
|
15
|
+
val orderStatus: HyperTrack.OrderStatus?,
|
|
13
16
|
)
|
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
package com.reactnativehypertracksdk.common
|
|
2
2
|
|
|
3
|
-
import com.hypertrack.sdk.*
|
|
4
3
|
import com.hypertrack.sdk.android.HyperTrack
|
|
5
|
-
import com.hypertrack.sdk.android.HyperTrack.metadata
|
|
6
4
|
import com.hypertrack.sdk.android.Json
|
|
7
5
|
import com.hypertrack.sdk.android.Result
|
|
8
6
|
import com.reactnativehypertracksdk.common.Serialization.deserializeDynamicPublishableKey
|
|
9
|
-
import com.reactnativehypertracksdk.common.Serialization.deserializeIsAvailable
|
|
10
|
-
import com.reactnativehypertracksdk.common.Serialization.deserializeName
|
|
11
7
|
import com.reactnativehypertracksdk.common.Serialization.deserializeGeotagData
|
|
8
|
+
import com.reactnativehypertracksdk.common.Serialization.deserializeIsAvailable
|
|
12
9
|
import com.reactnativehypertracksdk.common.Serialization.deserializeIsTracking
|
|
13
10
|
import com.reactnativehypertracksdk.common.Serialization.deserializeMetadata
|
|
11
|
+
import com.reactnativehypertracksdk.common.Serialization.deserializeName
|
|
14
12
|
import com.reactnativehypertracksdk.common.Serialization.serializeDeviceId
|
|
15
13
|
import com.reactnativehypertracksdk.common.Serialization.serializeDynamicPublishableKey
|
|
16
14
|
import com.reactnativehypertracksdk.common.Serialization.serializeErrors
|
|
@@ -30,23 +28,36 @@ typealias Serialized = Map<String, Any?>
|
|
|
30
28
|
* It receives serialized params.
|
|
31
29
|
*/
|
|
32
30
|
internal object HyperTrackSdkWrapper {
|
|
33
|
-
|
|
34
31
|
fun addGeotag(args: Serialized): WrapperResult<Serialized> {
|
|
35
32
|
return deserializeGeotagData(args)
|
|
36
33
|
.flatMapSuccess { geotag ->
|
|
37
34
|
// TODO: return proper error if JSON is wrong
|
|
38
35
|
val geotagMetadata = Json.fromMap(geotag.data)!!
|
|
39
|
-
val expectedLocation =
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
36
|
+
val expectedLocation =
|
|
37
|
+
geotag
|
|
38
|
+
.expectedLocation
|
|
39
|
+
?.let {
|
|
40
|
+
HyperTrack.Location(
|
|
41
|
+
latitude = it.latitude,
|
|
42
|
+
longitude = it.longitude,
|
|
43
|
+
)
|
|
44
|
+
}
|
|
45
|
+
val orderHandle = geotag.orderHandle
|
|
46
|
+
val orderStatus = geotag.orderStatus
|
|
47
|
+
if (expectedLocation != null) {
|
|
48
|
+
if (orderHandle != null || orderStatus != null) {
|
|
49
|
+
if (orderHandle == null || orderStatus == null) {
|
|
50
|
+
throw Error("orderHandle and orderStatus must be provided")
|
|
51
|
+
}
|
|
52
|
+
HyperTrack.addGeotag(
|
|
53
|
+
orderHandle = orderHandle,
|
|
54
|
+
orderStatus = orderStatus,
|
|
55
|
+
expectedLocation = expectedLocation,
|
|
56
|
+
metadata = geotagMetadata,
|
|
45
57
|
)
|
|
58
|
+
} else {
|
|
59
|
+
HyperTrack.addGeotag(geotagMetadata, expectedLocation)
|
|
46
60
|
}
|
|
47
|
-
if (expectedLocation != null) {
|
|
48
|
-
HyperTrack
|
|
49
|
-
.addGeotag(geotagMetadata, expectedLocation)
|
|
50
61
|
.let {
|
|
51
62
|
when (it) {
|
|
52
63
|
is Result.Failure -> {
|
|
@@ -59,8 +70,18 @@ internal object HyperTrackSdkWrapper {
|
|
|
59
70
|
}
|
|
60
71
|
}
|
|
61
72
|
} else {
|
|
62
|
-
|
|
63
|
-
|
|
73
|
+
if (orderHandle != null || orderStatus != null) {
|
|
74
|
+
if (orderHandle == null || orderStatus == null) {
|
|
75
|
+
throw Error("orderHandle and orderStatus must be provided")
|
|
76
|
+
}
|
|
77
|
+
HyperTrack.addGeotag(
|
|
78
|
+
orderHandle = orderHandle,
|
|
79
|
+
orderStatus = orderStatus,
|
|
80
|
+
metadata = geotagMetadata,
|
|
81
|
+
)
|
|
82
|
+
} else {
|
|
83
|
+
HyperTrack.addGeotag(geotagMetadata)
|
|
84
|
+
}
|
|
64
85
|
.let { serializeLocationResult(it) }
|
|
65
86
|
}.let {
|
|
66
87
|
Success(it)
|
|
@@ -82,13 +103,13 @@ internal object HyperTrackSdkWrapper {
|
|
|
82
103
|
|
|
83
104
|
fun getIsAvailable(): WrapperResult<Serialized> {
|
|
84
105
|
return Success(
|
|
85
|
-
serializeIsAvailable(HyperTrack.isAvailable)
|
|
106
|
+
serializeIsAvailable(HyperTrack.isAvailable),
|
|
86
107
|
)
|
|
87
108
|
}
|
|
88
109
|
|
|
89
110
|
fun getIsTracking(): WrapperResult<Serialized> {
|
|
90
111
|
return Success(
|
|
91
|
-
serializeIsTracking(HyperTrack.isTracking)
|
|
112
|
+
serializeIsTracking(HyperTrack.isTracking),
|
|
92
113
|
)
|
|
93
114
|
}
|
|
94
115
|
|
|
@@ -106,13 +127,13 @@ internal object HyperTrackSdkWrapper {
|
|
|
106
127
|
|
|
107
128
|
fun getMetadata(): WrapperResult<Serialized> {
|
|
108
129
|
return Success(
|
|
109
|
-
serializeMetadata(HyperTrack.metadata.toMap())
|
|
130
|
+
serializeMetadata(HyperTrack.metadata.toMap()),
|
|
110
131
|
)
|
|
111
132
|
}
|
|
112
133
|
|
|
113
134
|
fun getName(): WrapperResult<Serialized> {
|
|
114
135
|
return Success(
|
|
115
|
-
serializeName(HyperTrack.name)
|
|
136
|
+
serializeName(HyperTrack.name),
|
|
116
137
|
)
|
|
117
138
|
}
|
|
118
139
|
|
|
@@ -153,5 +174,4 @@ internal object HyperTrackSdkWrapper {
|
|
|
153
174
|
HyperTrack.name = name
|
|
154
175
|
}
|
|
155
176
|
}
|
|
156
|
-
|
|
157
177
|
}
|