hypertrack-sdk-react-native 9.1.1 → 9.2.0
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/CHANGELOG.md +148 -3
- package/README.md +3 -3
- 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/executionHistory/executionHistory.lock +0 -0
- package/android/.gradle/7.2/fileChanges/last-build.bin +0 -0
- package/android/.gradle/7.2/fileHashes/fileHashes.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/buildOutputCleanup/outputFiles.bin +0 -0
- package/android/.gradle/checksums/checksums.lock +0 -0
- package/android/.gradle/checksums/md5-checksums.bin +0 -0
- package/android/.gradle/checksums/sha1-checksums.bin +0 -0
- package/android/.gradle/vcs-1/gc.properties +0 -0
- package/android/.idea/compiler.xml +6 -0
- package/android/.idea/gradle.xml +19 -0
- package/android/.idea/jarRepositories.xml +35 -0
- package/android/.idea/kotlinc.xml +6 -0
- package/android/.idea/misc.xml +9 -0
- package/android/.idea/vcs.xml +6 -0
- package/android/local.properties +8 -0
- package/android/src/main/java/com/reactnativehypertracksdk/HyperTrackReactNativePlugin.kt +4 -4
- package/android/src/main/java/com/reactnativehypertracksdk/ReactNativeSerialization.kt +16 -17
- package/android/src/main/java/com/reactnativehypertracksdk/common/GeotagData.kt +13 -0
- package/android/src/main/java/com/reactnativehypertracksdk/common/HyperTrackSdkWrapper.kt +45 -19
- package/android/src/main/java/com/reactnativehypertracksdk/common/Serialization.kt +115 -40
- package/hypertrack-sdk-react-native.podspec +1 -1
- package/ios/common/GeotagData.swift +11 -0
- package/ios/common/HyperTrackSDKWrapper.swift +9 -4
- package/ios/common/Serialization.swift +140 -61
- package/lib/commonjs/HyperTrack/HyperTrack.js +90 -22
- package/lib/commonjs/HyperTrack/HyperTrack.js.map +1 -1
- package/lib/commonjs/HyperTrack/data_types/HyperTrackError.js +4 -4
- package/lib/commonjs/HyperTrack/data_types/HyperTrackError.js.map +1 -1
- package/lib/commonjs/HyperTrack/data_types/Location.js.map +1 -1
- package/lib/commonjs/HyperTrack/data_types/LocationWithDeviation.js +6 -0
- package/lib/commonjs/HyperTrack/data_types/LocationWithDeviation.js.map +1 -0
- package/lib/commonjs/HyperTrack/data_types/Result.js +2 -0
- package/lib/commonjs/HyperTrack/data_types/Result.js.map +1 -0
- package/lib/commonjs/HyperTrack/data_types/internal/{LocationResponse.js → GeotagData.js} +1 -1
- package/lib/commonjs/HyperTrack/data_types/internal/GeotagData.js.map +1 -0
- package/lib/commonjs/HyperTrack/data_types/internal/LocationInternal.js +2 -0
- package/lib/commonjs/HyperTrack/data_types/internal/LocationInternal.js.map +1 -0
- package/lib/commonjs/HyperTrack/data_types/internal/LocationWithDeviationInternal.js +6 -0
- package/lib/commonjs/HyperTrack/data_types/internal/LocationWithDeviationInternal.js.map +1 -0
- package/lib/commonjs/index.js +19 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/HyperTrack/HyperTrack.js +90 -22
- package/lib/module/HyperTrack/HyperTrack.js.map +1 -1
- package/lib/module/HyperTrack/data_types/HyperTrackError.js +3 -3
- package/lib/module/HyperTrack/data_types/HyperTrackError.js.map +1 -1
- package/lib/module/HyperTrack/data_types/Location.js.map +1 -1
- package/lib/module/HyperTrack/data_types/LocationWithDeviation.js +2 -0
- package/lib/module/HyperTrack/data_types/LocationWithDeviation.js.map +1 -0
- package/lib/module/HyperTrack/data_types/Result.js +2 -0
- package/lib/module/HyperTrack/data_types/Result.js.map +1 -0
- package/lib/module/HyperTrack/data_types/internal/GeotagData.js +2 -0
- package/lib/module/HyperTrack/data_types/internal/GeotagData.js.map +1 -0
- package/lib/module/HyperTrack/data_types/internal/LocationInternal.js +2 -0
- package/lib/module/HyperTrack/data_types/internal/LocationInternal.js.map +1 -0
- package/lib/module/HyperTrack/data_types/internal/LocationWithDeviationInternal.js +2 -0
- package/lib/module/HyperTrack/data_types/internal/LocationWithDeviationInternal.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 +17 -1
- package/lib/typescript/HyperTrack/data_types/Location.d.ts +2 -5
- package/lib/typescript/HyperTrack/data_types/LocationWithDeviation.d.ts +5 -0
- package/lib/typescript/HyperTrack/data_types/Result.d.ts +9 -0
- package/lib/typescript/HyperTrack/data_types/internal/GeotagData.d.ts +5 -0
- package/lib/typescript/HyperTrack/data_types/internal/LocationInternal.d.ts +7 -0
- package/lib/typescript/HyperTrack/data_types/internal/LocationWithDeviationInternal.d.ts +8 -0
- package/lib/typescript/index.d.ts +2 -1
- package/package.json +1 -1
- package/src/HyperTrack/HyperTrack.ts +160 -46
- package/src/HyperTrack/data_types/Location.ts +2 -5
- package/src/HyperTrack/data_types/LocationWithDeviation.ts +6 -0
- package/src/HyperTrack/data_types/Result.ts +11 -0
- package/src/HyperTrack/data_types/internal/GeotagData.ts +6 -0
- package/src/HyperTrack/data_types/internal/LocationInternal.ts +7 -0
- package/src/HyperTrack/data_types/internal/LocationWithDeviationInternal.ts +9 -0
- package/src/index.tsx +6 -2
- package/android/src/main/java/com/reactnativehypertracksdk/common/Geotag.kt +0 -9
- package/lib/commonjs/HyperTrack/data_types/internal/Geotag.js +0 -2
- package/lib/commonjs/HyperTrack/data_types/internal/Geotag.js.map +0 -1
- package/lib/commonjs/HyperTrack/data_types/internal/LocationResponse.js.map +0 -1
- package/lib/module/HyperTrack/data_types/internal/Geotag.js +0 -2
- package/lib/module/HyperTrack/data_types/internal/Geotag.js.map +0 -1
- package/lib/module/HyperTrack/data_types/internal/LocationResponse.js +0 -2
- package/lib/module/HyperTrack/data_types/internal/LocationResponse.js.map +0 -1
- package/lib/typescript/HyperTrack/data_types/internal/Geotag.d.ts +0 -3
- package/lib/typescript/HyperTrack/data_types/internal/LocationResponse.d.ts +0 -11
- package/src/HyperTrack/data_types/internal/Geotag.ts +0 -3
- package/src/HyperTrack/data_types/internal/LocationResponse.ts +0 -14
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
package com.reactnativehypertracksdk.common
|
|
2
|
+
|
|
3
|
+
import android.location.Location
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* The data that represents geotag to create
|
|
7
|
+
*
|
|
8
|
+
* @param data Geotag payload
|
|
9
|
+
*/
|
|
10
|
+
internal data class GeotagData(
|
|
11
|
+
val data: Map<String, Any?>,
|
|
12
|
+
val expectedLocation: Location?
|
|
13
|
+
)
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
package com.reactnativehypertracksdk.common
|
|
2
2
|
|
|
3
3
|
import com.hypertrack.sdk.*
|
|
4
|
+
import com.hypertrack.sdk.GeotagResult
|
|
4
5
|
import com.reactnativehypertracksdk.common.Serialization.deserializeAvailability
|
|
5
6
|
import com.reactnativehypertracksdk.common.Serialization.deserializeDeviceName
|
|
6
7
|
import com.reactnativehypertracksdk.common.Serialization.deserializeGeotagData
|
|
7
8
|
import com.reactnativehypertracksdk.common.Serialization.serializeDeviceId
|
|
8
9
|
import com.reactnativehypertracksdk.common.Serialization.serializeErrors
|
|
9
|
-
import com.reactnativehypertracksdk.common.Serialization.serializeFailure
|
|
10
10
|
import com.reactnativehypertracksdk.common.Serialization.serializeIsAvailable
|
|
11
11
|
import com.reactnativehypertracksdk.common.Serialization.serializeIsTracking
|
|
12
|
-
import com.reactnativehypertracksdk.common.Serialization.
|
|
12
|
+
import com.reactnativehypertracksdk.common.Serialization.serializeLocationErrorFailure
|
|
13
|
+
import com.reactnativehypertracksdk.common.Serialization.serializeLocationSuccess
|
|
14
|
+
import com.reactnativehypertracksdk.common.Serialization.serializeLocationWithDeviationSuccess
|
|
13
15
|
import java.lang.IllegalStateException
|
|
14
16
|
import java.lang.RuntimeException
|
|
15
17
|
|
|
@@ -30,8 +32,7 @@ internal object HyperTrackSdkWrapper {
|
|
|
30
32
|
args: Map<String, Any?>
|
|
31
33
|
): Result<HyperTrack> {
|
|
32
34
|
return try {
|
|
33
|
-
SdkInitParams
|
|
34
|
-
.fromMap(args)
|
|
35
|
+
SdkInitParams.fromMap(args)
|
|
35
36
|
.flatMapSuccess { initParams ->
|
|
36
37
|
_sdkInstance = HyperTrack.getInstance(initParams.publishableKey)
|
|
37
38
|
if (initParams.loggingEnabled) {
|
|
@@ -40,7 +41,7 @@ internal object HyperTrackSdkWrapper {
|
|
|
40
41
|
if (initParams.allowMockLocations) {
|
|
41
42
|
sdkInstance.allowMockLocations()
|
|
42
43
|
}
|
|
43
|
-
|
|
44
|
+
sdkInstance.backgroundTrackingRequirement(
|
|
44
45
|
initParams.requireBackgroundTrackingPermission
|
|
45
46
|
)
|
|
46
47
|
Success(sdkInstance)
|
|
@@ -73,20 +74,45 @@ internal object HyperTrackSdkWrapper {
|
|
|
73
74
|
return deserializeGeotagData(args)
|
|
74
75
|
.flatMapSuccess { geotag ->
|
|
75
76
|
sdkInstance
|
|
76
|
-
.addGeotag(geotag.data)
|
|
77
|
+
.addGeotag(geotag.data, geotag.expectedLocation)
|
|
77
78
|
.let { result ->
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
79
|
+
if(geotag.expectedLocation == null) {
|
|
80
|
+
when (result) {
|
|
81
|
+
is GeotagResult.SuccessWithDeviation -> {
|
|
82
|
+
// not supposed to happen
|
|
83
|
+
serializeLocationSuccess(result.deviceLocation)
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
is GeotagResult.Success -> {
|
|
87
|
+
serializeLocationSuccess(result.deviceLocation)
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
is GeotagResult.Error -> {
|
|
91
|
+
serializeLocationErrorFailure(getLocationError(result.reason))
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
else -> {
|
|
95
|
+
throw IllegalArgumentException()
|
|
96
|
+
}
|
|
87
97
|
}
|
|
88
|
-
|
|
89
|
-
|
|
98
|
+
} else {
|
|
99
|
+
when (result) {
|
|
100
|
+
is GeotagResult.SuccessWithDeviation -> {
|
|
101
|
+
serializeLocationWithDeviationSuccess(result.deviceLocation, result.deviationDistance.toDouble())
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
is GeotagResult.Success -> {
|
|
105
|
+
// not supposed to happen
|
|
106
|
+
serializeLocationWithDeviationSuccess(result.deviceLocation, 0.0)
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
is GeotagResult.Error -> {
|
|
110
|
+
serializeLocationErrorFailure(getLocationError(result.reason))
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
else -> {
|
|
114
|
+
throw IllegalArgumentException()
|
|
115
|
+
}
|
|
90
116
|
}
|
|
91
117
|
}
|
|
92
118
|
}
|
|
@@ -135,9 +161,9 @@ internal object HyperTrackSdkWrapper {
|
|
|
135
161
|
return sdkInstance.latestLocation
|
|
136
162
|
.let { result ->
|
|
137
163
|
if (result.isSuccess) {
|
|
138
|
-
|
|
164
|
+
serializeLocationSuccess(result.value)
|
|
139
165
|
} else {
|
|
140
|
-
|
|
166
|
+
serializeLocationErrorFailure(getLocationError(result.error))
|
|
141
167
|
}
|
|
142
168
|
}
|
|
143
169
|
.let { Success(it) }
|
|
@@ -14,18 +14,22 @@ internal object Serialization {
|
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
fun
|
|
18
|
-
return
|
|
19
|
-
KEY_TYPE to TYPE_RESULT_SUCCESS,
|
|
20
|
-
KEY_VALUE to serializeLocation(location)
|
|
21
|
-
)
|
|
17
|
+
fun serializeLocationSuccess(location: Location): Map<String, Any?> {
|
|
18
|
+
return serializeSuccess(serializeLocation(location))
|
|
22
19
|
}
|
|
23
20
|
|
|
24
|
-
fun
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
21
|
+
fun serializeLocationWithDeviationSuccess(
|
|
22
|
+
location: Location,
|
|
23
|
+
deviation: Double
|
|
24
|
+
): Map<String, Any?> {
|
|
25
|
+
return serializeSuccess(serializeLocationWithDeviation(
|
|
26
|
+
location,
|
|
27
|
+
deviation
|
|
28
|
+
))
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
fun serializeLocationErrorFailure(locationError: LocationError): Map<String, Any?> {
|
|
32
|
+
return serializeFailure(serializeLocationError(locationError))
|
|
29
33
|
}
|
|
30
34
|
|
|
31
35
|
fun serializeIsTracking(isTracking: Boolean): Map<String, Any?> {
|
|
@@ -42,34 +46,6 @@ internal object Serialization {
|
|
|
42
46
|
)
|
|
43
47
|
}
|
|
44
48
|
|
|
45
|
-
fun serializeLocation(location: Location): Map<String, Any?> {
|
|
46
|
-
return mapOf(
|
|
47
|
-
KEY_TYPE to TYPE_LOCATION,
|
|
48
|
-
KEY_VALUE to mapOf(
|
|
49
|
-
KEY_LATITUDE to location.latitude,
|
|
50
|
-
KEY_LONGITUDE to location.longitude
|
|
51
|
-
)
|
|
52
|
-
)
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
fun serializeLocationError(locationError: LocationError): Map<String, Any?> {
|
|
56
|
-
return when (locationError) {
|
|
57
|
-
NotRunning -> {
|
|
58
|
-
mapOf(KEY_TYPE to TYPE_LOCATION_ERROR_NOT_RUNNING)
|
|
59
|
-
}
|
|
60
|
-
Starting -> {
|
|
61
|
-
mapOf(KEY_TYPE to TYPE_LOCATION_ERROR_STARTING)
|
|
62
|
-
}
|
|
63
|
-
is Errors -> {
|
|
64
|
-
mapOf(
|
|
65
|
-
KEY_TYPE to TYPE_LOCATION_ERROR_ERRORS,
|
|
66
|
-
KEY_VALUE to locationError.errors
|
|
67
|
-
.map { serializeHypertrackError(it) }
|
|
68
|
-
)
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
|
|
73
49
|
fun serializeHypertrackError(error: HyperTrackError): Map<String, String> {
|
|
74
50
|
return mapOf(
|
|
75
51
|
KEY_TYPE to TYPE_HYPERTRACK_ERROR,
|
|
@@ -102,12 +78,16 @@ internal object Serialization {
|
|
|
102
78
|
}
|
|
103
79
|
}
|
|
104
80
|
|
|
105
|
-
fun deserializeGeotagData(map: Map<String, Any?>): Result<
|
|
81
|
+
fun deserializeGeotagData(map: Map<String, Any?>): Result<GeotagData> {
|
|
106
82
|
return parse(map) {
|
|
107
83
|
val data = it
|
|
108
84
|
.get<Map<String, Any?>>(KEY_GEOTAG_DATA)
|
|
109
85
|
.getOrThrow()
|
|
110
|
-
|
|
86
|
+
val locationData = it
|
|
87
|
+
.getOptional<Map<String, Any?>>(KEY_GEOTAG_EXPECTED_LOCATION)
|
|
88
|
+
.getOrThrow()
|
|
89
|
+
val location = locationData?.let { deserializeLocation(it).getOrThrow() }
|
|
90
|
+
GeotagData(data, location)
|
|
111
91
|
}
|
|
112
92
|
}
|
|
113
93
|
|
|
@@ -154,6 +134,21 @@ internal object Serialization {
|
|
|
154
134
|
}
|
|
155
135
|
}
|
|
156
136
|
|
|
137
|
+
inline fun <reified T> getOptional(
|
|
138
|
+
key: String
|
|
139
|
+
): Result<T?> {
|
|
140
|
+
return try {
|
|
141
|
+
Success(source[key] as T?)
|
|
142
|
+
} catch (e: Exception) {
|
|
143
|
+
Failure(
|
|
144
|
+
ParsingException(key, e)
|
|
145
|
+
.also {
|
|
146
|
+
_exceptions.add(it)
|
|
147
|
+
}
|
|
148
|
+
)
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
157
152
|
inline fun <reified T> assertValue(
|
|
158
153
|
key: String,
|
|
159
154
|
value: Any
|
|
@@ -179,6 +174,82 @@ internal object Serialization {
|
|
|
179
174
|
exception: Exception
|
|
180
175
|
) : Exception("Invalid value for '$key': $exception", exception)
|
|
181
176
|
|
|
177
|
+
private fun deserializeLocation(map: Map<String, Any?>): Result<Location> {
|
|
178
|
+
return parse(map) {
|
|
179
|
+
it.assertValue<String>(key = KEY_TYPE, value = TYPE_LOCATION)
|
|
180
|
+
val value = it
|
|
181
|
+
.get<Map<String, Any?>>(KEY_VALUE)
|
|
182
|
+
.getOrThrow()
|
|
183
|
+
parse(value) { parser ->
|
|
184
|
+
val latitude = parser
|
|
185
|
+
.get<Double>(KEY_LATITUDE)
|
|
186
|
+
.getOrThrow()
|
|
187
|
+
val longitude = parser
|
|
188
|
+
.get<Double>(KEY_LONGITUDE)
|
|
189
|
+
.getOrThrow()
|
|
190
|
+
Location("api").also {
|
|
191
|
+
it.latitude = latitude
|
|
192
|
+
it.longitude = longitude
|
|
193
|
+
}
|
|
194
|
+
}.getOrThrow()
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
private fun serializeLocationWithDeviation(
|
|
199
|
+
location: Location,
|
|
200
|
+
deviation: Double
|
|
201
|
+
): Map<String, Any?> {
|
|
202
|
+
return mapOf(
|
|
203
|
+
KEY_TYPE to TYPE_LOCATION,
|
|
204
|
+
KEY_VALUE to mapOf(
|
|
205
|
+
KEY_LOCATION to serializeLocation(location),
|
|
206
|
+
KEY_DEVIATION to deviation
|
|
207
|
+
)
|
|
208
|
+
)
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
private fun serializeFailure(failure: Map<String, Any?>): Map<String, Any?> {
|
|
212
|
+
return mapOf(
|
|
213
|
+
KEY_TYPE to TYPE_RESULT_FAILURE,
|
|
214
|
+
KEY_VALUE to failure
|
|
215
|
+
)
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
private fun serializeSuccess(success: Map<String, Any?>): Map<String, Any?> {
|
|
219
|
+
return mapOf(
|
|
220
|
+
KEY_TYPE to TYPE_RESULT_SUCCESS,
|
|
221
|
+
KEY_VALUE to success
|
|
222
|
+
)
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
private fun serializeLocation(location: Location): Map<String, Any?> {
|
|
226
|
+
return mapOf(
|
|
227
|
+
KEY_TYPE to TYPE_LOCATION,
|
|
228
|
+
KEY_VALUE to mapOf(
|
|
229
|
+
KEY_LATITUDE to location.latitude,
|
|
230
|
+
KEY_LONGITUDE to location.longitude
|
|
231
|
+
)
|
|
232
|
+
)
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
private fun serializeLocationError(locationError: LocationError): Map<String, Any?> {
|
|
236
|
+
return when (locationError) {
|
|
237
|
+
NotRunning -> {
|
|
238
|
+
mapOf(KEY_TYPE to TYPE_LOCATION_ERROR_NOT_RUNNING)
|
|
239
|
+
}
|
|
240
|
+
Starting -> {
|
|
241
|
+
mapOf(KEY_TYPE to TYPE_LOCATION_ERROR_STARTING)
|
|
242
|
+
}
|
|
243
|
+
is Errors -> {
|
|
244
|
+
mapOf(
|
|
245
|
+
KEY_TYPE to TYPE_LOCATION_ERROR_ERRORS,
|
|
246
|
+
KEY_VALUE to locationError.errors
|
|
247
|
+
.map { serializeHypertrackError(it) }
|
|
248
|
+
)
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
|
|
182
253
|
private const val KEY_TYPE = "type"
|
|
183
254
|
private const val KEY_VALUE = "value"
|
|
184
255
|
|
|
@@ -186,6 +257,7 @@ internal object Serialization {
|
|
|
186
257
|
private const val TYPE_RESULT_FAILURE = "failure"
|
|
187
258
|
|
|
188
259
|
private const val TYPE_LOCATION = "location"
|
|
260
|
+
private const val TYPE_LOCATION_WITH_DEVIATION = "locationWithDeviation"
|
|
189
261
|
private const val TYPE_AVAILABILITY = "isAvailable"
|
|
190
262
|
private const val TYPE_DEVICE_NAME = "deviceName"
|
|
191
263
|
private const val TYPE_DEVICE_ID = "deviceID"
|
|
@@ -200,4 +272,7 @@ internal object Serialization {
|
|
|
200
272
|
private const val KEY_LONGITUDE = "longitude"
|
|
201
273
|
|
|
202
274
|
const val KEY_GEOTAG_DATA = "data"
|
|
275
|
+
const val KEY_GEOTAG_EXPECTED_LOCATION = "expectedLocation"
|
|
276
|
+
const val KEY_DEVIATION = "deviation"
|
|
277
|
+
const val KEY_LOCATION = "location"
|
|
203
278
|
}
|
|
@@ -18,7 +18,7 @@ Pod::Spec.new do |s|
|
|
|
18
18
|
s.source_files = "ios/**/*.{h,m,mm,swift}"
|
|
19
19
|
|
|
20
20
|
s.dependency "React-Core"
|
|
21
|
-
s.dependency 'HyperTrack/Objective-C', '4.
|
|
21
|
+
s.dependency 'HyperTrack/Objective-C', '4.15.0'
|
|
22
22
|
|
|
23
23
|
# Don't install the dependencies when we run `pod install` in the old architecture.
|
|
24
24
|
if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then
|
|
@@ -88,10 +88,15 @@ func isAvailable() -> Result<SuccessResult, FailureResult> {
|
|
|
88
88
|
}
|
|
89
89
|
|
|
90
90
|
func addGeotag(_ args: Dictionary<String, Any>) -> Result<SuccessResult, FailureResult> {
|
|
91
|
-
return deserializeGeotagData(args).flatMap {
|
|
92
|
-
let metadata: HyperTrack.JSON.Object = getJSON(data)
|
|
93
|
-
let
|
|
94
|
-
|
|
91
|
+
return deserializeGeotagData(args).flatMap { geotagData in
|
|
92
|
+
let metadata: HyperTrack.JSON.Object = getJSON(geotagData.data)
|
|
93
|
+
if let expectedLocation = geotagData.expectedLocation {
|
|
94
|
+
let result = sdkInstance.addGeotag(metadata, expectedLocation: expectedLocation)
|
|
95
|
+
return .success(.dict(serializeExpectedLocationResult(result)))
|
|
96
|
+
} else {
|
|
97
|
+
let result = sdkInstance.addGeotag(metadata)
|
|
98
|
+
return .success(.dict(serializeLocationResult(result)))
|
|
99
|
+
}
|
|
95
100
|
}
|
|
96
101
|
}
|
|
97
102
|
|