react-native-radar 3.18.2 → 3.18.3
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 +2 -2
- package/android/src/main/java/io/radar/react/RNRadarModule.java +26 -4
- package/dist/@types/RadarNativeInterface.d.ts +2 -1
- package/dist/@types/types.d.ts +9 -0
- package/dist/@types/types.js +4 -3
- package/dist/index.native.js +2 -0
- package/ios/Cartfile.resolved +1 -1
- package/ios/RNRadar.m +28 -1
- package/package.json +1 -1
- package/plugin/build/withRadarIOS.js +2 -1
- package/react-native-radar.podspec +1 -1
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.18.
|
|
21
|
+
versionName '3.18.3'
|
|
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.18.
|
|
48
|
+
api 'io.radar:sdk:3.18.5'
|
|
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.18.
|
|
99
|
+
editor.putString("x_platform_sdk_version", "3.18.3");
|
|
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
|
-
|
|
253
|
+
Activity activity =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
|
-
|
|
258
|
+
ActivityCompat.requestPermissions(activity, new String[] { Manifest.permission.ACCESS_BACKGROUND_LOCATION }, PERMISSIONS_REQUEST_CODE);
|
|
259
259
|
} else {
|
|
260
|
-
|
|
260
|
+
ActivityCompat.requestPermissions(activity, new String[] { Manifest.permission.ACCESS_FINE_LOCATION }, PERMISSIONS_REQUEST_CODE);
|
|
261
261
|
}
|
|
262
262
|
}
|
|
263
263
|
}
|
|
@@ -1113,6 +1113,28 @@ public class RNRadarModule extends ReactContextBaseJavaModule implements Permiss
|
|
|
1113
1113
|
});
|
|
1114
1114
|
}
|
|
1115
1115
|
|
|
1116
|
+
@ReactMethod
|
|
1117
|
+
public void validateAddress(ReadableMap addressMap, final Promise promise) {
|
|
1118
|
+
RadarAddress address = RadarAddress.fromJson(RNRadarUtils.jsonForMap(addressMap));
|
|
1119
|
+
Radar.validateAddress(address, new RadarValidateAddressCallback {
|
|
1120
|
+
@Override
|
|
1121
|
+
onComplete(@NonNull Radar.RadarStatus status, @Nullable RadarAddress address, @Nullable RadarAddressVerificationStatus verificationStatus) {
|
|
1122
|
+
if (status == Radar.RadarStatus.SUCCESS && ) {
|
|
1123
|
+
map.putString("status", status.toString());
|
|
1124
|
+
if (address != null) {
|
|
1125
|
+
map.putMap("address", RNRadarUtils.mapForJson(address.toJson()));
|
|
1126
|
+
}
|
|
1127
|
+
if (verificationStatus != null) {
|
|
1128
|
+
map.putString("verificationStatus", verificationStatus.toString());
|
|
1129
|
+
}
|
|
1130
|
+
promise.resolve(map);
|
|
1131
|
+
} else {
|
|
1132
|
+
promise.reject(status.toString, status.toString());
|
|
1133
|
+
}
|
|
1134
|
+
}
|
|
1135
|
+
});
|
|
1136
|
+
}
|
|
1137
|
+
|
|
1116
1138
|
@ReactMethod
|
|
1117
1139
|
public void getDistance(ReadableMap optionsMap, final Promise promise) {
|
|
1118
1140
|
if (promise == null) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Location, RadarAutocompleteOptions, RadarContextCallback,
|
|
1
|
+
import { Location, RadarAddress, RadarAddressCallback, RadarAutocompleteOptions, RadarContextCallback, RadarEventChannel, RadarGeocodeOptions, RadarGetDistanceOptions, RadarGetMatrixOptions, RadarIPGeocodeCallback, RadarListenerCallback, RadarLocationCallback, RadarLogConversionCallback, RadarLogConversionOptions, RadarLogLevel, RadarMetadata, RadarMockTrackingOptions, RadarNotificationOptions, RadarPermissionsStatus, RadarReverseGeocodeOptions, RadarRouteCallback, RadarRouteMatrix, RadarSearchGeofencesCallback, RadarSearchGeofencesOptions, RadarSearchPlacesCallback, RadarSearchPlacesOptions, RadarStartTripOptions, RadarTrackCallback, RadarTrackingOptions, RadarTrackingOptionsDesiredAccuracy, RadarTrackingOptionsForegroundService, RadarTrackOnceOptions, RadarTrackVerifiedCallback, RadarTrackVerifiedOptions, RadarTripCallback, RadarTripOptions, RadarUpdateTripOptions, RadarValidateAddressCallback, RadarVerifiedTrackingOptions } from "./types";
|
|
2
2
|
export interface RadarNativeInterface {
|
|
3
3
|
initialize: (publishableKey: string, fraud?: boolean) => void;
|
|
4
4
|
setLogLevel: (level: RadarLogLevel) => void;
|
|
@@ -42,6 +42,7 @@ export interface RadarNativeInterface {
|
|
|
42
42
|
geocode: (options: RadarGeocodeOptions) => Promise<RadarAddressCallback>;
|
|
43
43
|
reverseGeocode: (options?: RadarReverseGeocodeOptions) => Promise<RadarAddressCallback>;
|
|
44
44
|
ipGeocode: () => Promise<RadarIPGeocodeCallback>;
|
|
45
|
+
validateAddress: (address: RadarAddress) => Promise<RadarValidateAddressCallback>;
|
|
45
46
|
getDistance: (option: RadarGetDistanceOptions) => Promise<RadarRouteCallback>;
|
|
46
47
|
getMatrix: (option: RadarGetMatrixOptions) => Promise<RadarRouteMatrix>;
|
|
47
48
|
logConversion: (options: RadarLogConversionOptions) => Promise<RadarLogConversionCallback>;
|
package/dist/@types/types.d.ts
CHANGED
|
@@ -435,6 +435,15 @@ export interface RadarAddress {
|
|
|
435
435
|
stateCode?: string;
|
|
436
436
|
street?: string;
|
|
437
437
|
unit?: string;
|
|
438
|
+
timeZone?: RadarTimeZone;
|
|
439
|
+
}
|
|
440
|
+
export interface RadarTimeZone {
|
|
441
|
+
id: string;
|
|
442
|
+
name: string;
|
|
443
|
+
code: string;
|
|
444
|
+
currentTime: string;
|
|
445
|
+
utcOffset: number;
|
|
446
|
+
dstOffset: number;
|
|
438
447
|
}
|
|
439
448
|
export type RadarVerificationStatus = "verified" | "partially verified" | "ambiguous" | "unverified";
|
|
440
449
|
export interface RadarRoutes {
|
package/dist/@types/types.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.RadarEventVerification = exports.RadarEventConfidence = exports.presetEfficient = exports.presetEfficientAndroid = exports.presetEfficientIOS = exports.presetResponsive = exports.presetResponsiveAndroid = exports.presetResponsiveIOS = exports.presetContinuous = exports.presetContinuousAndroid = exports.presetContinuousIOS = void 0;
|
|
4
4
|
const react_native_1 = require("react-native");
|
|
5
|
+
const platform = react_native_1.Platform.OS;
|
|
5
6
|
exports.presetContinuousIOS = {
|
|
6
7
|
desiredStoppedUpdateInterval: 30,
|
|
7
8
|
desiredMovingUpdateInterval: 30,
|
|
@@ -45,7 +46,7 @@ exports.presetContinuousAndroid = {
|
|
|
45
46
|
startTrackingAfter: undefined,
|
|
46
47
|
stopTrackingAfter: undefined,
|
|
47
48
|
};
|
|
48
|
-
exports.presetContinuous =
|
|
49
|
+
exports.presetContinuous = platform === 'ios' ? exports.presetContinuousIOS : exports.presetContinuousAndroid;
|
|
49
50
|
exports.presetResponsiveIOS = {
|
|
50
51
|
desiredStoppedUpdateInterval: 0,
|
|
51
52
|
desiredMovingUpdateInterval: 150,
|
|
@@ -89,7 +90,7 @@ exports.presetResponsiveAndroid = {
|
|
|
89
90
|
startTrackingAfter: undefined,
|
|
90
91
|
stopTrackingAfter: undefined,
|
|
91
92
|
};
|
|
92
|
-
exports.presetResponsive =
|
|
93
|
+
exports.presetResponsive = platform === 'ios' ? exports.presetResponsiveIOS : exports.presetResponsiveAndroid;
|
|
93
94
|
exports.presetEfficientIOS = {
|
|
94
95
|
desiredStoppedUpdateInterval: 0,
|
|
95
96
|
desiredMovingUpdateInterval: 0,
|
|
@@ -133,7 +134,7 @@ exports.presetEfficientAndroid = {
|
|
|
133
134
|
startTrackingAfter: undefined,
|
|
134
135
|
stopTrackingAfter: undefined,
|
|
135
136
|
};
|
|
136
|
-
exports.presetEfficient =
|
|
137
|
+
exports.presetEfficient = platform === 'ios' ? exports.presetEfficientIOS : exports.presetEfficientAndroid;
|
|
137
138
|
var RadarEventConfidence;
|
|
138
139
|
(function (RadarEventConfidence) {
|
|
139
140
|
RadarEventConfidence[RadarEventConfidence["none"] = 0] = "none";
|
package/dist/index.native.js
CHANGED
|
@@ -67,6 +67,7 @@ const autocomplete = (options) => react_native_1.NativeModules.RNRadar.autocompl
|
|
|
67
67
|
const geocode = (options) => react_native_1.NativeModules.RNRadar.geocode(options);
|
|
68
68
|
const reverseGeocode = (options) => react_native_1.NativeModules.RNRadar.reverseGeocode(options);
|
|
69
69
|
const ipGeocode = () => react_native_1.NativeModules.RNRadar.ipGeocode();
|
|
70
|
+
const validateAddress = (address) => react_native_1.NativeModules.RNRadar.validateAddress(address);
|
|
70
71
|
const getDistance = (options) => react_native_1.NativeModules.RNRadar.getDistance(options);
|
|
71
72
|
const getMatrix = (options) => react_native_1.NativeModules.RNRadar.getMatrix(options);
|
|
72
73
|
const logConversion = (options) => react_native_1.NativeModules.RNRadar.logConversion(options);
|
|
@@ -126,6 +127,7 @@ const Radar = {
|
|
|
126
127
|
geocode,
|
|
127
128
|
reverseGeocode,
|
|
128
129
|
ipGeocode,
|
|
130
|
+
validateAddress,
|
|
129
131
|
getDistance,
|
|
130
132
|
getMatrix,
|
|
131
133
|
logConversion,
|
package/ios/Cartfile.resolved
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
github "radarlabs/radar-sdk-ios" "3.18.
|
|
1
|
+
github "radarlabs/radar-sdk-ios" "3.18.4"
|
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.
|
|
105
|
+
[[NSUserDefaults standardUserDefaults] setObject:@"3.18.3" forKey:@"radar-xPlatformSDKVersion"];
|
|
106
106
|
[Radar initializeWithPublishableKey:publishableKey];
|
|
107
107
|
}
|
|
108
108
|
|
|
@@ -968,6 +968,33 @@ RCT_EXPORT_METHOD(ipGeocode:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRe
|
|
|
968
968
|
}];
|
|
969
969
|
}
|
|
970
970
|
|
|
971
|
+
RCT_EXPORT_METHOD(validateAddress:(NSDictionary *)addressDict resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject) {
|
|
972
|
+
__block RCTPromiseResolveBlock resolver = resolve;
|
|
973
|
+
__block RCTPromiseRejectBlock rejecter = reject;
|
|
974
|
+
|
|
975
|
+
RadarAddress *address = [RadarAddress addressFromObject:addressDict];
|
|
976
|
+
|
|
977
|
+
if (address == nil) {
|
|
978
|
+
reject([Radar stringForStatus:RadarStatusErrorBadRequest], [Radar stringForStatus:RadarStatusErrorBadRequest], nil);
|
|
979
|
+
}
|
|
980
|
+
|
|
981
|
+
[Radar validateAddress:address completionHandler:^(RadarStatus status, RadarAddress * _Nullable address, RadarAddressVerificationStatus verificationStatus) {
|
|
982
|
+
if (status == RadarStatusSuccess && resolver) {
|
|
983
|
+
NSMutableDictionary *dict = [NSMutableDictionary new];
|
|
984
|
+
[dict setObject:[Radar stringForStatus:status] forKey:@"status"];
|
|
985
|
+
if (address) {
|
|
986
|
+
[dict setObject:[address dictionaryValue] forKey:@"address"];
|
|
987
|
+
}
|
|
988
|
+
dict[@"verificationStatus"] = [Radar stringForVerificationStatus: verificationStatus];
|
|
989
|
+
resolver(dict);
|
|
990
|
+
} else if (rejecter) {
|
|
991
|
+
rejecter([Radar stringForStatus:status], [Radar stringForStatus:status], nil);
|
|
992
|
+
}
|
|
993
|
+
resolver = nil;
|
|
994
|
+
rejecter = nil;
|
|
995
|
+
}];
|
|
996
|
+
}
|
|
997
|
+
|
|
971
998
|
RCT_EXPORT_METHOD(getDistance:(NSDictionary *)optionsDict resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject) {
|
|
972
999
|
if (optionsDict == nil) {
|
|
973
1000
|
if (reject) {
|
package/package.json
CHANGED
|
@@ -51,7 +51,8 @@ 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
|
-
|
|
54
|
+
const RadarSDKMotionVersion = '3.18.3';
|
|
55
|
+
if (contents.indexOf(`pod 'RadarSDKMotion', ${RadarSDKMotionVersion}`) === -1) {
|
|
55
56
|
// Find the target block
|
|
56
57
|
const targetRegex = /target '(\w+)' do/g;
|
|
57
58
|
const match = targetRegex.exec(contents);
|