react-native-radar 3.8.5 → 3.8.6

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.
@@ -18,7 +18,7 @@ android {
18
18
  minSdkVersion 16
19
19
  targetSdkVersion 31
20
20
  versionCode 1
21
- versionName '3.8.6'
21
+ versionName '3.8.7'
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.8.6'
48
+ api 'io.radar:sdk:3.8.7'
49
49
  }
@@ -377,6 +377,34 @@ public class RNRadarModule extends ReactContextBaseJavaModule implements Permiss
377
377
  });
378
378
  }
379
379
 
380
+ @ReactMethod
381
+ public void trackVerifiedToken(final Promise promise) {
382
+ Radar.trackVerifiedToken(new Radar.RadarTrackTokenCallback() {
383
+ @Override
384
+ public void onComplete(@NonNull Radar.RadarStatus status, @Nullable String token) {
385
+ if (promise == null) {
386
+ return;
387
+ }
388
+
389
+ try {
390
+ if (status == Radar.RadarStatus.SUCCESS) {
391
+ WritableMap map = Arguments.createMap();
392
+ map.putString("status", status.toString());
393
+ if (token != null) {
394
+ map.putString("token", token);
395
+ }
396
+ promise.resolve(map);
397
+ } else {
398
+ promise.reject(status.toString(), status.toString());
399
+ }
400
+ } catch (Exception e) {
401
+ Log.e(TAG, "Exception", e);
402
+ promise.reject(Radar.RadarStatus.ERROR_SERVER.toString(), Radar.RadarStatus.ERROR_SERVER.toString());
403
+ }
404
+ }
405
+ });
406
+ }
407
+
380
408
  @ReactMethod
381
409
  public void startTrackingEfficient() {
382
410
  Radar.startTracking(RadarTrackingOptions.EFFICIENT);
@@ -1 +1 @@
1
- github "radarlabs/radar-sdk-ios" "3.8.4"
1
+ github "radarlabs/radar-sdk-ios" "3.8.5"
package/ios/RNRadar.m CHANGED
@@ -319,6 +319,27 @@ RCT_EXPORT_METHOD(trackVerified:(RCTPromiseResolveBlock)resolve reject:(RCTPromi
319
319
  [Radar trackVerifiedWithCompletionHandler:completionHandler];
320
320
  }
321
321
 
322
+ RCT_EXPORT_METHOD(trackVerifiedToken:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject) {
323
+ __block RCTPromiseResolveBlock resolver = resolve;
324
+ __block RCTPromiseRejectBlock rejecter = reject;
325
+
326
+ RadarTrackTokenCompletionHandler completionHandler = ^(RadarStatus status, NSString * _Nullable token) {
327
+ if (status == RadarStatusSuccess && resolver) {
328
+ NSMutableDictionary *dict = [NSMutableDictionary new];
329
+ [dict setObject:[Radar stringForStatus:status] forKey:@"status"];
330
+ if (token) {
331
+ [dict setObject:token forKey:@"token"];
332
+ }
333
+ resolver(dict);
334
+ } else if (rejecter) {
335
+ rejecter([Radar stringForStatus:status], [Radar stringForStatus:status], nil);
336
+ }
337
+ resolver = nil;
338
+ rejecter = nil;
339
+ };
340
+
341
+ [Radar trackVerifiedTokenWithCompletionHandler:completionHandler];
342
+ }
322
343
 
323
344
  RCT_EXPORT_METHOD(startTrackingEfficient) {
324
345
  [Radar startTrackingWithOptions:RadarTrackingOptions.presetEfficient];
@@ -6,7 +6,7 @@ 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, fraud) => {
9
+ const initialize = (publishableKey, fraud = false) => {
10
10
  NativeModules.RNRadar.initialize(publishableKey, fraud);
11
11
  };
12
12
 
@@ -70,6 +70,10 @@ const trackVerified = () => (
70
70
  NativeModules.RNRadar.trackVerified()
71
71
  );
72
72
 
73
+ const trackVerifiedToken = () => (
74
+ NativeModules.RNRadar.trackVerifiedToken()
75
+ );
76
+
73
77
  const startTrackingEfficient = () => (
74
78
  NativeModules.RNRadar.startTrackingEfficient()
75
79
  );
@@ -205,6 +209,7 @@ const Radar = {
205
209
  getLocation,
206
210
  trackOnce,
207
211
  trackVerified,
212
+ trackVerifiedToken,
208
213
  startTrackingEfficient,
209
214
  startTrackingResponsive,
210
215
  startTrackingContinuous,
package/js/index.web.js CHANGED
@@ -91,6 +91,10 @@ const trackVerified = () => {
91
91
  // not implemented
92
92
  };
93
93
 
94
+ const trackVerifiedToken = () => {
95
+ // not implemented
96
+ };
97
+
94
98
  const startTrackingEfficient = () => {
95
99
  // not implemented
96
100
  };
@@ -376,6 +380,7 @@ const Radar = {
376
380
  getLocation,
377
381
  trackOnce,
378
382
  trackVerified,
383
+ trackVerifiedToken,
379
384
  startTrackingEfficient,
380
385
  startTrackingResponsive,
381
386
  startTrackingContinuous,
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.8.5",
6
+ "version": "3.8.6",
7
7
  "main": "js/index.js",
8
8
  "files": [
9
9
  "android",
@@ -15,5 +15,5 @@ Pod::Spec.new do |s|
15
15
  s.platform = :ios, "10.0"
16
16
 
17
17
  s.dependency "React"
18
- s.dependency "RadarSDK", "~> 3.8.4"
18
+ s.dependency "RadarSDK", "~> 3.8.5"
19
19
  end