Skip to content

Commit 09e63b9

Browse files
committed
- changed account css values to support system dark mode
- moved logo image from the intro screen into the general account view - added navigation bar in account view (visible, if cancel button is visible) - removed title "Account Setup" and app name in branded client
1 parent a686d4c commit 09e63b9

File tree

4 files changed

+65
-57
lines changed

4 files changed

+65
-57
lines changed

ownCloud/App Controllers/AppRootViewController.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,9 @@ open class AppRootViewController: EmbeddingViewController, BrowserNavigationView
121121
noBookmarkCondition = DataSourceCondition(.empty, with: OCBookmarkManager.shared.bookmarksDatasource, initial: true, action: { [weak self] condition in
122122
if condition.fulfilled == true {
123123
// No account available
124-
var configuration = BookmarkComposerConfiguration.newBookmarkConfiguration
124+
let configuration = BookmarkComposerConfiguration.newBookmarkConfiguration
125125
configuration.hasIntro = true
126-
self?.contentViewController = BookmarkSetupViewController(configuration: configuration, headerTitle: "Account setup".localized)
126+
self?.contentViewController = BookmarkSetupViewController(configuration: configuration, headerTitle: nil)
127127
// self?.contentViewController = InitialSetupViewController()
128128
} else {
129129
// Account already available

ownCloud/Bookmarks/Setup/BookmarkSetupViewController.swift

Lines changed: 58 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -77,54 +77,70 @@ class BookmarkSetupViewController: EmbeddingViewController, BookmarkComposerDele
7777
logoImageView.contentMode = .scaleAspectFit
7878
logoImageView.translatesAutoresizingMaskIntoConstraints = false
7979

80-
if let logoImage {
81-
// Keep aspect ratio + scale logo to 90% of available height
82-
logoImageView.widthAnchor.constraint(equalTo: logoImageView.heightAnchor, multiplier: (logoImage.size.width / logoImage.size.height) * 0.9).isActive = true
83-
}
84-
85-
let logoTitle = ThemeCSSLabel(withSelectors: [.title])
86-
logoTitle.translatesAutoresizingMaskIntoConstraints = false
87-
logoTitle.font = .preferredFont(forTextStyle: .title2, with: .bold)
88-
logoTitle.text = headerTitle ?? Branding.shared.appDisplayName
89-
90-
let logoContainerView = UIView()
91-
logoContainerView.translatesAutoresizingMaskIntoConstraints = false
92-
logoContainerView.cssSelector = .header
93-
logoContainerView.addSubview(logoImageView)
94-
logoContainerView.addSubview(logoTitle)
95-
96-
logoContainerView.embedHorizontally(views: [logoImageView, logoTitle], insets: NSDirectionalEdgeInsets(top: 0, leading: 0, bottom: 0, trailing: 0)) { _, _ in
97-
return 10
98-
}
99-
100-
contentView.addSubview(logoContainerView)
101-
102-
NSLayoutConstraint.activate([
103-
logoContainerView.leadingAnchor.constraint(greaterThanOrEqualTo: contentView.safeAreaLayoutGuide.leadingAnchor),
104-
logoContainerView.trailingAnchor.constraint(lessThanOrEqualTo: contentView.safeAreaLayoutGuide.trailingAnchor),
105-
logoContainerView.centerXAnchor.constraint(equalTo: contentView.safeAreaLayoutGuide.centerXAnchor).with(priority: .defaultHigh),
106-
logoContainerView.topAnchor.constraint(equalTo: contentView.safeAreaLayoutGuide.topAnchor, constant: 20),
107-
logoContainerView.heightAnchor.constraint(equalToConstant: 40)
108-
])
109-
11080
// Add cancel button
11181
if cancelHandler != nil {
112-
let cancelButton = ThemeCSSButton(withSelectors: [.cancel])
113-
cancelButton.translatesAutoresizingMaskIntoConstraints = false
114-
cancelButton.setTitle("Cancel".localized, for: .normal)
115-
cancelButton.addAction(UIAction(handler: { [weak self] _ in
82+
let navigationView = UINavigationBar()
83+
navigationView.translatesAutoresizingMaskIntoConstraints = false
84+
85+
let cancelBarButton = UIBarButtonItem(systemItem: .cancel, primaryAction: UIAction(handler: { [weak self] action in
11686
self?.cancel()
117-
}), for: .primaryActionTriggered)
118-
119-
contentView.addSubview(cancelButton)
120-
87+
}))
88+
let navigationItem = UINavigationItem(title: headerTitle ?? Branding.shared.appDisplayName)
89+
navigationItem.rightBarButtonItem = cancelBarButton
90+
navigationView.setItems([navigationItem], animated: false)
91+
92+
contentView.addSubview(navigationView)
93+
contentView.addSubview(logoImageView)
94+
95+
NSLayoutConstraint.activate([
96+
navigationView.topAnchor.constraint(equalTo: contentView.safeAreaLayoutGuide.topAnchor),
97+
navigationView.leadingAnchor.constraint(equalTo: contentView.safeAreaLayoutGuide.leadingAnchor),
98+
navigationView.trailingAnchor.constraint(equalTo: contentView.safeAreaLayoutGuide.trailingAnchor),
99+
100+
logoImageView.widthAnchor.constraint(equalToConstant: 128),
101+
logoImageView.heightAnchor.constraint(equalToConstant: 128),
102+
logoImageView.topAnchor.constraint(equalTo: navigationView.safeAreaLayoutGuide.bottomAnchor, constant: 20.0),
103+
logoImageView.centerXAnchor.constraint(equalTo: contentView.safeAreaLayoutGuide.centerXAnchor)
104+
])
105+
} else {
106+
var title = headerTitle
107+
if !Branding.shared.isBranded, title == "" {
108+
title = Branding.shared.appDisplayName
109+
}
110+
111+
let logoTitle = ThemeCSSLabel(withSelectors: [.title])
112+
logoTitle.translatesAutoresizingMaskIntoConstraints = false
113+
logoTitle.font = .preferredFont(forTextStyle: .title3, with: .bold)
114+
logoTitle.text = title
115+
logoTitle.textAlignment = .center
116+
117+
let logoContainerView = UIView()
118+
logoContainerView.translatesAutoresizingMaskIntoConstraints = false
119+
logoContainerView.cssSelector = .header
120+
logoContainerView.addSubview(logoTitle)
121+
logoContainerView.addSubview(logoImageView)
122+
123+
logoContainerView.embedHorizontally(views: [logoTitle], insets: NSDirectionalEdgeInsets(top: 0, leading: 0, bottom: 0, trailing: 0)) { _, _ in
124+
return 10
125+
}
126+
127+
contentView.addSubview(logoContainerView)
128+
logoContainerView.addSubview(logoImageView)
129+
121130
NSLayoutConstraint.activate([
122-
cancelButton.leadingAnchor.constraint(greaterThanOrEqualTo: logoContainerView.trailingAnchor, constant: 20),
123-
cancelButton.trailingAnchor.constraint(equalTo: contentView.safeAreaLayoutGuide.trailingAnchor, constant: -20),
124-
cancelButton.centerYAnchor.constraint(equalTo: logoContainerView.centerYAnchor)
131+
logoContainerView.leadingAnchor.constraint(greaterThanOrEqualTo: contentView.safeAreaLayoutGuide.leadingAnchor),
132+
logoContainerView.trailingAnchor.constraint(lessThanOrEqualTo: contentView.safeAreaLayoutGuide.trailingAnchor),
133+
logoContainerView.centerXAnchor.constraint(equalTo: contentView.safeAreaLayoutGuide.centerXAnchor).with(priority: .defaultHigh),
134+
logoContainerView.topAnchor.constraint(equalTo: contentView.safeAreaLayoutGuide.topAnchor, constant: 20),
135+
logoContainerView.heightAnchor.constraint(equalToConstant: 40),
136+
137+
logoImageView.widthAnchor.constraint(equalToConstant: 128),
138+
logoImageView.heightAnchor.constraint(equalToConstant: 128),
139+
logoImageView.topAnchor.constraint(equalTo: logoTitle.safeAreaLayoutGuide.bottomAnchor, constant: 20.0),
140+
logoImageView.centerXAnchor.constraint(equalTo: contentView.safeAreaLayoutGuide.centerXAnchor)
125141
])
126142
}
127-
143+
128144
// Add help message
129145
if configuration.helpButtonURL != nil || configuration.helpMessage != nil {
130146
var helpElements: [ComposedMessageElement] = [

ownCloud/Bookmarks/Setup/Steps/BookmarkSetupStepIntroViewController.swift

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,22 +27,13 @@ class BookmarkSetupStepIntroViewController: BookmarkSetupStepViewController {
2727
override func loadView() {
2828
super.loadView()
2929

30-
var logoImage = AccountSettingsProvider.shared.logo
31-
3230
continueButtonLabelText = "Start setup".localized
3331

3432
if hasSettings {
3533
backButtonLabelText = "Settings".localized
3634
}
3735

38-
if let tintImageColor = Theme.shared.activeCollection.css.getThemeCSSColor(.fill, selectors: [.accountSetup, .welcome, .icon]) {
39-
if let tintedLogoImage = logoImage.tinted(with: tintImageColor) {
40-
logoImage = tintedLogoImage
41-
}
42-
}
43-
4436
let messageView = ComposedMessageView(elements: [
45-
.image(logoImage, size: CGSize(width: 128, height: 128), adaptSizeToRatio: true, cssSelectors: [.icon], insets: .zero),
4637
.title(String(format: "Welcome to %@".localized, VendorServices.shared.appName), alignment: .centered, cssSelectors: [.title], insets: NSDirectionalEdgeInsets(top: 10, leading: 0, bottom: 10, trailing: 0)),
4738
.subtitle("The following steps will guide you through the setup process.".localized, alignment: .centered, cssSelectors: [.message])
4839
])

ownCloudAppShared/User Interface/Theme/ThemeCollection.swift

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -690,16 +690,17 @@ public class ThemeCollection : NSObject {
690690
ThemeCSSRecord(selectors: [.accountSetup, .message, .title], property: .stroke, value: UIColor.white),
691691
ThemeCSSRecord(selectors: [.accountSetup, .header, .title], property: .stroke, value: UIColor.white),
692692
ThemeCSSRecord(selectors: [.accountSetup, .welcome, .icon], property: .fill, value: darkBrandColor),
693-
ThemeCSSRecord(selectors: [.accountSetup, .step, .title], property: .stroke, value: UIColor.black),
694-
ThemeCSSRecord(selectors: [.accountSetup, .step, .message], property: .stroke, value: UIColor.lightGray),
695-
ThemeCSSRecord(selectors: [.accountSetup, .step, .background], property: .fill, value: UIColor.white),
693+
ThemeCSSRecord(selectors: [.accountSetup, .step, .title], property: .stroke, value: UIColor.label),
694+
ThemeCSSRecord(selectors: [.accountSetup, .step, .message], property: .stroke, value: UIColor.secondaryLabel),
695+
ThemeCSSRecord(selectors: [.accountSetup, .step, .background], property: .fill, value: UIColor.systemBackground),
696696
ThemeCSSRecord(selectors: [.accountSetup, .step, .button], property: .stroke, value: UIColor.white),
697697
ThemeCSSRecord(selectors: [.accountSetup, .step, .button], property: .fill, value: darkBrandColor),
698698
ThemeCSSRecord(selectors: [.accountSetup, .help, .subtitle], property: .stroke, value: UIColor.lightGray),
699699
ThemeCSSRecord(selectors: [.accountSetup, .help, .button], property: .stroke, value: lightBrandColor),
700700
ThemeCSSRecord(selectors: [.accountSetup, .help, .button], property: .fill, value: UIColor.clear),
701701
ThemeCSSRecord(selectors: [.accountSetup], property: .statusBarStyle, value: UIStatusBarStyle.lightContent),
702-
702+
ThemeCSSRecord(selectors: [.modal, .accountSetup], property: .fill, value: darkBrandColor),
703+
703704
// Side Bar
704705
// - Interface Style
705706
ThemeCSSRecord(selectors: [.sidebar], property: .style, value: UIUserInterfaceStyle.light),

0 commit comments

Comments
 (0)