fix a case where the received notification payload is not valid either for legacy or current PN protocol

pull/1061/head
Ryan ZHAO 3 months ago
parent 07e75d0cca
commit 8c02b7ac08

@ -441,6 +441,7 @@ public enum PushNotificationAPI {
}
// 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)

@ -76,7 +76,7 @@ public final class NotificationServiceExtension: UNNotificationServiceExtension
switch result {
// If we got an explicit failure, or we got a success but no content then show
// the fallback notification
case .success, .legacySuccess, .failure, .legacyFailure:
case .success, .legacySuccess, .failure:
return self.handleFailure(for: notificationContent, error: .processing(result))
// Just log if the notification was too long (a ~2k message should be able to fit so
@ -92,6 +92,10 @@ public final class NotificationServiceExtension: UNNotificationServiceExtension
case .failureNoContent:
Log.warn("Failed due to missing notification content.")
return self.completeSilenty(handledNotification: false)
case .legacyFailure:
Log.warn("Received a notification without a valid payload.")
return self.completeSilenty(handledNotification: false)
}
}

Loading…
Cancel
Save