From 125335d9e051508534cfbc225fd576895bfca368 Mon Sep 17 00:00:00 2001 From: Dariusz Rybicki <dariusz@elixxir.io> Date: Thu, 28 Jul 2022 18:47:33 +0100 Subject: [PATCH] Rename ServiceProcessor to Processor --- ...ServiceProcessor.swift => Processor.swift} | 22 +++++++++---------- .../E2E/Functors/E2EAddService.swift | 4 ++-- 2 files changed, 13 insertions(+), 13 deletions(-) rename Sources/ElixxirDAppsSDK/Callbacks/{ServiceProcessor.swift => Processor.swift} (75%) 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 e70c4f28..59414fde 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 f4b57217..c743f148 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) } -- GitLab