@sentiance-react-native/core 6.0.0-beta.10 → 6.0.0-beta.13

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/lib/core.js CHANGED
@@ -9,48 +9,48 @@ const SDK_ON_TRIP_TIMED_OUT_EVENT = "SENTIANCE_ON_TRIP_TIMED_OUT_EVENT";
9
9
 
10
10
  if (!SentianceCore) {
11
11
  const nativeModuleName = varToString({SentianceCore});
12
- throw `Could not locate the native ${nativeModuleName} module.
13
- Make sure that your native code is properly linked, and that the module name you specified is correct.`;
12
+ console.error(`Could not locate the native ${nativeModuleName} module.
13
+ Make sure that your native code is properly linked, and that the module name you specified is correct.`);
14
+ } else {
15
+ const SENTIANCE_EMITTER = new NativeEventEmitter(SentianceCore);
16
+
17
+ const _addSdkStatusUpdateListener = async (onSdkStatusUpdated) => {
18
+ await SentianceCore.listenSdkStatusUpdates();
19
+ return SENTIANCE_EMITTER.addListener(SDK_STATUS_UPDATE_EVENT, (sdkStatus) => {
20
+ onSdkStatusUpdated(sdkStatus);
21
+ });
22
+ };
23
+
24
+ const _addUserLinkListener = async (linker) => {
25
+ const subscription = SENTIANCE_EMITTER.addListener(SDK_USER_LINK_EVENT, async (data) => {
26
+ const {installId} = data;
27
+ const linkingResult = await linker(installId);
28
+ if (typeof linkingResult != "boolean") {
29
+ console.error('Expected linker result of type boolean, got: ' + typeof linkingResult);
30
+ SentianceCore.userLinkCallback(false);
31
+ } else {
32
+ SentianceCore.userLinkCallback(linkingResult);
33
+ }
34
+ subscription.remove();
35
+ });
36
+ };
37
+
38
+ const _addSdkUserActivityUpdateListener = async (onUserActivityUpdated) => {
39
+ await SentianceCore.listenUserActivityUpdates();
40
+ return SENTIANCE_EMITTER.addListener(SDK_USER_ACTIVITY_UPDATE_EVENT, (data) => {
41
+ onUserActivityUpdated(data);
42
+ });
43
+ };
44
+
45
+ const _addTripTimeoutListener = async (onTripTimedOut) => {
46
+ await SentianceCore.listenTripTimeout();
47
+ return SENTIANCE_EMITTER.addListener(SDK_ON_TRIP_TIMED_OUT_EVENT, onTripTimedOut);
48
+ };
49
+
50
+ SentianceCore._addSdkStatusUpdateListener = _addSdkStatusUpdateListener;
51
+ SentianceCore._addUserLinkListener = _addUserLinkListener;
52
+ SentianceCore._addSdkUserActivityUpdateListener = _addSdkUserActivityUpdateListener;
53
+ SentianceCore._addTripTimeoutListener = _addTripTimeoutListener;
14
54
  }
15
55
 
16
- const SENTIANCE_EMITTER = new NativeEventEmitter(SentianceCore);
17
-
18
- const _addSdkStatusUpdateListener = async (onSdkStatusUpdated) => {
19
- await SentianceCore.listenSdkStatusUpdates();
20
- return SENTIANCE_EMITTER.addListener(SDK_STATUS_UPDATE_EVENT, (sdkStatus) => {
21
- onSdkStatusUpdated(sdkStatus);
22
- });
23
- };
24
-
25
- const _addUserLinkListener = async (linker) => {
26
- const subscription = SENTIANCE_EMITTER.addListener(SDK_USER_LINK_EVENT, async (data) => {
27
- const {installId} = data;
28
- const linkingResult = await linker(installId);
29
- if (typeof linkingResult != "boolean") {
30
- console.error('Expected linker result of type boolean, got: ' + typeof linkingResult);
31
- SentianceCore.userLinkCallback(false);
32
- } else {
33
- SentianceCore.userLinkCallback(linkingResult);
34
- }
35
- subscription.remove();
36
- });
37
- };
38
-
39
- const _addSdkUserActivityUpdateListener = async (onUserActivityUpdated) => {
40
- await SentianceCore.listenUserActivityUpdates();
41
- return SENTIANCE_EMITTER.addListener(SDK_USER_ACTIVITY_UPDATE_EVENT, (data) => {
42
- onUserActivityUpdated(data);
43
- });
44
- };
45
-
46
- const _addTripTimeoutListener = async (onTripTimedOut) => {
47
- await SentianceCore.listenTripTimeout();
48
- return SENTIANCE_EMITTER.addListener(SDK_ON_TRIP_TIMED_OUT_EVENT, onTripTimedOut);
49
- };
50
-
51
- SentianceCore._addSdkStatusUpdateListener = _addSdkStatusUpdateListener;
52
- SentianceCore._addUserLinkListener = _addUserLinkListener;
53
- SentianceCore._addSdkUserActivityUpdateListener = _addSdkUserActivityUpdateListener;
54
- SentianceCore._addTripTimeoutListener = _addTripTimeoutListener;
55
-
56
56
  export default SentianceCore;
package/lib/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  declare module "sentiance-react-native-core" {
2
2
  import {EmitterSubscription} from "react-native";
3
3
 
4
+ export type DetectionStatus = "DISABLED" | "EXPIRED" | "ENABLED_BUT_BLOCKED" | "ENABLED_AND_DETECTING";
4
5
  export type LocationPermission = "ALWAYS" | "ONLY_WHILE_IN_USE" | "NEVER";
5
6
  export type SdkInitState =
6
7
  "NOT_INITIALIZED"
@@ -84,6 +85,7 @@ declare module "sentiance-react-native-core" {
84
85
 
85
86
  export interface SdkStatus {
86
87
  startStatus: string;
88
+ detectionStatus: DetectionStatus;
87
89
  canDetect: boolean;
88
90
  isRemoteEnabled: boolean;
89
91
  isAccelPresent: boolean;
@@ -109,7 +111,7 @@ declare module "sentiance-react-native-core" {
109
111
 
110
112
  export interface EnableDisableDetectionsResult {
111
113
  sdkStatus: SdkStatus,
112
- detectionStatus: string
114
+ detectionStatus: DetectionStatus
113
115
  }
114
116
 
115
117
  export interface SentianceCore {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentiance-react-native/core",
3
- "version": "6.0.0-beta.10",
3
+ "version": "6.0.0-beta.13",
4
4
  "description": "React Native Sentiance core library",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
@@ -32,7 +32,7 @@
32
32
  "sentiance": "6.0.0-beta6"
33
33
  },
34
34
  "ios": {
35
- "sentiance": "6.0.0-beta10"
35
+ "sentiance": "6.0.0-beta13"
36
36
  }
37
37
  }
38
38
  }