react-native-radar 3.12.0 → 3.12.1

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.
@@ -97,7 +97,7 @@ public class RNRadarModule extends ReactContextBaseJavaModule implements Permiss
97
97
  this.fraud = fraud;
98
98
  SharedPreferences.Editor editor = getReactApplicationContext().getSharedPreferences("RadarSDK", Context.MODE_PRIVATE).edit();
99
99
  editor.putString("x_platform_sdk_type", "ReactNative");
100
- editor.putString("x_platform_sdk_version", "3.12.0");
100
+ editor.putString("x_platform_sdk_version", "3.12.1");
101
101
  editor.apply();
102
102
  if (fraud) {
103
103
  Radar.initialize(getReactApplicationContext(), publishableKey, receiver, Radar.RadarLocationServicesProvider.GOOGLE, fraud);
@@ -398,7 +398,12 @@ public class RNRadarModule extends ReactContextBaseJavaModule implements Permiss
398
398
 
399
399
  try {
400
400
  if (status == Radar.RadarStatus.SUCCESS) {
401
- promise.resolve(token != null ? RNRadarUtils.mapForJson(token.toJson()) : null);
401
+ WritableMap map = Arguments.createMap();
402
+ map.putString("status", status.toString());
403
+ if (token != null) {
404
+ map.putMap("token", RNRadarUtils.mapForJson(token.toJson()));
405
+ }
406
+ promise.resolve(map);
402
407
  } else {
403
408
  promise.reject(status.toString(), status.toString());
404
409
  }
@@ -423,7 +428,12 @@ public class RNRadarModule extends ReactContextBaseJavaModule implements Permiss
423
428
 
424
429
  try {
425
430
  if (status == Radar.RadarStatus.SUCCESS) {
426
- promise.resolve(token != null ? RNRadarUtils.mapForJson(token.toJson()) : null);
431
+ WritableMap map = Arguments.createMap();
432
+ map.putString("status", status.toString());
433
+ if (token != null) {
434
+ map.putMap("token", RNRadarUtils.mapForJson(token.toJson()));
435
+ }
436
+ promise.resolve(map);
427
437
  } else {
428
438
  promise.reject(status.toString(), status.toString());
429
439
  }
@@ -466,7 +476,7 @@ public class RNRadarModule extends ReactContextBaseJavaModule implements Permiss
466
476
  @ReactMethod
467
477
  public void startTrackingVerified(ReadableMap optionsMap) {
468
478
  boolean beacons = false;
469
- int interval = 1;
479
+ int interval = 1200;
470
480
 
471
481
  if (optionsMap != null) {
472
482
  beacons = optionsMap.hasKey("beacons") ? optionsMap.getBoolean("beacons") : beacons;
package/dist/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.12.0",
6
+ "version": "3.12.1",
7
7
  "main": "dist/src/index.js",
8
8
  "files": [
9
9
  "android",
package/ios/RNRadar.m CHANGED
@@ -137,7 +137,7 @@ RCT_EXPORT_MODULE();
137
137
 
138
138
  RCT_EXPORT_METHOD(initialize:(NSString *)publishableKey fraud:(BOOL)fraud) {
139
139
  [[NSUserDefaults standardUserDefaults] setObject:@"ReactNative" forKey:@"radar-xPlatformSDKType"];
140
- [[NSUserDefaults standardUserDefaults] setObject:@"3.12.0" forKey:@"radar-xPlatformSDKVersion"];
140
+ [[NSUserDefaults standardUserDefaults] setObject:@"3.12.1" forKey:@"radar-xPlatformSDKVersion"];
141
141
  [Radar initializeWithPublishableKey:publishableKey];
142
142
  }
143
143
 
@@ -354,11 +354,12 @@ RCT_EXPORT_METHOD(trackVerified:(NSDictionary *)optionsDict resolve:(RCTPromiseR
354
354
 
355
355
  RadarTrackVerifiedCompletionHandler completionHandler = ^(RadarStatus status, RadarVerifiedLocationToken * _Nullable token) {
356
356
  if (status == RadarStatusSuccess && resolver) {
357
+ NSMutableDictionary *dict = [NSMutableDictionary new];
358
+ [dict setObject:[Radar stringForStatus:status] forKey:@"status"];
357
359
  if (token != nil) {
358
- resolver([token dictionaryValue]);
359
- } else {
360
- resolver(nil);
360
+ [dict setObject:[token dictionaryValue] forKey:@"token"];
361
361
  }
362
+ resolver(dict);
362
363
  } else if (rejecter) {
363
364
  rejecter([Radar stringForStatus:status], [Radar stringForStatus:status], nil);
364
365
  }
@@ -375,11 +376,12 @@ RCT_EXPORT_METHOD(getVerifiedLocationToken:(RCTPromiseResolveBlock)resolve rejec
375
376
 
376
377
  RadarTrackVerifiedCompletionHandler completionHandler = ^(RadarStatus status, RadarVerifiedLocationToken * _Nullable token) {
377
378
  if (status == RadarStatusSuccess && resolver) {
379
+ NSMutableDictionary *dict = [NSMutableDictionary new];
380
+ [dict setObject:[Radar stringForStatus:status] forKey:@"status"];
378
381
  if (token != nil) {
379
- resolver([token dictionaryValue]);
380
- } else {
381
- resolver(nil);
382
+ [dict setObject:[token dictionaryValue] forKey:@"token"];
382
383
  }
384
+ resolver(dict);
383
385
  } else if (rejecter) {
384
386
  rejecter([Radar stringForStatus:status], [Radar stringForStatus:status], nil);
385
387
  }
@@ -410,13 +412,9 @@ RCT_EXPORT_METHOD(startTrackingCustom:(NSDictionary *)optionsDict) {
410
412
  RCT_EXPORT_METHOD(startTrackingVerified:(NSDictionary *)optionsDict) {
411
413
  BOOL token = NO;
412
414
  BOOL beacons = NO;
413
- double interval = 1;
415
+ double interval = 1200;
414
416
 
415
417
  if (optionsDict != nil) {
416
- NSNumber *tokenNumber = optionsDict[@"token"];
417
- if (tokenNumber != nil && [tokenNumber isKindOfClass:[NSNumber class]]) {
418
- token = [tokenNumber boolValue];
419
- }
420
418
  NSNumber *beaconsNumber = optionsDict[@"beacons"];
421
419
  if (beaconsNumber != nil && [beaconsNumber isKindOfClass:[NSNumber class]]) {
422
420
  beacons = [beaconsNumber boolValue];
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.12.0",
6
+ "version": "3.12.1",
7
7
  "main": "dist/src/index.js",
8
8
  "files": [
9
9
  "android",