Restore the pushkit token after login/logout when configuring PushKit

This commit is contained in:
David Langley
2021-11-26 12:52:40 +00:00
parent 37b6dc7e80
commit 907a61765f

View File

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