react-native-radar 3.21.0-beta.2 → 3.21.0-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -104,7 +104,7 @@ class RadarModule(reactContext: ReactApplicationContext) :
104
104
  override fun initialize(publishableKey: String, fraud: Boolean): Unit {
105
105
  val editor = reactApplicationContext.getSharedPreferences("RadarSDK", Context.MODE_PRIVATE).edit()
106
106
  editor.putString("x_platform_sdk_type", "ReactNative")
107
- editor.putString("x_platform_sdk_version", "3.21.0-beta.2")
107
+ editor.putString("x_platform_sdk_version", "3.21.0-beta.3")
108
108
  editor.apply()
109
109
 
110
110
  if (fraud) {
@@ -336,7 +336,7 @@ class RadarModule(reactContext: ReactApplicationContext) :
336
336
  radarModuleImpl.geocode(options, promise)
337
337
  }
338
338
 
339
- override fun reverseGeocode(options: ReadableMap, promise: Promise): Unit {
339
+ override fun reverseGeocode(options: ReadableMap?, promise: Promise): Unit {
340
340
  radarModuleImpl.reverseGeocode(options, promise)
341
341
  }
342
342
 
@@ -98,7 +98,7 @@ public class RadarModule extends ReactContextBaseJavaModule implements Permissio
98
98
  this.fraud = fraud;
99
99
  SharedPreferences.Editor editor = getReactApplicationContext().getSharedPreferences("RadarSDK", Context.MODE_PRIVATE).edit();
100
100
  editor.putString("x_platform_sdk_type", "ReactNative");
101
- editor.putString("x_platform_sdk_version", "3.21.0-beta.2");
101
+ editor.putString("x_platform_sdk_version", "3.21.0-beta.3");
102
102
  editor.apply();
103
103
  if (fraud) {
104
104
  Radar.initialize(getReactApplicationContext(), publishableKey, receiver, Radar.RadarLocationServicesProvider.GOOGLE, fraud);
@@ -48,7 +48,7 @@ public class RadarOldArchReceiver extends RadarReceiver {
48
48
  map.putMap("user", RadarUtils.mapForJson(user.toJson()));
49
49
  }
50
50
 
51
- sendEvent("events", map);
51
+ sendEvent("eventsEmitter", map);
52
52
  } catch (Exception e) {
53
53
  Log.e(TAG, "Exception", e);
54
54
  }
@@ -64,7 +64,7 @@ public class RadarOldArchReceiver extends RadarReceiver {
64
64
  map.putMap("location", RadarUtils.mapForJson(Radar.jsonForLocation(location)));
65
65
  map.putMap("user", RadarUtils.mapForJson(user.toJson()));
66
66
 
67
- sendEvent("location", map);
67
+ sendEvent("locationEmitter", map);
68
68
  } catch (Exception e) {
69
69
  Log.e(TAG, "Exception", e);
70
70
  }
@@ -81,7 +81,7 @@ public class RadarOldArchReceiver extends RadarReceiver {
81
81
  map.putBoolean("stopped", stopped);
82
82
  map.putString("source", source.toString());
83
83
 
84
- sendEvent("clientLocation", map);
84
+ sendEvent("clientLocationEmitter", map);
85
85
  } catch (Exception e) {
86
86
  Log.e(TAG, "Exception", e);
87
87
  }
@@ -93,7 +93,7 @@ public class RadarOldArchReceiver extends RadarReceiver {
93
93
  ReactApplication reactApplication = ((ReactApplication)context.getApplicationContext());
94
94
  reactNativeHost = reactApplication.getReactNativeHost();
95
95
 
96
- sendEvent("error", status.toString());
96
+ sendEvent("errorEmitter", status.toString());
97
97
  } catch (Exception e) {
98
98
  Log.e(TAG, "Exception", e);
99
99
  }
@@ -105,7 +105,7 @@ public class RadarOldArchReceiver extends RadarReceiver {
105
105
  ReactApplication reactApplication = ((ReactApplication)context.getApplicationContext());
106
106
  reactNativeHost = reactApplication.getReactNativeHost();
107
107
 
108
- sendEvent("log", message);
108
+ sendEvent("logEmitter", message);
109
109
  } catch (Exception e) {
110
110
  Log.e(TAG, "Exception", e);
111
111
  }
@@ -38,7 +38,7 @@ public class RadarOldArchVerifiedReceiver extends RadarVerifiedReceiver {
38
38
  ReactApplication reactApplication = ((ReactApplication)context.getApplicationContext());
39
39
  reactNativeHost = reactApplication.getReactNativeHost();
40
40
 
41
- sendEvent("token", RadarUtils.mapForJson(token.toJson()));
41
+ sendEvent("tokenEmitter", RadarUtils.mapForJson(token.toJson()));
42
42
  } catch (Exception e) {
43
43
  Log.e(TAG, "Exception", e);
44
44
  }
@@ -1,4 +1,4 @@
1
- import type { RadarPermissionsStatus, RadarTrackCallback, RadarTrackOnceOptions, RadarLocationUpdateCallback, RadarClientLocationUpdateCallback, RadarErrorCallback, RadarLogUpdateCallback, RadarEventUpdateCallback, RadarTokenUpdateCallback, RadarLogLevel, RadarMetadata, RadarTrackingOptionsDesiredAccuracy, RadarLocationCallback, RadarTrackVerifiedCallback, RadarTrackVerifiedOptions, RadarTrackingOptions, RadarVerifiedTrackingOptions, RadarMockTrackingOptions, RadarTrackingOptionsForegroundService, RadarNotificationOptions, RadarTripOptions, RadarStartTripOptions, RadarTripCallback, RadarUpdateTripOptions, RadarContextCallback, RadarSearchPlacesOptions, RadarSearchPlacesCallback, RadarSearchGeofencesCallback, RadarSearchGeofencesOptions, RadarAutocompleteOptions, RadarAddressCallback, RadarReverseGeocodeOptions, RadarGeocodeOptions, RadarValidateAddressCallback, RadarIPGeocodeCallback, RadarAddress, RadarLogConversionOptions, RadarGetDistanceOptions, RadarRouteCallback, RadarGetMatrixOptions, RadarLogConversionCallback, RadarRouteMatrix } from "./types";
1
+ import type { RadarPermissionsStatus, RadarTrackCallback, RadarTrackOnceOptions, RadarLocationUpdateCallback, RadarClientLocationUpdateCallback, RadarErrorCallback, RadarLogUpdateCallback, RadarEventUpdateCallback, RadarTokenUpdateCallback, RadarLogLevel, RadarMetadata, RadarTrackingOptionsDesiredAccuracy, RadarLocationCallback, RadarTrackVerifiedCallback, RadarTrackVerifiedOptions, RadarTrackingOptions, RadarVerifiedTrackingOptions, RadarMockTrackingOptions, RadarTrackingOptionsForegroundService, RadarNotificationOptions, RadarTripOptions, RadarStartTripOptions, RadarTripCallback, RadarUpdateTripOptions, RadarContextCallback, RadarSearchPlacesOptions, RadarSearchPlacesCallback, RadarSearchGeofencesCallback, RadarSearchGeofencesOptions, RadarAutocompleteOptions, RadarAddressCallback, RadarReverseGeocodeOptions, RadarGeocodeOptions, RadarValidateAddressCallback, RadarIPGeocodeCallback, RadarAddress, RadarLogConversionOptions, RadarGetDistanceOptions, RadarRouteCallback, RadarGetMatrixOptions, RadarLogConversionCallback, RadarRouteMatrix, Location } from "./types";
2
2
  export interface RadarNativeInterface {
3
3
  initialize: (publishableKey: string, fraud?: boolean) => void;
4
4
  setLogLevel: (level: RadarLogLevel) => void;
@@ -51,18 +51,12 @@ export interface RadarNativeInterface {
51
51
  logConversion: (options: RadarLogConversionOptions) => Promise<RadarLogConversionCallback>;
52
52
  nativeSdkVersion: () => Promise<string>;
53
53
  rnSdkVersion: () => string;
54
- onLocationUpdate: (callback: RadarLocationUpdateCallback) => void;
55
- clearLocationUpdate: () => void;
56
- onClientLocationUpdate: (callback: RadarClientLocationUpdateCallback) => void;
57
- clearClientLocationUpdate: () => void;
58
- onError: (callback: RadarErrorCallback) => void;
59
- clearError: () => void;
60
- onLog: (callback: RadarLogUpdateCallback) => void;
61
- clearLog: () => void;
62
- onEventUpdate: (callback: RadarEventUpdateCallback) => void;
63
- clearEventUpdate: () => void;
64
- onTokenUpdate: (callback: RadarTokenUpdateCallback) => void;
65
- clearTokenUpdate: () => void;
54
+ onLocationUpdated: (callback: RadarLocationUpdateCallback | null) => void;
55
+ onClientLocationUpdated: (callback: RadarClientLocationUpdateCallback | null) => void;
56
+ onError: (callback: RadarErrorCallback | null) => void;
57
+ onLog: (callback: RadarLogUpdateCallback | null) => void;
58
+ onEventsReceived: (callback: RadarEventUpdateCallback | null) => void;
59
+ onTokenUpdated: (callback: RadarTokenUpdateCallback | null) => void;
66
60
  getHost: () => Promise<string>;
67
61
  getPublishableKey: () => Promise<string>;
68
62
  }
@@ -61,12 +61,12 @@ export interface Spec extends TurboModule {
61
61
  updateTrip(options: Object): Promise<Object>;
62
62
  acceptEvent(eventId: string, verifiedPlaceId: string): void;
63
63
  rejectEvent(eventId: string): void;
64
- getContext(location: Object): Promise<Object>;
64
+ getContext(location: Object | null): Promise<Object>;
65
65
  searchPlaces(options: Object): Promise<Object>;
66
66
  searchGeofences(options: Object): Promise<Object>;
67
67
  autocomplete(options: Object): Promise<Object>;
68
68
  geocode(options: Object): Promise<Object>;
69
- reverseGeocode(options: Object): Promise<Object>;
69
+ reverseGeocode(options: Object | null): Promise<Object>;
70
70
  ipGeocode(): Promise<Object>;
71
71
  validateAddress(address: Object): Promise<Object>;
72
72
  getDistance(options: Object): Promise<Object>;
@@ -1,6 +1,7 @@
1
+ import type { EventSubscription } from 'react-native';
1
2
  import type { RadarNativeInterface } from './@types/RadarNativeInterface';
2
- declare global {
3
- var __turboModuleProxy: any;
4
- }
3
+ import NativeRadar from './NativeRadar';
4
+ type Events = 'locationEmitter' | 'clientLocationEmitter' | 'errorEmitter' | 'logEmitter' | 'eventsEmitter' | 'tokenEmitter';
5
+ export declare function addListener<EventT extends Events>(event: EventT, handler: Parameters<(typeof NativeRadar)[EventT]>[0]): EventSubscription;
5
6
  declare const Radar: RadarNativeInterface;
6
7
  export default Radar;