react-native-radar 3.1.4 → 3.2.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/android/build.gradle +14 -13
- package/android/gradle/wrapper/gradle-wrapper.properties +1 -1
- package/android/gradle.properties +1 -0
- package/android/src/main/AndroidManifest.xml +0 -11
- package/android/src/main/java/io/radar/react/RNRadarModule.java +50 -19
- package/android/src/main/java/io/radar/react/RNRadarReceiver.java +7 -28
- package/ios/RNRadar.h +1 -1
- package/ios/RNRadar.m +35 -14
- package/js/index.js +3 -3
- package/package.json +7 -5
- package/react-native-radar.podspec +1 -1
package/android/build.gradle
CHANGED
|
@@ -1,26 +1,24 @@
|
|
|
1
1
|
buildscript {
|
|
2
2
|
repositories {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
jcenter()
|
|
3
|
+
google()
|
|
4
|
+
mavenCentral()
|
|
7
5
|
}
|
|
8
6
|
|
|
9
7
|
dependencies {
|
|
10
|
-
classpath 'com.android.tools.build:gradle:
|
|
8
|
+
classpath 'com.android.tools.build:gradle:7.0.3'
|
|
11
9
|
}
|
|
12
10
|
}
|
|
13
11
|
|
|
14
12
|
apply plugin: 'com.android.library'
|
|
15
13
|
|
|
16
14
|
android {
|
|
17
|
-
compileSdkVersion
|
|
15
|
+
compileSdkVersion 31
|
|
18
16
|
|
|
19
17
|
defaultConfig {
|
|
20
18
|
minSdkVersion 16
|
|
21
|
-
targetSdkVersion
|
|
19
|
+
targetSdkVersion 31
|
|
22
20
|
versionCode 1
|
|
23
|
-
versionName '3.
|
|
21
|
+
versionName '3.2.0'
|
|
24
22
|
}
|
|
25
23
|
lintOptions {
|
|
26
24
|
abortOnError false
|
|
@@ -28,14 +26,17 @@ android {
|
|
|
28
26
|
testOptions {
|
|
29
27
|
unitTests.returnDefaultValues = true
|
|
30
28
|
}
|
|
29
|
+
configurations.all {
|
|
30
|
+
resolutionStrategy {
|
|
31
|
+
force 'androidx.core:core:1.6.0'
|
|
32
|
+
force 'androidx.core:core-ktx:1.6.0'
|
|
33
|
+
}
|
|
34
|
+
}
|
|
31
35
|
}
|
|
32
36
|
|
|
33
37
|
repositories {
|
|
34
38
|
mavenCentral()
|
|
35
|
-
|
|
36
|
-
url 'https://maven.google.com'
|
|
37
|
-
}
|
|
38
|
-
jcenter()
|
|
39
|
+
google()
|
|
39
40
|
maven {
|
|
40
41
|
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
|
|
41
42
|
url "$rootDir/../node_modules/react-native/android"
|
|
@@ -44,5 +45,5 @@ repositories {
|
|
|
44
45
|
|
|
45
46
|
dependencies {
|
|
46
47
|
api 'com.facebook.react:react-native:+'
|
|
47
|
-
api 'io.radar:sdk:3.
|
|
48
|
+
api 'io.radar:sdk:3.2.3'
|
|
48
49
|
}
|
|
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
|
|
|
3
3
|
distributionPath=wrapper/dists
|
|
4
4
|
zipStoreBase=GRADLE_USER_HOME
|
|
5
5
|
zipStorePath=wrapper/dists
|
|
6
|
-
distributionUrl=https\://services.gradle.org/distributions/gradle-
|
|
6
|
+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
android.useAndroidX=true
|
|
@@ -1,15 +1,4 @@
|
|
|
1
1
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
|
2
2
|
package="io.radar.react">
|
|
3
3
|
|
|
4
|
-
<application>
|
|
5
|
-
<receiver
|
|
6
|
-
android:name="io.radar.react.RNRadarReceiver"
|
|
7
|
-
android:enabled="true"
|
|
8
|
-
android:exported="false">
|
|
9
|
-
<intent-filter>
|
|
10
|
-
<action android:name="io.radar.sdk.RECEIVED" />
|
|
11
|
-
</intent-filter>
|
|
12
|
-
</receiver>
|
|
13
|
-
</application>
|
|
14
|
-
|
|
15
4
|
</manifest>
|
|
@@ -19,6 +19,8 @@ import com.facebook.react.bridge.ReactMethod;
|
|
|
19
19
|
import com.facebook.react.bridge.ReadableArray;
|
|
20
20
|
import com.facebook.react.bridge.ReadableMap;
|
|
21
21
|
import com.facebook.react.bridge.WritableMap;
|
|
22
|
+
import com.facebook.react.modules.core.PermissionAwareActivity;
|
|
23
|
+
import com.facebook.react.modules.core.PermissionListener;
|
|
22
24
|
import io.radar.sdk.Radar;
|
|
23
25
|
import io.radar.sdk.RadarTrackingOptions;
|
|
24
26
|
import io.radar.sdk.RadarTripOptions;
|
|
@@ -29,6 +31,7 @@ import io.radar.sdk.model.RadarGeofence;
|
|
|
29
31
|
import io.radar.sdk.model.RadarPlace;
|
|
30
32
|
import io.radar.sdk.model.RadarRouteMatrix;
|
|
31
33
|
import io.radar.sdk.model.RadarRoutes;
|
|
34
|
+
import io.radar.sdk.model.RadarTrip;
|
|
32
35
|
import io.radar.sdk.model.RadarUser;
|
|
33
36
|
|
|
34
37
|
import org.json.JSONException;
|
|
@@ -36,12 +39,15 @@ import org.json.JSONObject;
|
|
|
36
39
|
|
|
37
40
|
import java.util.EnumSet;
|
|
38
41
|
|
|
39
|
-
public class RNRadarModule extends ReactContextBaseJavaModule {
|
|
42
|
+
public class RNRadarModule extends ReactContextBaseJavaModule implements PermissionListener {
|
|
40
43
|
|
|
41
44
|
private static final String TAG = "RNRadarModule";
|
|
45
|
+
private static final int PERMISSIONS_REQUEST_CODE = 20160525; // random request code (Radar's birthday!)
|
|
46
|
+
private Promise mPermissionsRequestPromise;
|
|
42
47
|
|
|
43
48
|
public RNRadarModule(ReactApplicationContext reactContext) {
|
|
44
49
|
super(reactContext);
|
|
50
|
+
Radar.setReceiver(new RNRadarReceiver());
|
|
45
51
|
}
|
|
46
52
|
|
|
47
53
|
@Override
|
|
@@ -82,34 +88,57 @@ public class RNRadarModule extends ReactContextBaseJavaModule {
|
|
|
82
88
|
}
|
|
83
89
|
|
|
84
90
|
@ReactMethod
|
|
85
|
-
public void getPermissionsStatus(Promise promise) {
|
|
91
|
+
public void getPermissionsStatus(final Promise promise) {
|
|
86
92
|
if (promise == null) {
|
|
87
93
|
return;
|
|
88
94
|
}
|
|
89
95
|
|
|
90
|
-
|
|
96
|
+
Activity activity = getCurrentActivity();
|
|
97
|
+
|
|
98
|
+
if (activity == null) {
|
|
99
|
+
promise.resolve("UNKNOWN");
|
|
100
|
+
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
boolean foreground = ActivityCompat.checkSelfPermission(activity, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED;
|
|
105
|
+
boolean background = foreground;
|
|
106
|
+
boolean denied = ActivityCompat.shouldShowRequestPermissionRationale(activity, Manifest.permission.ACCESS_FINE_LOCATION);
|
|
107
|
+
|
|
91
108
|
if (Build.VERSION.SDK_INT >= 29) {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
109
|
+
background = ActivityCompat.checkSelfPermission(activity, Manifest.permission.ACCESS_BACKGROUND_LOCATION) == PackageManager.PERMISSION_GRANTED;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
if (background) {
|
|
113
|
+
promise.resolve("GRANTED_BACKGROUND");
|
|
114
|
+
} else if (foreground) {
|
|
115
|
+
promise.resolve("GRANTED_FOREGROUND");
|
|
116
|
+
} else if (denied) {
|
|
117
|
+
promise.resolve("DENIED");
|
|
98
118
|
} else {
|
|
99
|
-
promise.resolve(
|
|
119
|
+
promise.resolve("NOT_DETERMINED");
|
|
100
120
|
}
|
|
101
121
|
}
|
|
102
122
|
|
|
123
|
+
@Override
|
|
124
|
+
public boolean onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
|
|
125
|
+
if (requestCode == PERMISSIONS_REQUEST_CODE && mPermissionsRequestPromise != null) {
|
|
126
|
+
getPermissionsStatus(mPermissionsRequestPromise);
|
|
127
|
+
mPermissionsRequestPromise = null;
|
|
128
|
+
}
|
|
129
|
+
return true;
|
|
130
|
+
}
|
|
131
|
+
|
|
103
132
|
@ReactMethod
|
|
104
|
-
public void requestPermissions(boolean background) {
|
|
105
|
-
|
|
133
|
+
public void requestPermissions(boolean background, final Promise promise) {
|
|
134
|
+
PermissionAwareActivity activity = (PermissionAwareActivity)getCurrentActivity();
|
|
135
|
+
mPermissionsRequestPromise = promise;
|
|
106
136
|
if (activity != null) {
|
|
107
137
|
if (Build.VERSION.SDK_INT >= 23) {
|
|
108
|
-
int requestCode = 0;
|
|
109
138
|
if (background && Build.VERSION.SDK_INT >= 29) {
|
|
110
|
-
|
|
139
|
+
activity.requestPermissions(new String[] { Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_BACKGROUND_LOCATION }, PERMISSIONS_REQUEST_CODE, this);
|
|
111
140
|
} else {
|
|
112
|
-
|
|
141
|
+
activity.requestPermissions(new String[] { Manifest.permission.ACCESS_FINE_LOCATION }, PERMISSIONS_REQUEST_CODE, this);
|
|
113
142
|
}
|
|
114
143
|
}
|
|
115
144
|
}
|
|
@@ -308,7 +337,7 @@ public class RNRadarModule extends ReactContextBaseJavaModule {
|
|
|
308
337
|
RadarTripOptions options = RadarTripOptions.fromJson(optionsObj);
|
|
309
338
|
Radar.startTrip(options, new Radar.RadarTripCallback() {
|
|
310
339
|
@Override
|
|
311
|
-
public void onComplete(@NonNull Radar.RadarStatus status) {
|
|
340
|
+
public void onComplete(@NonNull Radar.RadarStatus status, @Nullable RadarTrip trip, @Nullable RadarEvent[] events) {
|
|
312
341
|
|
|
313
342
|
}
|
|
314
343
|
});
|
|
@@ -321,7 +350,7 @@ public class RNRadarModule extends ReactContextBaseJavaModule {
|
|
|
321
350
|
public void completeTrip() {
|
|
322
351
|
Radar.completeTrip(new Radar.RadarTripCallback() {
|
|
323
352
|
@Override
|
|
324
|
-
public void onComplete(@NonNull Radar.RadarStatus status) {
|
|
353
|
+
public void onComplete(@NonNull Radar.RadarStatus status, @Nullable RadarTrip trip, @Nullable RadarEvent[] events) {
|
|
325
354
|
|
|
326
355
|
}
|
|
327
356
|
});
|
|
@@ -331,7 +360,7 @@ public class RNRadarModule extends ReactContextBaseJavaModule {
|
|
|
331
360
|
public void cancelTrip() {
|
|
332
361
|
Radar.cancelTrip(new Radar.RadarTripCallback() {
|
|
333
362
|
@Override
|
|
334
|
-
public void onComplete(@NonNull Radar.RadarStatus status) {
|
|
363
|
+
public void onComplete(@NonNull Radar.RadarStatus status, @Nullable RadarTrip trip, @Nullable RadarEvent[] events) {
|
|
335
364
|
|
|
336
365
|
}
|
|
337
366
|
});
|
|
@@ -539,8 +568,10 @@ public class RNRadarModule extends ReactContextBaseJavaModule {
|
|
|
539
568
|
near.setLatitude(latitude);
|
|
540
569
|
near.setLongitude(longitude);
|
|
541
570
|
int limit = optionsMap.hasKey("limit") ? optionsMap.getInt("limit") : 10;
|
|
571
|
+
String country = optionsMap.hasKey("country") ? optionsMap.getString("country") : null;
|
|
572
|
+
String[] layers = optionsMap.hasKey("layers") ? RNRadarUtils.stringArrayForArray(optionsMap.getArray("layers")) : null;
|
|
542
573
|
|
|
543
|
-
Radar.autocomplete(query, near, limit, new Radar.RadarGeocodeCallback() {
|
|
574
|
+
Radar.autocomplete(query, near, layers, limit, country, new Radar.RadarGeocodeCallback() {
|
|
544
575
|
@Override
|
|
545
576
|
public void onComplete(@NonNull Radar.RadarStatus status, @Nullable RadarAddress[] addresses) {
|
|
546
577
|
if (status == Radar.RadarStatus.SUCCESS) {
|
|
@@ -5,6 +5,7 @@ import android.location.Location;
|
|
|
5
5
|
import android.util.Log;
|
|
6
6
|
|
|
7
7
|
import androidx.annotation.NonNull;
|
|
8
|
+
import androidx.annotation.Nullable;
|
|
8
9
|
|
|
9
10
|
import com.facebook.react.ReactApplication;
|
|
10
11
|
import com.facebook.react.ReactInstanceManager;
|
|
@@ -23,49 +24,27 @@ import java.util.concurrent.atomic.AtomicInteger;
|
|
|
23
24
|
public class RNRadarReceiver extends RadarReceiver {
|
|
24
25
|
|
|
25
26
|
private ReactNativeHost reactNativeHost;
|
|
26
|
-
private PendingResult result;
|
|
27
|
-
private AtomicInteger pendingCount = new AtomicInteger(0);
|
|
28
27
|
private static final String TAG = "RNRadarReceiver";
|
|
29
28
|
|
|
30
|
-
private void invokeSendEvent(ReactContext reactContext, String eventName, Object data) {
|
|
31
|
-
reactContext.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class).emit(eventName, data);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
29
|
private void sendEvent(final String eventName, final Object data) {
|
|
35
30
|
final ReactInstanceManager reactInstanceManager = reactNativeHost.getReactInstanceManager();
|
|
36
31
|
ReactContext reactContext = reactInstanceManager.getCurrentReactContext();
|
|
37
|
-
if (reactContext
|
|
38
|
-
|
|
39
|
-
result = goAsync();
|
|
40
|
-
}
|
|
41
|
-
pendingCount.incrementAndGet();
|
|
42
|
-
reactInstanceManager.addReactInstanceEventListener(new ReactInstanceManager.ReactInstanceEventListener() {
|
|
43
|
-
@Override
|
|
44
|
-
public void onReactContextInitialized(ReactContext reactContext) {
|
|
45
|
-
invokeSendEvent(reactContext, eventName, data);
|
|
46
|
-
reactInstanceManager.removeReactInstanceEventListener(this);
|
|
47
|
-
if (pendingCount.decrementAndGet() == 0) {
|
|
48
|
-
result.finish();
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
});
|
|
52
|
-
if (!reactInstanceManager.hasStartedCreatingInitialContext()) {
|
|
53
|
-
reactInstanceManager.createReactContextInBackground();
|
|
54
|
-
}
|
|
55
|
-
} else {
|
|
56
|
-
invokeSendEvent(reactContext, eventName, data);
|
|
32
|
+
if (reactContext != null) {
|
|
33
|
+
reactContext.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class).emit(eventName, data);
|
|
57
34
|
}
|
|
58
35
|
}
|
|
59
36
|
|
|
60
37
|
@Override
|
|
61
|
-
public void onEventsReceived(@NonNull Context context, @NonNull RadarEvent[] events, @
|
|
38
|
+
public void onEventsReceived(@NonNull Context context, @NonNull RadarEvent[] events, @Nullable RadarUser user) {
|
|
62
39
|
try {
|
|
63
40
|
ReactApplication reactApplication = ((ReactApplication)context.getApplicationContext());
|
|
64
41
|
reactNativeHost = reactApplication.getReactNativeHost();
|
|
65
42
|
|
|
66
43
|
WritableMap map = Arguments.createMap();
|
|
67
44
|
map.putArray("events", RNRadarUtils.arrayForJson(RadarEvent.toJson(events)));
|
|
68
|
-
|
|
45
|
+
if (user != null) {
|
|
46
|
+
map.putMap("user", RNRadarUtils.mapForJson(user.toJson()));
|
|
47
|
+
}
|
|
69
48
|
|
|
70
49
|
sendEvent("events", map);
|
|
71
50
|
} catch (Exception e) {
|
package/ios/RNRadar.h
CHANGED
package/ios/RNRadar.m
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
@implementation RNRadar {
|
|
8
8
|
BOOL hasListeners;
|
|
9
9
|
CLLocationManager *locationManager;
|
|
10
|
+
RCTPromiseResolveBlock permissionsRequestResolver;
|
|
10
11
|
}
|
|
11
12
|
|
|
12
13
|
RCT_EXPORT_MODULE();
|
|
@@ -16,10 +17,18 @@ RCT_EXPORT_MODULE();
|
|
|
16
17
|
if (self) {
|
|
17
18
|
[Radar setDelegate:self];
|
|
18
19
|
locationManager = [CLLocationManager new];
|
|
20
|
+
locationManager.delegate = self;
|
|
19
21
|
}
|
|
20
22
|
return self;
|
|
21
23
|
}
|
|
22
24
|
|
|
25
|
+
- (void)locationManager:(CLLocationManager *)manager didChangeAuthorizationStatus:(CLAuthorizationStatus)status {
|
|
26
|
+
if (permissionsRequestResolver) {
|
|
27
|
+
[self getPermissionsStatusWithResolver:permissionsRequestResolver rejecter:nil];
|
|
28
|
+
permissionsRequestResolver = nil;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
23
32
|
+ (BOOL)requiresMainQueueSetup {
|
|
24
33
|
return YES;
|
|
25
34
|
}
|
|
@@ -40,13 +49,14 @@ RCT_EXPORT_MODULE();
|
|
|
40
49
|
hasListeners = NO;
|
|
41
50
|
}
|
|
42
51
|
|
|
43
|
-
- (void)didReceiveEvents:(NSArray<RadarEvent *> *)events user:(RadarUser *)user {
|
|
52
|
+
- (void)didReceiveEvents:(NSArray<RadarEvent *> *)events user:(RadarUser * _Nullable )user {
|
|
44
53
|
if (hasListeners) {
|
|
45
|
-
[
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}
|
|
54
|
+
NSMutableDictionary *body = [NSMutableDictionary new];
|
|
55
|
+
[body setValue:[RadarEvent arrayForEvents:events] forKey:@"events"];
|
|
56
|
+
if (user) {
|
|
57
|
+
[body setValue:[user dictionaryValue] forKey:@"user"];
|
|
58
|
+
}
|
|
59
|
+
[self sendEventWithName:@"events" body:body];
|
|
50
60
|
}
|
|
51
61
|
}
|
|
52
62
|
|
|
@@ -64,7 +74,7 @@ RCT_EXPORT_MODULE();
|
|
|
64
74
|
[self sendEventWithName:@"clientLocation" body:@{
|
|
65
75
|
@"location": [Radar dictionaryForLocation:location],
|
|
66
76
|
@"stopped": @(stopped),
|
|
67
|
-
@"source": [Radar
|
|
77
|
+
@"source": [Radar stringForLocationSource:source]
|
|
68
78
|
}];
|
|
69
79
|
}
|
|
70
80
|
}
|
|
@@ -125,6 +135,9 @@ RCT_REMAP_METHOD(getPermissionsStatus, getPermissionsStatusWithResolver:(RCTProm
|
|
|
125
135
|
case kCLAuthorizationStatusAuthorizedWhenInUse:
|
|
126
136
|
statusStr = @"GRANTED_FOREGROUND";
|
|
127
137
|
break;
|
|
138
|
+
case kCLAuthorizationStatusNotDetermined:
|
|
139
|
+
statusStr = @"NOT_DETERMINED";
|
|
140
|
+
break;
|
|
128
141
|
default:
|
|
129
142
|
statusStr = @"DENIED";
|
|
130
143
|
break;
|
|
@@ -132,11 +145,16 @@ RCT_REMAP_METHOD(getPermissionsStatus, getPermissionsStatusWithResolver:(RCTProm
|
|
|
132
145
|
resolve(statusStr);
|
|
133
146
|
}
|
|
134
147
|
|
|
135
|
-
RCT_EXPORT_METHOD(requestPermissions:(BOOL)background) {
|
|
136
|
-
|
|
148
|
+
RCT_EXPORT_METHOD(requestPermissions:(BOOL)background resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject) {
|
|
149
|
+
permissionsRequestResolver = resolve;
|
|
150
|
+
|
|
151
|
+
CLAuthorizationStatus status = [CLLocationManager authorizationStatus];
|
|
152
|
+
if (background && status == kCLAuthorizationStatusAuthorizedWhenInUse) {
|
|
137
153
|
[locationManager requestAlwaysAuthorization];
|
|
138
|
-
} else {
|
|
154
|
+
} else if (status == kCLAuthorizationStatusNotDetermined) {
|
|
139
155
|
[locationManager requestWhenInUseAuthorization];
|
|
156
|
+
} else {
|
|
157
|
+
[self getPermissionsStatusWithResolver:resolve rejecter:reject];
|
|
140
158
|
}
|
|
141
159
|
}
|
|
142
160
|
|
|
@@ -228,15 +246,15 @@ RCT_EXPORT_METHOD(trackOnce:(NSDictionary *)locationDict resolve:(RCTPromiseReso
|
|
|
228
246
|
}
|
|
229
247
|
|
|
230
248
|
RCT_EXPORT_METHOD(startTrackingEfficient) {
|
|
231
|
-
[Radar startTrackingWithOptions:RadarTrackingOptions.
|
|
249
|
+
[Radar startTrackingWithOptions:RadarTrackingOptions.presetEfficient];
|
|
232
250
|
}
|
|
233
251
|
|
|
234
252
|
RCT_EXPORT_METHOD(startTrackingResponsive) {
|
|
235
|
-
[Radar startTrackingWithOptions:RadarTrackingOptions.
|
|
253
|
+
[Radar startTrackingWithOptions:RadarTrackingOptions.presetResponsive];
|
|
236
254
|
}
|
|
237
255
|
|
|
238
256
|
RCT_EXPORT_METHOD(startTrackingContinuous) {
|
|
239
|
-
[Radar startTrackingWithOptions:RadarTrackingOptions.
|
|
257
|
+
[Radar startTrackingWithOptions:RadarTrackingOptions.presetContinuous];
|
|
240
258
|
}
|
|
241
259
|
|
|
242
260
|
RCT_EXPORT_METHOD(startTrackingCustom:(NSDictionary *)optionsDict) {
|
|
@@ -502,10 +520,13 @@ RCT_EXPORT_METHOD(autocomplete:(NSDictionary *)optionsDict resolve:(RCTPromiseRe
|
|
|
502
520
|
limit = 10;
|
|
503
521
|
}
|
|
504
522
|
|
|
523
|
+
NSArray *layers = optionsDict[@"layers"];
|
|
524
|
+
NSString *country = optionsDict[@"country"];
|
|
525
|
+
|
|
505
526
|
__block RCTPromiseResolveBlock resolver = resolve;
|
|
506
527
|
__block RCTPromiseRejectBlock rejecter = reject;
|
|
507
528
|
|
|
508
|
-
[Radar autocompleteQuery:query near:near limit:limit completionHandler:^(RadarStatus status, NSArray<RadarAddress *> * _Nullable addresses) {
|
|
529
|
+
[Radar autocompleteQuery:query near:near layers:layers limit:limit country:country completionHandler:^(RadarStatus status, NSArray<RadarAddress *> * _Nullable addresses) {
|
|
509
530
|
if (status == RadarStatusSuccess && resolver) {
|
|
510
531
|
NSMutableDictionary *dict = [NSMutableDictionary new];
|
|
511
532
|
[dict setObject:[Radar stringForStatus:status] forKey:@"status"];
|
package/js/index.js
CHANGED
|
@@ -26,9 +26,9 @@ const getPermissionsStatus = () => (
|
|
|
26
26
|
NativeModules.RNRadar.getPermissionsStatus()
|
|
27
27
|
);
|
|
28
28
|
|
|
29
|
-
const requestPermissions =
|
|
30
|
-
NativeModules.RNRadar.requestPermissions(background)
|
|
31
|
-
|
|
29
|
+
const requestPermissions = background => (
|
|
30
|
+
NativeModules.RNRadar.requestPermissions(background)
|
|
31
|
+
);
|
|
32
32
|
|
|
33
33
|
const getLocation = () => (
|
|
34
34
|
NativeModules.RNRadar.getLocation()
|
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.io",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
|
-
"version": "3.
|
|
6
|
+
"version": "3.2.0",
|
|
7
7
|
"main": "js/index.js",
|
|
8
8
|
"files": [
|
|
9
9
|
"android",
|
|
@@ -23,7 +23,6 @@
|
|
|
23
23
|
"jest-junit"
|
|
24
24
|
]
|
|
25
25
|
},
|
|
26
|
-
"dependencies": {},
|
|
27
26
|
"peerDependencies": {
|
|
28
27
|
"react": ">= 16.8.6",
|
|
29
28
|
"react-native": ">= 0.60.0"
|
|
@@ -36,6 +35,7 @@
|
|
|
36
35
|
"babel-core": "^7.0.0-bridge.0",
|
|
37
36
|
"babel-eslint": "^10.0.1",
|
|
38
37
|
"babel-jest": "^23.4.2",
|
|
38
|
+
"braces": ">=2.3.2",
|
|
39
39
|
"eslint": "^5.6.1",
|
|
40
40
|
"eslint-config-airbnb": "^17.1.0",
|
|
41
41
|
"eslint-plugin-import": "^2.14.0",
|
|
@@ -44,12 +44,11 @@
|
|
|
44
44
|
"eslint-plugin-react": "^7.11.1",
|
|
45
45
|
"jest": "^23.6.0",
|
|
46
46
|
"jest-junit": "^5.2.0",
|
|
47
|
+
"logkitty": ">=0.7.1",
|
|
47
48
|
"metro-react-native-babel-preset": "^0.51.1",
|
|
48
49
|
"npm-run-all": "^4.1.5",
|
|
49
50
|
"react": "16.8.6",
|
|
50
|
-
"react-native": "0.60.0"
|
|
51
|
-
"braces": ">=2.3.2",
|
|
52
|
-
"logkitty": ">=0.7.1"
|
|
51
|
+
"react-native": "0.60.0"
|
|
53
52
|
},
|
|
54
53
|
"bugs": {
|
|
55
54
|
"url": "https://github.com/radarlabs/react-native-radar/issues"
|
|
@@ -57,5 +56,8 @@
|
|
|
57
56
|
"repository": {
|
|
58
57
|
"type": "git",
|
|
59
58
|
"url": "https://github.com/radarlabs/react-native-radar.git"
|
|
59
|
+
},
|
|
60
|
+
"dependencies": {
|
|
61
|
+
"@react-native-community/netinfo": "^7.1.3"
|
|
60
62
|
}
|
|
61
63
|
}
|