chore: change .black to asset color.

This commit is contained in:
sunxiaojian 2021-04-02 16:50:07 +08:00
parent f24aee739e
commit c0bd7c2497
6 changed files with 21 additions and 11 deletions

View File

@ -58,7 +58,7 @@ final class MastodonRegisterViewController: UIViewController, NeedsDependency, O
let largeTitleLabel: UILabel = { let largeTitleLabel: UILabel = {
let label = UILabel() let label = UILabel()
label.font = UIFontMetrics(forTextStyle: .largeTitle).scaledFont(for: UIFont.boldSystemFont(ofSize: 34)) label.font = UIFontMetrics(forTextStyle: .largeTitle).scaledFont(for: UIFont.boldSystemFont(ofSize: 34))
label.textColor = .black label.textColor = Asset.Colors.Label.primary.color
label.text = L10n.Scene.Register.title label.text = L10n.Scene.Register.title
return label return label
}() }()
@ -97,7 +97,7 @@ final class MastodonRegisterViewController: UIViewController, NeedsDependency, O
let domainLabel: UILabel = { let domainLabel: UILabel = {
let label = UILabel() let label = UILabel()
label.font = .preferredFont(forTextStyle: .headline) label.font = .preferredFont(forTextStyle: .headline)
label.textColor = .black label.textColor = Asset.Colors.Label.primary.color
return label return label
}() }()

View File

@ -185,9 +185,9 @@ extension MastodonRegisterViewModel {
let attributeString = NSMutableAttributedString() let attributeString = NSMutableAttributedString()
let image = MastodonRegisterViewModel.checkmarkImage(font: font) let image = MastodonRegisterViewModel.checkmarkImage(font: font)
attributeString.append(attributedStringImage(with: image, tintColor: validateState == .valid ? .black : .clear)) attributeString.append(attributedStringImage(with: image, tintColor: validateState == .valid ? Asset.Colors.Label.primary.color : .clear))
attributeString.append(NSAttributedString(string: " ")) attributeString.append(NSAttributedString(string: " "))
let eightCharactersDescription = NSAttributedString(string: L10n.Scene.Register.Input.Password.hint, attributes: [NSAttributedString.Key.font: font, NSAttributedString.Key.foregroundColor: UIColor.black]) let eightCharactersDescription = NSAttributedString(string: L10n.Scene.Register.Input.Password.hint, attributes: [NSAttributedString.Key.font: font, NSAttributedString.Key.foregroundColor: Asset.Colors.Label.primary.color])
attributeString.append(eightCharactersDescription) attributeString.append(eightCharactersDescription)
return attributeString return attributeString

View File

@ -40,7 +40,7 @@ final class MastodonServerRulesViewController: UIViewController, NeedsDependency
let rulesLabel: UILabel = { let rulesLabel: UILabel = {
let label = UILabel() let label = UILabel()
label.font = .preferredFont(forTextStyle: .body) label.font = .preferredFont(forTextStyle: .body)
label.textColor = .black label.textColor = Asset.Colors.Label.primary.color
label.text = "Rules" label.text = "Rules"
label.numberOfLines = 0 label.numberOfLines = 0
return label return label

View File

@ -40,7 +40,7 @@ final class MastodonServerRulesViewModel {
let imageName = String(i + 1) + ".circle.fill" let imageName = String(i + 1) + ".circle.fill"
let image = UIImage(systemName: imageName, withConfiguration: configuration)! let image = UIImage(systemName: imageName, withConfiguration: configuration)!
let attachment = NSTextAttachment() let attachment = NSTextAttachment()
attachment.image = image.withTintColor(.black) attachment.image = image.withTintColor(Asset.Colors.Label.primary.color)
let imageAttribute = NSAttributedString(attachment: attachment) let imageAttribute = NSAttributedString(attachment: attachment)
let ruleString = NSAttributedString(string: " " + rule.text + "\n\n") let ruleString = NSAttributedString(string: " " + rule.text + "\n\n")

View File

@ -78,12 +78,22 @@ extension SearchRecommendTagsCollectionViewCell {
func config(with tag: Mastodon.Entity.Tag) { func config(with tag: Mastodon.Entity.Tag) {
hashTagTitleLabel.text = "# " + tag.name hashTagTitleLabel.text = "# " + tag.name
if let peopleAreTalking = tag.history?.compactMap({ Int($0.uses) }).reduce(0, +) { guard let historys = tag.history else {
let string = L10n.Scene.Search.Recommend.HashTag.peopleTalking(String(peopleAreTalking))
peopleLabel.text = string
} else {
peopleLabel.text = "" peopleLabel.text = ""
return
} }
var recentHistory = [Mastodon.Entity.History]()
for history in historys {
if Int(history.uses) == 0 {
break
} else {
recentHistory.append(history)
}
}
let peopleAreTalking = recentHistory.compactMap({ Int($0.accounts) }).reduce(0, +)
let string = L10n.Scene.Search.Recommend.HashTag.peopleTalking(String(peopleAreTalking))
peopleLabel.text = string
} }
} }

View File

@ -11,7 +11,7 @@ import UIKit
class SearchRecommendCollectionHeader: UIView { class SearchRecommendCollectionHeader: UIView {
let titleLabel: UILabel = { let titleLabel: UILabel = {
let label = UILabel() let label = UILabel()
label.textColor = .black label.textColor = Asset.Colors.Label.primary.color
label.font = .systemFont(ofSize: 20, weight: .semibold) label.font = .systemFont(ofSize: 20, weight: .semibold)
return label return label
}() }()