Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions Nextcloud.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@
F7381EE1218218C9000B1560 /* NCOffline.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7381EDA218218C9000B1560 /* NCOffline.swift */; };
F7381EE5218218C9000B1560 /* NCOffline.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F7381EDE218218C9000B1560 /* NCOffline.storyboard */; };
F7386E482DA90E0F009A00F6 /* NCAppVersionManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7386E452DA90E02009A00F6 /* NCAppVersionManager.swift */; };
F73BC74F2F23811E003170C2 /* BannerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7DF7B3E2F1A2EE400514020 /* BannerView.swift */; };
F73BC74F2F23811E003170C2 /* WarningBannerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7DF7B3E2F1A2EE400514020 /* WarningBannerView.swift */; };
F73CB3B222E072A000AD728E /* NCShareHeaderView.xib in Resources */ = {isa = PBXBuildFile; fileRef = F73CB3B122E072A000AD728E /* NCShareHeaderView.xib */; };
F73D11FA253C5F4800DF9BEC /* NCViewerNextcloudText.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F73D11F9253C5F4800DF9BEC /* NCViewerNextcloudText.storyboard */; };
F73EF7A72B0223900087E6E9 /* NCManageDatabase+Comments.swift in Sources */ = {isa = PBXBuildFile; fileRef = F73EF7A62B0223900087E6E9 /* NCManageDatabase+Comments.swift */; };
Expand Down Expand Up @@ -850,7 +850,9 @@
F7D7A7712DCDD437003D2007 /* NCManageDatabase+AutoUpload.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7D7A76B2DCDD437003D2007 /* NCManageDatabase+AutoUpload.swift */; };
F7D7A7722DCDD437003D2007 /* NCManageDatabase+AutoUpload.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7D7A76B2DCDD437003D2007 /* NCManageDatabase+AutoUpload.swift */; };
F7D890752BD25C570050B8A6 /* NCCollectionViewCommon+DragDrop.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7D890742BD25C570050B8A6 /* NCCollectionViewCommon+DragDrop.swift */; };
F7DF7B3F2F1A2EF900514020 /* BannerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7DF7B3E2F1A2EE400514020 /* BannerView.swift */; };
F7DA0F662F66AA0D0033020C /* ShowBanner.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7DA0F652F66AA0A0033020C /* ShowBanner.swift */; };
F7DA0F672F66AA0D0033020C /* ShowBanner.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7DA0F652F66AA0A0033020C /* ShowBanner.swift */; };
F7DF7B3F2F1A2EF900514020 /* WarningBannerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7DF7B3E2F1A2EE400514020 /* WarningBannerView.swift */; };
F7DF7B422F1A36C100514020 /* HelperBanner.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7DF7B412F1A36B600514020 /* HelperBanner.swift */; };
F7DF7B432F1A373E00514020 /* HelperBanner.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7DF7B412F1A36B600514020 /* HelperBanner.swift */; };
F7E0710128B13BB00001B882 /* DashboardData.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7E0710028B13BB00001B882 /* DashboardData.swift */; };
Expand Down Expand Up @@ -1779,8 +1781,9 @@
F7D68FCB28CB9051009139F3 /* NCManageDatabase+DashboardWidget.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NCManageDatabase+DashboardWidget.swift"; sourceTree = "<group>"; };
F7D7A76B2DCDD437003D2007 /* NCManageDatabase+AutoUpload.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NCManageDatabase+AutoUpload.swift"; sourceTree = "<group>"; };
F7D890742BD25C570050B8A6 /* NCCollectionViewCommon+DragDrop.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NCCollectionViewCommon+DragDrop.swift"; sourceTree = "<group>"; };
F7DA0F652F66AA0A0033020C /* ShowBanner.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShowBanner.swift; sourceTree = "<group>"; };
F7DE9AB01F482FA5008DFE10 /* sv */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = sv; path = sv.lproj/Localizable.strings; sourceTree = "<group>"; };
F7DF7B3E2F1A2EE400514020 /* BannerView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BannerView.swift; sourceTree = "<group>"; };
F7DF7B3E2F1A2EE400514020 /* WarningBannerView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WarningBannerView.swift; sourceTree = "<group>"; };
F7DF7B412F1A36B600514020 /* HelperBanner.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HelperBanner.swift; sourceTree = "<group>"; };
F7E0710028B13BB00001B882 /* DashboardData.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DashboardData.swift; sourceTree = "<group>"; };
F7E2B64E2DDCC5C30075B4D0 /* NCMedia+TransferDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NCMedia+TransferDelegate.swift"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -2259,9 +2262,10 @@
isa = PBXGroup;
children = (
F72CA05B2F5051DB002E2F06 /* AlertActionBannerView.swift */,
F7DF7B3E2F1A2EE400514020 /* BannerView.swift */,
F74B91E42F51D4100050813D /* InfoBannerView.swift */,
F7DF7B3E2F1A2EE400514020 /* WarningBannerView.swift */,
F74B91E72F51D4510050813D /* ErrorBannerView.swift */,
F7DA0F652F66AA0A0033020C /* ShowBanner.swift */,
F714A1462ED84AF00050A43B /* HudBannerView.swift */,
F70557BB2ED44F1800135623 /* UploadBannerView.swift */,
F7DF7B412F1A36B600514020 /* HelperBanner.swift */,
Expand Down Expand Up @@ -4243,7 +4247,7 @@
F7D4BF302CA2E8D800A5E746 /* TOPasscodeViewControllerAnimatedTransitioning.m in Sources */,
F7D4BF312CA2E8D800A5E746 /* TOPasscodeSettingsViewController.m in Sources */,
F71916122E2901FB00E13E96 /* NCNetworking+Upload.swift in Sources */,
F73BC74F2F23811E003170C2 /* BannerView.swift in Sources */,
F73BC74F2F23811E003170C2 /* WarningBannerView.swift in Sources */,
F7D4BF322CA2E8D800A5E746 /* TOPasscodeCircleImage.m in Sources */,
F7CAFE192F168F6000DB35A5 /* NCDebouncer.swift in Sources */,
F7D4BF332CA2E8D800A5E746 /* TOPasscodeView.m in Sources */,
Expand Down Expand Up @@ -4310,6 +4314,7 @@
F76D364728A4F8BF00214537 /* NCActivityIndicator.swift in Sources */,
F749B654297B0F2400087535 /* NCManageDatabase+Avatar.swift in Sources */,
AF22B208277B4E4C00DAB0CC /* NCCreateFormUploadConflictCell.swift in Sources */,
F7DA0F662F66AA0D0033020C /* ShowBanner.swift in Sources */,
F73EF7C22B02250B0087E6E9 /* NCManageDatabase+GPS.swift in Sources */,
F7148041262EBE4000693E51 /* NCShareExtension.swift in Sources */,
F71FA7992F3508C600E86192 /* NCNetworking+WebDAV.swift in Sources */,
Expand Down Expand Up @@ -4450,7 +4455,7 @@
F733598125C1C188002ABA72 /* NCAskAuthorization.swift in Sources */,
370D26AF248A3D7A00121797 /* NCCellMain.swift in Sources */,
F32FADA92D1176E3007035E2 /* UIButton+Extension.swift in Sources */,
F7DF7B3F2F1A2EF900514020 /* BannerView.swift in Sources */,
F7DF7B3F2F1A2EF900514020 /* WarningBannerView.swift in Sources */,
F768822C2C0DD1E7001CF441 /* NCPreferences.swift in Sources */,
F7CAFE1D2F17A35F00DB35A5 /* NCNetworking+Actor.swift in Sources */,
F71CD6CA2930D7B1006C95C1 /* NCApplicationHandle.swift in Sources */,
Expand Down Expand Up @@ -4757,6 +4762,7 @@
F7F563042E15762B00631A11 /* MigrationMultiDomains.swift in Sources */,
F75CA1472962F13700B01130 /* NCHUDView.swift in Sources */,
F77BB748289985270090FC19 /* UITabBarController+Extension.swift in Sources */,
F7DA0F672F66AA0D0033020C /* ShowBanner.swift in Sources */,
F752BA052E58C05200616A26 /* Maintenance.swift in Sources */,
F763D29D2A249C4500A3C901 /* NCManageDatabase+Capabilities.swift in Sources */,
F76882252C0DD1E7001CF441 /* NCSettingsAdvancedModel.swift in Sources */,
Expand Down
6 changes: 0 additions & 6 deletions Share/NCShareExtension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -379,14 +379,8 @@ extension NCShareExtension {
guard let window = self.view.window else {
return
}
let horizontalLayout = horizontalLayoutBanner(bounds: window.bounds,
safeAreaInsets: window.safeAreaInsets,
idiom: window.traitCollection.userInterfaceIdiom)

let payload = LucidBannerPayload(stage: .button,
backgroundColor: Color(.systemBackground),
vPosition: .center,
horizontalLayout: horizontalLayout,
blocksTouches: true)
(banner, token) = showUploadBanner(windowScene: window.windowScene,
payload: payload,
Expand Down
26 changes: 9 additions & 17 deletions iOSClient/GUI/Lucid Banner/ErrorBannerView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,9 @@ func showErrorBanner(windowScene: UIWindowScene?,
title: String = "_error_",
text: String,
footnote: String? = nil,
foregroundColor: UIColor = .white,
backgroundColor: UIColor = .red,
sleepBefore: Double = 1,
errorCode: Int,
errorCode: Int? = nil,
afError: AFError? = nil) async {
guard let windowScene else {
guard let windowScene, let window = windowScene.windows.first else {
return
}

Expand All @@ -37,25 +34,20 @@ func showErrorBanner(windowScene: UIWindowScene?,
#endif

let banner = LucidBannerRegistry.shared.banner(for: windowScene)

guard let window = banner.windowScene.windows.first else {
return
}

let horizontalLayout = horizontalLayoutBanner(bounds: window.bounds,
safeAreaInsets: window.safeAreaInsets,
idiom: window.traitCollection.userInterfaceIdiom)

try? await Task.sleep(for: .seconds(sleepBefore))
try? await Task.sleep(for: .seconds(0.5))

let payload = LucidBannerPayload(
title: NSLocalizedString(title, comment: ""),
subtitle: NSLocalizedString(text, comment: ""),
footnote: NSLocalizedString(footnote ?? "", comment: ""),
systemImage: "xmark.circle.fill",
backgroundColor: Color(uiColor: backgroundColor),
textColor: Color(uiColor: foregroundColor),
imageColor: .white,
backgroundColor: Color(.systemBackground).opacity(0.4),
textColor: Color(uiColor: .label),
imageColor: Color(uiColor: .red),
vPosition: .top,
verticalMargin: 10,
horizontalLayout: horizontalLayout,
Expand Down Expand Up @@ -145,9 +137,9 @@ struct ErrorBannerView: View {
subtitle: "Subtitle",
footnote: "footnote",
systemImage: "xmark.circle.fill",
backgroundColor: .red,
textColor: .white,
imageColor: .white
backgroundColor: Color(UIColor.red.withAlphaComponent(0.12)),
textColor: Color(uiColor: .label),
imageColor: Color(uiColor: .red)
)
)

Expand Down
2 changes: 1 addition & 1 deletion iOSClient/GUI/Lucid Banner/HelperBanner.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public extension View {
.fill(backgroundColor)
.id(backgroundColor)
)
.glassEffect(.clear, in: RoundedRectangle(cornerRadius: cornerRadius))
.glassEffect(.regular, in: RoundedRectangle(cornerRadius: cornerRadius))
.shadow(color: .black.opacity(0.5), radius: 10, x: 0, y: 4)
.frame(maxWidth: .infinity, alignment: .center)

Expand Down
2 changes: 1 addition & 1 deletion iOSClient/GUI/Lucid Banner/HudBannerView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ struct HudBannerView: View {
@ViewBuilder
func hudContainerView<Content: View>(@ViewBuilder _ content: () -> Content) -> some View {
let cornerRadius: CGFloat = 22
let backgroundColor = Color(.systemBackground).opacity(0.9)
let backgroundColor = Color(.systemBackground).opacity(0.7)

if #available(iOS 26, *) {
content()
Expand Down
19 changes: 6 additions & 13 deletions iOSClient/GUI/Lucid Banner/InfoBannerView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,8 @@ func showInfoBanner(windowScene: UIWindowScene?,
title: String = "_info_",
text: String,
footnote: String? = nil,
foregroundColor: UIColor = .label,
backgroundColor: UIColor = .systemBackground,
errorCode: Int? = nil) async {
guard let windowScene else {
guard let windowScene, let window = windowScene.windows.first else {
return
}

Expand All @@ -26,11 +24,6 @@ func showInfoBanner(windowScene: UIWindowScene?,
#endif

let banner = LucidBannerRegistry.shared.banner(for: windowScene)

guard let window = banner.windowScene.windows.first else {
return
}

let horizontalLayout = horizontalLayoutBanner(bounds: window.bounds,
safeAreaInsets: window.safeAreaInsets,
idiom: window.traitCollection.userInterfaceIdiom)
Expand All @@ -40,9 +33,9 @@ func showInfoBanner(windowScene: UIWindowScene?,
subtitle: NSLocalizedString(text, comment: ""),
footnote: NSLocalizedString(footnote ?? "", comment: ""),
systemImage: "checkmark.circle",
backgroundColor: Color(uiColor: backgroundColor),
textColor: Color(uiColor: foregroundColor),
imageColor: Color(uiColor: NCBrandColor.shared.customer),
backgroundColor: Color(.systemBackground).opacity(0.4),
textColor: Color(uiColor: .label),
imageColor: Color(uiColor: .systemBlue),
vPosition: .top,
verticalMargin: 10,
horizontalLayout: horizontalLayout,
Expand Down Expand Up @@ -132,9 +125,9 @@ struct InfoBannerView: View {
subtitle: "Subtitle",
footnote: "footnote",
systemImage: "checkmark.circle",
backgroundColor: Color(uiColor: .systemBackground),
backgroundColor: Color(UIColor.systemBlue.withAlphaComponent(0.12)),
textColor: Color(uiColor: .label),
imageColor: Color(uiColor: NCBrandColor.shared.customer)
imageColor: Color(uiColor: .systemBlue)
)
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,42 +8,61 @@
import Alamofire

// MARK: - Show Banner

@discardableResult
@MainActor
func showBanner(windowScene: UIWindowScene?,
title: String?,
subtitle: String? = nil,
footnote: String? = nil,
textColor: UIColor,
image: String?,
systemImage: String?,
imageAnimation: LucidBanner.LucidBannerAnimationStyle,
backgroundColor: UIColor = .systemBackground.withAlphaComponent(0.4),
textColor: UIColor = .label,
imageColor: UIColor,
vPosition: LucidBanner.VerticalPosition = .top,
backgroundColor: UIColor,
verticalMargin: CGFloat = 10,
autoDismissAfter: TimeInterval = NCGlobal.shared.dismissAfterSecond,
swipeToDismiss: Bool = true,
policy: LucidBanner.ShowPolicy = .replace) async -> (banner: LucidBanner?, token: Int?) {
guard let windowScene else {
policy: LucidBanner.ShowPolicy = .replace,
errorCode: Int? = nil) async -> (banner: LucidBanner?, token: Int?) {
guard let windowScene, let window = windowScene.windows.first else {
return(nil, nil)
}

#if !EXTENSION
guard !bannerContainsError(errorCode: errorCode) else {
return (nil, nil)
}
#endif

let banner = LucidBannerRegistry.shared.banner(for: windowScene)
let horizontalLayout = horizontalLayoutBanner(bounds: window.bounds,
safeAreaInsets: window.safeAreaInsets,
idiom: window.traitCollection.userInterfaceIdiom)

let payload = LucidBannerPayload(
title: NSLocalizedString(title ?? "", comment: ""),
subtitle: NSLocalizedString(subtitle ?? "", comment: ""),
footnote: NSLocalizedString(footnote ?? "", comment: ""),
systemImage: image,
systemImage: systemImage,
imageAnimation: imageAnimation,
backgroundColor: Color(uiColor: backgroundColor),
textColor: Color(uiColor: textColor),
imageColor: Color(uiColor: imageColor),
vPosition: vPosition,
verticalMargin: verticalMargin,
horizontalLayout: horizontalLayout,
autoDismissAfter: autoDismissAfter,
swipeToDismiss: swipeToDismiss
)

let banner = LucidBannerRegistry.shared.banner(for: windowScene)

let token = banner.show(payload: payload, policy: policy) { state in
let token = banner.show(
payload: payload,
policy: policy,
onTap: { _, _ in
}
) { state in
BannerView(state: state)
}

Expand Down Expand Up @@ -104,7 +123,7 @@

// MARK: - Preview

#Preview {
#Preview("maintenance mode") {
ZStack {
Text(
Array(0...500)
Expand All @@ -117,14 +136,46 @@

let state = LucidBannerState(
payload: LucidBannerPayload(
title: "Title",
subtitle: "Subtitle",
footnote: "footnote",
systemImage: "wifi.circle"
title: "_warning_",
subtitle: "_maintenance_mode_",
systemImage: "xmark.icloud.fill",
imageAnimation: .none,
backgroundColor: Color(UIColor.systemOrange.withAlphaComponent(0.12)),
textColor: Color(uiColor: .label),
imageColor: Color(uiColor: .systemOrange),
)
)

BannerView(state: state)
.padding()
}
}

#Preview("creating db photo") {
ZStack {
Text(
Array(0...500)
.map(String.init)
.joined(separator: " ")
)
.font(.system(size: 16, design: .monospaced))
.foregroundStyle(.primary)
.padding()

let state = LucidBannerState(
payload: LucidBannerPayload(
title: "_info_",
subtitle: "_creating_db_photo_progress_",
systemImage: "photo.on.rectangle.angled",
imageAnimation: .none,
backgroundColor: Color(UIColor.systemBlue.withAlphaComponent(0.12)),
textColor: Color(uiColor: .label),
imageColor: Color(uiColor: .systemBlue),
)
)

BannerView(state: state)
.padding()
}
}

Check warning on line 181 in iOSClient/GUI/Lucid Banner/ShowBanner.swift

View workflow job for this annotation

GitHub Actions / Lint

Trailing Newline Violation: Files should have a single trailing newline (trailing_newline)
9 changes: 8 additions & 1 deletion iOSClient/GUI/Lucid Banner/UploadBannerView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,18 @@ func showUploadBanner(windowScene: UIWindowScene?,
payload: LucidBannerPayload,
allowMinimizeOnTap: Bool,
onButtonTap: (() -> Void)? = nil) -> (banner: LucidBanner?, token: Int?) {
guard let windowScene else {
guard let windowScene, let window = windowScene.windows.first else {
return (nil, nil)
}
let horizontalLayout = horizontalLayoutBanner(bounds: window.bounds,
safeAreaInsets: window.safeAreaInsets,
idiom: window.traitCollection.userInterfaceIdiom)
let banner = LucidBannerRegistry.shared.banner(for: windowScene)
let bannerCoordinator = LucidBannerVariantCoordinator(banner: banner)
var payload = payload

payload.backgroundColor = Color(.systemBackground).opacity(0.4)
payload.horizontalLayout = horizontalLayout

let token = banner.show(
payload: payload,
Expand Down
Loading
Loading