@sentiance-react-native/core 6.0.0-beta.15 → 6.0.0-beta.18

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.
@@ -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
@@ -313,8 +313,6 @@ RCT_EXPORT_METHOD(disableDetections:(RCTPromiseResolveBlock)resolve rejecter:(RC
313
313
 
314
314
  RCT_EXPORT_METHOD(getInitState:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject)
315
315
  {
316
- REJECT_IF_SDK_NOT_INITIALIZED(reject);
317
-
318
316
  @try {
319
317
  SENTSDKInitState initState = [[Sentiance sharedInstance] getInitState];
320
318
  resolve([self convertInitStateToString:initState]);
package/lib/core.js CHANGED
@@ -55,4 +55,4 @@ if (!SentianceCore) {
55
55
  coreModule = SentianceCore;
56
56
  }
57
57
 
58
- export default coreModule;
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
- import core from './core';
2
- import Platform from 'react-native';
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);
package/lib/utils.js CHANGED
@@ -1 +1,3 @@
1
- export const varToString = varObj => Object.keys(varObj)[0];
1
+ module.exports.varToString = function (varObj) {
2
+ return Object.keys(varObj)[0];
3
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentiance-react-native/core",
3
- "version": "6.0.0-beta.15",
3
+ "version": "6.0.0-beta.18",
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-beta6"
32
+ "sentiance": "6.0.0-beta7"
33
33
  },
34
34
  "ios": {
35
- "sentiance": "6.0.0-beta13"
35
+ "sentiance": "6.0.0-beta14"
36
36
  }
37
37
  }
38
38
  }