From 9c5b5d5a0d0abde7c7439325f5b7aa2d1dc494a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20Bo=CC=88hlmark?= Date: Wed, 31 Oct 2018 16:46:28 +0100 Subject: [PATCH] Do not call setApplicationIconBadgeNumber on background thread. Fixes #931 --- src/ios/FirebasePlugin.m | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/src/ios/FirebasePlugin.m b/src/ios/FirebasePlugin.m index df0c79167..069317e1e 100644 --- a/src/ios/FirebasePlugin.m +++ b/src/ios/FirebasePlugin.m @@ -172,12 +172,10 @@ - (void)getVerificationID:(CDVInvokedUrlCommand *)command { - (void)setBadgeNumber:(CDVInvokedUrlCommand *)command { int number = [[command.arguments objectAtIndex:0] intValue]; - [self.commandDelegate runInBackground:^{ - [[UIApplication sharedApplication] setApplicationIconBadgeNumber:number]; + [[UIApplication sharedApplication] setApplicationIconBadgeNumber:number]; - CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK]; - [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId]; - }]; + CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK]; + [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId]; } - (void)getBadgeNumber:(CDVInvokedUrlCommand *)command { @@ -473,12 +471,10 @@ - (void)setPerformanceCollectionEnabled:(CDVInvokedUrlCommand *)command { } - (void)clearAllNotifications:(CDVInvokedUrlCommand *)command { - [self.commandDelegate runInBackground:^{ - [[UIApplication sharedApplication] setApplicationIconBadgeNumber:1]; - [[UIApplication sharedApplication] setApplicationIconBadgeNumber:0]; + [[UIApplication sharedApplication] setApplicationIconBadgeNumber:1]; + [[UIApplication sharedApplication] setApplicationIconBadgeNumber:0]; - CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK]; - [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId]; - }]; + CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK]; + [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId]; } @end