react-native-radar 3.21.0-beta.3 → 3.21.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/Radar.podspec +2 -2
- package/android/build.gradle +2 -2
- package/android/src/main/java/com/radar/RadarModuleImpl.java +99 -85
- package/android/src/newarch/java/com/radar/RadarModule.kt +14 -10
- package/android/src/oldarch/java/com/radar/RadarModule.java +11 -6
- package/android/src/oldarch/java/com/radar/RadarOldArchReceiver.java +8 -2
- package/dist/@types/RadarNativeInterface.d.ts +2 -1
- package/dist/@types/types.d.ts +2 -0
- package/dist/@types/types.js +19 -19
- package/dist/NativeRadar.d.ts +4 -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 +90 -248
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/ios/RNRadar.mm +43 -35
- package/package.json +3 -4
- package/src/@types/RadarNativeInterface.ts +18 -17
- package/src/@types/types.ts +38 -32
- package/src/NativeRadar.ts +6 -6
- package/src/index.native.ts +224 -283
- package/src/index.tsx +4 -1
- package/src/version.ts +1 -1
package/src/index.native.ts
CHANGED
|
@@ -1,32 +1,91 @@
|
|
|
1
|
-
import type { EventSubscription } from
|
|
2
|
-
import type { RadarNativeInterface } from
|
|
3
|
-
import type {
|
|
1
|
+
import type { EventSubscription } from "react-native";
|
|
2
|
+
import type { RadarNativeInterface } from "./@types/RadarNativeInterface";
|
|
3
|
+
import type {
|
|
4
|
+
RadarTrackCallback,
|
|
5
|
+
RadarTrackOnceOptions,
|
|
6
|
+
RadarLocationUpdateCallback,
|
|
7
|
+
RadarPermissionsStatus,
|
|
8
|
+
RadarClientLocationUpdateCallback,
|
|
9
|
+
RadarLocationSource,
|
|
10
|
+
RadarErrorCallback,
|
|
11
|
+
RadarLogUpdateCallback,
|
|
12
|
+
RadarTokenUpdateCallback,
|
|
13
|
+
RadarEventUpdateCallback,
|
|
14
|
+
RadarLogLevel,
|
|
15
|
+
RadarMetadata,
|
|
16
|
+
RadarLocationCallback,
|
|
17
|
+
RadarTrackingOptionsDesiredAccuracy,
|
|
18
|
+
RadarTrackVerifiedCallback,
|
|
19
|
+
RadarTrackVerifiedOptions,
|
|
20
|
+
RadarMockTrackingOptions,
|
|
21
|
+
RadarTrackingOptions,
|
|
22
|
+
RadarVerifiedTrackingOptions,
|
|
23
|
+
RadarContextCallback,
|
|
24
|
+
RadarNotificationOptions,
|
|
25
|
+
RadarStartTripOptions,
|
|
26
|
+
RadarTrackingOptionsForegroundService,
|
|
27
|
+
RadarTripCallback,
|
|
28
|
+
RadarTripOptions,
|
|
29
|
+
RadarUpdateTripOptions,
|
|
30
|
+
RadarAddress,
|
|
31
|
+
RadarAddressCallback,
|
|
32
|
+
RadarAutocompleteOptions,
|
|
33
|
+
RadarGeocodeOptions,
|
|
34
|
+
RadarGetDistanceOptions,
|
|
35
|
+
RadarGetMatrixOptions,
|
|
36
|
+
RadarIPGeocodeCallback,
|
|
37
|
+
RadarLogConversionCallback,
|
|
38
|
+
RadarLogConversionOptions,
|
|
39
|
+
RadarReverseGeocodeOptions,
|
|
40
|
+
RadarRouteCallback,
|
|
41
|
+
RadarRouteMatrix,
|
|
42
|
+
RadarSearchGeofencesCallback,
|
|
43
|
+
RadarSearchGeofencesOptions,
|
|
44
|
+
RadarSearchPlacesCallback,
|
|
45
|
+
RadarSearchPlacesOptions,
|
|
46
|
+
RadarValidateAddressCallback,
|
|
47
|
+
RadarUser,
|
|
4
48
|
Location,
|
|
5
|
-
RadarEvent
|
|
6
|
-
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
49
|
+
RadarEvent,
|
|
50
|
+
} from "./@types/types";
|
|
51
|
+
import { NativeEventEmitter, NativeModules } from "react-native";
|
|
52
|
+
import { VERSION } from "./version";
|
|
53
|
+
import NativeRadarMod, {
|
|
54
|
+
ClientLocationEmitter,
|
|
55
|
+
ErrorEmitter,
|
|
56
|
+
EventsEmitter,
|
|
57
|
+
LocationEmitter,
|
|
58
|
+
LogEmitter,
|
|
59
|
+
TokenEmitter,
|
|
60
|
+
} from "./NativeRadar";
|
|
61
|
+
|
|
62
|
+
const NativeRadar = NativeRadarMod;
|
|
63
|
+
// Comment above and uncomment below for QA logging
|
|
64
|
+
// const NativeRadar = new Proxy(NativeRadarMod, {
|
|
65
|
+
// get: function (target, name, receiver) {
|
|
66
|
+
// if (typeof target[name] == "function") {
|
|
67
|
+
// return function () {
|
|
68
|
+
// console.log("rn native:", name, "(", ...arguments, ")");
|
|
69
|
+
// return target[name].apply(target, arguments);
|
|
70
|
+
// };
|
|
71
|
+
// } else {
|
|
72
|
+
// return target[name];
|
|
73
|
+
// }
|
|
74
|
+
// },
|
|
75
|
+
// });
|
|
76
|
+
|
|
77
|
+
const compatEventEmitter =
|
|
78
|
+
NativeRadar.locationEmitter == null
|
|
79
|
+
? new NativeEventEmitter(NativeModules.RNRadar)
|
|
80
|
+
: null;
|
|
22
81
|
|
|
23
82
|
type Events =
|
|
24
|
-
|
|
|
25
|
-
|
|
|
26
|
-
|
|
|
27
|
-
|
|
|
28
|
-
|
|
|
29
|
-
|
|
|
83
|
+
| "locationEmitter"
|
|
84
|
+
| "clientLocationEmitter"
|
|
85
|
+
| "errorEmitter"
|
|
86
|
+
| "logEmitter"
|
|
87
|
+
| "eventsEmitter"
|
|
88
|
+
| "tokenEmitter";
|
|
30
89
|
|
|
31
90
|
export function addListener<EventT extends Events>(
|
|
32
91
|
event: EventT,
|
|
@@ -38,28 +97,6 @@ export function addListener<EventT extends Events>(
|
|
|
38
97
|
return NativeRadar[event](handler as any);
|
|
39
98
|
}
|
|
40
99
|
|
|
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
|
-
|
|
53
|
-
// For old architecture, create a NativeEventEmitter
|
|
54
|
-
// const eventEmitter = isNewArchitecture ? null : new NativeEventEmitter(NativeModules.RNRadar);
|
|
55
|
-
|
|
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;
|
|
62
|
-
|
|
63
100
|
let locationUpdateSubscription: EventSubscription | null = null;
|
|
64
101
|
let clientLocationUpdateSubscription: EventSubscription | null = null;
|
|
65
102
|
let errorUpdateSubscription: EventSubscription | null = null;
|
|
@@ -73,7 +110,9 @@ const Radar: RadarNativeInterface = {
|
|
|
73
110
|
},
|
|
74
111
|
|
|
75
112
|
trackOnce: async (options?: RadarTrackOnceOptions) => {
|
|
76
|
-
return NativeRadar.trackOnce(
|
|
113
|
+
return NativeRadar.trackOnce(
|
|
114
|
+
options || null
|
|
115
|
+
) as Promise<RadarTrackCallback>;
|
|
77
116
|
},
|
|
78
117
|
|
|
79
118
|
onLocationUpdated: (callback: RadarLocationUpdateCallback | null) => {
|
|
@@ -86,57 +125,25 @@ const Radar: RadarNativeInterface = {
|
|
|
86
125
|
return;
|
|
87
126
|
}
|
|
88
127
|
|
|
89
|
-
locationUpdateSubscription = addListener(
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
128
|
+
locationUpdateSubscription = addListener(
|
|
129
|
+
"locationEmitter",
|
|
130
|
+
(event: LocationEmitter) => {
|
|
131
|
+
try {
|
|
132
|
+
const locationUpdate = {
|
|
133
|
+
location: event.location as Location,
|
|
134
|
+
user: event.user as RadarUser,
|
|
135
|
+
};
|
|
136
|
+
callback(locationUpdate);
|
|
137
|
+
} catch (error) {
|
|
138
|
+
console.error("[Radar] Error in location update callback:", error);
|
|
139
|
+
}
|
|
98
140
|
}
|
|
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
|
-
// }
|
|
141
|
+
);
|
|
130
142
|
},
|
|
131
143
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
// locationUpdateSubscription = null;
|
|
136
|
-
// }
|
|
137
|
-
// },
|
|
138
|
-
|
|
139
|
-
onClientLocationUpdated: (callback: RadarClientLocationUpdateCallback | null) => {
|
|
144
|
+
onClientLocationUpdated: (
|
|
145
|
+
callback: RadarClientLocationUpdateCallback | null
|
|
146
|
+
) => {
|
|
140
147
|
if (clientLocationUpdateSubscription) {
|
|
141
148
|
clientLocationUpdateSubscription.remove();
|
|
142
149
|
clientLocationUpdateSubscription = null;
|
|
@@ -146,53 +153,19 @@ const Radar: RadarNativeInterface = {
|
|
|
146
153
|
return;
|
|
147
154
|
}
|
|
148
155
|
|
|
149
|
-
clientLocationUpdateSubscription = addListener(
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
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
|
-
// }
|
|
156
|
+
clientLocationUpdateSubscription = addListener(
|
|
157
|
+
"clientLocationEmitter",
|
|
158
|
+
(event: ClientLocationEmitter) => {
|
|
159
|
+
const clientLocationUpdate = {
|
|
160
|
+
location: event.location as Location,
|
|
161
|
+
stopped: event.stopped,
|
|
162
|
+
source: event.source as RadarLocationSource,
|
|
163
|
+
};
|
|
164
|
+
callback(clientLocationUpdate);
|
|
165
|
+
}
|
|
166
|
+
);
|
|
187
167
|
},
|
|
188
168
|
|
|
189
|
-
// clearClientLocationUpdate: () => {
|
|
190
|
-
// if (clientLocationUpdateSubscription) {
|
|
191
|
-
// clientLocationUpdateSubscription.remove();
|
|
192
|
-
// clientLocationUpdateSubscription = null;
|
|
193
|
-
// }
|
|
194
|
-
// },
|
|
195
|
-
|
|
196
169
|
onError: (callback: RadarErrorCallback | null) => {
|
|
197
170
|
if (errorUpdateSubscription) {
|
|
198
171
|
errorUpdateSubscription.remove();
|
|
@@ -203,33 +176,17 @@ const Radar: RadarNativeInterface = {
|
|
|
203
176
|
return;
|
|
204
177
|
}
|
|
205
178
|
|
|
206
|
-
errorUpdateSubscription = addListener(
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
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
|
-
// }
|
|
179
|
+
errorUpdateSubscription = addListener(
|
|
180
|
+
"errorEmitter",
|
|
181
|
+
(event: ErrorEmitter) => {
|
|
182
|
+
const errorUpdate = {
|
|
183
|
+
status: event.status,
|
|
184
|
+
};
|
|
185
|
+
callback(errorUpdate.status);
|
|
186
|
+
}
|
|
187
|
+
);
|
|
224
188
|
},
|
|
225
189
|
|
|
226
|
-
// clearError: () => {
|
|
227
|
-
// if (errorUpdateSubscription) {
|
|
228
|
-
// errorUpdateSubscription.remove();
|
|
229
|
-
// errorUpdateSubscription = null;
|
|
230
|
-
// }
|
|
231
|
-
// },
|
|
232
|
-
|
|
233
190
|
onLog: (callback: RadarLogUpdateCallback | null) => {
|
|
234
191
|
if (logUpdateSubscription) {
|
|
235
192
|
logUpdateSubscription.remove();
|
|
@@ -240,30 +197,11 @@ const Radar: RadarNativeInterface = {
|
|
|
240
197
|
return;
|
|
241
198
|
}
|
|
242
199
|
|
|
243
|
-
logUpdateSubscription = addListener(
|
|
200
|
+
logUpdateSubscription = addListener("logEmitter", (event: LogEmitter) => {
|
|
244
201
|
callback(event.message);
|
|
245
202
|
});
|
|
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
203
|
},
|
|
259
204
|
|
|
260
|
-
// clearLog: () => {
|
|
261
|
-
// if (logUpdateSubscription) {
|
|
262
|
-
// logUpdateSubscription.remove();
|
|
263
|
-
// logUpdateSubscription = null;
|
|
264
|
-
// }
|
|
265
|
-
// },
|
|
266
|
-
|
|
267
205
|
onEventsReceived: (callback: RadarEventUpdateCallback | null) => {
|
|
268
206
|
if (eventsUpdateSubscription) {
|
|
269
207
|
eventsUpdateSubscription.remove();
|
|
@@ -274,50 +212,18 @@ const Radar: RadarNativeInterface = {
|
|
|
274
212
|
return;
|
|
275
213
|
}
|
|
276
214
|
|
|
277
|
-
eventsUpdateSubscription = addListener(
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
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
|
-
// }
|
|
215
|
+
eventsUpdateSubscription = addListener(
|
|
216
|
+
"eventsEmitter",
|
|
217
|
+
(event: EventsEmitter) => {
|
|
218
|
+
const eventUpdate = {
|
|
219
|
+
user: event.user as RadarUser,
|
|
220
|
+
events: event.events as RadarEvent[],
|
|
221
|
+
};
|
|
222
|
+
callback(eventUpdate);
|
|
223
|
+
}
|
|
224
|
+
);
|
|
312
225
|
},
|
|
313
226
|
|
|
314
|
-
// clearEventUpdate: () => {
|
|
315
|
-
// if (eventsUpdateSubscription) {
|
|
316
|
-
// eventsUpdateSubscription.remove();
|
|
317
|
-
// eventsUpdateSubscription = null;
|
|
318
|
-
// }
|
|
319
|
-
// },
|
|
320
|
-
|
|
321
227
|
onTokenUpdated: (callback: RadarTokenUpdateCallback | null) => {
|
|
322
228
|
if (tokenUpdateSubscription) {
|
|
323
229
|
tokenUpdateSubscription.remove();
|
|
@@ -328,32 +234,18 @@ const Radar: RadarNativeInterface = {
|
|
|
328
234
|
return;
|
|
329
235
|
}
|
|
330
236
|
|
|
331
|
-
tokenUpdateSubscription = addListener(
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
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
|
-
// }
|
|
237
|
+
tokenUpdateSubscription = addListener(
|
|
238
|
+
"tokenEmitter",
|
|
239
|
+
(event: TokenEmitter) => {
|
|
240
|
+
callback(event.token);
|
|
241
|
+
}
|
|
242
|
+
);
|
|
346
243
|
},
|
|
347
244
|
|
|
348
|
-
// clearTokenUpdate: () => {
|
|
349
|
-
// if (tokenUpdateSubscription) {
|
|
350
|
-
// tokenUpdateSubscription.remove();
|
|
351
|
-
// tokenUpdateSubscription = null;
|
|
352
|
-
// }
|
|
353
|
-
// },
|
|
354
|
-
|
|
355
245
|
requestPermissions: (background: boolean) => {
|
|
356
|
-
return NativeRadar.requestPermissions(
|
|
246
|
+
return NativeRadar.requestPermissions(
|
|
247
|
+
background
|
|
248
|
+
) as Promise<RadarPermissionsStatus>;
|
|
357
249
|
},
|
|
358
250
|
setLogLevel: function (level: RadarLogLevel): void {
|
|
359
251
|
return NativeRadar.setLogLevel(level);
|
|
@@ -376,17 +268,31 @@ const Radar: RadarNativeInterface = {
|
|
|
376
268
|
getMetadata: function (): Promise<RadarMetadata> {
|
|
377
269
|
return NativeRadar.getMetadata() as Promise<RadarMetadata>;
|
|
378
270
|
},
|
|
271
|
+
setProduct: function (product: string): void {
|
|
272
|
+
return NativeRadar.setProduct(product);
|
|
273
|
+
},
|
|
274
|
+
getProduct: function (): Promise<string> {
|
|
275
|
+
return NativeRadar.getProduct();
|
|
276
|
+
},
|
|
379
277
|
setAnonymousTrackingEnabled: function (enabled: boolean): void {
|
|
380
278
|
return NativeRadar.setAnonymousTrackingEnabled(enabled);
|
|
381
279
|
},
|
|
382
280
|
getPermissionsStatus: function (): Promise<RadarPermissionsStatus> {
|
|
383
281
|
return NativeRadar.getPermissionsStatus() as Promise<RadarPermissionsStatus>;
|
|
384
282
|
},
|
|
385
|
-
getLocation: function (
|
|
386
|
-
|
|
283
|
+
getLocation: function (
|
|
284
|
+
desiredAccuracy?: RadarTrackingOptionsDesiredAccuracy
|
|
285
|
+
): Promise<RadarLocationCallback> {
|
|
286
|
+
return NativeRadar.getLocation(
|
|
287
|
+
desiredAccuracy || null
|
|
288
|
+
) as Promise<RadarLocationCallback>;
|
|
387
289
|
},
|
|
388
|
-
trackVerified: function (
|
|
389
|
-
|
|
290
|
+
trackVerified: function (
|
|
291
|
+
options?: RadarTrackVerifiedOptions
|
|
292
|
+
): Promise<RadarTrackVerifiedCallback> {
|
|
293
|
+
return NativeRadar.trackVerified(
|
|
294
|
+
options || null
|
|
295
|
+
) as Promise<RadarTrackVerifiedCallback>;
|
|
390
296
|
},
|
|
391
297
|
getVerifiedLocationToken: function (): Promise<RadarTrackVerifiedCallback> {
|
|
392
298
|
return NativeRadar.getVerifiedLocationToken() as Promise<RadarTrackVerifiedCallback>;
|
|
@@ -406,15 +312,14 @@ const Radar: RadarNativeInterface = {
|
|
|
406
312
|
startTrackingCustom: function (options: RadarTrackingOptions): void {
|
|
407
313
|
return NativeRadar.startTrackingCustom(options);
|
|
408
314
|
},
|
|
409
|
-
startTrackingVerified: function (
|
|
315
|
+
startTrackingVerified: function (
|
|
316
|
+
options?: RadarVerifiedTrackingOptions
|
|
317
|
+
): void {
|
|
410
318
|
return NativeRadar.startTrackingVerified(options || null);
|
|
411
319
|
},
|
|
412
320
|
isTrackingVerified: function (): Promise<boolean> {
|
|
413
321
|
return NativeRadar.isTrackingVerified();
|
|
414
322
|
},
|
|
415
|
-
setProduct: function (product: string): void {
|
|
416
|
-
return NativeRadar.setProduct(product);
|
|
417
|
-
},
|
|
418
323
|
mockTracking: function (options: RadarMockTrackingOptions): void {
|
|
419
324
|
return NativeRadar.mockTracking(options);
|
|
420
325
|
},
|
|
@@ -433,7 +338,9 @@ const Radar: RadarNativeInterface = {
|
|
|
433
338
|
isTracking: function (): Promise<boolean> {
|
|
434
339
|
return NativeRadar.isTracking();
|
|
435
340
|
},
|
|
436
|
-
setForegroundServiceOptions: function (
|
|
341
|
+
setForegroundServiceOptions: function (
|
|
342
|
+
options: RadarTrackingOptionsForegroundService
|
|
343
|
+
): void {
|
|
437
344
|
return NativeRadar.setForegroundServiceOptions(options);
|
|
438
345
|
},
|
|
439
346
|
setNotificationOptions: function (options: RadarNotificationOptions): void {
|
|
@@ -442,7 +349,9 @@ const Radar: RadarNativeInterface = {
|
|
|
442
349
|
getTripOptions: function (): Promise<RadarTripOptions> {
|
|
443
350
|
return NativeRadar.getTripOptions() as Promise<RadarTripOptions>;
|
|
444
351
|
},
|
|
445
|
-
startTrip: function (
|
|
352
|
+
startTrip: function (
|
|
353
|
+
options: RadarStartTripOptions
|
|
354
|
+
): Promise<RadarTripCallback> {
|
|
446
355
|
return NativeRadar.startTrip(options) as Promise<RadarTripCallback>;
|
|
447
356
|
},
|
|
448
357
|
completeTrip: function (): Promise<RadarTripCallback> {
|
|
@@ -451,7 +360,9 @@ const Radar: RadarNativeInterface = {
|
|
|
451
360
|
cancelTrip: function (): Promise<RadarTripCallback> {
|
|
452
361
|
return NativeRadar.cancelTrip() as Promise<RadarTripCallback>;
|
|
453
362
|
},
|
|
454
|
-
updateTrip: function (
|
|
363
|
+
updateTrip: function (
|
|
364
|
+
options: RadarUpdateTripOptions
|
|
365
|
+
): Promise<RadarTripCallback> {
|
|
455
366
|
return NativeRadar.updateTrip(options) as Promise<RadarTripCallback>;
|
|
456
367
|
},
|
|
457
368
|
acceptEvent: function (eventId: string, verifiedPlaceId: string): void {
|
|
@@ -461,37 +372,67 @@ const Radar: RadarNativeInterface = {
|
|
|
461
372
|
return NativeRadar.rejectEvent(eventId);
|
|
462
373
|
},
|
|
463
374
|
getContext: function (location?: Location): Promise<RadarContextCallback> {
|
|
464
|
-
return NativeRadar.getContext(
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
375
|
+
return NativeRadar.getContext(
|
|
376
|
+
location || null
|
|
377
|
+
) as Promise<RadarContextCallback>;
|
|
378
|
+
},
|
|
379
|
+
searchPlaces: function (
|
|
380
|
+
options: RadarSearchPlacesOptions
|
|
381
|
+
): Promise<RadarSearchPlacesCallback> {
|
|
382
|
+
return NativeRadar.searchPlaces(
|
|
383
|
+
options
|
|
384
|
+
) as Promise<RadarSearchPlacesCallback>;
|
|
385
|
+
},
|
|
386
|
+
searchGeofences: function (
|
|
387
|
+
options: RadarSearchGeofencesOptions
|
|
388
|
+
): Promise<RadarSearchGeofencesCallback> {
|
|
389
|
+
return NativeRadar.searchGeofences(
|
|
390
|
+
options
|
|
391
|
+
) as Promise<RadarSearchGeofencesCallback>;
|
|
392
|
+
},
|
|
393
|
+
autocomplete: function (
|
|
394
|
+
options: RadarAutocompleteOptions
|
|
395
|
+
): Promise<RadarAddressCallback> {
|
|
473
396
|
return NativeRadar.autocomplete(options) as Promise<RadarAddressCallback>;
|
|
474
397
|
},
|
|
475
|
-
geocode: function (
|
|
398
|
+
geocode: function (
|
|
399
|
+
options: RadarGeocodeOptions
|
|
400
|
+
): Promise<RadarAddressCallback> {
|
|
476
401
|
return NativeRadar.geocode(options) as Promise<RadarAddressCallback>;
|
|
477
402
|
},
|
|
478
|
-
reverseGeocode: function (
|
|
479
|
-
|
|
403
|
+
reverseGeocode: function (
|
|
404
|
+
options?: RadarReverseGeocodeOptions
|
|
405
|
+
): Promise<RadarAddressCallback> {
|
|
406
|
+
return NativeRadar.reverseGeocode(
|
|
407
|
+
options || null
|
|
408
|
+
) as Promise<RadarAddressCallback>;
|
|
480
409
|
},
|
|
481
410
|
ipGeocode: function (): Promise<RadarIPGeocodeCallback> {
|
|
482
411
|
return NativeRadar.ipGeocode() as Promise<RadarIPGeocodeCallback>;
|
|
483
412
|
},
|
|
484
|
-
validateAddress: function (
|
|
485
|
-
|
|
413
|
+
validateAddress: function (
|
|
414
|
+
address: RadarAddress
|
|
415
|
+
): Promise<RadarValidateAddressCallback> {
|
|
416
|
+
return NativeRadar.validateAddress(
|
|
417
|
+
address
|
|
418
|
+
) as Promise<RadarValidateAddressCallback>;
|
|
486
419
|
},
|
|
487
|
-
getDistance: function (
|
|
420
|
+
getDistance: function (
|
|
421
|
+
option: RadarGetDistanceOptions
|
|
422
|
+
): Promise<RadarRouteCallback> {
|
|
488
423
|
return NativeRadar.getDistance(option) as Promise<RadarRouteCallback>;
|
|
489
424
|
},
|
|
490
|
-
getMatrix: function (
|
|
425
|
+
getMatrix: function (
|
|
426
|
+
option: RadarGetMatrixOptions
|
|
427
|
+
): Promise<RadarRouteMatrix> {
|
|
491
428
|
return NativeRadar.getMatrix(option) as Promise<RadarRouteMatrix>;
|
|
492
429
|
},
|
|
493
|
-
logConversion: function (
|
|
494
|
-
|
|
430
|
+
logConversion: function (
|
|
431
|
+
options: RadarLogConversionOptions
|
|
432
|
+
): Promise<RadarLogConversionCallback> {
|
|
433
|
+
return NativeRadar.logConversion(
|
|
434
|
+
options
|
|
435
|
+
) as Promise<RadarLogConversionCallback>;
|
|
495
436
|
},
|
|
496
437
|
|
|
497
438
|
nativeSdkVersion: function (): Promise<string> {
|
|
@@ -505,7 +446,7 @@ const Radar: RadarNativeInterface = {
|
|
|
505
446
|
},
|
|
506
447
|
getPublishableKey: function (): Promise<string> {
|
|
507
448
|
return NativeRadar.getPublishableKey();
|
|
508
|
-
}
|
|
509
|
-
}
|
|
449
|
+
},
|
|
450
|
+
};
|
|
510
451
|
|
|
511
452
|
export default Radar;
|
package/src/index.tsx
CHANGED
|
@@ -3,7 +3,10 @@ import { Platform } from "react-native";
|
|
|
3
3
|
|
|
4
4
|
let nativeModule: RadarNativeInterface;
|
|
5
5
|
|
|
6
|
-
nativeModule =
|
|
6
|
+
nativeModule =
|
|
7
|
+
Platform.OS === "web"
|
|
8
|
+
? require("./index.web").default
|
|
9
|
+
: require("./index.native").default;
|
|
7
10
|
|
|
8
11
|
export default nativeModule;
|
|
9
12
|
|
package/src/version.ts
CHANGED