From bdfb583f004772cedb3ed8ef581f81a5fcd1c657 Mon Sep 17 00:00:00 2001 From: Dariusz Rybicki <dariusz@elixxir.io> Date: Thu, 21 Jul 2022 17:59:33 +0100 Subject: [PATCH] Add CmixMakeLegacyReceptionIdentity functor --- Sources/ElixxirDAppsSDK/Cmix.swift | 3 +++ .../CmixMakeLegacyReceptionIdentity.swift | 22 +++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 Sources/ElixxirDAppsSDK/CmixMakeLegacyReceptionIdentity.swift diff --git a/Sources/ElixxirDAppsSDK/Cmix.swift b/Sources/ElixxirDAppsSDK/Cmix.swift index 5c5d9e34..c9518d30 100644 --- a/Sources/ElixxirDAppsSDK/Cmix.swift +++ b/Sources/ElixxirDAppsSDK/Cmix.swift @@ -3,6 +3,7 @@ import Bindings public struct Cmix { public var getId: CmixGetId public var makeReceptionIdentity: CmixMakeReceptionIdentity + public var makeLegacyReceptionIdentity: CmixMakeLegacyReceptionIdentity public var isHealthy: CmixIsHealthy public var hasRunningProcesses: CmixHasRunningProcesses public var networkFollowerStatus: CmixNetworkFollowerStatus @@ -15,6 +16,7 @@ extension Cmix { Cmix( getId: .live(bindingsCmix), makeReceptionIdentity: .live(bindingsCmix), + makeLegacyReceptionIdentity: .live(bindingsCmix), isHealthy: .live(bindingsCmix), hasRunningProcesses: .live(bindingsCmix), networkFollowerStatus: .live(bindingsCmix), @@ -28,6 +30,7 @@ extension Cmix { public static let unimplemented = Cmix( getId: .unimplemented, makeReceptionIdentity: .unimplemented, + makeLegacyReceptionIdentity: .unimplemented, isHealthy: .unimplemented, hasRunningProcesses: .unimplemented, networkFollowerStatus: .unimplemented, diff --git a/Sources/ElixxirDAppsSDK/CmixMakeLegacyReceptionIdentity.swift b/Sources/ElixxirDAppsSDK/CmixMakeLegacyReceptionIdentity.swift new file mode 100644 index 00000000..2f461616 --- /dev/null +++ b/Sources/ElixxirDAppsSDK/CmixMakeLegacyReceptionIdentity.swift @@ -0,0 +1,22 @@ +import Bindings +import XCTestDynamicOverlay + +public struct CmixMakeLegacyReceptionIdentity { + public var run: () throws -> Data + + public func callAsFunction() throws -> Data { + try run() + } +} + +extension CmixMakeLegacyReceptionIdentity { + public static func live(_ bindingsCmix: BindingsCmix) -> CmixMakeLegacyReceptionIdentity { + CmixMakeLegacyReceptionIdentity(run: bindingsCmix.makeLegacyReceptionIdentity) + } +} + +extension CmixMakeLegacyReceptionIdentity { + public static let unimplemented = CmixMakeLegacyReceptionIdentity( + run: XCTUnimplemented("\(Self.self)") + ) +} -- GitLab