|
|
|
@ -219,7 +219,7 @@
|
|
|
|
|
// Replace any existing notification
|
|
|
|
|
// e.g. when an "Incoming Call" notification gets replaced with a "Missed Call" notification.
|
|
|
|
|
if (self.currentNotifications[identifier]) {
|
|
|
|
|
[self cancelNotificationWithIdentifier:identifier];
|
|
|
|
|
[self cancelNotificationWithIdentifierMainThread:identifier];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[[UIApplication sharedApplication] scheduleLocalNotification:notification];
|
|
|
|
@ -232,18 +232,24 @@
|
|
|
|
|
- (void)cancelNotificationWithIdentifier:(NSString *)identifier
|
|
|
|
|
{
|
|
|
|
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
|
|
UILocalNotification *notification = self.currentNotifications[identifier];
|
|
|
|
|
if (!notification) {
|
|
|
|
|
DDLogWarn(
|
|
|
|
|
@"%@ Couldn't cancel notification because none was found with identifier: %@", self.tag, identifier);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
[self.currentNotifications removeObjectForKey:identifier];
|
|
|
|
|
|
|
|
|
|
[[UIApplication sharedApplication] cancelLocalNotification:notification];
|
|
|
|
|
[self cancelNotificationWithIdentifierMainThread:identifier];
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (void)cancelNotificationWithIdentifierMainThread:(NSString *)identifier
|
|
|
|
|
{
|
|
|
|
|
OWSAssert([NSThread isMainThread]);
|
|
|
|
|
|
|
|
|
|
UILocalNotification *notification = self.currentNotifications[identifier];
|
|
|
|
|
if (!notification) {
|
|
|
|
|
DDLogWarn(@"%@ Couldn't cancel notification because none was found with identifier: %@", self.tag, identifier);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
[self.currentNotifications removeObjectForKey:identifier];
|
|
|
|
|
|
|
|
|
|
[[UIApplication sharedApplication] cancelLocalNotification:notification];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#pragma mark - Logging
|
|
|
|
|
|
|
|
|
|
+ (NSString *)tag
|
|
|
|
|