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

Add Login functor

parent 97aa776e
No related branches found
No related tags found
2 merge requests!102Release 1.0.0,!18Update Bindings
import Bindings
import XCTestDynamicOverlay
public struct Login {
public var run: (Int, Data, Data) throws -> E2E
public func callAsFunction(
cmixId: Int,
identity: Data,
e2eParamsJSON: Data
) throws -> E2E {
try run(cmixId, identity, e2eParamsJSON)
}
}
extension Login {
public static let live = Login { cmixId, identity, e2eParamsJSON in
var error: NSError?
let bindingsE2E = BindingsLogin(
cmixId,
nil, // TODO: pass callbacks
identity,
e2eParamsJSON,
&error
)
if let error = error {
throw error
}
guard let bindingsE2E = bindingsE2E else {
fatalError("BindingsLogin returned `nil` without providing error")
}
return .live(bindingsE2E)
}
}
extension Login {
public static let unimplemented = Login(
run: XCTUnimplemented("\(Self.self)")
)
}
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