Skip to content

Commit

Permalink
[feature/theme-dark-web] New Dark Mode Themes (#1145)
Browse files Browse the repository at this point in the history
  • Loading branch information
hosy authored Sep 12, 2022
1 parent 6abb59d commit 82af097
Show file tree
Hide file tree
Showing 9 changed files with 70 additions and 15 deletions.
30 changes: 30 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,33 @@
Changelog for ownCloud iOS Client [unreleased] (UNRELEASED)
=======================================
The following sections list the changes in ownCloud iOS Client unreleased relevant to
ownCloud admins and users.

[unreleased]: https://github.com/owncloud/ios-app/compare/milestone/11.10.1...master

Summary
-------

* Bugfix - Updating Theme: [#1141](https://github.com/owncloud/ios-app/issues/1141)
* Change - New Dark Mode Themes: [#1146](https://github.com/owncloud/ios-app/issues/1146)

Details
-------

* Bugfix - Updating Theme: [#1141](https://github.com/owncloud/ios-app/issues/1141)

Fixes a bug when a new theme was activated, this causes that the UITabBar and UIToolbar does not
updates colours.

https://github.com/owncloud/ios-app/issues/1141

* Change - New Dark Mode Themes: [#1146](https://github.com/owncloud/ios-app/issues/1146)

Adds a new dark mode theme which is mostly equal to the web UI dark mode theme. Furthermore it adds
a black dark mode theme.

https://github.com/owncloud/ios-app/issues/1146

Changelog for ownCloud iOS Client [11.10.1] (2022-08-02)
=======================================
The following sections list the changes in ownCloud iOS Client 11.10.1 relevant to
Expand Down
5 changes: 5 additions & 0 deletions changelog/unreleased/1141
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Bugfix: Updating Theme

Fixes a bug when a new theme was activated, this causes that the UITabBar and UIToolbar does not updates colours.

https://github.com/owncloud/ios-app/issues/1141
5 changes: 5 additions & 0 deletions changelog/unreleased/1146
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Change: New Dark Mode Themes

Adds a new dark mode theme which is mostly equal to the web UI dark mode theme. Furthermore it adds a black dark mode theme.

https://github.com/owncloud/ios-app/issues/1146
3 changes: 1 addition & 2 deletions ownCloud/Client/ClientRootViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -495,8 +495,7 @@ class ClientRootViewController: UITabBarController, BookmarkContainer, ToolAndTa
extension ClientRootViewController : Themeable {
func applyThemeCollection(theme: Theme, collection: ThemeCollection, event: ThemeEvent) {
self.tabBar.applyThemeCollection(collection)

self.toolbar?.applyThemeCollection(Theme.shared.activeCollection)
self.toolbar?.applyThemeCollection(collection)

self.view.backgroundColor = collection.tableBackgroundColor
}
Expand Down
2 changes: 2 additions & 0 deletions ownCloud/Resources/en.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,8 @@
"Theme" = "Theme";
"User Interface" = "User Interface";
"Dark" = "Dark";
"Dark Blue" = "Dark Blue";
"Dark Web" = "Dark Web";
"Light" = "Light";
"Classic" = "Classic";
"System" = "System";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,8 @@ public extension NSObject {
if #available(iOS 15, *) {
let appearance = UIToolbarAppearance()
appearance.backgroundColor = collection.toolbarColors.backgroundColor
UIToolbar.appearance().standardAppearance = appearance
UIToolbar.appearance().scrollEdgeAppearance = appearance
toolbar.standardAppearance = appearance
toolbar.scrollEdgeAppearance = appearance
} else {
toolbar.barTintColor = collection.toolbarColors.backgroundColor
}
Expand All @@ -149,8 +149,8 @@ public extension NSObject {
if #available(iOS 15, *) {
let appearance = UITabBarAppearance()
appearance.backgroundColor = collection.toolbarColors.backgroundColor
UITabBar.appearance().standardAppearance = appearance
UITabBar.appearance().scrollEdgeAppearance = appearance
tabBar.standardAppearance = appearance
tabBar.scrollEdgeAppearance = appearance
} else {
tabBar.barTintColor = collection.toolbarColors.backgroundColor
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ import ownCloudSDK
// MARK: - ownCloud brand colors
extension UIColor {
static var ownCloudLightColor : UIColor { return UIColor(hex: 0x4E85C8) }
static var ownCloudDarkColor : UIColor { return UIColor(hex: 0x041E42) }
static var ownCloudDarkColor : UIColor { return UIColor(hex: 0x041E42) }
static var ownCloudWebDarkColor : UIColor { return UIColor(hex: 0x292929) }
static var ownCloudWebDarkLabelColor : UIColor { return UIColor(hex: 0xDADCDF) }
static var ownCloudWebDarkFolderColor : UIColor { return UIColor(red: 44, green: 101, blue: 255) }
}

extension ThemeStyle {
Expand All @@ -31,10 +34,18 @@ extension ThemeStyle {
}

static public var ownCloudDark : ThemeStyle {
return (ThemeStyle(styleIdentifier: "com.owncloud.dark", localizedName: "Dark".localized, lightColor: .ownCloudLightColor, darkColor: .ownCloudDarkColor, themeStyle: .dark))
}

static public var ownCloudClassic : ThemeStyle {
return (ThemeStyle(styleIdentifier: "com.owncloud.classic", darkStyleIdentifier: "com.owncloud.dark", localizedName: "Classic".localized, lightColor: .ownCloudLightColor, darkColor: .ownCloudDarkColor, themeStyle: .contrast))
return (ThemeStyle(styleIdentifier: "com.owncloud.dark", localizedName: "Dark Blue".localized, lightColor: .ownCloudLightColor, darkColor: .ownCloudDarkColor, themeStyle: .dark))
}

static public var ownCloudWebDark : ThemeStyle {
return (ThemeStyle(styleIdentifier: "com.owncloud.web.dark", darkStyleIdentifier: "com.owncloud.web.dark", localizedName: "Dark Web".localized, lightColor: .ownCloudWebDarkLabelColor, darkColor: .ownCloudWebDarkColor, themeStyle: .dark, customColors: ["Icon.folderFillColor" : UIColor.ownCloudWebDarkFolderColor.hexString()]))
}

static public var ownCloudDarkBlack : ThemeStyle {
return (ThemeStyle(styleIdentifier: "com.owncloud.dark.black", darkStyleIdentifier: "com.owncloud.dark.black", localizedName: "Dark Black".localized, lightColor: .lightGray, darkColor: .black, themeStyle: .dark, customColors: ["Icon.folderFillColor" : UIColor.ownCloudWebDarkFolderColor.hexString(), "Toolbar.tintColor" : UIColor.white.hexString(), "NavigationBar.tintColor" : UIColor(white: 0.888, alpha: 1.0) .hexString()]))
}

static public var ownCloudClassic : ThemeStyle {
return (ThemeStyle(styleIdentifier: "com.owncloud.classic", darkStyleIdentifier: "com.owncloud.dark", localizedName: "Classic".localized, lightColor: .ownCloudLightColor, darkColor: .ownCloudDarkColor, themeStyle: .contrast))
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,10 @@ extension ThemeStyle {
static public func registerDefaultStyles() {
if !Branding.shared.setupThemeStyles() {
OCExtensionManager.shared.addExtension(ThemeStyle.ownCloudLight.themeStyleExtension())
OCExtensionManager.shared.addExtension(ThemeStyle.ownCloudDark.themeStyleExtension(isDefault: true))
OCExtensionManager.shared.addExtension(ThemeStyle.ownCloudClassic.themeStyleExtension())
OCExtensionManager.shared.addExtension(ThemeStyle.ownCloudWebDark.themeStyleExtension(isDefault: true))
OCExtensionManager.shared.addExtension(ThemeStyle.ownCloudDark.themeStyleExtension())
OCExtensionManager.shared.addExtension(ThemeStyle.ownCloudDarkBlack.themeStyleExtension())
OCExtensionManager.shared.addExtension(ThemeStyle.ownCloudClassic.themeStyleExtension())
}
}

Expand Down
3 changes: 2 additions & 1 deletion ownCloudTests/SettingsTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,8 @@ class SettingsTests: XCTestCase {
EarlGrey.selectElement(with: grey_accessibilityID("theme")).perform(grey_tap())

//Assert
EarlGrey.selectElement(with: grey_text("Dark".localized)).assert(grey_sufficientlyVisible())
EarlGrey.selectElement(with: grey_text("Dark Blue".localized)).assert(grey_sufficientlyVisible())
EarlGrey.selectElement(with: grey_text("Dark Web".localized)).assert(grey_sufficientlyVisible())
EarlGrey.selectElement(with: grey_text("Light".localized)).assert(grey_sufficientlyVisible())
EarlGrey.selectElement(with: grey_text("Classic".localized)).assert(grey_sufficientlyVisible())

Expand Down

0 comments on commit 82af097

Please sign in to comment.