mirror of
https://github.com/vector-im/element-ios.git
synced 2024-09-28 23:32:41 +00:00
Merge pull request #5200 from vector-im/langleyd/5199_fix_failed_first_call_in_closed_app
Fix voip calls after singout/signin
This commit is contained in:
commit
034e253fb1
3 changed files with 20 additions and 8 deletions
|
@ -266,6 +266,15 @@ Matrix session observer used to detect new opened sessions.
|
|||
- (void)configurePushKit
|
||||
{
|
||||
MXLogDebug(@"[PushNotificationService] configurePushKit")
|
||||
NSData* token = [_pushRegistry pushTokenForType:PKPushTypeVoIP];
|
||||
if (token) {
|
||||
// If the token is available, store it. This can happen if you sign out and back in.
|
||||
// i.e We are registered, but we have cleared it from the the store on logout and the
|
||||
// _pushRegistry lives through signin/signout as PushNotificationService is a singleton
|
||||
// on app delegate.
|
||||
_pushNotificationStore.pushKitToken = token;
|
||||
MXLogDebug(@"[PushNotificationService] configurePushKit: Restored pushKit token")
|
||||
}
|
||||
|
||||
_pushRegistry.delegate = self;
|
||||
_pushRegistry.desiredPushTypes = [NSSet setWithObject:PKPushTypeVoIP];
|
||||
|
|
|
@ -66,7 +66,7 @@ class NotificationService: UNNotificationServiceExtension {
|
|||
}()
|
||||
private var pushNotificationStore: PushNotificationStore = PushNotificationStore()
|
||||
private let localAuthenticationService = LocalAuthenticationService(pinCodePreferences: .shared)
|
||||
|
||||
private static let backgroundServiceInitQueue = DispatchQueue(label: "io.element.NotificationService.backgroundServiceInitQueue")
|
||||
// MARK: - Method Overrides
|
||||
|
||||
override func didReceive(_ request: UNNotificationRequest, withContentHandler contentHandler: @escaping (UNNotificationContent) -> Void) {
|
||||
|
@ -169,14 +169,16 @@ class NotificationService: UNNotificationServiceExtension {
|
|||
MXKAccountManager.shared()?.forceReloadAccounts()
|
||||
self.userAccount = MXKAccountManager.shared()?.activeAccounts.first
|
||||
if let userAccount = userAccount {
|
||||
if NotificationService.backgroundSyncService?.credentials != userAccount.mxCredentials {
|
||||
MXLog.debug("[NotificationService] setup: MXBackgroundSyncService init: BEFORE")
|
||||
self.logMemory()
|
||||
NotificationService.backgroundSyncService = MXBackgroundSyncService(withCredentials: userAccount.mxCredentials)
|
||||
MXLog.debug("[NotificationService] setup: MXBackgroundSyncService init: AFTER")
|
||||
self.logMemory()
|
||||
Self.backgroundServiceInitQueue.sync {
|
||||
if NotificationService.backgroundSyncService?.credentials != userAccount.mxCredentials {
|
||||
MXLog.debug("[NotificationService] setup: MXBackgroundSyncService init: BEFORE")
|
||||
self.logMemory()
|
||||
NotificationService.backgroundSyncService = MXBackgroundSyncService(withCredentials: userAccount.mxCredentials)
|
||||
MXLog.debug("[NotificationService] setup: MXBackgroundSyncService init: AFTER")
|
||||
self.logMemory()
|
||||
}
|
||||
completion()
|
||||
}
|
||||
completion()
|
||||
} else {
|
||||
MXLog.debug("[NotificationService] setup: No active accounts")
|
||||
fallbackToBestAttemptContent(forEventId: eventId)
|
||||
|
|
1
changelog.d/5199.bugfix
Normal file
1
changelog.d/5199.bugfix
Normal file
|
@ -0,0 +1 @@
|
|||
Fix bug where VoIP calls would not connect reliably after signout/signin.
|
Loading…
Reference in a new issue