diff --git a/NextcloudTalk/NCKeyChainController.h b/NextcloudTalk/NCKeyChainController.h index ba6af552e..c221272cc 100644 --- a/NextcloudTalk/NCKeyChainController.h +++ b/NextcloudTalk/NCKeyChainController.h @@ -40,6 +40,7 @@ extern NSString * const kNCPushKitTokenKey; - (void)setPushNotificationPrivateKey:(NSData *)privateKey forAccountId:(NSString *)accountId; - (NSData *)pushNotificationPrivateKeyForAccountId:(NSString *)accountId; - (NSString *)pushTokenSHA512; +- (void)logCombinedPushToken; - (NSString *)combinedPushToken; - (void)removeAllItems; diff --git a/NextcloudTalk/NCKeyChainController.m b/NextcloudTalk/NCKeyChainController.m index b7b171979..35203d571 100644 --- a/NextcloudTalk/NCKeyChainController.m +++ b/NextcloudTalk/NCKeyChainController.m @@ -96,6 +96,24 @@ - (NSString *)pushTokenSHA512 return [self createSHA512:token]; } +- (void)logCombinedPushToken +{ + NSString *normalPushToken = [_keychain stringForKey:kNCNormalPushTokenKey]; + NSString *pushKitToken = [_keychain stringForKey:kNCPushKitTokenKey]; + + if (normalPushToken && [normalPushToken length] >= 10) { + [NCUtils log:[NSString stringWithFormat:@"Push notification, normal push token: %@... length %ld", [normalPushToken substringToIndex:10], [normalPushToken length]]]; + } else { + [NCUtils log:@"Push notification, normal push token length < 10"]; + } + + if (pushKitToken && [pushKitToken length] >= 10) { + [NCUtils log:[NSString stringWithFormat:@"Push notification, pushKit token: %@... length %ld", [pushKitToken substringToIndex:10], [pushKitToken length]]]; + } else { + [NCUtils log:@"Push notification, pushKit token length < 10"]; + } +} + - (NSString *)combinedPushToken { NSString *normalPushToken = [_keychain stringForKey:kNCNormalPushTokenKey]; diff --git a/NextcloudTalk/NCSettingsController.m b/NextcloudTalk/NCSettingsController.m index 0abe3b807..00aa2e082 100644 --- a/NextcloudTalk/NCSettingsController.m +++ b/NextcloudTalk/NCSettingsController.m @@ -753,6 +753,10 @@ - (void)subscribeForPushNotificationsForAccountId:(NSString *)accountId withComp [bgTask stopBackgroundTask]; } else { [NCUtils log:[NSString stringWithFormat:@"Error while subscribing to Push Notification server. Error: %@", error.description]]; + [NCUtils log:[NSString stringWithFormat:@"Push notification, public key: %@", publicKey]]; + [NCUtils log:[NSString stringWithFormat:@"Push notification, device signature: %@", signature]]; + [NCUtils log:[NSString stringWithFormat:@"Push notification, device identifier: %@", deviceIdentifier]]; + [[NCKeyChainController sharedInstance] logCombinedPushToken]; if (block) { block(NO);