react-native-radar 3.20.4 → 3.21.0-beta.2
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 +22 -0
- package/android/build.gradle +77 -35
- package/android/gradle.properties +5 -1
- package/android/src/main/AndroidManifest.xml +1 -3
- package/android/src/main/java/{io/radar/react/RNRadarModule.java → com/radar/RadarModuleImpl.java} +131 -258
- package/android/src/main/java/com/radar/RadarPackage.kt +35 -0
- package/android/src/main/java/{io/radar/react/RNRadarUtils.java → com/radar/RadarUtils.java} +3 -2
- package/android/src/newarch/java/com/radar/RadarModule.kt +381 -0
- package/android/src/oldarch/java/com/radar/RadarModule.java +416 -0
- package/android/src/{main/java/io/radar/react/RNRadarReceiver.java → oldarch/java/com/radar/RadarOldArchReceiver.java} +8 -8
- package/android/src/{main/java/io/radar/react/RNRadarVerifiedReceiver.java → oldarch/java/com/radar/RadarOldArchVerifiedReceiver.java} +4 -4
- package/app.plugin.js +1 -1
- package/dist/@types/RadarNativeInterface.d.ts +17 -7
- package/dist/@types/types.d.ts +4 -3
- package/dist/NativeRadar.d.ts +86 -0
- package/dist/NativeRadar.js +4 -0
- package/dist/helpers.d.ts +2 -2
- package/dist/helpers.js +6 -6
- package/dist/index.native.d.ts +4 -1
- package/dist/index.native.js +402 -141
- package/dist/index.web.js +2 -2
- package/dist/ui/autocomplete.js +17 -7
- package/dist/ui/map.js +18 -8
- package/dist/version.d.ts +1 -0
- package/dist/version.js +6 -0
- package/ios/RNRadar.h +11 -2
- package/ios/{RNRadar.m → RNRadar.mm} +77 -39
- package/package.json +65 -32
- package/plugin/build/withRadar.d.ts +2 -4
- package/plugin/build/withRadar.js +9 -10
- package/plugin/build/withRadarAndroid.d.ts +2 -3
- package/plugin/build/withRadarAndroid.js +11 -14
- package/plugin/build/withRadarIOS.d.ts +1 -2
- package/plugin/build/withRadarIOS.js +8 -11
- package/react-native.config.js +10 -0
- package/src/@types/RadarNativeInterface.ts +127 -0
- package/src/@types/types.ts +808 -0
- package/src/NativeRadar.ts +95 -0
- package/src/helpers.js +11 -0
- package/src/index.native.ts +419 -0
- package/src/index.tsx +22 -0
- package/src/index.web.js +528 -0
- package/src/ui/autocomplete.jsx +324 -0
- package/src/ui/back.png +0 -0
- package/src/ui/close.png +0 -0
- package/src/ui/images.js +5 -0
- package/src/ui/map-logo.png +0 -0
- package/src/ui/map.jsx +122 -0
- package/src/ui/marker.png +0 -0
- package/src/ui/radar-logo.png +0 -0
- package/src/ui/search.png +0 -0
- package/src/ui/styles.js +125 -0
- package/src/version.ts +3 -0
- package/android/build.gradle.template +0 -49
- package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/android/gradle/wrapper/gradle-wrapper.properties +0 -6
- package/android/gradlew +0 -160
- package/android/gradlew.bat +0 -90
- package/android/proguard-rules.pro +0 -4
- package/android/src/main/java/io/radar/react/RNRadarPackage.java +0 -29
- package/ios/Cartfile.private +0 -1
- package/ios/Cartfile.resolved +0 -1
- package/ios/Cartfile.resolved.template +0 -1
- package/ios/RNRadar.xcodeproj/project.pbxproj +0 -521
- package/ios/RNRadar.xcodeproj/xcshareddata/xcschemes/RNRadar.xcscheme +0 -76
- package/plugin/build/index.d.ts +0 -3
- package/plugin/build/index.js +0 -6
- package/react-native-radar.podspec +0 -19
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import type { TurboModule } from 'react-native';
|
|
2
|
+
import { TurboModuleRegistry } from 'react-native';
|
|
3
|
+
import type { EventEmitter } from 'react-native/Libraries/Types/CodegenTypes';
|
|
4
|
+
|
|
5
|
+
export type LocationEmitter = {
|
|
6
|
+
location: Object;
|
|
7
|
+
user: Object;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export type ClientLocationEmitter = {
|
|
11
|
+
location: Object;
|
|
12
|
+
stopped: boolean;
|
|
13
|
+
source: string;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export type ErrorEmitter = {
|
|
17
|
+
status: string;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export type LogEmitter = {
|
|
21
|
+
message: string;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export type EventsEmitter = {
|
|
25
|
+
events: Array<Object>;
|
|
26
|
+
user: Object;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export type TokenEmitter = {
|
|
30
|
+
token: Object;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
export interface Spec extends TurboModule {
|
|
35
|
+
initialize(publishableKey: string, fraud: boolean): void;
|
|
36
|
+
requestPermissions(background: boolean): Promise<string>;
|
|
37
|
+
getPermissionsStatus(): Promise<string>;
|
|
38
|
+
trackOnce(trackOnceOptions: Object | null): Promise<Object>;
|
|
39
|
+
setLogLevel(level: string): void;
|
|
40
|
+
setUserId(userId: string): void;
|
|
41
|
+
getUserId(): Promise<string>;
|
|
42
|
+
setDescription(description: string): void;
|
|
43
|
+
getDescription(): Promise<string>;
|
|
44
|
+
setMetadata(metadata: Object): void;
|
|
45
|
+
getMetadata(): Promise<Object>;
|
|
46
|
+
setAnonymousTrackingEnabled(enabled: boolean): void;
|
|
47
|
+
getLocation(desiredAccuracy: string | null): Promise<Object>;
|
|
48
|
+
trackVerified(trackVerifiedOptions: Object | null): Promise<Object>;
|
|
49
|
+
getVerifiedLocationToken(): Promise<Object>;
|
|
50
|
+
clearVerifiedLocationToken(): void;
|
|
51
|
+
startTrackingEfficient(): void;
|
|
52
|
+
startTrackingResponsive(): void;
|
|
53
|
+
startTrackingContinuous(): void;
|
|
54
|
+
startTrackingCustom(options: Object): void;
|
|
55
|
+
startTrackingVerified(options: Object | null): void;
|
|
56
|
+
isTrackingVerified(): Promise<boolean>;
|
|
57
|
+
setProduct(product: string): void;
|
|
58
|
+
mockTracking(options: Object): void;
|
|
59
|
+
stopTracking(): void;
|
|
60
|
+
stopTrackingVerified(): void;
|
|
61
|
+
getTrackingOptions(): Promise<Object>;
|
|
62
|
+
isUsingRemoteTrackingOptions(): Promise<boolean>;
|
|
63
|
+
isTracking(): Promise<boolean>;
|
|
64
|
+
setForegroundServiceOptions(options: Object): void;
|
|
65
|
+
setNotificationOptions(options: Object): void;
|
|
66
|
+
getTripOptions(): Promise<Object>;
|
|
67
|
+
startTrip(options: Object): Promise<Object>;
|
|
68
|
+
completeTrip(): Promise<Object>;
|
|
69
|
+
cancelTrip(): Promise<Object>;
|
|
70
|
+
updateTrip(options: Object): Promise<Object>;
|
|
71
|
+
acceptEvent(eventId: string, verifiedPlaceId: string): void;
|
|
72
|
+
rejectEvent(eventId: string): void;
|
|
73
|
+
getContext(location: Object): Promise<Object>;
|
|
74
|
+
searchPlaces(options: Object): Promise<Object>;
|
|
75
|
+
searchGeofences(options: Object): Promise<Object>;
|
|
76
|
+
autocomplete(options: Object): Promise<Object>;
|
|
77
|
+
geocode(options: Object): Promise<Object>;
|
|
78
|
+
reverseGeocode(options: Object): Promise<Object>;
|
|
79
|
+
ipGeocode(): Promise<Object>;
|
|
80
|
+
validateAddress(address: Object): Promise<Object>;
|
|
81
|
+
getDistance(options: Object): Promise<Object>;
|
|
82
|
+
getMatrix(options: Object): Promise<Object>;
|
|
83
|
+
logConversion(options: Object): Promise<Object>;
|
|
84
|
+
nativeSdkVersion(): Promise<string>;
|
|
85
|
+
getHost(): Promise<string>;
|
|
86
|
+
getPublishableKey(): Promise<string>;
|
|
87
|
+
readonly locationEmitter: EventEmitter<LocationEmitter>;
|
|
88
|
+
readonly clientLocationEmitter: EventEmitter<ClientLocationEmitter>;
|
|
89
|
+
readonly errorEmitter: EventEmitter<ErrorEmitter>;
|
|
90
|
+
readonly logEmitter: EventEmitter<LogEmitter>;
|
|
91
|
+
readonly eventsEmitter: EventEmitter<EventsEmitter>;
|
|
92
|
+
readonly tokenEmitter: EventEmitter<TokenEmitter>;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export default TurboModuleRegistry.getEnforcing<Spec>('RNRadar');
|
package/src/helpers.js
ADDED
|
@@ -0,0 +1,419 @@
|
|
|
1
|
+
import type { EventSubscription } from 'react-native';
|
|
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';
|
|
6
|
+
import { VERSION } from './version';
|
|
7
|
+
|
|
8
|
+
declare global {
|
|
9
|
+
var __turboModuleProxy: any;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const isNewArchitecture = global.__turboModuleProxy != null;
|
|
13
|
+
|
|
14
|
+
let NativeRadar: any;
|
|
15
|
+
|
|
16
|
+
try {
|
|
17
|
+
if (isNewArchitecture) {
|
|
18
|
+
const NativeRadarModule = require('./NativeRadar');
|
|
19
|
+
NativeRadar = NativeRadarModule.default;
|
|
20
|
+
} else {
|
|
21
|
+
NativeRadar = NativeModules.RNRadar;
|
|
22
|
+
}
|
|
23
|
+
} catch (error) {
|
|
24
|
+
console.error('[Radar] Error loading NativeRadar module:', error);
|
|
25
|
+
throw error;
|
|
26
|
+
}
|
|
27
|
+
|
|
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
|
+
let locationUpdateSubscription: EventSubscription | null = null;
|
|
39
|
+
let clientLocationUpdateSubscription: EventSubscription | null = null;
|
|
40
|
+
let errorUpdateSubscription: EventSubscription | null = null;
|
|
41
|
+
let logUpdateSubscription: EventSubscription | null = null;
|
|
42
|
+
let eventsUpdateSubscription: EventSubscription | null = null;
|
|
43
|
+
let tokenUpdateSubscription: EventSubscription | null = null;
|
|
44
|
+
|
|
45
|
+
const Radar: RadarNativeInterface = {
|
|
46
|
+
initialize: (publishableKey: string, fraud?: boolean) => {
|
|
47
|
+
return NativeRadar.initialize(publishableKey, !!fraud);
|
|
48
|
+
},
|
|
49
|
+
|
|
50
|
+
trackOnce: async (options?: RadarTrackOnceOptions) => {
|
|
51
|
+
return NativeRadar.trackOnce(options || null) as Promise<RadarTrackCallback>;
|
|
52
|
+
},
|
|
53
|
+
|
|
54
|
+
onLocationUpdate: (callback: RadarLocationUpdateCallback) => {
|
|
55
|
+
// Clear any existing subscription
|
|
56
|
+
if (locationUpdateSubscription) {
|
|
57
|
+
locationUpdateSubscription.remove();
|
|
58
|
+
locationUpdateSubscription = null;
|
|
59
|
+
}
|
|
60
|
+
|
|
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');
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
|
|
92
|
+
clearLocationUpdate: () => {
|
|
93
|
+
if (locationUpdateSubscription) {
|
|
94
|
+
locationUpdateSubscription.remove();
|
|
95
|
+
locationUpdateSubscription = null;
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
|
|
99
|
+
onClientLocationUpdate: (callback: RadarClientLocationUpdateCallback) => {
|
|
100
|
+
if (clientLocationUpdateSubscription) {
|
|
101
|
+
clientLocationUpdateSubscription.remove();
|
|
102
|
+
clientLocationUpdateSubscription = null;
|
|
103
|
+
}
|
|
104
|
+
|
|
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');
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
|
|
136
|
+
clearClientLocationUpdate: () => {
|
|
137
|
+
if (clientLocationUpdateSubscription) {
|
|
138
|
+
clientLocationUpdateSubscription.remove();
|
|
139
|
+
clientLocationUpdateSubscription = null;
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
|
|
143
|
+
onError: (callback: RadarErrorCallback) => {
|
|
144
|
+
if (errorUpdateSubscription) {
|
|
145
|
+
errorUpdateSubscription.remove();
|
|
146
|
+
errorUpdateSubscription = null;
|
|
147
|
+
}
|
|
148
|
+
|
|
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;
|
|
166
|
+
}
|
|
167
|
+
},
|
|
168
|
+
|
|
169
|
+
onLog: (callback: RadarLogUpdateCallback) => {
|
|
170
|
+
if (logUpdateSubscription) {
|
|
171
|
+
logUpdateSubscription.remove();
|
|
172
|
+
logUpdateSubscription = null;
|
|
173
|
+
}
|
|
174
|
+
|
|
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;
|
|
192
|
+
}
|
|
193
|
+
},
|
|
194
|
+
|
|
195
|
+
onEventUpdate: (callback: RadarEventUpdateCallback) => {
|
|
196
|
+
if (eventsUpdateSubscription) {
|
|
197
|
+
eventsUpdateSubscription.remove();
|
|
198
|
+
eventsUpdateSubscription = null;
|
|
199
|
+
}
|
|
200
|
+
|
|
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');
|
|
227
|
+
}
|
|
228
|
+
},
|
|
229
|
+
|
|
230
|
+
clearEventUpdate: () => {
|
|
231
|
+
if (eventsUpdateSubscription) {
|
|
232
|
+
eventsUpdateSubscription.remove();
|
|
233
|
+
eventsUpdateSubscription = null;
|
|
234
|
+
}
|
|
235
|
+
},
|
|
236
|
+
|
|
237
|
+
onTokenUpdate: (callback: RadarTokenUpdateCallback) => {
|
|
238
|
+
if (tokenUpdateSubscription) {
|
|
239
|
+
tokenUpdateSubscription.remove();
|
|
240
|
+
tokenUpdateSubscription = null;
|
|
241
|
+
}
|
|
242
|
+
|
|
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');
|
|
253
|
+
}
|
|
254
|
+
},
|
|
255
|
+
|
|
256
|
+
clearTokenUpdate: () => {
|
|
257
|
+
if (tokenUpdateSubscription) {
|
|
258
|
+
tokenUpdateSubscription.remove();
|
|
259
|
+
tokenUpdateSubscription = null;
|
|
260
|
+
}
|
|
261
|
+
},
|
|
262
|
+
|
|
263
|
+
requestPermissions: (background: boolean) => {
|
|
264
|
+
return NativeRadar.requestPermissions(background) as Promise<RadarPermissionsStatus>;
|
|
265
|
+
},
|
|
266
|
+
setLogLevel: function (level: RadarLogLevel): void {
|
|
267
|
+
return NativeRadar.setLogLevel(level);
|
|
268
|
+
},
|
|
269
|
+
setUserId: function (userId: string): void {
|
|
270
|
+
return NativeRadar.setUserId(userId);
|
|
271
|
+
},
|
|
272
|
+
getUserId: function (): Promise<string> {
|
|
273
|
+
return NativeRadar.getUserId();
|
|
274
|
+
},
|
|
275
|
+
setDescription: function (description: string): void {
|
|
276
|
+
return NativeRadar.setDescription(description);
|
|
277
|
+
},
|
|
278
|
+
getDescription: function (): Promise<string> {
|
|
279
|
+
return NativeRadar.getDescription();
|
|
280
|
+
},
|
|
281
|
+
setMetadata: function (metadata: RadarMetadata): void {
|
|
282
|
+
return NativeRadar.setMetadata(metadata);
|
|
283
|
+
},
|
|
284
|
+
getMetadata: function (): Promise<RadarMetadata> {
|
|
285
|
+
return NativeRadar.getMetadata();
|
|
286
|
+
},
|
|
287
|
+
setAnonymousTrackingEnabled: function (enabled: boolean): void {
|
|
288
|
+
return NativeRadar.setAnonymousTrackingEnabled(enabled);
|
|
289
|
+
},
|
|
290
|
+
getPermissionsStatus: function (): Promise<RadarPermissionsStatus> {
|
|
291
|
+
return NativeRadar.getPermissionsStatus();
|
|
292
|
+
},
|
|
293
|
+
getLocation: function (desiredAccuracy?: RadarTrackingOptionsDesiredAccuracy): Promise<RadarLocationCallback> {
|
|
294
|
+
return NativeRadar.getLocation(desiredAccuracy);
|
|
295
|
+
},
|
|
296
|
+
trackVerified: function (options?: RadarTrackVerifiedOptions): Promise<RadarTrackVerifiedCallback> {
|
|
297
|
+
return NativeRadar.trackVerified(options);
|
|
298
|
+
},
|
|
299
|
+
getVerifiedLocationToken: function (): Promise<RadarTrackVerifiedCallback> {
|
|
300
|
+
return NativeRadar.getVerifiedLocationToken();
|
|
301
|
+
},
|
|
302
|
+
clearVerifiedLocationToken: function (): void {
|
|
303
|
+
return NativeRadar.clearVerifiedLocationToken();
|
|
304
|
+
},
|
|
305
|
+
startTrackingEfficient: function (): void {
|
|
306
|
+
return NativeRadar.startTrackingEfficient();
|
|
307
|
+
},
|
|
308
|
+
startTrackingResponsive: function (): void {
|
|
309
|
+
return NativeRadar.startTrackingResponsive();
|
|
310
|
+
},
|
|
311
|
+
startTrackingContinuous: function (): void {
|
|
312
|
+
return NativeRadar.startTrackingContinuous();
|
|
313
|
+
},
|
|
314
|
+
startTrackingCustom: function (options: RadarTrackingOptions): void {
|
|
315
|
+
return NativeRadar.startTrackingCustom(options);
|
|
316
|
+
},
|
|
317
|
+
startTrackingVerified: function (options?: RadarVerifiedTrackingOptions): void {
|
|
318
|
+
return NativeRadar.startTrackingVerified(options);
|
|
319
|
+
},
|
|
320
|
+
isTrackingVerified: function (): Promise<boolean> {
|
|
321
|
+
return NativeRadar.isTrackingVerified();
|
|
322
|
+
},
|
|
323
|
+
setProduct: function (product: string): void {
|
|
324
|
+
return NativeRadar.setProduct(product);
|
|
325
|
+
},
|
|
326
|
+
mockTracking: function (options: RadarMockTrackingOptions): void {
|
|
327
|
+
return NativeRadar.mockTracking(options);
|
|
328
|
+
},
|
|
329
|
+
stopTracking: function (): void {
|
|
330
|
+
return NativeRadar.stopTracking();
|
|
331
|
+
},
|
|
332
|
+
stopTrackingVerified: function (): void {
|
|
333
|
+
return NativeRadar.stopTrackingVerified();
|
|
334
|
+
},
|
|
335
|
+
getTrackingOptions: function (): Promise<RadarTrackingOptions> {
|
|
336
|
+
return NativeRadar.getTrackingOptions();
|
|
337
|
+
},
|
|
338
|
+
isUsingRemoteTrackingOptions: function (): Promise<boolean> {
|
|
339
|
+
return NativeRadar.isUsingRemoteTrackingOptions();
|
|
340
|
+
},
|
|
341
|
+
isTracking: function (): Promise<boolean> {
|
|
342
|
+
return NativeRadar.isTracking();
|
|
343
|
+
},
|
|
344
|
+
setForegroundServiceOptions: function (options: RadarTrackingOptionsForegroundService): void {
|
|
345
|
+
return NativeRadar.setForegroundServiceOptions(options);
|
|
346
|
+
},
|
|
347
|
+
setNotificationOptions: function (options: RadarNotificationOptions): void {
|
|
348
|
+
return NativeRadar.setNotificationOptions(options);
|
|
349
|
+
},
|
|
350
|
+
getTripOptions: function (): Promise<RadarTripOptions> {
|
|
351
|
+
return NativeRadar.getTripOptions();
|
|
352
|
+
},
|
|
353
|
+
startTrip: function (options: RadarStartTripOptions): Promise<RadarTripCallback> {
|
|
354
|
+
return NativeRadar.startTrip(options);
|
|
355
|
+
},
|
|
356
|
+
completeTrip: function (): Promise<RadarTripCallback> {
|
|
357
|
+
return NativeRadar.completeTrip();
|
|
358
|
+
},
|
|
359
|
+
cancelTrip: function (): Promise<RadarTripCallback> {
|
|
360
|
+
return NativeRadar.cancelTrip();
|
|
361
|
+
},
|
|
362
|
+
updateTrip: function (options: RadarUpdateTripOptions): Promise<RadarTripCallback> {
|
|
363
|
+
return NativeRadar.updateTrip(options);
|
|
364
|
+
},
|
|
365
|
+
acceptEvent: function (eventId: string, verifiedPlaceId: string): void {
|
|
366
|
+
return NativeRadar.acceptEvent(eventId, verifiedPlaceId);
|
|
367
|
+
},
|
|
368
|
+
rejectEvent: function (eventId: string): void {
|
|
369
|
+
return NativeRadar.rejectEvent(eventId);
|
|
370
|
+
},
|
|
371
|
+
getContext: function (location?: Location): Promise<RadarContextCallback> {
|
|
372
|
+
return NativeRadar.getContext(location);
|
|
373
|
+
},
|
|
374
|
+
searchPlaces: function (options: RadarSearchPlacesOptions): Promise<RadarSearchPlacesCallback> {
|
|
375
|
+
return NativeRadar.searchPlaces(options);
|
|
376
|
+
},
|
|
377
|
+
searchGeofences: function (options: RadarSearchGeofencesOptions): Promise<RadarSearchGeofencesCallback> {
|
|
378
|
+
return NativeRadar.searchGeofences(options);
|
|
379
|
+
},
|
|
380
|
+
autocomplete: function (options: RadarAutocompleteOptions): Promise<RadarAddressCallback> {
|
|
381
|
+
return NativeRadar.autocomplete(options);
|
|
382
|
+
},
|
|
383
|
+
geocode: function (options: RadarGeocodeOptions): Promise<RadarAddressCallback> {
|
|
384
|
+
return NativeRadar.geocode(options);
|
|
385
|
+
},
|
|
386
|
+
reverseGeocode: function (options?: RadarReverseGeocodeOptions): Promise<RadarAddressCallback> {
|
|
387
|
+
return NativeRadar.reverseGeocode(options);
|
|
388
|
+
},
|
|
389
|
+
ipGeocode: function (): Promise<RadarIPGeocodeCallback> {
|
|
390
|
+
return NativeRadar.ipGeocode();
|
|
391
|
+
},
|
|
392
|
+
validateAddress: function (address: RadarAddress): Promise<RadarValidateAddressCallback> {
|
|
393
|
+
return NativeRadar.validateAddress(address);
|
|
394
|
+
},
|
|
395
|
+
getDistance: function (option: RadarGetDistanceOptions): Promise<RadarRouteCallback> {
|
|
396
|
+
return NativeRadar.getDistance(option);
|
|
397
|
+
},
|
|
398
|
+
getMatrix: function (option: RadarGetMatrixOptions): Promise<RadarRouteMatrix> {
|
|
399
|
+
return NativeRadar.getMatrix(option);
|
|
400
|
+
},
|
|
401
|
+
logConversion: function (options: RadarLogConversionOptions): Promise<RadarLogConversionCallback> {
|
|
402
|
+
return NativeRadar.logConversion(options);
|
|
403
|
+
},
|
|
404
|
+
|
|
405
|
+
nativeSdkVersion: function (): Promise<string> {
|
|
406
|
+
return NativeRadar.nativeSdkVersion();
|
|
407
|
+
},
|
|
408
|
+
rnSdkVersion: function (): string {
|
|
409
|
+
return VERSION;
|
|
410
|
+
},
|
|
411
|
+
getHost: function (): Promise<string> {
|
|
412
|
+
return NativeRadar.getHost();
|
|
413
|
+
},
|
|
414
|
+
getPublishableKey: function (): Promise<string> {
|
|
415
|
+
return NativeRadar.getPublishableKey();
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
export default Radar;
|
package/src/index.tsx
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { RadarNativeInterface } from "./@types/RadarNativeInterface";
|
|
2
|
+
import { Platform } from "react-native";
|
|
3
|
+
|
|
4
|
+
let nativeModule: RadarNativeInterface;
|
|
5
|
+
|
|
6
|
+
nativeModule = Platform.OS === "web" ? require("./index.web").default : require("./index.native").default;
|
|
7
|
+
|
|
8
|
+
export default nativeModule;
|
|
9
|
+
|
|
10
|
+
let RadarRNWeb = Platform.OS === "web" ? require("./index.web").default : {};
|
|
11
|
+
|
|
12
|
+
export { RadarRNWeb };
|
|
13
|
+
|
|
14
|
+
let Autocomplete =
|
|
15
|
+
Platform.OS !== "web" ? require("./ui/autocomplete").default : {};
|
|
16
|
+
export { Autocomplete };
|
|
17
|
+
|
|
18
|
+
let Map = Platform.OS !== "web" ? require("./ui/map").default : {};
|
|
19
|
+
export { Map };
|
|
20
|
+
|
|
21
|
+
export * from "./@types/types";
|
|
22
|
+
export * from "./@types/RadarNativeInterface";
|