From 10432eb1caefe22f7756c3ff159cf1cd2769d2b0 Mon Sep 17 00:00:00 2001 From: Danmei Chen Date: Tue, 31 Mar 2020 13:59:09 +0200 Subject: [PATCH] try to ensure registered for notification --- Classes/CallManager.swift | 2 +- Classes/LinphoneAppDelegate.m | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Classes/CallManager.swift b/Classes/CallManager.swift index db42576f1..318dbb4ed 100644 --- a/Classes/CallManager.swift +++ b/Classes/CallManager.swift @@ -394,7 +394,7 @@ class CoreManagerDelegate: CoreDelegate { // The call is already answered. CallManager.instance().acceptCall(call: call, hasVideo: video) } - } else if (!CallManager.instance().alreadyRegisteredForNotification) { + } else if (!(CallManager.instance().alreadyRegisteredForNotification && UIApplication.shared.isRegisteredForRemoteNotifications)) { CallManager.instance().displayIncomingCall(call: call, handle: address, hasVideo: video, callId: callId!) } } else if (UIApplication.shared.applicationState != .active) { diff --git a/Classes/LinphoneAppDelegate.m b/Classes/LinphoneAppDelegate.m index 87020f4d6..c6de201be 100644 --- a/Classes/LinphoneAppDelegate.m +++ b/Classes/LinphoneAppDelegate.m @@ -152,7 +152,7 @@ #pragma deploymate push "ignored-api-availability" - (void)registerForNotifications { - if (CallManager.instance.alreadyRegisteredForNotification) + if (CallManager.instance.alreadyRegisteredForNotification && [[UIApplication sharedApplication] isRegisteredForRemoteNotifications]) return; CallManager.instance.alreadyRegisteredForNotification = true;