From af42540ee745391da32bda26707f4828ad05ad22 Mon Sep 17 00:00:00 2001 From: CMK Date: Tue, 22 Jun 2021 20:52:30 +0800 Subject: [PATCH] fix: using wrong color issue --- Mastodon/Diffiable/Item/SettingsItem.swift | 6 +-- Mastodon/Diffiable/Section/PollSection.swift | 2 +- Mastodon/Extension/ActiveLabel.swift | 6 +-- Mastodon/Extension/UITableView.swift | 2 +- Mastodon/Generated/Assets.swift | 7 ---- .../Background/AudioPlayer/Contents.json | 9 ----- .../highlight.colorset/Contents.json | 20 ---------- .../Poll/highlight.colorset/Contents.json | 20 ---------- .../Button/normal.colorset/Contents.json | 38 ------------------- .../Label/highlight.colorset/Contents.json | 20 ---------- .../highlight.colorset/Contents.json | 20 ---------- .../Cell/AutoCompleteTableViewCell.swift | 2 +- ...sPollExpiresOptionCollectionViewCell.swift | 2 +- ...lOptionAppendEntryCollectionViewCell.swift | 2 +- .../Scene/Compose/ComposeViewController.swift | 8 ++-- .../Compose/View/ComposeToolbarView.swift | 2 +- .../HomeTimelineNavigationBarTitleView.swift | 2 +- .../MastodonRegisterViewController.swift | 2 +- .../MastodonServerRulesViewController.swift | 12 ++++-- .../Welcome/WelcomeViewController.swift | 4 +- Mastodon/Scene/Profile/ProfileViewModel.swift | 22 +++++------ .../Scene/Report/ReportViewController.swift | 2 +- .../Report/ReportedStatusTableviewCell.swift | 2 +- .../Settings/SettingsViewController.swift | 4 +- .../Scene/Settings/SettingsViewModel.swift | 4 +- .../SettingsAppearanceTableViewCell.swift | 2 +- .../View/Button/PrimaryActionButton.swift | 12 +++++- .../View/Container/AudioContainerView.swift | 4 +- .../Share/View/Content/PollOptionView.swift | 6 +-- .../Scene/Share/View/Content/StatusView.swift | 6 +-- .../Share/View/Content/ThreadMetaView.swift | 8 ++-- .../ThreadReplyLoaderTableViewCell.swift | 2 +- .../TimelineLoaderTableViewCell.swift | 2 +- Mastodon/Supporting Files/SceneDelegate.swift | 2 + 34 files changed, 73 insertions(+), 191 deletions(-) delete mode 100644 Mastodon/Resources/Assets.xcassets/Colors/Background/AudioPlayer/Contents.json delete mode 100644 Mastodon/Resources/Assets.xcassets/Colors/Background/AudioPlayer/highlight.colorset/Contents.json delete mode 100644 Mastodon/Resources/Assets.xcassets/Colors/Background/Poll/highlight.colorset/Contents.json delete mode 100644 Mastodon/Resources/Assets.xcassets/Colors/Button/normal.colorset/Contents.json delete mode 100644 Mastodon/Resources/Assets.xcassets/Colors/Label/highlight.colorset/Contents.json delete mode 100644 Mastodon/Resources/Assets.xcassets/Colors/TextField/highlight.colorset/Contents.json diff --git a/Mastodon/Diffiable/Item/SettingsItem.swift b/Mastodon/Diffiable/Item/SettingsItem.swift index 8aabdc741..e81d7b599 100644 --- a/Mastodon/Diffiable/Item/SettingsItem.swift +++ b/Mastodon/Diffiable/Item/SettingsItem.swift @@ -9,7 +9,7 @@ import UIKit import CoreData enum SettingsItem: Hashable { - case apperance(settingObjectID: NSManagedObjectID) + case appearance(settingObjectID: NSManagedObjectID) case notification(settingObjectID: NSManagedObjectID, switchMode: NotificationSwitchMode) case boringZone(item: Link) case spicyZone(item: Link) @@ -56,8 +56,8 @@ extension SettingsItem { var textColor: UIColor { switch self { - case .termsOfService: return .systemBlue - case .privacyPolicy: return .systemBlue + case .termsOfService: return Asset.Colors.brandBlue.color + case .privacyPolicy: return Asset.Colors.brandBlue.color case .clearMediaCache: return .systemRed case .signOut: return .systemRed } diff --git a/Mastodon/Diffiable/Section/PollSection.swift b/Mastodon/Diffiable/Section/PollSection.swift index 044f4fb9d..3c31d9b93 100644 --- a/Mastodon/Diffiable/Section/PollSection.swift +++ b/Mastodon/Diffiable/Section/PollSection.swift @@ -91,7 +91,7 @@ extension PollSection { cell.pollOptionView.optionPercentageLabel.isHidden = false cell.pollOptionView.optionPercentageLabel.text = String(Int(100 * percentage)) + "%" cell.pollOptionView.voteProgressStripView.isHidden = false - cell.pollOptionView.voteProgressStripView.tintColor = voted ? Asset.Colors.Background.Poll.highlight.color : Asset.Colors.Background.Poll.disabled.color + cell.pollOptionView.voteProgressStripView.tintColor = voted ? Asset.Colors.brandBlue.color : Asset.Colors.Background.Poll.disabled.color cell.pollOptionView.voteProgressStripView.setProgress(CGFloat(percentage), animated: animated) } } diff --git a/Mastodon/Extension/ActiveLabel.swift b/Mastodon/Extension/ActiveLabel.swift index 3d59fc92d..9e5c53eed 100644 --- a/Mastodon/Extension/ActiveLabel.swift +++ b/Mastodon/Extension/ActiveLabel.swift @@ -25,9 +25,9 @@ extension ActiveLabel { numberOfLines = 0 lineSpacing = 5 - mentionColor = Asset.Colors.Label.highlight.color - hashtagColor = Asset.Colors.Label.highlight.color - URLColor = Asset.Colors.Label.highlight.color + mentionColor = Asset.Colors.brandBlue.color + hashtagColor = Asset.Colors.brandBlue.color + URLColor = Asset.Colors.brandBlue.color emojiPlaceholderColor = .systemFill #if DEBUG text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua." diff --git a/Mastodon/Extension/UITableView.swift b/Mastodon/Extension/UITableView.swift index 8e3cc957d..3d96f97cd 100644 --- a/Mastodon/Extension/UITableView.swift +++ b/Mastodon/Extension/UITableView.swift @@ -33,7 +33,7 @@ extension UITableView { let backgroundColor = cell.backgroundColor UIView.animate(withDuration: 0.3) { - cell.backgroundColor = Asset.Colors.Label.highlight.color.withAlphaComponent(0.5) + cell.backgroundColor = Asset.Colors.brandBlue.color.withAlphaComponent(0.5) DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) { UIView.animate(withDuration: 0.3) { cell.backgroundColor = backgroundColor diff --git a/Mastodon/Generated/Assets.swift b/Mastodon/Generated/Assets.swift index b71299203..a680db4a5 100644 --- a/Mastodon/Generated/Assets.swift +++ b/Mastodon/Generated/Assets.swift @@ -32,12 +32,8 @@ internal enum Asset { } internal enum Colors { internal enum Background { - internal enum AudioPlayer { - internal static let highlight = ColorAsset(name: "Colors/Background/AudioPlayer/highlight") - } internal enum Poll { internal static let disabled = ColorAsset(name: "Colors/Background/Poll/disabled") - internal static let highlight = ColorAsset(name: "Colors/Background/Poll/highlight") } internal static let alertYellow = ColorAsset(name: "Colors/Background/alert.yellow") internal static let dangerBorder = ColorAsset(name: "Colors/Background/danger.border") @@ -61,13 +57,11 @@ internal enum Asset { internal static let actionToolbar = ColorAsset(name: "Colors/Button/action.toolbar") internal static let disabled = ColorAsset(name: "Colors/Button/disabled") internal static let inactive = ColorAsset(name: "Colors/Button/inactive") - internal static let normal = ColorAsset(name: "Colors/Button/normal") } internal enum Icon { internal static let plus = ColorAsset(name: "Colors/Icon/plus") } internal enum Label { - internal static let highlight = ColorAsset(name: "Colors/Label/highlight") internal static let primary = ColorAsset(name: "Colors/Label/primary") internal static let secondary = ColorAsset(name: "Colors/Label/secondary") internal static let tertiary = ColorAsset(name: "Colors/Label/tertiary") @@ -85,7 +79,6 @@ internal enum Asset { } internal enum TextField { internal static let background = ColorAsset(name: "Colors/TextField/background") - internal static let highlight = ColorAsset(name: "Colors/TextField/highlight") internal static let invalid = ColorAsset(name: "Colors/TextField/invalid") internal static let valid = ColorAsset(name: "Colors/TextField/valid") } diff --git a/Mastodon/Resources/Assets.xcassets/Colors/Background/AudioPlayer/Contents.json b/Mastodon/Resources/Assets.xcassets/Colors/Background/AudioPlayer/Contents.json deleted file mode 100644 index 6e965652d..000000000 --- a/Mastodon/Resources/Assets.xcassets/Colors/Background/AudioPlayer/Contents.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "info" : { - "author" : "xcode", - "version" : 1 - }, - "properties" : { - "provides-namespace" : true - } -} diff --git a/Mastodon/Resources/Assets.xcassets/Colors/Background/AudioPlayer/highlight.colorset/Contents.json b/Mastodon/Resources/Assets.xcassets/Colors/Background/AudioPlayer/highlight.colorset/Contents.json deleted file mode 100644 index 2e1ce5f3a..000000000 --- a/Mastodon/Resources/Assets.xcassets/Colors/Background/AudioPlayer/highlight.colorset/Contents.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "colors" : [ - { - "color" : { - "color-space" : "srgb", - "components" : { - "alpha" : "1.000", - "blue" : "0.851", - "green" : "0.565", - "red" : "0.169" - } - }, - "idiom" : "universal" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/Mastodon/Resources/Assets.xcassets/Colors/Background/Poll/highlight.colorset/Contents.json b/Mastodon/Resources/Assets.xcassets/Colors/Background/Poll/highlight.colorset/Contents.json deleted file mode 100644 index 2e1ce5f3a..000000000 --- a/Mastodon/Resources/Assets.xcassets/Colors/Background/Poll/highlight.colorset/Contents.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "colors" : [ - { - "color" : { - "color-space" : "srgb", - "components" : { - "alpha" : "1.000", - "blue" : "0.851", - "green" : "0.565", - "red" : "0.169" - } - }, - "idiom" : "universal" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/Mastodon/Resources/Assets.xcassets/Colors/Button/normal.colorset/Contents.json b/Mastodon/Resources/Assets.xcassets/Colors/Button/normal.colorset/Contents.json deleted file mode 100644 index 869ed278a..000000000 --- a/Mastodon/Resources/Assets.xcassets/Colors/Button/normal.colorset/Contents.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "colors" : [ - { - "color" : { - "color-space" : "srgb", - "components" : { - "alpha" : "1.000", - "blue" : "0xD9", - "green" : "0x90", - "red" : "0x2B" - } - }, - "idiom" : "universal" - }, - { - "appearances" : [ - { - "appearance" : "luminosity", - "value" : "dark" - } - ], - "color" : { - "color-space" : "srgb", - "components" : { - "alpha" : "1.000", - "blue" : "0xFF", - "green" : "0x84", - "red" : "0x0A" - } - }, - "idiom" : "universal" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/Mastodon/Resources/Assets.xcassets/Colors/Label/highlight.colorset/Contents.json b/Mastodon/Resources/Assets.xcassets/Colors/Label/highlight.colorset/Contents.json deleted file mode 100644 index d853a71aa..000000000 --- a/Mastodon/Resources/Assets.xcassets/Colors/Label/highlight.colorset/Contents.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "colors" : [ - { - "color" : { - "color-space" : "srgb", - "components" : { - "alpha" : "1.000", - "blue" : "217", - "green" : "144", - "red" : "43" - } - }, - "idiom" : "universal" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/Mastodon/Resources/Assets.xcassets/Colors/TextField/highlight.colorset/Contents.json b/Mastodon/Resources/Assets.xcassets/Colors/TextField/highlight.colorset/Contents.json deleted file mode 100644 index d853a71aa..000000000 --- a/Mastodon/Resources/Assets.xcassets/Colors/TextField/highlight.colorset/Contents.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "colors" : [ - { - "color" : { - "color-space" : "srgb", - "components" : { - "alpha" : "1.000", - "blue" : "217", - "green" : "144", - "red" : "43" - } - }, - "idiom" : "universal" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/Mastodon/Scene/Compose/AutoComplete/Cell/AutoCompleteTableViewCell.swift b/Mastodon/Scene/Compose/AutoComplete/Cell/AutoCompleteTableViewCell.swift index c9f0a55d1..a13e82f31 100644 --- a/Mastodon/Scene/Compose/AutoComplete/Cell/AutoCompleteTableViewCell.swift +++ b/Mastodon/Scene/Compose/AutoComplete/Cell/AutoCompleteTableViewCell.swift @@ -32,7 +32,7 @@ final class AutoCompleteTableViewCell: UITableViewCell { let titleLabel: UILabel = { let label = UILabel() label.font = UIFontMetrics(forTextStyle: .headline).scaledFont(for: .systemFont(ofSize: 17, weight: .semibold), maximumPointSize: 22) - label.textColor = Asset.Colors.Label.highlight.color + label.textColor = Asset.Colors.brandBlue.color label.text = "Title" return label }() diff --git a/Mastodon/Scene/Compose/CollectionViewCell/ComposeStatusPollExpiresOptionCollectionViewCell.swift b/Mastodon/Scene/Compose/CollectionViewCell/ComposeStatusPollExpiresOptionCollectionViewCell.swift index 8347f5641..4ef0dbe5a 100644 --- a/Mastodon/Scene/Compose/CollectionViewCell/ComposeStatusPollExpiresOptionCollectionViewCell.swift +++ b/Mastodon/Scene/Compose/CollectionViewCell/ComposeStatusPollExpiresOptionCollectionViewCell.swift @@ -23,7 +23,7 @@ final class ComposeStatusPollExpiresOptionCollectionViewCell: UICollectionViewCe button.titleLabel?.font = UIFontMetrics(forTextStyle: .body).scaledFont(for: .systemFont(ofSize: 12)) button.expandEdgeInsets = UIEdgeInsets(top: 0, left: -10, bottom: -20, right: -20) button.setTitle(L10n.Scene.Compose.Poll.durationTime(L10n.Scene.Compose.Poll.thirtyMinutes), for: .normal) - button.setTitleColor(Asset.Colors.Button.normal.color, for: .normal) + button.setTitleColor(Asset.Colors.brandBlue.color, for: .normal) return button }() diff --git a/Mastodon/Scene/Compose/CollectionViewCell/ComposeStatusPollOptionAppendEntryCollectionViewCell.swift b/Mastodon/Scene/Compose/CollectionViewCell/ComposeStatusPollOptionAppendEntryCollectionViewCell.swift index dbe9ef4ad..4827c16f7 100644 --- a/Mastodon/Scene/Compose/CollectionViewCell/ComposeStatusPollOptionAppendEntryCollectionViewCell.swift +++ b/Mastodon/Scene/Compose/CollectionViewCell/ComposeStatusPollOptionAppendEntryCollectionViewCell.swift @@ -30,7 +30,7 @@ final class ComposeStatusPollOptionAppendEntryCollectionViewCell: UICollectionVi override var isHighlighted: Bool { didSet { pollOptionView.roundedBackgroundView.backgroundColor = isHighlighted ? Asset.Colors.Background.tertiarySystemBackground.color : Asset.Colors.Background.secondarySystemBackground.color - pollOptionView.plusCircleImageView.tintColor = isHighlighted ? Asset.Colors.Button.normal.color.withAlphaComponent(0.5) : Asset.Colors.Button.normal.color + pollOptionView.plusCircleImageView.tintColor = isHighlighted ? Asset.Colors.brandBlue.color.withAlphaComponent(0.5) : Asset.Colors.brandBlue.color } } diff --git a/Mastodon/Scene/Compose/ComposeViewController.swift b/Mastodon/Scene/Compose/ComposeViewController.swift index 0c1bf3a34..a9fe951f7 100644 --- a/Mastodon/Scene/Compose/ComposeViewController.swift +++ b/Mastodon/Scene/Compose/ComposeViewController.swift @@ -29,8 +29,8 @@ final class ComposeViewController: UIViewController, NeedsDependency { let button = RoundedEdgesButton(type: .custom) button.setTitle(L10n.Scene.Compose.composeAction, for: .normal) button.titleLabel?.font = .systemFont(ofSize: 14, weight: .bold) - button.setBackgroundImage(.placeholder(color: Asset.Colors.Button.normal.color), for: .normal) - button.setBackgroundImage(.placeholder(color: Asset.Colors.Button.normal.color.withAlphaComponent(0.5)), for: .highlighted) + button.setBackgroundImage(.placeholder(color: Asset.Colors.brandBlue.color), for: .normal) + button.setBackgroundImage(.placeholder(color: Asset.Colors.brandBlue.color.withAlphaComponent(0.5)), for: .highlighted) button.setBackgroundImage(.placeholder(color: Asset.Colors.Button.disabled.color), for: .disabled) button.setTitleColor(.white, for: .normal) button.contentEdgeInsets = UIEdgeInsets(top: 6, left: 16, bottom: 5, right: 16) // set 28pt height @@ -711,7 +711,7 @@ extension ComposeViewController: TextEditorViewTextAttributesDelegate { for match in highlightMatches { // set highlight var attributes = [NSAttributedString.Key: Any]() - attributes[.foregroundColor] = Asset.Colors.Label.highlight.color + attributes[.foregroundColor] = Asset.Colors.brandBlue.color // See `traitCollectionDidChange(_:)` // set accessibility @@ -780,7 +780,7 @@ extension ComposeViewController: TextEditorViewTextAttributesDelegate { // set highlight var attributes = [NSAttributedString.Key: Any]() - attributes[.foregroundColor] = Asset.Colors.Label.highlight.color + attributes[.foregroundColor] = Asset.Colors.brandBlue.color // See `traitCollectionDidChange(_:)` // set accessibility diff --git a/Mastodon/Scene/Compose/View/ComposeToolbarView.swift b/Mastodon/Scene/Compose/View/ComposeToolbarView.swift index d1ba5fdab..1dd19c552 100644 --- a/Mastodon/Scene/Compose/View/ComposeToolbarView.swift +++ b/Mastodon/Scene/Compose/View/ComposeToolbarView.swift @@ -225,7 +225,7 @@ extension ComposeToolbarView { extension ComposeToolbarView { private static func configureToolbarButtonAppearance(button: UIButton) { - button.tintColor = Asset.Colors.Button.normal.color + button.tintColor = Asset.Colors.brandBlue.color button.setBackgroundImage(.placeholder(size: ComposeToolbarView.toolbarButtonSize, color: .systemFill), for: .highlighted) button.layer.masksToBounds = true button.layer.cornerRadius = 5 diff --git a/Mastodon/Scene/HomeTimeline/View/HomeTimelineNavigationBarTitleView.swift b/Mastodon/Scene/HomeTimeline/View/HomeTimelineNavigationBarTitleView.swift index ac39ce1ae..84a463671 100644 --- a/Mastodon/Scene/HomeTimeline/View/HomeTimelineNavigationBarTitleView.swift +++ b/Mastodon/Scene/HomeTimeline/View/HomeTimelineNavigationBarTitleView.swift @@ -106,7 +106,7 @@ extension HomeTimelineNavigationBarTitleView { configureButton( title: L10n.Scene.HomeTimeline.NavigationBarState.newPosts, textColor: .white, - backgroundColor: Asset.Colors.Button.normal.color + backgroundColor: Asset.Colors.brandBlue.color ) button.isHidden = false case .offlineButton: diff --git a/Mastodon/Scene/Onboarding/Register/MastodonRegisterViewController.swift b/Mastodon/Scene/Onboarding/Register/MastodonRegisterViewController.swift index ebd9b6ead..955f70a0f 100644 --- a/Mastodon/Scene/Onboarding/Register/MastodonRegisterViewController.swift +++ b/Mastodon/Scene/Onboarding/Register/MastodonRegisterViewController.swift @@ -713,7 +713,7 @@ extension MastodonRegisterViewController: UITextFieldDelegate { private func setTextFieldValidAppearance(_ textField: UITextField, validateState: MastodonRegisterViewModel.ValidateState) { switch validateState { case .empty: - showShadowWithColor(color: textField.isFirstResponder ? Asset.Colors.TextField.highlight.color : .clear, textField: textField) + showShadowWithColor(color: textField.isFirstResponder ? Asset.Colors.brandBlue.color : .clear, textField: textField) case .valid: showShadowWithColor(color: Asset.Colors.TextField.valid.color, textField: textField) case .invalid: diff --git a/Mastodon/Scene/Onboarding/ServerRules/MastodonServerRulesViewController.swift b/Mastodon/Scene/Onboarding/ServerRules/MastodonServerRulesViewController.swift index 8b238cf0f..fda790913 100644 --- a/Mastodon/Scene/Onboarding/ServerRules/MastodonServerRulesViewController.swift +++ b/Mastodon/Scene/Onboarding/ServerRules/MastodonServerRulesViewController.swift @@ -175,15 +175,19 @@ extension MastodonServerRulesViewController { } func configTextView() { - let linkColor = Asset.Colors.Button.normal.color - let str = NSString(string: L10n.Scene.ServerRules.prompt(viewModel.domain)) let termsOfServiceRange = str.range(of: L10n.Scene.ServerRules.termsOfService) let privacyRange = str.range(of: L10n.Scene.ServerRules.privacyPolicy) - let attributeString = NSMutableAttributedString(string: L10n.Scene.ServerRules.prompt(viewModel.domain), attributes: [NSAttributedString.Key.font: UIFontMetrics(forTextStyle: .body).scaledFont(for: .systemFont(ofSize: 17, weight: .regular), maximumPointSize: 22), NSAttributedString.Key.foregroundColor: UIColor.label]) + let attributeString = NSMutableAttributedString( + string: L10n.Scene.ServerRules.prompt(viewModel.domain), + attributes: [ + NSAttributedString.Key.font: UIFontMetrics(forTextStyle: .body).scaledFont(for: .systemFont(ofSize: 17, weight: .regular), maximumPointSize: 22), + NSAttributedString.Key.foregroundColor: UIColor.label + ] + ) attributeString.addAttribute(.link, value: Mastodon.API.serverRulesURL(domain: viewModel.domain), range: termsOfServiceRange) attributeString.addAttribute(.link, value: Mastodon.API.privacyURL(domain: viewModel.domain), range: privacyRange) - let linkAttributes = [NSAttributedString.Key.foregroundColor:linkColor] + let linkAttributes = [NSAttributedString.Key.foregroundColor: Asset.Colors.brandBlue.color] bottomPromptTextView.attributedText = attributeString bottomPromptTextView.linkTextAttributes = linkAttributes bottomPromptTextView.delegate = self diff --git a/Mastodon/Scene/Onboarding/Welcome/WelcomeViewController.swift b/Mastodon/Scene/Onboarding/Welcome/WelcomeViewController.swift index dea4de017..3ee2a4b07 100644 --- a/Mastodon/Scene/Onboarding/Welcome/WelcomeViewController.swift +++ b/Mastodon/Scene/Onboarding/Welcome/WelcomeViewController.swift @@ -41,7 +41,7 @@ final class WelcomeViewController: UIViewController, NeedsDependency { let backgroundImageHighlightedColor: UIColor = traitCollection.userInterfaceIdiom == .phone ? UIColor(white: 0.8, alpha: 1.0) : Asset.Colors.brandBlueDarken20.color button.setBackgroundImage(.placeholder(color: backgroundImageColor), for: .normal) button.setBackgroundImage(.placeholder(color: backgroundImageHighlightedColor), for: .highlighted) - let titleColor: UIColor = traitCollection.userInterfaceIdiom == .phone ? Asset.Colors.Button.normal.color : UIColor.white + let titleColor: UIColor = traitCollection.userInterfaceIdiom == .phone ? Asset.Colors.brandBlue.color : UIColor.white button.setTitleColor(titleColor, for: .normal) button.translatesAutoresizingMaskIntoConstraints = false return button @@ -51,7 +51,7 @@ final class WelcomeViewController: UIViewController, NeedsDependency { let button = UIButton(type: .system) button.titleLabel?.font = UIFontMetrics(forTextStyle: .headline).scaledFont(for: .systemFont(ofSize: 15, weight: .semibold)) button.setTitle(L10n.Common.Controls.Actions.signIn, for: .normal) - let titleColor: UIColor = traitCollection.userInterfaceIdiom == .phone ? UIColor.white.withAlphaComponent(0.8) : Asset.Colors.Button.normal.color + let titleColor: UIColor = traitCollection.userInterfaceIdiom == .phone ? UIColor.white.withAlphaComponent(0.8) : Asset.Colors.brandBlue.color button.setTitleColor(titleColor, for: .normal) button.translatesAutoresizingMaskIntoConstraints = false return button diff --git a/Mastodon/Scene/Profile/ProfileViewModel.swift b/Mastodon/Scene/Profile/ProfileViewModel.swift index f9a89909c..289772033 100644 --- a/Mastodon/Scene/Profile/ProfileViewModel.swift +++ b/Mastodon/Scene/Profile/ProfileViewModel.swift @@ -395,21 +395,21 @@ extension ProfileViewModel { var backgroundColor: UIColor { guard let highPriorityAction = self.highPriorityAction(except: []) else { assertionFailure() - return Asset.Colors.Button.normal.color + return Asset.Colors.brandBlue.color } switch highPriorityAction { - case .none: return Asset.Colors.Button.normal.color - case .follow: return Asset.Colors.Button.normal.color - case .reqeust: return Asset.Colors.Button.normal.color - case .pending: return Asset.Colors.Button.normal.color - case .following: return Asset.Colors.Button.normal.color + case .none: return Asset.Colors.brandBlue.color + case .follow: return Asset.Colors.brandBlue.color + case .reqeust: return Asset.Colors.brandBlue.color + case .pending: return Asset.Colors.brandBlue.color + case .following: return Asset.Colors.brandBlue.color case .muting: return Asset.Colors.Background.alertYellow.color - case .blocked: return Asset.Colors.Button.normal.color + case .blocked: return Asset.Colors.brandBlue.color case .blocking: return Asset.Colors.Background.danger.color - case .suspended: return Asset.Colors.Button.normal.color - case .edit: return Asset.Colors.Button.normal.color - case .editing: return Asset.Colors.Button.normal.color - case .updating: return Asset.Colors.Button.normal.color + case .suspended: return Asset.Colors.brandBlue.color + case .edit: return Asset.Colors.brandBlue.color + case .editing: return Asset.Colors.brandBlue.color + case .updating: return Asset.Colors.brandBlue.color } } diff --git a/Mastodon/Scene/Report/ReportViewController.swift b/Mastodon/Scene/Report/ReportViewController.swift index 5e81ba139..7143912d5 100644 --- a/Mastodon/Scene/Report/ReportViewController.swift +++ b/Mastodon/Scene/Report/ReportViewController.swift @@ -241,7 +241,7 @@ class ReportViewController: UIViewController, NeedsDependency { = UIBarButtonItem(barButtonSystemItem: UIBarButtonItem.SystemItem.cancel, target: self, action: #selector(doneButtonDidClick)) - navigationItem.rightBarButtonItem?.tintColor = Asset.Colors.Label.highlight.color + navigationItem.rightBarButtonItem?.tintColor = Asset.Colors.brandBlue.color // fetch old mastodon user let beReportedUser: MastodonUser? = { diff --git a/Mastodon/Scene/Report/ReportedStatusTableviewCell.swift b/Mastodon/Scene/Report/ReportedStatusTableviewCell.swift index b1d0af6b0..95198312f 100644 --- a/Mastodon/Scene/Report/ReportedStatusTableviewCell.swift +++ b/Mastodon/Scene/Report/ReportedStatusTableviewCell.swift @@ -76,7 +76,7 @@ final class ReportedStatusTableViewCell: UITableViewCell, StatusCell { super.setHighlighted(highlighted, animated: animated) if highlighted { checkbox.image = UIImage(systemName: "checkmark.circle.fill") - checkbox.tintColor = Asset.Colors.Label.highlight.color + checkbox.tintColor = Asset.Colors.brandBlue.color } else if !isSelected { checkbox.image = UIImage(systemName: "circle") checkbox.tintColor = Asset.Colors.Label.secondary.color diff --git a/Mastodon/Scene/Settings/SettingsViewController.swift b/Mastodon/Scene/Settings/SettingsViewController.swift index 077058466..e7be49b33 100644 --- a/Mastodon/Scene/Settings/SettingsViewController.swift +++ b/Mastodon/Scene/Settings/SettingsViewController.swift @@ -328,7 +328,7 @@ extension SettingsViewController: UITableViewDelegate { guard let item = dataSource.itemIdentifier(for: indexPath) else { return } switch item { - case .apperance: + case .appearance: // do nothing break case .notification: @@ -399,7 +399,7 @@ extension SettingsViewController: SettingsAppearanceTableViewCellDelegate { guard let dataSource = viewModel.dataSource else { return } guard let indexPath = tableView.indexPath(for: cell) else { return } let item = dataSource.itemIdentifier(for: indexPath) - guard case let .apperance(settingObjectID) = item else { return } + guard case let .appearance(settingObjectID) = item else { return } context.managedObjectContext.performChanges { let setting = self.context.managedObjectContext.object(with: settingObjectID) as! Setting diff --git a/Mastodon/Scene/Settings/SettingsViewModel.swift b/Mastodon/Scene/Settings/SettingsViewModel.swift index c168b5611..c489f2133 100644 --- a/Mastodon/Scene/Settings/SettingsViewModel.swift +++ b/Mastodon/Scene/Settings/SettingsViewModel.swift @@ -71,7 +71,7 @@ extension SettingsViewModel { var snapshot = NSDiffableDataSourceSnapshot() // appearance - let appearanceItems = [SettingsItem.apperance(settingObjectID: setting.objectID)] + let appearanceItems = [SettingsItem.appearance(settingObjectID: setting.objectID)] snapshot.appendSections([.apperance]) snapshot.appendItems(appearanceItems, toSection: .apperance) @@ -123,7 +123,7 @@ extension SettingsViewModel { guard let self = self else { return nil } switch item { - case .apperance(let objectID): + case .appearance(let objectID): let cell = tableView.dequeueReusableCell(withIdentifier: String(describing: SettingsAppearanceTableViewCell.self), for: indexPath) as! SettingsAppearanceTableViewCell self.context.managedObjectContext.performAndWait { let setting = self.context.managedObjectContext.object(with: objectID) as! Setting diff --git a/Mastodon/Scene/Settings/View/Cell/SettingsAppearanceTableViewCell.swift b/Mastodon/Scene/Settings/View/Cell/SettingsAppearanceTableViewCell.swift index 9a9ff7454..25bf4f1a0 100644 --- a/Mastodon/Scene/Settings/View/Cell/SettingsAppearanceTableViewCell.swift +++ b/Mastodon/Scene/Settings/View/Cell/SettingsAppearanceTableViewCell.swift @@ -48,7 +48,7 @@ class AppearanceView: UIView { didSet { checkBox.isSelected = selected if selected { - checkBox.imageView?.tintColor = Asset.Colors.Label.highlight.color + checkBox.imageView?.tintColor = Asset.Colors.brandBlue.color } else { checkBox.imageView?.tintColor = Asset.Colors.Label.secondary.color } diff --git a/Mastodon/Scene/Share/View/Button/PrimaryActionButton.swift b/Mastodon/Scene/Share/View/Button/PrimaryActionButton.swift index 82d0319f7..75e03d97c 100644 --- a/Mastodon/Scene/Share/View/Button/PrimaryActionButton.swift +++ b/Mastodon/Scene/Share/View/Button/PrimaryActionButton.swift @@ -38,10 +38,20 @@ extension PrimaryActionButton { private func _init() { titleLabel?.font = UIFontMetrics(forTextStyle: .headline).scaledFont(for: .systemFont(ofSize: 17, weight: .semibold)) setTitleColor(.white, for: .normal) + setupBackgroundAppearance() + applyCornerRadius(radius: 10) + } + + func setupBackgroundAppearance() { setBackgroundImage(UIImage.placeholder(color: Asset.Colors.brandBlue.color), for: .normal) setBackgroundImage(UIImage.placeholder(color: Asset.Colors.brandBlueDarken20.color), for: .highlighted) setBackgroundImage(UIImage.placeholder(color: Asset.Colors.disabled.color), for: .disabled) - applyCornerRadius(radius: 10) + } + + override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) { + super.traitCollectionDidChange(previousTraitCollection) + + setupBackgroundAppearance() } func showLoading() { diff --git a/Mastodon/Scene/Share/View/Container/AudioContainerView.swift b/Mastodon/Scene/Share/View/Container/AudioContainerView.swift index 5661f833a..c4cf4f490 100644 --- a/Mastodon/Scene/Share/View/Container/AudioContainerView.swift +++ b/Mastodon/Scene/Share/View/Container/AudioContainerView.swift @@ -22,7 +22,7 @@ final class AudioContainerView: UIView { stackView.isLayoutMarginsRelativeArrangement = true stackView.layer.cornerRadius = AudioContainerView.cornerRadius stackView.clipsToBounds = true - stackView.backgroundColor = Asset.Colors.Background.AudioPlayer.highlight.color + stackView.backgroundColor = Asset.Colors.brandBlue.color stackView.translatesAutoresizingMaskIntoConstraints = false return stackView }() @@ -31,7 +31,7 @@ final class AudioContainerView: UIView { let view = UIView() view.layer.cornerRadius = 16 view.clipsToBounds = true - view.backgroundColor = Asset.Colors.Background.AudioPlayer.highlight.color + view.backgroundColor = Asset.Colors.brandBlue.color view.translatesAutoresizingMaskIntoConstraints = false return view }() diff --git a/Mastodon/Scene/Share/View/Content/PollOptionView.swift b/Mastodon/Scene/Share/View/Content/PollOptionView.swift index 2a248ec3f..e95de4624 100644 --- a/Mastodon/Scene/Share/View/Content/PollOptionView.swift +++ b/Mastodon/Scene/Share/View/Content/PollOptionView.swift @@ -21,7 +21,7 @@ final class PollOptionView: UIView { let roundedBackgroundView = UIView() let voteProgressStripView: StripProgressView = { let view = StripProgressView() - view.tintColor = Asset.Colors.Background.Poll.highlight.color + view.tintColor = Asset.Colors.brandBlue.color return view }() @@ -35,7 +35,7 @@ final class PollOptionView: UIView { let imageView = UIImageView() let image = UIImage(systemName: "checkmark", withConfiguration: UIImage.SymbolConfiguration(pointSize: 14, weight: .bold))! imageView.image = image.withRenderingMode(.alwaysTemplate) - imageView.tintColor = Asset.Colors.Button.normal.color + imageView.tintColor = Asset.Colors.brandBlue.color return imageView }() @@ -43,7 +43,7 @@ final class PollOptionView: UIView { let imageView = UIImageView() let image = Asset.Circles.plusCircle.image imageView.image = image.withRenderingMode(.alwaysTemplate) - imageView.tintColor = Asset.Colors.Button.normal.color + imageView.tintColor = Asset.Colors.brandBlue.color return imageView }() diff --git a/Mastodon/Scene/Share/View/Content/StatusView.swift b/Mastodon/Scene/Share/View/Content/StatusView.swift index d61210117..7cb2aef87 100644 --- a/Mastodon/Scene/Share/View/Content/StatusView.swift +++ b/Mastodon/Scene/Share/View/Content/StatusView.swift @@ -126,7 +126,7 @@ final class StatusView: UIView { let revealContentWarningButton: UIButton = { let button = HighlightDimmableButton() button.setImage(UIImage(systemName: "eye", withConfiguration: UIImage.SymbolConfiguration(pointSize: 17, weight: .medium)), for: .normal) - button.tintColor = Asset.Colors.Button.normal.color + button.tintColor = Asset.Colors.brandBlue.color return button }() @@ -175,8 +175,8 @@ final class StatusView: UIView { let button = HitTestExpandedButton() button.titleLabel?.font = UIFontMetrics(forTextStyle: .body).scaledFont(for: .systemFont(ofSize: 14, weight: .semibold)) button.setTitle(L10n.Common.Controls.Status.Poll.vote, for: .normal) - button.setTitleColor(Asset.Colors.Button.normal.color, for: .normal) - button.setTitleColor(Asset.Colors.Button.normal.color.withAlphaComponent(0.8), for: .highlighted) + button.setTitleColor(Asset.Colors.brandBlue.color, for: .normal) + button.setTitleColor(Asset.Colors.brandBlue.color.withAlphaComponent(0.8), for: .highlighted) button.setTitleColor(Asset.Colors.Button.disabled.color, for: .disabled) button.isEnabled = false return button diff --git a/Mastodon/Scene/Share/View/Content/ThreadMetaView.swift b/Mastodon/Scene/Share/View/Content/ThreadMetaView.swift index ff5fa58d6..ff2f94a0e 100644 --- a/Mastodon/Scene/Share/View/Content/ThreadMetaView.swift +++ b/Mastodon/Scene/Share/View/Content/ThreadMetaView.swift @@ -20,8 +20,8 @@ final class ThreadMetaView: UIView { let button = UIButton() button.titleLabel?.font = UIFontMetrics(forTextStyle: .headline).scaledFont(for: .systemFont(ofSize: 15, weight: .semibold)) button.setTitle("0 reblog", for: .normal) - button.setTitleColor(Asset.Colors.Button.normal.color, for: .normal) - button.setTitleColor(Asset.Colors.Button.normal.color.withAlphaComponent(0.5), for: .highlighted) + button.setTitleColor(Asset.Colors.brandBlue.color, for: .normal) + button.setTitleColor(Asset.Colors.brandBlue.color.withAlphaComponent(0.5), for: .highlighted) return button }() @@ -29,8 +29,8 @@ final class ThreadMetaView: UIView { let button = UIButton() button.titleLabel?.font = UIFontMetrics(forTextStyle: .headline).scaledFont(for: .systemFont(ofSize: 15, weight: .semibold)) button.setTitle("0 favorite", for: .normal) - button.setTitleColor(Asset.Colors.Button.normal.color, for: .normal) - button.setTitleColor(Asset.Colors.Button.normal.color.withAlphaComponent(0.5), for: .highlighted) + button.setTitleColor(Asset.Colors.brandBlue.color, for: .normal) + button.setTitleColor(Asset.Colors.brandBlue.color.withAlphaComponent(0.5), for: .highlighted) return button }() diff --git a/Mastodon/Scene/Share/View/TableviewCell/ThreadReplyLoaderTableViewCell.swift b/Mastodon/Scene/Share/View/TableviewCell/ThreadReplyLoaderTableViewCell.swift index 03359df51..9461bb282 100644 --- a/Mastodon/Scene/Share/View/TableviewCell/ThreadReplyLoaderTableViewCell.swift +++ b/Mastodon/Scene/Share/View/TableviewCell/ThreadReplyLoaderTableViewCell.swift @@ -23,7 +23,7 @@ final class ThreadReplyLoaderTableViewCell: UITableViewCell { let button = HighlightDimmableButton() button.titleLabel?.font = TimelineLoaderTableViewCell.labelFont button.backgroundColor = Asset.Colors.Background.secondaryGroupedSystemBackground.color - button.setTitleColor(Asset.Colors.Button.normal.color, for: .normal) + button.setTitleColor(Asset.Colors.brandBlue.color, for: .normal) button.setTitle(L10n.Common.Controls.Timeline.Loader.showMoreReplies, for: .normal) return button }() diff --git a/Mastodon/Scene/Share/View/TableviewCell/TimelineLoaderTableViewCell.swift b/Mastodon/Scene/Share/View/TableviewCell/TimelineLoaderTableViewCell.swift index ded8fa49b..271a08a61 100644 --- a/Mastodon/Scene/Share/View/TableviewCell/TimelineLoaderTableViewCell.swift +++ b/Mastodon/Scene/Share/View/TableviewCell/TimelineLoaderTableViewCell.swift @@ -23,7 +23,7 @@ class TimelineLoaderTableViewCell: UITableViewCell { let button = HighlightDimmableButton() button.titleLabel?.font = TimelineLoaderTableViewCell.labelFont button.backgroundColor = Asset.Colors.Background.systemBackground.color - button.setTitleColor(Asset.Colors.Button.normal.color, for: .normal) + button.setTitleColor(Asset.Colors.brandBlue.color, for: .normal) button.setTitle(L10n.Common.Controls.Timeline.Loader.loadMissingPosts, for: .normal) button.setTitle("", for: .disabled) return button diff --git a/Mastodon/Supporting Files/SceneDelegate.swift b/Mastodon/Supporting Files/SceneDelegate.swift index 81869153f..948911a2a 100644 --- a/Mastodon/Supporting Files/SceneDelegate.swift +++ b/Mastodon/Supporting Files/SceneDelegate.swift @@ -22,6 +22,8 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate { let window = UIWindow(windowScene: windowScene) self.window = window + // set tint color + window.tintColor = Asset.Colors.brandBlue.color let appContext = AppContext.shared let sceneCoordinator = SceneCoordinator(scene: scene, sceneDelegate: self, appContext: appContext)