react-native-radar 3.15.0 → 3.17.0
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/README.md +10 -0
- package/android/build.gradle +2 -2
- package/android/src/main/java/io/radar/react/RNRadarModule.java +20 -8
- package/app.plugin.js +1 -0
- package/dist/{src/ui → ui}/autocomplete.d.ts +2 -1
- package/dist/{src/ui → ui}/autocomplete.js +1 -1
- package/dist/{src/ui → ui}/map.d.ts +2 -1
- package/ios/Cartfile.resolved +1 -1
- package/ios/RNRadar.m +13 -5
- package/package.json +18 -11
- package/plugin/build/index.d.ts +3 -0
- package/plugin/build/index.js +6 -0
- package/plugin/build/types.d.ts +11 -0
- package/plugin/build/types.js +2 -0
- package/plugin/build/withRadar.d.ts +4 -0
- package/plugin/build/withRadar.js +26 -0
- package/plugin/build/withRadarAndroid.d.ts +3 -0
- package/plugin/build/withRadarAndroid.js +110 -0
- package/plugin/build/withRadarIOS.d.ts +3 -0
- package/plugin/build/withRadarIOS.js +75 -0
- package/react-native-radar.podspec +1 -1
- package/dist/package.json +0 -84
- package/src/@types/RadarNativeInterface.ts +0 -106
- package/src/@types/types.ts +0 -784
- package/src/helpers.js +0 -15
- package/src/index.native.ts +0 -298
- package/src/index.ts +0 -22
- package/src/index.web.js +0 -410
- package/src/ui/autocomplete.jsx +0 -323
- package/src/ui/back.png +0 -0
- package/src/ui/close.png +0 -0
- package/src/ui/images.js +0 -5
- package/src/ui/map-logo.png +0 -0
- package/src/ui/map.jsx +0 -122
- package/src/ui/marker.png +0 -0
- package/src/ui/radar-logo.png +0 -0
- package/src/ui/search.png +0 -0
- package/src/ui/styles.js +0 -125
- /package/dist/{src/@types → @types}/RadarNativeInterface.d.ts +0 -0
- /package/dist/{src/@types → @types}/RadarNativeInterface.js +0 -0
- /package/dist/{src/@types → @types}/types.d.ts +0 -0
- /package/dist/{src/@types → @types}/types.js +0 -0
- /package/dist/{src/helpers.d.ts → helpers.d.ts} +0 -0
- /package/dist/{src/helpers.js → helpers.js} +0 -0
- /package/dist/{src/index.d.ts → index.d.ts} +0 -0
- /package/dist/{src/index.js → index.js} +0 -0
- /package/dist/{src/index.native.d.ts → index.native.d.ts} +0 -0
- /package/dist/{src/index.native.js → index.native.js} +0 -0
- /package/dist/{src/index.web.d.ts → index.web.d.ts} +0 -0
- /package/dist/{src/index.web.js → index.web.js} +0 -0
- /package/dist/{src/ui → ui}/back.png +0 -0
- /package/dist/{src/ui → ui}/close.png +0 -0
- /package/dist/{src/ui → ui}/images.d.ts +0 -0
- /package/dist/{src/ui → ui}/images.js +0 -0
- /package/dist/{src/ui → ui}/map-logo.png +0 -0
- /package/dist/{src/ui → ui}/map.js +0 -0
- /package/dist/{src/ui → ui}/marker.png +0 -0
- /package/dist/{src/ui → ui}/radar-logo.png +0 -0
- /package/dist/{src/ui → ui}/search.png +0 -0
- /package/dist/{src/ui → ui}/styles.d.ts +0 -0
- /package/dist/{src/ui → ui}/styles.js +0 -0
package/README.md
CHANGED
|
@@ -18,6 +18,16 @@ See an example app in `example/`.
|
|
|
18
18
|
|
|
19
19
|
Setup Radar public key check pre-commit hook with `cp -r hooks .git` to prevent accidental key leak when working with the Example app.
|
|
20
20
|
|
|
21
|
+
To run example app with local `react-native-radar` dependency:
|
|
22
|
+
|
|
23
|
+
- install node dependencies with `npm ci` and typescript if needed with `npm install -g typescript`.
|
|
24
|
+
- build local `react-native-radar` with `npm run build-all`.
|
|
25
|
+
- navigate to the example dir with `cd example`.
|
|
26
|
+
- install node dependency of example with `npm ci`.
|
|
27
|
+
- build native app using expo pre-build and `react-native-plugin` with `npm run install-radar-rebuild`.
|
|
28
|
+
- run iOS and android example app with `npx expo run:ios` or `npx expo run:android`.
|
|
29
|
+
|
|
30
|
+
|
|
21
31
|
## Support
|
|
22
32
|
|
|
23
33
|
Have questions? We're here to help! Email us at [support@radar.com](mailto:support@radar.com).
|
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.
|
|
21
|
+
versionName '3.17.0'
|
|
22
22
|
}
|
|
23
23
|
lintOptions {
|
|
24
24
|
abortOnError false
|
|
@@ -45,6 +45,6 @@ repositories {
|
|
|
45
45
|
|
|
46
46
|
dependencies {
|
|
47
47
|
api 'com.facebook.react:react-native:+'
|
|
48
|
-
api 'io.radar:sdk:3.
|
|
48
|
+
api 'io.radar:sdk:3.17.1'
|
|
49
49
|
}
|
|
50
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.
|
|
99
|
+
editor.putString("x_platform_sdk_version", "3.17.0");
|
|
100
100
|
editor.apply();
|
|
101
101
|
if (fraud) {
|
|
102
102
|
Radar.initialize(getReactApplicationContext(), publishableKey, receiver, Radar.RadarLocationServicesProvider.GOOGLE, fraud);
|
|
@@ -971,19 +971,31 @@ public class RNRadarModule extends ReactContextBaseJavaModule implements Permiss
|
|
|
971
971
|
return;
|
|
972
972
|
}
|
|
973
973
|
|
|
974
|
-
if (!optionsMap.hasKey("query")
|
|
974
|
+
if (!optionsMap.hasKey("query")) {
|
|
975
975
|
promise.reject(Radar.RadarStatus.ERROR_BAD_REQUEST.toString(), Radar.RadarStatus.ERROR_BAD_REQUEST.toString());
|
|
976
976
|
|
|
977
977
|
return;
|
|
978
978
|
}
|
|
979
979
|
|
|
980
980
|
String query = optionsMap.getString("query");
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
981
|
+
Location near = null;
|
|
982
|
+
|
|
983
|
+
if (optionsMap.hasKey("near")) {
|
|
984
|
+
ReadableMap nearMap = optionsMap.getMap("near");
|
|
985
|
+
if (nearMap != null && nearMap.hasKey("latitude") && nearMap.hasKey("longitude")) {
|
|
986
|
+
try {
|
|
987
|
+
double latitude = nearMap.getDouble("latitude");
|
|
988
|
+
double longitude = nearMap.getDouble("longitude");
|
|
989
|
+
near = new Location("RNRadarModule");
|
|
990
|
+
near.setLatitude(latitude);
|
|
991
|
+
near.setLongitude(longitude);
|
|
992
|
+
} catch (Exception e) {
|
|
993
|
+
promise.reject(Radar.RadarStatus.ERROR_BAD_REQUEST.toString(), "Invalid near coordinates");
|
|
994
|
+
return;
|
|
995
|
+
}
|
|
996
|
+
}
|
|
997
|
+
}
|
|
998
|
+
|
|
987
999
|
int limit = optionsMap.hasKey("limit") ? optionsMap.getInt("limit") : 10;
|
|
988
1000
|
String country = optionsMap.hasKey("countryCode") ? optionsMap.getString("countryCode") : optionsMap.hasKey("country") ? optionsMap.getString("country") : null;
|
|
989
1001
|
String[] layers = optionsMap.hasKey("layers") ? RNRadarUtils.stringArrayForArray(optionsMap.getArray("layers")) : null;
|
package/app.plugin.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('./plugin/build');
|
|
@@ -174,7 +174,7 @@ const autocompleteUI = ({ options = {} }) => {
|
|
|
174
174
|
<react_native_1.Modal animationType="slide" transparent={false} visible={isOpen} onRequestClose={() => setIsOpen(false)}>
|
|
175
175
|
<react_native_1.Animated.View style={{ flex: 1, opacity: modalOpacity }}>
|
|
176
176
|
<react_native_1.SafeAreaView>
|
|
177
|
-
<react_native_1.KeyboardAvoidingView behavior={Platform.OS === "ios" ? "padding" : "height"} keyboardVerticalOffset={50} style={styles.container}>
|
|
177
|
+
<react_native_1.KeyboardAvoidingView behavior={react_native_1.Platform.OS === "ios" ? "padding" : "height"} keyboardVerticalOffset={50} style={styles.container}>
|
|
178
178
|
<react_native_1.View style={styles.modalInputContainer}>
|
|
179
179
|
<react_native_1.TouchableOpacity onPress={() => {
|
|
180
180
|
setIsOpen(false);
|
package/ios/Cartfile.resolved
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
github "radarlabs/radar-sdk-ios" "3.
|
|
1
|
+
github "radarlabs/radar-sdk-ios" "3.17.0"
|
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.17.0" forKey:@"radar-xPlatformSDKVersion"];
|
|
106
106
|
[Radar initializeWithPublishableKey:publishableKey];
|
|
107
107
|
}
|
|
108
108
|
|
|
@@ -818,10 +818,18 @@ RCT_EXPORT_METHOD(autocomplete:(NSDictionary *)optionsDict resolve:(RCTPromiseRe
|
|
|
818
818
|
NSDictionary *nearDict = optionsDict[@"near"];
|
|
819
819
|
CLLocation *near = nil;
|
|
820
820
|
if (nearDict && [nearDict isKindOfClass:[NSDictionary class]]) {
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
821
|
+
id latitudeObj = nearDict[@"latitude"];
|
|
822
|
+
id longitudeObj = nearDict[@"longitude"];
|
|
823
|
+
|
|
824
|
+
if (latitudeObj && longitudeObj &&
|
|
825
|
+
[latitudeObj isKindOfClass:[NSNumber class]] &&
|
|
826
|
+
[longitudeObj isKindOfClass:[NSNumber class]]) {
|
|
827
|
+
|
|
828
|
+
double latitude = [RCTConvert double:latitudeObj];
|
|
829
|
+
double longitude = [RCTConvert double:longitudeObj];
|
|
830
|
+
NSDate *timestamp = [NSDate new];
|
|
831
|
+
near = [[CLLocation alloc] initWithCoordinate:CLLocationCoordinate2DMake(latitude, longitude) altitude:-1 horizontalAccuracy:5 verticalAccuracy:-1 timestamp:timestamp];
|
|
832
|
+
}
|
|
825
833
|
}
|
|
826
834
|
|
|
827
835
|
|
package/package.json
CHANGED
|
@@ -3,23 +3,26 @@
|
|
|
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.
|
|
7
|
-
"main": "dist/
|
|
6
|
+
"version": "3.17.0",
|
|
7
|
+
"main": "dist/index.js",
|
|
8
8
|
"files": [
|
|
9
|
-
"android",
|
|
10
|
-
"ios",
|
|
11
|
-
"src",
|
|
9
|
+
"/android",
|
|
10
|
+
"/ios",
|
|
12
11
|
"README.md",
|
|
13
12
|
"react-native-radar.podspec",
|
|
14
|
-
"/dist"
|
|
13
|
+
"/dist",
|
|
14
|
+
"app.plugin.js",
|
|
15
|
+
"/plugin/build"
|
|
15
16
|
],
|
|
16
|
-
"types":"dist/
|
|
17
|
+
"types": "dist/index.d.ts",
|
|
17
18
|
"scripts": {
|
|
18
19
|
"test": "jest ./test/*.test.js",
|
|
19
20
|
"check-latest-tag": "node ./scripts/check-latest-tag.cjs",
|
|
20
21
|
"check-beta-tag": "node ./scripts/check-beta-tag.cjs",
|
|
21
22
|
"build": "tsc",
|
|
22
|
-
"copy-assets": "./copyAssets.sh"
|
|
23
|
+
"copy-assets": "./copyAssets.sh",
|
|
24
|
+
"build-plugin": "tsc --build plugin/",
|
|
25
|
+
"build-all": "npm run build && npm run build-plugin && npm run copy-assets"
|
|
23
26
|
},
|
|
24
27
|
"jest": {
|
|
25
28
|
"preset": "react-native",
|
|
@@ -34,13 +37,17 @@
|
|
|
34
37
|
]
|
|
35
38
|
},
|
|
36
39
|
"peerDependencies": {
|
|
37
|
-
"@maplibre/maplibre-react-native": "
|
|
40
|
+
"@maplibre/maplibre-react-native": ">=9.0.1 || >=10.0.0-alpha",
|
|
41
|
+
"expo": ">=43.0.5",
|
|
38
42
|
"react": ">= 16.8.6",
|
|
39
43
|
"react-native": ">= 0.60.0"
|
|
40
44
|
},
|
|
41
45
|
"peerDependenciesMeta": {
|
|
42
46
|
"@maplibre/maplibre-react-native": {
|
|
43
47
|
"optional": true
|
|
48
|
+
},
|
|
49
|
+
"expo": {
|
|
50
|
+
"optional": true
|
|
44
51
|
}
|
|
45
52
|
},
|
|
46
53
|
"devDependencies": {
|
|
@@ -48,8 +55,6 @@
|
|
|
48
55
|
"@babel/preset-env": "^7.2.3",
|
|
49
56
|
"@babel/preset-react": "^7.0.0",
|
|
50
57
|
"@babel/register": "^7.0.0",
|
|
51
|
-
"@types/node": "^20.11.7",
|
|
52
|
-
"@types/react-native": "^0.73.0",
|
|
53
58
|
"babel-core": "^7.0.0-bridge.0",
|
|
54
59
|
"babel-eslint": "^10.0.1",
|
|
55
60
|
"babel-jest": "^23.4.2",
|
|
@@ -60,6 +65,8 @@
|
|
|
60
65
|
"eslint-plugin-jest": "^22.1.2",
|
|
61
66
|
"eslint-plugin-jsx-a11y": "^6.1.1",
|
|
62
67
|
"eslint-plugin-react": "^7.11.1",
|
|
68
|
+
"expo": "^47.0.0",
|
|
69
|
+
"expo-module-scripts": "^3.4.1",
|
|
63
70
|
"jest": "^23.6.0",
|
|
64
71
|
"jest-junit": "^5.2.0",
|
|
65
72
|
"logkitty": ">=0.7.1",
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.withRadar = void 0;
|
|
4
|
+
const withRadar_1 = require("./withRadar");
|
|
5
|
+
Object.defineProperty(exports, "withRadar", { enumerable: true, get: function () { return withRadar_1.withRadar; } });
|
|
6
|
+
exports.default = withRadar_1.withRadar;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface RadarPluginProps {
|
|
2
|
+
iosFraud?: boolean;
|
|
3
|
+
androidFraud?: boolean;
|
|
4
|
+
iosNSLocationWhenInUseUsageDescription?: string;
|
|
5
|
+
iosNSLocationAlwaysAndWhenInUseUsageDescription?: string;
|
|
6
|
+
iosBackgroundMode?: boolean;
|
|
7
|
+
androidBackgroundPermission?: boolean;
|
|
8
|
+
androidFineLocationPermission?: boolean;
|
|
9
|
+
addRadarSDKMotion?: boolean;
|
|
10
|
+
iosNSMotionUsageDescription?: string;
|
|
11
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.withRadar = void 0;
|
|
4
|
+
const config_plugins_1 = require("expo/config-plugins");
|
|
5
|
+
const withRadarAndroid_1 = require("./withRadarAndroid");
|
|
6
|
+
const withRadarIOS_1 = require("./withRadarIOS");
|
|
7
|
+
const pkg = require("../../package.json");
|
|
8
|
+
const withRadarPlugin = (config, args = {}) => {
|
|
9
|
+
try {
|
|
10
|
+
config = (0, withRadarAndroid_1.withRadarAndroid)(config, args);
|
|
11
|
+
}
|
|
12
|
+
catch (e) {
|
|
13
|
+
config_plugins_1.WarningAggregator.addWarningAndroid("react-native-radar", "There was a problem configuring react-native-radar in your native Android project: " +
|
|
14
|
+
e);
|
|
15
|
+
}
|
|
16
|
+
try {
|
|
17
|
+
config = (0, withRadarIOS_1.withRadarIOS)(config, args);
|
|
18
|
+
}
|
|
19
|
+
catch (e) {
|
|
20
|
+
config_plugins_1.WarningAggregator.addWarningIOS("react-native-radar", "There was a problem configuring react-native-radar in your native iOS project: " +
|
|
21
|
+
e);
|
|
22
|
+
}
|
|
23
|
+
return config;
|
|
24
|
+
};
|
|
25
|
+
const withRadar = (0, config_plugins_1.createRunOncePlugin)(withRadarPlugin, pkg.name, pkg.version);
|
|
26
|
+
exports.withRadar = withRadar;
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.withRadarAndroid = void 0;
|
|
7
|
+
const config_plugins_1 = require("expo/config-plugins");
|
|
8
|
+
const fs_1 = __importDefault(require("fs"));
|
|
9
|
+
const path_1 = __importDefault(require("path"));
|
|
10
|
+
const { addPermission } = config_plugins_1.AndroidConfig.Permissions;
|
|
11
|
+
const withRadarAndroid = (config, args) => {
|
|
12
|
+
config = (0, config_plugins_1.withAndroidManifest)(config, async (config) => {
|
|
13
|
+
config.modResults = await setCustomConfigAsync(config, config.modResults, args);
|
|
14
|
+
return config;
|
|
15
|
+
});
|
|
16
|
+
config = (0, config_plugins_1.withDangerousMod)(config, [
|
|
17
|
+
"android",
|
|
18
|
+
async (config) => {
|
|
19
|
+
if (!args.androidFraud) {
|
|
20
|
+
return config;
|
|
21
|
+
}
|
|
22
|
+
// Get the path to the Android folder
|
|
23
|
+
const androidPath = path_1.default.join(config.modRequest.projectRoot, "android", "app", "src", "main", "res", "xml");
|
|
24
|
+
// Check if the directory exists, if not, create it
|
|
25
|
+
if (!fs_1.default.existsSync(androidPath)) {
|
|
26
|
+
fs_1.default.mkdirSync(androidPath, { recursive: true });
|
|
27
|
+
}
|
|
28
|
+
// Create the path to the new file
|
|
29
|
+
const newFilePath = path_1.default.join(androidPath, "network_security_config.xml");
|
|
30
|
+
// Define xml content
|
|
31
|
+
const xml = `<?xml version="1.0" encoding="utf-8"?>
|
|
32
|
+
<network-security-config>
|
|
33
|
+
<!-- for React Native -->
|
|
34
|
+
<domain-config cleartextTrafficPermitted="true">
|
|
35
|
+
<domain includeSubdomains="true">localhost</domain>
|
|
36
|
+
</domain-config>
|
|
37
|
+
|
|
38
|
+
<!-- for SSL pinning -->
|
|
39
|
+
<domain-config cleartextTrafficPermitted="false">
|
|
40
|
+
<domain includeSubdomains="true">api-verified.radar.io</domain>
|
|
41
|
+
<pin-set>
|
|
42
|
+
<pin digest="SHA-256">15ktYXSSU2llpy7YyCgeqUKDBkjcimK/weUcec960sI=</pin>
|
|
43
|
+
<pin digest="SHA-256">15ktYXSSU2llpy7YyCgeqUKDBkjcimK/weUcec960sI=</pin>
|
|
44
|
+
</pin-set>
|
|
45
|
+
</domain-config>
|
|
46
|
+
</network-security-config>`;
|
|
47
|
+
// Write to the new file
|
|
48
|
+
fs_1.default.writeFileSync(newFilePath, xml);
|
|
49
|
+
return config;
|
|
50
|
+
},
|
|
51
|
+
]);
|
|
52
|
+
return (0, config_plugins_1.withAppBuildGradle)(config, (config) => {
|
|
53
|
+
if (config.modResults.language === "groovy") {
|
|
54
|
+
config.modResults.contents = modifyAppBuildGradle(config.modResults.contents, args.androidFraud ?? false);
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
throw new Error("Cannot configure Sentry in the app gradle because the build.gradle is not groovy");
|
|
58
|
+
}
|
|
59
|
+
return config;
|
|
60
|
+
});
|
|
61
|
+
};
|
|
62
|
+
exports.withRadarAndroid = withRadarAndroid;
|
|
63
|
+
async function setCustomConfigAsync(config, androidManifest, args) {
|
|
64
|
+
if (!androidManifest.manifest["uses-permission"]) {
|
|
65
|
+
androidManifest.manifest["uses-permission"] = [];
|
|
66
|
+
}
|
|
67
|
+
// Add permissions
|
|
68
|
+
if (args.androidFineLocationPermission &&
|
|
69
|
+
!androidManifest.manifest["uses-permission"].some((e) => e["$"]["android:name"] === "android.permission.ACCESS_FINE_LOCATION")) {
|
|
70
|
+
addPermission(androidManifest, "android.permission.ACCESS_FINE_LOCATION");
|
|
71
|
+
}
|
|
72
|
+
if (args.androidBackgroundPermission &&
|
|
73
|
+
!androidManifest.manifest["uses-permission"].some((e) => e["$"]["android:name"] ===
|
|
74
|
+
"android.permission.ACCESS_BACKGROUND_LOCATION")) {
|
|
75
|
+
addPermission(androidManifest, "android.permission.ACCESS_BACKGROUND_LOCATION");
|
|
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;
|
|
87
|
+
}
|
|
88
|
+
function modifyAppBuildGradle(buildGradle, androidFraud) {
|
|
89
|
+
let hasLocationService = false;
|
|
90
|
+
let hasPlayIntegrity = false;
|
|
91
|
+
if (buildGradle.includes('com.google.android.gms:play-services-location:21.0.1"')) {
|
|
92
|
+
hasLocationService = true;
|
|
93
|
+
}
|
|
94
|
+
if (buildGradle.includes('com.google.android.play:integrity:1.2.0"')) {
|
|
95
|
+
hasPlayIntegrity = true;
|
|
96
|
+
}
|
|
97
|
+
const pattern = /^dependencies {/m;
|
|
98
|
+
if (!buildGradle.match(pattern)) {
|
|
99
|
+
config_plugins_1.WarningAggregator.addWarningAndroid("react-native-radar", "Could not find react.gradle script in android/app/build.gradle.");
|
|
100
|
+
}
|
|
101
|
+
let replacementString = "\n\n" +
|
|
102
|
+
(!hasLocationService
|
|
103
|
+
? ' implementation "com.google.android.gms:play-services-location:21.0.1"'
|
|
104
|
+
: "");
|
|
105
|
+
if (androidFraud && !hasPlayIntegrity) {
|
|
106
|
+
replacementString +=
|
|
107
|
+
"\n\n" + ' implementation "com.google.android.play:integrity:1.2.0"';
|
|
108
|
+
}
|
|
109
|
+
return buildGradle.replace(pattern, (match) => match + replacementString);
|
|
110
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.withRadarIOS = void 0;
|
|
7
|
+
const config_plugins_1 = require("expo/config-plugins");
|
|
8
|
+
const promises_1 = __importDefault(require("fs/promises"));
|
|
9
|
+
const path_1 = __importDefault(require("path"));
|
|
10
|
+
const withRadarIOS = (config, args) => {
|
|
11
|
+
config = (0, config_plugins_1.withInfoPlist)(config, (config) => {
|
|
12
|
+
config.modResults.NSLocationWhenInUseUsageDescription =
|
|
13
|
+
args.iosNSLocationWhenInUseUsageDescription ??
|
|
14
|
+
"This app uses the location service to provide location-based services.";
|
|
15
|
+
if (args.iosNSLocationAlwaysAndWhenInUseUsageDescription) {
|
|
16
|
+
config.modResults.NSLocationAlwaysAndWhenInUseUsageDescription =
|
|
17
|
+
args.iosNSLocationAlwaysAndWhenInUseUsageDescription;
|
|
18
|
+
}
|
|
19
|
+
if (args.iosBackgroundMode) {
|
|
20
|
+
config.modResults.UIBackgroundModes = ["location", "fetch"];
|
|
21
|
+
}
|
|
22
|
+
if (args.iosFraud) {
|
|
23
|
+
config.modResults.NSAppTransportSecurity = {
|
|
24
|
+
NSAllowsArbitraryLoads: false,
|
|
25
|
+
NSPinnedDomains: {
|
|
26
|
+
"api-verified.radar.io": {
|
|
27
|
+
NSIncludesSubdomains: true,
|
|
28
|
+
NSPinnedLeafIdentities: [
|
|
29
|
+
{
|
|
30
|
+
"SPKI-SHA256-BASE64": "15ktYXSSU2llpy7YyCgeqUKDBkjcimK/weUcec960sI=",
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"SPKI-SHA256-BASE64": "15ktYXSSU2llpy7YyCgeqUKDBkjcimK/weUcec960sI=",
|
|
34
|
+
},
|
|
35
|
+
],
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
if (args.addRadarSDKMotion) {
|
|
41
|
+
config.modResults.NSMotionUsageDescription =
|
|
42
|
+
args.iosNSMotionUsageDescription ??
|
|
43
|
+
"This app uses the motion service to provide motion-based services.";
|
|
44
|
+
}
|
|
45
|
+
return config;
|
|
46
|
+
});
|
|
47
|
+
if (args.addRadarSDKMotion) {
|
|
48
|
+
config = (0, config_plugins_1.withDangerousMod)(config, [
|
|
49
|
+
'ios',
|
|
50
|
+
async (config) => {
|
|
51
|
+
const filePath = path_1.default.join(config.modRequest.platformProjectRoot, 'Podfile');
|
|
52
|
+
const contents = await promises_1.default.readFile(filePath, 'utf-8');
|
|
53
|
+
// Check if the pod declaration already exists
|
|
54
|
+
if (contents.indexOf("pod 'RadarSDKMotion', '3.17.0'") === -1) {
|
|
55
|
+
// Find the target block
|
|
56
|
+
const targetRegex = /target '(\w+)' do/g;
|
|
57
|
+
const match = targetRegex.exec(contents);
|
|
58
|
+
if (match) {
|
|
59
|
+
const targetStartIndex = match.index;
|
|
60
|
+
const targetEndIndex = contents.indexOf('end', targetStartIndex) + 3;
|
|
61
|
+
// Insert the pod declaration within the target block
|
|
62
|
+
const targetBlock = contents.substring(targetStartIndex, targetEndIndex);
|
|
63
|
+
const updatedTargetBlock = targetBlock.replace(/(target '(\w+)' do)/, `$1\n pod 'RadarSDKMotion', '3.17.0'`);
|
|
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
|
+
return config;
|
|
74
|
+
};
|
|
75
|
+
exports.withRadarIOS = withRadarIOS;
|
package/dist/package.json
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "react-native-radar",
|
|
3
|
-
"description": "React Native module for Radar, the leading geofencing and location tracking platform",
|
|
4
|
-
"homepage": "https://radar.com",
|
|
5
|
-
"license": "Apache-2.0",
|
|
6
|
-
"version": "3.15.0",
|
|
7
|
-
"main": "dist/src/index.js",
|
|
8
|
-
"files": [
|
|
9
|
-
"android",
|
|
10
|
-
"ios",
|
|
11
|
-
"src",
|
|
12
|
-
"README.md",
|
|
13
|
-
"react-native-radar.podspec",
|
|
14
|
-
"/dist"
|
|
15
|
-
],
|
|
16
|
-
"types": "dist/src/index.d.ts",
|
|
17
|
-
"scripts": {
|
|
18
|
-
"test": "jest ./test/*.test.js",
|
|
19
|
-
"check-latest-tag": "node ./scripts/check-latest-tag.cjs",
|
|
20
|
-
"check-beta-tag": "node ./scripts/check-beta-tag.cjs",
|
|
21
|
-
"build": "tsc",
|
|
22
|
-
"copy-assets": "./copyAssets.sh"
|
|
23
|
-
},
|
|
24
|
-
"jest": {
|
|
25
|
-
"preset": "react-native",
|
|
26
|
-
"clearMocks": true,
|
|
27
|
-
"reporters": [
|
|
28
|
-
"default",
|
|
29
|
-
"jest-junit"
|
|
30
|
-
],
|
|
31
|
-
"modulePathIgnorePatterns": [
|
|
32
|
-
"example",
|
|
33
|
-
"example2"
|
|
34
|
-
]
|
|
35
|
-
},
|
|
36
|
-
"peerDependencies": {
|
|
37
|
-
"@maplibre/maplibre-react-native": "^9.0.1",
|
|
38
|
-
"react": ">= 16.8.6",
|
|
39
|
-
"react-native": ">= 0.60.0"
|
|
40
|
-
},
|
|
41
|
-
"peerDependenciesMeta": {
|
|
42
|
-
"@maplibre/maplibre-react-native": {
|
|
43
|
-
"optional": true
|
|
44
|
-
}
|
|
45
|
-
},
|
|
46
|
-
"devDependencies": {
|
|
47
|
-
"@babel/core": "^7.2.2",
|
|
48
|
-
"@babel/preset-env": "^7.2.3",
|
|
49
|
-
"@babel/preset-react": "^7.0.0",
|
|
50
|
-
"@babel/register": "^7.0.0",
|
|
51
|
-
"@types/node": "^20.11.7",
|
|
52
|
-
"@types/react-native": "^0.73.0",
|
|
53
|
-
"babel-core": "^7.0.0-bridge.0",
|
|
54
|
-
"babel-eslint": "^10.0.1",
|
|
55
|
-
"babel-jest": "^23.4.2",
|
|
56
|
-
"braces": ">=2.3.2",
|
|
57
|
-
"eslint": "^5.6.1",
|
|
58
|
-
"eslint-config-airbnb": "^17.1.0",
|
|
59
|
-
"eslint-plugin-import": "^2.14.0",
|
|
60
|
-
"eslint-plugin-jest": "^22.1.2",
|
|
61
|
-
"eslint-plugin-jsx-a11y": "^6.1.1",
|
|
62
|
-
"eslint-plugin-react": "^7.11.1",
|
|
63
|
-
"jest": "^23.6.0",
|
|
64
|
-
"jest-junit": "^5.2.0",
|
|
65
|
-
"logkitty": ">=0.7.1",
|
|
66
|
-
"metro-react-native-babel-preset": "^0.51.1",
|
|
67
|
-
"npm-run-all": "^4.1.5",
|
|
68
|
-
"react": "16.8.6",
|
|
69
|
-
"react-native": "0.60.0",
|
|
70
|
-
"typescript": "^5.3.3"
|
|
71
|
-
},
|
|
72
|
-
"bugs": {
|
|
73
|
-
"url": "https://github.com/radarlabs/react-native-radar/issues"
|
|
74
|
-
},
|
|
75
|
-
"repository": {
|
|
76
|
-
"type": "git",
|
|
77
|
-
"url": "https://github.com/radarlabs/react-native-radar.git"
|
|
78
|
-
},
|
|
79
|
-
"dependencies": {
|
|
80
|
-
"@babel/runtime": "^7.21.0",
|
|
81
|
-
"@react-native-community/netinfo": "^7.1.3",
|
|
82
|
-
"radar-sdk-js": "^3.6.0"
|
|
83
|
-
}
|
|
84
|
-
}
|