From ee83881a05102adfd606584c93bf888679ffcc2a Mon Sep 17 00:00:00 2001 From: Marino Faggiana Date: Mon, 12 Jan 2026 11:22:33 +0100 Subject: [PATCH 1/3] Pause added --- .../GUI/Lucid Banner/UploadBannerView.swift | 16 ++++-- iOSClient/Utility/NCDebouncer.swift | 56 +++++++++++++++---- 2 files changed, 58 insertions(+), 14 deletions(-) diff --git a/iOSClient/GUI/Lucid Banner/UploadBannerView.swift b/iOSClient/GUI/Lucid Banner/UploadBannerView.swift index ae98fe88f3..f08931e1b0 100644 --- a/iOSClient/GUI/Lucid Banner/UploadBannerView.swift +++ b/iOSClient/GUI/Lucid Banner/UploadBannerView.swift @@ -89,9 +89,18 @@ struct UploadBannerView: View { containerView(state: state) { if state.isMinimized { HStack(spacing: 5) { - Image(systemName: state.systemImage ?? "arrow.up.circle") - .font(.body.weight(.medium)) - .frame(width: 20, height: 20) + if #available(iOS 26, *) { + Image(systemName: state.systemImage ?? "arrow.up.circle") + .applyBannerAnimation(state.imageAnimation) + .font(.body.weight(.medium)) + .frame(width: 20, height: 20) + .foregroundStyle(Color(uiColor: NCBrandColor.shared.customer)) + + } else { + Image(systemName: state.systemImage ?? "arrow.up.circle") + .font(.body.weight(.medium)) + .frame(width: 20, height: 20) + } if let p = state.progress { Text("\(Int(p * 100))%") @@ -99,7 +108,6 @@ struct UploadBannerView: View { .frame(height: 20) .foregroundStyle(textColor) } - } .padding(.horizontal, 10) .padding(.vertical, 10) diff --git a/iOSClient/Utility/NCDebouncer.swift b/iOSClient/Utility/NCDebouncer.swift index 855f97b647..6055569760 100644 --- a/iOSClient/Utility/NCDebouncer.swift +++ b/iOSClient/Utility/NCDebouncer.swift @@ -7,18 +7,30 @@ import Foundation public actor NCDebouncer { private let delay: Duration private let maxEventCount: Int - private var eventCount = 0 + private var eventCount: Int = 0 private var pendingTask: Task? private var latestBlock: (@MainActor @Sendable () async -> Void)? + private var isPaused: Bool = false + + // MARK: - Init public init(delay: Duration = .seconds(2), maxEventCount: Int) { self.delay = delay self.maxEventCount = maxEventCount } + // MARK: - Public API + public func call(_ block: @MainActor @Sendable @escaping () async -> Void, immediate: Bool = false) { latestBlock = block + guard !isPaused else { + // We only store the latest block and count events, + // but we never schedule or commit while paused. + eventCount += 1 + return + } + if immediate { commit() return @@ -32,6 +44,25 @@ public actor NCDebouncer { } } + public func pause() { + guard !isPaused else { return } + + isPaused = true + pendingTask?.cancel() + pendingTask = nil + } + + public func resume() { + guard isPaused else { return } + + isPaused = false + + // If something accumulated while paused, commit immediately. + if latestBlock != nil { + commit() + } + } + public func cancel() { pendingTask?.cancel() pendingTask = nil @@ -39,25 +70,30 @@ public actor NCDebouncer { eventCount = 0 } + // MARK: - Internal + private func scheduleIfNeeded() { - guard pendingTask == nil else { return } + guard pendingTask == nil, !isPaused else { return } + pendingTask = Task { [weak self] in - guard let delay = self?.delay else { return } - try? await Task.sleep(for: delay) - await self?.commit() + guard let self else { return } + try? await Task.sleep(for: self.delay) + await self.commit() } } private func commit() { + guard !isPaused else { return } + pendingTask?.cancel() pendingTask = nil eventCount = 0 - if let block = latestBlock { - latestBlock = nil - Task { @MainActor in - await block() - } + guard let block = latestBlock else { return } + latestBlock = nil + + Task { @MainActor in + await block() } } } From d17c9a4738c9a022b620083c1d9f1c2ed223cdbb Mon Sep 17 00:00:00 2001 From: Marino Faggiana Date: Mon, 12 Jan 2026 11:31:23 +0100 Subject: [PATCH 2/3] Update UploadBannerView.swift --- .../GUI/Lucid Banner/UploadBannerView.swift | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/iOSClient/GUI/Lucid Banner/UploadBannerView.swift b/iOSClient/GUI/Lucid Banner/UploadBannerView.swift index f08931e1b0..7d85e1a0b6 100644 --- a/iOSClient/GUI/Lucid Banner/UploadBannerView.swift +++ b/iOSClient/GUI/Lucid Banner/UploadBannerView.swift @@ -89,18 +89,11 @@ struct UploadBannerView: View { containerView(state: state) { if state.isMinimized { HStack(spacing: 5) { - if #available(iOS 26, *) { - Image(systemName: state.systemImage ?? "arrow.up.circle") - .applyBannerAnimation(state.imageAnimation) - .font(.body.weight(.medium)) - .frame(width: 20, height: 20) - .foregroundStyle(Color(uiColor: NCBrandColor.shared.customer)) - - } else { - Image(systemName: state.systemImage ?? "arrow.up.circle") - .font(.body.weight(.medium)) - .frame(width: 20, height: 20) - } + Image(systemName: state.systemImage ?? "arrow.up.circle") + .applyBannerAnimation(state.imageAnimation) + .font(.body.weight(.medium)) + .frame(width: 20, height: 20) + .foregroundStyle(Color(uiColor: NCBrandColor.shared.customer)) if let p = state.progress { Text("\(Int(p * 100))%") From 888dba284304debde3f343c537a2669cebfe6927 Mon Sep 17 00:00:00 2001 From: Marino Faggiana Date: Mon, 12 Jan 2026 11:35:33 +0100 Subject: [PATCH 3/3] Update NCGlobal.swift --- iOSClient/NCGlobal.swift | 1 - 1 file changed, 1 deletion(-) diff --git a/iOSClient/NCGlobal.swift b/iOSClient/NCGlobal.swift index 51df24b68c..e257881739 100644 --- a/iOSClient/NCGlobal.swift +++ b/iOSClient/NCGlobal.swift @@ -277,7 +277,6 @@ final class NCGlobal: Sendable { let notificationCenterOpenMediaDetail = "openMediaDetail" // userInfo: ocId let notificationCenterDismissScanDocument = "dismissScanDocument" - let notificationCenterDismissUploadAssets = "dismissUploadAssets" let notificationCenterEnableSwipeGesture = "enableSwipeGesture" let notificationCenterDisableSwipeGesture = "disableSwipeGesture"