From 9d18fdaec56bd5d9118094ff78367b818b09ed41 Mon Sep 17 00:00:00 2001 From: Dariusz Rybicki <dariusz@elixxir.io> Date: Fri, 19 Aug 2022 18:25:13 +0100 Subject: [PATCH] Add UnregisterForNotifications functor --- .../Functors/UnregisterForNotifications.swift | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 Sources/ElixxirDAppsSDK/Functors/UnregisterForNotifications.swift diff --git a/Sources/ElixxirDAppsSDK/Functors/UnregisterForNotifications.swift b/Sources/ElixxirDAppsSDK/Functors/UnregisterForNotifications.swift new file mode 100644 index 00000000..aa3ce63b --- /dev/null +++ b/Sources/ElixxirDAppsSDK/Functors/UnregisterForNotifications.swift @@ -0,0 +1,29 @@ +import Bindings +import XCTestDynamicOverlay + +public struct UnregisterForNotifications { + public var run: (Int) throws -> Void + + public func callAsFunction( + e2eId: Int + ) throws { + try run(e2eId) + } +} + +extension UnregisterForNotifications { + public static let live = UnregisterForNotifications { e2eId in + var error: NSError? + BindingsUnregisterForNotifications(e2eId, &error) + if let error = error { + throw error + } + } +} + +extension UnregisterForNotifications { + public static let unimplemented = UnregisterForNotifications( + run: XCTUnimplemented("\(Self.self)") + ) +} + -- GitLab