Merge pull request #413 from akshetpandey/fixUIKitBug

UIApplication methods should only be called from the main thread
This commit is contained in:
Michael Diarmid 2017-09-17 18:01:04 +01:00 committed by GitHub
commit 614a61eeb7
2 changed files with 6 additions and 2 deletions

View File

@ -16,7 +16,9 @@ RCT_EXPORT_METHOD(setAnalyticsCollectionEnabled:(BOOL) enabled) {
} }
RCT_EXPORT_METHOD(setCurrentScreen:(NSString *) screenName screenClass:(NSString *) screenClassOverriew) { RCT_EXPORT_METHOD(setCurrentScreen:(NSString *) screenName screenClass:(NSString *) screenClassOverriew) {
dispatch_async(dispatch_get_main_queue(), ^{
[FIRAnalytics setScreenName:screenName screenClass:screenClassOverriew]; [FIRAnalytics setScreenName:screenName screenClass:screenClassOverriew];
});
} }
RCT_EXPORT_METHOD(setUserId: (NSString *) id) { RCT_EXPORT_METHOD(setUserId: (NSString *) id) {

View File

@ -386,7 +386,9 @@ RCT_EXPORT_METHOD(getScheduledLocalNotifications:(RCTPromiseResolveBlock)resolve
} }
RCT_EXPORT_METHOD(setBadgeNumber: (NSInteger*) number) { RCT_EXPORT_METHOD(setBadgeNumber: (NSInteger*) number) {
dispatch_async(dispatch_get_main_queue(), ^{
[RCTSharedApplication() setApplicationIconBadgeNumber:number]; [RCTSharedApplication() setApplicationIconBadgeNumber:number];
}
} }
RCT_EXPORT_METHOD(getBadgeNumber: (RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) { RCT_EXPORT_METHOD(getBadgeNumber: (RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {