Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not call setApplicationIconBadgeNumber on background thread #932

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 7 additions & 11 deletions src/ios/FirebasePlugin.m
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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