@qonversion/react-native-sdk 10.3.1 → 10.3.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/ios/RNNoCodes.mm CHANGED
@@ -5,6 +5,9 @@
5
5
  #import "qonversion_react_native_sdk-Swift.h"
6
6
  #endif
7
7
 
8
+ #define QNR_LOG_EXCEPTION(method, exception) \
9
+ NSLog(@"[Qonversion] Caught NSException in %s: %@ — %@", method, exception.name, exception.reason)
10
+
8
11
  @interface RNNoCodes () <NoCodesEventDelegate, NoCodesPurchaseDelegateProxy>
9
12
 
10
13
  @property (nonatomic, strong) RNNoCodesImpl *impl;
@@ -22,79 +25,135 @@
22
25
  return self;
23
26
  }
24
27
 
28
+ #pragma mark - Void Methods
29
+
25
30
  - (void)initialize:(NSString *)projectKey
26
31
  source:(NSString *)source
27
32
  version:(NSString *)version
28
33
  proxyUrl:(NSString *)proxyUrl
29
34
  locale:(NSString *)locale
30
35
  theme:(NSString *)theme {
31
- [self.impl initializeWithProjectKey:projectKey source:source version:version proxyUrl:proxyUrl locale:locale theme:theme];
36
+ @try {
37
+ [self.impl initializeWithProjectKey:projectKey source:source version:version proxyUrl:proxyUrl locale:locale theme:theme];
38
+ } @catch (NSException *exception) {
39
+ QNR_LOG_EXCEPTION("initialize", exception);
40
+ }
32
41
  }
33
42
 
34
43
  - (void)setScreenPresentationConfig:(NSDictionary *)configData
35
44
  contextKey:(NSString *)contextKey
36
45
  resolve:(RCTPromiseResolveBlock)resolve
37
46
  reject:(RCTPromiseRejectBlock)reject {
38
- [self.impl setScreenPresentationConfig:configData contextKey:contextKey];
47
+ @try {
48
+ [self.impl setScreenPresentationConfig:configData contextKey:contextKey];
49
+ } @catch (NSException *exception) {
50
+ QNR_LOG_EXCEPTION("setScreenPresentationConfig", exception);
51
+ }
39
52
  }
40
53
 
41
54
  - (void)showScreen:(NSString *)contextKey
42
55
  resolve:(RCTPromiseResolveBlock)resolve
43
56
  reject:(RCTPromiseRejectBlock)reject {
44
57
  dispatch_async(dispatch_get_main_queue(), ^{
45
- [self.impl showScreenWithContextKey:contextKey];
58
+ @try {
59
+ [self.impl showScreenWithContextKey:contextKey];
60
+ } @catch (NSException *exception) {
61
+ QNR_LOG_EXCEPTION("showScreen", exception);
62
+ }
46
63
  });
47
64
  }
48
65
 
49
66
  - (void)close:(RCTPromiseResolveBlock)resolve
50
67
  reject:(RCTPromiseRejectBlock)reject {
51
68
  dispatch_async(dispatch_get_main_queue(), ^{
52
- [self.impl close];
69
+ @try {
70
+ [self.impl close];
71
+ } @catch (NSException *exception) {
72
+ QNR_LOG_EXCEPTION("close", exception);
73
+ }
53
74
  });
54
75
  }
55
76
 
56
77
  - (void)setPurchaseDelegate {
57
- [self.impl setPurchaseDelegate:self];
78
+ @try {
79
+ [self.impl setPurchaseDelegate:self];
80
+ } @catch (NSException *exception) {
81
+ QNR_LOG_EXCEPTION("setPurchaseDelegate", exception);
82
+ }
58
83
  }
59
84
 
60
85
  - (void)delegatedPurchaseCompleted {
61
- [self.impl delegatedPurchaseCompleted];
86
+ @try {
87
+ [self.impl delegatedPurchaseCompleted];
88
+ } @catch (NSException *exception) {
89
+ QNR_LOG_EXCEPTION("delegatedPurchaseCompleted", exception);
90
+ }
62
91
  }
63
92
 
64
93
  - (void)delegatedPurchaseFailed:(NSString *)errorMessage {
65
- [self.impl delegatedPurchaseFailed:errorMessage];
94
+ @try {
95
+ [self.impl delegatedPurchaseFailed:errorMessage];
96
+ } @catch (NSException *exception) {
97
+ QNR_LOG_EXCEPTION("delegatedPurchaseFailed", exception);
98
+ }
66
99
  }
67
100
 
68
101
  - (void)delegatedRestoreCompleted {
69
- [self.impl delegatedRestoreCompleted];
102
+ @try {
103
+ [self.impl delegatedRestoreCompleted];
104
+ } @catch (NSException *exception) {
105
+ QNR_LOG_EXCEPTION("delegatedRestoreCompleted", exception);
106
+ }
70
107
  }
71
108
 
72
109
  - (void)delegatedRestoreFailed:(NSString *)errorMessage {
73
- [self.impl delegatedRestoreFailed:errorMessage];
110
+ @try {
111
+ [self.impl delegatedRestoreFailed:errorMessage];
112
+ } @catch (NSException *exception) {
113
+ QNR_LOG_EXCEPTION("delegatedRestoreFailed", exception);
114
+ }
74
115
  }
75
116
 
76
117
  - (void)setLocale:(NSString *)locale {
77
- [self.impl setLocale:locale];
118
+ @try {
119
+ [self.impl setLocale:locale];
120
+ } @catch (NSException *exception) {
121
+ QNR_LOG_EXCEPTION("setLocale", exception);
122
+ }
78
123
  }
79
124
 
80
125
  - (void)setTheme:(NSString *)theme {
81
- [self.impl setTheme:theme];
126
+ @try {
127
+ [self.impl setTheme:theme];
128
+ } @catch (NSException *exception) {
129
+ QNR_LOG_EXCEPTION("setTheme", exception);
130
+ }
82
131
  }
83
132
 
84
- #pragma mark - NoCodesEventDelegate
133
+ #pragma mark - Delegate Callbacks
85
134
 
86
135
  - (void)noCodesDidTriggerWithEvent:(NSString * _Nonnull)event payload:(NSDictionary<NSString *,id> * _Nullable)payload {
87
- [self emitOnNoCodeEvent:@{@"name": event, @"payload": payload ?: [NSNull null]}];
136
+ @try {
137
+ [self emitOnNoCodeEvent:@{@"name": event, @"payload": payload ?: [NSNull null]}];
138
+ } @catch (NSException *exception) {
139
+ QNR_LOG_EXCEPTION("noCodesDidTriggerWithEvent", exception);
140
+ }
88
141
  }
89
142
 
90
- #pragma mark - NoCodesPurchaseDelegateProxy
91
-
92
143
  - (void)purchase:(NSDictionary *)product {
93
- [self emitOnNoCodePurchase:product];
144
+ @try {
145
+ [self emitOnNoCodePurchase:product];
146
+ } @catch (NSException *exception) {
147
+ QNR_LOG_EXCEPTION("purchase (NoCodes delegate)", exception);
148
+ }
94
149
  }
95
150
 
96
151
  - (void)restore {
97
- [self emitOnNoCodeRestore];
152
+ @try {
153
+ [self emitOnNoCodeRestore];
154
+ } @catch (NSException *exception) {
155
+ QNR_LOG_EXCEPTION("restore (NoCodes delegate)", exception);
156
+ }
98
157
  }
99
158
 
100
159
  #pragma mark - TurboModule
@@ -5,6 +5,9 @@
5
5
  #import "qonversion_react_native_sdk-Swift.h"
6
6
  #endif
7
7
 
8
+ #define QNR_LOG_EXCEPTION(method, exception) \
9
+ NSLog(@"[Qonversion] Caught NSException in %s: %@ — %@", method, exception.name, exception.reason)
10
+
8
11
  @interface RNQonversion () <QonversionEventDelegate>
9
12
 
10
13
  @property (nonatomic, strong) RNQonversionImpl *impl;
@@ -22,147 +25,304 @@
22
25
  return self;
23
26
  }
24
27
 
28
+ #pragma mark - Void Methods
29
+
25
30
  - (void)storeSDKInfo:(nonnull NSString *)sdkName sdkVersion:(nonnull NSString *)sdkVersion {
26
- [self.impl storeSDKInfo:sdkName version:sdkVersion];
31
+ @try {
32
+ [self.impl storeSDKInfo:sdkName version:sdkVersion];
33
+ } @catch (NSException *exception) {
34
+ QNR_LOG_EXCEPTION("storeSDKInfo", exception);
35
+ }
27
36
  }
28
37
 
29
38
  - (void)initializeSdk:(nonnull NSString *)projectKey launchMode:(nonnull NSString *)launchModeKey environment:(nonnull NSString *)environmentKey entitlementsCacheLifetime:(nonnull NSString *)cacheLifetimeKey proxyUrl:(NSString * _Nullable)proxyUrl kidsMode:(BOOL)kidsMode {
30
- [self.impl initializeSdk:projectKey launchModeKey:launchModeKey environmentKey:environmentKey cacheLifetimeKey:cacheLifetimeKey proxyUrl:proxyUrl kidsMode:kidsMode];
39
+ @try {
40
+ [self.impl initializeSdk:projectKey launchModeKey:launchModeKey environmentKey:environmentKey cacheLifetimeKey:cacheLifetimeKey proxyUrl:proxyUrl kidsMode:kidsMode];
41
+ } @catch (NSException *exception) {
42
+ QNR_LOG_EXCEPTION("initializeSdk", exception);
43
+ }
31
44
  }
32
45
 
33
46
  - (void)syncHistoricalData {
34
- [self.impl syncHistoricalData];
47
+ @try {
48
+ [self.impl syncHistoricalData];
49
+ } @catch (NSException *exception) {
50
+ QNR_LOG_EXCEPTION("syncHistoricalData", exception);
51
+ }
35
52
  }
36
53
 
37
54
  - (void)syncStoreKit2Purchases {
38
- [self.impl syncStoreKit2Purchases];
55
+ @try {
56
+ [self.impl syncStoreKit2Purchases];
57
+ } @catch (NSException *exception) {
58
+ QNR_LOG_EXCEPTION("syncStoreKit2Purchases", exception);
59
+ }
39
60
  }
40
61
 
41
- - (void)getPromotionalOffer:(nonnull NSString *)productId discount:(NSString * _Nullable)discountId resolve:(nonnull RCTPromiseResolveBlock)resolve reject:(nonnull RCTPromiseRejectBlock)reject {
42
- [self.impl getPromotionalOffer:productId discountId:discountId resolve:resolve reject:reject];
62
+ - (void)setDefinedProperty:(NSString *)property value:(NSString *)value {
63
+ @try {
64
+ [self.impl setDefinedProperty:property value:value];
65
+ } @catch (NSException *exception) {
66
+ QNR_LOG_EXCEPTION("setDefinedProperty", exception);
67
+ }
43
68
  }
44
69
 
45
- - (void)purchase:(nonnull NSString *)productId quantity:(double)quantity contextKeys:(NSArray * _Nullable)contextKeys promoOffer:(JS::NativeQonversionModule::QPromoOfferDetails &)promoOffer offerId:(NSString * _Nullable)offerId applyOffer:(BOOL)applyOffer oldProductId:(NSString * _Nullable)oldProductId updatePolicyKey:(NSString * _Nullable)updatePolicyKey resolve:(nonnull RCTPromiseResolveBlock)resolve reject:(nonnull RCTPromiseRejectBlock)reject {
46
- NSDictionary *promoOfferDict = convertPromoOfferDetailsToDictionary(promoOffer);
47
- [self.impl purchase:productId quantity:quantity contextKeys:contextKeys promoOffer:promoOfferDict resolve:resolve reject:reject];
70
+ - (void)setCustomProperty:(NSString *)property value:(NSString *)value {
71
+ @try {
72
+ [self.impl setCustomProperty:property value:value];
73
+ } @catch (NSException *exception) {
74
+ QNR_LOG_EXCEPTION("setCustomProperty", exception);
75
+ }
48
76
  }
49
77
 
50
- - (void)purchaseWithResult:(nonnull NSString *)productId quantity:(double)quantity contextKeys:(NSArray * _Nullable)contextKeys promoOffer:(JS::NativeQonversionModule::QPromoOfferDetails &)promoOffer offerId:(NSString * _Nullable)offerId applyOffer:(BOOL)applyOffer oldProductId:(NSString * _Nullable)oldProductId updatePolicyKey:(NSString * _Nullable)updatePolicyKey resolve:(nonnull RCTPromiseResolveBlock)resolve reject:(nonnull RCTPromiseRejectBlock)reject {
51
- NSDictionary *promoOfferDict = convertPromoOfferDetailsToDictionary(promoOffer);
52
- [self.impl purchaseWithResult:productId quantity:quantity contextKeys:contextKeys promoOffer:promoOfferDict resolve:resolve reject:reject];
78
+ - (void)addAttributionData:(NSDictionary *)data provider:(NSString *)provider {
79
+ @try {
80
+ [self.impl addAttributionData:data provider:provider];
81
+ } @catch (NSException *exception) {
82
+ QNR_LOG_EXCEPTION("addAttributionData", exception);
83
+ }
53
84
  }
54
85
 
55
- - (void)setDefinedProperty:(NSString *)property value:(NSString *)value {
56
- [self.impl setDefinedProperty:property value:value];
86
+ - (void)logout {
87
+ @try {
88
+ [self.impl logout];
89
+ } @catch (NSException *exception) {
90
+ QNR_LOG_EXCEPTION("logout", exception);
91
+ }
57
92
  }
58
93
 
59
- - (void)setCustomProperty:(NSString *)property value:(NSString *)value {
60
- [self.impl setCustomProperty:property value:value];
94
+ - (void)collectAdvertisingId {
95
+ @try {
96
+ [self.impl collectAdvertisingId];
97
+ } @catch (NSException *exception) {
98
+ QNR_LOG_EXCEPTION("collectAdvertisingId", exception);
99
+ }
61
100
  }
62
101
 
63
- - (void)userProperties:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject {
64
- [self.impl userProperties:resolve reject:reject];
102
+ - (void)collectAppleSearchAdsAttribution {
103
+ @try {
104
+ [self.impl collectAppleSearchAdsAttribution];
105
+ } @catch (NSException *exception) {
106
+ QNR_LOG_EXCEPTION("collectAppleSearchAdsAttribution", exception);
107
+ }
65
108
  }
66
109
 
67
- - (void)addAttributionData:(NSDictionary *)data provider:(NSString *)provider {
68
- [self.impl addAttributionData:data provider:provider];
110
+ - (void)presentCodeRedemptionSheet {
111
+ @try {
112
+ [self.impl presentCodeRedemptionSheet];
113
+ } @catch (NSException *exception) {
114
+ QNR_LOG_EXCEPTION("presentCodeRedemptionSheet", exception);
115
+ }
116
+ }
117
+
118
+ - (void)syncPurchases {
119
+ // Android only.
120
+ }
121
+
122
+ #pragma mark - Promise Methods
123
+
124
+ - (void)getPromotionalOffer:(nonnull NSString *)productId discount:(NSString * _Nullable)discountId resolve:(nonnull RCTPromiseResolveBlock)resolve reject:(nonnull RCTPromiseRejectBlock)reject {
125
+ @try {
126
+ [self.impl getPromotionalOffer:productId discountId:discountId resolve:resolve reject:reject];
127
+ } @catch (NSException *exception) {
128
+ QNR_LOG_EXCEPTION("getPromotionalOffer", exception);
129
+ reject(@"QONBridgeException", exception.reason, nil);
130
+ }
131
+ }
132
+
133
+ - (void)purchase:(nonnull NSString *)productId quantity:(double)quantity contextKeys:(NSArray * _Nullable)contextKeys promoOffer:(JS::NativeQonversionModule::QPromoOfferDetails &)promoOffer offerId:(NSString * _Nullable)offerId applyOffer:(BOOL)applyOffer oldProductId:(NSString * _Nullable)oldProductId updatePolicyKey:(NSString * _Nullable)updatePolicyKey resolve:(nonnull RCTPromiseResolveBlock)resolve reject:(nonnull RCTPromiseRejectBlock)reject {
134
+ @try {
135
+ NSDictionary *promoOfferDict = convertPromoOfferDetailsToDictionary(promoOffer);
136
+ [self.impl purchase:productId quantity:quantity contextKeys:contextKeys promoOffer:promoOfferDict resolve:resolve reject:reject];
137
+ } @catch (NSException *exception) {
138
+ QNR_LOG_EXCEPTION("purchase", exception);
139
+ reject(@"QONBridgeException", exception.reason, nil);
140
+ }
141
+ }
142
+
143
+ - (void)purchaseWithResult:(nonnull NSString *)productId quantity:(double)quantity contextKeys:(NSArray * _Nullable)contextKeys promoOffer:(JS::NativeQonversionModule::QPromoOfferDetails &)promoOffer offerId:(NSString * _Nullable)offerId applyOffer:(BOOL)applyOffer oldProductId:(NSString * _Nullable)oldProductId updatePolicyKey:(NSString * _Nullable)updatePolicyKey resolve:(nonnull RCTPromiseResolveBlock)resolve reject:(nonnull RCTPromiseRejectBlock)reject {
144
+ @try {
145
+ NSDictionary *promoOfferDict = convertPromoOfferDetailsToDictionary(promoOffer);
146
+ [self.impl purchaseWithResult:productId quantity:quantity contextKeys:contextKeys promoOffer:promoOfferDict resolve:resolve reject:reject];
147
+ } @catch (NSException *exception) {
148
+ QNR_LOG_EXCEPTION("purchaseWithResult", exception);
149
+ reject(@"QONBridgeException", exception.reason, nil);
150
+ }
151
+ }
152
+
153
+ - (void)userProperties:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject {
154
+ @try {
155
+ [self.impl userProperties:resolve reject:reject];
156
+ } @catch (NSException *exception) {
157
+ QNR_LOG_EXCEPTION("userProperties", exception);
158
+ reject(@"QONBridgeException", exception.reason, nil);
159
+ }
69
160
  }
70
161
 
71
162
  - (void)checkEntitlements:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject {
72
- [self.impl checkEntitlements:resolve reject:reject];
163
+ @try {
164
+ [self.impl checkEntitlements:resolve reject:reject];
165
+ } @catch (NSException *exception) {
166
+ QNR_LOG_EXCEPTION("checkEntitlements", exception);
167
+ reject(@"QONBridgeException", exception.reason, nil);
168
+ }
73
169
  }
74
170
 
75
171
  - (void)products:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject {
76
- [self.impl products:resolve reject:reject];
172
+ @try {
173
+ [self.impl products:resolve reject:reject];
174
+ } @catch (NSException *exception) {
175
+ QNR_LOG_EXCEPTION("products", exception);
176
+ reject(@"QONBridgeException", exception.reason, nil);
177
+ }
77
178
  }
78
179
 
79
180
  - (void)offerings:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject {
80
- [self.impl offerings:resolve reject:reject];
181
+ @try {
182
+ [self.impl offerings:resolve reject:reject];
183
+ } @catch (NSException *exception) {
184
+ QNR_LOG_EXCEPTION("offerings", exception);
185
+ reject(@"QONBridgeException", exception.reason, nil);
186
+ }
81
187
  }
82
188
 
83
189
  - (void)checkTrialIntroEligibilityForProductIds:(NSArray *)data resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject {
84
- [self.impl checkTrialIntroEligibilityForProductIds:data resolve:resolve reject:reject];
190
+ @try {
191
+ [self.impl checkTrialIntroEligibilityForProductIds:data resolve:resolve reject:reject];
192
+ } @catch (NSException *exception) {
193
+ QNR_LOG_EXCEPTION("checkTrialIntroEligibility", exception);
194
+ reject(@"QONBridgeException", exception.reason, nil);
195
+ }
85
196
  }
86
197
 
87
198
  - (void)restore:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject {
88
- [self.impl restore:resolve reject:reject];
199
+ @try {
200
+ [self.impl restore:resolve reject:reject];
201
+ } @catch (NSException *exception) {
202
+ QNR_LOG_EXCEPTION("restore", exception);
203
+ reject(@"QONBridgeException", exception.reason, nil);
204
+ }
89
205
  }
90
206
 
91
207
  - (void)identify:(NSString *)userId resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject {
92
- [self.impl identify:userId resolve:resolve reject:reject];
93
- }
94
-
95
- - (void)logout {
96
- [self.impl logout];
208
+ @try {
209
+ [self.impl identify:userId resolve:resolve reject:reject];
210
+ } @catch (NSException *exception) {
211
+ QNR_LOG_EXCEPTION("identify", exception);
212
+ reject(@"QONBridgeException", exception.reason, nil);
213
+ }
97
214
  }
98
215
 
99
216
  - (void)userInfo:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject {
100
- [self.impl userInfo:resolve reject:reject];
217
+ @try {
218
+ [self.impl userInfo:resolve reject:reject];
219
+ } @catch (NSException *exception) {
220
+ QNR_LOG_EXCEPTION("userInfo", exception);
221
+ reject(@"QONBridgeException", exception.reason, nil);
222
+ }
101
223
  }
102
224
 
103
225
  - (void)remoteConfig:(NSString * _Nullable)contextKey resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject {
104
- [self.impl remoteConfig:contextKey resolve:resolve reject:reject];
226
+ @try {
227
+ [self.impl remoteConfig:contextKey resolve:resolve reject:reject];
228
+ } @catch (NSException *exception) {
229
+ QNR_LOG_EXCEPTION("remoteConfig", exception);
230
+ reject(@"QONBridgeException", exception.reason, nil);
231
+ }
105
232
  }
106
233
 
107
234
  - (void)remoteConfigList:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject {
108
- [self.impl remoteConfigList:resolve reject:reject];
235
+ @try {
236
+ [self.impl remoteConfigList:resolve reject:reject];
237
+ } @catch (NSException *exception) {
238
+ QNR_LOG_EXCEPTION("remoteConfigList", exception);
239
+ reject(@"QONBridgeException", exception.reason, nil);
240
+ }
109
241
  }
110
242
 
111
243
  - (void)remoteConfigListForContextKeys:(NSArray<NSString *> *)contextKeys includeEmptyContextKey:(BOOL)includeEmptyContextKey resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject {
112
- [self.impl remoteConfigListForContextKeys:contextKeys includeEmptyContextKey:includeEmptyContextKey resolve:resolve reject:reject];
244
+ @try {
245
+ [self.impl remoteConfigListForContextKeys:contextKeys includeEmptyContextKey:includeEmptyContextKey resolve:resolve reject:reject];
246
+ } @catch (NSException *exception) {
247
+ QNR_LOG_EXCEPTION("remoteConfigListForContextKeys", exception);
248
+ reject(@"QONBridgeException", exception.reason, nil);
249
+ }
113
250
  }
114
251
 
115
252
  - (void)attachUserToExperiment:(NSString *)experimentId groupId:(NSString *)groupId resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject {
116
- [self.impl attachUserToExperiment:experimentId groupId:groupId resolve:resolve reject:reject];
253
+ @try {
254
+ [self.impl attachUserToExperiment:experimentId groupId:groupId resolve:resolve reject:reject];
255
+ } @catch (NSException *exception) {
256
+ QNR_LOG_EXCEPTION("attachUserToExperiment", exception);
257
+ reject(@"QONBridgeException", exception.reason, nil);
258
+ }
117
259
  }
118
260
 
119
261
  - (void)detachUserFromExperiment:(NSString *)experimentId resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject {
120
- [self.impl detachUserFromExperiment:experimentId resolve:resolve reject:reject];
262
+ @try {
263
+ [self.impl detachUserFromExperiment:experimentId resolve:resolve reject:reject];
264
+ } @catch (NSException *exception) {
265
+ QNR_LOG_EXCEPTION("detachUserFromExperiment", exception);
266
+ reject(@"QONBridgeException", exception.reason, nil);
267
+ }
121
268
  }
122
269
 
123
270
  - (void)attachUserToRemoteConfiguration:(NSString *)remoteConfigurationId resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject {
124
- [self.impl attachUserToRemoteConfiguration:remoteConfigurationId resolve:resolve reject:reject];
271
+ @try {
272
+ [self.impl attachUserToRemoteConfiguration:remoteConfigurationId resolve:resolve reject:reject];
273
+ } @catch (NSException *exception) {
274
+ QNR_LOG_EXCEPTION("attachUserToRemoteConfiguration", exception);
275
+ reject(@"QONBridgeException", exception.reason, nil);
276
+ }
125
277
  }
126
278
 
127
279
  - (void)detachUserFromRemoteConfiguration:(NSString *)remoteConfigurationId resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject {
128
- [self.impl detachUserFromRemoteConfiguration:remoteConfigurationId resolve:resolve reject:reject];
280
+ @try {
281
+ [self.impl detachUserFromRemoteConfiguration:remoteConfigurationId resolve:resolve reject:reject];
282
+ } @catch (NSException *exception) {
283
+ QNR_LOG_EXCEPTION("detachUserFromRemoteConfiguration", exception);
284
+ reject(@"QONBridgeException", exception.reason, nil);
285
+ }
129
286
  }
130
287
 
131
288
  - (void)isFallbackFileAccessible:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject {
132
- [self.impl isFallbackFileAccessible:resolve reject:reject];
133
- }
134
-
135
- - (void)collectAdvertisingId {
136
- [self.impl collectAdvertisingId];
137
- }
138
-
139
- - (void)collectAppleSearchAdsAttribution {
140
- [self.impl collectAppleSearchAdsAttribution];
289
+ @try {
290
+ [self.impl isFallbackFileAccessible:resolve reject:reject];
291
+ } @catch (NSException *exception) {
292
+ QNR_LOG_EXCEPTION("isFallbackFileAccessible", exception);
293
+ reject(@"QONBridgeException", exception.reason, nil);
294
+ }
141
295
  }
142
296
 
143
297
  - (void)promoPurchase:(NSString *)storeProductId resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject {
144
- [self.impl promoPurchase:storeProductId resolve:resolve reject:reject];
145
- }
146
-
147
- - (void)presentCodeRedemptionSheet {
148
- [self.impl presentCodeRedemptionSheet];
149
- }
150
-
151
- - (void)syncPurchases {
152
- // Android only.
298
+ @try {
299
+ [self.impl promoPurchase:storeProductId resolve:resolve reject:reject];
300
+ } @catch (NSException *exception) {
301
+ QNR_LOG_EXCEPTION("promoPurchase", exception);
302
+ reject(@"QONBridgeException", exception.reason, nil);
303
+ }
153
304
  }
154
305
 
155
306
  - (void)updatePurchase:(nonnull NSString *)productId offerId:(NSString * _Nullable)offerId applyOffer:(BOOL)applyOffer oldProductId:(NSString * _Nullable)oldProductId updatePolicyKey:(NSString * _Nullable)updatePolicyKey resolve:(nonnull RCTPromiseResolveBlock)resolve reject:(nonnull RCTPromiseRejectBlock)reject {
156
307
  // Android only
157
308
  }
158
309
 
310
+ #pragma mark - Delegate Callbacks
159
311
 
160
- - (void)qonversionDidReceiveUpdatedEntitlements:(NSDictionary<NSString *,id> * _Nonnull)entitlements {
161
- [self emitOnEntitlementsUpdated:entitlements];
312
+ - (void)qonversionDidReceiveUpdatedEntitlements:(NSDictionary<NSString *,id> * _Nonnull)entitlements {
313
+ @try {
314
+ [self emitOnEntitlementsUpdated:entitlements];
315
+ } @catch (NSException *exception) {
316
+ QNR_LOG_EXCEPTION("qonversionDidReceiveUpdatedEntitlements", exception);
317
+ }
162
318
  }
163
319
 
164
- - (void)shouldPurchasePromoProductWith:(NSString * _Nonnull)productId {
165
- [self emitOnPromoPurchaseReceived:productId];
320
+ - (void)shouldPurchasePromoProductWith:(NSString * _Nonnull)productId {
321
+ @try {
322
+ [self emitOnPromoPurchaseReceived:productId];
323
+ } @catch (NSException *exception) {
324
+ QNR_LOG_EXCEPTION("shouldPurchasePromoProductWith", exception);
325
+ }
166
326
  }
167
327
 
168
328
  #pragma mark - Private
@@ -5,7 +5,7 @@ import Mapper from "./Mapper.js";
5
5
  import { isAndroid, isIos } from "./utils.js";
6
6
  import PurchaseOptionsBuilder from "../dto/PurchaseOptionsBuilder.js";
7
7
  import RNQonversion from "./specs/NativeQonversionModule.js";
8
- export const sdkVersion = "10.3.1";
8
+ export const sdkVersion = "10.3.2";
9
9
  export const sdkSource = "rn";
10
10
  export default class QonversionInternal {
11
11
  entitlementsUpdateListener = null;
@@ -17,7 +17,7 @@ import PurchaseModel from '../dto/PurchaseModel';
17
17
  import PurchaseUpdateModel from '../dto/PurchaseUpdateModel';
18
18
  import { RemoteConfigList } from '../index';
19
19
  import PromotionalOffer from '../dto/PromotionalOffer';
20
- export declare const sdkVersion = "10.3.1";
20
+ export declare const sdkVersion = "10.3.2";
21
21
  export declare const sdkSource = "rn";
22
22
  export default class QonversionInternal implements QonversionApi {
23
23
  private entitlementsUpdateListener;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@qonversion/react-native-sdk",
3
3
  "title": "React Native Qonversion",
4
- "version": "10.3.1",
4
+ "version": "10.3.2",
5
5
  "description": "Qonversion provides full in-app purchases infrastructure, so you do not need to build your own server for receipt validation. Implement in-app subscriptions, validate user receipts, check subscription status, and provide access to your app features and content using our StoreKit wrapper and Google Play Billing wrapper.",
6
6
  "main": "./lib/module/index.js",
7
7
  "types": "./lib/typescript/src/index.d.ts",
@@ -24,7 +24,7 @@ import PromotionalOffer from '../dto/PromotionalOffer';
24
24
  import RNQonversion from './specs/NativeQonversionModule';
25
25
  import type { QPromoOfferDetails } from './specs/NativeQonversionModule';
26
26
 
27
- export const sdkVersion = "10.3.1";
27
+ export const sdkVersion = "10.3.2";
28
28
  export const sdkSource = "rn";
29
29
 
30
30
  export default class QonversionInternal implements QonversionApi {