react-native-radar 3.19.1 → 3.20.1-beta.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.
- package/android/build.gradle +3 -2
- package/android/proguard-rules.pro +4 -0
- package/android/src/main/java/io/radar/react/RNRadarModule.java +14 -3
- package/dist/@types/RadarNativeInterface.d.ts +2 -0
- package/dist/@types/types.d.ts +1 -0
- package/dist/index.native.js +4 -0
- package/ios/Cartfile.resolved +1 -1
- package/ios/RNRadar.m +26 -3
- package/package.json +1 -1
- package/plugin/build/types.d.ts +2 -1
- package/plugin/build/withRadarAndroid.js +18 -30
- package/plugin/build/withRadarIOS.js +2 -2
- package/react-native-radar.podspec +1 -1
package/android/build.gradle
CHANGED
|
@@ -18,7 +18,8 @@ android {
|
|
|
18
18
|
minSdkVersion 16
|
|
19
19
|
targetSdkVersion 31
|
|
20
20
|
versionCode 1
|
|
21
|
-
versionName '3.
|
|
21
|
+
versionName '3.20.1-beta.1'
|
|
22
|
+
consumerProguardFiles 'proguard-rules.pro'
|
|
22
23
|
}
|
|
23
24
|
lintOptions {
|
|
24
25
|
abortOnError false
|
|
@@ -45,6 +46,6 @@ repositories {
|
|
|
45
46
|
|
|
46
47
|
dependencies {
|
|
47
48
|
api 'com.facebook.react:react-native:+'
|
|
48
|
-
api 'io.radar:sdk:3.
|
|
49
|
+
api 'io.radar:sdk:3.21.1'
|
|
49
50
|
}
|
|
50
51
|
|
|
@@ -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.
|
|
99
|
+
editor.putString("x_platform_sdk_version", "3.20.1-beta.1");
|
|
100
100
|
editor.apply();
|
|
101
101
|
if (fraud) {
|
|
102
102
|
Radar.initialize(getReactApplicationContext(), publishableKey, receiver, Radar.RadarLocationServicesProvider.GOOGLE, fraud);
|
|
@@ -431,6 +431,16 @@ public class RNRadarModule extends ReactContextBaseJavaModule implements Permiss
|
|
|
431
431
|
Radar.trackVerified(beaconsTrackingOption, accuracyLevel, trackCallback);
|
|
432
432
|
}
|
|
433
433
|
|
|
434
|
+
@ReactMethod
|
|
435
|
+
public void isTrackingVerified(final Promise promise) {
|
|
436
|
+
promise.resolve(Radar.isTrackingVerified());
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
@ReactMethod
|
|
440
|
+
public void setProduct(String product) {
|
|
441
|
+
Radar.setProduct(product);
|
|
442
|
+
}
|
|
443
|
+
|
|
434
444
|
@ReactMethod
|
|
435
445
|
public void getVerifiedLocationToken(final Promise promise) {
|
|
436
446
|
Radar.RadarTrackVerifiedCallback trackCallback = new Radar.RadarTrackVerifiedCallback() {
|
|
@@ -861,6 +871,7 @@ public class RNRadarModule extends ReactContextBaseJavaModule implements Permiss
|
|
|
861
871
|
Map<String, String> chainMetadata = RNRadarUtils.stringStringMap(optionsMap.getMap("chainMetadata"));
|
|
862
872
|
String[] categories = optionsMap.hasKey("categories") ? RNRadarUtils.stringArrayForArray(optionsMap.getArray("categories")) : null;
|
|
863
873
|
String[] groups = optionsMap.hasKey("groups") ? RNRadarUtils.stringArrayForArray(optionsMap.getArray("groups")) : null;
|
|
874
|
+
String[] countryCodes = optionsMap.hasKey("countryCodes") ? RNRadarUtils.stringArrayForArray(optionsMap.getArray("countryCodes")) : null;
|
|
864
875
|
int limit = optionsMap.hasKey("limit") ? optionsMap.getInt("limit") : 10;
|
|
865
876
|
|
|
866
877
|
Radar.RadarSearchPlacesCallback callback = new Radar.RadarSearchPlacesCallback() {
|
|
@@ -888,9 +899,9 @@ public class RNRadarModule extends ReactContextBaseJavaModule implements Permiss
|
|
|
888
899
|
};
|
|
889
900
|
|
|
890
901
|
if (near != null) {
|
|
891
|
-
Radar.searchPlaces(near, radius, chains, chainMetadata, categories, groups, limit, callback);
|
|
902
|
+
Radar.searchPlaces(near, radius, chains, chainMetadata, categories, groups, countryCodes, limit, callback);
|
|
892
903
|
} else {
|
|
893
|
-
Radar.searchPlaces(radius, chains, chainMetadata, categories, groups, limit, callback);
|
|
904
|
+
Radar.searchPlaces(radius, chains, chainMetadata, categories, groups, countryCodes, limit, callback);
|
|
894
905
|
}
|
|
895
906
|
}
|
|
896
907
|
|
|
@@ -21,6 +21,8 @@ export interface RadarNativeInterface {
|
|
|
21
21
|
startTrackingContinuous: () => void;
|
|
22
22
|
startTrackingCustom: (options: RadarTrackingOptions) => void;
|
|
23
23
|
startTrackingVerified: (options?: RadarVerifiedTrackingOptions) => void;
|
|
24
|
+
isTrackingVerified: () => Promise<boolean>;
|
|
25
|
+
setProduct(product: string): void;
|
|
24
26
|
mockTracking: (options: RadarMockTrackingOptions) => void;
|
|
25
27
|
stopTracking: () => void;
|
|
26
28
|
stopTrackingVerified: () => void;
|
package/dist/@types/types.d.ts
CHANGED
package/dist/index.native.js
CHANGED
|
@@ -50,6 +50,8 @@ const mockTracking = (options) => react_native_1.NativeModules.RNRadar.mockTrack
|
|
|
50
50
|
const stopTracking = () => react_native_1.NativeModules.RNRadar.stopTracking();
|
|
51
51
|
const stopTrackingVerified = () => react_native_1.NativeModules.RNRadar.stopTrackingVerified();
|
|
52
52
|
const isTracking = () => react_native_1.NativeModules.RNRadar.isTracking();
|
|
53
|
+
const isTrackingVerified = () => react_native_1.NativeModules.RNRadar.isTrackingVerified();
|
|
54
|
+
const setProduct = (product) => react_native_1.NativeModules.RNRadar.setProduct(product);
|
|
53
55
|
const getTrackingOptions = () => react_native_1.NativeModules.RNRadar.getTrackingOptions();
|
|
54
56
|
const isUsingRemoteTrackingOptions = () => react_native_1.NativeModules.RNRadar.isUsingRemoteTrackingOptions();
|
|
55
57
|
const setForegroundServiceOptions = (options) => react_native_1.NativeModules.RNRadar.setForegroundServiceOptions(options);
|
|
@@ -100,6 +102,8 @@ const Radar = {
|
|
|
100
102
|
getLocation,
|
|
101
103
|
trackOnce,
|
|
102
104
|
trackVerified,
|
|
105
|
+
isTrackingVerified,
|
|
106
|
+
setProduct,
|
|
103
107
|
getVerifiedLocationToken,
|
|
104
108
|
clearVerifiedLocationToken,
|
|
105
109
|
startTrackingEfficient,
|
package/ios/Cartfile.resolved
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
github "radarlabs/radar-sdk-ios" "3.
|
|
1
|
+
github "radarlabs/radar-sdk-ios" "3.21.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.
|
|
105
|
+
[[NSUserDefaults standardUserDefaults] setObject:@"3.20.1-beta.1" forKey:@"radar-xPlatformSDKVersion"];
|
|
106
106
|
[Radar initializeWithPublishableKey:publishableKey];
|
|
107
107
|
}
|
|
108
108
|
|
|
@@ -194,6 +194,10 @@ RCT_EXPORT_METHOD(requestPermissions:(BOOL)background resolve:(RCTPromiseResolve
|
|
|
194
194
|
CLAuthorizationStatus status = [CLLocationManager authorizationStatus];
|
|
195
195
|
if (background && status == kCLAuthorizationStatusAuthorizedWhenInUse) {
|
|
196
196
|
[locationManager requestAlwaysAuthorization];
|
|
197
|
+
[[NSNotificationCenter defaultCenter] addObserver:self
|
|
198
|
+
selector:@selector(handleAppBecomingActive)
|
|
199
|
+
name:UIApplicationDidBecomeActiveNotification
|
|
200
|
+
object:nil];
|
|
197
201
|
} else if (status == kCLAuthorizationStatusNotDetermined) {
|
|
198
202
|
[locationManager requestWhenInUseAuthorization];
|
|
199
203
|
} else {
|
|
@@ -201,6 +205,15 @@ RCT_EXPORT_METHOD(requestPermissions:(BOOL)background resolve:(RCTPromiseResolve
|
|
|
201
205
|
}
|
|
202
206
|
}
|
|
203
207
|
|
|
208
|
+
- (void)handleAppBecomingActive
|
|
209
|
+
{
|
|
210
|
+
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
|
211
|
+
if (permissionsRequestResolver) {
|
|
212
|
+
[self getPermissionsStatusWithResolver:permissionsRequestResolver rejecter:nil];
|
|
213
|
+
permissionsRequestResolver = nil;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
|
|
204
217
|
RCT_EXPORT_METHOD(getLocation:(NSString *)desiredAccuracy resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject) {
|
|
205
218
|
__block RCTPromiseResolveBlock resolver = resolve;
|
|
206
219
|
__block RCTPromiseRejectBlock rejecter = reject;
|
|
@@ -349,6 +362,15 @@ RCT_EXPORT_METHOD(trackVerified:(NSDictionary *)optionsDict resolve:(RCTPromiseR
|
|
|
349
362
|
[Radar trackVerifiedWithBeacons:beacons desiredAccuracy:desiredAccuracy completionHandler:completionHandler];
|
|
350
363
|
}
|
|
351
364
|
|
|
365
|
+
RCT_EXPORT_METHOD(isTrackingVerified:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject) {
|
|
366
|
+
BOOL res = [Radar isTrackingVerified];
|
|
367
|
+
resolve(@(res));
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
RCT_EXPORT_METHOD(setProduct:(NSString *)product) {
|
|
371
|
+
[Radar setProduct:product];
|
|
372
|
+
}
|
|
373
|
+
|
|
352
374
|
RCT_EXPORT_METHOD(getVerifiedLocationToken:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject) {
|
|
353
375
|
__block RCTPromiseResolveBlock resolver = resolve;
|
|
354
376
|
__block RCTPromiseRejectBlock rejecter = reject;
|
|
@@ -720,6 +742,7 @@ RCT_EXPORT_METHOD(searchPlaces:(NSDictionary *)optionsDict resolve:(RCTPromiseRe
|
|
|
720
742
|
NSDictionary *chainMetadata = optionsDict[@"chainMetadata"];
|
|
721
743
|
NSArray *categories = optionsDict[@"categories"];
|
|
722
744
|
NSArray *groups = optionsDict[@"groups"];
|
|
745
|
+
NSArray *countryCodes = optionsDict[@"countryCodes"];
|
|
723
746
|
NSNumber *limitNumber = optionsDict[@"limit"];
|
|
724
747
|
int limit;
|
|
725
748
|
if (limitNumber != nil && [limitNumber isKindOfClass:[NSNumber class]]) {
|
|
@@ -750,9 +773,9 @@ RCT_EXPORT_METHOD(searchPlaces:(NSDictionary *)optionsDict resolve:(RCTPromiseRe
|
|
|
750
773
|
};
|
|
751
774
|
|
|
752
775
|
if (near) {
|
|
753
|
-
[Radar searchPlacesNear:near radius:radius chains:chains chainMetadata:chainMetadata categories:categories groups:groups limit:limit completionHandler:completionHandler];
|
|
776
|
+
[Radar searchPlacesNear:near radius:radius chains:chains chainMetadata:chainMetadata categories:categories groups:groups countryCodes:countryCodes limit:limit completionHandler:completionHandler];
|
|
754
777
|
} else {
|
|
755
|
-
[Radar searchPlacesWithRadius:radius chains:chains chainMetadata:chainMetadata categories:categories groups:groups limit:limit completionHandler:completionHandler];
|
|
778
|
+
[Radar searchPlacesWithRadius:radius chains:chains chainMetadata:chainMetadata categories:categories groups:groups countryCodes:countryCodes limit:limit completionHandler:completionHandler];
|
|
756
779
|
}
|
|
757
780
|
}
|
|
758
781
|
|
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.
|
|
6
|
+
"version": "3.20.1-beta.1",
|
|
7
7
|
"main": "dist/index.js",
|
|
8
8
|
"files": [
|
|
9
9
|
"/android",
|
package/plugin/build/types.d.ts
CHANGED
|
@@ -5,7 +5,8 @@ export interface RadarPluginProps {
|
|
|
5
5
|
iosNSLocationAlwaysAndWhenInUseUsageDescription?: string;
|
|
6
6
|
iosBackgroundMode?: boolean;
|
|
7
7
|
androidBackgroundPermission?: boolean;
|
|
8
|
-
|
|
8
|
+
androidForegroundService?: boolean;
|
|
9
|
+
androidActivityRecognition?: boolean;
|
|
9
10
|
addRadarSDKMotion?: boolean;
|
|
10
11
|
iosNSMotionUsageDescription?: string;
|
|
11
12
|
}
|
|
@@ -7,12 +7,8 @@ exports.withRadarAndroid = void 0;
|
|
|
7
7
|
const config_plugins_1 = require("expo/config-plugins");
|
|
8
8
|
const fs_1 = __importDefault(require("fs"));
|
|
9
9
|
const path_1 = __importDefault(require("path"));
|
|
10
|
-
const { addPermission } = config_plugins_1.AndroidConfig.Permissions;
|
|
11
10
|
const withRadarAndroid = (config, args) => {
|
|
12
|
-
config = (
|
|
13
|
-
config.modResults = await setCustomConfigAsync(config, config.modResults, args);
|
|
14
|
-
return config;
|
|
15
|
-
});
|
|
11
|
+
config = withAndroidPermissions(config, args);
|
|
16
12
|
config = (0, config_plugins_1.withDangerousMod)(config, [
|
|
17
13
|
"android",
|
|
18
14
|
async (config) => {
|
|
@@ -60,30 +56,19 @@ const withRadarAndroid = (config, args) => {
|
|
|
60
56
|
});
|
|
61
57
|
};
|
|
62
58
|
exports.withRadarAndroid = withRadarAndroid;
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
"android.permission.
|
|
75
|
-
|
|
76
|
-
}
|
|
77
|
-
if (!androidManifest.manifest["uses-permission"].some((e) => e["$"]["android:name"] === "android.permission.ACCESS_COARSE_LOCATION")) {
|
|
78
|
-
addPermission(androidManifest, "android.permission.ACCESS_COARSE_LOCATION");
|
|
79
|
-
}
|
|
80
|
-
if (!androidManifest.manifest["uses-permission"].some((e) => e["$"]["android:name"] === "android.permission.FOREGROUND_SERVICE")) {
|
|
81
|
-
addPermission(androidManifest, "android.permission.FOREGROUND_SERVICE");
|
|
82
|
-
}
|
|
83
|
-
if (!androidManifest.manifest["uses-permission"].some((e) => e["$"]["android:name"] === "android.permission.ACTIVITY_RECOGNITION")) {
|
|
84
|
-
addPermission(androidManifest, "android.permission.ACTIVITY_RECOGNITION");
|
|
85
|
-
}
|
|
86
|
-
return androidManifest;
|
|
59
|
+
function withAndroidPermissions(config, args) {
|
|
60
|
+
const isAndroidBackgroundLocationEnabled = !!args.androidBackgroundPermission;
|
|
61
|
+
const enableAndroidForegroundService = !!args.androidForegroundService;
|
|
62
|
+
const enableAndroidActivityRecognition = !!args.androidActivityRecognition;
|
|
63
|
+
return config_plugins_1.AndroidConfig.Permissions.withPermissions(config, [
|
|
64
|
+
isAndroidBackgroundLocationEnabled &&
|
|
65
|
+
"android.permission.ACCESS_BACKGROUND_LOCATION",
|
|
66
|
+
enableAndroidForegroundService && "android.permission.FOREGROUND_SERVICE",
|
|
67
|
+
enableAndroidForegroundService &&
|
|
68
|
+
"android.permission.FOREGROUND_SERVICE_LOCATION",
|
|
69
|
+
enableAndroidActivityRecognition &&
|
|
70
|
+
"android.permission.ACTIVITY_RECOGNITION",
|
|
71
|
+
].filter(Boolean));
|
|
87
72
|
}
|
|
88
73
|
function modifyAppBuildGradle(buildGradle, androidFraud) {
|
|
89
74
|
let hasLocationService = false;
|
|
@@ -96,7 +81,10 @@ function modifyAppBuildGradle(buildGradle, androidFraud) {
|
|
|
96
81
|
}
|
|
97
82
|
const pattern = /^dependencies {/m;
|
|
98
83
|
if (!buildGradle.match(pattern)) {
|
|
99
|
-
|
|
84
|
+
throw new Error(`Failed to find react.gradle script in android/app/build.gradle.
|
|
85
|
+
This is required for react-native-radar to function properly.
|
|
86
|
+
Please ensure your android/app/build.gradle includes the react.gradle script.
|
|
87
|
+
Current build.gradle content: ${buildGradle}`);
|
|
100
88
|
}
|
|
101
89
|
let replacementString = "\n\n" +
|
|
102
90
|
(!hasLocationService
|
|
@@ -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.
|
|
54
|
+
if (contents.indexOf("pod 'RadarSDKMotion', '3.21.1'") === -1) {
|
|
55
55
|
// Find the target block
|
|
56
56
|
const targetRegex = /target '(\w+)' do/g;
|
|
57
57
|
const match = targetRegex.exec(contents);
|
|
@@ -60,7 +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.
|
|
63
|
+
const updatedTargetBlock = targetBlock.replace(/(target '(\w+)' do)/, `$1\n pod 'RadarSDKMotion', '3.21.1'`);
|
|
64
64
|
const newContents = contents.replace(targetBlock, updatedTargetBlock);
|
|
65
65
|
// Write the updated contents back to the Podfile
|
|
66
66
|
await promises_1.default.writeFile(filePath, newContents);
|