From: Claudio Cambra Date: Wed, 15 Mar 2023 11:09:33 +0000 (+0100) Subject: Do not copy pause, cancel, and resuming handlers in Progress extension copyCurrentSta... X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~12^2~10^2~55^2~80 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=a7616502ae7712903d3d4fa316303b74deab51b7;p=nextcloud-desktop.git Do not copy pause, cancel, and resuming handlers in Progress extension copyCurrentStateToProgress by default Signed-off-by: Claudio Cambra --- diff --git a/shell_integration/MacOSX/NextcloudIntegration/FileProviderExt/Extensions/Progress+Extensions.swift b/shell_integration/MacOSX/NextcloudIntegration/FileProviderExt/Extensions/Progress+Extensions.swift index 97123fd90..926fed83c 100644 --- a/shell_integration/MacOSX/NextcloudIntegration/FileProviderExt/Extensions/Progress+Extensions.swift +++ b/shell_integration/MacOSX/NextcloudIntegration/FileProviderExt/Extensions/Progress+Extensions.swift @@ -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 } }