mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-21 20:45:51 +03:00
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:
parent
d4d5c8f8da
commit
607d72615d
1 changed files with 7 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue