diff --git a/Mastodon/Scene/Onboarding/Register/MastodonRegisterViewController.swift b/Mastodon/Scene/Onboarding/Register/MastodonRegisterViewController.swift index 2bfa138b4..6079f4d0c 100644 --- a/Mastodon/Scene/Onboarding/Register/MastodonRegisterViewController.swift +++ b/Mastodon/Scene/Onboarding/Register/MastodonRegisterViewController.swift @@ -58,7 +58,7 @@ final class MastodonRegisterViewController: UIViewController, NeedsDependency, O let largeTitleLabel: UILabel = { let label = UILabel() 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 return label }() @@ -97,7 +97,7 @@ final class MastodonRegisterViewController: UIViewController, NeedsDependency, O let domainLabel: UILabel = { let label = UILabel() label.font = .preferredFont(forTextStyle: .headline) - label.textColor = .black + label.textColor = Asset.Colors.Label.primary.color return label }() diff --git a/Mastodon/Scene/Onboarding/Register/MastodonRegisterViewModel.swift b/Mastodon/Scene/Onboarding/Register/MastodonRegisterViewModel.swift index 45b4599a9..cd6106c23 100644 --- a/Mastodon/Scene/Onboarding/Register/MastodonRegisterViewModel.swift +++ b/Mastodon/Scene/Onboarding/Register/MastodonRegisterViewModel.swift @@ -185,9 +185,9 @@ extension MastodonRegisterViewModel { let attributeString = NSMutableAttributedString() 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: " ")) - 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) return attributeString diff --git a/Mastodon/Scene/Onboarding/ServerRules/MastodonServerRulesViewController.swift b/Mastodon/Scene/Onboarding/ServerRules/MastodonServerRulesViewController.swift index 86b9dc3eb..edc4c59e1 100644 --- a/Mastodon/Scene/Onboarding/ServerRules/MastodonServerRulesViewController.swift +++ b/Mastodon/Scene/Onboarding/ServerRules/MastodonServerRulesViewController.swift @@ -40,7 +40,7 @@ final class MastodonServerRulesViewController: UIViewController, NeedsDependency let rulesLabel: UILabel = { let label = UILabel() label.font = .preferredFont(forTextStyle: .body) - label.textColor = .black + label.textColor = Asset.Colors.Label.primary.color label.text = "Rules" label.numberOfLines = 0 return label diff --git a/Mastodon/Scene/Onboarding/ServerRules/MastodonServerRulesViewModel.swift b/Mastodon/Scene/Onboarding/ServerRules/MastodonServerRulesViewModel.swift index 14b4f0941..b1d000db5 100644 --- a/Mastodon/Scene/Onboarding/ServerRules/MastodonServerRulesViewModel.swift +++ b/Mastodon/Scene/Onboarding/ServerRules/MastodonServerRulesViewModel.swift @@ -40,7 +40,7 @@ final class MastodonServerRulesViewModel { let imageName = String(i + 1) + ".circle.fill" let image = UIImage(systemName: imageName, withConfiguration: configuration)! let attachment = NSTextAttachment() - attachment.image = image.withTintColor(.black) + attachment.image = image.withTintColor(Asset.Colors.Label.primary.color) let imageAttribute = NSAttributedString(attachment: attachment) let ruleString = NSAttributedString(string: " " + rule.text + "\n\n") diff --git a/Mastodon/Scene/Search/CollectionViewCell/SearchRecommendTagsCollectionViewCell.swift b/Mastodon/Scene/Search/CollectionViewCell/SearchRecommendTagsCollectionViewCell.swift index 350720403..685d214e6 100644 --- a/Mastodon/Scene/Search/CollectionViewCell/SearchRecommendTagsCollectionViewCell.swift +++ b/Mastodon/Scene/Search/CollectionViewCell/SearchRecommendTagsCollectionViewCell.swift @@ -78,12 +78,22 @@ extension SearchRecommendTagsCollectionViewCell { func config(with tag: Mastodon.Entity.Tag) { hashTagTitleLabel.text = "# " + tag.name - if let peopleAreTalking = tag.history?.compactMap({ Int($0.uses) }).reduce(0, +) { - let string = L10n.Scene.Search.Recommend.HashTag.peopleTalking(String(peopleAreTalking)) - peopleLabel.text = string - } else { + guard let historys = tag.history else { 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 + } } diff --git a/Mastodon/Scene/Search/View/SearchRecommendCollectionHeader.swift b/Mastodon/Scene/Search/View/SearchRecommendCollectionHeader.swift index 02915ed25..00efecd85 100644 --- a/Mastodon/Scene/Search/View/SearchRecommendCollectionHeader.swift +++ b/Mastodon/Scene/Search/View/SearchRecommendCollectionHeader.swift @@ -11,7 +11,7 @@ import UIKit class SearchRecommendCollectionHeader: UIView { let titleLabel: UILabel = { let label = UILabel() - label.textColor = .black + label.textColor = Asset.Colors.Label.primary.color label.font = .systemFont(ofSize: 20, weight: .semibold) return label }()