From c412eefe4a6872d2fe43b1898e2141c7ba33ceb0 Mon Sep 17 00:00:00 2001 From: Marino Faggiana Date: Fri, 12 Dec 2025 14:37:50 +0100 Subject: [PATCH 1/8] Update UploadBannerView.swift --- iOSClient/GUI/Lucid Banner/UploadBannerView.swift | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/iOSClient/GUI/Lucid Banner/UploadBannerView.swift b/iOSClient/GUI/Lucid Banner/UploadBannerView.swift index a7fa63c99e..c1f43eb4ed 100644 --- a/iOSClient/GUI/Lucid Banner/UploadBannerView.swift +++ b/iOSClient/GUI/Lucid Banner/UploadBannerView.swift @@ -214,8 +214,9 @@ struct UploadBannerView: View { @ViewBuilder func containerView(state: LucidBannerState, @ViewBuilder _ content: () -> Content) -> some View { let isError = (state.typedStage == .error) - let cornerRadius: CGFloat = 22 + let isSuccess = (state.typedStage == .success) let isMinimized = state.isMinimized + let cornerRadius: CGFloat = 22 let base = content() .contentShape(Rectangle()) @@ -224,7 +225,7 @@ struct UploadBannerView: View { LucidBannerMinimizeCoordinator.shared.handleTap(state) } - if isMinimized { + if isMinimized || isSuccess { if #available(iOS 26, *) { if isError { base @@ -339,10 +340,10 @@ public extension View { systemImage: "arrow.up.circle", imageAnimation: .none, progress: 0.71, - stage: "button" + stage: "success" ) - state.isMinimized = true + // state.isMinimized = false return ZStack { LinearGradient( @@ -353,7 +354,7 @@ public extension View { UploadBannerView( state: state, - allowMinimizeOnTap: true + allowMinimizeOnTap: false ) .padding() } From 942629809b0b334b733efe0bf20e445ba1741a06 Mon Sep 17 00:00:00 2001 From: Marino Faggiana Date: Sat, 13 Dec 2025 13:42:31 +0100 Subject: [PATCH 2/8] color --- .../GUI/Lucid Banner/ErrorBannerView.swift | 25 ++++++++----- .../GUI/Lucid Banner/HudBannerView.swift | 22 +++++++++-- .../GUI/Lucid Banner/UploadBannerView.swift | 37 +++++++++++++------ 3 files changed, 59 insertions(+), 25 deletions(-) diff --git a/iOSClient/GUI/Lucid Banner/ErrorBannerView.swift b/iOSClient/GUI/Lucid Banner/ErrorBannerView.swift index cd06c28c8e..1cd694e55f 100644 --- a/iOSClient/GUI/Lucid Banner/ErrorBannerView.swift +++ b/iOSClient/GUI/Lucid Banner/ErrorBannerView.swift @@ -84,6 +84,8 @@ struct ErrorBannerView: View { @ViewBuilder func containerView(@ViewBuilder _ content: () -> Content) -> some View { + let cornerRadius: CGFloat = 22 + let opacityError: CGFloat = 0.75 let contentBase = content() .contentShape(Rectangle()) .frame(maxWidth: 500) @@ -91,16 +93,16 @@ struct ErrorBannerView: View { if #available(iOS 26, *) { contentBase .background( - RoundedRectangle(cornerRadius: 22) - .fill(Color.red.opacity(1)) + RoundedRectangle(cornerRadius: cornerRadius) + .fill(Color.red.opacity(opacityError)) ) - .glassEffect(.regular, in: RoundedRectangle(cornerRadius: 22)) + .glassEffect(.clear, in: RoundedRectangle(cornerRadius: 22)) .frame(maxWidth: .infinity, alignment: .center) } else { contentBase - .background(.ultraThinMaterial, in: RoundedRectangle(cornerRadius: 22.0)) + .background(.ultraThinMaterial, in: RoundedRectangle(cornerRadius: cornerRadius)) .overlay( - RoundedRectangle(cornerRadius: 22, style: .continuous) + RoundedRectangle(cornerRadius: cornerRadius, style: .continuous) .stroke(.white.opacity(0.9), lineWidth: 0.6) ) .shadow(color: .black.opacity(0.5), radius: 10, x: 0, y: 4) @@ -113,11 +115,14 @@ struct ErrorBannerView: View { #Preview { ZStack { - LinearGradient( - colors: [.white, .gray.opacity(0.1)], - startPoint: .top, - endPoint: .bottom - ) + Text( + Array(0...500) + .map(String.init) + .joined(separator: " ") + ) + .font(.system(size: 16, design: .monospaced)) + .foregroundStyle(.primary) + .padding() ErrorBannerView( state: LucidBannerState( diff --git a/iOSClient/GUI/Lucid Banner/HudBannerView.swift b/iOSClient/GUI/Lucid Banner/HudBannerView.swift index a01c9f36f6..dfadca7687 100644 --- a/iOSClient/GUI/Lucid Banner/HudBannerView.swift +++ b/iOSClient/GUI/Lucid Banner/HudBannerView.swift @@ -189,14 +189,21 @@ struct HudBannerView: View { @ViewBuilder func containerView(@ViewBuilder _ content: () -> Content) -> some View { + let cornerRadius: CGFloat = 22 + let opacity = 0.65 + if #available(iOS 26, *) { content() - .glassEffect(.regular, in: RoundedRectangle(cornerRadius: 22)) + .background( + RoundedRectangle(cornerRadius: cornerRadius) + .fill(Color.white.opacity(opacity)) + ) + .glassEffect(.clear, in: RoundedRectangle(cornerRadius: cornerRadius)) } else { content() - .background(.ultraThinMaterial, in: RoundedRectangle(cornerRadius: 22.0)) + .background(.ultraThinMaterial, in: RoundedRectangle(cornerRadius: cornerRadius)) .overlay( - RoundedRectangle(cornerRadius: 22, style: .continuous) + RoundedRectangle(cornerRadius: cornerRadius, style: .continuous) .stroke(.white.opacity(0.9), lineWidth: 0.6) ) .shadow(color: .black.opacity(0.5), radius: 10, x: 0, y: 4) @@ -208,6 +215,15 @@ struct HudBannerView: View { #Preview("HudBannerView") { ZStack { + Text( + Array(0...500) + .map(String.init) + .joined(separator: " ") + ) + .font(.system(size: 16, design: .monospaced)) + .foregroundStyle(.primary) + .padding() + HudBannerPreviewWrapper() } } diff --git a/iOSClient/GUI/Lucid Banner/UploadBannerView.swift b/iOSClient/GUI/Lucid Banner/UploadBannerView.swift index c1f43eb4ed..e3a9724974 100644 --- a/iOSClient/GUI/Lucid Banner/UploadBannerView.swift +++ b/iOSClient/GUI/Lucid Banner/UploadBannerView.swift @@ -217,6 +217,8 @@ struct UploadBannerView: View { let isSuccess = (state.typedStage == .success) let isMinimized = state.isMinimized let cornerRadius: CGFloat = 22 + let opacityError: CGFloat = 0.75 + let opacity = 0.65 let base = content() .contentShape(Rectangle()) @@ -231,12 +233,16 @@ struct UploadBannerView: View { base .background( RoundedRectangle(cornerRadius: cornerRadius) - .fill(Color.red.opacity(1)) + .fill(Color.red.opacity(opacityError)) ) - .glassEffect(.regular, in: RoundedRectangle(cornerRadius: cornerRadius)) + .glassEffect(.clear, in: RoundedRectangle(cornerRadius: cornerRadius)) } else { base - .glassEffect(.regular, in: RoundedRectangle(cornerRadius: cornerRadius)) + .background( + RoundedRectangle(cornerRadius: cornerRadius) + .fill(Color.white.opacity(opacity)) + ) + .glassEffect(.clear, in: RoundedRectangle(cornerRadius: cornerRadius)) } } else { let colorBg = isError ? Color.red.opacity(0.9) : Color.white.opacity(0.9) @@ -258,13 +264,17 @@ struct UploadBannerView: View { contentBase .background( RoundedRectangle(cornerRadius: cornerRadius) - .fill(Color.red.opacity(1)) + .fill(Color.red.opacity(opacityError)) ) - .glassEffect(.regular, in: RoundedRectangle(cornerRadius: cornerRadius)) + .glassEffect(.clear, in: RoundedRectangle(cornerRadius: cornerRadius)) .frame(maxWidth: .infinity, alignment: .center) } else { contentBase - .glassEffect(.regular, in: RoundedRectangle(cornerRadius: cornerRadius)) + .background( + RoundedRectangle(cornerRadius: cornerRadius) + .fill(Color.white.opacity(opacity)) + ) + .glassEffect(.clear, in: RoundedRectangle(cornerRadius: cornerRadius)) .frame(maxWidth: .infinity, alignment: .center) } } else { @@ -340,17 +350,20 @@ public extension View { systemImage: "arrow.up.circle", imageAnimation: .none, progress: 0.71, - stage: "success" + stage: "button" ) // state.isMinimized = false return ZStack { - LinearGradient( - colors: [.white, .gray.opacity(0.1)], - startPoint: .top, - endPoint: .bottom - ) + Text( + Array(0...500) + .map(String.init) + .joined(separator: " ") + ) + .font(.system(size: 16, design: .monospaced)) + .foregroundStyle(.primary) + .padding() UploadBannerView( state: state, From 1f234ef70290b96539f4dfca4e57b45936c928fc Mon Sep 17 00:00:00 2001 From: Marino Faggiana Date: Sat, 13 Dec 2025 14:34:31 +0100 Subject: [PATCH 3/8] cod --- .../GUI/Lucid Banner/HudBannerView.swift | 45 +++++++++++++++---- ...ionViewCommon+CollectionViewDelegate.swift | 6 ++- iOSClient/Menu/NCContextMenu.swift | 12 ++--- .../Networking/NCNetworking+WebDAV.swift | 6 ++- .../NCPlayer/NCPlayerToolBar.swift | 3 +- .../Viewer/NCViewerMedia/NCViewerMedia.swift | 3 +- 6 files changed, 54 insertions(+), 21 deletions(-) diff --git a/iOSClient/GUI/Lucid Banner/HudBannerView.swift b/iOSClient/GUI/Lucid Banner/HudBannerView.swift index dfadca7687..4bbd29b0c1 100644 --- a/iOSClient/GUI/Lucid Banner/HudBannerView.swift +++ b/iOSClient/GUI/Lucid Banner/HudBannerView.swift @@ -6,7 +6,11 @@ import SwiftUI import LucidBanner @MainActor -func showHudBanner(scene: UIWindowScene?, title: String? = nil, subtitle: String? = nil, onTap: ((_ token: Int?, _ stage: String?) -> Void)? = nil) -> Int? { +func showHudBanner(scene: UIWindowScene?, + title: String? = nil, + subtitle: String? = nil, + stage: LucidBanner.Stage? = nil, + onButtonTap: (() -> Void)? = nil) -> Int? { var scene = scene if scene == nil { scene = UIApplication.shared.mainAppWindow?.windowScene @@ -18,11 +22,9 @@ func showHudBanner(scene: UIWindowScene?, title: String? = nil, subtitle: String subtitle: subtitle, vPosition: .center, blocksTouches: true, - onTap: { token, stage in - onTap?(token, stage) - } + stage: stage ) { state in - HudBannerView(state: state) + HudBannerView(state: state, onButtonTap: onButtonTap) } } @@ -56,16 +58,24 @@ struct HudBannerView: View { @ObservedObject var state: LucidBannerState @State private var displayedProgress: Double = 0 + let onButtonTap: (() -> Void)? + private let circleSize: CGFloat = 90 private let lineWidth: CGFloat = 8 + init(state: LucidBannerState, + onButtonTap: (() -> Void)? = nil) { + self.state = state + self.onButtonTap = onButtonTap + } + var body: some View { let rawProgress = state.progress ?? 0 let clampedProgress = min(max(rawProgress, 0), 1) - let stage = state.stage?.lowercased() - let isSuccess = (stage == "success") - let isError = (stage == "error") + let isSuccess = (state.typedStage == .success) + let isError = (state.typedStage == .error) + let isButton = (state.typedStage == .button) let visualProgress: Double = { if isSuccess || isError { @@ -141,6 +151,22 @@ struct HudBannerView: View { } } .padding(.top, 4) + + if isButton { + VStack { + Button("_cancel_") { + onButtonTap?() + } + .buttonStyle(.plain) + .padding(.horizontal, 20) + .padding(.vertical, 10) + .background( + Capsule() + .stroke(.primary.opacity(0.2), lineWidth: 1) + ) + } + .padding(15) + } } .padding(.horizontal, 22) .padding(.vertical, 24) @@ -233,7 +259,8 @@ private struct HudBannerPreviewWrapper: View { title: "Uploading files", subtitle: "Syncing your library…", footnote: nil, - imageAnimation: .none + imageAnimation: .none, + stage: "button" ) var body: some View { diff --git a/iOSClient/Main/Collection Common/NCCollectionViewCommon+CollectionViewDelegate.swift b/iOSClient/Main/Collection Common/NCCollectionViewCommon+CollectionViewDelegate.swift index 8f3a08f851..b80a4db83a 100644 --- a/iOSClient/Main/Collection Common/NCCollectionViewCommon+CollectionViewDelegate.swift +++ b/iOSClient/Main/Collection Common/NCCollectionViewCommon+CollectionViewDelegate.swift @@ -31,11 +31,13 @@ extension NCCollectionViewCommon: UICollectionViewDelegate { var tokenBanner: Int? await MainActor.run { tokenBanner = showHudBanner(scene: scene, - title: NSLocalizedString("_downloading_", comment: "")) { _, _ in + title: NSLocalizedString("_downloading_", comment: ""), + stage: .button, + onButtonTap: { if let request = downloadRequest { request.cancel() } - } + }) } guard let metadata = await database.setMetadataSessionInWaitDownloadAsync(ocId: metadata.ocId, diff --git a/iOSClient/Menu/NCContextMenu.swift b/iOSClient/Menu/NCContextMenu.swift index bccd3b52fb..b69dd7d94d 100644 --- a/iOSClient/Menu/NCContextMenu.swift +++ b/iOSClient/Menu/NCContextMenu.swift @@ -98,12 +98,12 @@ class NCContextMenu: NSObject { return } - let token = showHudBanner( - scene: scene, - title: NSLocalizedString("_download_in_progress_", comment: "")) { _, _ in - if let request = downloadRequest { - request.cancel() - } + let token = showHudBanner(scene: scene, + title: NSLocalizedString("_download_in_progress_", comment: ""), + stage: .button) { + if let request = downloadRequest { + request.cancel() + } } let results = await self.networking.downloadFile(metadata: metadata) { request in diff --git a/iOSClient/Networking/NCNetworking+WebDAV.swift b/iOSClient/Networking/NCNetworking+WebDAV.swift index bfc52f257c..e9c6d1c7d7 100644 --- a/iOSClient/Networking/NCNetworking+WebDAV.swift +++ b/iOSClient/Networking/NCNetworking+WebDAV.swift @@ -385,9 +385,11 @@ extension NCNetworking { var num: Float = 0 let total = Float(metadatasE2EE.count) var cancelOnTap = false + let scene = SceneManager.shared.getWindow(sceneIdentifier: sceneIdentifier)?.windowScene - let token = showHudBanner(scene: SceneManager.shared.getWindow(sceneIdentifier: sceneIdentifier)?.windowScene, - title: NSLocalizedString("_delete_in_progress_", comment: "")) { _, _ in + let token = showHudBanner(scene: scene, + title: NSLocalizedString("_delete_in_progress_", comment: ""), + stage: .button) { cancelOnTap = true } diff --git a/iOSClient/Viewer/NCViewerMedia/NCPlayer/NCPlayerToolBar.swift b/iOSClient/Viewer/NCViewerMedia/NCPlayer/NCPlayerToolBar.swift index 4d044ee6e0..92267d3a73 100644 --- a/iOSClient/Viewer/NCViewerMedia/NCPlayer/NCPlayerToolBar.swift +++ b/iOSClient/Viewer/NCViewerMedia/NCPlayer/NCPlayerToolBar.swift @@ -438,7 +438,8 @@ extension NCPlayerToolBar: NCSelectDelegate { } else { var downloadRequest: DownloadRequest? let token = showHudBanner(scene: scene, - title: NSLocalizedString("_downloading_", comment: "")) { _, _ in + title: NSLocalizedString("_downloading_", comment: ""), + stage: .button) { if let request = downloadRequest { request.cancel() } diff --git a/iOSClient/Viewer/NCViewerMedia/NCViewerMedia.swift b/iOSClient/Viewer/NCViewerMedia/NCViewerMedia.swift index 0c29fdd9d9..0b2d267e41 100644 --- a/iOSClient/Viewer/NCViewerMedia/NCViewerMedia.swift +++ b/iOSClient/Viewer/NCViewerMedia/NCViewerMedia.swift @@ -157,7 +157,8 @@ class NCViewerMedia: UIViewController { let scene = SceneManager.shared.getWindow(controller: self.tabBarController)?.windowScene var downloadRequest: DownloadRequest? let token = showHudBanner(scene: scene, - title: NSLocalizedString("_download_in_progress_", comment: "")) { _, _ in + title: NSLocalizedString("_download_in_progress_", comment: ""), + stage: .button) { if let request = downloadRequest { request.cancel() } From 2ba998722538fa0c68cddd9c8e0c7c94e713b16c Mon Sep 17 00:00:00 2001 From: Marino Faggiana Date: Sat, 13 Dec 2025 18:37:10 +0100 Subject: [PATCH 4/8] Update UploadBannerView.swift --- .../GUI/Lucid Banner/UploadBannerView.swift | 25 +++++++++++-------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/iOSClient/GUI/Lucid Banner/UploadBannerView.swift b/iOSClient/GUI/Lucid Banner/UploadBannerView.swift index e3a9724974..58bd1a5e97 100644 --- a/iOSClient/GUI/Lucid Banner/UploadBannerView.swift +++ b/iOSClient/GUI/Lucid Banner/UploadBannerView.swift @@ -64,6 +64,7 @@ struct UploadBannerView: View { @State var trigger = true let onButtonTap: (() -> Void)? let allowMinimizeOnTap: Bool + let textColor = Color(.label) init(state: LucidBannerState, allowMinimizeOnTap: Bool = false, @@ -93,6 +94,7 @@ struct UploadBannerView: View { Text("\(Int(p * 100))%") .font(.caption2.monospacedDigit()) .frame(height: 20) + .foregroundStyle(textColor) } } @@ -131,13 +133,13 @@ struct UploadBannerView: View { .multilineTextAlignment(.leading) .truncationMode(.tail) .minimumScaleFactor(0.9) - .foregroundStyle(.primary) + .foregroundStyle(textColor) if showSubtitle, let subtitle = state.subtitle { Text(subtitle) .font(.subheadline) .multilineTextAlignment(.leading) .truncationMode(.tail) - .foregroundStyle(.primary) + .foregroundStyle(textColor) } } } @@ -162,21 +164,21 @@ struct UploadBannerView: View { .multilineTextAlignment(.leading) .truncationMode(.tail) .minimumScaleFactor(0.9) - .foregroundStyle(.primary) + .foregroundStyle(textColor) } if showSubtitle, let subtitle = state.subtitle { Text(subtitle) .font(.subheadline) .multilineTextAlignment(.leading) .truncationMode(.tail) - .foregroundStyle(.primary) + .foregroundStyle(textColor) } if showFootnote, let footnote = state.footnote { Text(footnote) .font(.caption) .multilineTextAlignment(.leading) .truncationMode(.tail) - .foregroundStyle(.primary) + .foregroundStyle(textColor) } } } @@ -192,6 +194,7 @@ struct UploadBannerView: View { onButtonTap?() } .buttonStyle(.plain) + .foregroundStyle(textColor) .padding(.horizontal, 20) .padding(.vertical, 10) .background( @@ -217,8 +220,8 @@ struct UploadBannerView: View { let isSuccess = (state.typedStage == .success) let isMinimized = state.isMinimized let cornerRadius: CGFloat = 22 - let opacityError: CGFloat = 0.75 - let opacity = 0.65 + let backgroundColor = Color(.systemBackground).opacity(0.65) + let errorColor = Color.red.opacity(0.75) let base = content() .contentShape(Rectangle()) @@ -233,14 +236,14 @@ struct UploadBannerView: View { base .background( RoundedRectangle(cornerRadius: cornerRadius) - .fill(Color.red.opacity(opacityError)) + .fill(errorColor) ) .glassEffect(.clear, in: RoundedRectangle(cornerRadius: cornerRadius)) } else { base .background( RoundedRectangle(cornerRadius: cornerRadius) - .fill(Color.white.opacity(opacity)) + .fill(backgroundColor) ) .glassEffect(.clear, in: RoundedRectangle(cornerRadius: cornerRadius)) } @@ -264,7 +267,7 @@ struct UploadBannerView: View { contentBase .background( RoundedRectangle(cornerRadius: cornerRadius) - .fill(Color.red.opacity(opacityError)) + .fill(errorColor) ) .glassEffect(.clear, in: RoundedRectangle(cornerRadius: cornerRadius)) .frame(maxWidth: .infinity, alignment: .center) @@ -272,7 +275,7 @@ struct UploadBannerView: View { contentBase .background( RoundedRectangle(cornerRadius: cornerRadius) - .fill(Color.white.opacity(opacity)) + .fill(backgroundColor) ) .glassEffect(.clear, in: RoundedRectangle(cornerRadius: cornerRadius)) .frame(maxWidth: .infinity, alignment: .center) From 4bc72e45d50ff820d10dda03ffd1ea62b55ba4b4 Mon Sep 17 00:00:00 2001 From: Marino Faggiana Date: Sat, 13 Dec 2025 18:54:29 +0100 Subject: [PATCH 5/8] cod --- iOSClient/GUI/Lucid Banner/HudBannerView.swift | 2 +- iOSClient/GUI/Lucid Banner/UploadBannerView.swift | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/iOSClient/GUI/Lucid Banner/HudBannerView.swift b/iOSClient/GUI/Lucid Banner/HudBannerView.swift index 4bbd29b0c1..4be6d95e6b 100644 --- a/iOSClient/GUI/Lucid Banner/HudBannerView.swift +++ b/iOSClient/GUI/Lucid Banner/HudBannerView.swift @@ -162,7 +162,7 @@ struct HudBannerView: View { .padding(.vertical, 10) .background( Capsule() - .stroke(.primary.opacity(0.2), lineWidth: 1) + .stroke(.gray, lineWidth: 1) ) } .padding(15) diff --git a/iOSClient/GUI/Lucid Banner/UploadBannerView.swift b/iOSClient/GUI/Lucid Banner/UploadBannerView.swift index 58bd1a5e97..1285235245 100644 --- a/iOSClient/GUI/Lucid Banner/UploadBannerView.swift +++ b/iOSClient/GUI/Lucid Banner/UploadBannerView.swift @@ -98,8 +98,8 @@ struct UploadBannerView: View { } } - .padding(.horizontal, 3) - .padding(.vertical, 3) + .padding(.horizontal, 10) + .padding(.vertical, 10) .clipShape(Capsule()) } else if isSuccess { HStack(alignment: .center, spacing: 10) { @@ -199,7 +199,7 @@ struct UploadBannerView: View { .padding(.vertical, 10) .background( Capsule() - .stroke(.primary.opacity(0.2), lineWidth: 1) + .stroke(.gray, lineWidth: 1) ) } .padding(15) @@ -219,7 +219,7 @@ struct UploadBannerView: View { let isError = (state.typedStage == .error) let isSuccess = (state.typedStage == .success) let isMinimized = state.isMinimized - let cornerRadius: CGFloat = 22 + let cornerRadius: CGFloat = state.isMinimized ? 15 : 25 let backgroundColor = Color(.systemBackground).opacity(0.65) let errorColor = Color.red.opacity(0.75) @@ -356,7 +356,7 @@ public extension View { stage: "button" ) - // state.isMinimized = false + state.isMinimized = false return ZStack { Text( From cf9b3c76d276f6035f77b35dbfcfeb50f8c597c5 Mon Sep 17 00:00:00 2001 From: Marino Faggiana Date: Sat, 13 Dec 2025 19:16:34 +0100 Subject: [PATCH 6/8] code --- iOSClient/GUI/Lucid Banner/ErrorBannerView.swift | 12 +++++++----- iOSClient/GUI/Lucid Banner/HudBannerView.swift | 14 ++++++-------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/iOSClient/GUI/Lucid Banner/ErrorBannerView.swift b/iOSClient/GUI/Lucid Banner/ErrorBannerView.swift index 1cd694e55f..da5c656adc 100644 --- a/iOSClient/GUI/Lucid Banner/ErrorBannerView.swift +++ b/iOSClient/GUI/Lucid Banner/ErrorBannerView.swift @@ -38,6 +38,7 @@ func showErrorBanner(scene: UIWindowScene?, errorDescription: String, errorCode: struct ErrorBannerView: View { @ObservedObject var state: LucidBannerState + let textColor = Color(.label) var body: some View { let showSubtitle = !(state.subtitle?.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty ?? true) @@ -55,21 +56,21 @@ struct ErrorBannerView: View { .font(.subheadline.weight(.bold)) .multilineTextAlignment(.leading) .truncationMode(.tail) - .foregroundStyle(.white) + .foregroundStyle(textColor) if showSubtitle, let subtitle = state.subtitle { Text(subtitle) .font(.subheadline) .multilineTextAlignment(.leading) .truncationMode(.tail) - .foregroundStyle(.white) + .foregroundStyle(textColor) } if showFootnote, let footnote = state.footnote { Text(footnote) .font(.caption) .multilineTextAlignment(.leading) .truncationMode(.tail) - .foregroundStyle(.white) + .foregroundStyle(textColor) } } } @@ -85,7 +86,8 @@ struct ErrorBannerView: View { @ViewBuilder func containerView(@ViewBuilder _ content: () -> Content) -> some View { let cornerRadius: CGFloat = 22 - let opacityError: CGFloat = 0.75 + let errorColor = Color.red.opacity(0.75) + let contentBase = content() .contentShape(Rectangle()) .frame(maxWidth: 500) @@ -94,7 +96,7 @@ struct ErrorBannerView: View { contentBase .background( RoundedRectangle(cornerRadius: cornerRadius) - .fill(Color.red.opacity(opacityError)) + .fill(errorColor) ) .glassEffect(.clear, in: RoundedRectangle(cornerRadius: 22)) .frame(maxWidth: .infinity, alignment: .center) diff --git a/iOSClient/GUI/Lucid Banner/HudBannerView.swift b/iOSClient/GUI/Lucid Banner/HudBannerView.swift index 4be6d95e6b..4cbea4cad3 100644 --- a/iOSClient/GUI/Lucid Banner/HudBannerView.swift +++ b/iOSClient/GUI/Lucid Banner/HudBannerView.swift @@ -60,6 +60,7 @@ struct HudBannerView: View { let onButtonTap: (() -> Void)? + private let textColor = Color(.label) private let circleSize: CGFloat = 90 private let lineWidth: CGFloat = 8 @@ -98,7 +99,7 @@ struct HudBannerView: View { if let title = state.title, !title.isEmpty { Text(title) .font(.headline.weight(.semibold)) - .foregroundStyle(.primary) + .foregroundStyle(textColor) .multilineTextAlignment(.center) } @@ -106,7 +107,7 @@ struct HudBannerView: View { if let subtitle = state.subtitle, !subtitle.isEmpty { Text(subtitle) .font(.subheadline) - .foregroundStyle(.primary.opacity(0.95)) + .foregroundStyle(textColor) .multilineTextAlignment(.center) } @@ -131,9 +132,6 @@ struct HudBannerView: View { .frame(width: circleSize, height: circleSize) // Center content: - // - checkmark for success - // - xmark for error - // - percentage for normal progress Group { if isSuccess { Image(systemName: "checkmark") @@ -146,7 +144,7 @@ struct HudBannerView: View { } else { Text("\(Int(visualProgress * 100))%") .font(.headline.monospacedDigit()) - .foregroundStyle(.primary) + .foregroundStyle(textColor) } } } @@ -165,7 +163,6 @@ struct HudBannerView: View { .stroke(.gray, lineWidth: 1) ) } - .padding(15) } } .padding(.horizontal, 22) @@ -217,12 +214,13 @@ struct HudBannerView: View { func containerView(@ViewBuilder _ content: () -> Content) -> some View { let cornerRadius: CGFloat = 22 let opacity = 0.65 + let backgroundColor = Color(.systemBackground).opacity(0.65) if #available(iOS 26, *) { content() .background( RoundedRectangle(cornerRadius: cornerRadius) - .fill(Color.white.opacity(opacity)) + .fill(backgroundColor) ) .glassEffect(.clear, in: RoundedRectangle(cornerRadius: cornerRadius)) } else { From c7ba34e20a4b53a0421c9d5a22bd03e96a62fb59 Mon Sep 17 00:00:00 2001 From: Marino Faggiana Date: Sun, 14 Dec 2025 09:12:49 +0100 Subject: [PATCH 7/8] fix --- .../GUI/Lucid Banner/UploadBannerView.swift | 9 ++++++--- iOSClient/Main/Create/NCCreate.swift | 18 +++++++++++------- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/iOSClient/GUI/Lucid Banner/UploadBannerView.swift b/iOSClient/GUI/Lucid Banner/UploadBannerView.swift index 1285235245..32210f533e 100644 --- a/iOSClient/GUI/Lucid Banner/UploadBannerView.swift +++ b/iOSClient/GUI/Lucid Banner/UploadBannerView.swift @@ -37,12 +37,15 @@ func showUploadBanner(scene: UIWindowScene?, let bounds = context.bounds let controller = SceneManager.shared.getController(scene: scene) var height: CGFloat = 55 - let over: CGFloat = 20 + let over: CGFloat = 30 if let scene, let controller, let window = scene.windows.first { - let isPadLayout = (window.rootViewController?.traitCollection.horizontalSizeClass == .regular) - if !isPadLayout { + let regularLayout = (window.rootViewController?.traitCollection.horizontalSizeClass == .regular) + let iPad = UIDevice.current.userInterfaceIdiom == .pad + if iPad, regularLayout { + height = controller.barHeightBottom + context.safeAreaInsets.bottom + over + } else { height = controller.barHeightBottom + context.safeAreaInsets.bottom + over } } diff --git a/iOSClient/Main/Create/NCCreate.swift b/iOSClient/Main/Create/NCCreate.swift index c2280e256a..0348071348 100644 --- a/iOSClient/Main/Create/NCCreate.swift +++ b/iOSClient/Main/Create/NCCreate.swift @@ -6,6 +6,7 @@ import Foundation import UIKit import NextcloudKit import LucidBanner +import Alamofire class NCCreate: NSObject { let utility = NCUtility() @@ -257,6 +258,7 @@ class NCCreate: NSObject { var exportURLs: [URL] = [] var downloadMetadata: [(tableMetadata, URL)] = [] let scene = SceneManager.shared.getWindow(controller: controller)?.windowScene + var downloadRequest: DownloadRequest? for metadata in metadatas { let localPath = utilityFileSystem.getDirectoryProviderStorageOcId( @@ -275,12 +277,14 @@ class NCCreate: NSObject { } if !downloadMetadata.isEmpty { - let token = showHudBanner( - scene: scene, - title: NSLocalizedString("_download_in_progress_", comment: "") - ) + let token = showHudBanner(scene: scene, + title: NSLocalizedString("_download_in_progress_", comment: ""), + stage: .button) { + if let downloadRequest { + downloadRequest.cancel() + } + } - // Download missing files for (originalMetadata, localFileURL) in downloadMetadata { guard let metadata = await NCManageDatabase.shared.setMetadataSessionInWaitDownloadAsync( ocId: originalMetadata.ocId, @@ -294,8 +298,8 @@ class NCCreate: NSObject { let results = await NCNetworking.shared.downloadFile( metadata: metadata - ) { _ in - // downloadStartHandler not used here + ) { request in + downloadRequest = request } progressHandler: { progress in Task { @MainActor in LucidBanner.shared.update( From 6934eafd08f9ab95a7d73bfd3ddbcd057d483f6e Mon Sep 17 00:00:00 2001 From: Marino Faggiana Date: Sun, 14 Dec 2025 09:20:42 +0100 Subject: [PATCH 8/8] cod --- .../NCCollectionViewCommon+CollectionViewDelegate.swift | 2 +- iOSClient/Networking/NCNetworking+WebDAV.swift | 2 -- iOSClient/Viewer/NCViewerMedia/NCPlayer/NCPlayerToolBar.swift | 2 +- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/iOSClient/Main/Collection Common/NCCollectionViewCommon+CollectionViewDelegate.swift b/iOSClient/Main/Collection Common/NCCollectionViewCommon+CollectionViewDelegate.swift index b80a4db83a..3f2d134ddc 100644 --- a/iOSClient/Main/Collection Common/NCCollectionViewCommon+CollectionViewDelegate.swift +++ b/iOSClient/Main/Collection Common/NCCollectionViewCommon+CollectionViewDelegate.swift @@ -31,7 +31,7 @@ extension NCCollectionViewCommon: UICollectionViewDelegate { var tokenBanner: Int? await MainActor.run { tokenBanner = showHudBanner(scene: scene, - title: NSLocalizedString("_downloading_", comment: ""), + title: NSLocalizedString("_download_in_progress_", comment: ""), stage: .button, onButtonTap: { if let request = downloadRequest { diff --git a/iOSClient/Networking/NCNetworking+WebDAV.swift b/iOSClient/Networking/NCNetworking+WebDAV.swift index e9c6d1c7d7..fdb2c8428a 100644 --- a/iOSClient/Networking/NCNetworking+WebDAV.swift +++ b/iOSClient/Networking/NCNetworking+WebDAV.swift @@ -376,7 +376,6 @@ extension NCNetworking { if !metadatasE2EE.isEmpty { #if !EXTENSION - if isOffline { return NCContentPresenter().showInfo(error: NKError(errorCode: NCGlobal.shared.errorInternalError, errorDescription: "_offline_not_allowed_")) } @@ -419,7 +418,6 @@ extension NCNetworking { LucidBanner.shared.dismiss() } - #endif } else { var ocIds = Set() diff --git a/iOSClient/Viewer/NCViewerMedia/NCPlayer/NCPlayerToolBar.swift b/iOSClient/Viewer/NCViewerMedia/NCPlayer/NCPlayerToolBar.swift index 92267d3a73..5b138cd7fe 100644 --- a/iOSClient/Viewer/NCViewerMedia/NCPlayer/NCPlayerToolBar.swift +++ b/iOSClient/Viewer/NCViewerMedia/NCPlayer/NCPlayerToolBar.swift @@ -438,7 +438,7 @@ extension NCPlayerToolBar: NCSelectDelegate { } else { var downloadRequest: DownloadRequest? let token = showHudBanner(scene: scene, - title: NSLocalizedString("_downloading_", comment: ""), + title: NSLocalizedString("_download_in_progress_", comment: ""), stage: .button) { if let request = downloadRequest { request.cancel()