Skip to content
Snippets Groups Projects

Update Bindings

Merged Dariusz Rybicki requested to merge feature/debug-bindings into development
4 files
+ 116
100
Compare changes
  • Side-by-side
  • Inline
Files
4
@@ -18,8 +18,8 @@ public struct MessengerReceiveFile {
public enum CallbackInfo: Equatable {
public enum Failure: Equatable {
case callbackError(NSError)
case receiveError(NSError)
case callback(NSError)
case receive(NSError)
}
case progress(transmitted: Int, total: Int)
@@ -53,24 +53,22 @@ extension MessengerReceiveFile {
transferId: params.transferId,
period: params.callbackIntervalMS,
callback: FileTransferProgressCallback { result in
switch result {
case .success(let info):
if info.progress.completed {
do {
callback(.finished(try fileTransfer.receive(transferId: params.transferId)))
} catch {
callback(.failed(.receiveError(error as NSError)))
}
} else {
callback(.progress(
transmitted: info.progress.transmitted,
total: info.progress.total
))
if let error = result.error {
callback(.failed(.callback(error as NSError)))
return
}
if result.progress.completed {
do {
callback(.finished(try fileTransfer.receive(transferId: params.transferId)))
} catch {
callback(.failed(.receive(error as NSError)))
}
case .failure(let error):
callback(.failed(.callbackError(error)))
return
}
callback(.progress(
transmitted: result.progress.transmitted,
total: result.progress.total
))
}
)
}
Loading