diff --git a/Sources/ElixxirDAppsSDK/Callbacks/ServiceProcessor.swift b/Sources/ElixxirDAppsSDK/Callbacks/Processor.swift similarity index 75% rename from Sources/ElixxirDAppsSDK/Callbacks/ServiceProcessor.swift rename to Sources/ElixxirDAppsSDK/Callbacks/Processor.swift index e70c4f28a14c895a18e307d6a9bd6679b628b9f5..59414fdebbf264b1a813814d734067ee2cccbffb 100644 --- a/Sources/ElixxirDAppsSDK/Callbacks/ServiceProcessor.swift +++ b/Sources/ElixxirDAppsSDK/Callbacks/Processor.swift @@ -1,7 +1,7 @@ import Bindings import XCTestDynamicOverlay -public struct ServiceProcessor { +public struct Processor { public struct Callback: Equatable { public init(message: Data, receptionId: Data, ephemeralId: Int64, roundId: Int64) { self.message = message @@ -25,21 +25,21 @@ public struct ServiceProcessor { public var process: (Callback) -> Void } -extension ServiceProcessor { - public static let unimplemented = ServiceProcessor( +extension Processor { + public static let unimplemented = Processor( serviceTag: "unimplemented", process: XCTUnimplemented("\(Self.self).process") ) } -extension ServiceProcessor { +extension Processor { func makeBindingsProcessor() -> BindingsProcessorProtocol { - class Processor: NSObject, BindingsProcessorProtocol { - init(_ serviceProcessor: ServiceProcessor) { - self.serviceProcessor = serviceProcessor + class CallbackObject: NSObject, BindingsProcessorProtocol { + init(_ processor: Processor) { + self.processor = processor } - let serviceProcessor: ServiceProcessor + let processor: Processor func process(_ message: Data?, receptionId: Data?, ephemeralId: Int64, roundId: Int64) { guard let message = message else { @@ -48,7 +48,7 @@ extension ServiceProcessor { guard let receptionId = receptionId else { fatalError("BindingsProcessor.process received `nil` receptionId") } - serviceProcessor.process(Callback( + processor.process(Callback( message: message, receptionId: receptionId, ephemeralId: ephemeralId, @@ -57,10 +57,10 @@ extension ServiceProcessor { } func string() -> String { - serviceProcessor.serviceTag + processor.serviceTag } } - return Processor(self) + return CallbackObject(self) } } diff --git a/Sources/ElixxirDAppsSDK/E2E/Functors/E2EAddService.swift b/Sources/ElixxirDAppsSDK/E2E/Functors/E2EAddService.swift index f4b57217b4da05192097e830c2e2ae37e32464b9..c743f14827c0465b6b315d165d0b47ebb968426e 100644 --- a/Sources/ElixxirDAppsSDK/E2E/Functors/E2EAddService.swift +++ b/Sources/ElixxirDAppsSDK/E2E/Functors/E2EAddService.swift @@ -2,10 +2,10 @@ import Bindings import XCTestDynamicOverlay public struct E2EAddService { - public var run: (ServiceProcessor) throws -> Void + public var run: (Processor) throws -> Void public func callAsFunction( - processor: ServiceProcessor + processor: Processor ) throws { try run(processor) }