diff --git a/Classes/CoreManager.swift b/Classes/CoreManager.swift index c80c62627..e8b160e2d 100644 --- a/Classes/CoreManager.swift +++ b/Classes/CoreManager.swift @@ -59,8 +59,8 @@ import linphonesw @objc func stopLinphoneCore() { if (lc?.callsNb == 0) { - stopIterateTimer() - lc?.stop() + //stop iterate when core is off + lc?.stopAsync() } } } diff --git a/Classes/LinphoneManager.m b/Classes/LinphoneManager.m index b59584e9b..3fd69d5f5 100644 --- a/Classes/LinphoneManager.m +++ b/Classes/LinphoneManager.m @@ -587,6 +587,9 @@ static void linphone_iphone_global_state_changed(LinphoneCore *lc, LinphoneGloba dictionaryWithObjectsAndKeys:[NSNumber numberWithInt:state], @"state", [NSString stringWithUTF8String:message ? message : ""], @"message", nil]; + if (theLinphoneCore && linphone_core_get_global_state(theLinphoneCore) == LinphoneGlobalOff) { + [CoreManager.instance stopIterateTimer]; + } // dispatch the notification asynchronously dispatch_async(dispatch_get_main_queue(), ^(void) { if (theLinphoneCore && linphone_core_get_global_state(theLinphoneCore) != LinphoneGlobalOff) diff --git a/msgNotificationService/NotificationService.swift b/msgNotificationService/NotificationService.swift index 8f481bbf7..b52a3761c 100644 --- a/msgNotificationService/NotificationService.swift +++ b/msgNotificationService/NotificationService.swift @@ -89,7 +89,7 @@ class NotificationService: UNNotificationServiceExtension { if let message = message { let msgData = parseMessage(message: message) - if let badge = updateBadge() as NSNumber? { + if !message.isUsingUserDefaults, let badge = updateBadge() as NSNumber? { bestAttemptContent.badge = badge }