@sentiance-react-native/core 6.0.0-beta.14 → 6.0.0-beta.17
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/ios/RNSentianceCore+Converter.h +4 -0
- package/ios/RNSentianceCore+Converter.m +17 -1
- package/lib/core.js +3 -1
- package/lib/index.d.ts +2 -0
- package/lib/index.js +5 -5
- package/lib/utils.js +3 -1
- package/package.json +3 -3
|
@@ -7,6 +7,8 @@
|
|
|
7
7
|
//
|
|
8
8
|
#import "RNSentianceCore.h"
|
|
9
9
|
|
|
10
|
+
typedef NS_ENUM(NSInteger, UIBackgroundRefreshStatus);
|
|
11
|
+
|
|
10
12
|
@interface RNSentianceCore (Converter)
|
|
11
13
|
|
|
12
14
|
- (NSDictionary*) convertUserContextToDict:(SENTUserContext*) userContext;
|
|
@@ -43,4 +45,6 @@
|
|
|
43
45
|
- (NSDictionary *)convertDisableDetectionsResult:(SENTDisableDetectionsResult *)disableDetectionsResult;
|
|
44
46
|
- (NSString *)stringifyDisableDetectionsError:(SENTDisableDetectionsError *)disableDetectionsError;
|
|
45
47
|
- (NSString *)stringifyUserContextError:(SENTRequestUserContextError *)userContextError;
|
|
48
|
+
- (NSString*)convertBackgroundRefreshStatus:(UIBackgroundRefreshStatus)backgroundRefreshStatus;
|
|
49
|
+
|
|
46
50
|
@end
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
//
|
|
8
8
|
|
|
9
9
|
#import "RNSentianceCore+Converter.h"
|
|
10
|
+
@import UIKit.UIApplication;
|
|
10
11
|
|
|
11
12
|
@interface RNSentianceCore (Private)
|
|
12
13
|
|
|
@@ -25,6 +26,8 @@
|
|
|
25
26
|
- (nullable NSString*)convertSegmentTypeToString:(SENTSegmentType)type;
|
|
26
27
|
- (NSMutableDictionary*)convertSegmentAttributesToDict:(NSArray<SENTAttribute *>*)attributes;
|
|
27
28
|
- (nullable NSDictionary*)convertSegment:(SENTSegment*)segment;
|
|
29
|
+
- (NSString*)convertBackgroundRefreshStatus:(UIBackgroundRefreshStatus)backgroundRefreshStatus;
|
|
30
|
+
|
|
28
31
|
@end
|
|
29
32
|
|
|
30
33
|
@implementation RNSentianceCore (Converter)
|
|
@@ -562,7 +565,8 @@
|
|
|
562
565
|
@"wifiQuotaStatus":[self convertQuotaStatusToString:status.wifiQuotaStatus],
|
|
563
566
|
@"mobileQuotaStatus":[self convertQuotaStatusToString:status.mobileQuotaStatus],
|
|
564
567
|
@"diskQuotaStatus":[self convertQuotaStatusToString:status.diskQuotaStatus],
|
|
565
|
-
@"userExists":@(status.userExists)
|
|
568
|
+
@"userExists":@(status.userExists),
|
|
569
|
+
@"backgroundRefreshStatus":[self convertBackgroundRefreshStatus:status.backgroundRefreshStatus]
|
|
566
570
|
};
|
|
567
571
|
|
|
568
572
|
return dict;
|
|
@@ -990,4 +994,16 @@
|
|
|
990
994
|
}
|
|
991
995
|
return [NSString stringWithFormat:@"Reason: %@ - %@", reason, details];
|
|
992
996
|
}
|
|
997
|
+
|
|
998
|
+
- (NSString *)convertBackgroundRefreshStatus:(UIBackgroundRefreshStatus)backgroundRefreshStatus {
|
|
999
|
+
if (backgroundRefreshStatus == UIBackgroundRefreshStatusAvailable) {
|
|
1000
|
+
return @"AVAILABLE";
|
|
1001
|
+
} else if(backgroundRefreshStatus == UIBackgroundRefreshStatusDenied) {
|
|
1002
|
+
return @"DENIED";
|
|
1003
|
+
} else if(backgroundRefreshStatus == UIBackgroundRefreshStatusRestricted) {
|
|
1004
|
+
return @"RESTRICTED";
|
|
1005
|
+
}
|
|
1006
|
+
return @"";
|
|
1007
|
+
}
|
|
1008
|
+
|
|
993
1009
|
@end
|
package/lib/core.js
CHANGED
|
@@ -7,6 +7,7 @@ const SDK_USER_LINK_EVENT = "SENTIANCE_USER_LINK_EVENT";
|
|
|
7
7
|
const SDK_USER_ACTIVITY_UPDATE_EVENT = "SENTIANCE_USER_ACTIVITY_UPDATE_EVENT";
|
|
8
8
|
const SDK_ON_TRIP_TIMED_OUT_EVENT = "SENTIANCE_ON_TRIP_TIMED_OUT_EVENT";
|
|
9
9
|
|
|
10
|
+
let coreModule = {};
|
|
10
11
|
if (!SentianceCore) {
|
|
11
12
|
const nativeModuleName = varToString({SentianceCore});
|
|
12
13
|
console.error(`Could not locate the native ${nativeModuleName} module.
|
|
@@ -51,6 +52,7 @@ if (!SentianceCore) {
|
|
|
51
52
|
SentianceCore._addUserLinkListener = _addUserLinkListener;
|
|
52
53
|
SentianceCore._addSdkUserActivityUpdateListener = _addSdkUserActivityUpdateListener;
|
|
53
54
|
SentianceCore._addTripTimeoutListener = _addTripTimeoutListener;
|
|
55
|
+
coreModule = SentianceCore;
|
|
54
56
|
}
|
|
55
57
|
|
|
56
|
-
|
|
58
|
+
module.exports = coreModule;
|
package/lib/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ declare module "sentiance-react-native-core" {
|
|
|
3
3
|
|
|
4
4
|
export type DetectionStatus = "DISABLED" | "EXPIRED" | "ENABLED_BUT_BLOCKED" | "ENABLED_AND_DETECTING";
|
|
5
5
|
export type LocationPermission = "ALWAYS" | "ONLY_WHILE_IN_USE" | "NEVER";
|
|
6
|
+
export type BackgroundRefreshStatus = "AVAILABLE" | "DENIED" | "RESTRICTED";
|
|
6
7
|
export type SdkInitState =
|
|
7
8
|
"NOT_INITIALIZED"
|
|
8
9
|
| "INIT_IN_PROGRESS"
|
|
@@ -107,6 +108,7 @@ declare module "sentiance-react-native-core" {
|
|
|
107
108
|
isBackgroundProcessingRestricted?: boolean; // Android only
|
|
108
109
|
isPreciseLocationAuthorizationGranted: boolean;
|
|
109
110
|
isSchedulingExactAlarmsPermitted?: boolean; // Android only
|
|
111
|
+
backgroundRefreshStatus: BackgroundRefreshStatus; // iOS only
|
|
110
112
|
}
|
|
111
113
|
|
|
112
114
|
export interface EnableDisableDetectionsResult {
|
package/lib/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
const core = require('./core');
|
|
2
|
+
const {Platform} = require('react-native');
|
|
3
3
|
|
|
4
4
|
const enableDetections = () => core.enableDetections();
|
|
5
5
|
const enableDetectionsWithExpiryDate = (expiryTime) => core.enableDetectionsWithExpiryDate(expiryTime);
|
|
@@ -154,9 +154,9 @@ const createUser = async (userCreationOptions) => {
|
|
|
154
154
|
}
|
|
155
155
|
}
|
|
156
156
|
|
|
157
|
-
const addSdkStatusUpdateListener = core
|
|
158
|
-
const addSdkUserActivityUpdateListener = core
|
|
159
|
-
const addTripTimeoutListener = core
|
|
157
|
+
const addSdkStatusUpdateListener = core._addSdkStatusUpdateListener;
|
|
158
|
+
const addSdkUserActivityUpdateListener = core._addSdkUserActivityUpdateListener;
|
|
159
|
+
const addTripTimeoutListener = core._addTripTimeoutListener;
|
|
160
160
|
|
|
161
161
|
const transportModes = {};
|
|
162
162
|
(function (transportModes) {
|
package/lib/utils.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentiance-react-native/core",
|
|
3
|
-
"version": "6.0.0-beta.
|
|
3
|
+
"version": "6.0.0-beta.17",
|
|
4
4
|
"description": "React Native Sentiance core library",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"typings": "lib/index.d.ts",
|
|
@@ -29,10 +29,10 @@
|
|
|
29
29
|
"targetSdk": 31,
|
|
30
30
|
"compileSdk": 31,
|
|
31
31
|
"buildTools": "30.0.3",
|
|
32
|
-
"sentiance": "6.0.0-
|
|
32
|
+
"sentiance": "6.0.0-beta7"
|
|
33
33
|
},
|
|
34
34
|
"ios": {
|
|
35
|
-
"sentiance": "6.0.0-
|
|
35
|
+
"sentiance": "6.0.0-beta14"
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
}
|