react-native-radar 3.23.0-beta.2 → 3.23.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 +2 -0
- package/Radar.podspec +1 -1
- package/android/build.gradle +1 -1
- package/android/src/main/java/com/radar/RadarModuleImpl.java +20 -0
- package/android/src/main/java/com/radar/RadarUtils.java +12 -0
- package/android/src/newarch/java/com/radar/RadarModule.kt +23 -3
- package/android/src/oldarch/java/com/radar/RadarModule.java +26 -3
- package/dist/@types/RadarNativeInterface.d.ts +4 -0
- package/dist/@types/types.d.ts +1 -0
- package/dist/NativeRadar.d.ts +4 -0
- package/dist/index.native.js +12 -0
- package/dist/ui/map.js +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/ios/RNRadar.mm +17 -1
- package/package.json +2 -1
- package/plugin/build/withRadarIOS.js +2 -3
- package/src/@types/RadarNativeInterface.ts +4 -0
- package/src/@types/types.ts +1 -0
- package/src/NativeRadar.ts +4 -0
- package/src/index.native.ts +12 -0
- package/src/ui/map.jsx +1 -2
- package/src/version.ts +1 -1
package/README.md
CHANGED
|
@@ -18,6 +18,8 @@ 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
|
+
Android: compile with java 17
|
|
22
|
+
|
|
21
23
|
To run example app with local `react-native-radar` dependency:
|
|
22
24
|
|
|
23
25
|
- install node dependencies with `npm ci` and typescript if needed with `npm install -g typescript`.
|
package/Radar.podspec
CHANGED
package/android/build.gradle
CHANGED
|
@@ -129,6 +129,26 @@ public class RadarModuleImpl {
|
|
|
129
129
|
JSONObject metaJson = Radar.getMetadata();
|
|
130
130
|
promise.resolve(RadarUtils.mapForJson(metaJson));
|
|
131
131
|
}
|
|
132
|
+
|
|
133
|
+
public void setTags(ReadableArray tags) throws JSONException {
|
|
134
|
+
Radar.setTags(RadarUtils.stringArrayForArray(tags));
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
public void getTags(final Promise promise) throws JSONException {
|
|
138
|
+
if (promise == null) {
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
promise.resolve(RadarUtils.arrayForStringArray(Radar.getTags()));
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
public void addTags(ReadableArray tags) throws JSONException {
|
|
146
|
+
Radar.addTags(RadarUtils.stringArrayForArray(tags));
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
public void removeTags(ReadableArray tags) throws JSONException {
|
|
150
|
+
Radar.removeTags(RadarUtils.stringArrayForArray(tags));
|
|
151
|
+
}
|
|
132
152
|
|
|
133
153
|
public void setProduct(String product) {
|
|
134
154
|
Radar.setProduct(product);
|
|
@@ -150,6 +150,18 @@ public class RadarUtils {
|
|
|
150
150
|
}
|
|
151
151
|
return arr;
|
|
152
152
|
}
|
|
153
|
+
|
|
154
|
+
static ReadableArray arrayForStringArray(String[] arr) {
|
|
155
|
+
if (arr == null) {
|
|
156
|
+
return null;
|
|
157
|
+
}
|
|
158
|
+
WritableArray array = new WritableNativeArray();
|
|
159
|
+
for (String s : arr) {
|
|
160
|
+
array.pushString(s);
|
|
161
|
+
}
|
|
162
|
+
return array;
|
|
163
|
+
}
|
|
164
|
+
|
|
153
165
|
static Map<String, String> stringStringMap(ReadableMap readableMap) {
|
|
154
166
|
if (readableMap == null) {
|
|
155
167
|
return null;
|
|
@@ -31,6 +31,7 @@ import com.facebook.react.bridge.Arguments
|
|
|
31
31
|
import com.facebook.react.bridge.WritableMap
|
|
32
32
|
import com.facebook.react.bridge.Promise
|
|
33
33
|
import com.facebook.react.bridge.ReadableMap
|
|
34
|
+
import com.facebook.react.bridge.ReadableArray
|
|
34
35
|
import org.json.JSONException
|
|
35
36
|
|
|
36
37
|
@ReactModule(name = RadarModule.NAME)
|
|
@@ -104,13 +105,16 @@ class RadarModule(reactContext: ReactApplicationContext) :
|
|
|
104
105
|
override fun initialize(publishableKey: String, fraud: Boolean): Unit {
|
|
105
106
|
val editor = reactApplicationContext.getSharedPreferences("RadarSDK", Context.MODE_PRIVATE).edit()
|
|
106
107
|
editor.putString("x_platform_sdk_type", "ReactNative")
|
|
107
|
-
editor.putString("x_platform_sdk_version", "3.23.0
|
|
108
|
+
editor.putString("x_platform_sdk_version", "3.23.0")
|
|
108
109
|
editor.apply()
|
|
109
110
|
|
|
110
|
-
Radar.initialize(reactApplicationContext, publishableKey, null, Radar.RadarLocationServicesProvider.GOOGLE, fraud, null, currentActivity)
|
|
111
111
|
if (fraud) {
|
|
112
|
+
Radar.initialize(reactApplicationContext, publishableKey, radarReceiver, Radar.RadarLocationServicesProvider.GOOGLE, fraud)
|
|
112
113
|
Radar.setVerifiedReceiver(radarVerifiedReceiver)
|
|
113
|
-
}
|
|
114
|
+
} else {
|
|
115
|
+
Radar.initialize(reactApplicationContext, publishableKey)
|
|
116
|
+
Radar.setReceiver(radarReceiver)
|
|
117
|
+
}
|
|
114
118
|
}
|
|
115
119
|
|
|
116
120
|
override fun setLogLevel(level: String): Unit {
|
|
@@ -141,6 +145,22 @@ class RadarModule(reactContext: ReactApplicationContext) :
|
|
|
141
145
|
radarModuleImpl.getMetadata(promise)
|
|
142
146
|
}
|
|
143
147
|
|
|
148
|
+
override fun setTags(tags: ReadableArray): Unit {
|
|
149
|
+
radarModuleImpl.setTags(tags)
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
override fun getTags(promise: Promise): Unit {
|
|
153
|
+
radarModuleImpl.getTags(promise)
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
override fun addTags(tags: ReadableArray): Unit {
|
|
157
|
+
radarModuleImpl.addTags(tags)
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
override fun removeTags(tags: ReadableArray): Unit {
|
|
161
|
+
radarModuleImpl.removeTags(tags)
|
|
162
|
+
}
|
|
163
|
+
|
|
144
164
|
override fun setProduct(product: String): Unit {
|
|
145
165
|
radarModuleImpl.setProduct(product)
|
|
146
166
|
}
|
|
@@ -98,11 +98,14 @@ public class RadarModule extends ReactContextBaseJavaModule implements Permissio
|
|
|
98
98
|
this.fraud = fraud;
|
|
99
99
|
SharedPreferences.Editor editor = getReactApplicationContext().getSharedPreferences("RadarSDK", Context.MODE_PRIVATE).edit();
|
|
100
100
|
editor.putString("x_platform_sdk_type", "ReactNative");
|
|
101
|
-
editor.putString("x_platform_sdk_version", "3.23.0
|
|
101
|
+
editor.putString("x_platform_sdk_version", "3.23.0");
|
|
102
102
|
editor.apply();
|
|
103
|
-
|
|
104
|
-
|
|
103
|
+
if (fraud) {
|
|
104
|
+
Radar.initialize(getReactApplicationContext(), publishableKey, receiver, Radar.RadarLocationServicesProvider.GOOGLE, fraud);
|
|
105
105
|
Radar.setVerifiedReceiver(verifiedReceiver);
|
|
106
|
+
} else {
|
|
107
|
+
Radar.initialize(getReactApplicationContext(), publishableKey);
|
|
108
|
+
Radar.setReceiver(receiver);
|
|
106
109
|
}
|
|
107
110
|
}
|
|
108
111
|
|
|
@@ -146,6 +149,26 @@ public class RadarModule extends ReactContextBaseJavaModule implements Permissio
|
|
|
146
149
|
radarModuleImpl.getMetadata(promise);
|
|
147
150
|
}
|
|
148
151
|
|
|
152
|
+
@ReactMethod
|
|
153
|
+
public void setTags(ReadableArray tags) throws JSONException {
|
|
154
|
+
radarModuleImpl.setTags(tags);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
@ReactMethod
|
|
158
|
+
public void getTags(final Promise promise) throws JSONException {
|
|
159
|
+
radarModuleImpl.getTags(promise);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
@ReactMethod
|
|
163
|
+
public void addTags(ReadableArray tags) throws JSONException {
|
|
164
|
+
radarModuleImpl.addTags(tags);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
@ReactMethod
|
|
168
|
+
public void removeTags(ReadableArray tags) throws JSONException {
|
|
169
|
+
radarModuleImpl.removeTags(tags);
|
|
170
|
+
}
|
|
171
|
+
|
|
149
172
|
@ReactMethod
|
|
150
173
|
public void setAnonymousTrackingEnabled(boolean enabled) {
|
|
151
174
|
radarModuleImpl.setAnonymousTrackingEnabled(enabled);
|
|
@@ -8,6 +8,10 @@ export interface RadarNativeInterface {
|
|
|
8
8
|
getDescription: () => Promise<string>;
|
|
9
9
|
setMetadata: (metadata: RadarMetadata) => void;
|
|
10
10
|
getMetadata: () => Promise<RadarMetadata>;
|
|
11
|
+
setTags: (tags: string[]) => void;
|
|
12
|
+
getTags: () => Promise<string[]>;
|
|
13
|
+
addTags: (tags: string[]) => void;
|
|
14
|
+
removeTags: (tags: string[]) => void;
|
|
11
15
|
setProduct(product: string): void;
|
|
12
16
|
getProduct: () => Promise<string>;
|
|
13
17
|
setAnonymousTrackingEnabled: (enabled: boolean) => void;
|
package/dist/@types/types.d.ts
CHANGED
package/dist/NativeRadar.d.ts
CHANGED
|
@@ -34,6 +34,10 @@ export interface Spec extends TurboModule {
|
|
|
34
34
|
getDescription(): Promise<string>;
|
|
35
35
|
setMetadata(metadata: Object): void;
|
|
36
36
|
getMetadata(): Promise<Object>;
|
|
37
|
+
setTags(tags: Array<string>): void;
|
|
38
|
+
getTags(): Promise<Array<string>>;
|
|
39
|
+
addTags(tags: Array<string>): void;
|
|
40
|
+
removeTags(tags: Array<string>): void;
|
|
37
41
|
setProduct(product: string): void;
|
|
38
42
|
getProduct(): Promise<string>;
|
|
39
43
|
setAnonymousTrackingEnabled(enabled: boolean): void;
|
package/dist/index.native.js
CHANGED
|
@@ -169,6 +169,18 @@ const Radar = {
|
|
|
169
169
|
getMetadata: function () {
|
|
170
170
|
return NativeRadar.getMetadata();
|
|
171
171
|
},
|
|
172
|
+
setTags: function (tags) {
|
|
173
|
+
return NativeRadar.setTags(tags);
|
|
174
|
+
},
|
|
175
|
+
getTags: function () {
|
|
176
|
+
return NativeRadar.getTags();
|
|
177
|
+
},
|
|
178
|
+
addTags: function (tags) {
|
|
179
|
+
return NativeRadar.addTags(tags);
|
|
180
|
+
},
|
|
181
|
+
removeTags: function (tags) {
|
|
182
|
+
return NativeRadar.removeTags(tags);
|
|
183
|
+
},
|
|
172
184
|
setProduct: function (product) {
|
|
173
185
|
return NativeRadar.setProduct(product);
|
|
174
186
|
},
|
package/dist/ui/map.js
CHANGED
|
@@ -122,7 +122,7 @@ const RadarMap = ({ mapOptions, children }) => {
|
|
|
122
122
|
}}/>
|
|
123
123
|
</MapLibreGL.ShapeSource>);
|
|
124
124
|
return (<react_native_1.View style={styles_1.default.mapContainer}>
|
|
125
|
-
<MapLibreGL.MapView style={styles_1.default.map} pitchEnabled={false} compassEnabled={false} logoEnabled={false} attributionEnabled onRegionDidChange={(mapOptions === null || mapOptions === void 0 ? void 0 : mapOptions.onRegionDidChange) ? mapOptions.onRegionDidChange : null}
|
|
125
|
+
<MapLibreGL.MapView style={styles_1.default.map} pitchEnabled={false} compassEnabled={false} logoEnabled={false} attributionEnabled onRegionDidChange={(mapOptions === null || mapOptions === void 0 ? void 0 : mapOptions.onRegionDidChange) ? mapOptions.onRegionDidChange : null} mapStyle={styleURL}>
|
|
126
126
|
{userLocationMapIndicator}
|
|
127
127
|
{children}
|
|
128
128
|
</MapLibreGL.MapView>
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "3.23.0
|
|
1
|
+
export declare const VERSION = "3.23.0";
|
package/dist/version.js
CHANGED
|
@@ -3,4 +3,4 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.VERSION = void 0;
|
|
4
4
|
// This file contains the version of the react-native-radar package
|
|
5
5
|
// It should be updated to match the version in package.json
|
|
6
|
-
exports.VERSION = '3.23.0
|
|
6
|
+
exports.VERSION = '3.23.0';
|
package/ios/RNRadar.mm
CHANGED
|
@@ -139,7 +139,7 @@ RCT_EXPORT_MODULE()
|
|
|
139
139
|
|
|
140
140
|
RCT_EXPORT_METHOD(initialize:(NSString *)publishableKey fraud:(BOOL)fraud) {
|
|
141
141
|
[[NSUserDefaults standardUserDefaults] setObject:@"ReactNative" forKey:@"radar-xPlatformSDKType"];
|
|
142
|
-
[[NSUserDefaults standardUserDefaults] setObject:@"3.23.0
|
|
142
|
+
[[NSUserDefaults standardUserDefaults] setObject:@"3.23.0" forKey:@"radar-xPlatformSDKVersion"];
|
|
143
143
|
[Radar initializeWithPublishableKey:publishableKey];
|
|
144
144
|
}
|
|
145
145
|
|
|
@@ -183,6 +183,22 @@ RCT_EXPORT_METHOD(getMetadata:(RCTPromiseResolveBlock)resolve reject:(RCTPromise
|
|
|
183
183
|
resolve([Radar getMetadata]);
|
|
184
184
|
}
|
|
185
185
|
|
|
186
|
+
RCT_EXPORT_METHOD(setTags:(NSArray<NSString *> *)tags) {
|
|
187
|
+
[Radar setTags:tags];
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
RCT_EXPORT_METHOD(getTags:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject) {
|
|
191
|
+
resolve([Radar getTags]);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
RCT_EXPORT_METHOD(addTags:(NSArray<NSString *> *)tags) {
|
|
195
|
+
[Radar addTags:tags];
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
RCT_EXPORT_METHOD(removeTags:(NSArray<NSString *> *)tags) {
|
|
199
|
+
[Radar removeTags:tags];
|
|
200
|
+
}
|
|
201
|
+
|
|
186
202
|
RCT_EXPORT_METHOD(setProduct:(NSString *)product) {
|
|
187
203
|
[Radar setProduct:product];
|
|
188
204
|
}
|
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.23.0
|
|
6
|
+
"version": "3.23.0",
|
|
7
7
|
"main": "dist/index.js",
|
|
8
8
|
"files": [
|
|
9
9
|
"dist",
|
|
@@ -80,6 +80,7 @@
|
|
|
80
80
|
"@react-native/eslint-config": "^0.78.0",
|
|
81
81
|
"@release-it/conventional-changelog": "^9.0.2",
|
|
82
82
|
"@types/jest": "^29.5.5",
|
|
83
|
+
"@types/node": "^24.3.0",
|
|
83
84
|
"@types/react": "^19.0.0",
|
|
84
85
|
"commitlint": "^19.6.1",
|
|
85
86
|
"del-cli": "^5.1.0",
|
|
@@ -4,7 +4,6 @@ exports.withRadarIOS = void 0;
|
|
|
4
4
|
const { withInfoPlist, withDangerousMod } = require("expo/config-plugins");
|
|
5
5
|
const fs = require('fs/promises');
|
|
6
6
|
const path = require('path');
|
|
7
|
-
const pkg = require("../../package.json");
|
|
8
7
|
const withRadarIOS = (config, args) => {
|
|
9
8
|
config = withInfoPlist(config, (config) => {
|
|
10
9
|
config.modResults.NSLocationWhenInUseUsageDescription =
|
|
@@ -49,7 +48,7 @@ const withRadarIOS = (config, args) => {
|
|
|
49
48
|
const filePath = path.join(config.modRequest.platformProjectRoot, 'Podfile');
|
|
50
49
|
const contents = await fs.readFile(filePath, 'utf-8');
|
|
51
50
|
// Check if the pod declaration already exists
|
|
52
|
-
if (contents.indexOf(
|
|
51
|
+
if (contents.indexOf("pod 'RadarSDKMotion', '3.20.1'") === -1) {
|
|
53
52
|
// Find the target block
|
|
54
53
|
const targetRegex = /target '(\w+)' do/g;
|
|
55
54
|
const match = targetRegex.exec(contents);
|
|
@@ -59,7 +58,7 @@ const withRadarIOS = (config, args) => {
|
|
|
59
58
|
// Insert the pod declaration within the target block
|
|
60
59
|
const targetBlock = contents.substring(targetStartIndex, targetEndIndex);
|
|
61
60
|
// Just for this version of the SDK, we will be using 3.21.1 of the SDKMotion pod. There is no difference between the source code of 3.21.2 and 3.21.1 for RadarSDKMotion.
|
|
62
|
-
const updatedTargetBlock = targetBlock.replace(/(target '(\w+)' do)/, `$1\n pod 'RadarSDKMotion', '
|
|
61
|
+
const updatedTargetBlock = targetBlock.replace(/(target '(\w+)' do)/, `$1\n pod 'RadarSDKMotion', '3.20.1'`);
|
|
63
62
|
const newContents = contents.replace(targetBlock, updatedTargetBlock);
|
|
64
63
|
// Write the updated contents back to the Podfile
|
|
65
64
|
await fs.writeFile(filePath, newContents);
|
|
@@ -53,6 +53,10 @@ export interface RadarNativeInterface {
|
|
|
53
53
|
getDescription: () => Promise<string>;
|
|
54
54
|
setMetadata: (metadata: RadarMetadata) => void;
|
|
55
55
|
getMetadata: () => Promise<RadarMetadata>;
|
|
56
|
+
setTags: (tags: string[]) => void;
|
|
57
|
+
getTags: () => Promise<string[]>;
|
|
58
|
+
addTags: (tags: string[]) => void;
|
|
59
|
+
removeTags: (tags: string[]) => void;
|
|
56
60
|
setProduct(product: string): void;
|
|
57
61
|
getProduct: () => Promise<string>;
|
|
58
62
|
setAnonymousTrackingEnabled: (enabled: boolean) => void;
|
package/src/@types/types.ts
CHANGED
package/src/NativeRadar.ts
CHANGED
|
@@ -42,6 +42,10 @@ export interface Spec extends TurboModule {
|
|
|
42
42
|
getDescription(): Promise<string>;
|
|
43
43
|
setMetadata(metadata: Object): void;
|
|
44
44
|
getMetadata(): Promise<Object>;
|
|
45
|
+
setTags(tags: Array<string>): void;
|
|
46
|
+
getTags(): Promise<Array<string>>;
|
|
47
|
+
addTags(tags: Array<string>): void;
|
|
48
|
+
removeTags(tags: Array<string>): void;
|
|
45
49
|
setProduct(product: string): void;
|
|
46
50
|
getProduct(): Promise<string>;
|
|
47
51
|
setAnonymousTrackingEnabled(enabled: boolean): void;
|
package/src/index.native.ts
CHANGED
|
@@ -268,6 +268,18 @@ const Radar: RadarNativeInterface = {
|
|
|
268
268
|
getMetadata: function (): Promise<RadarMetadata> {
|
|
269
269
|
return NativeRadar.getMetadata() as Promise<RadarMetadata>;
|
|
270
270
|
},
|
|
271
|
+
setTags: function (tags: string[]): void {
|
|
272
|
+
return NativeRadar.setTags(tags);
|
|
273
|
+
},
|
|
274
|
+
getTags: function (): Promise<string[]> {
|
|
275
|
+
return NativeRadar.getTags() as Promise<string[]>;
|
|
276
|
+
},
|
|
277
|
+
addTags: function (tags: string[]): void {
|
|
278
|
+
return NativeRadar.addTags(tags);
|
|
279
|
+
},
|
|
280
|
+
removeTags: function (tags: string[]): void {
|
|
281
|
+
return NativeRadar.removeTags(tags);
|
|
282
|
+
},
|
|
271
283
|
setProduct: function (product: string): void {
|
|
272
284
|
return NativeRadar.setProduct(product);
|
|
273
285
|
},
|
package/src/ui/map.jsx
CHANGED
|
@@ -106,8 +106,7 @@ const RadarMap = ({ mapOptions, children }) => {
|
|
|
106
106
|
logoEnabled={false}
|
|
107
107
|
attributionEnabled
|
|
108
108
|
onRegionDidChange={mapOptions?.onRegionDidChange ? mapOptions.onRegionDidChange : null}
|
|
109
|
-
|
|
110
|
-
>
|
|
109
|
+
mapStyle={styleURL}>
|
|
111
110
|
{userLocationMapIndicator}
|
|
112
111
|
{children}
|
|
113
112
|
</MapLibreGL.MapView>
|
package/src/version.ts
CHANGED