зеркало из https://github.com/nextcloud/desktop.git
Add ability to set handlers from AlamoFire request on Progress extension
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
This commit is contained in:
Родитель
d4d5c8f8da
Коммит
607d72615d
|
@ -13,8 +13,15 @@
|
|||
*/
|
||||
|
||||
import Foundation
|
||||
import Alamofire
|
||||
|
||||
extension Progress {
|
||||
func setHandlersFromAfRequest(_ request: Request) {
|
||||
self.cancellationHandler = { request.cancel() }
|
||||
self.pausingHandler = { request.suspend() }
|
||||
self.resumingHandler = { request.resume() }
|
||||
}
|
||||
|
||||
func copyCurrentStateToProgress(_ otherProgress: Progress, includeHandlers: Bool = false) {
|
||||
if includeHandlers {
|
||||
otherProgress.cancellationHandler = self.cancellationHandler
|
||||
|
|
Загрузка…
Ссылка в новой задаче