SDK Bump to 1.0.80 and push notifications filtering (#1131)

* filtering nil notifications

* updated the sdk
This commit is contained in:
Mauro
2023-06-22 13:24:37 +02:00
committed by GitHub
parent 8b11a0a5ec
commit 8e8bb7a3e7
8 changed files with 23 additions and 13 deletions
@@ -72,7 +72,10 @@ class NotificationServiceExtension: UNNotificationServiceExtension {
do {
let userSession = try NSEUserSession(credentials: credentials)
let itemProxy = try await userSession.notificationItemProxy(roomID: roomId, eventID: eventId)
guard let itemProxy = try await userSession.notificationItemProxy(roomID: roomId, eventID: eventId) else {
MXLog.info("\(tag) no notification for this event")
return discard()
}
// After the first processing, update the modified content
modifiedContent = try await itemProxy.process(mediaProvider: nil)
+4 -2
View File
@@ -32,11 +32,13 @@ final class NSEUserSession {
try client.restoreSession(session: credentials.restorationToken.session)
}
func notificationItemProxy(roomID: String, eventID: String) async throws -> NotificationItemProxyProtocol {
func notificationItemProxy(roomID: String, eventID: String) async throws -> NotificationItemProxyProtocol? {
let userID = try client.userId()
return await Task.dispatch(on: .global()) {
do {
let notification = try self.client.getNotificationItem(roomId: roomID, eventId: eventID)
guard let notification = try self.client.getNotificationItem(roomId: roomID, eventId: eventID) else {
return nil
}
return NotificationItemProxy(notificationItem: notification, receiverID: userID)
} catch {
MXLog.error("NSE: Could not get notification's content creating an empty notification instead, error: \(error)")