use alreadyRegisteredForNotification instead of defaultProxyConfig?.pushNotificationAllowed to fix double calls

This commit is contained in:
Danmei Chen 2020-03-30 09:59:38 +02:00
parent 80ede4726b
commit 0ca42b5d18
3 changed files with 5 additions and 5 deletions

View file

@ -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) {

View file

@ -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;

View file

@ -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;