react-native-radar 3.30.0 → 3.31.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.
@@ -143,7 +143,7 @@ class RadarModule(reactContext: ReactApplicationContext) :
143
143
  override fun initialize(publishableKey: String, fraud: Boolean): Unit {
144
144
  val editor = reactApplicationContext.getSharedPreferences("RadarSDK", Context.MODE_PRIVATE).edit()
145
145
  editor.putString("x_platform_sdk_type", "ReactNative")
146
- editor.putString("x_platform_sdk_version", "3.30.0")
146
+ editor.putString("x_platform_sdk_version", "3.31.0")
147
147
  editor.apply()
148
148
 
149
149
  Radar.initialize(reactApplicationContext, publishableKey, radarReceiver, Radar.RadarLocationServicesProvider.GOOGLE, fraud, null, radarInAppMessageReceiver, currentActivity)
@@ -102,7 +102,7 @@ public class RadarModule extends ReactContextBaseJavaModule implements Permissio
102
102
  this.fraud = fraud;
103
103
  SharedPreferences.Editor editor = getReactApplicationContext().getSharedPreferences("RadarSDK", Context.MODE_PRIVATE).edit();
104
104
  editor.putString("x_platform_sdk_type", "ReactNative");
105
- editor.putString("x_platform_sdk_version", "3.30.0");
105
+ editor.putString("x_platform_sdk_version", "3.31.0");
106
106
  editor.apply();
107
107
  Radar.initialize(getReactApplicationContext(), publishableKey, receiver, Radar.RadarLocationServicesProvider.GOOGLE, fraud, null, inAppMessageReceiver, getCurrentActivity());
108
108
  if (fraud) {
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const VERSION = "3.30.0";
1
+ export declare const VERSION = "3.31.0";
package/dist/version.js CHANGED
@@ -3,4 +3,4 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
4
  // This file contains the version of the react-native-radar package
5
5
  // It should be updated to match the version in package.json
6
- exports.VERSION = '3.30.0';
6
+ exports.VERSION = '3.31.0';
package/ios/RNRadar.mm CHANGED
@@ -9,6 +9,9 @@ static NSString *_publishableKey = nil;
9
9
  CLLocationManager *locationManager;
10
10
  RCTPromiseResolveBlock permissionsRequestResolver;
11
11
  bool hasListeners;
12
+ #ifdef RCT_NEW_ARCH_ENABLED
13
+ bool jsEventEmitterReady;
14
+ #endif
12
15
  }
13
16
 
14
17
  RCT_EXPORT_MODULE()
@@ -52,12 +55,21 @@ RCT_EXPORT_MODULE()
52
55
  hasListeners = NO;
53
56
  }
54
57
 
58
+ #ifdef RCT_NEW_ARCH_ENABLED
59
+ - (void)setEventEmitterCallback:(EventEmitterCallbackWrapper *)eventEmitterCallbackWrapper {
60
+ [super setEventEmitterCallback:eventEmitterCallbackWrapper];
61
+ jsEventEmitterReady = YES;
62
+ }
63
+ #endif
64
+
55
65
  - (void)onNewInAppMessage:(RadarInAppMessage *)inAppMessage {
56
66
 
57
67
  NSMutableDictionary *body = [NSMutableDictionary new];
58
68
  [body setValue:[Radar dictionaryForInAppMessage:inAppMessage] forKey:@"inAppMessage"];
59
69
  #ifdef RCT_NEW_ARCH_ENABLED
60
- [self emitNewInAppMessageEmitter:body];
70
+ if (jsEventEmitterReady) {
71
+ [self emitNewInAppMessageEmitter:body];
72
+ }
61
73
  #else
62
74
  if (hasListeners) {
63
75
  [self sendEventWithName:@"newInAppMessageEmitter" body:body];
@@ -69,7 +81,9 @@ RCT_EXPORT_MODULE()
69
81
  NSMutableDictionary *body = [NSMutableDictionary new];
70
82
  [body setValue:[Radar dictionaryForInAppMessage:inAppMessage] forKey:@"inAppMessage"];
71
83
  #ifdef RCT_NEW_ARCH_ENABLED
72
- [self emitInAppMessageDismissedEmitter:body];
84
+ if (jsEventEmitterReady) {
85
+ [self emitInAppMessageDismissedEmitter:body];
86
+ }
73
87
  #else
74
88
  if (hasListeners) {
75
89
  [self sendEventWithName:@"inAppMessageDismissedEmitter" body:body];
@@ -81,7 +95,9 @@ RCT_EXPORT_MODULE()
81
95
  NSMutableDictionary *body = [NSMutableDictionary new];
82
96
  [body setValue:[Radar dictionaryForInAppMessage:inAppMessage] forKey:@"inAppMessage"];
83
97
  #ifdef RCT_NEW_ARCH_ENABLED
84
- [self emitInAppMessageClickedEmitter:body];
98
+ if (jsEventEmitterReady) {
99
+ [self emitInAppMessageClickedEmitter:body];
100
+ }
85
101
  #else
86
102
  if (hasListeners) {
87
103
  [self sendEventWithName:@"inAppMessageClickedEmitter" body:body];
@@ -105,7 +121,9 @@ RCT_EXPORT_MODULE()
105
121
  [body setValue:[user dictionaryValue] forKey:@"user"];
106
122
  }
107
123
  #ifdef RCT_NEW_ARCH_ENABLED
108
- [self emitEventsEmitter:body];
124
+ if (jsEventEmitterReady) {
125
+ [self emitEventsEmitter:body];
126
+ }
109
127
  #else
110
128
  if (hasListeners) {
111
129
  [self sendEventWithName:@"eventsEmitter" body:body];
@@ -115,10 +133,12 @@ RCT_EXPORT_MODULE()
115
133
 
116
134
  - (void)didUpdateLocation:(CLLocation *)location user:(RadarUser *)user {
117
135
  #ifdef RCT_NEW_ARCH_ENABLED
118
- [self emitLocationEmitter:@{
119
- @"location": [Radar dictionaryForLocation:location],
120
- @"user": [user dictionaryValue]
121
- }];
136
+ if (jsEventEmitterReady) {
137
+ [self emitLocationEmitter:@{
138
+ @"location": [Radar dictionaryForLocation:location],
139
+ @"user": [user dictionaryValue]
140
+ }];
141
+ }
122
142
  #else
123
143
  if (hasListeners) {
124
144
  [self sendEventWithName:@"locationEmitter" body:@{
@@ -131,11 +151,13 @@ RCT_EXPORT_MODULE()
131
151
 
132
152
  - (void)didUpdateClientLocation:(CLLocation *)location stopped:(BOOL)stopped source:(RadarLocationSource)source {
133
153
  #ifdef RCT_NEW_ARCH_ENABLED
134
- [self emitClientLocationEmitter:@{
135
- @"location": [Radar dictionaryForLocation:location],
136
- @"stopped": @(stopped),
137
- @"source": [Radar stringForLocationSource:source]
138
- }];
154
+ if (jsEventEmitterReady) {
155
+ [self emitClientLocationEmitter:@{
156
+ @"location": [Radar dictionaryForLocation:location],
157
+ @"stopped": @(stopped),
158
+ @"source": [Radar stringForLocationSource:source]
159
+ }];
160
+ }
139
161
  #else
140
162
  if (hasListeners) {
141
163
  [self sendEventWithName:@"clientLocationEmitter" body:@{
@@ -152,7 +174,9 @@ RCT_EXPORT_MODULE()
152
174
  @"status": [Radar stringForStatus:status]
153
175
  };
154
176
  #ifdef RCT_NEW_ARCH_ENABLED
155
- [self emitErrorEmitter:body];
177
+ if (jsEventEmitterReady) {
178
+ [self emitErrorEmitter:body];
179
+ }
156
180
  #else
157
181
  if (hasListeners) {
158
182
  [self sendEventWithName:@"errorEmitter" body:body];
@@ -165,7 +189,9 @@ RCT_EXPORT_MODULE()
165
189
  @"message": message
166
190
  };
167
191
  #ifdef RCT_NEW_ARCH_ENABLED
168
- [self emitLogEmitter:body];
192
+ if (jsEventEmitterReady) {
193
+ [self emitLogEmitter:body];
194
+ }
169
195
  #else
170
196
  if (hasListeners) {
171
197
  [self sendEventWithName:@"logEmitter" body:body];
@@ -178,7 +204,9 @@ RCT_EXPORT_MODULE()
178
204
  @"token": [token dictionaryValue]
179
205
  };
180
206
  #ifdef RCT_NEW_ARCH_ENABLED
181
- [self emitTokenEmitter:body];
207
+ if (jsEventEmitterReady) {
208
+ [self emitTokenEmitter:body];
209
+ }
182
210
  #else
183
211
  if (hasListeners) {
184
212
  [self sendEventWithName:@"tokenEmitter" body:body];
@@ -189,7 +217,7 @@ RCT_EXPORT_MODULE()
189
217
  RCT_EXPORT_METHOD(initialize:(NSString *)publishableKey fraud:(BOOL)fraud) {
190
218
  _publishableKey = publishableKey;
191
219
  [[NSUserDefaults standardUserDefaults] setObject:@"ReactNative" forKey:@"radar-xPlatformSDKType"];
192
- [[NSUserDefaults standardUserDefaults] setObject:@"3.30.0" forKey:@"radar-xPlatformSDKVersion"];
220
+ [[NSUserDefaults standardUserDefaults] setObject:@"3.31.0" forKey:@"radar-xPlatformSDKVersion"];
193
221
  [Radar initializeWithPublishableKey:publishableKey];
194
222
  }
195
223
 
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "React Native module for Radar, the leading geofencing and location tracking platform",
4
4
  "homepage": "https://radar.com",
5
5
  "license": "Apache-2.0",
6
- "version": "3.30.0",
6
+ "version": "3.31.0",
7
7
  "main": "dist/index.js",
8
8
  "files": [
9
9
  "dist",
package/src/version.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  // This file contains the version of the react-native-radar package
2
2
  // It should be updated to match the version in package.json
3
- export const VERSION = '3.30.0';
3
+ export const VERSION = '3.31.0';