From 5313248048c377f4588b67c4e4b4230a33de27c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Hu=CC=88hne?= Date: Tue, 11 Jul 2023 11:33:54 +0200 Subject: [PATCH 1/2] removed the logo label from the sidebar navigation bar to have more space for the logo image --- .../ClientSidebarViewController.swift | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/ownCloudAppShared/Client/View Controllers/ClientSidebarViewController.swift b/ownCloudAppShared/Client/View Controllers/ClientSidebarViewController.swift index ed61984a4..0f4da6490 100644 --- a/ownCloudAppShared/Client/View Controllers/ClientSidebarViewController.swift +++ b/ownCloudAppShared/Client/View Controllers/ClientSidebarViewController.swift @@ -218,17 +218,9 @@ extension ClientSidebarViewController { logoImageView.widthAnchor.constraint(equalTo: logoImageView.heightAnchor, multiplier: (logoImage.size.width / logoImage.size.height) * 0.9).isActive = true } - let logoLabel = ThemeCSSLabel() - logoLabel.translatesAutoresizingMaskIntoConstraints = false - logoLabel.text = VendorServices.shared.appName - logoLabel.font = UIFont.systemFont(ofSize: 20, weight: .bold) - logoLabel.setContentCompressionResistancePriority(.required, for: .horizontal) - logoLabel.setContentCompressionResistancePriority(.required, for: .vertical) - let logoContainer = ThemeCSSView(withSelectors: [.logo]) logoContainer.translatesAutoresizingMaskIntoConstraints = false logoContainer.addSubview(logoImageView) - logoContainer.addSubview(logoLabel) logoContainer.setContentHuggingPriority(.required, for: .horizontal) logoContainer.setContentHuggingPriority(.required, for: .vertical) @@ -239,14 +231,7 @@ extension ClientSidebarViewController { logoImageView.topAnchor.constraint(greaterThanOrEqualTo: logoContainer.topAnchor), logoImageView.bottomAnchor.constraint(lessThanOrEqualTo: logoContainer.bottomAnchor), logoImageView.centerYAnchor.constraint(equalTo: logoContainer.centerYAnchor), - logoLabel.topAnchor.constraint(greaterThanOrEqualTo: logoContainer.topAnchor), - logoLabel.bottomAnchor.constraint(lessThanOrEqualTo: logoContainer.bottomAnchor), - logoLabel.centerYAnchor.constraint(equalTo: logoContainer.centerYAnchor), - - logoImageView.leadingAnchor.constraint(equalTo: logoContainer.leadingAnchor), - logoLabel.leadingAnchor.constraint(equalToSystemSpacingAfter: logoImageView.trailingAnchor, multiplier: 1), - logoLabel.trailingAnchor.constraint(equalTo: logoContainer.trailingAnchor), - + logoImageView.centerXAnchor.constraint(equalTo: logoContainer.centerXAnchor), logoContainer.topAnchor.constraint(equalTo: logoWrapperView.topAnchor), logoContainer.bottomAnchor.constraint(equalTo: logoWrapperView.bottomAnchor), logoContainer.centerXAnchor.constraint(equalTo: logoWrapperView.centerXAnchor) From e14352c2aef6f5cd6c288c3a44185a2c9f8b56ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Hu=CC=88hne?= Date: Mon, 24 Jul 2023 09:19:26 +0200 Subject: [PATCH 2/2] - show vendor label in the sidebar if app is unbranded - added accessibility label to the logo image --- .../ClientSidebarViewController.swift | 46 +++++++++++++++---- 1 file changed, 36 insertions(+), 10 deletions(-) diff --git a/ownCloudAppShared/Client/View Controllers/ClientSidebarViewController.swift b/ownCloudAppShared/Client/View Controllers/ClientSidebarViewController.swift index 0f4da6490..a20b5a90e 100644 --- a/ownCloudAppShared/Client/View Controllers/ClientSidebarViewController.swift +++ b/ownCloudAppShared/Client/View Controllers/ClientSidebarViewController.swift @@ -211,13 +211,21 @@ extension ClientSidebarViewController { let logoImage = UIImage(named: "branding-login-logo") let logoImageView = UIImageView(image: logoImage) logoImageView.cssSelector = .icon + logoImageView.accessibilityLabel = VendorServices.shared.appName logoImageView.contentMode = .scaleAspectFit logoImageView.translatesAutoresizingMaskIntoConstraints = false if let logoImage = logoImage { // Keep aspect ratio + scale logo to 90% of available height logoImageView.widthAnchor.constraint(equalTo: logoImageView.heightAnchor, multiplier: (logoImage.size.width / logoImage.size.height) * 0.9).isActive = true } - + + let logoLabel = ThemeCSSLabel() + logoLabel.translatesAutoresizingMaskIntoConstraints = false + logoLabel.text = VendorServices.shared.appName + logoLabel.font = UIFont.systemFont(ofSize: 20, weight: .bold) + logoLabel.setContentCompressionResistancePriority(.required, for: .horizontal) + logoLabel.setContentCompressionResistancePriority(.required, for: .vertical) + let logoContainer = ThemeCSSView(withSelectors: [.logo]) logoContainer.translatesAutoresizingMaskIntoConstraints = false logoContainer.addSubview(logoImageView) @@ -227,15 +235,33 @@ extension ClientSidebarViewController { let logoWrapperView = ThemeCSSView() logoWrapperView.addSubview(logoContainer) - NSLayoutConstraint.activate([ - logoImageView.topAnchor.constraint(greaterThanOrEqualTo: logoContainer.topAnchor), - logoImageView.bottomAnchor.constraint(lessThanOrEqualTo: logoContainer.bottomAnchor), - logoImageView.centerYAnchor.constraint(equalTo: logoContainer.centerYAnchor), - logoImageView.centerXAnchor.constraint(equalTo: logoContainer.centerXAnchor), - logoContainer.topAnchor.constraint(equalTo: logoWrapperView.topAnchor), - logoContainer.bottomAnchor.constraint(equalTo: logoWrapperView.bottomAnchor), - logoContainer.centerXAnchor.constraint(equalTo: logoWrapperView.centerXAnchor) - ]) + if VendorServices.shared.isBranded { + NSLayoutConstraint.activate([ + logoImageView.topAnchor.constraint(greaterThanOrEqualTo: logoContainer.topAnchor), + logoImageView.bottomAnchor.constraint(lessThanOrEqualTo: logoContainer.bottomAnchor), + logoImageView.centerYAnchor.constraint(equalTo: logoContainer.centerYAnchor), + logoImageView.centerXAnchor.constraint(equalTo: logoContainer.centerXAnchor), + logoContainer.topAnchor.constraint(equalTo: logoWrapperView.topAnchor), + logoContainer.bottomAnchor.constraint(equalTo: logoWrapperView.bottomAnchor), + logoContainer.centerXAnchor.constraint(equalTo: logoWrapperView.centerXAnchor) + ]) + } else { + logoContainer.addSubview(logoLabel) + NSLayoutConstraint.activate([ + logoImageView.topAnchor.constraint(greaterThanOrEqualTo: logoContainer.topAnchor), + logoImageView.bottomAnchor.constraint(lessThanOrEqualTo: logoContainer.bottomAnchor), + logoImageView.centerYAnchor.constraint(equalTo: logoContainer.centerYAnchor), + logoLabel.topAnchor.constraint(greaterThanOrEqualTo: logoContainer.topAnchor), + logoLabel.bottomAnchor.constraint(lessThanOrEqualTo: logoContainer.bottomAnchor), + logoLabel.centerYAnchor.constraint(equalTo: logoContainer.centerYAnchor), + logoImageView.leadingAnchor.constraint(equalTo: logoContainer.leadingAnchor), + logoLabel.leadingAnchor.constraint(equalToSystemSpacingAfter: logoImageView.trailingAnchor, multiplier: 1), + logoLabel.trailingAnchor.constraint(equalTo: logoContainer.trailingAnchor), + logoContainer.topAnchor.constraint(equalTo: logoWrapperView.topAnchor), + logoContainer.bottomAnchor.constraint(equalTo: logoWrapperView.bottomAnchor), + logoContainer.centerXAnchor.constraint(equalTo: logoWrapperView.centerXAnchor) + ]) + } logoWrapperView.addThemeApplier({ (_, collection, _) in if !VendorServices.shared.isBranded, let logoColor = collection.css.getColor(.stroke, for: logoImageView) {