IOS-113 fix general vqa issues (#986)

This commit is contained in:
Marcus Kida 2023-03-21 08:01:40 +01:00 committed by GitHub
parent 68ba70285b
commit 8f327d4c05
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 21 deletions

View File

@ -20,6 +20,7 @@ class SettingsToggleTableViewCell: UITableViewCell {
private(set) lazy var switchButton: UISwitch = {
let view = UISwitch(frame:.zero)
view.onTintColor = Asset.Colors.brand.color
return view
}()
@ -48,15 +49,8 @@ class SettingsToggleTableViewCell: UITableViewCell {
accessoryView = switchButton
textLabel?.numberOfLines = 0
updateAppearance()
switchButton.addTarget(self, action: #selector(switchValueDidChange(sender:)), for: .valueChanged)
}
override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) {
super.traitCollectionDidChange(previousTraitCollection)
updateAppearance()
}
}
@ -71,23 +65,11 @@ extension SettingsToggleTableViewCell {
}
extension SettingsToggleTableViewCell {
func update(enabled: Bool?) {
switchButton.isEnabled = enabled != nil
textLabel?.textColor = enabled != nil ? Asset.Colors.Label.primary.color : Asset.Colors.Label.secondary.color
switchButton.isOn = enabled ?? false
}
private func updateAppearance() {
switchButton.onTintColor = {
switch traitCollection.userInterfaceStyle {
case .dark:
// set default green for Dark Mode
return nil
default:
// set tint black for Light Mode
return self.contentView.window?.tintColor
}
}()
}
}

View File

@ -93,8 +93,10 @@ public final class NotificationView: UIView {
public let menuButton: UIButton = {
let button = HitTestExpandedButton(type: .system)
button.tintColor = Asset.Colors.Label.secondary.color
let image = UIImage(systemName: "ellipsis", withConfiguration: UIImage.SymbolConfiguration(font: .systemFont(ofSize: 15)))
button.setImage(image, for: .normal)
button.accessibilityLabel = L10n.Common.Controls.Status.Actions.menu
return button
}()