From 345f95f664950d7a26a7b8e74fa3b16e3bd3fcfd Mon Sep 17 00:00:00 2001 From: Chris Brind Date: Fri, 3 Nov 2023 14:07:34 +0000 Subject: [PATCH] design system tweaks --- ...essBarPositionSettingsViewController.swift | 1 - .../AutoClearSettingsViewController.swift | 1 - DuckDuckGo/AutocompleteViewController.swift | 4 +--- ...ofillLoginSettingsListViewController.swift | 15 ++++++++++++ DuckDuckGo/BookmarksViewControllerCells.swift | 2 -- DuckDuckGo/DarkTheme.swift | 1 + DuckDuckGo/FeedbackPickerViewController.swift | 1 - ...uttonAnimationSettingsViewController.swift | 1 - DuckDuckGo/LightTheme.swift | 1 + DuckDuckGo/SettingsViewController.swift | 1 - DuckDuckGo/Theme+DesignSystem.swift | 5 ++-- DuckDuckGo/Theme.swift | 24 ++----------------- DuckDuckGo/ThemeSettingsViewController.swift | 1 - .../UnprotectedSitesViewController.swift | 1 - 14 files changed, 22 insertions(+), 37 deletions(-) diff --git a/DuckDuckGo/AddressBarPositionSettingsViewController.swift b/DuckDuckGo/AddressBarPositionSettingsViewController.swift index b7df80ab5e..34d8a466f4 100644 --- a/DuckDuckGo/AddressBarPositionSettingsViewController.swift +++ b/DuckDuckGo/AddressBarPositionSettingsViewController.swift @@ -43,7 +43,6 @@ class AddressBarPositionSettingsViewController: UITableViewController { override func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) { let theme = ThemeManager.shared.currentTheme cell.backgroundColor = theme.tableCellBackgroundColor - cell.setHighlightedStateBackgroundColor(theme.tableCellHighlightedBackgroundColor) cell.tintColor = theme.buttonTintColor cell.textLabel?.textColor = theme.tableCellTextColor diff --git a/DuckDuckGo/AutoClearSettingsViewController.swift b/DuckDuckGo/AutoClearSettingsViewController.swift index f46a1ccf1d..6f4363ff2d 100644 --- a/DuckDuckGo/AutoClearSettingsViewController.swift +++ b/DuckDuckGo/AutoClearSettingsViewController.swift @@ -114,7 +114,6 @@ class AutoClearSettingsViewController: UITableViewController { let theme = ThemeManager.shared.currentTheme cell.backgroundColor = theme.tableCellBackgroundColor - cell.setHighlightedStateBackgroundColor(theme.tableCellHighlightedBackgroundColor) // Checkmark color cell.tintColor = theme.buttonTintColor diff --git a/DuckDuckGo/AutocompleteViewController.swift b/DuckDuckGo/AutocompleteViewController.swift index cc13fc7ead..caa9e5b35a 100644 --- a/DuckDuckGo/AutocompleteViewController.swift +++ b/DuckDuckGo/AutocompleteViewController.swift @@ -237,8 +237,7 @@ extension AutocompleteViewController: UITableViewDataSource { cell.backgroundColor = backgroundColor cell.tintColor = currentTheme.autocompleteCellAccessoryColor - cell.setHighlightedStateBackgroundColor(currentTheme.tableCellHighlightedBackgroundColor) - + return cell } @@ -255,7 +254,6 @@ extension AutocompleteViewController: UITableViewDataSource { cell.tintColor = currentTheme.autocompleteCellAccessoryColor cell.label?.textColor = currentTheme.tableCellTextColor - cell.setHighlightedStateBackgroundColor(currentTheme.tableCellHighlightedBackgroundColor) return cell } diff --git a/DuckDuckGo/AutofillLoginSettingsListViewController.swift b/DuckDuckGo/AutofillLoginSettingsListViewController.swift index 2055e7b03f..313cfb6b84 100644 --- a/DuckDuckGo/AutofillLoginSettingsListViewController.swift +++ b/DuckDuckGo/AutofillLoginSettingsListViewController.swift @@ -524,6 +524,21 @@ extension AutofillLoginSettingsListViewController: UITableViewDelegate { return 0 } } + + func tableView(_ tableView: UITableView, willDisplayHeaderView view: UIView, forSection: Int) { + if let view = view as? UITableViewHeaderFooterView { + let theme = ThemeManager.shared.currentTheme + view.textLabel?.textColor = theme.tableHeaderTextColor + } + } + + func tableView(_ tableView: UITableView, willDisplayFooterView view: UIView, forSection: Int) { + if let view = view as? UITableViewHeaderFooterView { + let theme = ThemeManager.shared.currentTheme + view.textLabel?.textColor = theme.tableHeaderTextColor + } + } + } // MARK: UITableViewDataSource diff --git a/DuckDuckGo/BookmarksViewControllerCells.swift b/DuckDuckGo/BookmarksViewControllerCells.swift index 7cb16c799b..27b231fe19 100644 --- a/DuckDuckGo/BookmarksViewControllerCells.swift +++ b/DuckDuckGo/BookmarksViewControllerCells.swift @@ -76,7 +76,6 @@ class BookmarksViewControllerCellFactory { let theme = ThemeManager.shared.currentTheme cell.backgroundColor = theme.tableCellBackgroundColor cell.titleLabel.textColor = theme.tableCellTextColor - cell.setHighlightedStateBackgroundColor(theme.tableCellHighlightedBackgroundColor) cell.favoriteImageView.tintColor = UIColor(designSystemColor: .icons) cell.editingAccessoryType = .disclosureIndicator return cell @@ -91,7 +90,6 @@ class BookmarksViewControllerCellFactory { cell.backgroundColor = theme.tableCellBackgroundColor cell.titleLabel.textColor = theme.tableCellTextColor cell.childrenCountLabel.textColor = theme.tableCellTextColor - cell.setHighlightedStateBackgroundColor(theme.tableCellHighlightedBackgroundColor) cell.editingAccessoryType = .disclosureIndicator return cell } diff --git a/DuckDuckGo/DarkTheme.swift b/DuckDuckGo/DarkTheme.swift index ade0da0e5a..6ca267eba7 100644 --- a/DuckDuckGo/DarkTheme.swift +++ b/DuckDuckGo/DarkTheme.swift @@ -61,4 +61,5 @@ struct DarkTheme: Theme { var destructiveColor: UIColor = UIColor.destructive + var searchBarBackgroundColor: UIColor = UIColor.charcoalGrey } diff --git a/DuckDuckGo/FeedbackPickerViewController.swift b/DuckDuckGo/FeedbackPickerViewController.swift index 898f0d095a..96169a4169 100644 --- a/DuckDuckGo/FeedbackPickerViewController.swift +++ b/DuckDuckGo/FeedbackPickerViewController.swift @@ -117,7 +117,6 @@ class FeedbackPickerViewController: UITableViewController { let theme = ThemeManager.shared.currentTheme cell.backgroundColor = theme.tableCellBackgroundColor cell.textLabel?.textColor = theme.tableCellTextColor - cell.setHighlightedStateBackgroundColor(theme.tableCellHighlightedBackgroundColor) let text = cell.textLabel?.attributedText?.mutableCopy() as? NSMutableAttributedString text?.mutableString.setString(entries[indexPath.row].userText) diff --git a/DuckDuckGo/FireButtonAnimationSettingsViewController.swift b/DuckDuckGo/FireButtonAnimationSettingsViewController.swift index b96853515e..94b2ae8cd9 100644 --- a/DuckDuckGo/FireButtonAnimationSettingsViewController.swift +++ b/DuckDuckGo/FireButtonAnimationSettingsViewController.swift @@ -49,7 +49,6 @@ class FireButtonAnimationSettingsViewController: UITableViewController { let theme = ThemeManager.shared.currentTheme cell.backgroundColor = theme.tableCellBackgroundColor - cell.setHighlightedStateBackgroundColor(theme.tableCellHighlightedBackgroundColor) // Checkmark color cell.tintColor = theme.buttonTintColor diff --git a/DuckDuckGo/LightTheme.swift b/DuckDuckGo/LightTheme.swift index 0787e77758..7c90ed2b5d 100644 --- a/DuckDuckGo/LightTheme.swift +++ b/DuckDuckGo/LightTheme.swift @@ -61,4 +61,5 @@ struct LightTheme: Theme { var destructiveColor: UIColor = UIColor.destructive + var searchBarBackgroundColor: UIColor = UIColor.lightGreyish } diff --git a/DuckDuckGo/SettingsViewController.swift b/DuckDuckGo/SettingsViewController.swift index 7bbbbb048a..a558d15059 100644 --- a/DuckDuckGo/SettingsViewController.swift +++ b/DuckDuckGo/SettingsViewController.swift @@ -489,7 +489,6 @@ class SettingsViewController: UITableViewController { override func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) { let theme = ThemeManager.shared.currentTheme cell.backgroundColor = theme.tableCellBackgroundColor - cell.setHighlightedStateBackgroundColor(theme.tableCellHighlightedBackgroundColor) } override func tableView(_ tableView: UITableView, willDisplayHeaderView view: UIView, forSection: Int) { diff --git a/DuckDuckGo/Theme+DesignSystem.swift b/DuckDuckGo/Theme+DesignSystem.swift index 0f4fef68a7..d479b09cb4 100644 --- a/DuckDuckGo/Theme+DesignSystem.swift +++ b/DuckDuckGo/Theme+DesignSystem.swift @@ -74,19 +74,18 @@ extension Theme { var daxDialogTextColor: UIColor { UIColor(designSystemColor: .textPrimary) } var placeholderColor: UIColor { UIColor(designSystemColor: .textSecondary) } - - var searchBarBackgroundColor: UIColor { UIColor(designSystemColor: .container) } var searchBarTextColor: UIColor { UIColor(designSystemColor: .textPrimary) } var navigationBarTitleColor: UIColor { UIColor(designSystemColor: .textPrimary) } var tableHeaderTextColor: UIColor {UIColor(designSystemColor: .textSecondary) } var faviconBackgroundColor: UIColor { UIColor(designSystemColor: .surface) } - var tableCellTextColor: UIColor { UIColor(designSystemColor: .textPrimary) } var favoriteTextColor: UIColor { UIColor(designSystemColor: .textSecondary) } var aboutScreenTextColor: UIColor { UIColor(designSystemColor: .textPrimary) } var autocompleteSuggestionTextColor: UIColor { UIColor(designSystemColor: .textPrimary) } + + var tableCellTextColor: UIColor { UIColor(designSystemColor: .textPrimary) } var tableCellSeparatorColor: UIColor { UIColor(designSystemColor: .lines) } // No design system colour yet, so fall back to SDK colours diff --git a/DuckDuckGo/Theme.swift b/DuckDuckGo/Theme.swift index ae14a93049..e145c51444 100644 --- a/DuckDuckGo/Theme.swift +++ b/DuckDuckGo/Theme.swift @@ -46,19 +46,11 @@ protocol Theme { var navigationBarTitleColor: UIColor { get } var navigationBarTintColor: UIColor { get } - // Color of the content that is directly placed over blurred background -// var tintOnBlurColor: UIColor { get } - var searchBarBackgroundColor: UIColor { get } - // var centeredSearchBarBackgroundColor: UIColor { get } var searchBarTextColor: UIColor { get } var searchBarTextPlaceholderColor: UIColor { get } var searchBarTextDeemphasisColor: UIColor { get } -// var searchBarBorderColor: UIColor { get } -// var searchBarVoiceSearchIconColor: UIColor { get } -// var searchBarClearTextIconColor: UIColor { get } - var browsingMenuTextColor: UIColor { get } var browsingMenuIconsColor: UIColor { get } var browsingMenuBackgroundColor: UIColor { get } @@ -103,17 +95,13 @@ protocol Theme { var aboutScreenTextColor: UIColor { get } var aboutScreenButtonColor: UIColor { get } -// var favoritesPlusTintColor: UIColor { get } -// var favoritesPlusBackgroundColor: UIColor { get } var faviconBackgroundColor: UIColor { get } var favoriteTextColor: UIColor { get } var feedbackPrimaryTextColor: UIColor { get } var feedbackSecondaryTextColor: UIColor { get } var feedbackSentimentButtonBackgroundColor: UIColor { get } - -// var privacyReportCellBackgroundColor: UIColor { get } - + var activityStyle: UIActivityIndicatorView.Style { get } var destructiveColor: UIColor { get } @@ -122,15 +110,7 @@ protocol Theme { var daxDialogBackgroundColor: UIColor { get } var daxDialogTextColor: UIColor { get } - -// var homeMessageBackgroundColor: UIColor { get } -// var homeMessageHeaderTextColor: UIColor { get } -// var homeMessageSubheaderTextColor: UIColor { get } -// var homeMessageTopTextColor: UIColor { get } -// var homeMessageButtonColor: UIColor { get } -// var homeMessageButtonTextColor: UIColor { get } -// var homeMessageDismissButtonColor: UIColor { get } - + var autofillEmptySearchViewTextColor: UIColor { get } var autofillLockedViewTextColor: UIColor { get } diff --git a/DuckDuckGo/ThemeSettingsViewController.swift b/DuckDuckGo/ThemeSettingsViewController.swift index 4879cca3a2..81a0a874e1 100644 --- a/DuckDuckGo/ThemeSettingsViewController.swift +++ b/DuckDuckGo/ThemeSettingsViewController.swift @@ -55,7 +55,6 @@ class ThemeSettingsViewController: UITableViewController { let theme = ThemeManager.shared.currentTheme cell.backgroundColor = theme.tableCellBackgroundColor - cell.setHighlightedStateBackgroundColor(theme.tableCellHighlightedBackgroundColor) // Checkmark color cell.tintColor = theme.buttonTintColor diff --git a/DuckDuckGo/UnprotectedSitesViewController.swift b/DuckDuckGo/UnprotectedSitesViewController.swift index 94a1c03d5c..9a25969853 100644 --- a/DuckDuckGo/UnprotectedSitesViewController.swift +++ b/DuckDuckGo/UnprotectedSitesViewController.swift @@ -222,7 +222,6 @@ class UnprotectedSitesViewController: UITableViewController { let theme = enforceLightTheme ? LightTheme() : ThemeManager.shared.currentTheme cell.backgroundColor = theme.tableCellBackgroundColor - cell.setHighlightedStateBackgroundColor(theme.tableCellHighlightedBackgroundColor) return cell }