From 8ecdb3b544af3245f61ec6a14c83e37fc704ce9f Mon Sep 17 00:00:00 2001 From: Dariusz Rybicki <dariusz@elixxir.io> Date: Thu, 10 Nov 2022 11:23:00 +0100 Subject: [PATCH] Update GetNotificationsReport --- .../Functions/GetNotificationsReport.swift | 36 +++++++++---------- 1 file changed, 16 insertions(+), 20 deletions(-) diff --git a/Sources/XXClient/Functions/GetNotificationsReport.swift b/Sources/XXClient/Functions/GetNotificationsReport.swift index 0b5d31f8..81d54a59 100644 --- a/Sources/XXClient/Functions/GetNotificationsReport.swift +++ b/Sources/XXClient/Functions/GetNotificationsReport.swift @@ -2,35 +2,31 @@ import Bindings import XCTestDynamicOverlay public struct GetNotificationsReport { - public var run: (Int, String, Data) throws -> NotificationReport + public var run: (String, MessageServiceList) throws -> NotificationReport public func callAsFunction( - e2eId: Int, notificationCSV: String, - marshaledServices: Data + services: MessageServiceList ) throws -> NotificationReport { - try run(e2eId, notificationCSV, marshaledServices) + try run(notificationCSV, services) } } extension GetNotificationsReport { - public static func live() -> GetNotificationsReport { - GetNotificationsReport { e2eId, notificationCSV, marshaledServices in - var error: NSError? - let result = BindingsGetNotificationsReport( - e2eId, - notificationCSV, - marshaledServices, - &error - ) - if let error = error { - throw error - } - guard let result = result else { - fatalError("BindingsGetNotificationsReport returned nil without providing error") - } - return try NotificationReport.decode(result) + public static let live = GetNotificationsReport { notificationCSV, services in + var error: NSError? + let result = BindingsGetNotificationsReport( + notificationCSV, + try services.encode(), + &error + ) + if let error = error { + throw error } + guard let result = result else { + fatalError("BindingsGetNotificationsReport returned nil without providing error") + } + return try NotificationReport.decode(result) } } -- GitLab