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
import XCTestDynamicOverlay
public struct ServiceProcessor {
public typealias Process = (
_ message: Data,
_ receptionId: Data,
_ ephemeralId: Int64,
_ roundId: Int64
) -> Void
public init(serviceTag: String, process: @escaping Process) {
public struct Callback: Equatable {
public init(message: Data, receptionId: Data, ephemeralId: Int64, roundId: Int64) {
self.message = message
self.receptionId = receptionId
self.ephemeralId = ephemeralId
self.roundId = roundId
}
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.process = process
}
public var serviceTag: String
public var process: Process
public var process: (Callback) -> Void
}
extension ServiceProcessor {
......@@ -41,7 +48,12 @@ extension ServiceProcessor {
guard let receptionId = receptionId else {
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 {
......
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