react-native-radar 3.5.7 → 3.5.8
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/android/build.gradle
CHANGED
|
@@ -18,7 +18,7 @@ android {
|
|
|
18
18
|
minSdkVersion 16
|
|
19
19
|
targetSdkVersion 31
|
|
20
20
|
versionCode 1
|
|
21
|
-
versionName '3.5.
|
|
21
|
+
versionName '3.5.8'
|
|
22
22
|
}
|
|
23
23
|
lintOptions {
|
|
24
24
|
abortOnError false
|
|
@@ -45,5 +45,5 @@ repositories {
|
|
|
45
45
|
|
|
46
46
|
dependencies {
|
|
47
47
|
api 'com.facebook.react:react-native:+'
|
|
48
|
-
api 'io.radar:sdk:3.5.
|
|
48
|
+
api 'io.radar:sdk:3.5.9'
|
|
49
49
|
}
|
|
@@ -57,6 +57,11 @@ public class RNRadarModule extends ReactContextBaseJavaModule implements Permiss
|
|
|
57
57
|
return "RNRadar";
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
+
@ReactMethod
|
|
61
|
+
public void initialize(String publishableKey) {
|
|
62
|
+
Radar.initialize(getReactApplicationContext(), publishableKey);
|
|
63
|
+
}
|
|
64
|
+
|
|
60
65
|
@ReactMethod
|
|
61
66
|
public void setLogLevel(String level) {
|
|
62
67
|
Radar.RadarLogLevel logLevel = Radar.RadarLogLevel.NONE;
|
|
@@ -426,9 +431,21 @@ public class RNRadarModule extends ReactContextBaseJavaModule implements Permiss
|
|
|
426
431
|
@ReactMethod
|
|
427
432
|
public void startTrip(ReadableMap optionsMap, final Promise promise) {
|
|
428
433
|
try {
|
|
429
|
-
JSONObject
|
|
430
|
-
|
|
431
|
-
|
|
434
|
+
JSONObject optionsJson = RNRadarUtils.jsonForMap(optionsMap);
|
|
435
|
+
// new format is { tripOptions, trackingOptions }
|
|
436
|
+
JSONObject tripOptionsJson = optionsJson.optJSONObject("tripOptions");
|
|
437
|
+
if (tripOptionsJson == null) {
|
|
438
|
+
// legacy format
|
|
439
|
+
tripOptionsJson = optionsJson;
|
|
440
|
+
}
|
|
441
|
+
RadarTripOptions options = RadarTripOptions.fromJson(tripOptionsJson);
|
|
442
|
+
|
|
443
|
+
RadarTrackingOptions trackingOptions = null;
|
|
444
|
+
JSONObject trackingOptionsJson = optionsJson.optJSONObject("trackingOptions");
|
|
445
|
+
if (trackingOptionsJson != null) {
|
|
446
|
+
trackingOptions = RadarTrackingOptions.fromJson(trackingOptionsJson);
|
|
447
|
+
}
|
|
448
|
+
Radar.startTrip(options, trackingOptions, new Radar.RadarTripCallback() {
|
|
432
449
|
@Override
|
|
433
450
|
public void onComplete(@NonNull Radar.RadarStatus status, @Nullable RadarTrip trip, @Nullable RadarEvent[] events) {
|
|
434
451
|
if (promise == null) {
|
package/ios/Cartfile.resolved
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
github "radarlabs/radar-sdk-ios" "3.5.
|
|
1
|
+
github "radarlabs/radar-sdk-ios" "3.5.9"
|
package/ios/RNRadar.m
CHANGED
|
@@ -91,6 +91,10 @@ RCT_EXPORT_MODULE();
|
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
93
|
|
|
94
|
+
RCT_EXPORT_METHOD(initialize:(NSString *)publishableKey) {
|
|
95
|
+
[Radar initializeWithPublishableKey:publishableKey];
|
|
96
|
+
}
|
|
97
|
+
|
|
94
98
|
RCT_EXPORT_METHOD(setLogLevel:(NSString *)level) {
|
|
95
99
|
RadarLogLevel logLevel = RadarLogLevelNone;
|
|
96
100
|
if (level) {
|
|
@@ -381,15 +385,26 @@ RCT_EXPORT_METHOD(getTripOptions:(RCTPromiseResolveBlock)resolve reject:(RCTProm
|
|
|
381
385
|
}
|
|
382
386
|
|
|
383
387
|
RCT_EXPORT_METHOD(startTrip:(NSDictionary *)optionsDict resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject) {
|
|
384
|
-
|
|
388
|
+
// { tripOptions, trackingOptions } is the new req format.
|
|
389
|
+
// fallback to reading trip options from the top level options.
|
|
390
|
+
NSDictionary *tripOptionsDict = optionsDict[@"tripOptions"];
|
|
391
|
+
if (tripOptionsDict == nil) {
|
|
392
|
+
tripOptionsDict = optionsDict;
|
|
393
|
+
}
|
|
394
|
+
RadarTripOptions *options = [RadarTripOptions tripOptionsFromDictionary:tripOptionsDict];
|
|
385
395
|
if (options.scheduledArrivalAt) {
|
|
386
396
|
options.scheduledArrivalAt = [RCTConvert NSDate:options.scheduledArrivalAt];
|
|
387
397
|
}
|
|
398
|
+
RadarTrackingOptions *trackingOptions;
|
|
399
|
+
NSDictionary *trackingOptionsDict = optionsDict[@"trackingOptions"];
|
|
400
|
+
if (trackingOptionsDict != nil) {
|
|
401
|
+
trackingOptions = [RadarTrackingOptions trackingOptionsFromDictionary:trackingOptionsDict];
|
|
402
|
+
}
|
|
388
403
|
|
|
389
404
|
__block RCTPromiseResolveBlock resolver = resolve;
|
|
390
405
|
__block RCTPromiseRejectBlock rejecter = reject;
|
|
391
406
|
|
|
392
|
-
[Radar startTripWithOptions:options completionHandler:^(RadarStatus status, RadarTrip * _Nullable trip, NSArray<RadarEvent *> * _Nullable events) {
|
|
407
|
+
[Radar startTripWithOptions:options trackingOptions:trackingOptions completionHandler:^(RadarStatus status, RadarTrip * _Nullable trip, NSArray<RadarEvent *> * _Nullable events) {
|
|
393
408
|
if (status == RadarStatusSuccess && resolver) {
|
|
394
409
|
NSMutableDictionary *dict = [NSMutableDictionary new];
|
|
395
410
|
[dict setObject:[Radar stringForStatus:status] forKey:@"status"];
|
package/js/index.native.js
CHANGED
|
@@ -6,6 +6,10 @@ if (!NativeModules.RNRadar && (Platform.OS === 'ios' || Platform.OS === 'android
|
|
|
6
6
|
|
|
7
7
|
const eventEmitter = new NativeEventEmitter(NativeModules.RNRadar);
|
|
8
8
|
|
|
9
|
+
const initialize = (publishableKey) => {
|
|
10
|
+
NativeModules.RNRadar.initialize(publishableKey);
|
|
11
|
+
};
|
|
12
|
+
|
|
9
13
|
const setLogLevel = (level) => {
|
|
10
14
|
NativeModules.RNRadar.setLogLevel(level);
|
|
11
15
|
};
|
|
@@ -183,6 +187,7 @@ const off = (event, callback) => {
|
|
|
183
187
|
};
|
|
184
188
|
|
|
185
189
|
const Radar = {
|
|
190
|
+
initialize,
|
|
186
191
|
setLogLevel,
|
|
187
192
|
setUserId,
|
|
188
193
|
getUserId,
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "React Native module for Radar, the leading geofencing and location tracking platform",
|
|
4
4
|
"homepage": "https://radar.com",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
|
-
"version": "3.5.
|
|
6
|
+
"version": "3.5.8",
|
|
7
7
|
"main": "js/index.js",
|
|
8
8
|
"files": [
|
|
9
9
|
"android",
|
|
@@ -48,8 +48,7 @@
|
|
|
48
48
|
"metro-react-native-babel-preset": "^0.51.1",
|
|
49
49
|
"npm-run-all": "^4.1.5",
|
|
50
50
|
"react": "16.8.6",
|
|
51
|
-
"react-native": "0.60.0"
|
|
52
|
-
"radar-sdk-js": "^3.3.0"
|
|
51
|
+
"react-native": "0.60.0"
|
|
53
52
|
},
|
|
54
53
|
"bugs": {
|
|
55
54
|
"url": "https://github.com/radarlabs/react-native-radar/issues"
|
|
@@ -59,6 +58,7 @@
|
|
|
59
58
|
"url": "https://github.com/radarlabs/react-native-radar.git"
|
|
60
59
|
},
|
|
61
60
|
"dependencies": {
|
|
61
|
+
"radar-sdk-js": "^3.5.0",
|
|
62
62
|
"@react-native-community/netinfo": "^7.1.3"
|
|
63
63
|
}
|
|
64
64
|
}
|