Stop call notification repetition when app in foreground

This commit is contained in:
Benjamin Reis 2016-12-01 11:00:36 +01:00
parent 01cb68e80e
commit b310e0976d

View file

@ -616,17 +616,19 @@ static void linphone_iphone_display_status(struct _LinphoneCore *lc, const char
- (void)userNotifContinue:(NSTimer *)timer {
UNNotificationContent *content = [timer userInfo];
if (content) {
LOGI(@"cancelling/presenting user notif");
UNNotificationRequest *req = [UNNotificationRequest requestWithIdentifier:@"call_request" content:content trigger:NULL];
[[UNUserNotificationCenter currentNotificationCenter] addNotificationRequest:req withCompletionHandler:^(NSError * _Nullable error) {
// Enable or disable features based on authorization.
if (error) {
LOGD(@"Error while adding notification request :");
LOGD(error.description);
}
}];
}
if (content && [UIApplication sharedApplication].applicationState == UIApplicationStateBackground) {
LOGI(@"cancelling/presenting user notif");
UNNotificationRequest *req =
[UNNotificationRequest requestWithIdentifier:@"call_request" content:content trigger:NULL];
[[UNUserNotificationCenter currentNotificationCenter] addNotificationRequest:req
withCompletionHandler:^(NSError *_Nullable error) {
// Enable or disable features based on authorization.
if (error) {
LOGD(@"Error while adding notification request :");
LOGD(error.description);
}
}];
}
}