From e88a7ed453a83b0e3050b401ab416af6d0fe5945 Mon Sep 17 00:00:00 2001 From: Morgan Pretty Date: Thu, 30 Jan 2025 16:49:26 +1100 Subject: [PATCH] Allow notifications from non-default namespaces, handle empty data --- .../Notifications/PushNotificationAPI.swift | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/SessionMessagingKit/Sending & Receiving/Notifications/PushNotificationAPI.swift b/SessionMessagingKit/Sending & Receiving/Notifications/PushNotificationAPI.swift index e476b9a5e..86ad23fe6 100644 --- a/SessionMessagingKit/Sending & Receiving/Notifications/PushNotificationAPI.swift +++ b/SessionMessagingKit/Sending & Receiving/Notifications/PushNotificationAPI.swift @@ -440,17 +440,11 @@ public enum PushNotificationAPI { return (nil, notification.info, .successTooLong) } - // Only show notifcations for messages from default namespace - // TODO: Add group messages namespace - guard notification.info.namespace == .default else { - SNLog("Ignoring notification due to namespace being \(notification.info.namespace) instead of default") - return (nil, notification.info, .failureNoContent) - } - - // Check that the body we were given is valid + // Check that the body we were given is valid and not empty guard let notificationData: Data = notification.data, - notification.info.dataLength == notificationData.count + notification.info.dataLength == notificationData.count, + !notificationData.isEmpty else { SNLog("Get notification data failed") return (nil, notification.info, .failureNoContent)