From d6451a06a6a3d5bb87c5707aececc5c2076322c4 Mon Sep 17 00:00:00 2001 From: Ivan Sein Date: Thu, 20 Jul 2023 08:27:05 +0200 Subject: [PATCH] Check if publicKey, deviceIdentifier and signature are received when subscribing for push notifications in NC. Signed-off-by: Ivan Sein --- NextcloudTalk/NCSettingsController.m | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/NextcloudTalk/NCSettingsController.m b/NextcloudTalk/NCSettingsController.m index 19179962b..f51a41c26 100644 --- a/NextcloudTalk/NCSettingsController.m +++ b/NextcloudTalk/NCSettingsController.m @@ -788,6 +788,17 @@ - (void)subscribeForPushNotificationsForAccountId:(NSString *)accountId withComp NSString *deviceIdentifier = [responseDict objectForKey:@"deviceIdentifier"]; NSString *signature = [responseDict objectForKey:@"signature"]; + if (!publicKey || !deviceIdentifier || !signature) { + [NCUtils log:@"Something went wrong subscribing to NC server. Aborting subscribe to Push Notification server."]; + + if (block) { + block(NO); + } + + [bgTask stopBackgroundTask]; + return; + } + RLMRealm *realm = [RLMRealm defaultRealm]; [realm beginWriteTransaction]; NSPredicate *query = [NSPredicate predicateWithFormat:@"accountId = %@", accountId];