react-native-radar 3.21.0-beta.3 → 3.22.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 +2 -2
- package/android/build.gradle +3 -3
- package/android/src/main/java/com/radar/RadarModuleImpl.java +119 -85
- package/android/src/main/java/com/radar/RadarUtils.java +12 -0
- package/android/src/newarch/java/com/radar/RadarModule.kt +31 -10
- package/android/src/oldarch/java/com/radar/RadarModule.java +31 -6
- package/android/src/oldarch/java/com/radar/RadarOldArchReceiver.java +8 -2
- package/dist/@types/RadarNativeInterface.d.ts +6 -1
- package/dist/@types/types.d.ts +2 -0
- package/dist/@types/types.js +19 -19
- package/dist/NativeRadar.d.ts +8 -3
- package/dist/NativeRadar.js +1 -1
- package/dist/index.js +4 -1
- package/dist/index.native.d.ts +4 -4
- package/dist/index.native.js +102 -248
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/ios/RNRadar.mm +59 -35
- package/package.json +3 -4
- package/src/@types/RadarNativeInterface.ts +22 -17
- package/src/@types/types.ts +38 -32
- package/src/NativeRadar.ts +10 -6
- package/src/index.native.ts +236 -283
- package/src/index.tsx +4 -1
- 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
|
@@ -8,7 +8,7 @@ Pod::Spec.new do |s|
|
|
|
8
8
|
s.summary = package["description"]
|
|
9
9
|
s.homepage = "https://github.com/radarlabs/react-native-radar"
|
|
10
10
|
s.license = package["license"]
|
|
11
|
-
s.authors = "radarlabs"
|
|
11
|
+
s.authors = "radarlabs"
|
|
12
12
|
|
|
13
13
|
s.platforms = { :ios => min_ios_version_supported }
|
|
14
14
|
s.source = { :git => "https://github.com/radarlabs/react-native-radar.git/react-native-radar.git", :tag => "#{s.version}" }
|
|
@@ -16,7 +16,7 @@ Pod::Spec.new do |s|
|
|
|
16
16
|
s.source_files = "ios/**/*.{h,m,mm,cpp}"
|
|
17
17
|
s.private_header_files = "ios/**/*.h"
|
|
18
18
|
|
|
19
|
-
s.dependency "RadarSDK", "~> 3.
|
|
19
|
+
s.dependency "RadarSDK", "~> 3.22.0"
|
|
20
20
|
|
|
21
21
|
install_modules_dependencies(s)
|
|
22
22
|
end
|
package/android/build.gradle
CHANGED
|
@@ -79,11 +79,11 @@ def kotlin_version = getExtOrDefault("kotlinVersion")
|
|
|
79
79
|
dependencies {
|
|
80
80
|
// Expose React Native to consumers of this module
|
|
81
81
|
api "com.facebook.react:react-android"
|
|
82
|
-
|
|
82
|
+
|
|
83
83
|
// Keep Kotlin stdlib internal to this module
|
|
84
84
|
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
85
|
-
|
|
86
|
-
api 'io.radar:sdk:3.
|
|
85
|
+
|
|
86
|
+
api 'io.radar:sdk:3.22.0'
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
react {
|
|
@@ -52,11 +52,11 @@ public class RadarModuleImpl {
|
|
|
52
52
|
|
|
53
53
|
|
|
54
54
|
private boolean fraud = false;
|
|
55
|
-
|
|
55
|
+
|
|
56
56
|
public String getName() {
|
|
57
57
|
return "RNRadar";
|
|
58
58
|
}
|
|
59
|
-
|
|
59
|
+
|
|
60
60
|
public void setLogLevel(String level) {
|
|
61
61
|
Radar.RadarLogLevel logLevel = Radar.RadarLogLevel.NONE;
|
|
62
62
|
if (level != null) {
|
|
@@ -73,12 +73,12 @@ public class RadarModuleImpl {
|
|
|
73
73
|
Radar.setLogLevel(logLevel);
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
|
|
76
|
+
|
|
77
77
|
public void setUserId(String userId) {
|
|
78
78
|
Radar.setUserId(userId);
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
-
|
|
81
|
+
|
|
82
82
|
public void getUserId(final Promise promise) {
|
|
83
83
|
if (promise == null) {
|
|
84
84
|
return;
|
|
@@ -87,12 +87,12 @@ public class RadarModuleImpl {
|
|
|
87
87
|
promise.resolve(Radar.getUserId());
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
-
|
|
90
|
+
|
|
91
91
|
public void setDescription(String description) {
|
|
92
92
|
Radar.setDescription(description);
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
-
|
|
95
|
+
|
|
96
96
|
public void getDescription(final Promise promise) {
|
|
97
97
|
if (promise == null) {
|
|
98
98
|
return;
|
|
@@ -101,7 +101,7 @@ public class RadarModuleImpl {
|
|
|
101
101
|
promise.resolve(Radar.getDescription());
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
-
|
|
104
|
+
|
|
105
105
|
public void nativeSdkVersion(final Promise promise) {
|
|
106
106
|
if (promise == null) {
|
|
107
107
|
return;
|
|
@@ -109,33 +109,66 @@ public class RadarModuleImpl {
|
|
|
109
109
|
String sdkVersion = Radar.sdkVersion();
|
|
110
110
|
|
|
111
111
|
if (sdkVersion != null) {
|
|
112
|
-
promise.resolve(sdkVersion);
|
|
112
|
+
promise.resolve(sdkVersion);
|
|
113
113
|
} else {
|
|
114
114
|
promise.reject(Radar.RadarStatus.ERROR_BAD_REQUEST.toString(), Radar.RadarStatus.ERROR_BAD_REQUEST.toString());
|
|
115
115
|
}
|
|
116
116
|
}
|
|
117
117
|
|
|
118
|
-
|
|
118
|
+
|
|
119
119
|
public void setMetadata(ReadableMap metadataMap) throws JSONException {
|
|
120
120
|
Radar.setMetadata(RadarUtils.jsonForMap(metadataMap));
|
|
121
121
|
}
|
|
122
122
|
|
|
123
|
-
|
|
124
|
-
public void getMetadata(final Promise promise) throws JSONException {
|
|
123
|
+
|
|
124
|
+
public void getMetadata(final Promise promise) throws JSONException {
|
|
125
125
|
if (promise == null) {
|
|
126
126
|
return;
|
|
127
127
|
}
|
|
128
128
|
|
|
129
|
-
JSONObject metaJson = Radar.getMetadata();
|
|
129
|
+
JSONObject metaJson = Radar.getMetadata();
|
|
130
130
|
promise.resolve(RadarUtils.mapForJson(metaJson));
|
|
131
131
|
}
|
|
132
|
-
|
|
133
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
|
+
}
|
|
152
|
+
|
|
153
|
+
public void setProduct(String product) {
|
|
154
|
+
Radar.setProduct(product);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
public void getProduct(final Promise promise) throws JSONException {
|
|
158
|
+
if (promise == null) {
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
String product = Radar.getProduct();
|
|
163
|
+
promise.resolve(product);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
|
|
134
167
|
public void setAnonymousTrackingEnabled(boolean enabled) {
|
|
135
168
|
Radar.setAnonymousTrackingEnabled(enabled);
|
|
136
169
|
}
|
|
137
170
|
|
|
138
|
-
|
|
171
|
+
|
|
139
172
|
public void getHost(final Promise promise) {
|
|
140
173
|
if (promise == null) {
|
|
141
174
|
return;
|
|
@@ -144,7 +177,7 @@ public class RadarModuleImpl {
|
|
|
144
177
|
promise.resolve(Radar.getHost());
|
|
145
178
|
}
|
|
146
179
|
|
|
147
|
-
|
|
180
|
+
|
|
148
181
|
public void getPublishableKey(final Promise promise) {
|
|
149
182
|
if (promise == null) {
|
|
150
183
|
return;
|
|
@@ -152,12 +185,12 @@ public class RadarModuleImpl {
|
|
|
152
185
|
|
|
153
186
|
promise.resolve(Radar.getPublishableKey());
|
|
154
187
|
}
|
|
155
|
-
|
|
188
|
+
|
|
156
189
|
public void getLocation(String desiredAccuracy, final Promise promise) {
|
|
157
|
-
|
|
158
|
-
RadarTrackingOptions.RadarTrackingOptionsDesiredAccuracy accuracyLevel = RadarTrackingOptions.RadarTrackingOptionsDesiredAccuracy.MEDIUM;
|
|
190
|
+
|
|
191
|
+
RadarTrackingOptions.RadarTrackingOptionsDesiredAccuracy accuracyLevel = RadarTrackingOptions.RadarTrackingOptionsDesiredAccuracy.MEDIUM;
|
|
159
192
|
String accuracy = desiredAccuracy != null ? desiredAccuracy.toLowerCase() : "medium";
|
|
160
|
-
|
|
193
|
+
|
|
161
194
|
if (accuracy.equals("low")) {
|
|
162
195
|
accuracyLevel = RadarTrackingOptions.RadarTrackingOptionsDesiredAccuracy.LOW;
|
|
163
196
|
} else if (accuracy.equals("medium")) {
|
|
@@ -169,7 +202,7 @@ public class RadarModuleImpl {
|
|
|
169
202
|
}
|
|
170
203
|
|
|
171
204
|
Radar.getLocation(accuracyLevel, new Radar.RadarLocationCallback() {
|
|
172
|
-
|
|
205
|
+
|
|
173
206
|
public void onComplete(@NonNull Radar.RadarStatus status, @Nullable Location location, boolean stopped) {
|
|
174
207
|
if (promise == null) {
|
|
175
208
|
return;
|
|
@@ -195,9 +228,9 @@ public class RadarModuleImpl {
|
|
|
195
228
|
});
|
|
196
229
|
}
|
|
197
230
|
|
|
198
|
-
|
|
231
|
+
|
|
199
232
|
public void trackOnce(ReadableMap optionsMap, final Promise promise) {
|
|
200
|
-
|
|
233
|
+
|
|
201
234
|
Location location = null;
|
|
202
235
|
RadarTrackingOptions.RadarTrackingOptionsDesiredAccuracy accuracyLevel = RadarTrackingOptions.RadarTrackingOptionsDesiredAccuracy.MEDIUM;
|
|
203
236
|
boolean beaconsTrackingOption = false;
|
|
@@ -231,7 +264,7 @@ public class RadarModuleImpl {
|
|
|
231
264
|
}
|
|
232
265
|
|
|
233
266
|
Radar.RadarTrackCallback trackCallback = new Radar.RadarTrackCallback() {
|
|
234
|
-
|
|
267
|
+
|
|
235
268
|
public void onComplete(@NonNull Radar.RadarStatus status, @Nullable Location location, @Nullable RadarEvent[] events, @Nullable RadarUser user) {
|
|
236
269
|
if (promise == null) {
|
|
237
270
|
return;
|
|
@@ -268,11 +301,13 @@ public class RadarModuleImpl {
|
|
|
268
301
|
}
|
|
269
302
|
}
|
|
270
303
|
|
|
271
|
-
|
|
304
|
+
|
|
272
305
|
public void trackVerified(ReadableMap optionsMap, final Promise promise) {
|
|
273
306
|
|
|
274
307
|
boolean beaconsTrackingOption = false;
|
|
275
308
|
RadarTrackingOptions.RadarTrackingOptionsDesiredAccuracy accuracyLevel = RadarTrackingOptions.RadarTrackingOptionsDesiredAccuracy.MEDIUM;
|
|
309
|
+
String reason = null;
|
|
310
|
+
String transactionId = null;
|
|
276
311
|
|
|
277
312
|
if (optionsMap != null) {
|
|
278
313
|
if (optionsMap.hasKey("beacons")) {
|
|
@@ -290,10 +325,16 @@ public class RadarModuleImpl {
|
|
|
290
325
|
accuracyLevel = RadarTrackingOptions.RadarTrackingOptionsDesiredAccuracy.HIGH;
|
|
291
326
|
}
|
|
292
327
|
}
|
|
328
|
+
if (optionsMap.hasKey("reason")) {
|
|
329
|
+
reason = optionsMap.getString("reason");
|
|
330
|
+
}
|
|
331
|
+
if (optionsMap.hasKey("transactionId")) {
|
|
332
|
+
transactionId = optionsMap.getString("transactionId");
|
|
333
|
+
}
|
|
293
334
|
}
|
|
294
335
|
|
|
295
336
|
Radar.RadarTrackVerifiedCallback trackCallback = new Radar.RadarTrackVerifiedCallback() {
|
|
296
|
-
|
|
337
|
+
|
|
297
338
|
public void onComplete(@NonNull Radar.RadarStatus status, @Nullable RadarVerifiedLocationToken token) {
|
|
298
339
|
if (promise == null) {
|
|
299
340
|
return;
|
|
@@ -317,23 +358,17 @@ public class RadarModuleImpl {
|
|
|
317
358
|
}
|
|
318
359
|
};
|
|
319
360
|
|
|
320
|
-
Radar.trackVerified(beaconsTrackingOption, accuracyLevel, trackCallback);
|
|
361
|
+
Radar.trackVerified(beaconsTrackingOption, accuracyLevel, reason, transactionId, trackCallback);
|
|
321
362
|
}
|
|
322
363
|
|
|
323
|
-
|
|
364
|
+
|
|
324
365
|
public void isTrackingVerified(final Promise promise) {
|
|
325
366
|
promise.resolve(Radar.isTrackingVerified());
|
|
326
367
|
}
|
|
327
368
|
|
|
328
|
-
|
|
329
|
-
public void setProduct(String product) {
|
|
330
|
-
Radar.setProduct(product);
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
|
|
334
369
|
public void getVerifiedLocationToken(final Promise promise) {
|
|
335
370
|
Radar.RadarTrackVerifiedCallback trackCallback = new Radar.RadarTrackVerifiedCallback() {
|
|
336
|
-
|
|
371
|
+
|
|
337
372
|
public void onComplete(@NonNull Radar.RadarStatus status, @Nullable RadarVerifiedLocationToken token) {
|
|
338
373
|
if (promise == null) {
|
|
339
374
|
return;
|
|
@@ -360,27 +395,27 @@ public class RadarModuleImpl {
|
|
|
360
395
|
Radar.getVerifiedLocationToken(trackCallback);
|
|
361
396
|
}
|
|
362
397
|
|
|
363
|
-
|
|
398
|
+
|
|
364
399
|
public void clearVerifiedLocationToken() {
|
|
365
400
|
Radar.clearVerifiedLocationToken();
|
|
366
401
|
}
|
|
367
402
|
|
|
368
|
-
|
|
403
|
+
|
|
369
404
|
public void startTrackingEfficient() {
|
|
370
405
|
Radar.startTracking(RadarTrackingOptions.EFFICIENT);
|
|
371
406
|
}
|
|
372
407
|
|
|
373
|
-
|
|
408
|
+
|
|
374
409
|
public void startTrackingResponsive() {
|
|
375
410
|
Radar.startTracking(RadarTrackingOptions.RESPONSIVE);
|
|
376
411
|
}
|
|
377
412
|
|
|
378
|
-
|
|
413
|
+
|
|
379
414
|
public void startTrackingContinuous() {
|
|
380
415
|
Radar.startTracking(RadarTrackingOptions.CONTINUOUS);
|
|
381
416
|
}
|
|
382
417
|
|
|
383
|
-
|
|
418
|
+
|
|
384
419
|
public void startTrackingCustom(ReadableMap optionsMap) {
|
|
385
420
|
try {
|
|
386
421
|
JSONObject optionsObj = RadarUtils.jsonForMap(optionsMap);
|
|
@@ -391,7 +426,7 @@ public class RadarModuleImpl {
|
|
|
391
426
|
}
|
|
392
427
|
}
|
|
393
428
|
|
|
394
|
-
|
|
429
|
+
|
|
395
430
|
public void startTrackingVerified(ReadableMap optionsMap) {
|
|
396
431
|
boolean beacons = false;
|
|
397
432
|
int interval = 1200;
|
|
@@ -404,7 +439,7 @@ public class RadarModuleImpl {
|
|
|
404
439
|
Radar.startTrackingVerified(interval, beacons);
|
|
405
440
|
}
|
|
406
441
|
|
|
407
|
-
|
|
442
|
+
|
|
408
443
|
public void mockTracking(ReadableMap optionsMap) {
|
|
409
444
|
ReadableMap originMap = optionsMap.getMap("origin");
|
|
410
445
|
double originLatitude = originMap.getDouble("latitude");
|
|
@@ -431,24 +466,24 @@ public class RadarModuleImpl {
|
|
|
431
466
|
int interval = optionsMap.hasKey("interval") ? optionsMap.getInt("interval") : 1;
|
|
432
467
|
|
|
433
468
|
Radar.mockTracking(origin, destination, mode, steps, interval, new Radar.RadarTrackCallback() {
|
|
434
|
-
|
|
469
|
+
|
|
435
470
|
public void onComplete(@NonNull Radar.RadarStatus status, @Nullable Location location, @Nullable RadarEvent[] events, @Nullable RadarUser user) {
|
|
436
471
|
|
|
437
472
|
}
|
|
438
473
|
});
|
|
439
474
|
}
|
|
440
475
|
|
|
441
|
-
|
|
476
|
+
|
|
442
477
|
public void stopTracking() {
|
|
443
478
|
Radar.stopTracking();
|
|
444
479
|
}
|
|
445
480
|
|
|
446
|
-
|
|
481
|
+
|
|
447
482
|
public void stopTrackingVerified() {
|
|
448
483
|
Radar.stopTrackingVerified();
|
|
449
484
|
}
|
|
450
485
|
|
|
451
|
-
|
|
486
|
+
|
|
452
487
|
public void isTracking(final Promise promise) {
|
|
453
488
|
if (promise == null) {
|
|
454
489
|
return;
|
|
@@ -457,7 +492,7 @@ public class RadarModuleImpl {
|
|
|
457
492
|
promise.resolve(Radar.isTracking());
|
|
458
493
|
}
|
|
459
494
|
|
|
460
|
-
|
|
495
|
+
|
|
461
496
|
public void getTrackingOptions(final Promise promise) {
|
|
462
497
|
if (promise == null) {
|
|
463
498
|
return;
|
|
@@ -471,7 +506,7 @@ public class RadarModuleImpl {
|
|
|
471
506
|
}
|
|
472
507
|
}
|
|
473
508
|
|
|
474
|
-
|
|
509
|
+
|
|
475
510
|
public void isUsingRemoteTrackingOptions(final Promise promise) {
|
|
476
511
|
if (promise == null) {
|
|
477
512
|
return;
|
|
@@ -480,7 +515,7 @@ public class RadarModuleImpl {
|
|
|
480
515
|
promise.resolve(Radar.isUsingRemoteTrackingOptions());
|
|
481
516
|
}
|
|
482
517
|
|
|
483
|
-
|
|
518
|
+
|
|
484
519
|
public void setForegroundServiceOptions(ReadableMap optionsMap) {
|
|
485
520
|
try {
|
|
486
521
|
JSONObject optionsObj = RadarUtils.jsonForMap(optionsMap);
|
|
@@ -491,7 +526,7 @@ public class RadarModuleImpl {
|
|
|
491
526
|
}
|
|
492
527
|
}
|
|
493
528
|
|
|
494
|
-
|
|
529
|
+
|
|
495
530
|
public void setNotificationOptions(ReadableMap optionsMap) {
|
|
496
531
|
try {
|
|
497
532
|
JSONObject optionsObj = RadarUtils.jsonForMap(optionsMap);
|
|
@@ -502,17 +537,17 @@ public class RadarModuleImpl {
|
|
|
502
537
|
}
|
|
503
538
|
}
|
|
504
539
|
|
|
505
|
-
|
|
540
|
+
|
|
506
541
|
public void acceptEvent(String eventId, String verifiedPlaceId) {
|
|
507
542
|
Radar.acceptEvent(eventId, verifiedPlaceId);
|
|
508
543
|
}
|
|
509
544
|
|
|
510
|
-
|
|
545
|
+
|
|
511
546
|
public void rejectEvent(String eventId) {
|
|
512
547
|
Radar.rejectEvent(eventId);
|
|
513
548
|
}
|
|
514
549
|
|
|
515
|
-
|
|
550
|
+
|
|
516
551
|
public void getTripOptions(final Promise promise) {
|
|
517
552
|
if (promise == null) {
|
|
518
553
|
return;
|
|
@@ -526,7 +561,7 @@ public class RadarModuleImpl {
|
|
|
526
561
|
}
|
|
527
562
|
}
|
|
528
563
|
|
|
529
|
-
|
|
564
|
+
|
|
530
565
|
public void startTrip(ReadableMap optionsMap, final Promise promise) {
|
|
531
566
|
try {
|
|
532
567
|
JSONObject optionsJson = RadarUtils.jsonForMap(optionsMap);
|
|
@@ -544,7 +579,7 @@ public class RadarModuleImpl {
|
|
|
544
579
|
trackingOptions = RadarTrackingOptions.fromJson(trackingOptionsJson);
|
|
545
580
|
}
|
|
546
581
|
Radar.startTrip(options, trackingOptions, new Radar.RadarTripCallback() {
|
|
547
|
-
|
|
582
|
+
|
|
548
583
|
public void onComplete(@NonNull Radar.RadarStatus status, @Nullable RadarTrip trip, @Nullable RadarEvent[] events) {
|
|
549
584
|
if (promise == null) {
|
|
550
585
|
return;
|
|
@@ -575,10 +610,10 @@ public class RadarModuleImpl {
|
|
|
575
610
|
}
|
|
576
611
|
}
|
|
577
612
|
|
|
578
|
-
|
|
613
|
+
|
|
579
614
|
public void completeTrip(final Promise promise) {
|
|
580
615
|
Radar.completeTrip(new Radar.RadarTripCallback() {
|
|
581
|
-
|
|
616
|
+
|
|
582
617
|
public void onComplete(@NonNull Radar.RadarStatus status, @Nullable RadarTrip trip, @Nullable RadarEvent[] events) {
|
|
583
618
|
if (promise == null) {
|
|
584
619
|
return;
|
|
@@ -605,10 +640,10 @@ public class RadarModuleImpl {
|
|
|
605
640
|
});
|
|
606
641
|
}
|
|
607
642
|
|
|
608
|
-
|
|
643
|
+
|
|
609
644
|
public void cancelTrip(final Promise promise) {
|
|
610
645
|
Radar.cancelTrip(new Radar.RadarTripCallback() {
|
|
611
|
-
|
|
646
|
+
|
|
612
647
|
public void onComplete(@NonNull Radar.RadarStatus status, @Nullable RadarTrip trip, @Nullable RadarEvent[] events) {
|
|
613
648
|
if (promise == null) {
|
|
614
649
|
return;
|
|
@@ -635,7 +670,7 @@ public class RadarModuleImpl {
|
|
|
635
670
|
});
|
|
636
671
|
}
|
|
637
672
|
|
|
638
|
-
|
|
673
|
+
|
|
639
674
|
public void updateTrip(ReadableMap optionsMap, final Promise promise) {
|
|
640
675
|
|
|
641
676
|
try {
|
|
@@ -667,7 +702,7 @@ public class RadarModuleImpl {
|
|
|
667
702
|
}
|
|
668
703
|
|
|
669
704
|
Radar.updateTrip(options, status, new Radar.RadarTripCallback() {
|
|
670
|
-
|
|
705
|
+
|
|
671
706
|
public void onComplete(@NonNull Radar.RadarStatus status, @Nullable RadarTrip trip, @Nullable RadarEvent[] events) {
|
|
672
707
|
if (promise == null) {
|
|
673
708
|
return;
|
|
@@ -698,14 +733,14 @@ public class RadarModuleImpl {
|
|
|
698
733
|
}
|
|
699
734
|
}
|
|
700
735
|
|
|
701
|
-
|
|
736
|
+
|
|
702
737
|
public void getContext(@Nullable ReadableMap locationMap, final Promise promise) {
|
|
703
738
|
if (promise == null) {
|
|
704
739
|
return;
|
|
705
740
|
}
|
|
706
741
|
|
|
707
742
|
Radar.RadarContextCallback callback = new Radar.RadarContextCallback() {
|
|
708
|
-
|
|
743
|
+
|
|
709
744
|
public void onComplete(@NonNull Radar.RadarStatus status, @Nullable Location location, @Nullable RadarContext context) {
|
|
710
745
|
if (status == Radar.RadarStatus.SUCCESS) {
|
|
711
746
|
try {
|
|
@@ -740,7 +775,7 @@ public class RadarModuleImpl {
|
|
|
740
775
|
}
|
|
741
776
|
}
|
|
742
777
|
|
|
743
|
-
|
|
778
|
+
|
|
744
779
|
public void searchPlaces(ReadableMap optionsMap, final Promise promise) {
|
|
745
780
|
if (promise == null) {
|
|
746
781
|
return;
|
|
@@ -764,7 +799,7 @@ public class RadarModuleImpl {
|
|
|
764
799
|
int limit = optionsMap.hasKey("limit") ? optionsMap.getInt("limit") : 10;
|
|
765
800
|
|
|
766
801
|
Radar.RadarSearchPlacesCallback callback = new Radar.RadarSearchPlacesCallback() {
|
|
767
|
-
|
|
802
|
+
|
|
768
803
|
public void onComplete(@NonNull Radar.RadarStatus status, @Nullable Location location, @Nullable RadarPlace[] places) {
|
|
769
804
|
if (status == Radar.RadarStatus.SUCCESS) {
|
|
770
805
|
try {
|
|
@@ -794,7 +829,7 @@ public class RadarModuleImpl {
|
|
|
794
829
|
}
|
|
795
830
|
}
|
|
796
831
|
|
|
797
|
-
|
|
832
|
+
|
|
798
833
|
public void searchGeofences(ReadableMap optionsMap, final Promise promise) {
|
|
799
834
|
if (promise == null) {
|
|
800
835
|
return;
|
|
@@ -824,10 +859,10 @@ public class RadarModuleImpl {
|
|
|
824
859
|
}
|
|
825
860
|
|
|
826
861
|
int limit = optionsMap.hasKey("limit") ? optionsMap.getInt("limit") : 100;
|
|
827
|
-
boolean includeGeometry = optionsMap.hasKey("includeGeometry") ? optionsMap.getBoolean("includeGeometry") : false;
|
|
862
|
+
boolean includeGeometry = optionsMap.hasKey("includeGeometry") ? optionsMap.getBoolean("includeGeometry") : false;
|
|
828
863
|
|
|
829
864
|
Radar.RadarSearchGeofencesCallback callback = new Radar.RadarSearchGeofencesCallback() {
|
|
830
|
-
|
|
865
|
+
|
|
831
866
|
public void onComplete(@NonNull Radar.RadarStatus status, @Nullable Location location, @Nullable RadarGeofence[] geofences) {
|
|
832
867
|
if (status == Radar.RadarStatus.SUCCESS) {
|
|
833
868
|
try {
|
|
@@ -857,7 +892,7 @@ public class RadarModuleImpl {
|
|
|
857
892
|
}
|
|
858
893
|
}
|
|
859
894
|
|
|
860
|
-
|
|
895
|
+
|
|
861
896
|
public void autocomplete(ReadableMap optionsMap, final Promise promise) {
|
|
862
897
|
if (promise == null) {
|
|
863
898
|
return;
|
|
@@ -895,7 +930,7 @@ public class RadarModuleImpl {
|
|
|
895
930
|
boolean mailable = optionsMap.hasKey("mailable") ? optionsMap.getBoolean("mailable") : false;
|
|
896
931
|
|
|
897
932
|
Radar.autocomplete(query, near, layers, limit, country, true, mailable, new Radar.RadarGeocodeCallback() {
|
|
898
|
-
|
|
933
|
+
|
|
899
934
|
public void onComplete(@NonNull Radar.RadarStatus status, @Nullable RadarAddress[] addresses) {
|
|
900
935
|
if (status == Radar.RadarStatus.SUCCESS) {
|
|
901
936
|
try {
|
|
@@ -916,7 +951,7 @@ public class RadarModuleImpl {
|
|
|
916
951
|
});
|
|
917
952
|
}
|
|
918
953
|
|
|
919
|
-
|
|
954
|
+
|
|
920
955
|
public void geocode(ReadableMap optionsMap, final Promise promise) {
|
|
921
956
|
if (promise == null) {
|
|
922
957
|
return;
|
|
@@ -933,7 +968,7 @@ public class RadarModuleImpl {
|
|
|
933
968
|
String[] countries = optionsMap.hasKey("countries") ? RadarUtils.stringArrayForArray(optionsMap.getArray("countries")) : null;
|
|
934
969
|
|
|
935
970
|
Radar.geocode(address, layers, countries, new Radar.RadarGeocodeCallback() {
|
|
936
|
-
|
|
971
|
+
|
|
937
972
|
public void onComplete(@NonNull Radar.RadarStatus status, @Nullable RadarAddress[] addresses) {
|
|
938
973
|
if (status == Radar.RadarStatus.SUCCESS) {
|
|
939
974
|
try {
|
|
@@ -954,7 +989,7 @@ public class RadarModuleImpl {
|
|
|
954
989
|
});
|
|
955
990
|
}
|
|
956
991
|
|
|
957
|
-
|
|
992
|
+
|
|
958
993
|
public void reverseGeocode(ReadableMap optionsMap, final Promise promise) {
|
|
959
994
|
if (promise == null) {
|
|
960
995
|
return;
|
|
@@ -969,7 +1004,7 @@ public class RadarModuleImpl {
|
|
|
969
1004
|
}
|
|
970
1005
|
|
|
971
1006
|
Radar.RadarGeocodeCallback callback = new Radar.RadarGeocodeCallback() {
|
|
972
|
-
|
|
1007
|
+
|
|
973
1008
|
public void onComplete(@NonNull Radar.RadarStatus status, @Nullable RadarAddress[] addresses) {
|
|
974
1009
|
if (status == Radar.RadarStatus.SUCCESS) {
|
|
975
1010
|
try {
|
|
@@ -1002,14 +1037,14 @@ public class RadarModuleImpl {
|
|
|
1002
1037
|
}
|
|
1003
1038
|
}
|
|
1004
1039
|
|
|
1005
|
-
|
|
1040
|
+
|
|
1006
1041
|
public void ipGeocode(final Promise promise) {
|
|
1007
1042
|
if (promise == null) {
|
|
1008
1043
|
return;
|
|
1009
1044
|
}
|
|
1010
1045
|
|
|
1011
1046
|
Radar.ipGeocode(new Radar.RadarIpGeocodeCallback() {
|
|
1012
|
-
|
|
1047
|
+
|
|
1013
1048
|
public void onComplete(@NonNull Radar.RadarStatus status, @Nullable RadarAddress address, boolean proxy) {
|
|
1014
1049
|
if (status == Radar.RadarStatus.SUCCESS) {
|
|
1015
1050
|
try {
|
|
@@ -1031,7 +1066,7 @@ public class RadarModuleImpl {
|
|
|
1031
1066
|
});
|
|
1032
1067
|
}
|
|
1033
1068
|
|
|
1034
|
-
|
|
1069
|
+
|
|
1035
1070
|
public void validateAddress(ReadableMap addressMap, final Promise promise) {
|
|
1036
1071
|
if (promise == null) {
|
|
1037
1072
|
return;
|
|
@@ -1045,7 +1080,7 @@ public class RadarModuleImpl {
|
|
|
1045
1080
|
return;
|
|
1046
1081
|
}
|
|
1047
1082
|
Radar.validateAddress(address, new Radar.RadarValidateAddressCallback() {
|
|
1048
|
-
|
|
1083
|
+
|
|
1049
1084
|
public void onComplete(@NonNull Radar.RadarStatus status, @Nullable RadarAddress address, @Nullable Radar.RadarAddressVerificationStatus verificationStatus) {
|
|
1050
1085
|
if (status == Radar.RadarStatus.SUCCESS) {
|
|
1051
1086
|
try {
|
|
@@ -1069,7 +1104,7 @@ public class RadarModuleImpl {
|
|
|
1069
1104
|
});
|
|
1070
1105
|
}
|
|
1071
1106
|
|
|
1072
|
-
|
|
1107
|
+
|
|
1073
1108
|
public void getDistance(ReadableMap optionsMap, final Promise promise) {
|
|
1074
1109
|
if (promise == null) {
|
|
1075
1110
|
return;
|
|
@@ -1113,7 +1148,7 @@ public class RadarModuleImpl {
|
|
|
1113
1148
|
Radar.RadarRouteUnits units = unitsStr != null && (unitsStr.equals("METRIC") || unitsStr.equals("metric")) ? Radar.RadarRouteUnits.METRIC : Radar.RadarRouteUnits.IMPERIAL;
|
|
1114
1149
|
|
|
1115
1150
|
Radar.RadarRouteCallback callback = new Radar.RadarRouteCallback() {
|
|
1116
|
-
|
|
1151
|
+
|
|
1117
1152
|
public void onComplete(@NonNull Radar.RadarStatus status, @Nullable RadarRoutes routes) {
|
|
1118
1153
|
if (status == Radar.RadarStatus.SUCCESS) {
|
|
1119
1154
|
try {
|
|
@@ -1140,7 +1175,7 @@ public class RadarModuleImpl {
|
|
|
1140
1175
|
}
|
|
1141
1176
|
}
|
|
1142
1177
|
|
|
1143
|
-
|
|
1178
|
+
|
|
1144
1179
|
public void getMatrix(ReadableMap optionsMap, final Promise promise) {
|
|
1145
1180
|
if (promise == null) {
|
|
1146
1181
|
return;
|
|
@@ -1187,7 +1222,7 @@ public class RadarModuleImpl {
|
|
|
1187
1222
|
Radar.RadarRouteUnits units = unitsStr != null && (unitsStr.equals("METRIC") || unitsStr.equals("metric")) ? Radar.RadarRouteUnits.METRIC : Radar.RadarRouteUnits.IMPERIAL;
|
|
1188
1223
|
|
|
1189
1224
|
Radar.getMatrix(origins, destinations, mode, units, new Radar.RadarMatrixCallback() {
|
|
1190
|
-
|
|
1225
|
+
|
|
1191
1226
|
public void onComplete(@NonNull Radar.RadarStatus status, @Nullable RadarRouteMatrix matrix) {
|
|
1192
1227
|
if (status == Radar.RadarStatus.SUCCESS) {
|
|
1193
1228
|
try {
|
|
@@ -1208,7 +1243,7 @@ public class RadarModuleImpl {
|
|
|
1208
1243
|
});
|
|
1209
1244
|
}
|
|
1210
1245
|
|
|
1211
|
-
|
|
1246
|
+
|
|
1212
1247
|
public void logConversion(ReadableMap optionsMap, final Promise promise) throws JSONException {
|
|
1213
1248
|
if (promise == null) {
|
|
1214
1249
|
return;
|
|
@@ -1223,10 +1258,10 @@ public class RadarModuleImpl {
|
|
|
1223
1258
|
String name = optionsMap.getString("name");
|
|
1224
1259
|
Double revenue = optionsMap.hasKey("revenue") ? new Double(optionsMap.getDouble("revenue")) : null;
|
|
1225
1260
|
ReadableMap metadata = optionsMap.hasKey("metadata") ? optionsMap.getMap("metadata") : null;
|
|
1226
|
-
|
|
1261
|
+
|
|
1227
1262
|
JSONObject metadataObj = RadarUtils.jsonForMap(metadata);
|
|
1228
1263
|
Radar.RadarLogConversionCallback callback = new Radar.RadarLogConversionCallback() {
|
|
1229
|
-
|
|
1264
|
+
|
|
1230
1265
|
public void onComplete(@NonNull Radar.RadarStatus status, @Nullable RadarEvent event) {
|
|
1231
1266
|
try {
|
|
1232
1267
|
if (status == Radar.RadarStatus.SUCCESS) {
|
|
@@ -1253,4 +1288,3 @@ public class RadarModuleImpl {
|
|
|
1253
1288
|
}
|
|
1254
1289
|
}
|
|
1255
1290
|
}
|
|
1256
|
-
|
|
@@ -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;
|