@sentiance-react-native/core 6.6.0 → 6.7.0
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/RNSentianceCore.podspec +1 -1
- package/android/src/main/java/com/sentiance/react/bridge/core/SentianceModule.java +29 -5
- package/android/src/main/java/com/sentiance/react/bridge/core/SentiancePackage.java +11 -1
- package/ios/RNSentianceCore+Converter.m +1 -0
- package/ios/RNSentianceCore.m +14 -0
- package/lib/index.d.ts +8 -1
- package/lib/index.js +4 -0
- package/package.json +3 -3
package/RNSentianceCore.podspec
CHANGED
|
@@ -55,11 +55,16 @@ public class SentianceModule extends AbstractSentianceModule {
|
|
|
55
55
|
private final SentianceEmitter emitter;
|
|
56
56
|
private final SentianceConverter converter;
|
|
57
57
|
|
|
58
|
-
public SentianceModule(ReactApplicationContext reactContext
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
58
|
+
public SentianceModule(ReactApplicationContext reactContext,
|
|
59
|
+
Sentiance sentiance,
|
|
60
|
+
SentianceSubscriptionsManager subscriptionsManager,
|
|
61
|
+
SentianceHelper sentianceHelper,
|
|
62
|
+
SentianceEmitter sentianceEmitter,
|
|
63
|
+
SentianceConverter converter) {
|
|
64
|
+
super(reactContext, sentiance, subscriptionsManager);
|
|
65
|
+
this.sentianceHelper = sentianceHelper;
|
|
66
|
+
this.emitter = sentianceEmitter;
|
|
67
|
+
this.converter = converter;
|
|
63
68
|
}
|
|
64
69
|
|
|
65
70
|
@NonNull
|
|
@@ -563,6 +568,25 @@ public class SentianceModule extends AbstractSentianceModule {
|
|
|
563
568
|
promise.resolve(args);
|
|
564
569
|
}
|
|
565
570
|
|
|
571
|
+
@ReactMethod
|
|
572
|
+
public void setIsAllowedToUseMobileData(boolean isAllowed, Promise promise) {
|
|
573
|
+
if (rejectIfNotInitialized(promise)) {
|
|
574
|
+
return;
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
mSdk.setIsAllowedToUseMobileData(isAllowed);
|
|
578
|
+
promise.resolve(null);
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
@ReactMethod
|
|
582
|
+
public void isAllowedToUseMobileData(Promise promise) {
|
|
583
|
+
if (rejectIfNotInitialized(promise)) {
|
|
584
|
+
return;
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
promise.resolve(mSdk.isAllowedToUseMobileData());
|
|
588
|
+
}
|
|
589
|
+
|
|
566
590
|
@Override
|
|
567
591
|
@ReactMethod
|
|
568
592
|
protected void addNativeListener(String eventName, int subscriptionId, Promise promise) {
|
|
@@ -6,6 +6,8 @@ import com.facebook.react.ReactPackage;
|
|
|
6
6
|
import com.facebook.react.bridge.NativeModule;
|
|
7
7
|
import com.facebook.react.bridge.ReactApplicationContext;
|
|
8
8
|
import com.facebook.react.uimanager.ViewManager;
|
|
9
|
+
import com.sentiance.react.bridge.core.common.SentianceSubscriptionsManager;
|
|
10
|
+
import com.sentiance.sdk.Sentiance;
|
|
9
11
|
|
|
10
12
|
import java.util.ArrayList;
|
|
11
13
|
import java.util.Collections;
|
|
@@ -17,7 +19,15 @@ public class SentiancePackage implements ReactPackage {
|
|
|
17
19
|
@Override
|
|
18
20
|
public List<NativeModule> createNativeModules(@NonNull ReactApplicationContext reactContext) {
|
|
19
21
|
List<NativeModule> modules = new ArrayList<>();
|
|
20
|
-
|
|
22
|
+
|
|
23
|
+
SentianceModule sentianceModule = new SentianceModule(
|
|
24
|
+
reactContext,
|
|
25
|
+
Sentiance.getInstance(reactContext),
|
|
26
|
+
new SentianceSubscriptionsManager(),
|
|
27
|
+
SentianceHelper.getInstance(reactContext),
|
|
28
|
+
new SentianceEmitter(reactContext),
|
|
29
|
+
new SentianceConverter()
|
|
30
|
+
);
|
|
21
31
|
modules.add(sentianceModule);
|
|
22
32
|
return modules;
|
|
23
33
|
}
|
|
@@ -614,6 +614,7 @@
|
|
|
614
614
|
@"isRemoteEnabled":@(status.isRemoteEnabled),
|
|
615
615
|
@"locationPermission":[self convertLocationPermissionToString:status.locationPermission],
|
|
616
616
|
@"isPreciseLocationAuthorizationGranted":@(status.isPreciseLocationAuthorizationGranted),
|
|
617
|
+
@"isLocationAvailable":@(status.isLocationAvailable),
|
|
617
618
|
@"isAccelPresent":@(status.isAccelPresent),
|
|
618
619
|
@"isGyroPresent":@(status.isGyroPresent),
|
|
619
620
|
@"isGpsPresent":@(status.isGpsPresent),
|
package/ios/RNSentianceCore.m
CHANGED
|
@@ -1147,6 +1147,20 @@ RCT_EXPORT_METHOD(getTimelineEvents:(nonnull NSNumber *)fromEpochTimeMs toEpochT
|
|
|
1147
1147
|
resolve(array);
|
|
1148
1148
|
}
|
|
1149
1149
|
|
|
1150
|
+
RCT_EXPORT_METHOD(setIsAllowedToUseMobileData:(BOOL)isAllowed resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {
|
|
1151
|
+
REJECT_IF_SDK_NOT_INITIALIZED(reject);
|
|
1152
|
+
|
|
1153
|
+
[[Sentiance sharedInstance] setAllowedToUseMobileData:isAllowed];
|
|
1154
|
+
|
|
1155
|
+
resolve(nil);
|
|
1156
|
+
}
|
|
1157
|
+
|
|
1158
|
+
RCT_EXPORT_METHOD(isAllowedToUseMobileData:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {
|
|
1159
|
+
REJECT_IF_SDK_NOT_INITIALIZED(reject);
|
|
1160
|
+
|
|
1161
|
+
resolve(@(Sentiance.sharedInstance.isAllowedToUseMobileData));
|
|
1162
|
+
}
|
|
1163
|
+
|
|
1150
1164
|
- (void)didUpdateUserContext:(SENTUserContext *)userContext
|
|
1151
1165
|
forCriteriaMask:(SENTUserContextUpdateCriteria)criteriaMask {
|
|
1152
1166
|
NSDictionary *dict = @{
|
package/lib/index.d.ts
CHANGED
|
@@ -122,7 +122,10 @@ declare module "@sentiance-react-native/core" {
|
|
|
122
122
|
isBgAccessPermGranted?: boolean; // iOS only
|
|
123
123
|
locationSetting?: string; // Android only
|
|
124
124
|
isAirplaneModeEnabled?: boolean; // Android only
|
|
125
|
-
|
|
125
|
+
/**
|
|
126
|
+
* This field is always set starting from version 6.7.0, but is kept nullable for backwards compatibility.
|
|
127
|
+
*/
|
|
128
|
+
isLocationAvailable?: boolean;
|
|
126
129
|
isGooglePlayServicesMissing?: boolean; // Android only
|
|
127
130
|
isBatteryOptimizationEnabled?: boolean; // Android only
|
|
128
131
|
isBackgroundProcessingRestricted?: boolean; // Android only
|
|
@@ -235,6 +238,10 @@ declare module "@sentiance-react-native/core" {
|
|
|
235
238
|
): Promise<void>;
|
|
236
239
|
|
|
237
240
|
getTransmittableDataTypes(): Promise<Array<TransmittableDataType>>;
|
|
241
|
+
|
|
242
|
+
setIsAllowedToUseMobileData(isAllowed: boolean): Promise<void>;
|
|
243
|
+
|
|
244
|
+
isAllowedToUseMobileData(): Promise<boolean>;
|
|
238
245
|
}
|
|
239
246
|
|
|
240
247
|
const SentianceCore: SentianceCore;
|
package/lib/index.js
CHANGED
|
@@ -33,6 +33,8 @@ const getWiFiQuotaLimit = () => core.getWiFiQuotaLimit();
|
|
|
33
33
|
const getWiFiQuotaUsage = () => core.getWiFiQuotaUsage();
|
|
34
34
|
const linkUserWithAuthCode = (authCode) => core.linkUserWithAuthCode(authCode);
|
|
35
35
|
const NO_OP_LINKER = {}
|
|
36
|
+
const setIsAllowedToUseMobileData = (isAllowed) => core.setIsAllowedToUseMobileData(isAllowed);
|
|
37
|
+
const isAllowedToUseMobileData = () => core.isAllowedToUseMobileData();
|
|
36
38
|
|
|
37
39
|
var startTrip
|
|
38
40
|
var stopTrip
|
|
@@ -237,6 +239,8 @@ module.exports = {
|
|
|
237
239
|
listenTripTimeout,
|
|
238
240
|
setTransmittableDataTypes,
|
|
239
241
|
getTransmittableDataTypes,
|
|
242
|
+
setIsAllowedToUseMobileData,
|
|
243
|
+
isAllowedToUseMobileData,
|
|
240
244
|
transportModes,
|
|
241
245
|
NO_OP_LINKER
|
|
242
246
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentiance-react-native/core",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.7.0",
|
|
4
4
|
"description": "The 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.
|
|
32
|
+
"sentiance": "6.7.+"
|
|
33
33
|
},
|
|
34
34
|
"ios": {
|
|
35
|
-
"sentiance": "~> 6.
|
|
35
|
+
"sentiance": "~> 6.7.0"
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
}
|