@@ -21,7 +21,7 @@ @interface CountlyFeedbackWidget ()
2121+ (CountlyFeedbackWidget *)createWithDictionary : (NSDictionary *)dictionary ;
2222@end
2323
24- NSString * const kCountlyReactNativeSDKVersion = @" 20.11.4 " ;
24+ NSString * const kCountlyReactNativeSDKVersion = @" 20.11.5 " ;
2525NSString * const kCountlyReactNativeSDKName = @" js-rnb-ios" ;
2626
2727CountlyConfig* config = nil ;
@@ -44,35 +44,32 @@ @implementation CountlyReactNative
4444 initWithResolver:(RCTPromiseResolveBlock)resolve
4545 rejecter:(RCTPromiseRejectBlock)reject)
4646{
47- NSString * serverurl = [arguments objectAtIndex: 0 ];
48- NSString * appkey = [arguments objectAtIndex: 1 ];
49- NSString * deviceID = [arguments objectAtIndex: 2 ];
50-
51- if (config == nil ){
52- config = CountlyConfig.new ;
53- }
54-
55- if (deviceID != nil && deviceID != (NSString *)[NSNull null ] && ![deviceID isEqual: @" " ]){
56- config.deviceID = deviceID;
57- }
58- config.appKey = appkey;
59- config.host = serverurl;
47+ dispatch_async (dispatch_get_main_queue (), ^ {
48+ NSString * serverurl = [arguments objectAtIndex: 0 ];
49+ NSString * appkey = [arguments objectAtIndex: 1 ];
50+ NSString * deviceID = [arguments objectAtIndex: 2 ];
6051
61- CountlyCommon.sharedInstance .SDKName = kCountlyReactNativeSDKName ;
62- CountlyCommon.sharedInstance .SDKVersion = kCountlyReactNativeSDKVersion ;
63- if (enablePushNotifications) {
64- [self addCountlyFeature: CLYPushNotifications];
65- }
52+ if (config == nil ){
53+ config = CountlyConfig.new ;
54+ }
55+
56+ if (deviceID != nil && deviceID != (NSString *)[NSNull null ] && ![deviceID isEqual: @" " ]){
57+ config.deviceID = deviceID;
58+ }
59+ config.appKey = appkey;
60+ config.host = serverurl;
6661
67- if (serverurl != nil && [serverurl length ] > 0 ) {
68- dispatch_async (dispatch_get_main_queue (), ^
69- {
70- [[Countly sharedInstance ] startWithConfig: config];
71-
72- resolve (@" Success" );
73- });
74- }
62+ CountlyCommon.sharedInstance .SDKName = kCountlyReactNativeSDKName ;
63+ CountlyCommon.sharedInstance .SDKVersion = kCountlyReactNativeSDKVersion ;
64+ if (enablePushNotifications) {
65+ [self addCountlyFeature: CLYPushNotifications];
66+ }
7567
68+ if (serverurl != nil && [serverurl length ] > 0 ) {
69+ [[Countly sharedInstance ] startWithConfig: config];
70+ resolve (@" Success" );
71+ }
72+ });
7673}
7774
7875RCT_EXPORT_METHOD (event:(NSArray *)arguments)
@@ -226,6 +223,7 @@ - (void) saveListener:(Result) result{
226223}
227224RCT_EXPORT_METHOD (registerForNotification:(NSArray *)arguments)
228225{
226+ dispatch_async (dispatch_get_main_queue (), ^ {
229227 [self saveListener: ^(id _Nullable result) {
230228 [self sendEventWithName: @" onCountlyPushNotification" body: [CountlyReactNative toJSON: lastStoredNotification]];
231229 lastStoredNotification = nil ;
@@ -234,6 +232,8 @@ - (void) saveListener:(Result) result{
234232 [self sendEventWithName: @" onCountlyPushNotification" body: [CountlyReactNative toJSON: lastStoredNotification]];
235233 lastStoredNotification = nil ;
236234 }
235+ });
236+
237237};
238238
239239+ (void )onNotification : (NSDictionary *)notificationMessage
0 commit comments