From 5c290e8a42aef2972ed911007b32746069a80414 Mon Sep 17 00:00:00 2001 From: mojganii Date: Tue, 22 Oct 2024 11:34:28 +0200 Subject: [PATCH] Fix text color for disabled state --- ios/MullvadVPN/UI appearance/UIColor+Palette.swift | 2 +- ios/MullvadVPN/Views/AppButton.swift | 6 +++--- ios/MullvadVPN/Views/CustomButton.swift | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ios/MullvadVPN/UI appearance/UIColor+Palette.swift b/ios/MullvadVPN/UI appearance/UIColor+Palette.swift index 38749d6706e7..9d5cfe84bcb5 100644 --- a/ios/MullvadVPN/UI appearance/UIColor+Palette.swift +++ b/ios/MullvadVPN/UI appearance/UIColor+Palette.swift @@ -50,7 +50,7 @@ extension UIColor { enum AppButton { static let normalTitleColor = UIColor.white static let highlightedTitleColor = UIColor.lightGray - static let disabledTitleColor = UIColor.lightGray + static let disabledTitleColor = UIColor.white.withAlphaComponent(0.2) } enum Switch { diff --git a/ios/MullvadVPN/Views/AppButton.swift b/ios/MullvadVPN/Views/AppButton.swift index 022bd97b130b..a5c092d4db88 100644 --- a/ios/MullvadVPN/Views/AppButton.swift +++ b/ios/MullvadVPN/Views/AppButton.swift @@ -113,15 +113,15 @@ class AppButton: CustomButton { config.background.image = style.backgroundImage config.background.imageContentMode = .scaleAspectFill config.titleTextAttributesTransformer = - UIConfigurationTextAttributesTransformer { attributeContainer in + UIConfigurationTextAttributesTransformer { [weak self] attributeContainer in var updatedAttributeContainer = attributeContainer updatedAttributeContainer.font = UIFont.systemFont(ofSize: 18, weight: .semibold) + updatedAttributeContainer.foregroundColor = self?.state.customButtonTitleColor return updatedAttributeContainer } - let configurationHandler: UIButton.ConfigurationUpdateHandler = { [weak self] button in + let configurationHandler: UIButton.ConfigurationUpdateHandler = { [weak self] _ in guard let self else { return } - button.configuration?.baseForegroundColor = button.state.customButtonTitleColor updateButtonBackground() } configuration = config diff --git a/ios/MullvadVPN/Views/CustomButton.swift b/ios/MullvadVPN/Views/CustomButton.swift index a956025f28e2..8c99ddb2cc6c 100644 --- a/ios/MullvadVPN/Views/CustomButton.swift +++ b/ios/MullvadVPN/Views/CustomButton.swift @@ -14,7 +14,7 @@ extension UIControl.State { case .normal: return UIColor.AppButton.normalTitleColor case .disabled: - return UIColor.AppButton.disabledTitleColor.withAlphaComponent(0.5) + return UIColor.AppButton.disabledTitleColor case .highlighted: return UIColor.AppButton.highlightedTitleColor default: