react-native-radar 4.3.0 → 4.31.0-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/src/newarch/java/com/radar/RadarModule.kt +2 -2
- package/android/src/oldarch/java/com/radar/RadarModule.java +2 -2
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/ios/RNRadar.mm +2 -2
- package/package.json +1 -1
- package/plugin/build/types.d.ts +12 -0
- package/plugin/build/withRadarIOS.js +72 -1
- package/src/version.ts +1 -1
|
@@ -143,7 +143,7 @@ class RadarModule(reactContext: ReactApplicationContext) :
|
|
|
143
143
|
override fun initialize(publishableKey: String, fraud: Boolean, options: ReadableMap?): Unit {
|
|
144
144
|
val editor = reactApplicationContext.getSharedPreferences("RadarSDK", Context.MODE_PRIVATE).edit()
|
|
145
145
|
editor.putString("x_platform_sdk_type", "ReactNative")
|
|
146
|
-
editor.putString("x_platform_sdk_version", "4.
|
|
146
|
+
editor.putString("x_platform_sdk_version", "4.31.0-beta.1")
|
|
147
147
|
editor.apply()
|
|
148
148
|
|
|
149
149
|
Radar.initialize(reactApplicationContext, publishableKey, radarReceiver, Radar.RadarLocationServicesProvider.GOOGLE, fraud, null, radarInAppMessageReceiver, currentActivity)
|
|
@@ -155,7 +155,7 @@ class RadarModule(reactContext: ReactApplicationContext) :
|
|
|
155
155
|
override fun initializeWithAuthToken(authToken: String, fraud: Boolean, options: ReadableMap?): Unit {
|
|
156
156
|
val editor = reactApplicationContext.getSharedPreferences("RadarSDK", Context.MODE_PRIVATE).edit()
|
|
157
157
|
editor.putString("x_platform_sdk_type", "ReactNative")
|
|
158
|
-
editor.putString("x_platform_sdk_version", "4.
|
|
158
|
+
editor.putString("x_platform_sdk_version", "4.31.0-beta.1")
|
|
159
159
|
editor.apply()
|
|
160
160
|
|
|
161
161
|
val initOptions = io.radar.sdk.RadarInitializeOptions.builder()
|
|
@@ -102,7 +102,7 @@ public class RadarModule extends ReactContextBaseJavaModule implements Permissio
|
|
|
102
102
|
this.fraud = fraud;
|
|
103
103
|
SharedPreferences.Editor editor = getReactApplicationContext().getSharedPreferences("RadarSDK", Context.MODE_PRIVATE).edit();
|
|
104
104
|
editor.putString("x_platform_sdk_type", "ReactNative");
|
|
105
|
-
editor.putString("x_platform_sdk_version", "4.
|
|
105
|
+
editor.putString("x_platform_sdk_version", "4.31.0-beta.1");
|
|
106
106
|
editor.apply();
|
|
107
107
|
Radar.initialize(getReactApplicationContext(), publishableKey, receiver, Radar.RadarLocationServicesProvider.GOOGLE, fraud, null, inAppMessageReceiver, getCurrentActivity());
|
|
108
108
|
if (fraud) {
|
|
@@ -115,7 +115,7 @@ public class RadarModule extends ReactContextBaseJavaModule implements Permissio
|
|
|
115
115
|
this.fraud = fraud;
|
|
116
116
|
SharedPreferences.Editor editor = getReactApplicationContext().getSharedPreferences("RadarSDK", Context.MODE_PRIVATE).edit();
|
|
117
117
|
editor.putString("x_platform_sdk_type", "ReactNative");
|
|
118
|
-
editor.putString("x_platform_sdk_version", "4.
|
|
118
|
+
editor.putString("x_platform_sdk_version", "4.31.0-beta.1");
|
|
119
119
|
editor.apply();
|
|
120
120
|
|
|
121
121
|
io.radar.sdk.RadarInitializeOptions.Builder builder = io.radar.sdk.RadarInitializeOptions.builder()
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "4.
|
|
1
|
+
export declare const VERSION = "4.31.0-beta.1";
|
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 = '4.
|
|
6
|
+
exports.VERSION = '4.31.0-beta.1';
|
package/ios/RNRadar.mm
CHANGED
|
@@ -217,7 +217,7 @@ RCT_EXPORT_MODULE()
|
|
|
217
217
|
RCT_EXPORT_METHOD(initialize:(NSString *)publishableKey fraud:(BOOL)fraud options:(NSDictionary *)options) {
|
|
218
218
|
_publishableKey = publishableKey;
|
|
219
219
|
[[NSUserDefaults standardUserDefaults] setObject:@"ReactNative" forKey:@"radar-xPlatformSDKType"];
|
|
220
|
-
[[NSUserDefaults standardUserDefaults] setObject:@"4.
|
|
220
|
+
[[NSUserDefaults standardUserDefaults] setObject:@"4.31.0-beta.1" forKey:@"radar-xPlatformSDKVersion"];
|
|
221
221
|
|
|
222
222
|
RadarInitializeOptions *radarOptions = [[RadarInitializeOptions alloc] init];
|
|
223
223
|
if (options != nil) {
|
|
@@ -240,7 +240,7 @@ RCT_EXPORT_METHOD(initialize:(NSString *)publishableKey fraud:(BOOL)fraud option
|
|
|
240
240
|
RCT_EXPORT_METHOD(initializeWithAuthToken:(NSString *)authToken fraud:(BOOL)fraud options:(NSDictionary *)options) {
|
|
241
241
|
_publishableKey = nil;
|
|
242
242
|
[[NSUserDefaults standardUserDefaults] setObject:@"ReactNative" forKey:@"radar-xPlatformSDKType"];
|
|
243
|
-
[[NSUserDefaults standardUserDefaults] setObject:@"4.
|
|
243
|
+
[[NSUserDefaults standardUserDefaults] setObject:@"4.31.0-beta.1" forKey:@"radar-xPlatformSDKVersion"];
|
|
244
244
|
RadarInitializeOptions *radarOptions = [[RadarInitializeOptions alloc] init];
|
|
245
245
|
if (options != nil) {
|
|
246
246
|
id silentPushValue = options[@"silentPush"];
|
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": "4.
|
|
6
|
+
"version": "4.31.0-beta.1",
|
|
7
7
|
"main": "dist/index.js",
|
|
8
8
|
"files": [
|
|
9
9
|
"dist",
|
package/plugin/build/types.d.ts
CHANGED
|
@@ -9,4 +9,16 @@ export interface RadarPluginProps {
|
|
|
9
9
|
androidActivityRecognition?: boolean;
|
|
10
10
|
addRadarSDKMotion?: boolean;
|
|
11
11
|
iosNSMotionUsageDescription?: string;
|
|
12
|
+
/**
|
|
13
|
+
* iOS only. When true, injects `[Radar nativeSetup:options]` into AppDelegate
|
|
14
|
+
* with autoHandleNotificationDeepLinks = YES so cold-start notification taps
|
|
15
|
+
* route to the URL in the notification payload.
|
|
16
|
+
*/
|
|
17
|
+
iosAutoHandleNotificationDeepLinks?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* iOS only. When true, injects `[Radar nativeSetup:options]` into AppDelegate
|
|
20
|
+
* with autoLogNotificationConversions = YES so opened_app conversions are
|
|
21
|
+
* automatically associated with the notification that opened the app.
|
|
22
|
+
*/
|
|
23
|
+
iosAutoLogNotificationConversions?: boolean;
|
|
12
24
|
}
|
|
@@ -1,10 +1,80 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.withRadarIOS = void 0;
|
|
4
|
-
const { withInfoPlist, withDangerousMod } = require("expo/config-plugins");
|
|
4
|
+
const { withInfoPlist, withDangerousMod, withAppDelegate, WarningAggregator, } = require("expo/config-plugins");
|
|
5
5
|
const fs = require('fs/promises');
|
|
6
6
|
const path = require('path');
|
|
7
7
|
const pkg = require("../../package.json");
|
|
8
|
+
const NATIVE_SETUP_SENTINEL = "@generated react-native-radar nativeSetup";
|
|
9
|
+
function buildObjcSnippet(args) {
|
|
10
|
+
const lines = [
|
|
11
|
+
` // ${NATIVE_SETUP_SENTINEL}`,
|
|
12
|
+
` RadarInitializeOptions *radarInitializeOptions = [[RadarInitializeOptions alloc] init];`,
|
|
13
|
+
];
|
|
14
|
+
if (args.iosAutoHandleNotificationDeepLinks) {
|
|
15
|
+
lines.push(` radarInitializeOptions.autoHandleNotificationDeepLinks = YES;`);
|
|
16
|
+
}
|
|
17
|
+
if (args.iosAutoLogNotificationConversions) {
|
|
18
|
+
lines.push(` radarInitializeOptions.autoLogNotificationConversions = YES;`);
|
|
19
|
+
}
|
|
20
|
+
lines.push(` [Radar nativeSetup:radarInitializeOptions];`);
|
|
21
|
+
return lines.join("\n");
|
|
22
|
+
}
|
|
23
|
+
function buildSwiftSnippet(args) {
|
|
24
|
+
const lines = [
|
|
25
|
+
` // ${NATIVE_SETUP_SENTINEL}`,
|
|
26
|
+
` let radarInitializeOptions = RadarInitializeOptions()`,
|
|
27
|
+
];
|
|
28
|
+
if (args.iosAutoHandleNotificationDeepLinks) {
|
|
29
|
+
lines.push(` radarInitializeOptions.autoHandleNotificationDeepLinks = true`);
|
|
30
|
+
}
|
|
31
|
+
if (args.iosAutoLogNotificationConversions) {
|
|
32
|
+
lines.push(` radarInitializeOptions.autoLogNotificationConversions = true`);
|
|
33
|
+
}
|
|
34
|
+
lines.push(` Radar.nativeSetup(radarInitializeOptions)`);
|
|
35
|
+
return lines.join("\n");
|
|
36
|
+
}
|
|
37
|
+
function withRadarAppDelegate(config, args) {
|
|
38
|
+
const enabled = args.iosAutoHandleNotificationDeepLinks ||
|
|
39
|
+
args.iosAutoLogNotificationConversions;
|
|
40
|
+
if (!enabled)
|
|
41
|
+
return config;
|
|
42
|
+
return withAppDelegate(config, (config) => {
|
|
43
|
+
let contents = config.modResults.contents;
|
|
44
|
+
if (contents.includes(NATIVE_SETUP_SENTINEL)) {
|
|
45
|
+
return config;
|
|
46
|
+
}
|
|
47
|
+
const language = config.modResults.language; // 'objc' | 'objcpp' | 'swift'
|
|
48
|
+
if (language === "objc" || language === "objcpp") {
|
|
49
|
+
if (!contents.includes("RadarSDK/RadarSDK.h")) {
|
|
50
|
+
contents = contents.replace(/(#import\s+"AppDelegate\.h")/, `$1\n#import <RadarSDK/RadarSDK.h>`);
|
|
51
|
+
}
|
|
52
|
+
const anchor = "[super application:application didFinishLaunchingWithOptions:launchOptions];";
|
|
53
|
+
if (!contents.includes(anchor)) {
|
|
54
|
+
WarningAggregator.addWarningIOS("react-native-radar", "Could not find didFinishLaunchingWithOptions super call in AppDelegate; skipping nativeSetup injection.");
|
|
55
|
+
return config;
|
|
56
|
+
}
|
|
57
|
+
contents = contents.replace(anchor, `${anchor}\n${buildObjcSnippet(args)}`);
|
|
58
|
+
}
|
|
59
|
+
else if (language === "swift") {
|
|
60
|
+
if (!/^import RadarSDK\b/m.test(contents)) {
|
|
61
|
+
contents = contents.replace(/(import Expo\b.*)/, `$1\nimport RadarSDK`);
|
|
62
|
+
}
|
|
63
|
+
const anchor = "super.application(application, didFinishLaunchingWithOptions: launchOptions)";
|
|
64
|
+
if (!contents.includes(anchor)) {
|
|
65
|
+
WarningAggregator.addWarningIOS("react-native-radar", "Could not find didFinishLaunchingWithOptions super call in AppDelegate.swift; skipping nativeSetup injection.");
|
|
66
|
+
return config;
|
|
67
|
+
}
|
|
68
|
+
contents = contents.replace(anchor, `${anchor}\n${buildSwiftSnippet(args)}`);
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
WarningAggregator.addWarningIOS("react-native-radar", `Unsupported AppDelegate language "${language}"; skipping Radar nativeSetup injection.`);
|
|
72
|
+
return config;
|
|
73
|
+
}
|
|
74
|
+
config.modResults.contents = contents;
|
|
75
|
+
return config;
|
|
76
|
+
});
|
|
77
|
+
}
|
|
8
78
|
const withRadarIOS = (config, args) => {
|
|
9
79
|
config = withInfoPlist(config, (config) => {
|
|
10
80
|
config.modResults.NSLocationWhenInUseUsageDescription =
|
|
@@ -42,6 +112,7 @@ const withRadarIOS = (config, args) => {
|
|
|
42
112
|
}
|
|
43
113
|
return config;
|
|
44
114
|
});
|
|
115
|
+
config = withRadarAppDelegate(config, args);
|
|
45
116
|
if (args.addRadarSDKMotion) {
|
|
46
117
|
config = withDangerousMod(config, [
|
|
47
118
|
'ios',
|
package/src/version.ts
CHANGED