diff --git a/Classes/CallManager.swift b/Classes/CallManager.swift index ca48356a5..db42576f1 100644 --- a/Classes/CallManager.swift +++ b/Classes/CallManager.swift @@ -43,6 +43,7 @@ import AVFoundation @objc var speakerEnabled : Bool = false @objc var bluetoothEnabled : Bool = false @objc var nextCallIsTransfer: Bool = false + @objc var alreadyRegisteredForNotification: Bool = false fileprivate override init() { @@ -393,7 +394,7 @@ class CoreManagerDelegate: CoreDelegate { // The call is already answered. CallManager.instance().acceptCall(call: call, hasVideo: video) } - } else if (!(lc.defaultProxyConfig?.pushNotificationAllowed ?? false)) { + } else if (!CallManager.instance().alreadyRegisteredForNotification) { CallManager.instance().displayIncomingCall(call: call, handle: address, hasVideo: video, callId: callId!) } } else if (UIApplication.shared.applicationState != .active) { diff --git a/Classes/LinphoneAppDelegate.h b/Classes/LinphoneAppDelegate.h index 9728720cd..d199fe98d 100644 --- a/Classes/LinphoneAppDelegate.h +++ b/Classes/LinphoneAppDelegate.h @@ -40,7 +40,6 @@ @property (nonatomic, retain) NSString *configURL; @property (nonatomic, strong) UIWindow* window; @property PKPushRegistry* voipRegistry; -@property BOOL alreadyRegisteredForNotification; @property BOOL onlyPortrait; @property UIApplicationShortcutItem *shortcutItem; diff --git a/Classes/LinphoneAppDelegate.m b/Classes/LinphoneAppDelegate.m index b7c7a8bc7..600f0e0b6 100644 --- a/Classes/LinphoneAppDelegate.m +++ b/Classes/LinphoneAppDelegate.m @@ -47,7 +47,7 @@ if (self != nil) { startedInBackground = FALSE; } - _alreadyRegisteredForNotification = false; + CallManager.instance.alreadyRegisteredForNotification = false; _onlyPortrait = FALSE; return self; [[UIApplication sharedApplication] setDelegate:self]; @@ -152,10 +152,10 @@ #pragma deploymate push "ignored-api-availability" - (void)registerForNotifications { - if (_alreadyRegisteredForNotification) + if (CallManager.instance.alreadyRegisteredForNotification) return; - _alreadyRegisteredForNotification = true; + CallManager.instance.alreadyRegisteredForNotification = true; self.voipRegistry = [[PKPushRegistry alloc] initWithQueue:dispatch_get_main_queue()]; self.voipRegistry.delegate = self;