react-native-radar 3.19.0-beta.2 → 3.19.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.
@@ -18,7 +18,7 @@ android {
18
18
  minSdkVersion 16
19
19
  targetSdkVersion 31
20
20
  versionCode 1
21
- versionName '3.18.5'
21
+ versionName '3.19.1'
22
22
  }
23
23
  lintOptions {
24
24
  abortOnError false
@@ -45,5 +45,6 @@ repositories {
45
45
 
46
46
  dependencies {
47
47
  api 'com.facebook.react:react-native:+'
48
- api 'io.radar:sdk:3.18.8-beta.1'
48
+ api 'io.radar:sdk:3.19.0'
49
49
  }
50
+
@@ -96,7 +96,7 @@ public class RNRadarModule extends ReactContextBaseJavaModule implements Permiss
96
96
  this.fraud = fraud;
97
97
  SharedPreferences.Editor editor = getReactApplicationContext().getSharedPreferences("RadarSDK", Context.MODE_PRIVATE).edit();
98
98
  editor.putString("x_platform_sdk_type", "ReactNative");
99
- editor.putString("x_platform_sdk_version", "3.18.5");
99
+ editor.putString("x_platform_sdk_version", "3.19.1");
100
100
  editor.apply();
101
101
  if (fraud) {
102
102
  Radar.initialize(getReactApplicationContext(), publishableKey, receiver, Radar.RadarLocationServicesProvider.GOOGLE, fraud);
@@ -250,14 +250,14 @@ public class RNRadarModule extends ReactContextBaseJavaModule implements Permiss
250
250
 
251
251
  @ReactMethod
252
252
  public void requestPermissions(boolean background, final Promise promise) {
253
- Activity activity =getCurrentActivity();
253
+ PermissionAwareActivity activity = (PermissionAwareActivity)getCurrentActivity();
254
254
  mPermissionsRequestPromise = promise;
255
255
  if (activity != null) {
256
256
  if (Build.VERSION.SDK_INT >= 23) {
257
257
  if (background && Build.VERSION.SDK_INT >= 29) {
258
- ActivityCompat.requestPermissions(activity, new String[] { Manifest.permission.ACCESS_BACKGROUND_LOCATION }, PERMISSIONS_REQUEST_CODE);
258
+ activity.requestPermissions(new String[] { Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_BACKGROUND_LOCATION }, PERMISSIONS_REQUEST_CODE, this);
259
259
  } else {
260
- ActivityCompat.requestPermissions(activity, new String[] { Manifest.permission.ACCESS_FINE_LOCATION }, PERMISSIONS_REQUEST_CODE);
260
+ activity.requestPermissions(new String[] { Manifest.permission.ACCESS_FINE_LOCATION }, PERMISSIONS_REQUEST_CODE, this);
261
261
  }
262
262
  }
263
263
  }
@@ -383,11 +383,24 @@ public class RNRadarModule extends ReactContextBaseJavaModule implements Permiss
383
383
  public void trackVerified(ReadableMap optionsMap, final Promise promise) {
384
384
 
385
385
  boolean beaconsTrackingOption = false;
386
+ RadarTrackingOptions.RadarTrackingOptionsDesiredAccuracy accuracyLevel = RadarTrackingOptions.RadarTrackingOptionsDesiredAccuracy.MEDIUM;
386
387
 
387
388
  if (optionsMap != null) {
388
389
  if (optionsMap.hasKey("beacons")) {
389
390
  beaconsTrackingOption = optionsMap.getBoolean("beacons");
390
391
  }
392
+ if (optionsMap.hasKey("desiredAccuracy")) {
393
+ String desiredAccuracy = optionsMap.getString("desiredAccuracy").toLowerCase();
394
+ if (desiredAccuracy.equals("none")) {
395
+ accuracyLevel = RadarTrackingOptions.RadarTrackingOptionsDesiredAccuracy.NONE;
396
+ } else if (desiredAccuracy.equals("low")) {
397
+ accuracyLevel = RadarTrackingOptions.RadarTrackingOptionsDesiredAccuracy.LOW;
398
+ } else if (desiredAccuracy.equals("medium")) {
399
+ accuracyLevel = RadarTrackingOptions.RadarTrackingOptionsDesiredAccuracy.MEDIUM;
400
+ } else if (desiredAccuracy.equals("high")) {
401
+ accuracyLevel = RadarTrackingOptions.RadarTrackingOptionsDesiredAccuracy.HIGH;
402
+ }
403
+ }
391
404
  }
392
405
 
393
406
  Radar.RadarTrackVerifiedCallback trackCallback = new Radar.RadarTrackVerifiedCallback() {
@@ -415,7 +428,7 @@ public class RNRadarModule extends ReactContextBaseJavaModule implements Permiss
415
428
  }
416
429
  };
417
430
 
418
- Radar.trackVerified(beaconsTrackingOption, trackCallback);
431
+ Radar.trackVerified(beaconsTrackingOption, accuracyLevel, trackCallback);
419
432
  }
420
433
 
421
434
  @ReactMethod
@@ -449,13 +462,8 @@ public class RNRadarModule extends ReactContextBaseJavaModule implements Permiss
449
462
  }
450
463
 
451
464
  @ReactMethod
452
- public void startVerifyServer() {
453
- Radar.startVerifyServer();
454
- }
455
-
456
- @ReactMethod
457
- public void stopVerifyServer() {
458
- Radar.stopVerifyServer();
465
+ public void clearVerifiedLocationToken() {
466
+ Radar.clearVerifiedLocationToken();
459
467
  }
460
468
 
461
469
  @ReactMethod
@@ -15,8 +15,7 @@ export interface RadarNativeInterface {
15
15
  trackOnce: (options?: RadarTrackOnceOptions | Location) => Promise<RadarTrackCallback>;
16
16
  trackVerified: (options?: RadarTrackVerifiedOptions) => Promise<RadarTrackVerifiedCallback>;
17
17
  getVerifiedLocationToken: () => Promise<RadarTrackVerifiedCallback>;
18
- startVerifyServer: () => void;
19
- stopVerifyServer: () => void;
18
+ clearVerifiedLocationToken: () => void;
20
19
  startTrackingEfficient: () => void;
21
20
  startTrackingResponsive: () => void;
22
21
  startTrackingContinuous: () => void;
@@ -6,6 +6,7 @@ export interface RadarTrackOnceOptions {
6
6
  }
7
7
  export interface RadarTrackVerifiedOptions {
8
8
  beacons?: boolean;
9
+ desiredAccuracy?: RadarTrackingOptionsDesiredAccuracy;
9
10
  }
10
11
  /**
11
12
  * Options for tracking the user's location.
@@ -40,8 +40,7 @@ const trackOnce = (options) => {
40
40
  };
41
41
  const trackVerified = (options) => react_native_1.NativeModules.RNRadar.trackVerified(options);
42
42
  const getVerifiedLocationToken = () => react_native_1.NativeModules.RNRadar.getVerifiedLocationToken();
43
- const startVerifyServer = () => react_native_1.NativeModules.RNRadar.startVerifyServer();
44
- const stopVerifyServer = () => react_native_1.NativeModules.RNRadar.stopVerifyServer();
43
+ const clearVerifiedLocationToken = () => react_native_1.NativeModules.RNRadar.clearVerifiedLocationToken();
45
44
  const startTrackingEfficient = () => react_native_1.NativeModules.RNRadar.startTrackingEfficient();
46
45
  const startTrackingResponsive = () => react_native_1.NativeModules.RNRadar.startTrackingResponsive();
47
46
  const startTrackingContinuous = () => react_native_1.NativeModules.RNRadar.startTrackingContinuous();
@@ -102,8 +101,7 @@ const Radar = {
102
101
  trackOnce,
103
102
  trackVerified,
104
103
  getVerifiedLocationToken,
105
- startVerifyServer,
106
- stopVerifyServer,
104
+ clearVerifiedLocationToken,
107
105
  startTrackingEfficient,
108
106
  startTrackingResponsive,
109
107
  startTrackingContinuous,
@@ -15,8 +15,6 @@ declare namespace Radar {
15
15
  export { trackOnce };
16
16
  export { trackVerified };
17
17
  export { getVerifiedLocationToken };
18
- export { startVerifyServer };
19
- export { stopVerifyServer };
20
18
  export { startTrackingEfficient };
21
19
  export { startTrackingResponsive };
22
20
  export { startTrackingContinuous };
@@ -73,8 +71,6 @@ declare function getLocation(): Promise<any>;
73
71
  declare function trackOnce(options: any): Promise<any>;
74
72
  declare function trackVerified(): Promise<any>;
75
73
  declare function getVerifiedLocationToken(): Promise<any>;
76
- declare function startVerifyServer(): void;
77
- declare function stopVerifyServer(): void;
78
74
  declare function startTrackingEfficient(): void;
79
75
  declare function startTrackingResponsive(): void;
80
76
  declare function startTrackingContinuous(): void;
package/dist/index.web.js CHANGED
@@ -118,14 +118,6 @@ const getVerifiedLocationToken = () => {
118
118
  throw new Error("getVerifiedLocationToken() is not implemented on web");
119
119
  return new Promise((resolve, reject) => { reject("getVerifiedLocationToken() is not implemented on web"); });
120
120
  };
121
- const startVerifyServer = () => {
122
- if (throws)
123
- throw new Error("startVerifyServer() is not implemented on web");
124
- };
125
- const stopVerifyServer = () => {
126
- if (throws)
127
- throw new Error("stopVerifyServer() is not implemented on web");
128
- };
129
121
  const startTrackingEfficient = () => {
130
122
  if (throws)
131
123
  throw new Error("startTrackingEfficient() is not implemented on web");
@@ -479,8 +471,6 @@ const Radar = {
479
471
  trackOnce,
480
472
  trackVerified,
481
473
  getVerifiedLocationToken,
482
- startVerifyServer,
483
- stopVerifyServer,
484
474
  startTrackingEfficient,
485
475
  startTrackingResponsive,
486
476
  startTrackingContinuous,
@@ -1 +1 @@
1
- github "radarlabs/radar-sdk-ios" "3.18.5"
1
+ github "radarlabs/radar-sdk-ios" "3.20.1"
package/ios/RNRadar.m CHANGED
@@ -102,7 +102,7 @@ RCT_EXPORT_MODULE();
102
102
 
103
103
  RCT_EXPORT_METHOD(initialize:(NSString *)publishableKey fraud:(BOOL)fraud) {
104
104
  [[NSUserDefaults standardUserDefaults] setObject:@"ReactNative" forKey:@"radar-xPlatformSDKType"];
105
- [[NSUserDefaults standardUserDefaults] setObject:@"3.18.5" forKey:@"radar-xPlatformSDKVersion"];
105
+ [[NSUserDefaults standardUserDefaults] setObject:@"3.19.1" forKey:@"radar-xPlatformSDKVersion"];
106
106
  [Radar initializeWithPublishableKey:publishableKey];
107
107
  }
108
108
 
@@ -307,11 +307,25 @@ RCT_EXPORT_METHOD(trackOnce:(NSDictionary *)optionsDict resolve:(RCTPromiseResol
307
307
 
308
308
  RCT_EXPORT_METHOD(trackVerified:(NSDictionary *)optionsDict resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject) {
309
309
  BOOL beacons = NO;
310
+ RadarTrackingOptionsDesiredAccuracy desiredAccuracy = RadarTrackingOptionsDesiredAccuracyMedium;
311
+
310
312
  if (optionsDict != nil) {
311
313
  NSNumber *beaconsNumber = optionsDict[@"beacons"];
312
314
  if (beaconsNumber != nil && [beaconsNumber isKindOfClass:[NSNumber class]]) {
313
315
  beacons = [beaconsNumber boolValue];
314
316
  }
317
+
318
+ NSString *accuracy = optionsDict[@"desiredAccuracy"];
319
+ if (accuracy != nil && [accuracy isKindOfClass:[NSString class]]) {
320
+ NSString *lowerAccuracy = [accuracy lowercaseString];
321
+ if ([lowerAccuracy isEqualToString:@"high"]) {
322
+ desiredAccuracy = RadarTrackingOptionsDesiredAccuracyHigh;
323
+ } else if ([lowerAccuracy isEqualToString:@"medium"]) {
324
+ desiredAccuracy = RadarTrackingOptionsDesiredAccuracyMedium;
325
+ } else if ([lowerAccuracy isEqualToString:@"low"]) {
326
+ desiredAccuracy = RadarTrackingOptionsDesiredAccuracyLow;
327
+ }
328
+ }
315
329
  }
316
330
 
317
331
  __block RCTPromiseResolveBlock resolver = resolve;
@@ -332,7 +346,7 @@ RCT_EXPORT_METHOD(trackVerified:(NSDictionary *)optionsDict resolve:(RCTPromiseR
332
346
  rejecter = nil;
333
347
  };
334
348
 
335
- [Radar trackVerifiedWithBeacons:beacons completionHandler:completionHandler];
349
+ [Radar trackVerifiedWithBeacons:beacons desiredAccuracy:desiredAccuracy completionHandler:completionHandler];
336
350
  }
337
351
 
338
352
  RCT_EXPORT_METHOD(getVerifiedLocationToken:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject) {
@@ -357,12 +371,8 @@ RCT_EXPORT_METHOD(getVerifiedLocationToken:(RCTPromiseResolveBlock)resolve rejec
357
371
  [Radar getVerifiedLocationToken:completionHandler];
358
372
  }
359
373
 
360
- RCT_EXPORT_METHOD(startVerifyServer) {
361
- [Radar startVerifyServer];
362
- }
363
-
364
- RCT_EXPORT_METHOD(stopVerifyServer) {
365
- [Radar stopVerifyServer];
374
+ RCT_EXPORT_METHOD(clearVerifiedLocationToken) {
375
+ [Radar clearVerifiedLocationToken];
366
376
  }
367
377
 
368
378
  RCT_EXPORT_METHOD(startTrackingEfficient) {
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.19.0-beta.2",
6
+ "version": "3.19.1",
7
7
  "main": "dist/index.js",
8
8
  "files": [
9
9
  "/android",
@@ -8,5 +8,4 @@ export interface RadarPluginProps {
8
8
  androidFineLocationPermission?: boolean;
9
9
  addRadarSDKMotion?: boolean;
10
10
  iosNSMotionUsageDescription?: string;
11
- addRadarSDKVerify?: boolean;
12
11
  }
@@ -33,7 +33,6 @@ const withRadarAndroid = (config, args) => {
33
33
  <!-- for React Native -->
34
34
  <domain-config cleartextTrafficPermitted="true">
35
35
  <domain includeSubdomains="true">localhost</domain>
36
- <domain includeSubdomains="true">10.0.2.2</domain>
37
36
  </domain-config>
38
37
 
39
38
  <!-- for SSL pinning -->
@@ -52,7 +51,7 @@ const withRadarAndroid = (config, args) => {
52
51
  ]);
53
52
  return (0, config_plugins_1.withAppBuildGradle)(config, (config) => {
54
53
  if (config.modResults.language === "groovy") {
55
- config.modResults.contents = modifyAppBuildGradle(config.modResults.contents, args.androidFraud ?? false, args.addRadarSDKVerify ?? false);
54
+ config.modResults.contents = modifyAppBuildGradle(config.modResults.contents, args.androidFraud ?? false);
56
55
  }
57
56
  else {
58
57
  throw new Error("Cannot configure Sentry in the app gradle because the build.gradle is not groovy");
@@ -86,19 +85,15 @@ async function setCustomConfigAsync(config, androidManifest, args) {
86
85
  }
87
86
  return androidManifest;
88
87
  }
89
- function modifyAppBuildGradle(buildGradle, androidFraud, addRadarSDKVerify) {
88
+ function modifyAppBuildGradle(buildGradle, androidFraud) {
90
89
  let hasLocationService = false;
91
90
  let hasPlayIntegrity = false;
92
- let hasNanoHTTPD = false;
93
91
  if (buildGradle.includes('com.google.android.gms:play-services-location:21.0.1"')) {
94
92
  hasLocationService = true;
95
93
  }
96
94
  if (buildGradle.includes('com.google.android.play:integrity:1.2.0"')) {
97
95
  hasPlayIntegrity = true;
98
96
  }
99
- if (buildGradle.includes('org.nanohttpd:nanohttpd:2.3.1"')) {
100
- hasNanoHTTPD = true;
101
- }
102
97
  const pattern = /^dependencies {/m;
103
98
  if (!buildGradle.match(pattern)) {
104
99
  config_plugins_1.WarningAggregator.addWarningAndroid("react-native-radar", "Could not find react.gradle script in android/app/build.gradle.");
@@ -111,9 +106,5 @@ function modifyAppBuildGradle(buildGradle, androidFraud, addRadarSDKVerify) {
111
106
  replacementString +=
112
107
  "\n\n" + ' implementation "com.google.android.play:integrity:1.2.0"';
113
108
  }
114
- if (addRadarSDKVerify && !hasNanoHTTPD) {
115
- replacementString +=
116
- "\n\n" + ' implementation "org.nanohttpd:nanohttpd:2.3.1"';
117
- }
118
109
  return buildGradle.replace(pattern, (match) => match + replacementString);
119
110
  }
@@ -51,7 +51,7 @@ const withRadarIOS = (config, args) => {
51
51
  const filePath = path_1.default.join(config.modRequest.platformProjectRoot, 'Podfile');
52
52
  const contents = await promises_1.default.readFile(filePath, 'utf-8');
53
53
  // Check if the pod declaration already exists
54
- if (contents.indexOf("pod 'RadarSDKMotion', '3.18.5'") === -1) {
54
+ if (contents.indexOf("pod 'RadarSDKMotion', '3.20.1'") === -1) {
55
55
  // Find the target block
56
56
  const targetRegex = /target '(\w+)' do/g;
57
57
  const match = targetRegex.exec(contents);
@@ -60,33 +60,7 @@ const withRadarIOS = (config, args) => {
60
60
  const targetEndIndex = contents.indexOf('end', targetStartIndex) + 3;
61
61
  // Insert the pod declaration within the target block
62
62
  const targetBlock = contents.substring(targetStartIndex, targetEndIndex);
63
- const updatedTargetBlock = targetBlock.replace(/(target '(\w+)' do)/, `$1\n pod 'RadarSDKMotion', '3.18.5'`);
64
- const newContents = contents.replace(targetBlock, updatedTargetBlock);
65
- // Write the updated contents back to the Podfile
66
- await promises_1.default.writeFile(filePath, newContents);
67
- }
68
- }
69
- return config;
70
- },
71
- ]);
72
- }
73
- if (args.addRadarSDKVerify) {
74
- config = (0, config_plugins_1.withDangerousMod)(config, [
75
- 'ios',
76
- async (config) => {
77
- const filePath = path_1.default.join(config.modRequest.platformProjectRoot, 'Podfile');
78
- const contents = await promises_1.default.readFile(filePath, 'utf-8');
79
- // Check if the pod declaration already exists
80
- if (contents.indexOf("pod 'RadarSDK/Verify', '3.19.2-beta.9'") === -1) {
81
- // Find the target block
82
- const targetRegex = /target '(\w+)' do/g;
83
- const match = targetRegex.exec(contents);
84
- if (match) {
85
- const targetStartIndex = match.index;
86
- const targetEndIndex = contents.indexOf('end', targetStartIndex) + 3;
87
- // Insert the pod declaration within the target block
88
- const targetBlock = contents.substring(targetStartIndex, targetEndIndex);
89
- const updatedTargetBlock = targetBlock.replace(/(target '(\w+)' do)/, `$1\n pod 'RadarSDK/Verify', '3.19.2-beta.9'\n pod 'CocoaAsyncSocket', :modular_headers => true\n pod 'HTTPParserC', :modular_headers => true`);
63
+ const updatedTargetBlock = targetBlock.replace(/(target '(\w+)' do)/, `$1\n pod 'RadarSDKMotion', '3.20.1'`);
90
64
  const newContents = contents.replace(targetBlock, updatedTargetBlock);
91
65
  // Write the updated contents back to the Podfile
92
66
  await promises_1.default.writeFile(filePath, newContents);
@@ -12,8 +12,8 @@ Pod::Spec.new do |s|
12
12
  s.summary = package[:description]
13
13
  s.source = { git: package[:repository][:url] }
14
14
  s.source_files = "ios/*.{h,m}"
15
- s.platform = :ios, "12.0"
15
+ s.platform = :ios, "10.0"
16
16
 
17
17
  s.dependency "React"
18
- s.dependency "RadarSDK", "~> 3.19.2-beta.9"
18
+ s.dependency "RadarSDK", "~> 3.20.1"
19
19
  end