react-native-radar 3.5.6 → 3.5.8

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.
@@ -18,7 +18,7 @@ android {
18
18
  minSdkVersion 16
19
19
  targetSdkVersion 31
20
20
  versionCode 1
21
- versionName '3.5.6'
21
+ versionName '3.5.8'
22
22
  }
23
23
  lintOptions {
24
24
  abortOnError false
@@ -45,5 +45,5 @@ repositories {
45
45
 
46
46
  dependencies {
47
47
  api 'com.facebook.react:react-native:+'
48
- api 'io.radar:sdk:3.5.4'
48
+ api 'io.radar:sdk:3.5.9'
49
49
  }
@@ -39,6 +39,7 @@ import org.json.JSONException;
39
39
  import org.json.JSONObject;
40
40
 
41
41
  import java.util.EnumSet;
42
+ import java.util.Map;
42
43
 
43
44
  public class RNRadarModule extends ReactContextBaseJavaModule implements PermissionListener {
44
45
 
@@ -56,6 +57,11 @@ public class RNRadarModule extends ReactContextBaseJavaModule implements Permiss
56
57
  return "RNRadar";
57
58
  }
58
59
 
60
+ @ReactMethod
61
+ public void initialize(String publishableKey) {
62
+ Radar.initialize(getReactApplicationContext(), publishableKey);
63
+ }
64
+
59
65
  @ReactMethod
60
66
  public void setLogLevel(String level) {
61
67
  Radar.RadarLogLevel logLevel = Radar.RadarLogLevel.NONE;
@@ -78,16 +84,54 @@ public class RNRadarModule extends ReactContextBaseJavaModule implements Permiss
78
84
  Radar.setUserId(userId);
79
85
  }
80
86
 
87
+ @ReactMethod
88
+ public void getUserId(final Promise promise) {
89
+ if (promise == null) {
90
+ return;
91
+ }
92
+
93
+ promise.resolve(Radar.getUserId());
94
+ }
95
+
81
96
  @ReactMethod
82
97
  public void setDescription(String description) {
83
98
  Radar.setDescription(description);
84
99
  }
85
100
 
101
+ @ReactMethod
102
+ public void getDescription(final Promise promise) {
103
+ if (promise == null) {
104
+ return;
105
+ }
106
+
107
+ promise.resolve(Radar.getDescription());
108
+ }
109
+
86
110
  @ReactMethod
87
111
  public void setMetadata(ReadableMap metadataMap) throws JSONException {
88
112
  Radar.setMetadata(RNRadarUtils.jsonForMap(metadataMap));
89
113
  }
90
114
 
115
+ @ReactMethod
116
+ public void getMetadata(final Promise promise) throws JSONException {
117
+ if (promise == null) {
118
+ return;
119
+ }
120
+
121
+ JSONObject metaJson = Radar.getMetadata();
122
+ promise.resolve(RNRadarUtils.mapForJson(metaJson));
123
+ }
124
+
125
+ @ReactMethod
126
+ public void setAnonymousTrackingEnabled(boolean enabled) {
127
+ Radar.setAnonymousTrackingEnabled(enabled);
128
+ }
129
+
130
+ @ReactMethod
131
+ public void setAdIdEnabled(boolean enabled) {
132
+ Radar.setAdIdEnabled(enabled);
133
+ }
134
+
91
135
  @ReactMethod
92
136
  public void getPermissionsStatus(final Promise promise) {
93
137
  if (promise == null) {
@@ -146,8 +190,22 @@ public class RNRadarModule extends ReactContextBaseJavaModule implements Permiss
146
190
  }
147
191
 
148
192
  @ReactMethod
149
- public void getLocation(final Promise promise) {
150
- Radar.getLocation(new Radar.RadarLocationCallback() {
193
+ public void getLocation(String desiredAccuracy, final Promise promise) {
194
+
195
+ RadarTrackingOptions.RadarTrackingOptionsDesiredAccuracy accuracyLevel = RadarTrackingOptions.RadarTrackingOptionsDesiredAccuracy.MEDIUM;
196
+ String accuracy = desiredAccuracy != null ? desiredAccuracy.toLowerCase() : "medium";
197
+
198
+ if (accuracy.equals("low")) {
199
+ accuracyLevel = RadarTrackingOptions.RadarTrackingOptionsDesiredAccuracy.LOW;
200
+ } else if (accuracy.equals("medium")) {
201
+ accuracyLevel = RadarTrackingOptions.RadarTrackingOptionsDesiredAccuracy.MEDIUM;
202
+ } else if (accuracy.equals("high")) {
203
+ accuracyLevel = RadarTrackingOptions.RadarTrackingOptionsDesiredAccuracy.HIGH;
204
+ } else {
205
+ promise.reject(Radar.RadarStatus.ERROR_BAD_REQUEST.toString(), Radar.RadarStatus.ERROR_BAD_REQUEST.toString());
206
+ }
207
+
208
+ Radar.getLocation(accuracyLevel, new Radar.RadarLocationCallback() {
151
209
  @Override
152
210
  public void onComplete(@NonNull Radar.RadarStatus status, @Nullable Location location, boolean stopped) {
153
211
  if (promise == null) {
@@ -312,6 +370,29 @@ public class RNRadarModule extends ReactContextBaseJavaModule implements Permiss
312
370
  Radar.stopTracking();
313
371
  }
314
372
 
373
+ @ReactMethod
374
+ public void isTracking(final Promise promise) {
375
+ if (promise == null) {
376
+ return;
377
+ }
378
+
379
+ promise.resolve(Radar.isTracking());
380
+ }
381
+
382
+ @ReactMethod
383
+ public void getTrackingOptions(final Promise promise) {
384
+ if (promise == null) {
385
+ return;
386
+ }
387
+ try {
388
+ RadarTrackingOptions options = Radar.getTrackingOptions();
389
+ promise.resolve(RNRadarUtils.mapForJson(options.toJson()));
390
+ } catch(JSONException e) {
391
+ Log.e(TAG, "JSONException", e);
392
+ promise.reject(Radar.RadarStatus.ERROR_SERVER.toString(), Radar.RadarStatus.ERROR_SERVER.toString());
393
+ }
394
+ }
395
+
315
396
  @ReactMethod
316
397
  public void setForegroundServiceOptions(ReadableMap optionsMap) {
317
398
  try {
@@ -333,12 +414,38 @@ public class RNRadarModule extends ReactContextBaseJavaModule implements Permiss
333
414
  Radar.rejectEvent(eventId);
334
415
  }
335
416
 
417
+ @ReactMethod
418
+ public void getTripOptions(final Promise promise) {
419
+ if (promise == null) {
420
+ return;
421
+ }
422
+ try {
423
+ RadarTripOptions options = Radar.getTripOptions();
424
+ promise.resolve(options != null ? RNRadarUtils.mapForJson(options.toJson()) : null);
425
+ } catch(JSONException e) {
426
+ Log.e(TAG, "JSONException", e);
427
+ promise.reject(Radar.RadarStatus.ERROR_SERVER.toString(), Radar.RadarStatus.ERROR_SERVER.toString());
428
+ }
429
+ }
430
+
336
431
  @ReactMethod
337
432
  public void startTrip(ReadableMap optionsMap, final Promise promise) {
338
433
  try {
339
- JSONObject optionsObj = RNRadarUtils.jsonForMap(optionsMap);
340
- RadarTripOptions options = RadarTripOptions.fromJson(optionsObj);
341
- Radar.startTrip(options, new Radar.RadarTripCallback() {
434
+ JSONObject optionsJson = RNRadarUtils.jsonForMap(optionsMap);
435
+ // new format is { tripOptions, trackingOptions }
436
+ JSONObject tripOptionsJson = optionsJson.optJSONObject("tripOptions");
437
+ if (tripOptionsJson == null) {
438
+ // legacy format
439
+ tripOptionsJson = optionsJson;
440
+ }
441
+ RadarTripOptions options = RadarTripOptions.fromJson(tripOptionsJson);
442
+
443
+ RadarTrackingOptions trackingOptions = null;
444
+ JSONObject trackingOptionsJson = optionsJson.optJSONObject("trackingOptions");
445
+ if (trackingOptionsJson != null) {
446
+ trackingOptions = RadarTrackingOptions.fromJson(trackingOptionsJson);
447
+ }
448
+ Radar.startTrip(options, trackingOptions, new Radar.RadarTripCallback() {
342
449
  @Override
343
450
  public void onComplete(@NonNull Radar.RadarStatus status, @Nullable RadarTrip trip, @Nullable RadarEvent[] events) {
344
451
  if (promise == null) {
@@ -578,6 +685,7 @@ public class RNRadarModule extends ReactContextBaseJavaModule implements Permiss
578
685
  }
579
686
  int radius = optionsMap.hasKey("radius") ? optionsMap.getInt("radius") : 1000;
580
687
  String[] chains = optionsMap.hasKey("chains") ? RNRadarUtils.stringArrayForArray(optionsMap.getArray("chains")) : null;
688
+ Map<String, String> chainMetadata = RNRadarUtils.stringStringMap(optionsMap.getMap("chainMetadata"));
581
689
  String[] categories = optionsMap.hasKey("categories") ? RNRadarUtils.stringArrayForArray(optionsMap.getArray("categories")) : null;
582
690
  String[] groups = optionsMap.hasKey("groups") ? RNRadarUtils.stringArrayForArray(optionsMap.getArray("groups")) : null;
583
691
  int limit = optionsMap.hasKey("limit") ? optionsMap.getInt("limit") : 10;
@@ -607,9 +715,9 @@ public class RNRadarModule extends ReactContextBaseJavaModule implements Permiss
607
715
  };
608
716
 
609
717
  if (near != null) {
610
- Radar.searchPlaces(near, radius, chains, categories, groups, limit, callback);
718
+ Radar.searchPlaces(near, radius, chains, chainMetadata, categories, groups, limit, callback);
611
719
  } else {
612
- Radar.searchPlaces(radius, chains, categories, groups, limit, callback);
720
+ Radar.searchPlaces(radius, chains, chainMetadata, categories, groups, limit, callback);
613
721
  }
614
722
  }
615
723
 
@@ -984,4 +1092,39 @@ public class RNRadarModule extends ReactContextBaseJavaModule implements Permiss
984
1092
  });
985
1093
  }
986
1094
 
1095
+ @ReactMethod
1096
+ public void sendEvent(String customType, ReadableMap metadata, final Promise promise) throws JSONException {
1097
+ if (promise == null) {
1098
+ return;
1099
+ }
1100
+
1101
+ JSONObject metadataObj = RNRadarUtils.jsonForMap(metadata);
1102
+ Radar.sendEvent(customType, metadataObj, new Radar.RadarSendEventCallback() {
1103
+ @Override
1104
+ public void onComplete(@NonNull Radar.RadarStatus status, @Nullable Location location, @Nullable RadarEvent[] events, @Nullable RadarUser user) {
1105
+ try {
1106
+ if (status == Radar.RadarStatus.SUCCESS) {
1107
+ WritableMap map = Arguments.createMap();
1108
+ map.putString("status", status.toString());
1109
+ if (location != null) {
1110
+ map.putMap("location", RNRadarUtils.mapForJson(Radar.jsonForLocation(location)));
1111
+ }
1112
+ if (events != null) {
1113
+ map.putArray("events", RNRadarUtils.arrayForJson(RadarEvent.toJson(events)));
1114
+ }
1115
+ if (user != null) {
1116
+ map.putMap("user", RNRadarUtils.mapForJson(user.toJson()));
1117
+ }
1118
+ promise.resolve(map);
1119
+ } else {
1120
+ promise.reject(status.toString(), status.toString());
1121
+ }
1122
+ } catch (JSONException e) {
1123
+ Log.e(TAG, "JSONException", e);
1124
+ promise.reject(Radar.RadarStatus.ERROR_SERVER.toString(), Radar.RadarStatus.ERROR_SERVER.toString());
1125
+ }
1126
+ }
1127
+ });
1128
+ }
1129
+
987
1130
  }
@@ -3,6 +3,8 @@ package io.radar.react;
3
3
  import com.facebook.react.bridge.ReadableArray;
4
4
  import com.facebook.react.bridge.ReadableMapKeySetIterator;
5
5
  import java.util.Iterator;
6
+ import java.util.Map;
7
+ import java.util.HashMap;
6
8
 
7
9
  import org.json.JSONArray;
8
10
  import org.json.JSONException;
@@ -148,5 +150,18 @@ class RNRadarUtils {
148
150
  }
149
151
  return arr;
150
152
  }
153
+ static Map<String, String> stringStringMap(ReadableMap readableMap) {
154
+ if (readableMap == null) {
155
+ return null;
156
+ }
157
+
158
+ Map<String, String> stringMap = new HashMap<String, String>();
159
+ ReadableMapKeySetIterator iterator = readableMap.keySetIterator();
160
+ while (iterator.hasNextKey()) {
161
+ String key = iterator.nextKey();
162
+ stringMap.put(key, readableMap.getString(key));
163
+ }
164
+ return stringMap;
165
+ }
151
166
 
152
167
  }
@@ -1 +1 @@
1
- github "radarlabs/radar-sdk-ios" "3.5.4"
1
+ github "radarlabs/radar-sdk-ios" "3.5.9"
package/ios/RNRadar.m CHANGED
@@ -91,6 +91,10 @@ RCT_EXPORT_MODULE();
91
91
  }
92
92
  }
93
93
 
94
+ RCT_EXPORT_METHOD(initialize:(NSString *)publishableKey) {
95
+ [Radar initializeWithPublishableKey:publishableKey];
96
+ }
97
+
94
98
  RCT_EXPORT_METHOD(setLogLevel:(NSString *)level) {
95
99
  RadarLogLevel logLevel = RadarLogLevelNone;
96
100
  if (level) {
@@ -111,14 +115,34 @@ RCT_EXPORT_METHOD(setUserId:(NSString *)userId) {
111
115
  [Radar setUserId:userId];
112
116
  }
113
117
 
118
+ RCT_EXPORT_METHOD(getUserId:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject) {
119
+ resolve([Radar getUserId]);
120
+ }
121
+
114
122
  RCT_EXPORT_METHOD(setDescription:(NSString *)description) {
115
123
  [Radar setDescription:description];
116
124
  }
117
125
 
126
+ RCT_EXPORT_METHOD(getDescription:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject) {
127
+ resolve([Radar getDescription]);
128
+ }
129
+
118
130
  RCT_EXPORT_METHOD(setMetadata:(NSDictionary *)metadataDict) {
119
131
  [Radar setMetadata:metadataDict];
120
132
  }
121
133
 
134
+ RCT_EXPORT_METHOD(getMetadata:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject) {
135
+ resolve([Radar getMetadata]);
136
+ }
137
+
138
+ RCT_EXPORT_METHOD(setAnonymousTrackingEnabled:(BOOL)enabled) {
139
+ [Radar setAnonymousTrackingEnabled:enabled];
140
+ }
141
+
142
+ RCT_EXPORT_METHOD(setAdIdEnabled:(BOOL)enabled) {
143
+ [Radar setAdIdEnabled:enabled];
144
+ }
145
+
122
146
  RCT_REMAP_METHOD(getPermissionsStatus, getPermissionsStatusWithResolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {
123
147
  CLAuthorizationStatus status = [CLLocationManager authorizationStatus];
124
148
  NSString *statusStr;
@@ -158,11 +182,29 @@ RCT_EXPORT_METHOD(requestPermissions:(BOOL)background resolve:(RCTPromiseResolve
158
182
  }
159
183
  }
160
184
 
161
- RCT_EXPORT_METHOD(getLocation:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject) {
185
+ RCT_EXPORT_METHOD(getLocation:(NSString *)desiredAccuracy resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject) {
162
186
  __block RCTPromiseResolveBlock resolver = resolve;
163
187
  __block RCTPromiseRejectBlock rejecter = reject;
188
+ RadarTrackingOptionsDesiredAccuracy accuracy = RadarTrackingOptionsDesiredAccuracyMedium;
189
+
190
+ if (desiredAccuracy) {
191
+ NSString *lowerAccuracy = [desiredAccuracy lowercaseString];
192
+ if ([lowerAccuracy isEqualToString:@"high"]) {
193
+ accuracy = RadarTrackingOptionsDesiredAccuracyHigh;
194
+ } else if ([lowerAccuracy isEqualToString:@"medium"]) {
195
+ accuracy = RadarTrackingOptionsDesiredAccuracyMedium;
196
+ } else if ([lowerAccuracy isEqualToString:@"low"]) {
197
+ accuracy = RadarTrackingOptionsDesiredAccuracyLow;
198
+ } else {
199
+ if (reject) {
200
+ reject([Radar stringForStatus:RadarStatusErrorBadRequest], [Radar stringForStatus:RadarStatusErrorBadRequest], nil);
201
+ }
202
+
203
+ return;
204
+ }
205
+ }
164
206
 
165
- [Radar getLocationWithCompletionHandler:^(RadarStatus status, CLLocation * _Nullable location, BOOL stopped) {
207
+ [Radar getLocationWithDesiredAccuracy:accuracy completionHandler:^(RadarStatus status, CLLocation * _Nullable location, BOOL stopped) {
166
208
  if (status == RadarStatusSuccess && resolver) {
167
209
  NSMutableDictionary *dict = [NSMutableDictionary new];
168
210
  [dict setObject:[Radar stringForStatus:status] forKey:@"status"];
@@ -307,6 +349,20 @@ RCT_EXPORT_METHOD(stopTracking) {
307
349
  [Radar stopTracking];
308
350
  }
309
351
 
352
+ RCT_EXPORT_METHOD(isTracking:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject) {
353
+ BOOL res = [Radar isTracking];
354
+ resolve(@(res));
355
+ }
356
+
357
+ RCT_EXPORT_METHOD(getTrackingOptions:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject) {
358
+ if (resolve == nil) {
359
+ return;
360
+ }
361
+
362
+ RadarTrackingOptions* options = [Radar getTrackingOptions];
363
+ resolve([options dictionaryValue]);
364
+ }
365
+
310
366
  RCT_EXPORT_METHOD(setForegroundServiceOptions) {
311
367
  // not implemented
312
368
  }
@@ -319,13 +375,36 @@ RCT_EXPORT_METHOD(rejectEvent:(NSString *)eventId) {
319
375
  [Radar rejectEventId:eventId];
320
376
  }
321
377
 
378
+ RCT_EXPORT_METHOD(getTripOptions:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject) {
379
+ if (resolve == nil) {
380
+ return;
381
+ }
382
+
383
+ RadarTripOptions* options = [Radar getTripOptions];
384
+ resolve([options dictionaryValue]);
385
+ }
386
+
322
387
  RCT_EXPORT_METHOD(startTrip:(NSDictionary *)optionsDict resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject) {
323
- RadarTripOptions *options = [RadarTripOptions tripOptionsFromDictionary:optionsDict];
388
+ // { tripOptions, trackingOptions } is the new req format.
389
+ // fallback to reading trip options from the top level options.
390
+ NSDictionary *tripOptionsDict = optionsDict[@"tripOptions"];
391
+ if (tripOptionsDict == nil) {
392
+ tripOptionsDict = optionsDict;
393
+ }
394
+ RadarTripOptions *options = [RadarTripOptions tripOptionsFromDictionary:tripOptionsDict];
395
+ if (options.scheduledArrivalAt) {
396
+ options.scheduledArrivalAt = [RCTConvert NSDate:options.scheduledArrivalAt];
397
+ }
398
+ RadarTrackingOptions *trackingOptions;
399
+ NSDictionary *trackingOptionsDict = optionsDict[@"trackingOptions"];
400
+ if (trackingOptionsDict != nil) {
401
+ trackingOptions = [RadarTrackingOptions trackingOptionsFromDictionary:trackingOptionsDict];
402
+ }
324
403
 
325
404
  __block RCTPromiseResolveBlock resolver = resolve;
326
405
  __block RCTPromiseRejectBlock rejecter = reject;
327
406
 
328
- [Radar startTripWithOptions:options completionHandler:^(RadarStatus status, RadarTrip * _Nullable trip, NSArray<RadarEvent *> * _Nullable events) {
407
+ [Radar startTripWithOptions:options trackingOptions:trackingOptions completionHandler:^(RadarStatus status, RadarTrip * _Nullable trip, NSArray<RadarEvent *> * _Nullable events) {
329
408
  if (status == RadarStatusSuccess && resolver) {
330
409
  NSMutableDictionary *dict = [NSMutableDictionary new];
331
410
  [dict setObject:[Radar stringForStatus:status] forKey:@"status"];
@@ -516,6 +595,7 @@ RCT_EXPORT_METHOD(searchPlaces:(NSDictionary *)optionsDict resolve:(RCTPromiseRe
516
595
  radius = 1000;
517
596
  }
518
597
  NSArray *chains = optionsDict[@"chains"];
598
+ NSDictionary *chainMetadata = optionsDict[@"chainMetadata"];
519
599
  NSArray *categories = optionsDict[@"categories"];
520
600
  NSArray *groups = optionsDict[@"groups"];
521
601
  NSNumber *limitNumber = optionsDict[@"limit"];
@@ -548,9 +628,9 @@ RCT_EXPORT_METHOD(searchPlaces:(NSDictionary *)optionsDict resolve:(RCTPromiseRe
548
628
  };
549
629
 
550
630
  if (near) {
551
- [Radar searchPlacesNear:near radius:radius chains:chains categories:categories groups:groups limit:limit completionHandler:completionHandler];
631
+ [Radar searchPlacesNear:near radius:radius chains:chains chainMetadata:chainMetadata categories:categories groups:groups limit:limit completionHandler:completionHandler];
552
632
  } else {
553
- [Radar searchPlacesWithRadius:radius chains:chains categories:categories groups:groups limit:limit completionHandler:completionHandler];
633
+ [Radar searchPlacesWithRadius:radius chains:chains chainMetadata:chainMetadata categories:categories groups:groups limit:limit completionHandler:completionHandler];
554
634
  }
555
635
  }
556
636
 
@@ -889,4 +969,29 @@ RCT_EXPORT_METHOD(getMatrix:(NSDictionary *)optionsDict resolve:(RCTPromiseResol
889
969
  }];
890
970
  }
891
971
 
972
+ RCT_EXPORT_METHOD(sendEvent:(NSString*) customType metadata:(NSDictionary *)metadata resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject) {
973
+ __block RCTPromiseResolveBlock resolver = resolve;
974
+ __block RCTPromiseRejectBlock rejecter = reject;
975
+
976
+ [Radar sendEvent:customType withMetadata:metadata completionHandler:^(RadarStatus status, CLLocation * _Nullable location, NSArray<RadarEvent *> * _Nullable events, RadarUser * _Nullable user) {
977
+ if (status == RadarStatusSuccess && resolver) {
978
+ NSMutableDictionary *dict = [NSMutableDictionary new];
979
+ [dict setObject:[Radar stringForStatus:status] forKey:@"status"];
980
+ if (location) {
981
+ [dict setObject:[Radar dictionaryForLocation:location] forKey:@"location"];
982
+ }
983
+ if (events) {
984
+ [dict setObject:[RadarEvent arrayForEvents:events] forKey:@"events"];
985
+ }
986
+ if (user) {
987
+ [dict setObject:[user dictionaryValue] forKey:@"user"];
988
+ }
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
+ }
892
997
  @end
@@ -6,6 +6,10 @@ if (!NativeModules.RNRadar && (Platform.OS === 'ios' || Platform.OS === 'android
6
6
 
7
7
  const eventEmitter = new NativeEventEmitter(NativeModules.RNRadar);
8
8
 
9
+ const initialize = (publishableKey) => {
10
+ NativeModules.RNRadar.initialize(publishableKey);
11
+ };
12
+
9
13
  const setLogLevel = (level) => {
10
14
  NativeModules.RNRadar.setLogLevel(level);
11
15
  };
@@ -14,14 +18,34 @@ const setUserId = (userId) => {
14
18
  NativeModules.RNRadar.setUserId(userId);
15
19
  };
16
20
 
21
+ const getUserId = () => (
22
+ NativeModules.RNRadar.getUserId()
23
+ );
24
+
17
25
  const setDescription = (description) => {
18
26
  NativeModules.RNRadar.setDescription(description);
19
27
  };
20
28
 
29
+ const getDescription = () => (
30
+ NativeModules.RNRadar.getDescription()
31
+ );
32
+
21
33
  const setMetadata = (metadata) => {
22
34
  NativeModules.RNRadar.setMetadata(metadata);
23
35
  };
24
36
 
37
+ const getMetadata = () => (
38
+ NativeModules.RNRadar.getMetadata()
39
+ )
40
+
41
+ const setAnonymousTrackingEnabled = (enabled) => (
42
+ NativeModules.RNRadar.setAnonymousTrackingEnabled(enabled)
43
+ )
44
+
45
+ const setAdIdEnabled = (enabled) => (
46
+ NativeModules.RNRadar.setAdIdEnabled(enabled)
47
+ )
48
+
25
49
  const getPermissionsStatus = () => (
26
50
  NativeModules.RNRadar.getPermissionsStatus()
27
51
  );
@@ -30,8 +54,8 @@ const requestPermissions = background => (
30
54
  NativeModules.RNRadar.requestPermissions(background)
31
55
  );
32
56
 
33
- const getLocation = () => (
34
- NativeModules.RNRadar.getLocation()
57
+ const getLocation = desiredAccuracy => (
58
+ NativeModules.RNRadar.getLocation(desiredAccuracy)
35
59
  );
36
60
 
37
61
  const trackOnce = options => {
@@ -70,10 +94,22 @@ const stopTracking = () => (
70
94
  NativeModules.RNRadar.stopTracking()
71
95
  );
72
96
 
97
+ const getTrackingOptions = () => (
98
+ NativeModules.RNRadar.getTrackingOptions()
99
+ )
100
+
101
+ const isTracking = () => (
102
+ NativeModules.RNRadar.isTracking()
103
+ )
104
+
73
105
  const setForegroundServiceOptions = options => (
74
106
  NativeModules.RNRadar.setForegroundServiceOptions(options)
75
107
  );
76
108
 
109
+ const getTripOptions = () => (
110
+ NativeModules.RNRadar.getTripOptions()
111
+ )
112
+
77
113
  const startTrip = options => (
78
114
  NativeModules.RNRadar.startTrip(options)
79
115
  );
@@ -134,6 +170,10 @@ const getMatrix = options => (
134
170
  NativeModules.RNRadar.getMatrix(options)
135
171
  );
136
172
 
173
+ const sendEvent = (customType, metadata) => (
174
+ NativeModules.RNRadar.sendEvent(customType, metadata)
175
+ )
176
+
137
177
  const on = (event, callback) => (
138
178
  eventEmitter.addListener(event, callback)
139
179
  );
@@ -147,10 +187,16 @@ const off = (event, callback) => {
147
187
  };
148
188
 
149
189
  const Radar = {
190
+ initialize,
150
191
  setLogLevel,
151
192
  setUserId,
193
+ getUserId,
152
194
  setDescription,
195
+ getDescription,
153
196
  setMetadata,
197
+ getMetadata,
198
+ setAnonymousTrackingEnabled,
199
+ setAdIdEnabled,
154
200
  getPermissionsStatus,
155
201
  requestPermissions,
156
202
  getLocation,
@@ -161,9 +207,12 @@ const Radar = {
161
207
  startTrackingCustom,
162
208
  mockTracking,
163
209
  stopTracking,
210
+ isTracking,
211
+ getTrackingOptions,
164
212
  setForegroundServiceOptions,
165
213
  acceptEvent,
166
214
  rejectEvent,
215
+ getTripOptions,
167
216
  startTrip,
168
217
  updateTrip,
169
218
  completeTrip,
@@ -177,6 +226,7 @@ const Radar = {
177
226
  ipGeocode,
178
227
  getDistance,
179
228
  getMatrix,
229
+ sendEvent,
180
230
  on,
181
231
  off,
182
232
  };
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.5.6",
6
+ "version": "3.5.8",
7
7
  "main": "js/index.js",
8
8
  "files": [
9
9
  "android",
@@ -48,8 +48,7 @@
48
48
  "metro-react-native-babel-preset": "^0.51.1",
49
49
  "npm-run-all": "^4.1.5",
50
50
  "react": "16.8.6",
51
- "react-native": "0.60.0",
52
- "radar-sdk-js": "^3.3.0"
51
+ "react-native": "0.60.0"
53
52
  },
54
53
  "bugs": {
55
54
  "url": "https://github.com/radarlabs/react-native-radar/issues"
@@ -59,6 +58,7 @@
59
58
  "url": "https://github.com/radarlabs/react-native-radar.git"
60
59
  },
61
60
  "dependencies": {
61
+ "radar-sdk-js": "^3.5.0",
62
62
  "@react-native-community/netinfo": "^7.1.3"
63
63
  }
64
64
  }
@@ -15,5 +15,5 @@ Pod::Spec.new do |s|
15
15
  s.platform = :ios, "10.0"
16
16
 
17
17
  s.dependency "React"
18
- s.dependency "RadarSDK", "~> 3.5.4"
18
+ s.dependency "RadarSDK", "~> 3.5.9"
19
19
  end