react-native-radar 3.21.0-beta.3 → 3.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/Radar.podspec +2 -2
- package/android/build.gradle +3 -3
- package/android/src/main/java/com/radar/RadarModuleImpl.java +119 -85
- package/android/src/main/java/com/radar/RadarUtils.java +12 -0
- package/android/src/newarch/java/com/radar/RadarModule.kt +31 -10
- package/android/src/oldarch/java/com/radar/RadarModule.java +31 -6
- package/android/src/oldarch/java/com/radar/RadarOldArchReceiver.java +8 -2
- package/dist/@types/RadarNativeInterface.d.ts +6 -1
- package/dist/@types/types.d.ts +2 -0
- package/dist/@types/types.js +19 -19
- package/dist/NativeRadar.d.ts +8 -3
- package/dist/NativeRadar.js +1 -1
- package/dist/index.js +4 -1
- package/dist/index.native.d.ts +4 -4
- package/dist/index.native.js +102 -248
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/ios/RNRadar.mm +59 -35
- package/package.json +3 -4
- package/src/@types/RadarNativeInterface.ts +22 -17
- package/src/@types/types.ts +38 -32
- package/src/NativeRadar.ts +10 -6
- package/src/index.native.ts +236 -283
- package/src/index.tsx +4 -1
- package/src/version.ts +1 -1
package/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,43 @@ const Radar: RadarNativeInterface = {
|
|
|
376
268
|
getMetadata: function (): Promise<RadarMetadata> {
|
|
377
269
|
return NativeRadar.getMetadata() as Promise<RadarMetadata>;
|
|
378
270
|
},
|
|
271
|
+
setTags: function (tags: string[]): void {
|
|
272
|
+
return NativeRadar.setTags(tags);
|
|
273
|
+
},
|
|
274
|
+
getTags: function (): Promise<string[]> {
|
|
275
|
+
return NativeRadar.getTags() as Promise<string[]>;
|
|
276
|
+
},
|
|
277
|
+
addTags: function (tags: string[]): void {
|
|
278
|
+
return NativeRadar.addTags(tags);
|
|
279
|
+
},
|
|
280
|
+
removeTags: function (tags: string[]): void {
|
|
281
|
+
return NativeRadar.removeTags(tags);
|
|
282
|
+
},
|
|
283
|
+
setProduct: function (product: string): void {
|
|
284
|
+
return NativeRadar.setProduct(product);
|
|
285
|
+
},
|
|
286
|
+
getProduct: function (): Promise<string> {
|
|
287
|
+
return NativeRadar.getProduct();
|
|
288
|
+
},
|
|
379
289
|
setAnonymousTrackingEnabled: function (enabled: boolean): void {
|
|
380
290
|
return NativeRadar.setAnonymousTrackingEnabled(enabled);
|
|
381
291
|
},
|
|
382
292
|
getPermissionsStatus: function (): Promise<RadarPermissionsStatus> {
|
|
383
293
|
return NativeRadar.getPermissionsStatus() as Promise<RadarPermissionsStatus>;
|
|
384
294
|
},
|
|
385
|
-
getLocation: function (
|
|
386
|
-
|
|
295
|
+
getLocation: function (
|
|
296
|
+
desiredAccuracy?: RadarTrackingOptionsDesiredAccuracy
|
|
297
|
+
): Promise<RadarLocationCallback> {
|
|
298
|
+
return NativeRadar.getLocation(
|
|
299
|
+
desiredAccuracy || null
|
|
300
|
+
) as Promise<RadarLocationCallback>;
|
|
387
301
|
},
|
|
388
|
-
trackVerified: function (
|
|
389
|
-
|
|
302
|
+
trackVerified: function (
|
|
303
|
+
options?: RadarTrackVerifiedOptions
|
|
304
|
+
): Promise<RadarTrackVerifiedCallback> {
|
|
305
|
+
return NativeRadar.trackVerified(
|
|
306
|
+
options || null
|
|
307
|
+
) as Promise<RadarTrackVerifiedCallback>;
|
|
390
308
|
},
|
|
391
309
|
getVerifiedLocationToken: function (): Promise<RadarTrackVerifiedCallback> {
|
|
392
310
|
return NativeRadar.getVerifiedLocationToken() as Promise<RadarTrackVerifiedCallback>;
|
|
@@ -406,15 +324,14 @@ const Radar: RadarNativeInterface = {
|
|
|
406
324
|
startTrackingCustom: function (options: RadarTrackingOptions): void {
|
|
407
325
|
return NativeRadar.startTrackingCustom(options);
|
|
408
326
|
},
|
|
409
|
-
startTrackingVerified: function (
|
|
327
|
+
startTrackingVerified: function (
|
|
328
|
+
options?: RadarVerifiedTrackingOptions
|
|
329
|
+
): void {
|
|
410
330
|
return NativeRadar.startTrackingVerified(options || null);
|
|
411
331
|
},
|
|
412
332
|
isTrackingVerified: function (): Promise<boolean> {
|
|
413
333
|
return NativeRadar.isTrackingVerified();
|
|
414
334
|
},
|
|
415
|
-
setProduct: function (product: string): void {
|
|
416
|
-
return NativeRadar.setProduct(product);
|
|
417
|
-
},
|
|
418
335
|
mockTracking: function (options: RadarMockTrackingOptions): void {
|
|
419
336
|
return NativeRadar.mockTracking(options);
|
|
420
337
|
},
|
|
@@ -433,7 +350,9 @@ const Radar: RadarNativeInterface = {
|
|
|
433
350
|
isTracking: function (): Promise<boolean> {
|
|
434
351
|
return NativeRadar.isTracking();
|
|
435
352
|
},
|
|
436
|
-
setForegroundServiceOptions: function (
|
|
353
|
+
setForegroundServiceOptions: function (
|
|
354
|
+
options: RadarTrackingOptionsForegroundService
|
|
355
|
+
): void {
|
|
437
356
|
return NativeRadar.setForegroundServiceOptions(options);
|
|
438
357
|
},
|
|
439
358
|
setNotificationOptions: function (options: RadarNotificationOptions): void {
|
|
@@ -442,7 +361,9 @@ const Radar: RadarNativeInterface = {
|
|
|
442
361
|
getTripOptions: function (): Promise<RadarTripOptions> {
|
|
443
362
|
return NativeRadar.getTripOptions() as Promise<RadarTripOptions>;
|
|
444
363
|
},
|
|
445
|
-
startTrip: function (
|
|
364
|
+
startTrip: function (
|
|
365
|
+
options: RadarStartTripOptions
|
|
366
|
+
): Promise<RadarTripCallback> {
|
|
446
367
|
return NativeRadar.startTrip(options) as Promise<RadarTripCallback>;
|
|
447
368
|
},
|
|
448
369
|
completeTrip: function (): Promise<RadarTripCallback> {
|
|
@@ -451,7 +372,9 @@ const Radar: RadarNativeInterface = {
|
|
|
451
372
|
cancelTrip: function (): Promise<RadarTripCallback> {
|
|
452
373
|
return NativeRadar.cancelTrip() as Promise<RadarTripCallback>;
|
|
453
374
|
},
|
|
454
|
-
updateTrip: function (
|
|
375
|
+
updateTrip: function (
|
|
376
|
+
options: RadarUpdateTripOptions
|
|
377
|
+
): Promise<RadarTripCallback> {
|
|
455
378
|
return NativeRadar.updateTrip(options) as Promise<RadarTripCallback>;
|
|
456
379
|
},
|
|
457
380
|
acceptEvent: function (eventId: string, verifiedPlaceId: string): void {
|
|
@@ -461,37 +384,67 @@ const Radar: RadarNativeInterface = {
|
|
|
461
384
|
return NativeRadar.rejectEvent(eventId);
|
|
462
385
|
},
|
|
463
386
|
getContext: function (location?: Location): Promise<RadarContextCallback> {
|
|
464
|
-
return NativeRadar.getContext(
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
387
|
+
return NativeRadar.getContext(
|
|
388
|
+
location || null
|
|
389
|
+
) as Promise<RadarContextCallback>;
|
|
390
|
+
},
|
|
391
|
+
searchPlaces: function (
|
|
392
|
+
options: RadarSearchPlacesOptions
|
|
393
|
+
): Promise<RadarSearchPlacesCallback> {
|
|
394
|
+
return NativeRadar.searchPlaces(
|
|
395
|
+
options
|
|
396
|
+
) as Promise<RadarSearchPlacesCallback>;
|
|
397
|
+
},
|
|
398
|
+
searchGeofences: function (
|
|
399
|
+
options: RadarSearchGeofencesOptions
|
|
400
|
+
): Promise<RadarSearchGeofencesCallback> {
|
|
401
|
+
return NativeRadar.searchGeofences(
|
|
402
|
+
options
|
|
403
|
+
) as Promise<RadarSearchGeofencesCallback>;
|
|
404
|
+
},
|
|
405
|
+
autocomplete: function (
|
|
406
|
+
options: RadarAutocompleteOptions
|
|
407
|
+
): Promise<RadarAddressCallback> {
|
|
473
408
|
return NativeRadar.autocomplete(options) as Promise<RadarAddressCallback>;
|
|
474
409
|
},
|
|
475
|
-
geocode: function (
|
|
410
|
+
geocode: function (
|
|
411
|
+
options: RadarGeocodeOptions
|
|
412
|
+
): Promise<RadarAddressCallback> {
|
|
476
413
|
return NativeRadar.geocode(options) as Promise<RadarAddressCallback>;
|
|
477
414
|
},
|
|
478
|
-
reverseGeocode: function (
|
|
479
|
-
|
|
415
|
+
reverseGeocode: function (
|
|
416
|
+
options?: RadarReverseGeocodeOptions
|
|
417
|
+
): Promise<RadarAddressCallback> {
|
|
418
|
+
return NativeRadar.reverseGeocode(
|
|
419
|
+
options || null
|
|
420
|
+
) as Promise<RadarAddressCallback>;
|
|
480
421
|
},
|
|
481
422
|
ipGeocode: function (): Promise<RadarIPGeocodeCallback> {
|
|
482
423
|
return NativeRadar.ipGeocode() as Promise<RadarIPGeocodeCallback>;
|
|
483
424
|
},
|
|
484
|
-
validateAddress: function (
|
|
485
|
-
|
|
425
|
+
validateAddress: function (
|
|
426
|
+
address: RadarAddress
|
|
427
|
+
): Promise<RadarValidateAddressCallback> {
|
|
428
|
+
return NativeRadar.validateAddress(
|
|
429
|
+
address
|
|
430
|
+
) as Promise<RadarValidateAddressCallback>;
|
|
486
431
|
},
|
|
487
|
-
getDistance: function (
|
|
432
|
+
getDistance: function (
|
|
433
|
+
option: RadarGetDistanceOptions
|
|
434
|
+
): Promise<RadarRouteCallback> {
|
|
488
435
|
return NativeRadar.getDistance(option) as Promise<RadarRouteCallback>;
|
|
489
436
|
},
|
|
490
|
-
getMatrix: function (
|
|
437
|
+
getMatrix: function (
|
|
438
|
+
option: RadarGetMatrixOptions
|
|
439
|
+
): Promise<RadarRouteMatrix> {
|
|
491
440
|
return NativeRadar.getMatrix(option) as Promise<RadarRouteMatrix>;
|
|
492
441
|
},
|
|
493
|
-
logConversion: function (
|
|
494
|
-
|
|
442
|
+
logConversion: function (
|
|
443
|
+
options: RadarLogConversionOptions
|
|
444
|
+
): Promise<RadarLogConversionCallback> {
|
|
445
|
+
return NativeRadar.logConversion(
|
|
446
|
+
options
|
|
447
|
+
) as Promise<RadarLogConversionCallback>;
|
|
495
448
|
},
|
|
496
449
|
|
|
497
450
|
nativeSdkVersion: function (): Promise<string> {
|
|
@@ -505,7 +458,7 @@ const Radar: RadarNativeInterface = {
|
|
|
505
458
|
},
|
|
506
459
|
getPublishableKey: function (): Promise<string> {
|
|
507
460
|
return NativeRadar.getPublishableKey();
|
|
508
|
-
}
|
|
509
|
-
}
|
|
461
|
+
},
|
|
462
|
+
};
|
|
510
463
|
|
|
511
464
|
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
|
|