Skip to content
Snippets Groups Projects
Commit 0253bbef authored by Dariusz Rybicki's avatar Dariusz Rybicki
Browse files

Refactor ServiceProcessor callback

parent 47414a4b
No related branches found
No related tags found
2 merge requests!102Release 1.0.0,!18Update Bindings
...@@ -2,20 +2,27 @@ import Bindings ...@@ -2,20 +2,27 @@ import Bindings
import XCTestDynamicOverlay import XCTestDynamicOverlay
public struct ServiceProcessor { public struct ServiceProcessor {
public typealias Process = ( public struct Callback: Equatable {
_ message: Data, public init(message: Data, receptionId: Data, ephemeralId: Int64, roundId: Int64) {
_ receptionId: Data, self.message = message
_ ephemeralId: Int64, self.receptionId = receptionId
_ roundId: Int64 self.ephemeralId = ephemeralId
) -> Void self.roundId = roundId
}
public init(serviceTag: String, process: @escaping Process) {
public var message: Data
public var receptionId: Data
public var ephemeralId: Int64
public var roundId: Int64
}
public init(serviceTag: String, process: @escaping (Callback) -> Void) {
self.serviceTag = serviceTag self.serviceTag = serviceTag
self.process = process self.process = process
} }
public var serviceTag: String public var serviceTag: String
public var process: Process public var process: (Callback) -> Void
} }
extension ServiceProcessor { extension ServiceProcessor {
...@@ -41,7 +48,12 @@ extension ServiceProcessor { ...@@ -41,7 +48,12 @@ extension ServiceProcessor {
guard let receptionId = receptionId else { guard let receptionId = receptionId else {
fatalError("BindingsProcessor.process received `nil` receptionId") fatalError("BindingsProcessor.process received `nil` receptionId")
} }
serviceProcessor.process(message, receptionId, ephemeralId, roundId) serviceProcessor.process(Callback(
message: message,
receptionId: receptionId,
ephemeralId: ephemeralId,
roundId: roundId
))
} }
func string() -> String { func string() -> String {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment