@sentiance-react-native/core 6.0.0-beta.16 → 6.0.0-beta.19

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/README.md CHANGED
@@ -1,24 +1,9 @@
1
- ## Installation
1
+ # Sentiance Core module for React Native
2
2
 
3
- ```bash
4
- npm i @sentiance-react-native/core
5
- ```
3
+ ## Demo Application
6
4
 
7
- ## Usage
8
-
9
- ### Importing the package
10
-
11
- You can import the entire contents of the package for use under a namespace of your choosing:
5
+ https://github.com/sentiance/sample-apps-react-native
12
6
 
13
- ```javascript
14
- import * as SentianceCore from "@sentiance-react-native/core";
15
- ```
16
-
17
- or you can require specific functionality using named imports:
7
+ ## Usage
18
8
 
19
- ```javascript
20
- import {
21
- enableDetections,
22
- createUser
23
- } from "@sentiance-react-native/core";
24
- ```
9
+ To use the core SDK module, please visit the corresponding [API reference page.](https://docs.sentiance.com/sdk/api-reference/react-native/core)
@@ -24,12 +24,12 @@ public class SentianceUtils {
24
24
  public static final String SENTIANCE_FALLBACK_NOTIFICATION_CHANNEL_NAME = "Sentiance";
25
25
  public static final String SENTIANCE_FALLBACK_NOTIFICATION_CHANNEL_ID = "Sentiance";
26
26
 
27
- public static final String SENTIANCE_NOTIFICATION_ID = "com.sentiance.react.bridge.notification_id";
28
- public static final String SENTIANCE_NOTIFICATION_TITLE = "com.sentiance.react.bridge.notification_title";
29
- public static final String SENTIANCE_NOTIFICATION_ICON = "com.sentiance.react.bridge.notification_icon";
30
- public static final String SENTIANCE_NOTIFICATION_CHANNEL_ID = "com.sentiance.react.bridge.channel_id";
31
- public static final String SENTIANCE_NOTIFICATION_CHANNEL_NAME = "com.sentiance.react.bridge.notification_channel_name";
32
- public static final String SENTIANCE_NOTIFICATION_NOTIFICATION_TEXT = "com.sentiance.react.bridge.notification_text";
27
+ public static final String SENTIANCE_NOTIFICATION_ID = "com.sentiance.react.bridge.core.notification_id";
28
+ public static final String SENTIANCE_NOTIFICATION_TITLE = "com.sentiance.react.bridge.core.notification_title";
29
+ public static final String SENTIANCE_NOTIFICATION_ICON = "com.sentiance.react.bridge.core.notification_icon";
30
+ public static final String SENTIANCE_NOTIFICATION_CHANNEL_ID = "com.sentiance.react.bridge.core.channel_id";
31
+ public static final String SENTIANCE_NOTIFICATION_CHANNEL_NAME = "com.sentiance.react.bridge.core.notification_channel_name";
32
+ public static final String SENTIANCE_NOTIFICATION_NOTIFICATION_TEXT = "com.sentiance.react.bridge.core.notification_text";
33
33
 
34
34
  private static final String DATE_TIME_PATTERN_M = "yyyy-MM-dd'T'HH:mm:ss.SSSZ"; // ISO_8601
35
35
 
@@ -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]);
@@ -27,5 +27,7 @@
27
27
  launchOptions:(nullable NSDictionary *)launchOptions
28
28
  NS_SWIFT_NAME(initializeSDK(platformUrl:isAppSessionDataCollectionAllowed:launchOptions:));
29
29
 
30
+ - (void)enableDetectionsIfUserExists;
31
+
30
32
  @end
31
33
 
@@ -28,11 +28,17 @@
28
28
  - (SENTInitializationResult *)initializeSDKWithPlatformUrl:(NSString *)platformUrl
29
29
  isAppSessionDataCollectionAllowed:(BOOL *)isAppSessionDataCollectionAllowed
30
30
  launchOptions:(nullable NSDictionary *)launchOptions {
31
- SENTOptions *options = [[SENTOptions alloc] init];
31
+ SENTOptions *options = [[SENTOptions alloc] initFor:SENTOptionsInitPurposeAppLaunch];
32
32
  options.platformUrl = platformUrl;
33
33
  options.isAppSessionDataCollectionAllowed = isAppSessionDataCollectionAllowed;
34
34
  return [[Sentiance sharedInstance] initializeWithOptions:options launchOptions:launchOptions];
35
35
  }
36
36
 
37
+ - (void)enableDetectionsIfUserExists {
38
+ if ([Sentiance sharedInstance].userExists) {
39
+ [[Sentiance sharedInstance] enableDetectionsWithCompletionHandler:nil];
40
+ }
41
+ }
42
+
37
43
  @end
38
44
 
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 {
@@ -183,7 +185,7 @@ declare module "sentiance-react-native-core" {
183
185
 
184
186
  createUser(options: UserCreationOptions): Promise<CreateUserResult>;
185
187
 
186
- linkUser(): Promise<UserLinkingResult>;
188
+ linkUser(linker: (installId) => boolean): Promise<UserLinkingResult>;
187
189
 
188
190
  linkUserWithAuthCode(authCode: string): Promise<UserLinkingResult>;
189
191
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentiance-react-native/core",
3
- "version": "6.0.0-beta.16",
3
+ "version": "6.0.0-beta.19",
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
  }