fix: account notification badge color only set to Dark Mode style issue

This commit is contained in:
CMK 2022-05-27 00:01:31 +08:00
parent cd32cedfc6
commit 15be4a9ce3
2 changed files with 13 additions and 4 deletions

View File

@ -23,7 +23,6 @@ final class AccountListTableViewCell: UITableViewCell {
let checkmarkImageView: UIImageView = {
let image = UIImage(systemName: "checkmark", withConfiguration: UIImage.SymbolConfiguration(pointSize: 17, weight: .semibold))
let imageView = UIImageView(image: image)
imageView.tintColor = .label
return imageView
}()
let separatorLine = UIView.separatorLine

View File

@ -26,10 +26,14 @@ final class BadgeButton: UIButton {
extension BadgeButton {
private func _init() {
titleLabel?.font = UIFontMetrics(forTextStyle: .caption1).scaledFont(for: .systemFont(ofSize: 13, weight: .medium))
setBackgroundColor(.systemBackground, for: .normal)
setTitleColor(.label, for: .normal)
contentEdgeInsets = UIEdgeInsets(top: 6, left: 6, bottom: 6, right: 6)
setAppearance()
}
override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) {
super.traitCollectionDidChange(previousTraitCollection)
setAppearance()
}
override func layoutSubviews() {
@ -39,6 +43,12 @@ extension BadgeButton {
layer.cornerRadius = frame.height * 0.5
}
private func setAppearance() {
setBackgroundColor(Asset.Colors.Label.primary.color, for: .normal)
setTitleColor(Asset.Colors.Label.primaryReverse.color, for: .normal)
tintColor = Asset.Colors.Label.primary.color
}
func setBadge(number: Int) {
let number = min(99, max(0, number))
setTitle("\(number)", for: .normal)