hypertrack-sdk-react-native 10.0.3 → 11.0.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/CHANGELOG.md +54 -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 +46 -80
- package/ios/common/SDKMethod.swift +13 -12
- package/ios/common/Serialization.swift +200 -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,24 +1,20 @@
|
|
|
1
1
|
// enum naming convention is ignored to make datatype sync
|
|
2
2
|
// across platforms easier
|
|
3
3
|
export let HyperTrackError = /*#__PURE__*/function (HyperTrackError) {
|
|
4
|
-
HyperTrackError["gpsSignalLost"] = "gpsSignalLost";
|
|
5
|
-
HyperTrackError["locationMocked"] = "locationMocked";
|
|
6
|
-
HyperTrackError["locationPermissionsDenied"] = "locationPermissionsDenied";
|
|
7
|
-
HyperTrackError["locationPermissionsInsufficientForBackground"] = "locationPermissionsInsufficientForBackground";
|
|
8
|
-
HyperTrackError["locationPermissionsNotDetermined"] = "locationPermissionsNotDetermined";
|
|
9
|
-
HyperTrackError["locationPermissionsReducedAccuracy"] = "locationPermissionsReducedAccuracy";
|
|
10
|
-
HyperTrackError["locationPermissionsProvisional"] = "locationPermissionsProvisional";
|
|
11
|
-
HyperTrackError["locationPermissionsRestricted"] = "locationPermissionsRestricted";
|
|
12
|
-
HyperTrackError["locationServicesDisabled"] = "locationServicesDisabled";
|
|
13
|
-
HyperTrackError["locationServicesUnavailable"] = "locationServicesUnavailable";
|
|
14
|
-
HyperTrackError["motionActivityPermissionsNotDetermined"] = "motionActivityPermissionsNotDetermined";
|
|
15
|
-
HyperTrackError["motionActivityPermissionsDenied"] = "motionActivityPermissionsDenied";
|
|
16
|
-
HyperTrackError["motionActivityServicesDisabled"] = "motionActivityServicesDisabled";
|
|
17
|
-
HyperTrackError["motionActivityServicesUnavailable"] = "motionActivityServicesUnavailable";
|
|
18
|
-
HyperTrackError["motionActivityPermissionsRestricted"] = "motionActivityPermissionsRestricted";
|
|
19
|
-
HyperTrackError["networkConnectionUnavailable"] = "networkConnectionUnavailable";
|
|
20
|
-
HyperTrackError["invalidPublishableKey"] = "invalidPublishableKey";
|
|
21
4
|
HyperTrackError["blockedFromRunning"] = "blockedFromRunning";
|
|
5
|
+
HyperTrackError["invalidPublishableKey"] = "invalidPublishableKey";
|
|
6
|
+
HyperTrackError["locationMocked"] = "location.mocked";
|
|
7
|
+
HyperTrackError["locationServicesDisabled"] = "location.servicesDisabled";
|
|
8
|
+
HyperTrackError["locationServicesUnavailable"] = "location.servicesUnavailable";
|
|
9
|
+
HyperTrackError["locationSignalLost"] = "location.signalLost";
|
|
10
|
+
HyperTrackError["noExemptionFromBackgroundStartRestrictions"] = "noExemptionFromBackgroundStartRestrictions";
|
|
11
|
+
HyperTrackError["permissionsLocationDenied"] = "permissions.location.denied";
|
|
12
|
+
HyperTrackError["permissionsLocationInsufficientForBackground"] = "permissions.location.insufficientForBackground";
|
|
13
|
+
HyperTrackError["permissionsLocationNotDetermined"] = "permissions.location.notDetermined";
|
|
14
|
+
HyperTrackError["permissionsLocationProvisional"] = "permissions.location.provisional";
|
|
15
|
+
HyperTrackError["permissionsLocationReducedAccuracy"] = "permissions.location.reducedAccuracy";
|
|
16
|
+
HyperTrackError["permissionsLocationRestricted"] = "permissions.location.restricted";
|
|
17
|
+
HyperTrackError["permissionsNotificationsDenied"] = "permissions.notifications.denied";
|
|
22
18
|
return HyperTrackError;
|
|
23
19
|
}({});
|
|
24
20
|
//# sourceMappingURL=HyperTrackError.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["HyperTrackError"],"sources":["HyperTrackError.ts"],"sourcesContent":["// enum naming convention is ignored to make datatype sync\n// across platforms easier\nexport enum HyperTrackError {\n
|
|
1
|
+
{"version":3,"names":["HyperTrackError"],"sources":["HyperTrackError.ts"],"sourcesContent":["// enum naming convention is ignored to make datatype sync\n// across platforms easier\nexport enum HyperTrackError {\n /**\n * The SDK was remotely blocked from running.\n */\n blockedFromRunning = 'blockedFromRunning',\n\n /**\n * The publishable key is invalid.\n */\n invalidPublishableKey = 'invalidPublishableKey',\n\n /**\n * The user enabled mock location app while mocking locations is prohibited.\n */\n locationMocked = 'location.mocked',\n\n /**\n * The user disabled location services systemwide.\n */\n locationServicesDisabled = 'location.servicesDisabled',\n\n /**\n * [Android only] The device doesn't have location services.\n */\n locationServicesUnavailable = 'location.servicesUnavailable',\n\n /**\n * GPS satellites are not in view.\n */\n locationSignalLost = 'location.signalLost',\n\n /**\n * [Android only] The SDK wasn't able to start tracking because of the limitations imposed by the OS.\n * The exempt from background execution conditions weren't met.\n * {@link https://developer.android.com/guide/components/foreground-services#background-start-restriction-exemptions}\n */\n noExemptionFromBackgroundStartRestrictions = 'noExemptionFromBackgroundStartRestrictions',\n\n /**\n * The user denied location permissions.\n */\n permissionsLocationDenied = 'permissions.location.denied',\n\n /**\n * Can’t start tracking in background with When In Use location permissions.\n * SDK will automatically start tracking when app will return to foreground.\n */\n permissionsLocationInsufficientForBackground = 'permissions.location.insufficientForBackground',\n\n /**\n * [iOS only] The user has not chosen whether the app can use location services.\n */\n permissionsLocationNotDetermined = 'permissions.location.notDetermined',\n\n /**\n * [iOS only] The app is in Provisional Always authorization state, which stops sending locations when app is in background.\n */\n permissionsLocationProvisional = 'permissions.location.provisional',\n\n /**\n * The user didn't grant precise location permissions or downgraded permissions to imprecise.\n */\n permissionsLocationReducedAccuracy = 'permissions.location.reducedAccuracy',\n\n /**\n * [iOS only] The app is not authorized to use location services.\n */\n permissionsLocationRestricted = 'permissions.location.restricted',\n\n /**\n * [Android only] The user denied notification permissions needed to display a persistent notification\n * needed for foreground location tracking.\n */\n permissionsNotificationsDenied = 'permissions.notifications.denied',\n}\n"],"mappings":"AAAA;AACA;AACA,WAAYA,eAAe,0BAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAA,OAAfA,eAAe;AAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["HyperTrackErrorInternal.ts"],"sourcesContent":["export type HyperTrackErrorInternal = {\n
|
|
1
|
+
{"version":3,"names":[],"sources":["HyperTrackErrorInternal.ts"],"sourcesContent":["export type HyperTrackErrorInternal = {\n type: 'error';\n value: string;\n};\n"],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["Metadata.ts"],"sourcesContent":["export type Metadata = {\n type: 'metadata';\n value: Object;\n};\n"],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["Name.ts"],"sourcesContent":["/**\n * Device name\n */\nexport type Name = {\n type: 'name';\n value: string;\n};\n"],"mappings":""}
|
package/lib/module/index.js
CHANGED
|
@@ -6,6 +6,5 @@ export { NotRunning, Starting } from './HyperTrack/data_types/internal/LocationE
|
|
|
6
6
|
export { LocationError, Errors } from './HyperTrack/data_types/LocationError';
|
|
7
7
|
export { LocationWithDeviation } from './HyperTrack/data_types/LocationWithDeviation';
|
|
8
8
|
export { Location } from './HyperTrack/data_types/Location';
|
|
9
|
-
export { SdkInitParams } from './HyperTrack/data_types/SdkInitParams';
|
|
10
9
|
export { Result, Success, Failure } from './HyperTrack/data_types/Result';
|
|
11
10
|
//# sourceMappingURL=index.js.map
|
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["HyperTrack","HyperTrackError","NotRunning","Starting","LocationError","Errors","LocationWithDeviation","Location","
|
|
1
|
+
{"version":3,"names":["HyperTrack","HyperTrackError","NotRunning","Starting","LocationError","Errors","LocationWithDeviation","Location","Result","Success","Failure"],"sources":["index.tsx"],"sourcesContent":["import HyperTrack from './HyperTrack/HyperTrack';\nexport default HyperTrack;\nexport { HyperTrack };\n\nexport { HyperTrackError } from './HyperTrack/data_types/HyperTrackError';\nexport {\n NotRunning,\n Starting,\n} from './HyperTrack/data_types/internal/LocationErrorInternal';\nexport { LocationError, Errors } from './HyperTrack/data_types/LocationError';\nexport { LocationWithDeviation } from './HyperTrack/data_types/LocationWithDeviation';\nexport { Location } from './HyperTrack/data_types/Location';\nexport { Result, Success, Failure } from './HyperTrack/data_types/Result';\n"],"mappings":"AAAA,OAAOA,UAAU,MAAM,yBAAyB;AAChD,eAAeA,UAAU;AACzB,SAASA,UAAU;AAEnB,SAASC,eAAe,QAAQ,yCAAyC;AACzE,SACEC,UAAU,EACVC,QAAQ,QACH,wDAAwD;AAC/D,SAASC,aAAa,EAAEC,MAAM,QAAQ,uCAAuC;AAC7E,SAASC,qBAAqB,QAAQ,+CAA+C;AACrF,SAASC,QAAQ,QAAQ,kCAAkC;AAC3D,SAASC,MAAM,EAAEC,OAAO,EAAEC,OAAO,QAAQ,gCAAgC"}
|
|
@@ -1,82 +1,112 @@
|
|
|
1
|
+
import { EmitterSubscription } from 'react-native';
|
|
1
2
|
import { HyperTrackError } from './data_types/HyperTrackError';
|
|
2
3
|
import type { Location } from './data_types/Location';
|
|
3
4
|
import type { LocationError } from './data_types/LocationError';
|
|
4
|
-
import type { SdkInitParams } from './data_types/SdkInitParams';
|
|
5
|
-
import type { Result } from './data_types/Result';
|
|
6
5
|
import type { LocationWithDeviation } from './data_types/LocationWithDeviation';
|
|
6
|
+
import type { Result } from './data_types/Result';
|
|
7
7
|
export default class HyperTrack {
|
|
8
|
-
private
|
|
8
|
+
private static locateSubscription;
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
10
|
+
* Adds a new geotag
|
|
11
11
|
*
|
|
12
|
-
* @param
|
|
13
|
-
* @
|
|
14
|
-
* @returns HyperTrack instance
|
|
12
|
+
* @param {Object} data - Geotad data JSON
|
|
13
|
+
* @returns current location if success or LocationError if failure
|
|
15
14
|
*/
|
|
16
|
-
static
|
|
15
|
+
static addGeotag(data: Object): Promise<Result<Location, LocationError>>;
|
|
16
|
+
/**
|
|
17
|
+
* Adds a new geotag with expected location
|
|
18
|
+
*
|
|
19
|
+
* @param {Object} data - Geotad data JSON
|
|
20
|
+
* @param {Location} expectedLocation - Expected location
|
|
21
|
+
* @returns location with deviation if success or LocationError if failure
|
|
22
|
+
*/
|
|
23
|
+
static addGeotag(data: Object, expectedLocation: Location): Promise<Result<LocationWithDeviation, LocationError>>;
|
|
17
24
|
/**
|
|
18
25
|
* Returns a string that is used to uniquely identify the device
|
|
26
|
+
*
|
|
27
|
+
* @returns {string} Device ID
|
|
19
28
|
*/
|
|
20
|
-
getDeviceId(): Promise<string>;
|
|
29
|
+
static getDeviceId(): Promise<string>;
|
|
21
30
|
/**
|
|
22
|
-
*
|
|
31
|
+
* Returns a list of errors that blocks SDK from tracking
|
|
23
32
|
*
|
|
24
|
-
* @returns
|
|
33
|
+
* @returns {HyperTrackError[]} List of errors
|
|
25
34
|
*/
|
|
26
|
-
|
|
35
|
+
static getErrors(): Promise<HyperTrackError[]>;
|
|
27
36
|
/**
|
|
28
|
-
*
|
|
37
|
+
* Reflects availability of the device for the Nearby search
|
|
29
38
|
*
|
|
30
|
-
* @
|
|
39
|
+
* @returns true when is available or false when unavailable
|
|
31
40
|
*/
|
|
32
|
-
|
|
41
|
+
static getIsAvailable(): Promise<boolean>;
|
|
33
42
|
/**
|
|
34
43
|
* Reflects the tracking intent for the device
|
|
35
44
|
*
|
|
36
|
-
* @
|
|
45
|
+
* @returns {boolean} Whether the user's movement data is getting tracked or not.
|
|
37
46
|
*/
|
|
38
|
-
|
|
47
|
+
static getIsTracking(): Promise<boolean>;
|
|
39
48
|
/**
|
|
40
|
-
*
|
|
49
|
+
* Reflects the current location of the user or an outage reason
|
|
41
50
|
*/
|
|
42
|
-
|
|
51
|
+
static getLocation(): Promise<Result<Location, LocationError>>;
|
|
43
52
|
/**
|
|
44
|
-
*
|
|
53
|
+
* Gets the metadata that is set for the device
|
|
54
|
+
*
|
|
55
|
+
* @returns {Object} Metadata JSON
|
|
45
56
|
*/
|
|
46
|
-
|
|
57
|
+
static getMetadata(): Promise<Object>;
|
|
47
58
|
/**
|
|
48
|
-
*
|
|
59
|
+
* Gets the name that is set for the device
|
|
60
|
+
*
|
|
61
|
+
* @returns {string} Device name
|
|
49
62
|
*/
|
|
50
|
-
|
|
63
|
+
static getName(): Promise<string>;
|
|
51
64
|
/**
|
|
52
|
-
*
|
|
65
|
+
* Requests one-time location update and returns the location once it is available, or error.
|
|
66
|
+
*
|
|
67
|
+
* Only one locate subscription can be active at a time. If you re-subscribe, the old EmitterSubscription
|
|
68
|
+
* will be automaticaly removed.
|
|
69
|
+
*
|
|
70
|
+
* This method will start location tracking if called, and will stop it when the location is received or
|
|
71
|
+
* the subscription is cancelled. If any other tracking intent is present (e.g. isAvailable is set to `true`),
|
|
72
|
+
* the tracking will not be stopped.
|
|
73
|
+
*
|
|
74
|
+
* @param callback
|
|
75
|
+
* @returns EmitterSubscription
|
|
76
|
+
* @example ```js
|
|
77
|
+
* const subscription = HyperTrack.locate(location => {
|
|
78
|
+
* ...
|
|
79
|
+
* })
|
|
80
|
+
*
|
|
81
|
+
* // to unsubscribe
|
|
82
|
+
* subscription.remove()
|
|
83
|
+
* ```
|
|
53
84
|
*/
|
|
54
|
-
|
|
85
|
+
static locate(callback: (location: Result<Location, HyperTrackError[]>) => void): EmitterSubscription;
|
|
55
86
|
/**
|
|
56
|
-
* Sets the
|
|
57
|
-
*
|
|
87
|
+
* Sets the availability of the device for the Nearby search
|
|
88
|
+
*
|
|
89
|
+
* @param availability true when is available or false when unavailable
|
|
58
90
|
*/
|
|
59
|
-
|
|
91
|
+
static setIsAvailable(isAvailable: boolean): Promise<void>;
|
|
60
92
|
/**
|
|
61
|
-
* Sets the
|
|
62
|
-
*
|
|
93
|
+
* Sets the tracking intent for the device
|
|
94
|
+
*
|
|
95
|
+
* @param {boolean} isTracking
|
|
63
96
|
*/
|
|
64
|
-
|
|
97
|
+
static setIsTracking(isTracking: boolean): Promise<void>;
|
|
65
98
|
/**
|
|
66
|
-
*
|
|
99
|
+
* Sets the metadata for the device
|
|
67
100
|
*
|
|
68
|
-
* @param {Object} data -
|
|
69
|
-
* @returns current location if success or LocationError if failure
|
|
101
|
+
* @param {Object} data - Metadata JSON
|
|
70
102
|
*/
|
|
71
|
-
|
|
103
|
+
static setMetadata(data: Object): Promise<void>;
|
|
72
104
|
/**
|
|
73
|
-
*
|
|
105
|
+
* Sets the name for the device
|
|
74
106
|
*
|
|
75
|
-
* @param {
|
|
76
|
-
* @param {Location} expectedLocation - Expected location
|
|
77
|
-
* @returns location with deviation if success or LocationError if failure
|
|
107
|
+
* @param {string} name
|
|
78
108
|
*/
|
|
79
|
-
|
|
109
|
+
static setName(name: string): Promise<void>;
|
|
80
110
|
/**
|
|
81
111
|
* Subscribe to tracking errors
|
|
82
112
|
*
|
|
@@ -94,16 +124,16 @@ export default class HyperTrack {
|
|
|
94
124
|
* subscription.remove()
|
|
95
125
|
* ```
|
|
96
126
|
*/
|
|
97
|
-
subscribeToErrors(listener: (errors: HyperTrackError[]) => void):
|
|
127
|
+
static subscribeToErrors(listener: (errors: HyperTrackError[]) => void): EmitterSubscription;
|
|
98
128
|
/**
|
|
99
|
-
* Subscribe to
|
|
129
|
+
* Subscribe to availability changes
|
|
100
130
|
*
|
|
101
131
|
* @param listener
|
|
102
132
|
* @returns EmitterSubscription
|
|
103
133
|
* @example
|
|
104
134
|
* ```js
|
|
105
|
-
* const subscription = HyperTrack.
|
|
106
|
-
* if (
|
|
135
|
+
* const subscription = HyperTrack.subscribeToIsAvailable(isAvailable => {
|
|
136
|
+
* if (isAvailable) {
|
|
107
137
|
* // ... ready to go
|
|
108
138
|
* }
|
|
109
139
|
* })
|
|
@@ -112,16 +142,16 @@ export default class HyperTrack {
|
|
|
112
142
|
* subscription.remove()
|
|
113
143
|
* ```
|
|
114
144
|
*/
|
|
115
|
-
|
|
145
|
+
static subscribeToIsAvailable(listener: (isAvailable: boolean) => void): EmitterSubscription;
|
|
116
146
|
/**
|
|
117
|
-
* Subscribe to
|
|
147
|
+
* Subscribe to tracking intent changes
|
|
118
148
|
*
|
|
119
149
|
* @param listener
|
|
120
150
|
* @returns EmitterSubscription
|
|
121
151
|
* @example
|
|
122
152
|
* ```js
|
|
123
|
-
* const subscription = HyperTrack.
|
|
124
|
-
* if (
|
|
153
|
+
* const subscription = HyperTrack.subscribeToIsTracking(isTracking => {
|
|
154
|
+
* if (isTracking) {
|
|
125
155
|
* // ... ready to go
|
|
126
156
|
* }
|
|
127
157
|
* })
|
|
@@ -130,15 +160,37 @@ export default class HyperTrack {
|
|
|
130
160
|
* subscription.remove()
|
|
131
161
|
* ```
|
|
132
162
|
*/
|
|
133
|
-
|
|
163
|
+
static subscribeToIsTracking(listener: (isTracking: boolean) => void): EmitterSubscription;
|
|
164
|
+
/**
|
|
165
|
+
* Subscribe to location changes
|
|
166
|
+
*
|
|
167
|
+
* @param listener
|
|
168
|
+
* @returns EmitterSubscription
|
|
169
|
+
* @example
|
|
170
|
+
* ```js
|
|
171
|
+
* const subscription = HyperTrack.subscribeToLocation(location => {
|
|
172
|
+
* ...
|
|
173
|
+
* })
|
|
174
|
+
*
|
|
175
|
+
* // later, to stop listening
|
|
176
|
+
* subscription.remove()
|
|
177
|
+
* ```
|
|
178
|
+
*/
|
|
179
|
+
static subscribeToLocation(listener: (location: Result<Location, LocationError>) => void): EmitterSubscription;
|
|
180
|
+
/** @ignore */
|
|
181
|
+
private static deserializeHyperTrackErrors;
|
|
182
|
+
/** @ignore */
|
|
183
|
+
private static deserializeLocateResponse;
|
|
184
|
+
/** @ignore */
|
|
185
|
+
private static deserializeLocationError;
|
|
134
186
|
/** @ignore */
|
|
135
|
-
private
|
|
187
|
+
private static deserializeLocationResponse;
|
|
136
188
|
/** @ignore */
|
|
137
|
-
private
|
|
189
|
+
private static deserializeLocationWithDeviationResponse;
|
|
138
190
|
/** @ignore */
|
|
139
|
-
private
|
|
191
|
+
private static deserializeMetadata;
|
|
140
192
|
/** @ignore */
|
|
141
|
-
private
|
|
193
|
+
private static deserializeName;
|
|
142
194
|
/** @ignore */
|
|
143
|
-
private isLocation;
|
|
195
|
+
private static isLocation;
|
|
144
196
|
}
|
|
@@ -1,20 +1,62 @@
|
|
|
1
1
|
export declare enum HyperTrackError {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
locationPermissionsRestricted = "locationPermissionsRestricted",
|
|
10
|
-
locationServicesDisabled = "locationServicesDisabled",
|
|
11
|
-
locationServicesUnavailable = "locationServicesUnavailable",
|
|
12
|
-
motionActivityPermissionsNotDetermined = "motionActivityPermissionsNotDetermined",
|
|
13
|
-
motionActivityPermissionsDenied = "motionActivityPermissionsDenied",
|
|
14
|
-
motionActivityServicesDisabled = "motionActivityServicesDisabled",
|
|
15
|
-
motionActivityServicesUnavailable = "motionActivityServicesUnavailable",
|
|
16
|
-
motionActivityPermissionsRestricted = "motionActivityPermissionsRestricted",
|
|
17
|
-
networkConnectionUnavailable = "networkConnectionUnavailable",
|
|
2
|
+
/**
|
|
3
|
+
* The SDK was remotely blocked from running.
|
|
4
|
+
*/
|
|
5
|
+
blockedFromRunning = "blockedFromRunning",
|
|
6
|
+
/**
|
|
7
|
+
* The publishable key is invalid.
|
|
8
|
+
*/
|
|
18
9
|
invalidPublishableKey = "invalidPublishableKey",
|
|
19
|
-
|
|
10
|
+
/**
|
|
11
|
+
* The user enabled mock location app while mocking locations is prohibited.
|
|
12
|
+
*/
|
|
13
|
+
locationMocked = "location.mocked",
|
|
14
|
+
/**
|
|
15
|
+
* The user disabled location services systemwide.
|
|
16
|
+
*/
|
|
17
|
+
locationServicesDisabled = "location.servicesDisabled",
|
|
18
|
+
/**
|
|
19
|
+
* [Android only] The device doesn't have location services.
|
|
20
|
+
*/
|
|
21
|
+
locationServicesUnavailable = "location.servicesUnavailable",
|
|
22
|
+
/**
|
|
23
|
+
* GPS satellites are not in view.
|
|
24
|
+
*/
|
|
25
|
+
locationSignalLost = "location.signalLost",
|
|
26
|
+
/**
|
|
27
|
+
* [Android only] The SDK wasn't able to start tracking because of the limitations imposed by the OS.
|
|
28
|
+
* The exempt from background execution conditions weren't met.
|
|
29
|
+
* {@link https://developer.android.com/guide/components/foreground-services#background-start-restriction-exemptions}
|
|
30
|
+
*/
|
|
31
|
+
noExemptionFromBackgroundStartRestrictions = "noExemptionFromBackgroundStartRestrictions",
|
|
32
|
+
/**
|
|
33
|
+
* The user denied location permissions.
|
|
34
|
+
*/
|
|
35
|
+
permissionsLocationDenied = "permissions.location.denied",
|
|
36
|
+
/**
|
|
37
|
+
* Can’t start tracking in background with When In Use location permissions.
|
|
38
|
+
* SDK will automatically start tracking when app will return to foreground.
|
|
39
|
+
*/
|
|
40
|
+
permissionsLocationInsufficientForBackground = "permissions.location.insufficientForBackground",
|
|
41
|
+
/**
|
|
42
|
+
* [iOS only] The user has not chosen whether the app can use location services.
|
|
43
|
+
*/
|
|
44
|
+
permissionsLocationNotDetermined = "permissions.location.notDetermined",
|
|
45
|
+
/**
|
|
46
|
+
* [iOS only] The app is in Provisional Always authorization state, which stops sending locations when app is in background.
|
|
47
|
+
*/
|
|
48
|
+
permissionsLocationProvisional = "permissions.location.provisional",
|
|
49
|
+
/**
|
|
50
|
+
* The user didn't grant precise location permissions or downgraded permissions to imprecise.
|
|
51
|
+
*/
|
|
52
|
+
permissionsLocationReducedAccuracy = "permissions.location.reducedAccuracy",
|
|
53
|
+
/**
|
|
54
|
+
* [iOS only] The app is not authorized to use location services.
|
|
55
|
+
*/
|
|
56
|
+
permissionsLocationRestricted = "permissions.location.restricted",
|
|
57
|
+
/**
|
|
58
|
+
* [Android only] The user denied notification permissions needed to display a persistent notification
|
|
59
|
+
* needed for foreground location tracking.
|
|
60
|
+
*/
|
|
61
|
+
permissionsNotificationsDenied = "permissions.notifications.denied"
|
|
20
62
|
}
|
|
@@ -6,5 +6,4 @@ export { NotRunning, Starting, } from './HyperTrack/data_types/internal/Location
|
|
|
6
6
|
export { LocationError, Errors } from './HyperTrack/data_types/LocationError';
|
|
7
7
|
export { LocationWithDeviation } from './HyperTrack/data_types/LocationWithDeviation';
|
|
8
8
|
export { Location } from './HyperTrack/data_types/Location';
|
|
9
|
-
export { SdkInitParams } from './HyperTrack/data_types/SdkInitParams';
|
|
10
9
|
export { Result, Success, Failure } from './HyperTrack/data_types/Result';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hypertrack-sdk-react-native",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "11.0.1",
|
|
4
4
|
"description": "React Native HyperTrack SDK is a wrapper around native iOS and Android SDKs that allows to integrate HyperTrack into React Native apps.",
|
|
5
5
|
"main": "lib/commonjs/index",
|
|
6
6
|
"module": "lib/module/index",
|