hypertrack-sdk-react-native 10.0.3 → 11.0.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 +48 -0
- package/CONTRIBUTING.md +1 -1
- package/README.md +2 -2
- package/android/build.gradle +5 -1
- package/android/gradle.properties +1 -1
- package/android/src/main/java/com/reactnativehypertracksdk/HyperTrackReactNativePlugin.kt +80 -115
- package/android/src/main/java/com/reactnativehypertracksdk/ReactNativeSerialization.kt +23 -3
- package/android/src/main/java/com/reactnativehypertracksdk/common/HyperTrackSdkWrapper.kt +87 -220
- package/android/src/main/java/com/reactnativehypertracksdk/common/SdkMethod.kt +11 -9
- package/android/src/main/java/com/reactnativehypertracksdk/common/Serialization.kt +216 -132
- package/android/src/main/java/com/reactnativehypertracksdk/common/{Result.kt → WrapperResult.kt} +9 -7
- package/hypertrack-sdk-react-native.podspec +1 -1
- package/ios/HyperTrackReactNativePlugin.m +13 -11
- package/ios/HyperTrackReactNativePlugin.swift +141 -114
- package/ios/common/DictionaryDecoder.swift +5 -5
- package/ios/common/HyperTrackSDKWrapper.swift +44 -80
- package/ios/common/SDKMethod.swift +13 -12
- package/ios/common/Serialization.swift +190 -245
- package/lib/commonjs/HyperTrack/HyperTrack.js +224 -124
- package/lib/commonjs/HyperTrack/HyperTrack.js.map +1 -1
- package/lib/commonjs/HyperTrack/data_types/HyperTrackError.js +13 -17
- package/lib/commonjs/HyperTrack/data_types/HyperTrackError.js.map +1 -1
- package/lib/commonjs/HyperTrack/data_types/internal/HyperTrackErrorInternal.js.map +1 -1
- package/lib/commonjs/HyperTrack/data_types/internal/Metadata.js +2 -0
- package/lib/commonjs/HyperTrack/data_types/internal/Metadata.js.map +1 -0
- package/lib/commonjs/HyperTrack/data_types/internal/Name.js +2 -0
- package/lib/commonjs/HyperTrack/data_types/internal/Name.js.map +1 -0
- package/lib/commonjs/index.js +0 -7
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/HyperTrack/HyperTrack.js +224 -124
- package/lib/module/HyperTrack/HyperTrack.js.map +1 -1
- package/lib/module/HyperTrack/data_types/HyperTrackError.js +13 -17
- package/lib/module/HyperTrack/data_types/HyperTrackError.js.map +1 -1
- package/lib/module/HyperTrack/data_types/internal/HyperTrackErrorInternal.js.map +1 -1
- package/lib/module/HyperTrack/data_types/internal/Metadata.js +2 -0
- package/lib/module/HyperTrack/data_types/internal/Metadata.js.map +1 -0
- package/lib/module/HyperTrack/data_types/internal/Name.js +2 -0
- package/lib/module/HyperTrack/data_types/internal/Name.js.map +1 -0
- package/lib/module/index.js +0 -1
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/HyperTrack/HyperTrack.d.ts +106 -54
- package/lib/typescript/HyperTrack/data_types/HyperTrackError.d.ts +59 -17
- package/lib/typescript/HyperTrack/data_types/internal/HyperTrackErrorInternal.d.ts +1 -1
- package/lib/typescript/HyperTrack/data_types/internal/Metadata.d.ts +4 -0
- package/lib/typescript/HyperTrack/data_types/internal/Name.d.ts +7 -0
- package/lib/typescript/index.d.ts +0 -1
- package/package.json +1 -1
- package/src/HyperTrack/HyperTrack.ts +281 -161
- package/src/HyperTrack/data_types/HyperTrackError.ts +73 -18
- package/src/HyperTrack/data_types/internal/HyperTrackErrorInternal.ts +3 -3
- package/src/HyperTrack/data_types/internal/Metadata.ts +4 -0
- package/src/HyperTrack/data_types/internal/Name.ts +7 -0
- package/src/index.tsx +0 -1
- package/android/src/main/java/com/reactnativehypertracksdk/common/HyperTrackError.kt +0 -28
- package/android/src/main/java/com/reactnativehypertracksdk/common/LocationError.kt +0 -9
- package/android/src/main/java/com/reactnativehypertracksdk/common/SdkInitParams.kt +0 -44
- package/ios/common/HyperTrackError.swift +0 -20
- package/ios/common/SDKInitParams.swift +0 -13
- package/lib/commonjs/HyperTrack/data_types/SdkInitParams.js +0 -2
- package/lib/commonjs/HyperTrack/data_types/SdkInitParams.js.map +0 -1
- package/lib/commonjs/HyperTrack/data_types/internal/DeviceName.js +0 -2
- package/lib/commonjs/HyperTrack/data_types/internal/DeviceName.js.map +0 -1
- package/lib/module/HyperTrack/data_types/SdkInitParams.js +0 -2
- package/lib/module/HyperTrack/data_types/SdkInitParams.js.map +0 -1
- package/lib/module/HyperTrack/data_types/internal/DeviceName.js +0 -2
- package/lib/module/HyperTrack/data_types/internal/DeviceName.js.map +0 -1
- package/lib/typescript/HyperTrack/data_types/SdkInitParams.d.ts +0 -25
- package/lib/typescript/HyperTrack/data_types/internal/DeviceName.d.ts +0 -4
- package/src/HyperTrack/data_types/SdkInitParams.ts +0 -28
- package/src/HyperTrack/data_types/internal/DeviceName.ts +0 -4
|
@@ -1,22 +1,77 @@
|
|
|
1
1
|
// enum naming convention is ignored to make datatype sync
|
|
2
2
|
// across platforms easier
|
|
3
3
|
export enum HyperTrackError {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
4
|
+
/**
|
|
5
|
+
* The SDK was remotely blocked from running.
|
|
6
|
+
*/
|
|
7
|
+
blockedFromRunning = 'blockedFromRunning',
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* The publishable key is invalid.
|
|
11
|
+
*/
|
|
12
|
+
invalidPublishableKey = 'invalidPublishableKey',
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* The user enabled mock location app while mocking locations is prohibited.
|
|
16
|
+
*/
|
|
17
|
+
locationMocked = 'location.mocked',
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* The user disabled location services systemwide.
|
|
21
|
+
*/
|
|
22
|
+
locationServicesDisabled = 'location.servicesDisabled',
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* [Android only] The device doesn't have location services.
|
|
26
|
+
*/
|
|
27
|
+
locationServicesUnavailable = 'location.servicesUnavailable',
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* GPS satellites are not in view.
|
|
31
|
+
*/
|
|
32
|
+
locationSignalLost = 'location.signalLost',
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* [Android only] The SDK wasn't able to start tracking because of the limitations imposed by the OS.
|
|
36
|
+
* The exempt from background execution conditions weren't met.
|
|
37
|
+
* {@link https://developer.android.com/guide/components/foreground-services#background-start-restriction-exemptions}
|
|
38
|
+
*/
|
|
39
|
+
noExemptionFromBackgroundStartRestrictions = 'noExemptionFromBackgroundStartRestrictions',
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* The user denied location permissions.
|
|
43
|
+
*/
|
|
44
|
+
permissionsLocationDenied = 'permissions.location.denied',
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Can’t start tracking in background with When In Use location permissions.
|
|
48
|
+
* SDK will automatically start tracking when app will return to foreground.
|
|
49
|
+
*/
|
|
50
|
+
permissionsLocationInsufficientForBackground = 'permissions.location.insufficientForBackground',
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* [iOS only] The user has not chosen whether the app can use location services.
|
|
54
|
+
*/
|
|
55
|
+
permissionsLocationNotDetermined = 'permissions.location.notDetermined',
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* [iOS only] The app is in Provisional Always authorization state, which stops sending locations when app is in background.
|
|
59
|
+
*/
|
|
60
|
+
permissionsLocationProvisional = 'permissions.location.provisional',
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* The user didn't grant precise location permissions or downgraded permissions to imprecise.
|
|
64
|
+
*/
|
|
65
|
+
permissionsLocationReducedAccuracy = 'permissions.location.reducedAccuracy',
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* [iOS only] The app is not authorized to use location services.
|
|
69
|
+
*/
|
|
70
|
+
permissionsLocationRestricted = 'permissions.location.restricted',
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* [Android only] The user denied notification permissions needed to display a persistent notification
|
|
74
|
+
* needed for foreground location tracking.
|
|
75
|
+
*/
|
|
76
|
+
permissionsNotificationsDenied = 'permissions.notifications.denied',
|
|
22
77
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export type HyperTrackErrorInternal = {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
}
|
|
2
|
+
type: 'error';
|
|
3
|
+
value: string;
|
|
4
|
+
};
|
package/src/index.tsx
CHANGED
|
@@ -10,5 +10,4 @@ export {
|
|
|
10
10
|
export { LocationError, Errors } from './HyperTrack/data_types/LocationError';
|
|
11
11
|
export { LocationWithDeviation } from './HyperTrack/data_types/LocationWithDeviation';
|
|
12
12
|
export { Location } from './HyperTrack/data_types/Location';
|
|
13
|
-
export { SdkInitParams } from './HyperTrack/data_types/SdkInitParams';
|
|
14
13
|
export { Result, Success, Failure } from './HyperTrack/data_types/Result';
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
package com.reactnativehypertracksdk.common
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Check HyperTrack SDK docs for HyperTrackError.
|
|
5
|
-
* Enum naming convention is ignored to make datatype sync across platforms easier.
|
|
6
|
-
* Using Swift naming convention.
|
|
7
|
-
*/
|
|
8
|
-
@Suppress("EnumEntryName")
|
|
9
|
-
internal enum class HyperTrackError {
|
|
10
|
-
gpsSignalLost,
|
|
11
|
-
locationMocked,
|
|
12
|
-
locationPermissionsDenied,
|
|
13
|
-
locationPermissionsInsufficientForBackground,
|
|
14
|
-
locationPermissionsNotDetermined,
|
|
15
|
-
locationPermissionsReducedAccuracy,
|
|
16
|
-
locationPermissionsProvisional,
|
|
17
|
-
locationPermissionsRestricted,
|
|
18
|
-
locationServicesDisabled,
|
|
19
|
-
locationServicesUnavailable,
|
|
20
|
-
motionActivityPermissionsNotDetermined,
|
|
21
|
-
motionActivityPermissionsDenied,
|
|
22
|
-
motionActivityServicesDisabled,
|
|
23
|
-
motionActivityServicesUnavailable,
|
|
24
|
-
motionActivityPermissionsRestricted,
|
|
25
|
-
networkConnectionUnavailable,
|
|
26
|
-
invalidPublishableKey,
|
|
27
|
-
blockedFromRunning
|
|
28
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
package com.reactnativehypertracksdk.common
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Check HyperTrack SDK docs for LocationError
|
|
5
|
-
*/
|
|
6
|
-
internal sealed class LocationError
|
|
7
|
-
internal object NotRunning : LocationError()
|
|
8
|
-
internal object Starting : LocationError()
|
|
9
|
-
internal data class Errors(val errors: Set<HyperTrackError>) : LocationError()
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
package com.reactnativehypertracksdk.common
|
|
2
|
-
|
|
3
|
-
import com.reactnativehypertracksdk.common.Serialization.parse
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* SDK config params
|
|
7
|
-
*/
|
|
8
|
-
internal data class SdkInitParams(
|
|
9
|
-
val publishableKey: String,
|
|
10
|
-
val requireBackgroundTrackingPermission: Boolean,
|
|
11
|
-
val loggingEnabled: Boolean,
|
|
12
|
-
val allowMockLocations: Boolean
|
|
13
|
-
) {
|
|
14
|
-
|
|
15
|
-
companion object {
|
|
16
|
-
fun fromMap(map: Map<String, Any?>): Result<SdkInitParams> {
|
|
17
|
-
return parse(map) {
|
|
18
|
-
SdkInitParams(
|
|
19
|
-
publishableKey = it
|
|
20
|
-
.get<String>(KEY_PUBLISHABLE_KEY)
|
|
21
|
-
.getOrThrow(),
|
|
22
|
-
requireBackgroundTrackingPermission = it
|
|
23
|
-
.get<Boolean>(KEY_REQUIRE_BACKGROUND_TRACKING_PERMISSION)
|
|
24
|
-
.getOrThrow(),
|
|
25
|
-
loggingEnabled = it
|
|
26
|
-
.get<Boolean>(KEY_LOGGING_ENABLED)
|
|
27
|
-
.getOrThrow(),
|
|
28
|
-
allowMockLocations = it
|
|
29
|
-
.get<Boolean>(KEY_ALLOW_MOCK_LOCATIONS)
|
|
30
|
-
.getOrThrow()
|
|
31
|
-
)
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
private const val KEY_PUBLISHABLE_KEY =
|
|
36
|
-
"publishableKey"
|
|
37
|
-
private const val KEY_REQUIRE_BACKGROUND_TRACKING_PERMISSION =
|
|
38
|
-
"requireBackgroundTrackingPermission"
|
|
39
|
-
private const val KEY_LOGGING_ENABLED =
|
|
40
|
-
"loggingEnabled"
|
|
41
|
-
private const val KEY_ALLOW_MOCK_LOCATIONS =
|
|
42
|
-
"allowMockLocations"
|
|
43
|
-
}
|
|
44
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
enum HyperTrackError: String {
|
|
2
|
-
case gpsSignalLost
|
|
3
|
-
case locationMocked
|
|
4
|
-
case locationPermissionsDenied
|
|
5
|
-
case locationPermissionsInsufficientForBackground
|
|
6
|
-
case locationPermissionsNotDetermined
|
|
7
|
-
case locationPermissionsReducedAccuracy
|
|
8
|
-
case locationPermissionsProvisional
|
|
9
|
-
case locationPermissionsRestricted
|
|
10
|
-
case locationServicesDisabled
|
|
11
|
-
case locationServicesUnavailable
|
|
12
|
-
case motionActivityPermissionsNotDetermined
|
|
13
|
-
case motionActivityPermissionsDenied
|
|
14
|
-
case motionActivityServicesDisabled
|
|
15
|
-
case motionActivityServicesUnavailable
|
|
16
|
-
case motionActivityPermissionsRestricted
|
|
17
|
-
case networkConnectionUnavailable
|
|
18
|
-
case invalidPublishableKey
|
|
19
|
-
case blockedFromRunning
|
|
20
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
public struct SDKInitParams {
|
|
2
|
-
let publishableKey: String
|
|
3
|
-
let loggingEnabled: Bool
|
|
4
|
-
let allowMockLocations: Bool
|
|
5
|
-
let automaticallyRequestPermissions: Bool
|
|
6
|
-
|
|
7
|
-
init?(_ map: Dictionary<String, Any>) {
|
|
8
|
-
self.publishableKey = (map["publishableKey"] as! String)
|
|
9
|
-
self.loggingEnabled = (map["loggingEnabled"] as! Bool)
|
|
10
|
-
self.allowMockLocations = (map["allowMockLocations"] as! Bool)
|
|
11
|
-
self.automaticallyRequestPermissions = (map["automaticallyRequestPermissions"] as! Bool)
|
|
12
|
-
}
|
|
13
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["SdkInitParams.ts"],"sourcesContent":["/**\n * Parameters for initializing the SDK.\n */\nexport type SdkInitParams = {\n /**\n * Enable debug logging.\n * @default false\n */\n loggingEnabled?: boolean;\n\n /**\n * Allow mock locations to pass through and don’t send mock location outage.\n * @default false\n */\n allowMockLocations?: boolean;\n\n /**\n * Require Background location permissions while requiring permissions on Android.\n * @default false\n */\n requireBackgroundTrackingPermission?: boolean;\n\n /**\n * Automatically request permissions on starting tracking on iOS.\n * @default true\n */\n automaticallyRequestPermissions?: boolean;\n};\n"],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["DeviceName.ts"],"sourcesContent":["export type DeviceName = {\n type: 'deviceName';\n value: string;\n};\n"],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["SdkInitParams.ts"],"sourcesContent":["/**\n * Parameters for initializing the SDK.\n */\nexport type SdkInitParams = {\n /**\n * Enable debug logging.\n * @default false\n */\n loggingEnabled?: boolean;\n\n /**\n * Allow mock locations to pass through and don’t send mock location outage.\n * @default false\n */\n allowMockLocations?: boolean;\n\n /**\n * Require Background location permissions while requiring permissions on Android.\n * @default false\n */\n requireBackgroundTrackingPermission?: boolean;\n\n /**\n * Automatically request permissions on starting tracking on iOS.\n * @default true\n */\n automaticallyRequestPermissions?: boolean;\n};\n"],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["DeviceName.ts"],"sourcesContent":["export type DeviceName = {\n type: 'deviceName';\n value: string;\n};\n"],"mappings":""}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Parameters for initializing the SDK.
|
|
3
|
-
*/
|
|
4
|
-
export type SdkInitParams = {
|
|
5
|
-
/**
|
|
6
|
-
* Enable debug logging.
|
|
7
|
-
* @default false
|
|
8
|
-
*/
|
|
9
|
-
loggingEnabled?: boolean;
|
|
10
|
-
/**
|
|
11
|
-
* Allow mock locations to pass through and don’t send mock location outage.
|
|
12
|
-
* @default false
|
|
13
|
-
*/
|
|
14
|
-
allowMockLocations?: boolean;
|
|
15
|
-
/**
|
|
16
|
-
* Require Background location permissions while requiring permissions on Android.
|
|
17
|
-
* @default false
|
|
18
|
-
*/
|
|
19
|
-
requireBackgroundTrackingPermission?: boolean;
|
|
20
|
-
/**
|
|
21
|
-
* Automatically request permissions on starting tracking on iOS.
|
|
22
|
-
* @default true
|
|
23
|
-
*/
|
|
24
|
-
automaticallyRequestPermissions?: boolean;
|
|
25
|
-
};
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Parameters for initializing the SDK.
|
|
3
|
-
*/
|
|
4
|
-
export type SdkInitParams = {
|
|
5
|
-
/**
|
|
6
|
-
* Enable debug logging.
|
|
7
|
-
* @default false
|
|
8
|
-
*/
|
|
9
|
-
loggingEnabled?: boolean;
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Allow mock locations to pass through and don’t send mock location outage.
|
|
13
|
-
* @default false
|
|
14
|
-
*/
|
|
15
|
-
allowMockLocations?: boolean;
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Require Background location permissions while requiring permissions on Android.
|
|
19
|
-
* @default false
|
|
20
|
-
*/
|
|
21
|
-
requireBackgroundTrackingPermission?: boolean;
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Automatically request permissions on starting tracking on iOS.
|
|
25
|
-
* @default true
|
|
26
|
-
*/
|
|
27
|
-
automaticallyRequestPermissions?: boolean;
|
|
28
|
-
};
|