react-native-radar 3.21.0-beta.2 → 3.21.0-beta.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.
@@ -1,39 +1,64 @@
1
1
  import type { EventSubscription } from 'react-native';
2
2
  import type { RadarNativeInterface } from './@types/RadarNativeInterface';
3
- import type { RadarTrackCallback, RadarTrackOnceOptions, RadarLocationUpdateCallback, RadarPermissionsStatus, RadarClientLocationUpdateCallback, RadarLocationSource, RadarErrorCallback, RadarLogUpdateCallback, RadarTokenUpdateCallback, RadarEventUpdateCallback, RadarLogLevel, RadarMetadata, RadarLocationCallback, RadarTrackingOptionsDesiredAccuracy, RadarTrackVerifiedCallback, RadarTrackVerifiedOptions, RadarMockTrackingOptions, RadarTrackingOptions, RadarVerifiedTrackingOptions, RadarContextCallback, RadarNotificationOptions, RadarStartTripOptions, RadarTrackingOptionsForegroundService, RadarTripCallback, RadarTripOptions, RadarUpdateTripOptions, RadarAddress, RadarAddressCallback, RadarAutocompleteOptions, RadarGeocodeOptions, RadarGetDistanceOptions, RadarGetMatrixOptions, RadarIPGeocodeCallback, RadarLogConversionCallback, RadarLogConversionOptions, RadarReverseGeocodeOptions, RadarRouteCallback, RadarRouteMatrix, RadarSearchGeofencesCallback, RadarSearchGeofencesOptions, RadarSearchPlacesCallback, RadarSearchPlacesOptions, RadarValidateAddressCallback,
4
- } from './@types/types';
5
- import { NativeEventEmitter, NativeModules } from 'react-native';
3
+ import type { RadarTrackCallback, RadarTrackOnceOptions, RadarLocationUpdateCallback, RadarPermissionsStatus, RadarClientLocationUpdateCallback, RadarLocationSource, RadarErrorCallback, RadarLogUpdateCallback, RadarTokenUpdateCallback, RadarEventUpdateCallback, RadarLogLevel, RadarMetadata, RadarLocationCallback, RadarTrackingOptionsDesiredAccuracy, RadarTrackVerifiedCallback, RadarTrackVerifiedOptions, RadarMockTrackingOptions, RadarTrackingOptions, RadarVerifiedTrackingOptions, RadarContextCallback, RadarNotificationOptions, RadarStartTripOptions, RadarTrackingOptionsForegroundService, RadarTripCallback, RadarTripOptions, RadarUpdateTripOptions, RadarAddress, RadarAddressCallback, RadarAutocompleteOptions, RadarGeocodeOptions, RadarGetDistanceOptions, RadarGetMatrixOptions, RadarIPGeocodeCallback, RadarLogConversionCallback, RadarLogConversionOptions, RadarReverseGeocodeOptions, RadarRouteCallback, RadarRouteMatrix, RadarSearchGeofencesCallback, RadarSearchGeofencesOptions, RadarSearchPlacesCallback, RadarSearchPlacesOptions, RadarValidateAddressCallback, RadarUser,
4
+ Location,
5
+ RadarEvent} from './@types/types';
6
+ import { DeviceEventEmitter, NativeEventEmitter, NativeModules, Platform } from 'react-native';
6
7
  import { VERSION } from './version';
8
+ import NativeRadar, { ClientLocationEmitter, ErrorEmitter, EventsEmitter, LocationEmitter, LogEmitter, TokenEmitter } from './NativeRadar';
7
9
 
8
- declare global {
9
- var __turboModuleProxy: any;
10
- }
11
10
 
12
- const isNewArchitecture = global.__turboModuleProxy != null;
11
+ // declare global {
12
+ // var __turboModuleProxy: any;
13
+ // }
14
+
15
+ // const isNewArchitecture = global.__turboModuleProxy != null;
16
+
13
17
 
14
- let NativeRadar: any;
15
18
 
16
- try {
17
- if (isNewArchitecture) {
18
- const NativeRadarModule = require('./NativeRadar');
19
- NativeRadar = NativeRadarModule.default;
20
- } else {
21
- NativeRadar = NativeModules.RNRadar;
19
+ const compatEventEmitter = NativeRadar.locationEmitter == null
20
+ ? new NativeEventEmitter(NativeModules.RNRadar)
21
+ : null;
22
+
23
+ type Events =
24
+ | 'locationEmitter'
25
+ | 'clientLocationEmitter'
26
+ | 'errorEmitter'
27
+ | 'logEmitter'
28
+ | 'eventsEmitter'
29
+ | 'tokenEmitter';
30
+
31
+ export function addListener<EventT extends Events>(
32
+ event: EventT,
33
+ handler: Parameters<(typeof NativeRadar)[EventT]>[0]
34
+ ): EventSubscription {
35
+ if (compatEventEmitter != null) {
36
+ return compatEventEmitter.addListener(event, handler);
22
37
  }
23
- } catch (error) {
24
- console.error('[Radar] Error loading NativeRadar module:', error);
25
- throw error;
38
+ return NativeRadar[event](handler as any);
26
39
  }
27
40
 
41
+ // try {
42
+ // if (isNewArchitecture) {
43
+ // const NativeRadarModule = require('./NativeRadar');
44
+ // NativeRadar = NativeRadarModule.default;
45
+ // } else {
46
+ // NativeRadar = NativeModules.RNRadar;
47
+ // }
48
+ // } catch (error) {
49
+ // console.error('[Radar] Error loading NativeRadar module:', error);
50
+ // throw error;
51
+ // }
52
+
28
53
  // For old architecture, create a NativeEventEmitter
29
- const eventEmitter = isNewArchitecture ? null : new NativeEventEmitter(NativeModules.RNRadar);
54
+ // const eventEmitter = isNewArchitecture ? null : new NativeEventEmitter(NativeModules.RNRadar);
30
55
 
31
- const locationEmitter = isNewArchitecture ? NativeRadar?.locationEmitter : null;
32
- const clientLocationEmitter = isNewArchitecture ? NativeRadar?.clientLocationEmitter : null;
33
- const errorEmitter = isNewArchitecture ? NativeRadar?.errorEmitter : null;
34
- const logEmitter = isNewArchitecture ? NativeRadar?.logEmitter : null;
35
- const eventsEmitter = isNewArchitecture ? NativeRadar?.eventsEmitter : null;
36
- const tokenEmitter = isNewArchitecture ? NativeRadar?.tokenEmitter : null;
56
+ // const locationEmitter = isNewArchitecture ? NativeRadar?.locationEmitter : null;
57
+ // const clientLocationEmitter = isNewArchitecture ? NativeRadar?.clientLocationEmitter : null;
58
+ // const errorEmitter = isNewArchitecture ? NativeRadar?.errorEmitter : null;
59
+ // const logEmitter = isNewArchitecture ? NativeRadar?.logEmitter : null;
60
+ // const eventsEmitter = isNewArchitecture ? NativeRadar?.eventsEmitter : null;
61
+ // const tokenEmitter = isNewArchitecture ? NativeRadar?.tokenEmitter : null;
37
62
 
38
63
  let locationUpdateSubscription: EventSubscription | null = null;
39
64
  let clientLocationUpdateSubscription: EventSubscription | null = null;
@@ -51,214 +76,281 @@ const Radar: RadarNativeInterface = {
51
76
  return NativeRadar.trackOnce(options || null) as Promise<RadarTrackCallback>;
52
77
  },
53
78
 
54
- onLocationUpdate: (callback: RadarLocationUpdateCallback) => {
79
+ onLocationUpdated: (callback: RadarLocationUpdateCallback | null) => {
55
80
  // Clear any existing subscription
56
81
  if (locationUpdateSubscription) {
57
82
  locationUpdateSubscription.remove();
58
- locationUpdateSubscription = null;
59
83
  }
60
84
 
61
- if (isNewArchitecture && locationEmitter) {
62
- locationUpdateSubscription = locationEmitter((event: { type: string; location: any; user: any; }) => {
63
- try {
64
- const locationUpdate = {
65
- location: event.location,
66
- user: event.user
67
- };
68
-
69
- callback(locationUpdate);
70
- } catch (error) {
71
- console.error('[Radar] Error in location update callback:', error);
72
- }
73
- });
74
- } else if (!isNewArchitecture && eventEmitter) {
75
- locationUpdateSubscription = eventEmitter.addListener('location', (event: { location: any; user: any; }) => {
76
- try {
77
- const locationUpdate = {
78
- location: event.location,
79
- user: event.user
80
- };
81
-
82
- callback(locationUpdate);
83
- } catch (error) {
84
- console.error('[Radar] Error in location update callback:', error);
85
- }
86
- });
87
- } else {
88
- console.warn('[Radar] No event emitter available for location updates');
85
+ if (!callback) {
86
+ return;
89
87
  }
90
- },
91
-
92
- clearLocationUpdate: () => {
93
- if (locationUpdateSubscription) {
94
- locationUpdateSubscription.remove();
95
- locationUpdateSubscription = null;
96
- }
97
- },
98
88
 
99
- onClientLocationUpdate: (callback: RadarClientLocationUpdateCallback) => {
89
+ locationUpdateSubscription = addListener('locationEmitter', (event: LocationEmitter) => {
90
+ try {
91
+ const locationUpdate = {
92
+ location: event.location as Location,
93
+ user: event.user as RadarUser
94
+ };
95
+ callback(locationUpdate);
96
+ } catch (error) {
97
+ console.error('[Radar] Error in location update callback:', error);
98
+ }
99
+ });
100
+
101
+ // if (isNewArchitecture && locationEmitter) {
102
+ // locationUpdateSubscription = locationEmitter((event: { type: string; location: any; user: any; }) => {
103
+ // try {
104
+ // const locationUpdate = {
105
+ // location: event.location,
106
+ // user: event.user
107
+ // };
108
+
109
+ // callback(locationUpdate);
110
+ // } catch (error) {
111
+ // console.error('[Radar] Error in location update callback:', error);
112
+ // }
113
+ // });
114
+ // } else if (!isNewArchitecture && eventEmitter) {
115
+ // locationUpdateSubscription = eventEmitter.addListener('location', (event: { location: any; user: any; }) => {
116
+ // try {
117
+ // const locationUpdate = {
118
+ // location: event.location,
119
+ // user: event.user
120
+ // };
121
+
122
+ // callback(locationUpdate);
123
+ // } catch (error) {
124
+ // console.error('[Radar] Error in location update callback:', error);
125
+ // }
126
+ // });
127
+ // } else {
128
+ // console.warn('[Radar] No event emitter available for location updates');
129
+ // }
130
+ },
131
+
132
+ // clearLocationUpdate: () => {
133
+ // if (locationUpdateSubscription) {
134
+ // locationUpdateSubscription.remove();
135
+ // locationUpdateSubscription = null;
136
+ // }
137
+ // },
138
+
139
+ onClientLocationUpdated: (callback: RadarClientLocationUpdateCallback | null) => {
100
140
  if (clientLocationUpdateSubscription) {
101
141
  clientLocationUpdateSubscription.remove();
102
142
  clientLocationUpdateSubscription = null;
103
143
  }
104
144
 
105
- if (isNewArchitecture && clientLocationEmitter) {
106
- clientLocationUpdateSubscription = clientLocationEmitter((event: { location: any; stopped: boolean; source: string; }) => {
107
- try {
108
- const clientLocationUpdate = {
109
- location: event.location,
110
- stopped: event.stopped,
111
- source: event.source as RadarLocationSource
112
- };
113
- callback(clientLocationUpdate);
114
- } catch (error) {
115
- console.error('[Radar] Error in client location update callback:', error);
116
- }
117
- });
118
- } else if (!isNewArchitecture && eventEmitter) {
119
- clientLocationUpdateSubscription = eventEmitter.addListener('clientLocation', (event: { location: any; stopped: boolean; source: string; }) => {
120
- try {
121
- const clientLocationUpdate = {
122
- location: event.location,
123
- stopped: event.stopped,
124
- source: event.source as RadarLocationSource
125
- };
126
- callback(clientLocationUpdate);
127
- } catch (error) {
128
- console.error('[Radar] Error in client location update callback:', error);
129
- }
130
- });
131
- } else {
132
- console.warn('[Radar] No event emitter available for client location updates');
145
+ if (!callback) {
146
+ return;
133
147
  }
134
- },
135
148
 
136
- clearClientLocationUpdate: () => {
137
- if (clientLocationUpdateSubscription) {
138
- clientLocationUpdateSubscription.remove();
139
- clientLocationUpdateSubscription = null;
140
- }
141
- },
142
-
143
- onError: (callback: RadarErrorCallback) => {
149
+ clientLocationUpdateSubscription = addListener('clientLocationEmitter', (event: ClientLocationEmitter) => {
150
+ const clientLocationUpdate = {
151
+ location: event.location as Location,
152
+ stopped: event.stopped,
153
+ source: event.source as RadarLocationSource
154
+ };
155
+ callback(clientLocationUpdate);
156
+ });
157
+
158
+ // if (isNewArchitecture && clientLocationEmitter) {
159
+ // clientLocationUpdateSubscription = clientLocationEmitter((event: { location: any; stopped: boolean; source: string; }) => {
160
+ // try {
161
+ // const clientLocationUpdate = {
162
+ // location: event.location,
163
+ // stopped: event.stopped,
164
+ // source: event.source as RadarLocationSource
165
+ // };
166
+ // callback(clientLocationUpdate);
167
+ // } catch (error) {
168
+ // console.error('[Radar] Error in client location update callback:', error);
169
+ // }
170
+ // });
171
+ // } else if (!isNewArchitecture && eventEmitter) {
172
+ // clientLocationUpdateSubscription = eventEmitter.addListener('clientLocation', (event: { location: any; stopped: boolean; source: string; }) => {
173
+ // try {
174
+ // const clientLocationUpdate = {
175
+ // location: event.location,
176
+ // stopped: event.stopped,
177
+ // source: event.source as RadarLocationSource
178
+ // };
179
+ // callback(clientLocationUpdate);
180
+ // } catch (error) {
181
+ // console.error('[Radar] Error in client location update callback:', error);
182
+ // }
183
+ // });
184
+ // } else {
185
+ // console.warn('[Radar] No event emitter available for client location updates');
186
+ // }
187
+ },
188
+
189
+ // clearClientLocationUpdate: () => {
190
+ // if (clientLocationUpdateSubscription) {
191
+ // clientLocationUpdateSubscription.remove();
192
+ // clientLocationUpdateSubscription = null;
193
+ // }
194
+ // },
195
+
196
+ onError: (callback: RadarErrorCallback | null) => {
144
197
  if (errorUpdateSubscription) {
145
198
  errorUpdateSubscription.remove();
146
199
  errorUpdateSubscription = null;
147
200
  }
148
201
 
149
- if (isNewArchitecture && errorEmitter) {
150
- errorUpdateSubscription = errorEmitter((event: { status: string; }) => {
151
- callback(event.status);
152
- });
153
- } else if (!isNewArchitecture && eventEmitter) {
154
- errorUpdateSubscription = eventEmitter.addListener('error', (event: { status: string; }) => {
155
- callback(event.status);
156
- });
157
- } else {
158
- console.warn('[Radar] No event emitter available for error updates');
159
- }
160
- },
161
-
162
- clearError: () => {
163
- if (errorUpdateSubscription) {
164
- errorUpdateSubscription.remove();
165
- errorUpdateSubscription = null;
202
+ if (!callback) {
203
+ return;
166
204
  }
167
- },
168
205
 
169
- onLog: (callback: RadarLogUpdateCallback) => {
206
+ errorUpdateSubscription = addListener('errorEmitter', (event: ErrorEmitter) => {
207
+ const errorUpdate = {
208
+ status: event.status,
209
+ };
210
+ callback(errorUpdate.status);
211
+ });
212
+
213
+ // if (isNewArchitecture && errorEmitter) {
214
+ // errorUpdateSubscription = errorEmitter((event: { status: string; }) => {
215
+ // callback(event.status);
216
+ // });
217
+ // } else if (!isNewArchitecture && eventEmitter) {
218
+ // errorUpdateSubscription = eventEmitter.addListener('error', (event: { status: string; }) => {
219
+ // callback(event.status);
220
+ // });
221
+ // } else {
222
+ // console.warn('[Radar] No event emitter available for error updates');
223
+ // }
224
+ },
225
+
226
+ // clearError: () => {
227
+ // if (errorUpdateSubscription) {
228
+ // errorUpdateSubscription.remove();
229
+ // errorUpdateSubscription = null;
230
+ // }
231
+ // },
232
+
233
+ onLog: (callback: RadarLogUpdateCallback | null) => {
170
234
  if (logUpdateSubscription) {
171
235
  logUpdateSubscription.remove();
172
236
  logUpdateSubscription = null;
173
237
  }
174
238
 
175
- if (isNewArchitecture && logEmitter) {
176
- logUpdateSubscription = logEmitter((event: { message: string; }) => {
177
- callback(event.message);
178
- });
179
- } else if (!isNewArchitecture && eventEmitter) {
180
- logUpdateSubscription = eventEmitter.addListener('log', (event: { message: string; }) => {
181
- callback(event.message);
182
- });
183
- } else {
184
- console.warn('[Radar] No event emitter available for log updates');
185
- }
186
- },
187
-
188
- clearLog: () => {
189
- if (logUpdateSubscription) {
190
- logUpdateSubscription.remove();
191
- logUpdateSubscription = null;
239
+ if (!callback) {
240
+ return;
192
241
  }
193
- },
194
242
 
195
- onEventUpdate: (callback: RadarEventUpdateCallback) => {
243
+ logUpdateSubscription = addListener('logEmitter', (event: LogEmitter) => {
244
+ callback(event.message);
245
+ });
246
+
247
+ // if (isNewArchitecture && logEmitter) {
248
+ // logUpdateSubscription = logEmitter((event: { message: string; }) => {
249
+ // callback(event.message);
250
+ // });
251
+ // } else if (!isNewArchitecture && eventEmitter) {
252
+ // logUpdateSubscription = eventEmitter.addListener('log', (event: { message: string; }) => {
253
+ // callback(event.message);
254
+ // });
255
+ // } else {
256
+ // console.warn('[Radar] No event emitter available for log updates');
257
+ // }
258
+ },
259
+
260
+ // clearLog: () => {
261
+ // if (logUpdateSubscription) {
262
+ // logUpdateSubscription.remove();
263
+ // logUpdateSubscription = null;
264
+ // }
265
+ // },
266
+
267
+ onEventsReceived: (callback: RadarEventUpdateCallback | null) => {
196
268
  if (eventsUpdateSubscription) {
197
269
  eventsUpdateSubscription.remove();
198
270
  eventsUpdateSubscription = null;
199
271
  }
200
272
 
201
- if (isNewArchitecture && eventsEmitter) {
202
- eventsUpdateSubscription = eventsEmitter((event: { events: any[]; user: any; }) => {
203
- try {
204
- const eventUpdate = {
205
- user: event.user,
206
- events: event.events
207
- };
208
- callback(eventUpdate);
209
- } catch (error) {
210
- console.error('[Radar] Error in event update callback:', error);
211
- }
212
- });
213
- } else if (!isNewArchitecture && eventEmitter) {
214
- eventsUpdateSubscription = eventEmitter.addListener('events', (event: { events: any[]; user: any; }) => {
215
- try {
216
- const eventUpdate = {
217
- user: event.user,
218
- events: event.events
219
- };
220
- callback(eventUpdate);
221
- } catch (error) {
222
- console.error('[Radar] Error in event update callback:', error);
223
- }
224
- });
225
- } else {
226
- console.warn('[Radar] No event emitter available for event updates');
273
+ if (!callback) {
274
+ return;
227
275
  }
228
- },
229
276
 
230
- clearEventUpdate: () => {
231
- if (eventsUpdateSubscription) {
232
- eventsUpdateSubscription.remove();
233
- eventsUpdateSubscription = null;
234
- }
235
- },
236
-
237
- onTokenUpdate: (callback: RadarTokenUpdateCallback) => {
277
+ eventsUpdateSubscription = addListener('eventsEmitter', (event: EventsEmitter) => {
278
+ const eventUpdate = {
279
+ user: event.user as RadarUser,
280
+ events: event.events as RadarEvent[]
281
+ };
282
+ callback(eventUpdate);
283
+ });
284
+
285
+ // if (isNewArchitecture && eventsEmitter) {
286
+ // eventsUpdateSubscription = eventsEmitter((event: { events: any[]; user: any; }) => {
287
+ // try {
288
+ // const eventUpdate = {
289
+ // user: event.user,
290
+ // events: event.events
291
+ // };
292
+ // callback(eventUpdate);
293
+ // } catch (error) {
294
+ // console.error('[Radar] Error in event update callback:', error);
295
+ // }
296
+ // });
297
+ // } else if (!isNewArchitecture && eventEmitter) {
298
+ // eventsUpdateSubscription = eventEmitter.addListener('events', (event: { events: any[]; user: any; }) => {
299
+ // try {
300
+ // const eventUpdate = {
301
+ // user: event.user,
302
+ // events: event.events
303
+ // };
304
+ // callback(eventUpdate);
305
+ // } catch (error) {
306
+ // console.error('[Radar] Error in event update callback:', error);
307
+ // }
308
+ // });
309
+ // } else {
310
+ // console.warn('[Radar] No event emitter available for event updates');
311
+ // }
312
+ },
313
+
314
+ // clearEventUpdate: () => {
315
+ // if (eventsUpdateSubscription) {
316
+ // eventsUpdateSubscription.remove();
317
+ // eventsUpdateSubscription = null;
318
+ // }
319
+ // },
320
+
321
+ onTokenUpdated: (callback: RadarTokenUpdateCallback | null) => {
238
322
  if (tokenUpdateSubscription) {
239
323
  tokenUpdateSubscription.remove();
240
324
  tokenUpdateSubscription = null;
241
325
  }
242
326
 
243
- if (isNewArchitecture && tokenEmitter) {
244
- tokenUpdateSubscription = tokenEmitter((event: { token: any; }) => {
245
- callback(event.token);
246
- });
247
- } else if (!isNewArchitecture && eventEmitter) {
248
- tokenUpdateSubscription = eventEmitter.addListener('token', (event: { token: any; }) => {
249
- callback(event.token);
250
- });
251
- } else {
252
- console.warn('[Radar] No event emitter available for token updates');
327
+ if (!callback) {
328
+ return;
253
329
  }
254
- },
255
330
 
256
- clearTokenUpdate: () => {
257
- if (tokenUpdateSubscription) {
258
- tokenUpdateSubscription.remove();
259
- tokenUpdateSubscription = null;
260
- }
261
- },
331
+ tokenUpdateSubscription = addListener('tokenEmitter', (event: TokenEmitter) => {
332
+ callback(event.token);
333
+ });
334
+
335
+ // if (isNewArchitecture && tokenEmitter) {
336
+ // tokenUpdateSubscription = tokenEmitter((event: { token: any; }) => {
337
+ // callback(event.token);
338
+ // });
339
+ // } else if (!isNewArchitecture && eventEmitter) {
340
+ // tokenUpdateSubscription = eventEmitter.addListener('token', (event: { token: any; }) => {
341
+ // callback(event.token);
342
+ // });
343
+ // } else {
344
+ // console.warn('[Radar] No event emitter available for token updates');
345
+ // }
346
+ },
347
+
348
+ // clearTokenUpdate: () => {
349
+ // if (tokenUpdateSubscription) {
350
+ // tokenUpdateSubscription.remove();
351
+ // tokenUpdateSubscription = null;
352
+ // }
353
+ // },
262
354
 
263
355
  requestPermissions: (background: boolean) => {
264
356
  return NativeRadar.requestPermissions(background) as Promise<RadarPermissionsStatus>;
@@ -282,22 +374,22 @@ const Radar: RadarNativeInterface = {
282
374
  return NativeRadar.setMetadata(metadata);
283
375
  },
284
376
  getMetadata: function (): Promise<RadarMetadata> {
285
- return NativeRadar.getMetadata();
377
+ return NativeRadar.getMetadata() as Promise<RadarMetadata>;
286
378
  },
287
379
  setAnonymousTrackingEnabled: function (enabled: boolean): void {
288
380
  return NativeRadar.setAnonymousTrackingEnabled(enabled);
289
381
  },
290
382
  getPermissionsStatus: function (): Promise<RadarPermissionsStatus> {
291
- return NativeRadar.getPermissionsStatus();
383
+ return NativeRadar.getPermissionsStatus() as Promise<RadarPermissionsStatus>;
292
384
  },
293
385
  getLocation: function (desiredAccuracy?: RadarTrackingOptionsDesiredAccuracy): Promise<RadarLocationCallback> {
294
- return NativeRadar.getLocation(desiredAccuracy);
386
+ return NativeRadar.getLocation(desiredAccuracy || null) as Promise<RadarLocationCallback>;
295
387
  },
296
388
  trackVerified: function (options?: RadarTrackVerifiedOptions): Promise<RadarTrackVerifiedCallback> {
297
- return NativeRadar.trackVerified(options);
389
+ return NativeRadar.trackVerified(options || null) as Promise<RadarTrackVerifiedCallback>;
298
390
  },
299
391
  getVerifiedLocationToken: function (): Promise<RadarTrackVerifiedCallback> {
300
- return NativeRadar.getVerifiedLocationToken();
392
+ return NativeRadar.getVerifiedLocationToken() as Promise<RadarTrackVerifiedCallback>;
301
393
  },
302
394
  clearVerifiedLocationToken: function (): void {
303
395
  return NativeRadar.clearVerifiedLocationToken();
@@ -315,7 +407,7 @@ const Radar: RadarNativeInterface = {
315
407
  return NativeRadar.startTrackingCustom(options);
316
408
  },
317
409
  startTrackingVerified: function (options?: RadarVerifiedTrackingOptions): void {
318
- return NativeRadar.startTrackingVerified(options);
410
+ return NativeRadar.startTrackingVerified(options || null);
319
411
  },
320
412
  isTrackingVerified: function (): Promise<boolean> {
321
413
  return NativeRadar.isTrackingVerified();
@@ -333,7 +425,7 @@ const Radar: RadarNativeInterface = {
333
425
  return NativeRadar.stopTrackingVerified();
334
426
  },
335
427
  getTrackingOptions: function (): Promise<RadarTrackingOptions> {
336
- return NativeRadar.getTrackingOptions();
428
+ return NativeRadar.getTrackingOptions() as Promise<RadarTrackingOptions>;
337
429
  },
338
430
  isUsingRemoteTrackingOptions: function (): Promise<boolean> {
339
431
  return NativeRadar.isUsingRemoteTrackingOptions();
@@ -348,19 +440,19 @@ const Radar: RadarNativeInterface = {
348
440
  return NativeRadar.setNotificationOptions(options);
349
441
  },
350
442
  getTripOptions: function (): Promise<RadarTripOptions> {
351
- return NativeRadar.getTripOptions();
443
+ return NativeRadar.getTripOptions() as Promise<RadarTripOptions>;
352
444
  },
353
445
  startTrip: function (options: RadarStartTripOptions): Promise<RadarTripCallback> {
354
- return NativeRadar.startTrip(options);
446
+ return NativeRadar.startTrip(options) as Promise<RadarTripCallback>;
355
447
  },
356
448
  completeTrip: function (): Promise<RadarTripCallback> {
357
- return NativeRadar.completeTrip();
449
+ return NativeRadar.completeTrip() as Promise<RadarTripCallback>;
358
450
  },
359
451
  cancelTrip: function (): Promise<RadarTripCallback> {
360
- return NativeRadar.cancelTrip();
452
+ return NativeRadar.cancelTrip() as Promise<RadarTripCallback>;
361
453
  },
362
454
  updateTrip: function (options: RadarUpdateTripOptions): Promise<RadarTripCallback> {
363
- return NativeRadar.updateTrip(options);
455
+ return NativeRadar.updateTrip(options) as Promise<RadarTripCallback>;
364
456
  },
365
457
  acceptEvent: function (eventId: string, verifiedPlaceId: string): void {
366
458
  return NativeRadar.acceptEvent(eventId, verifiedPlaceId);
@@ -369,37 +461,37 @@ const Radar: RadarNativeInterface = {
369
461
  return NativeRadar.rejectEvent(eventId);
370
462
  },
371
463
  getContext: function (location?: Location): Promise<RadarContextCallback> {
372
- return NativeRadar.getContext(location);
464
+ return NativeRadar.getContext(location || null) as Promise<RadarContextCallback>;
373
465
  },
374
466
  searchPlaces: function (options: RadarSearchPlacesOptions): Promise<RadarSearchPlacesCallback> {
375
- return NativeRadar.searchPlaces(options);
467
+ return NativeRadar.searchPlaces(options) as Promise<RadarSearchPlacesCallback>;
376
468
  },
377
469
  searchGeofences: function (options: RadarSearchGeofencesOptions): Promise<RadarSearchGeofencesCallback> {
378
- return NativeRadar.searchGeofences(options);
470
+ return NativeRadar.searchGeofences(options) as Promise<RadarSearchGeofencesCallback>;
379
471
  },
380
472
  autocomplete: function (options: RadarAutocompleteOptions): Promise<RadarAddressCallback> {
381
- return NativeRadar.autocomplete(options);
473
+ return NativeRadar.autocomplete(options) as Promise<RadarAddressCallback>;
382
474
  },
383
475
  geocode: function (options: RadarGeocodeOptions): Promise<RadarAddressCallback> {
384
- return NativeRadar.geocode(options);
476
+ return NativeRadar.geocode(options) as Promise<RadarAddressCallback>;
385
477
  },
386
478
  reverseGeocode: function (options?: RadarReverseGeocodeOptions): Promise<RadarAddressCallback> {
387
- return NativeRadar.reverseGeocode(options);
479
+ return NativeRadar.reverseGeocode(options || null) as Promise<RadarAddressCallback>;
388
480
  },
389
481
  ipGeocode: function (): Promise<RadarIPGeocodeCallback> {
390
- return NativeRadar.ipGeocode();
482
+ return NativeRadar.ipGeocode() as Promise<RadarIPGeocodeCallback>;
391
483
  },
392
484
  validateAddress: function (address: RadarAddress): Promise<RadarValidateAddressCallback> {
393
- return NativeRadar.validateAddress(address);
485
+ return NativeRadar.validateAddress(address) as Promise<RadarValidateAddressCallback>;
394
486
  },
395
487
  getDistance: function (option: RadarGetDistanceOptions): Promise<RadarRouteCallback> {
396
- return NativeRadar.getDistance(option);
488
+ return NativeRadar.getDistance(option) as Promise<RadarRouteCallback>;
397
489
  },
398
490
  getMatrix: function (option: RadarGetMatrixOptions): Promise<RadarRouteMatrix> {
399
- return NativeRadar.getMatrix(option);
491
+ return NativeRadar.getMatrix(option) as Promise<RadarRouteMatrix>;
400
492
  },
401
493
  logConversion: function (options: RadarLogConversionOptions): Promise<RadarLogConversionCallback> {
402
- return NativeRadar.logConversion(options);
494
+ return NativeRadar.logConversion(options) as Promise<RadarLogConversionCallback>;
403
495
  },
404
496
 
405
497
  nativeSdkVersion: function (): Promise<string> {
package/src/version.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  // This file contains the version of the react-native-radar package
2
2
  // It should be updated to match the version in package.json
3
- export const VERSION = '3.21.0-beta.2';
3
+ export const VERSION = '3.21.0-beta.3';