mirror of
https://github.com/nextcloud/desktop.git
synced 2024-10-24 05:15:40 +03:00
Do not copy pause, cancel, and resuming handlers in Progress extension copyCurrentStateToProgress by default
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
This commit is contained in:
parent
5e8d7217a9
commit
a7616502ae
1 changed files with 9 additions and 5 deletions
|
@ -15,9 +15,13 @@
|
|||
import Foundation
|
||||
|
||||
extension Progress {
|
||||
func copyCurrentStateToProgress(_ otherProgress: Progress) {
|
||||
otherProgress.cancellationHandler = self.cancellationHandler
|
||||
otherProgress.pausingHandler = self.pausingHandler
|
||||
func copyCurrentStateToProgress(_ otherProgress: Progress, includeHandlers: Bool = false) {
|
||||
if includeHandlers {
|
||||
otherProgress.cancellationHandler = self.cancellationHandler
|
||||
otherProgress.pausingHandler = self.pausingHandler
|
||||
otherProgress.resumingHandler = self.resumingHandler
|
||||
}
|
||||
|
||||
otherProgress.totalUnitCount = self.totalUnitCount
|
||||
otherProgress.completedUnitCount = self.completedUnitCount
|
||||
otherProgress.estimatedTimeRemaining = self.estimatedTimeRemaining
|
||||
|
@ -38,9 +42,9 @@ extension Progress {
|
|||
}
|
||||
}
|
||||
|
||||
func copyOfCurrentState() -> Progress {
|
||||
func copyOfCurrentState(includeHandlers: Bool = false) -> Progress {
|
||||
let newProgress = Progress()
|
||||
copyCurrentStateToProgress(newProgress)
|
||||
copyCurrentStateToProgress(newProgress, includeHandlers: includeHandlers)
|
||||
return newProgress
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue