react-native-radar 3.21.0-beta.2 → 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 +15 -11
- package/android/src/oldarch/java/com/radar/RadarModule.java +11 -6
- package/android/src/oldarch/java/com/radar/RadarOldArchReceiver.java +11 -5
- package/android/src/oldarch/java/com/radar/RadarOldArchVerifiedReceiver.java +1 -1
- package/dist/@types/RadarNativeInterface.d.ts +9 -14
- package/dist/@types/types.d.ts +2 -0
- package/dist/@types/types.js +19 -19
- package/dist/NativeRadar.d.ts +6 -5
- package/dist/NativeRadar.js +1 -1
- package/dist/index.js +4 -1
- package/dist/index.native.d.ts +5 -4
- package/dist/index.native.js +95 -201
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/ios/RNRadar.mm +50 -42
- package/package.json +3 -4
- package/src/@types/RadarNativeInterface.ts +23 -21
- package/src/@types/types.ts +38 -32
- package/src/NativeRadar.ts +8 -8
- package/src/index.native.ts +269 -236
- package/src/index.tsx +4 -1
- package/src/version.ts +1 -1
package/src/index.native.ts
CHANGED
|
@@ -1,40 +1,102 @@
|
|
|
1
|
-
import type { EventSubscription } from
|
|
2
|
-
import type { RadarNativeInterface } from
|
|
3
|
-
import type {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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,
|
|
48
|
+
Location,
|
|
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;
|
|
81
|
+
|
|
82
|
+
type Events =
|
|
83
|
+
| "locationEmitter"
|
|
84
|
+
| "clientLocationEmitter"
|
|
85
|
+
| "errorEmitter"
|
|
86
|
+
| "logEmitter"
|
|
87
|
+
| "eventsEmitter"
|
|
88
|
+
| "tokenEmitter";
|
|
89
|
+
|
|
90
|
+
export function addListener<EventT extends Events>(
|
|
91
|
+
event: EventT,
|
|
92
|
+
handler: Parameters<(typeof NativeRadar)[EventT]>[0]
|
|
93
|
+
): EventSubscription {
|
|
94
|
+
if (compatEventEmitter != null) {
|
|
95
|
+
return compatEventEmitter.addListener(event, handler);
|
|
22
96
|
}
|
|
23
|
-
|
|
24
|
-
console.error('[Radar] Error loading NativeRadar module:', error);
|
|
25
|
-
throw error;
|
|
97
|
+
return NativeRadar[event](handler as any);
|
|
26
98
|
}
|
|
27
99
|
|
|
28
|
-
// For old architecture, create a NativeEventEmitter
|
|
29
|
-
const eventEmitter = isNewArchitecture ? null : new NativeEventEmitter(NativeModules.RNRadar);
|
|
30
|
-
|
|
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;
|
|
37
|
-
|
|
38
100
|
let locationUpdateSubscription: EventSubscription | null = null;
|
|
39
101
|
let clientLocationUpdateSubscription: EventSubscription | null = null;
|
|
40
102
|
let errorUpdateSubscription: EventSubscription | null = null;
|
|
@@ -48,220 +110,142 @@ const Radar: RadarNativeInterface = {
|
|
|
48
110
|
},
|
|
49
111
|
|
|
50
112
|
trackOnce: async (options?: RadarTrackOnceOptions) => {
|
|
51
|
-
return NativeRadar.trackOnce(
|
|
113
|
+
return NativeRadar.trackOnce(
|
|
114
|
+
options || null
|
|
115
|
+
) as Promise<RadarTrackCallback>;
|
|
52
116
|
},
|
|
53
117
|
|
|
54
|
-
|
|
118
|
+
onLocationUpdated: (callback: RadarLocationUpdateCallback | null) => {
|
|
55
119
|
// Clear any existing subscription
|
|
56
120
|
if (locationUpdateSubscription) {
|
|
57
121
|
locationUpdateSubscription.remove();
|
|
58
|
-
locationUpdateSubscription = null;
|
|
59
122
|
}
|
|
60
123
|
|
|
61
|
-
if (
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
const locationUpdate = {
|
|
65
|
-
location: event.location,
|
|
66
|
-
user: event.user
|
|
67
|
-
};
|
|
124
|
+
if (!callback) {
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
68
127
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
} else if (!isNewArchitecture && eventEmitter) {
|
|
75
|
-
locationUpdateSubscription = eventEmitter.addListener('location', (event: { location: any; user: any; }) => {
|
|
128
|
+
locationUpdateSubscription = addListener(
|
|
129
|
+
"locationEmitter",
|
|
130
|
+
(event: LocationEmitter) => {
|
|
76
131
|
try {
|
|
77
132
|
const locationUpdate = {
|
|
78
|
-
location: event.location,
|
|
79
|
-
user: event.user
|
|
133
|
+
location: event.location as Location,
|
|
134
|
+
user: event.user as RadarUser,
|
|
80
135
|
};
|
|
81
|
-
|
|
82
136
|
callback(locationUpdate);
|
|
83
137
|
} catch (error) {
|
|
84
|
-
console.error(
|
|
138
|
+
console.error("[Radar] Error in location update callback:", error);
|
|
85
139
|
}
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
console.warn('[Radar] No event emitter available for location updates');
|
|
89
|
-
}
|
|
90
|
-
},
|
|
91
|
-
|
|
92
|
-
clearLocationUpdate: () => {
|
|
93
|
-
if (locationUpdateSubscription) {
|
|
94
|
-
locationUpdateSubscription.remove();
|
|
95
|
-
locationUpdateSubscription = null;
|
|
96
|
-
}
|
|
140
|
+
}
|
|
141
|
+
);
|
|
97
142
|
},
|
|
98
143
|
|
|
99
|
-
|
|
144
|
+
onClientLocationUpdated: (
|
|
145
|
+
callback: RadarClientLocationUpdateCallback | null
|
|
146
|
+
) => {
|
|
100
147
|
if (clientLocationUpdateSubscription) {
|
|
101
148
|
clientLocationUpdateSubscription.remove();
|
|
102
149
|
clientLocationUpdateSubscription = null;
|
|
103
150
|
}
|
|
104
151
|
|
|
105
|
-
if (
|
|
106
|
-
|
|
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');
|
|
152
|
+
if (!callback) {
|
|
153
|
+
return;
|
|
133
154
|
}
|
|
134
|
-
},
|
|
135
155
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
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
|
+
);
|
|
141
167
|
},
|
|
142
168
|
|
|
143
|
-
onError: (callback: RadarErrorCallback) => {
|
|
169
|
+
onError: (callback: RadarErrorCallback | null) => {
|
|
144
170
|
if (errorUpdateSubscription) {
|
|
145
171
|
errorUpdateSubscription.remove();
|
|
146
172
|
errorUpdateSubscription = null;
|
|
147
173
|
}
|
|
148
174
|
|
|
149
|
-
if (
|
|
150
|
-
|
|
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');
|
|
175
|
+
if (!callback) {
|
|
176
|
+
return;
|
|
159
177
|
}
|
|
160
|
-
},
|
|
161
178
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
179
|
+
errorUpdateSubscription = addListener(
|
|
180
|
+
"errorEmitter",
|
|
181
|
+
(event: ErrorEmitter) => {
|
|
182
|
+
const errorUpdate = {
|
|
183
|
+
status: event.status,
|
|
184
|
+
};
|
|
185
|
+
callback(errorUpdate.status);
|
|
186
|
+
}
|
|
187
|
+
);
|
|
167
188
|
},
|
|
168
189
|
|
|
169
|
-
onLog: (callback: RadarLogUpdateCallback) => {
|
|
190
|
+
onLog: (callback: RadarLogUpdateCallback | null) => {
|
|
170
191
|
if (logUpdateSubscription) {
|
|
171
192
|
logUpdateSubscription.remove();
|
|
172
193
|
logUpdateSubscription = null;
|
|
173
194
|
}
|
|
174
195
|
|
|
175
|
-
if (
|
|
176
|
-
|
|
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');
|
|
196
|
+
if (!callback) {
|
|
197
|
+
return;
|
|
185
198
|
}
|
|
186
|
-
},
|
|
187
199
|
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
logUpdateSubscription = null;
|
|
192
|
-
}
|
|
200
|
+
logUpdateSubscription = addListener("logEmitter", (event: LogEmitter) => {
|
|
201
|
+
callback(event.message);
|
|
202
|
+
});
|
|
193
203
|
},
|
|
194
204
|
|
|
195
|
-
|
|
205
|
+
onEventsReceived: (callback: RadarEventUpdateCallback | null) => {
|
|
196
206
|
if (eventsUpdateSubscription) {
|
|
197
207
|
eventsUpdateSubscription.remove();
|
|
198
208
|
eventsUpdateSubscription = null;
|
|
199
209
|
}
|
|
200
210
|
|
|
201
|
-
if (
|
|
202
|
-
|
|
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');
|
|
211
|
+
if (!callback) {
|
|
212
|
+
return;
|
|
227
213
|
}
|
|
228
|
-
},
|
|
229
214
|
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
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
|
+
);
|
|
235
225
|
},
|
|
236
226
|
|
|
237
|
-
|
|
227
|
+
onTokenUpdated: (callback: RadarTokenUpdateCallback | null) => {
|
|
238
228
|
if (tokenUpdateSubscription) {
|
|
239
229
|
tokenUpdateSubscription.remove();
|
|
240
230
|
tokenUpdateSubscription = null;
|
|
241
231
|
}
|
|
242
232
|
|
|
243
|
-
if (
|
|
244
|
-
|
|
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');
|
|
233
|
+
if (!callback) {
|
|
234
|
+
return;
|
|
253
235
|
}
|
|
254
|
-
},
|
|
255
236
|
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
237
|
+
tokenUpdateSubscription = addListener(
|
|
238
|
+
"tokenEmitter",
|
|
239
|
+
(event: TokenEmitter) => {
|
|
240
|
+
callback(event.token);
|
|
241
|
+
}
|
|
242
|
+
);
|
|
261
243
|
},
|
|
262
244
|
|
|
263
245
|
requestPermissions: (background: boolean) => {
|
|
264
|
-
return NativeRadar.requestPermissions(
|
|
246
|
+
return NativeRadar.requestPermissions(
|
|
247
|
+
background
|
|
248
|
+
) as Promise<RadarPermissionsStatus>;
|
|
265
249
|
},
|
|
266
250
|
setLogLevel: function (level: RadarLogLevel): void {
|
|
267
251
|
return NativeRadar.setLogLevel(level);
|
|
@@ -282,22 +266,36 @@ const Radar: RadarNativeInterface = {
|
|
|
282
266
|
return NativeRadar.setMetadata(metadata);
|
|
283
267
|
},
|
|
284
268
|
getMetadata: function (): Promise<RadarMetadata> {
|
|
285
|
-
return NativeRadar.getMetadata()
|
|
269
|
+
return NativeRadar.getMetadata() as Promise<RadarMetadata>;
|
|
270
|
+
},
|
|
271
|
+
setProduct: function (product: string): void {
|
|
272
|
+
return NativeRadar.setProduct(product);
|
|
273
|
+
},
|
|
274
|
+
getProduct: function (): Promise<string> {
|
|
275
|
+
return NativeRadar.getProduct();
|
|
286
276
|
},
|
|
287
277
|
setAnonymousTrackingEnabled: function (enabled: boolean): void {
|
|
288
278
|
return NativeRadar.setAnonymousTrackingEnabled(enabled);
|
|
289
279
|
},
|
|
290
280
|
getPermissionsStatus: function (): Promise<RadarPermissionsStatus> {
|
|
291
|
-
return NativeRadar.getPermissionsStatus()
|
|
292
|
-
},
|
|
293
|
-
getLocation: function (
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
281
|
+
return NativeRadar.getPermissionsStatus() as Promise<RadarPermissionsStatus>;
|
|
282
|
+
},
|
|
283
|
+
getLocation: function (
|
|
284
|
+
desiredAccuracy?: RadarTrackingOptionsDesiredAccuracy
|
|
285
|
+
): Promise<RadarLocationCallback> {
|
|
286
|
+
return NativeRadar.getLocation(
|
|
287
|
+
desiredAccuracy || null
|
|
288
|
+
) as Promise<RadarLocationCallback>;
|
|
289
|
+
},
|
|
290
|
+
trackVerified: function (
|
|
291
|
+
options?: RadarTrackVerifiedOptions
|
|
292
|
+
): Promise<RadarTrackVerifiedCallback> {
|
|
293
|
+
return NativeRadar.trackVerified(
|
|
294
|
+
options || null
|
|
295
|
+
) as Promise<RadarTrackVerifiedCallback>;
|
|
298
296
|
},
|
|
299
297
|
getVerifiedLocationToken: function (): Promise<RadarTrackVerifiedCallback> {
|
|
300
|
-
return NativeRadar.getVerifiedLocationToken()
|
|
298
|
+
return NativeRadar.getVerifiedLocationToken() as Promise<RadarTrackVerifiedCallback>;
|
|
301
299
|
},
|
|
302
300
|
clearVerifiedLocationToken: function (): void {
|
|
303
301
|
return NativeRadar.clearVerifiedLocationToken();
|
|
@@ -314,15 +312,14 @@ const Radar: RadarNativeInterface = {
|
|
|
314
312
|
startTrackingCustom: function (options: RadarTrackingOptions): void {
|
|
315
313
|
return NativeRadar.startTrackingCustom(options);
|
|
316
314
|
},
|
|
317
|
-
startTrackingVerified: function (
|
|
318
|
-
|
|
315
|
+
startTrackingVerified: function (
|
|
316
|
+
options?: RadarVerifiedTrackingOptions
|
|
317
|
+
): void {
|
|
318
|
+
return NativeRadar.startTrackingVerified(options || null);
|
|
319
319
|
},
|
|
320
320
|
isTrackingVerified: function (): Promise<boolean> {
|
|
321
321
|
return NativeRadar.isTrackingVerified();
|
|
322
322
|
},
|
|
323
|
-
setProduct: function (product: string): void {
|
|
324
|
-
return NativeRadar.setProduct(product);
|
|
325
|
-
},
|
|
326
323
|
mockTracking: function (options: RadarMockTrackingOptions): void {
|
|
327
324
|
return NativeRadar.mockTracking(options);
|
|
328
325
|
},
|
|
@@ -333,7 +330,7 @@ const Radar: RadarNativeInterface = {
|
|
|
333
330
|
return NativeRadar.stopTrackingVerified();
|
|
334
331
|
},
|
|
335
332
|
getTrackingOptions: function (): Promise<RadarTrackingOptions> {
|
|
336
|
-
return NativeRadar.getTrackingOptions()
|
|
333
|
+
return NativeRadar.getTrackingOptions() as Promise<RadarTrackingOptions>;
|
|
337
334
|
},
|
|
338
335
|
isUsingRemoteTrackingOptions: function (): Promise<boolean> {
|
|
339
336
|
return NativeRadar.isUsingRemoteTrackingOptions();
|
|
@@ -341,26 +338,32 @@ const Radar: RadarNativeInterface = {
|
|
|
341
338
|
isTracking: function (): Promise<boolean> {
|
|
342
339
|
return NativeRadar.isTracking();
|
|
343
340
|
},
|
|
344
|
-
setForegroundServiceOptions: function (
|
|
341
|
+
setForegroundServiceOptions: function (
|
|
342
|
+
options: RadarTrackingOptionsForegroundService
|
|
343
|
+
): void {
|
|
345
344
|
return NativeRadar.setForegroundServiceOptions(options);
|
|
346
345
|
},
|
|
347
346
|
setNotificationOptions: function (options: RadarNotificationOptions): void {
|
|
348
347
|
return NativeRadar.setNotificationOptions(options);
|
|
349
348
|
},
|
|
350
349
|
getTripOptions: function (): Promise<RadarTripOptions> {
|
|
351
|
-
return NativeRadar.getTripOptions()
|
|
350
|
+
return NativeRadar.getTripOptions() as Promise<RadarTripOptions>;
|
|
352
351
|
},
|
|
353
|
-
startTrip: function (
|
|
354
|
-
|
|
352
|
+
startTrip: function (
|
|
353
|
+
options: RadarStartTripOptions
|
|
354
|
+
): Promise<RadarTripCallback> {
|
|
355
|
+
return NativeRadar.startTrip(options) as Promise<RadarTripCallback>;
|
|
355
356
|
},
|
|
356
357
|
completeTrip: function (): Promise<RadarTripCallback> {
|
|
357
|
-
return NativeRadar.completeTrip()
|
|
358
|
+
return NativeRadar.completeTrip() as Promise<RadarTripCallback>;
|
|
358
359
|
},
|
|
359
360
|
cancelTrip: function (): Promise<RadarTripCallback> {
|
|
360
|
-
return NativeRadar.cancelTrip()
|
|
361
|
+
return NativeRadar.cancelTrip() as Promise<RadarTripCallback>;
|
|
361
362
|
},
|
|
362
|
-
updateTrip: function (
|
|
363
|
-
|
|
363
|
+
updateTrip: function (
|
|
364
|
+
options: RadarUpdateTripOptions
|
|
365
|
+
): Promise<RadarTripCallback> {
|
|
366
|
+
return NativeRadar.updateTrip(options) as Promise<RadarTripCallback>;
|
|
364
367
|
},
|
|
365
368
|
acceptEvent: function (eventId: string, verifiedPlaceId: string): void {
|
|
366
369
|
return NativeRadar.acceptEvent(eventId, verifiedPlaceId);
|
|
@@ -369,37 +372,67 @@ const Radar: RadarNativeInterface = {
|
|
|
369
372
|
return NativeRadar.rejectEvent(eventId);
|
|
370
373
|
},
|
|
371
374
|
getContext: function (location?: Location): Promise<RadarContextCallback> {
|
|
372
|
-
return NativeRadar.getContext(
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
},
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
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> {
|
|
396
|
+
return NativeRadar.autocomplete(options) as Promise<RadarAddressCallback>;
|
|
397
|
+
},
|
|
398
|
+
geocode: function (
|
|
399
|
+
options: RadarGeocodeOptions
|
|
400
|
+
): Promise<RadarAddressCallback> {
|
|
401
|
+
return NativeRadar.geocode(options) as Promise<RadarAddressCallback>;
|
|
402
|
+
},
|
|
403
|
+
reverseGeocode: function (
|
|
404
|
+
options?: RadarReverseGeocodeOptions
|
|
405
|
+
): Promise<RadarAddressCallback> {
|
|
406
|
+
return NativeRadar.reverseGeocode(
|
|
407
|
+
options || null
|
|
408
|
+
) as Promise<RadarAddressCallback>;
|
|
388
409
|
},
|
|
389
410
|
ipGeocode: function (): Promise<RadarIPGeocodeCallback> {
|
|
390
|
-
return NativeRadar.ipGeocode()
|
|
411
|
+
return NativeRadar.ipGeocode() as Promise<RadarIPGeocodeCallback>;
|
|
391
412
|
},
|
|
392
|
-
validateAddress: function (
|
|
393
|
-
|
|
413
|
+
validateAddress: function (
|
|
414
|
+
address: RadarAddress
|
|
415
|
+
): Promise<RadarValidateAddressCallback> {
|
|
416
|
+
return NativeRadar.validateAddress(
|
|
417
|
+
address
|
|
418
|
+
) as Promise<RadarValidateAddressCallback>;
|
|
394
419
|
},
|
|
395
|
-
getDistance: function (
|
|
396
|
-
|
|
420
|
+
getDistance: function (
|
|
421
|
+
option: RadarGetDistanceOptions
|
|
422
|
+
): Promise<RadarRouteCallback> {
|
|
423
|
+
return NativeRadar.getDistance(option) as Promise<RadarRouteCallback>;
|
|
397
424
|
},
|
|
398
|
-
getMatrix: function (
|
|
399
|
-
|
|
425
|
+
getMatrix: function (
|
|
426
|
+
option: RadarGetMatrixOptions
|
|
427
|
+
): Promise<RadarRouteMatrix> {
|
|
428
|
+
return NativeRadar.getMatrix(option) as Promise<RadarRouteMatrix>;
|
|
400
429
|
},
|
|
401
|
-
logConversion: function (
|
|
402
|
-
|
|
430
|
+
logConversion: function (
|
|
431
|
+
options: RadarLogConversionOptions
|
|
432
|
+
): Promise<RadarLogConversionCallback> {
|
|
433
|
+
return NativeRadar.logConversion(
|
|
434
|
+
options
|
|
435
|
+
) as Promise<RadarLogConversionCallback>;
|
|
403
436
|
},
|
|
404
437
|
|
|
405
438
|
nativeSdkVersion: function (): Promise<string> {
|
|
@@ -413,7 +446,7 @@ const Radar: RadarNativeInterface = {
|
|
|
413
446
|
},
|
|
414
447
|
getPublishableKey: function (): Promise<string> {
|
|
415
448
|
return NativeRadar.getPublishableKey();
|
|
416
|
-
}
|
|
417
|
-
}
|
|
449
|
+
},
|
|
450
|
+
};
|
|
418
451
|
|
|
419
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