diff --git a/Mastodon/Scene/Account/AccountViewController.swift b/Mastodon/Scene/Account/AccountViewController.swift index 4f2ece253..fce9c7320 100644 --- a/Mastodon/Scene/Account/AccountViewController.swift +++ b/Mastodon/Scene/Account/AccountViewController.swift @@ -75,7 +75,7 @@ extension AccountListViewController { override func viewDidLoad() { super.viewDidLoad() - view.backgroundColor = ThemeService.shared.currentTheme.value.systemBackgroundColor.withAlphaComponent(0.9) + setupBackgroundColor(theme: ThemeService.shared.currentTheme.value) ThemeService.shared.currentTheme .receive(on: DispatchQueue.main) .sink { [weak self] theme in @@ -131,7 +131,15 @@ extension AccountListViewController { } private func setupBackgroundColor(theme: Theme) { - view.backgroundColor = theme.systemBackgroundColor.withAlphaComponent(0.9) + let backgroundColor = UIColor { traitCollection in + switch traitCollection.userInterfaceLevel { + case .elevated where traitCollection.userInterfaceStyle == .dark: + return theme.systemElevatedBackgroundColor + default: + return theme.systemBackgroundColor.withAlphaComponent(0.9) + } + } + view.backgroundColor = backgroundColor } } diff --git a/Mastodon/Scene/Account/Cell/AccountListTableViewCell.swift b/Mastodon/Scene/Account/Cell/AccountListTableViewCell.swift index b8f7d5381..f6ab75877 100644 --- a/Mastodon/Scene/Account/Cell/AccountListTableViewCell.swift +++ b/Mastodon/Scene/Account/Cell/AccountListTableViewCell.swift @@ -12,6 +12,7 @@ import MetaTextKit final class AccountListTableViewCell: UITableViewCell { + private var _disposeBag = Set() var disposeBag = Set() let avatarButton = CircleAvatarButton(frame: .zero) @@ -47,6 +48,15 @@ final class AccountListTableViewCell: UITableViewCell { extension AccountListTableViewCell { private func _init() { + backgroundColor = ThemeService.shared.currentTheme.value.secondarySystemGroupedBackgroundColor + ThemeService.shared.currentTheme + .receive(on: RunLoop.main) + .sink { [weak self] theme in + guard let self = self else { return } + self.backgroundColor = ThemeService.shared.currentTheme.value.secondarySystemGroupedBackgroundColor + } + .store(in: &_disposeBag) + avatarButton.translatesAutoresizingMaskIntoConstraints = false contentView.addSubview(avatarButton) NSLayoutConstraint.activate([ diff --git a/Mastodon/Scene/Account/Cell/AddAccountTableViewCell.swift b/Mastodon/Scene/Account/Cell/AddAccountTableViewCell.swift index 722896641..0873c1390 100644 --- a/Mastodon/Scene/Account/Cell/AddAccountTableViewCell.swift +++ b/Mastodon/Scene/Account/Cell/AddAccountTableViewCell.swift @@ -6,10 +6,13 @@ // import UIKit +import Combine import MetaTextKit final class AddAccountTableViewCell: UITableViewCell { + private var _disposeBag = Set() + let iconImageView: UIImageView = { let image = UIImage(systemName: "plus.circle.fill")! let imageView = UIImageView(image: image) @@ -41,6 +44,15 @@ final class AddAccountTableViewCell: UITableViewCell { extension AddAccountTableViewCell { private func _init() { + backgroundColor = ThemeService.shared.currentTheme.value.secondarySystemGroupedBackgroundColor + ThemeService.shared.currentTheme + .receive(on: RunLoop.main) + .sink { [weak self] theme in + guard let self = self else { return } + self.backgroundColor = ThemeService.shared.currentTheme.value.secondarySystemGroupedBackgroundColor + } + .store(in: &_disposeBag) + iconImageView.translatesAutoresizingMaskIntoConstraints = false contentView.addSubview(iconImageView) NSLayoutConstraint.activate([ diff --git a/Mastodon/Scene/Onboarding/Register/MastodonRegisterViewController.swift b/Mastodon/Scene/Onboarding/Register/MastodonRegisterViewController.swift index b86c46745..4cf4da14d 100644 --- a/Mastodon/Scene/Onboarding/Register/MastodonRegisterViewController.swift +++ b/Mastodon/Scene/Onboarding/Register/MastodonRegisterViewController.swift @@ -312,7 +312,7 @@ extension MastodonRegisterViewController { view.addGestureRecognizer(tapGestureRecognizer) tapGestureRecognizer.addTarget(self, action: #selector(tapGestureRecognizerHandler)) - // stackview + // stackView stackView.axis = .vertical stackView.distribution = .fill stackView.spacing = 40 @@ -370,7 +370,7 @@ extension MastodonRegisterViewController { scrollView.frameLayoutGuide.widthAnchor.constraint(equalTo: scrollView.contentLayoutGuide.widthAnchor), ]) - // stackview + // stackView scrollView.addSubview(stackView) stackView.translatesAutoresizingMaskIntoConstraints = false NSLayoutConstraint.activate([ diff --git a/Mastodon/Scene/Report/ReportViewController.swift b/Mastodon/Scene/Report/ReportViewController.swift index 6a7161c91..b97424cb5 100644 --- a/Mastodon/Scene/Report/ReportViewController.swift +++ b/Mastodon/Scene/Report/ReportViewController.swift @@ -51,7 +51,7 @@ class ReportViewController: UIViewController, NeedsDependency { return view }() - lazy var stackview: UIStackView = { + lazy var stackView: UIStackView = { let view = UIStackView() view.axis = .vertical view.alignment = .fill @@ -122,19 +122,19 @@ class ReportViewController: UIViewController, NeedsDependency { setupNavigation() - stackview.addArrangedSubview(header) - stackview.addArrangedSubview(contentView) - stackview.addArrangedSubview(footer) - stackview.addArrangedSubview(bottomSpacing) + stackView.addArrangedSubview(header) + stackView.addArrangedSubview(contentView) + stackView.addArrangedSubview(footer) + stackView.addArrangedSubview(bottomSpacing) contentView.addSubview(tableView) - view.addSubview(stackview) + view.addSubview(stackView) NSLayoutConstraint.activate([ - stackview.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor), - stackview.leadingAnchor.constraint(equalTo: view.leadingAnchor), - stackview.bottomAnchor.constraint(equalTo: view.bottomAnchor), - stackview.trailingAnchor.constraint(equalTo: view.trailingAnchor), + stackView.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor), + stackView.leadingAnchor.constraint(equalTo: view.leadingAnchor), + stackView.bottomAnchor.constraint(equalTo: view.bottomAnchor), + stackView.trailingAnchor.constraint(equalTo: view.trailingAnchor), tableView.topAnchor.constraint(equalTo: contentView.topAnchor), tableView.leadingAnchor.constraint(equalTo: contentView.leadingAnchor), tableView.bottomAnchor.constraint(equalTo: contentView.bottomAnchor), @@ -273,8 +273,8 @@ class ReportViewController: UIViewController, NeedsDependency { navigationItem.titleView = titleView if let user = beReportedUser { do { - let mastodonConent = MastodonContent(content: user.displayNameWithFallback, emojis: user.emojiMeta) - let metaContent = try MastodonMetaContent.convert(document: mastodonConent) + let mastodonContent = MastodonContent(content: user.displayNameWithFallback, emojis: user.emojiMeta) + let metaContent = try MastodonMetaContent.convert(document: mastodonContent) titleView.update(titleMetaContent: metaContent, subtitle: nil) } catch { let metaContent = PlaintextMetaContent(string: user.displayNameWithFallback) diff --git a/Mastodon/Scene/Report/ReportedStatusTableviewCell.swift b/Mastodon/Scene/Report/ReportedStatusTableviewCell.swift index ff566a248..0880c479a 100644 --- a/Mastodon/Scene/Report/ReportedStatusTableviewCell.swift +++ b/Mastodon/Scene/Report/ReportedStatusTableviewCell.swift @@ -19,6 +19,7 @@ final class ReportedStatusTableViewCell: UITableViewCell, StatusCell { static let bottomPaddingHeight: CGFloat = 10 weak var dependency: ReportViewController? + private var _disposeBag = Set() var disposeBag = Set() var observations = Set() @@ -98,7 +99,7 @@ extension ReportedStatusTableViewCell { guard let self = self else { return } self.backgroundColor = ThemeService.shared.currentTheme.value.secondarySystemGroupedBackgroundColor } - .store(in: &disposeBag) + .store(in: &_disposeBag) checkbox.translatesAutoresizingMaskIntoConstraints = false contentView.addSubview(checkbox)