66#import " Countly.h"
77#import " CountlyReactNative.h"
88#import " CountlyConfig.h"
9- #import " CountlyPushNotifications.h"
109#import " CountlyConnectionManager.h"
1110#import " CountlyRemoteConfig.h"
1211#import " CountlyCommon.h"
12+
13+ #ifndef COUNTLY_EXCLUDE_PUSHNOTIFICATIONS
1314#import " CountlyRNPushNotifications.h"
15+ #endif
1416
1517#if DEBUG
1618#define COUNTLY_RN_LOG (fmt, ...) CountlyRNInternalLog(fmt, ##__VA_ARGS__)
@@ -22,7 +24,7 @@ @interface CountlyFeedbackWidget ()
2224+ (CountlyFeedbackWidget *)createWithDictionary : (NSDictionary *)dictionary ;
2325@end
2426
25- NSString * const kCountlyReactNativeSDKVersion = @" 22.06.4 " ;
27+ NSString * const kCountlyReactNativeSDKVersion = @" 22.06.5 " ;
2628NSString * const kCountlyReactNativeSDKName = @" js-rnb-ios" ;
2729
2830CLYPushTestMode const CLYPushTestModeProduction = @" CLYPushTestModeProduction" ;
@@ -57,7 +59,9 @@ - (instancetype)init
5759
5860 }
5961
62+ #ifndef COUNTLY_EXCLUDE_PUSHNOTIFICATIONS
6063 [CountlyRNPushNotifications.sharedInstance setCountlyReactNative: self ];
64+ #endif
6165
6266 return self;
6367}
@@ -89,15 +93,19 @@ - (instancetype)init
8993
9094 CountlyCommon.sharedInstance .SDKName = kCountlyReactNativeSDKName ;
9195 CountlyCommon.sharedInstance .SDKVersion = kCountlyReactNativeSDKVersion ;
96+
97+ #ifndef COUNTLY_EXCLUDE_PUSHNOTIFICATIONS
9298 if (enablePushNotifications) {
9399 [self addCountlyFeature: CLYPushNotifications];
94100 }
95-
101+ # endif
96102 if (serverurl != nil && [serverurl length ] > 0 ) {
97103 dispatch_async (dispatch_get_main_queue (), ^
98104 {
99105 [[Countly sharedInstance ] startWithConfig: config];
106+ #ifndef COUNTLY_EXCLUDE_PUSHNOTIFICATIONS
100107 [CountlyRNPushNotifications.sharedInstance recordPushActions ];
108+ #endif
101109 resolve (@" Success" );
102110 });
103111 }
@@ -194,13 +202,16 @@ - (instancetype)init
194202
195203RCT_EXPORT_METHOD (disablePushNotifications)
196204{
205+ #ifndef COUNTLY_EXCLUDE_PUSHNOTIFICATIONS
197206 dispatch_async (dispatch_get_main_queue (), ^ {
198207 enablePushNotifications = false ;
199208 });
209+ #endif
200210}
201211
202212RCT_EXPORT_METHOD (sendPushToken:(NSArray *)arguments)
203213{
214+ #ifndef COUNTLY_EXCLUDE_PUSHNOTIFICATIONS
204215 dispatch_async (dispatch_get_main_queue (), ^ {
205216
206217 NSString * token = [arguments objectAtIndex: 0 ];
@@ -213,16 +224,17 @@ - (instancetype)init
213224 [request setHTTPMethod: @" GET" ];
214225 [request setURL: [NSURL URLWithString: urlString]];
215226 });
227+ #endif
216228}
217229RCT_EXPORT_METHOD (pushTokenType:(NSArray *)arguments)
218230{
231+ #ifndef COUNTLY_EXCLUDE_PUSHNOTIFICATIONS
219232 dispatch_async (dispatch_get_main_queue (), ^ {
220233 if (config == nil ){
221234 config = CountlyConfig.new ;
222235 }
223236 config.sendPushTokenAlways = YES ;
224237 config.pushTestMode = CLYPushTestModeProduction;
225-
226238 NSString * tokenType = [arguments objectAtIndex: 0 ];
227239 if ([tokenType isEqualToString: @" 1" ]){
228240 config.pushTestMode = CLYPushTestModeDevelopment;
@@ -233,18 +245,24 @@ - (instancetype)init
233245
234246 CountlyPushNotifications.sharedInstance .pushTestMode = config.pushTestMode ;
235247 });
248+ #endif
236249}
237250
238251RCT_EXPORT_METHOD (askForNotificationPermission:(NSArray *)arguments)
239252{
253+ #ifndef COUNTLY_EXCLUDE_PUSHNOTIFICATIONS
240254 [CountlyRNPushNotifications.sharedInstance askForNotificationPermission ];
255+ #endif
241256}
242257RCT_EXPORT_METHOD (registerForNotification:(NSArray *)arguments)
243258{
259+ #ifndef COUNTLY_EXCLUDE_PUSHNOTIFICATIONS
244260 [CountlyRNPushNotifications.sharedInstance registerForNotification ];
261+ #endif
245262
246263};
247264
265+ #ifndef COUNTLY_EXCLUDE_PUSHNOTIFICATIONS
248266- (void )notificationCallback : (NSString *_Nullable)notificationJson {
249267 [self sendEventWithName: pushNotificationCallbackName body: notificationJson];
250268}
@@ -260,6 +278,7 @@ + (void)onNotification:(NSDictionary *_Nullable)notification {
260278+ (void )onNotificationResponse : (UNNotificationResponse * _Nullable)response {
261279 [CountlyRNPushNotifications.sharedInstance onNotificationResponse: response];
262280}
281+ #endif
263282
264283+ (void ) log : (NSString *) theMessage {
265284 if (config.enableDebug == YES ){
0 commit comments