Simplify Theme (#1121)
This commit is contained in:
parent
be11f632cc
commit
e473084038
|
@ -351,7 +351,6 @@
|
|||
DB7A9F912818EAF10016AF98 /* MastodonRegisterView.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB7A9F902818EAF10016AF98 /* MastodonRegisterView.swift */; };
|
||||
DB7A9F932818F33C0016AF98 /* MastodonServerRulesViewController+Debug.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB7A9F922818F33C0016AF98 /* MastodonServerRulesViewController+Debug.swift */; };
|
||||
DB7F48452620241000796008 /* ProfileHeaderViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB7F48442620241000796008 /* ProfileHeaderViewModel.swift */; };
|
||||
DB8190C62601FF0400020C08 /* AttachmentContainerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB8190C52601FF0400020C08 /* AttachmentContainerView.swift */; };
|
||||
DB848E33282B62A800A302CC /* ReportResultView.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB848E32282B62A800A302CC /* ReportResultView.swift */; };
|
||||
DB852D1926FAEB6B00FC9D81 /* SidebarViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB852D1826FAEB6B00FC9D81 /* SidebarViewController.swift */; };
|
||||
DB852D1C26FB021500FC9D81 /* RootSplitViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB852D1B26FB021500FC9D81 /* RootSplitViewController.swift */; };
|
||||
|
@ -386,7 +385,6 @@
|
|||
DB98EB6527B216500082E365 /* ReportResultViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB98EB6427B216500082E365 /* ReportResultViewModel.swift */; };
|
||||
DB98EB6927B21A7C0082E365 /* ReportResultActionTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB98EB6827B21A7C0082E365 /* ReportResultActionTableViewCell.swift */; };
|
||||
DB98EB6B27B243470082E365 /* SettingsAppearanceTableViewCell+ViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB98EB6A27B243470082E365 /* SettingsAppearanceTableViewCell+ViewModel.swift */; };
|
||||
DB9A486C26032AC1008B817C /* AttachmentContainerView+EmptyStateView.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB9A486B26032AC1008B817C /* AttachmentContainerView+EmptyStateView.swift */; };
|
||||
DB9D6BE925E4F5340051B173 /* SearchViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB9D6BE825E4F5340051B173 /* SearchViewController.swift */; };
|
||||
DB9D6BF825E4F5690051B173 /* NotificationViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB9D6BF725E4F5690051B173 /* NotificationViewController.swift */; };
|
||||
DB9D6BFF25E4F5940051B173 /* ProfileViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB9D6BFE25E4F5940051B173 /* ProfileViewController.swift */; };
|
||||
|
@ -1041,7 +1039,6 @@
|
|||
DB7A9F902818EAF10016AF98 /* MastodonRegisterView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MastodonRegisterView.swift; sourceTree = "<group>"; };
|
||||
DB7A9F922818F33C0016AF98 /* MastodonServerRulesViewController+Debug.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "MastodonServerRulesViewController+Debug.swift"; sourceTree = "<group>"; };
|
||||
DB7F48442620241000796008 /* ProfileHeaderViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProfileHeaderViewModel.swift; sourceTree = "<group>"; };
|
||||
DB8190C52601FF0400020C08 /* AttachmentContainerView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AttachmentContainerView.swift; sourceTree = "<group>"; };
|
||||
DB848E32282B62A800A302CC /* ReportResultView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReportResultView.swift; sourceTree = "<group>"; };
|
||||
DB852D1826FAEB6B00FC9D81 /* SidebarViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SidebarViewController.swift; sourceTree = "<group>"; };
|
||||
DB852D1B26FB021500FC9D81 /* RootSplitViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RootSplitViewController.swift; sourceTree = "<group>"; };
|
||||
|
@ -1092,7 +1089,6 @@
|
|||
DB98EB6427B216500082E365 /* ReportResultViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReportResultViewModel.swift; sourceTree = "<group>"; };
|
||||
DB98EB6827B21A7C0082E365 /* ReportResultActionTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReportResultActionTableViewCell.swift; sourceTree = "<group>"; };
|
||||
DB98EB6A27B243470082E365 /* SettingsAppearanceTableViewCell+ViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "SettingsAppearanceTableViewCell+ViewModel.swift"; sourceTree = "<group>"; };
|
||||
DB9A486B26032AC1008B817C /* AttachmentContainerView+EmptyStateView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "AttachmentContainerView+EmptyStateView.swift"; sourceTree = "<group>"; };
|
||||
DB9D6BE825E4F5340051B173 /* SearchViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SearchViewController.swift; sourceTree = "<group>"; };
|
||||
DB9D6BF725E4F5690051B173 /* NotificationViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationViewController.swift; sourceTree = "<group>"; };
|
||||
DB9D6BFE25E4F5940051B173 /* ProfileViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProfileViewController.swift; sourceTree = "<group>"; };
|
||||
|
@ -2170,8 +2166,6 @@
|
|||
DB55D32225FB4D320002F825 /* View */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
DB8190C52601FF0400020C08 /* AttachmentContainerView.swift */,
|
||||
DB9A486B26032AC1008B817C /* AttachmentContainerView+EmptyStateView.swift */,
|
||||
DBC7A671260C897100E57475 /* StatusContentWarningEditorView.swift */,
|
||||
);
|
||||
path = View;
|
||||
|
@ -3719,7 +3713,6 @@
|
|||
5B90C45F262599800002E742 /* SettingsToggleTableViewCell.swift in Sources */,
|
||||
2D694A7425F9EB4E0038ADDC /* ContentWarningOverlayView.swift in Sources */,
|
||||
DB0FCB7827957678006C02E2 /* DataSourceProvider+UITableViewDelegate.swift in Sources */,
|
||||
DB9A486C26032AC1008B817C /* AttachmentContainerView+EmptyStateView.swift in Sources */,
|
||||
5D0393902612D259007FE196 /* WebViewController.swift in Sources */,
|
||||
DB98EB6227B215EB0082E365 /* ReportResultViewController.swift in Sources */,
|
||||
DB6B74F4272FBAE700C70B6E /* FollowerListViewModel+Diffable.swift in Sources */,
|
||||
|
@ -3870,7 +3863,6 @@
|
|||
DB697DDD278F521D004EF2F7 /* DataSourceFacade.swift in Sources */,
|
||||
DBCC3B30261440A50045B23D /* UITabBarController.swift in Sources */,
|
||||
DB3E6FE42806A5B800B035AE /* DiscoverySection.swift in Sources */,
|
||||
DB8190C62601FF0400020C08 /* AttachmentContainerView.swift in Sources */,
|
||||
DB697DDB278F4DE3004EF2F7 /* DataSourceProvider+StatusTableViewCellDelegate.swift in Sources */,
|
||||
DB87D4512609CF1E00D12C0D /* ComposeStatusPollOptionAppendEntryCollectionViewCell.swift in Sources */,
|
||||
DBB45B5627B39FC9002DC5A7 /* MediaPreviewVideoViewController.swift in Sources */,
|
||||
|
|
|
@ -516,7 +516,7 @@ private extension SceneCoordinator {
|
|||
return nil
|
||||
}
|
||||
let _viewController = SFSafariViewController(url: url)
|
||||
_viewController.preferredBarTintColor = ThemeService.shared.currentTheme.value.navigationBarBackgroundColor
|
||||
_viewController.preferredBarTintColor = SystemTheme.navigationBarBackgroundColor
|
||||
_viewController.preferredControlTintColor = Asset.Colors.Brand.blurple.color
|
||||
viewController = _viewController
|
||||
|
||||
|
|
|
@ -83,14 +83,7 @@ extension AccountListViewController {
|
|||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
||||
setupBackgroundColor(theme: ThemeService.shared.currentTheme.value)
|
||||
ThemeService.shared.currentTheme
|
||||
.receive(on: DispatchQueue.main)
|
||||
.sink { [weak self] theme in
|
||||
guard let self = self else { return }
|
||||
self.setupBackgroundColor(theme: theme)
|
||||
}
|
||||
.store(in: &disposeBag)
|
||||
setupBackgroundColor()
|
||||
navigationItem.rightBarButtonItem = addBarButtonItem
|
||||
|
||||
dragIndicatorView.translatesAutoresizingMaskIntoConstraints = false
|
||||
|
@ -134,13 +127,13 @@ extension AccountListViewController {
|
|||
.store(in: &disposeBag)
|
||||
}
|
||||
|
||||
private func setupBackgroundColor(theme: Theme) {
|
||||
private func setupBackgroundColor() {
|
||||
let backgroundColor = UIColor { traitCollection in
|
||||
switch traitCollection.userInterfaceLevel {
|
||||
case .elevated where traitCollection.userInterfaceStyle == .dark:
|
||||
return theme.systemElevatedBackgroundColor
|
||||
return SystemTheme.systemElevatedBackgroundColor
|
||||
default:
|
||||
return theme.systemBackgroundColor.withAlphaComponent(0.9)
|
||||
return .systemBackground.withAlphaComponent(0.9)
|
||||
}
|
||||
}
|
||||
view.backgroundColor = backgroundColor
|
||||
|
|
|
@ -50,14 +50,7 @@ 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)
|
||||
backgroundColor = .secondarySystemGroupedBackground
|
||||
|
||||
avatarButton.translatesAutoresizingMaskIntoConstraints = false
|
||||
contentView.addSubview(avatarButton)
|
||||
|
|
|
@ -48,14 +48,7 @@ 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)
|
||||
backgroundColor = .secondarySystemGroupedBackground
|
||||
|
||||
iconImageView.translatesAutoresizingMaskIntoConstraints = false
|
||||
contentView.addSubview(iconImageView)
|
||||
|
|
|
@ -32,7 +32,7 @@ final class ComposeStatusPollOptionAppendEntryCollectionViewCell: UICollectionVi
|
|||
|
||||
override var isHighlighted: Bool {
|
||||
didSet {
|
||||
pollOptionView.roundedBackgroundView.backgroundColor = isHighlighted ? ThemeService.shared.currentTheme.value.tertiarySystemGroupedBackgroundColor.withAlphaComponent(0.6) : ThemeService.shared.currentTheme.value.tertiarySystemGroupedBackgroundColor
|
||||
pollOptionView.roundedBackgroundView.backgroundColor = isHighlighted ? UIColor.tertiarySystemGroupedBackground.withAlphaComponent(0.6) : .tertiarySystemGroupedBackground
|
||||
pollOptionView.plusCircleImageView.tintColor = isHighlighted ? Asset.Colors.Brand.blurple.color.withAlphaComponent(0.5) : Asset.Colors.Brand.blurple.color
|
||||
}
|
||||
}
|
||||
|
@ -85,7 +85,7 @@ extension ComposeStatusPollOptionAppendEntryCollectionViewCell {
|
|||
pollOptionView.optionTextField.isHidden = true
|
||||
pollOptionView.plusCircleImageView.isHidden = false
|
||||
|
||||
pollOptionView.roundedBackgroundView.backgroundColor = ThemeService.shared.currentTheme.value.tertiarySystemGroupedBackgroundColor
|
||||
pollOptionView.roundedBackgroundView.backgroundColor = .tertiarySystemGroupedBackground
|
||||
setupBorderColor()
|
||||
|
||||
pollOptionView.addGestureRecognizer(singleTagGestureRecognizer)
|
||||
|
@ -96,7 +96,7 @@ extension ComposeStatusPollOptionAppendEntryCollectionViewCell {
|
|||
|
||||
private func setupBorderColor() {
|
||||
pollOptionView.roundedBackgroundView.layer.borderWidth = 1
|
||||
pollOptionView.roundedBackgroundView.layer.borderColor = ThemeService.shared.currentTheme.value.tableViewCellSelectionBackgroundColor.withAlphaComponent(0.3).cgColor
|
||||
pollOptionView.roundedBackgroundView.layer.borderColor = SystemTheme.tableViewCellSelectionBackgroundColor.withAlphaComponent(0.3).cgColor
|
||||
}
|
||||
|
||||
override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) {
|
||||
|
|
|
@ -87,9 +87,9 @@ extension ComposeStatusPollOptionCollectionViewCell {
|
|||
pollOptionView.optionPercentageLabel.isHidden = true
|
||||
pollOptionView.optionTextField.text = nil
|
||||
|
||||
pollOptionView.roundedBackgroundView.backgroundColor = ThemeService.shared.currentTheme.value.tertiarySystemGroupedBackgroundColor
|
||||
pollOptionView.roundedBackgroundView.backgroundColor = .tertiarySystemGroupedBackground
|
||||
pollOptionView.checkmarkBackgroundView.backgroundColor = UIColor(dynamicProvider: { traitCollection in
|
||||
return traitCollection.userInterfaceStyle == .light ? .white : ThemeService.shared.currentTheme.value.tableViewCellSelectionBackgroundColor
|
||||
return traitCollection.userInterfaceStyle == .light ? .white : SystemTheme.tableViewCellSelectionBackgroundColor
|
||||
})
|
||||
setupBorderColor()
|
||||
|
||||
|
@ -109,9 +109,9 @@ extension ComposeStatusPollOptionCollectionViewCell {
|
|||
|
||||
private func setupBorderColor() {
|
||||
pollOptionView.roundedBackgroundView.layer.borderWidth = 1
|
||||
pollOptionView.roundedBackgroundView.layer.borderColor = ThemeService.shared.currentTheme.value.tableViewCellSelectionBackgroundColor.withAlphaComponent(0.3).cgColor
|
||||
pollOptionView.roundedBackgroundView.layer.borderColor = SystemTheme.tableViewCellSelectionBackgroundColor.withAlphaComponent(0.3).cgColor
|
||||
|
||||
pollOptionView.checkmarkBackgroundView.layer.borderColor = ThemeService.shared.currentTheme.value.tableViewCellSelectionBackgroundColor.withAlphaComponent(0.3).cgColor
|
||||
pollOptionView.checkmarkBackgroundView.layer.borderColor = SystemTheme.tableViewCellSelectionBackgroundColor.withAlphaComponent(0.3).cgColor
|
||||
pollOptionView.checkmarkBackgroundView.layer.borderWidth = 1
|
||||
}
|
||||
|
||||
|
|
|
@ -1,137 +0,0 @@
|
|||
//
|
||||
// AttachmentContainerView+EmptyStateView.swift
|
||||
// Mastodon
|
||||
//
|
||||
// Created by MainasuK Cirno on 2021-3-18.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import MastodonAsset
|
||||
import MastodonCore
|
||||
import MastodonUI
|
||||
import MastodonLocalization
|
||||
|
||||
//extension AttachmentContainerView {
|
||||
// final class EmptyStateView: UIView {
|
||||
//
|
||||
// static let photoFillSplitImage = Asset.Connectivity.photoFillSplit.image.withRenderingMode(.alwaysTemplate)
|
||||
// static let videoSplashImage: UIImage = {
|
||||
// let image = UIImage(systemName: "video.slash")!.withConfiguration(UIImage.SymbolConfiguration(pointSize: 64))
|
||||
// return image
|
||||
// }()
|
||||
//
|
||||
// let imageView: UIImageView = {
|
||||
// let imageView = UIImageView()
|
||||
// imageView.tintColor = Asset.Colors.Label.secondary.color
|
||||
// imageView.image = AttachmentContainerView.EmptyStateView.photoFillSplitImage
|
||||
// return imageView
|
||||
// }()
|
||||
// let label: UILabel = {
|
||||
// let label = UILabel()
|
||||
// label.font = .preferredFont(forTextStyle: .body)
|
||||
// label.textColor = Asset.Colors.Label.secondary.color
|
||||
// label.textAlignment = .center
|
||||
// label.text = L10n.Scene.Compose.Attachment.attachmentBroken(L10n.Scene.Compose.Attachment.photo)
|
||||
// label.numberOfLines = 2
|
||||
// label.adjustsFontSizeToFitWidth = true
|
||||
// label.minimumScaleFactor = 0.3
|
||||
// return label
|
||||
// }()
|
||||
//
|
||||
// override init(frame: CGRect) {
|
||||
// super.init(frame: frame)
|
||||
// _init()
|
||||
// }
|
||||
//
|
||||
// required init?(coder: NSCoder) {
|
||||
// super.init(coder: coder)
|
||||
// _init()
|
||||
// }
|
||||
//
|
||||
// }
|
||||
//}
|
||||
|
||||
//extension AttachmentContainerView.EmptyStateView {
|
||||
// private func _init() {
|
||||
// layer.masksToBounds = true
|
||||
// layer.cornerRadius = AttachmentContainerView.containerViewCornerRadius
|
||||
// layer.cornerCurve = .continuous
|
||||
// backgroundColor = ThemeService.shared.currentTheme.value.systemGroupedBackgroundColor
|
||||
//
|
||||
// let stackView = UIStackView()
|
||||
// stackView.axis = .vertical
|
||||
// stackView.alignment = .center
|
||||
// stackView.translatesAutoresizingMaskIntoConstraints = false
|
||||
// addSubview(stackView)
|
||||
// NSLayoutConstraint.activate([
|
||||
// stackView.topAnchor.constraint(equalTo: topAnchor),
|
||||
// stackView.leadingAnchor.constraint(equalTo: leadingAnchor),
|
||||
// stackView.trailingAnchor.constraint(equalTo: trailingAnchor),
|
||||
// stackView.bottomAnchor.constraint(equalTo: bottomAnchor),
|
||||
// ])
|
||||
// let topPaddingView = UIView()
|
||||
// let middlePaddingView = UIView()
|
||||
// let bottomPaddingView = UIView()
|
||||
//
|
||||
// topPaddingView.translatesAutoresizingMaskIntoConstraints = false
|
||||
// stackView.addArrangedSubview(topPaddingView)
|
||||
// imageView.translatesAutoresizingMaskIntoConstraints = false
|
||||
// stackView.addArrangedSubview(imageView)
|
||||
// NSLayoutConstraint.activate([
|
||||
// imageView.widthAnchor.constraint(equalToConstant: 92).priority(.defaultHigh),
|
||||
// imageView.heightAnchor.constraint(equalToConstant: 76).priority(.defaultHigh),
|
||||
// ])
|
||||
// imageView.setContentHuggingPriority(.required - 1, for: .vertical)
|
||||
// middlePaddingView.translatesAutoresizingMaskIntoConstraints = false
|
||||
// stackView.addArrangedSubview(middlePaddingView)
|
||||
// stackView.addArrangedSubview(label)
|
||||
// bottomPaddingView.translatesAutoresizingMaskIntoConstraints = false
|
||||
// stackView.addArrangedSubview(bottomPaddingView)
|
||||
// NSLayoutConstraint.activate([
|
||||
// topPaddingView.heightAnchor.constraint(equalTo: middlePaddingView.heightAnchor, multiplier: 1.5),
|
||||
// bottomPaddingView.heightAnchor.constraint(equalTo: middlePaddingView.heightAnchor, multiplier: 1.5),
|
||||
// ])
|
||||
// }
|
||||
//}
|
||||
|
||||
//#if canImport(SwiftUI) && DEBUG
|
||||
//import SwiftUI
|
||||
//
|
||||
//struct AttachmentContainerView_EmptyStateView_Previews: PreviewProvider {
|
||||
//
|
||||
// static var previews: some View {
|
||||
// Group {
|
||||
// UIViewPreview(width: 375) {
|
||||
// let emptyStateView = AttachmentContainerView.EmptyStateView()
|
||||
// NSLayoutConstraint.activate([
|
||||
// emptyStateView.heightAnchor.constraint(equalToConstant: 205)
|
||||
// ])
|
||||
// return emptyStateView
|
||||
// }
|
||||
// .previewLayout(.fixed(width: 375, height: 205))
|
||||
// UIViewPreview(width: 375) {
|
||||
// let emptyStateView = AttachmentContainerView.EmptyStateView()
|
||||
// NSLayoutConstraint.activate([
|
||||
// emptyStateView.heightAnchor.constraint(equalToConstant: 205)
|
||||
// ])
|
||||
// return emptyStateView
|
||||
// }
|
||||
// .preferredColorScheme(.dark)
|
||||
// .previewLayout(.fixed(width: 375, height: 205))
|
||||
// UIViewPreview(width: 375) {
|
||||
// let emptyStateView = AttachmentContainerView.EmptyStateView()
|
||||
// emptyStateView.imageView.image = AttachmentContainerView.EmptyStateView.videoSplashImage
|
||||
// emptyStateView.label.text = L10n.Scene.Compose.Attachment.attachmentBroken(L10n.Scene.Compose.Attachment.video)
|
||||
//
|
||||
// NSLayoutConstraint.activate([
|
||||
// emptyStateView.heightAnchor.constraint(equalToConstant: 205)
|
||||
// ])
|
||||
// return emptyStateView
|
||||
// }
|
||||
// .previewLayout(.fixed(width: 375, height: 205))
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//}
|
||||
//
|
||||
//#endif
|
|
@ -1,177 +0,0 @@
|
|||
//
|
||||
// AttachmentContainerView.swift
|
||||
// Mastodon
|
||||
//
|
||||
// Created by MainasuK Cirno on 2021-3-17.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import SwiftUI
|
||||
import MastodonUI
|
||||
|
||||
//final class AttachmentContainerView: UIView {
|
||||
//
|
||||
// static let containerViewCornerRadius: CGFloat = 4
|
||||
//
|
||||
// var descriptionBackgroundViewFrameObservation: NSKeyValueObservation?
|
||||
//
|
||||
// let activityIndicatorView: UIActivityIndicatorView = {
|
||||
// let activityIndicatorView = UIActivityIndicatorView(style: .large)
|
||||
// activityIndicatorView.color = UIColor.white.withAlphaComponent(0.8)
|
||||
// return activityIndicatorView
|
||||
// }()
|
||||
//
|
||||
// let previewImageView: UIImageView = {
|
||||
// let imageView = UIImageView()
|
||||
// imageView.contentMode = .scaleAspectFill
|
||||
// imageView.layer.cornerRadius = AttachmentContainerView.containerViewCornerRadius
|
||||
// imageView.layer.cornerCurve = .continuous
|
||||
// imageView.layer.masksToBounds = true
|
||||
// return imageView
|
||||
// }()
|
||||
//
|
||||
// let emptyStateView = AttachmentContainerView.EmptyStateView()
|
||||
// let descriptionBackgroundView: UIView = {
|
||||
// let view = UIView()
|
||||
// view.layer.masksToBounds = true
|
||||
// view.layer.cornerRadius = AttachmentContainerView.containerViewCornerRadius
|
||||
// view.layer.cornerCurve = .continuous
|
||||
// view.layer.maskedCorners = [.layerMinXMaxYCorner, .layerMaxXMaxYCorner]
|
||||
// view.layoutMargins = UIEdgeInsets(top: 0, left: 8, bottom: 5, right: 8)
|
||||
// return view
|
||||
// }()
|
||||
// let descriptionBackgroundGradientLayer: CAGradientLayer = {
|
||||
// let gradientLayer = CAGradientLayer()
|
||||
// gradientLayer.colors = [UIColor.black.withAlphaComponent(0.0).cgColor, UIColor.black.withAlphaComponent(0.69).cgColor]
|
||||
// gradientLayer.locations = [0.0, 1.0]
|
||||
// gradientLayer.startPoint = CGPoint(x: 0.5, y: 0)
|
||||
// gradientLayer.endPoint = CGPoint(x: 0.5, y: 1)
|
||||
// gradientLayer.frame = CGRect(x: 0, y: 0, width: 100, height: 100)
|
||||
// return gradientLayer
|
||||
// }()
|
||||
// let descriptionTextView: UITextView = {
|
||||
// let textView = UITextView()
|
||||
// textView.showsVerticalScrollIndicator = false
|
||||
// textView.backgroundColor = .clear
|
||||
// textView.textColor = .white
|
||||
// textView.font = UIFontMetrics(forTextStyle: .body).scaledFont(for: .systemFont(ofSize: 15), maximumPointSize: 20)
|
||||
// textView.placeholder = L10n.Scene.Compose.Attachment.descriptionPhoto
|
||||
// textView.placeholderColor = UIColor.white.withAlphaComponent(0.6) // force white with alpha for Light/Dark mode
|
||||
// textView.returnKeyType = .done
|
||||
// return textView
|
||||
// }()
|
||||
//
|
||||
// private(set) lazy var contentView = AttachmentView(viewModel: viewModel)
|
||||
// public var viewModel: AttachmentView.ViewModel!
|
||||
//
|
||||
// override init(frame: CGRect) {
|
||||
// super.init(frame: frame)
|
||||
// _init()
|
||||
// }
|
||||
//
|
||||
// required init?(coder: NSCoder) {
|
||||
// super.init(coder: coder)
|
||||
// _init()
|
||||
// }
|
||||
//
|
||||
//}
|
||||
|
||||
//extension AttachmentContainerView {
|
||||
//
|
||||
// private func _init() {
|
||||
// let hostingViewController = UIHostingController(rootView: contentView)
|
||||
// hostingViewController.view.translatesAutoresizingMaskIntoConstraints = false
|
||||
// addSubview(hostingViewController.view)
|
||||
// NSLayoutConstraint.activate([
|
||||
// hostingViewController.view.topAnchor.constraint(equalTo: topAnchor),
|
||||
// hostingViewController.view.leadingAnchor.constraint(equalTo: leadingAnchor),
|
||||
// hostingViewController.view.trailingAnchor.constraint(equalTo: trailingAnchor),
|
||||
// hostingViewController.view.bottomAnchor.constraint(equalTo: bottomAnchor),
|
||||
// ])
|
||||
//
|
||||
// previewImageView.translatesAutoresizingMaskIntoConstraints = false
|
||||
// addSubview(previewImageView)
|
||||
// NSLayoutConstraint.activate([
|
||||
// previewImageView.topAnchor.constraint(equalTo: topAnchor),
|
||||
// previewImageView.leadingAnchor.constraint(equalTo: leadingAnchor),
|
||||
// previewImageView.trailingAnchor.constraint(equalTo: trailingAnchor),
|
||||
// previewImageView.bottomAnchor.constraint(equalTo: bottomAnchor),
|
||||
// ])
|
||||
//
|
||||
// descriptionBackgroundView.translatesAutoresizingMaskIntoConstraints = false
|
||||
// addSubview(descriptionBackgroundView)
|
||||
// NSLayoutConstraint.activate([
|
||||
// descriptionBackgroundView.leadingAnchor.constraint(equalTo: leadingAnchor),
|
||||
// descriptionBackgroundView.trailingAnchor.constraint(equalTo: trailingAnchor),
|
||||
// descriptionBackgroundView.bottomAnchor.constraint(equalTo: bottomAnchor),
|
||||
// descriptionBackgroundView.heightAnchor.constraint(equalTo: heightAnchor, multiplier: 0.3),
|
||||
// ])
|
||||
// descriptionBackgroundView.layer.addSublayer(descriptionBackgroundGradientLayer)
|
||||
// descriptionBackgroundViewFrameObservation = descriptionBackgroundView.observe(\.bounds, options: [.initial, .new]) { [weak self] _, _ in
|
||||
// guard let self = self else { return }
|
||||
// self.descriptionBackgroundGradientLayer.frame = self.descriptionBackgroundView.bounds
|
||||
// }
|
||||
//
|
||||
// descriptionTextView.translatesAutoresizingMaskIntoConstraints = false
|
||||
// descriptionBackgroundView.addSubview(descriptionTextView)
|
||||
// NSLayoutConstraint.activate([
|
||||
// descriptionTextView.leadingAnchor.constraint(equalTo: descriptionBackgroundView.layoutMarginsGuide.leadingAnchor),
|
||||
// descriptionTextView.trailingAnchor.constraint(equalTo: descriptionBackgroundView.layoutMarginsGuide.trailingAnchor),
|
||||
// descriptionBackgroundView.layoutMarginsGuide.bottomAnchor.constraint(equalTo: descriptionTextView.bottomAnchor),
|
||||
// descriptionTextView.heightAnchor.constraint(lessThanOrEqualToConstant: 36),
|
||||
// ])
|
||||
//
|
||||
// emptyStateView.translatesAutoresizingMaskIntoConstraints = false
|
||||
// addSubview(emptyStateView)
|
||||
// NSLayoutConstraint.activate([
|
||||
// emptyStateView.topAnchor.constraint(equalTo: topAnchor),
|
||||
// emptyStateView.leadingAnchor.constraint(equalTo: leadingAnchor),
|
||||
// emptyStateView.trailingAnchor.constraint(equalTo: trailingAnchor),
|
||||
// emptyStateView.bottomAnchor.constraint(equalTo: bottomAnchor),
|
||||
// ])
|
||||
//
|
||||
// activityIndicatorView.translatesAutoresizingMaskIntoConstraints = false
|
||||
// addSubview(activityIndicatorView)
|
||||
// NSLayoutConstraint.activate([
|
||||
// activityIndicatorView.centerXAnchor.constraint(equalTo: previewImageView.centerXAnchor),
|
||||
// activityIndicatorView.centerYAnchor.constraint(equalTo: previewImageView.centerYAnchor),
|
||||
// ])
|
||||
//
|
||||
// setupBroader()
|
||||
//
|
||||
// emptyStateView.isHidden = true
|
||||
// activityIndicatorView.hidesWhenStopped = true
|
||||
// activityIndicatorView.startAnimating()
|
||||
//
|
||||
// descriptionTextView.delegate = self
|
||||
// }
|
||||
//
|
||||
//// override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) {
|
||||
// super.traitCollectionDidChange(previousTraitCollection)
|
||||
//
|
||||
// setupBroader()
|
||||
// }
|
||||
//
|
||||
//}
|
||||
//
|
||||
//extension AttachmentContainerView {
|
||||
//
|
||||
// private func setupBroader() {
|
||||
// emptyStateView.layer.borderWidth = 1
|
||||
// emptyStateView.layer.borderColor = traitCollection.userInterfaceStyle == .dark ? ThemeService.shared.currentTheme.value.tableViewCellSelectionBackgroundColor.cgColor : nil
|
||||
// }
|
||||
//
|
||||
//}
|
||||
|
||||
//// MARK: - UITextViewDelegate
|
||||
//extension AttachmentContainerView: UITextViewDelegate {
|
||||
// func textView(_ textView: UITextView, shouldChangeTextIn range: NSRange, replacementText text: String) -> Bool {
|
||||
// // let keyboard dismiss when input description with "done" type return key
|
||||
// if textView === descriptionTextView, text == "\n" {
|
||||
// textView.resignFirstResponder()
|
||||
// return false
|
||||
// }
|
||||
//
|
||||
// return true
|
||||
// }
|
||||
//}
|
|
@ -17,7 +17,7 @@ final class StatusContentWarningEditorView: UIView {
|
|||
// default hidden
|
||||
let containerBackgroundView: UIView = {
|
||||
let view = UIView()
|
||||
view.backgroundColor = ThemeService.shared.currentTheme.value.secondarySystemBackgroundColor
|
||||
view.backgroundColor = .secondarySystemBackground
|
||||
return view
|
||||
}()
|
||||
|
||||
|
|
|
@ -37,14 +37,7 @@ extension DiscoveryCommunityViewController {
|
|||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
||||
view.backgroundColor = ThemeService.shared.currentTheme.value.secondarySystemBackgroundColor
|
||||
ThemeService.shared.currentTheme
|
||||
.receive(on: DispatchQueue.main)
|
||||
.sink { [weak self] theme in
|
||||
guard let self = self else { return }
|
||||
self.view.backgroundColor = theme.secondarySystemBackgroundColor
|
||||
}
|
||||
.store(in: &disposeBag)
|
||||
view.backgroundColor = .secondarySystemBackground
|
||||
|
||||
tableView.translatesAutoresizingMaskIntoConstraints = false
|
||||
view.addSubview(tableView)
|
||||
|
|
|
@ -80,14 +80,7 @@ extension DiscoveryViewController {
|
|||
public override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
||||
setupAppearance(theme: ThemeService.shared.currentTheme.value)
|
||||
ThemeService.shared.currentTheme
|
||||
.receive(on: DispatchQueue.main)
|
||||
.sink { [weak self] theme in
|
||||
guard let self = self else { return }
|
||||
self.setupAppearance(theme: theme)
|
||||
}
|
||||
.store(in: &disposeBag)
|
||||
setupAppearance()
|
||||
|
||||
dataSource = viewModel
|
||||
addBar(
|
||||
|
@ -116,9 +109,9 @@ extension DiscoveryViewController {
|
|||
|
||||
extension DiscoveryViewController {
|
||||
|
||||
private func setupAppearance(theme: Theme) {
|
||||
view.backgroundColor = theme.secondarySystemBackgroundColor
|
||||
buttonBarBackgroundView.backgroundColor = theme.systemBackgroundColor
|
||||
private func setupAppearance() {
|
||||
view.backgroundColor = .secondarySystemBackground
|
||||
buttonBarBackgroundView.backgroundColor = .systemBackground
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -37,14 +37,7 @@ extension DiscoveryForYouViewController {
|
|||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
||||
view.backgroundColor = ThemeService.shared.currentTheme.value.secondarySystemBackgroundColor
|
||||
ThemeService.shared.currentTheme
|
||||
.receive(on: DispatchQueue.main)
|
||||
.sink { [weak self] theme in
|
||||
guard let self = self else { return }
|
||||
self.view.backgroundColor = theme.secondarySystemBackgroundColor
|
||||
}
|
||||
.store(in: &disposeBag)
|
||||
view.backgroundColor = .secondarySystemBackground
|
||||
|
||||
tableView.translatesAutoresizingMaskIntoConstraints = false
|
||||
view.addSubview(tableView)
|
||||
|
|
|
@ -39,14 +39,7 @@ extension DiscoveryHashtagsViewController {
|
|||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
||||
view.backgroundColor = ThemeService.shared.currentTheme.value.secondarySystemBackgroundColor
|
||||
ThemeService.shared.currentTheme
|
||||
.receive(on: DispatchQueue.main)
|
||||
.sink { [weak self] theme in
|
||||
guard let self = self else { return }
|
||||
self.view.backgroundColor = theme.secondarySystemBackgroundColor
|
||||
}
|
||||
.store(in: &disposeBag)
|
||||
view.backgroundColor = .secondarySystemBackground
|
||||
|
||||
tableView.translatesAutoresizingMaskIntoConstraints = false
|
||||
view.addSubview(tableView)
|
||||
|
|
|
@ -37,14 +37,7 @@ extension DiscoveryNewsViewController {
|
|||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
||||
view.backgroundColor = ThemeService.shared.currentTheme.value.secondarySystemBackgroundColor
|
||||
ThemeService.shared.currentTheme
|
||||
.receive(on: DispatchQueue.main)
|
||||
.sink { [weak self] theme in
|
||||
guard let self = self else { return }
|
||||
self.view.backgroundColor = theme.secondarySystemBackgroundColor
|
||||
}
|
||||
.store(in: &disposeBag)
|
||||
view.backgroundColor = .secondarySystemBackground
|
||||
|
||||
tableView.translatesAutoresizingMaskIntoConstraints = false
|
||||
view.addSubview(tableView)
|
||||
|
|
|
@ -38,14 +38,7 @@ extension DiscoveryPostsViewController {
|
|||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
||||
view.backgroundColor = ThemeService.shared.currentTheme.value.secondarySystemBackgroundColor
|
||||
ThemeService.shared.currentTheme
|
||||
.receive(on: DispatchQueue.main)
|
||||
.sink { [weak self] theme in
|
||||
guard let self = self else { return }
|
||||
self.view.backgroundColor = theme.secondarySystemBackgroundColor
|
||||
}
|
||||
.store(in: &disposeBag)
|
||||
view.backgroundColor = .secondarySystemBackground
|
||||
|
||||
tableView.translatesAutoresizingMaskIntoConstraints = false
|
||||
view.addSubview(tableView)
|
||||
|
|
|
@ -53,14 +53,7 @@ extension DiscoveryIntroBannerView {
|
|||
private func _init() {
|
||||
preservesSuperviewLayoutMargins = true
|
||||
|
||||
setupAppearance(theme: ThemeService.shared.currentTheme.value)
|
||||
ThemeService.shared.currentTheme
|
||||
.receive(on: DispatchQueue.main)
|
||||
.sink { [weak self] theme in
|
||||
guard let self = self else { return }
|
||||
self.setupAppearance(theme: theme)
|
||||
}
|
||||
.store(in: &_disposeBag)
|
||||
backgroundColor = .systemBackground
|
||||
|
||||
closeButton.translatesAutoresizingMaskIntoConstraints = false
|
||||
addSubview(closeButton)
|
||||
|
@ -89,11 +82,3 @@ extension DiscoveryIntroBannerView {
|
|||
delegate?.discoveryIntroBannerView(self, closeButtonDidPressed: sender)
|
||||
}
|
||||
}
|
||||
|
||||
extension DiscoveryIntroBannerView {
|
||||
|
||||
private func setupAppearance(theme: Theme) {
|
||||
backgroundColor = theme.systemBackgroundColor
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -70,14 +70,7 @@ extension HashtagTimelineViewController {
|
|||
titleView.update(title: _title, subtitle: nil)
|
||||
navigationItem.titleView = titleView
|
||||
|
||||
view.backgroundColor = ThemeService.shared.currentTheme.value.secondarySystemBackgroundColor
|
||||
ThemeService.shared.currentTheme
|
||||
.receive(on: RunLoop.main)
|
||||
.sink { [weak self] theme in
|
||||
guard let self = self else { return }
|
||||
self.view.backgroundColor = theme.secondarySystemBackgroundColor
|
||||
}
|
||||
.store(in: &disposeBag)
|
||||
view.backgroundColor = .secondarySystemBackground
|
||||
|
||||
navigationItem.rightBarButtonItem = composeBarButtonItem
|
||||
composeBarButtonItem.target = self
|
||||
|
|
|
@ -48,7 +48,7 @@ final class HomeTimelineViewController: UIViewController, NeedsDependency, Media
|
|||
|
||||
let settingBarButtonItem: UIBarButtonItem = {
|
||||
let barButtonItem = UIBarButtonItem()
|
||||
barButtonItem.tintColor = ThemeService.tintColor
|
||||
barButtonItem.tintColor = SystemTheme.tintColor
|
||||
barButtonItem.image = Asset.ObjectsAndTools.gear.image.withRenderingMode(.alwaysTemplate)
|
||||
barButtonItem.accessibilityLabel = L10n.Common.Controls.Actions.settings
|
||||
return barButtonItem
|
||||
|
@ -80,14 +80,8 @@ extension HomeTimelineViewController {
|
|||
super.viewDidLoad()
|
||||
|
||||
title = L10n.Scene.HomeTimeline.title
|
||||
view.backgroundColor = ThemeService.shared.currentTheme.value.secondarySystemBackgroundColor
|
||||
ThemeService.shared.currentTheme
|
||||
.receive(on: RunLoop.main)
|
||||
.sink { [weak self] theme in
|
||||
guard let self = self else { return }
|
||||
self.view.backgroundColor = theme.secondarySystemBackgroundColor
|
||||
}
|
||||
.store(in: &disposeBag)
|
||||
view.backgroundColor = .secondarySystemBackground
|
||||
|
||||
viewModel.$displaySettingBarButtonItem
|
||||
.receive(on: DispatchQueue.main)
|
||||
.sink { [weak self] displaySettingBarButtonItem in
|
||||
|
|
|
@ -64,13 +64,7 @@ extension NotificationTableViewCell {
|
|||
separatorLine.heightAnchor.constraint(equalToConstant: UIView.separatorLineHeight(of: contentView)).priority(.required - 1),
|
||||
])
|
||||
|
||||
notificationView.quoteBackgroundView.backgroundColor = ThemeService.shared.currentTheme.value.secondarySystemBackgroundColor
|
||||
ThemeService.shared.currentTheme
|
||||
.sink { [weak self] theme in
|
||||
guard let self = self else { return }
|
||||
self.notificationView.quoteBackgroundView.backgroundColor = theme.secondarySystemBackgroundColor
|
||||
}
|
||||
.store(in: &_disposeBag)
|
||||
notificationView.quoteBackgroundView.backgroundColor = .secondarySystemBackground
|
||||
|
||||
notificationView.delegate = self
|
||||
}
|
||||
|
|
|
@ -47,14 +47,7 @@ extension NotificationViewController {
|
|||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
||||
view.backgroundColor = ThemeService.shared.currentTheme.value.secondarySystemBackgroundColor
|
||||
ThemeService.shared.currentTheme
|
||||
.receive(on: RunLoop.main)
|
||||
.sink { [weak self] theme in
|
||||
guard let self = self else { return }
|
||||
self.view.backgroundColor = theme.secondarySystemBackgroundColor
|
||||
}
|
||||
.store(in: &disposeBag)
|
||||
view.backgroundColor = .secondarySystemBackground
|
||||
|
||||
setupSegmentedControl(scopes: viewModel.scopes)
|
||||
pageSegmentedControl.translatesAutoresizingMaskIntoConstraints = false
|
||||
|
|
|
@ -43,14 +43,7 @@ extension ProfileAboutViewController {
|
|||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
view.backgroundColor = ThemeService.shared.currentTheme.value.systemBackgroundColor
|
||||
ThemeService.shared.currentTheme
|
||||
.receive(on: DispatchQueue.main)
|
||||
.sink { [weak self] theme in
|
||||
guard let self = self else { return }
|
||||
self.view.backgroundColor = theme.systemBackgroundColor
|
||||
}
|
||||
.store(in: &disposeBag)
|
||||
view.backgroundColor = .systemBackground
|
||||
|
||||
collectionView.translatesAutoresizingMaskIntoConstraints = false
|
||||
view.addSubview(collectionView)
|
||||
|
|
|
@ -44,14 +44,7 @@ extension BookmarkViewController {
|
|||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
||||
view.backgroundColor = ThemeService.shared.currentTheme.value.secondarySystemBackgroundColor
|
||||
ThemeService.shared.currentTheme
|
||||
.receive(on: DispatchQueue.main)
|
||||
.sink { [weak self] theme in
|
||||
guard let self = self else { return }
|
||||
self.view.backgroundColor = theme.secondarySystemBackgroundColor
|
||||
}
|
||||
.store(in: &disposeBag)
|
||||
view.backgroundColor = .secondarySystemBackground
|
||||
|
||||
navigationItem.titleView = titleView
|
||||
titleView.update(title: L10n.Scene.Bookmark.title, subtitle: nil)
|
||||
|
|
|
@ -38,14 +38,7 @@ extension FamiliarFollowersViewController {
|
|||
|
||||
title = L10n.Scene.Familiarfollowers.title
|
||||
|
||||
view.backgroundColor = ThemeService.shared.currentTheme.value.secondarySystemBackgroundColor
|
||||
ThemeService.shared.currentTheme
|
||||
.receive(on: DispatchQueue.main)
|
||||
.sink { [weak self] theme in
|
||||
guard let self = self else { return }
|
||||
self.view.backgroundColor = theme.secondarySystemBackgroundColor
|
||||
}
|
||||
.store(in: &disposeBag)
|
||||
view.backgroundColor = .secondarySystemBackground
|
||||
|
||||
tableView.translatesAutoresizingMaskIntoConstraints = false
|
||||
view.addSubview(tableView)
|
||||
|
|
|
@ -47,14 +47,7 @@ extension FavoriteViewController {
|
|||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
||||
view.backgroundColor = ThemeService.shared.currentTheme.value.secondarySystemBackgroundColor
|
||||
ThemeService.shared.currentTheme
|
||||
.receive(on: DispatchQueue.main)
|
||||
.sink { [weak self] theme in
|
||||
guard let self = self else { return }
|
||||
self.view.backgroundColor = theme.secondarySystemBackgroundColor
|
||||
}
|
||||
.store(in: &disposeBag)
|
||||
view.backgroundColor = .secondarySystemBackground
|
||||
|
||||
navigationItem.titleView = titleView
|
||||
titleView.update(title: L10n.Scene.Favorite.title, subtitle: nil)
|
||||
|
|
|
@ -43,14 +43,7 @@ extension FollowedTagsViewController {
|
|||
|
||||
navigationItem.titleView = titleView
|
||||
|
||||
view.backgroundColor = ThemeService.shared.currentTheme.value.secondarySystemBackgroundColor
|
||||
ThemeService.shared.currentTheme
|
||||
.receive(on: RunLoop.main)
|
||||
.sink { [weak self] theme in
|
||||
guard let self = self else { return }
|
||||
self.view.backgroundColor = theme.secondarySystemBackgroundColor
|
||||
}
|
||||
.store(in: &disposeBag)
|
||||
view.backgroundColor = .secondarySystemBackground
|
||||
|
||||
tableView.translatesAutoresizingMaskIntoConstraints = false
|
||||
view.addSubview(tableView)
|
||||
|
|
|
@ -42,14 +42,7 @@ extension FollowerListViewController {
|
|||
|
||||
title = L10n.Scene.Follower.title
|
||||
|
||||
view.backgroundColor = ThemeService.shared.currentTheme.value.secondarySystemBackgroundColor
|
||||
ThemeService.shared.currentTheme
|
||||
.receive(on: DispatchQueue.main)
|
||||
.sink { [weak self] theme in
|
||||
guard let self = self else { return }
|
||||
self.view.backgroundColor = theme.secondarySystemBackgroundColor
|
||||
}
|
||||
.store(in: &disposeBag)
|
||||
view.backgroundColor = .secondarySystemBackground
|
||||
|
||||
tableView.translatesAutoresizingMaskIntoConstraints = false
|
||||
view.addSubview(tableView)
|
||||
|
|
|
@ -42,14 +42,7 @@ extension FollowingListViewController {
|
|||
|
||||
title = L10n.Scene.Following.title
|
||||
|
||||
view.backgroundColor = ThemeService.shared.currentTheme.value.secondarySystemBackgroundColor
|
||||
ThemeService.shared.currentTheme
|
||||
.receive(on: DispatchQueue.main)
|
||||
.sink { [weak self] theme in
|
||||
guard let self = self else { return }
|
||||
self.view.backgroundColor = theme.secondarySystemBackgroundColor
|
||||
}
|
||||
.store(in: &disposeBag)
|
||||
view.backgroundColor = .secondarySystemBackground
|
||||
|
||||
tableView.translatesAutoresizingMaskIntoConstraints = false
|
||||
view.addSubview(tableView)
|
||||
|
|
|
@ -91,14 +91,7 @@ extension ProfileHeaderViewController {
|
|||
|
||||
view.setContentHuggingPriority(.required - 1, for: .vertical)
|
||||
|
||||
view.backgroundColor = ThemeService.shared.currentTheme.value.systemBackgroundColor
|
||||
ThemeService.shared.currentTheme
|
||||
.receive(on: DispatchQueue.main)
|
||||
.sink { [weak self] theme in
|
||||
guard let self = self else { return }
|
||||
self.view.backgroundColor = theme.systemBackgroundColor
|
||||
}
|
||||
.store(in: &disposeBag)
|
||||
view.backgroundColor = .systemBackground
|
||||
|
||||
// profileHeaderView.preservesSuperviewLayoutMargins = true
|
||||
profileHeaderView.translatesAutoresizingMaskIntoConstraints = false
|
||||
|
|
|
@ -252,15 +252,7 @@ final class ProfileHeaderView: UIView {
|
|||
|
||||
extension ProfileHeaderView {
|
||||
private func _init() {
|
||||
let currentTheme = ThemeService.shared.currentTheme
|
||||
setColors(from: currentTheme.value)
|
||||
|
||||
currentTheme
|
||||
.receive(on: DispatchQueue.main)
|
||||
.sink { [weak self] theme in
|
||||
self?.setColors(from: theme)
|
||||
}
|
||||
.store(in: &_disposeBag)
|
||||
setColors()
|
||||
|
||||
// banner
|
||||
bannerContainerView.translatesAutoresizingMaskIntoConstraints = false
|
||||
|
@ -469,10 +461,10 @@ extension ProfileHeaderView {
|
|||
updateLayoutMargins()
|
||||
}
|
||||
|
||||
private func setColors(from theme: Theme) {
|
||||
backgroundColor = theme.systemBackgroundColor
|
||||
avatarButton.backgroundColor = theme.secondarySystemBackgroundColor
|
||||
avatarImageViewBackgroundView.layer.borderColor = theme.systemBackgroundColor.cgColor
|
||||
private func setColors() {
|
||||
backgroundColor = .systemBackground
|
||||
avatarButton.backgroundColor = .secondarySystemBackground
|
||||
avatarImageViewBackgroundView.layer.borderColor = UIColor.systemBackground.cgColor
|
||||
}
|
||||
|
||||
override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) {
|
||||
|
|
|
@ -64,7 +64,7 @@ extension ProfilePagingViewController {
|
|||
|
||||
override func viewDidLoad() {
|
||||
// configure style before viewDidLoad
|
||||
settings.style.buttonBarBackgroundColor = ThemeService.shared.currentTheme.value.systemBackgroundColor
|
||||
settings.style.buttonBarBackgroundColor = .systemBackground
|
||||
settings.style.buttonBarItemBackgroundColor = .clear
|
||||
settings.style.buttonBarItemsShouldFillAvailableWidth = false // alignment from leading to trailing
|
||||
settings.style.selectedBarHeight = 3
|
||||
|
@ -80,21 +80,12 @@ extension ProfilePagingViewController {
|
|||
|
||||
super.viewDidLoad()
|
||||
|
||||
ThemeService.shared.currentTheme
|
||||
.receive(on: DispatchQueue.main)
|
||||
.sink { [weak self] theme in
|
||||
guard let self = self else { return }
|
||||
self.settings.style.buttonBarBackgroundColor = theme.systemBackgroundColor
|
||||
self.buttonBarView.backgroundColor = self.settings.style.buttonBarBackgroundColor
|
||||
self.barButtonLayout?.invalidateLayout()
|
||||
}
|
||||
.store(in: &disposeBag)
|
||||
|
||||
updateBarButtonInsets()
|
||||
|
||||
if let buttonBarView = self.buttonBarView {
|
||||
buttonBarShadowView.translatesAutoresizingMaskIntoConstraints = false
|
||||
view.insertSubview(buttonBarShadowView, belowSubview: buttonBarView)
|
||||
buttonBarView.backgroundColor = .systemBackground
|
||||
buttonBarShadowView.pinTo(to: buttonBarView)
|
||||
|
||||
viewModel.$needsSetupBottomShadow
|
||||
|
|
|
@ -168,15 +168,7 @@ extension ProfileViewController {
|
|||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
||||
view.backgroundColor = ThemeService.shared.currentTheme.value.secondarySystemBackgroundColor
|
||||
ThemeService.shared.currentTheme
|
||||
.receive(on: DispatchQueue.main)
|
||||
.sink { [weak self] theme in
|
||||
guard let self = self else { return }
|
||||
self.view.backgroundColor = theme.secondarySystemBackgroundColor
|
||||
}
|
||||
.store(in: &disposeBag)
|
||||
|
||||
view.backgroundColor = .secondarySystemBackground
|
||||
let barAppearance = UINavigationBarAppearance()
|
||||
if isModal {
|
||||
barAppearance.configureWithDefaultBackground()
|
||||
|
|
|
@ -43,14 +43,7 @@ extension UserTimelineViewController {
|
|||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
||||
view.backgroundColor = ThemeService.shared.currentTheme.value.secondarySystemBackgroundColor
|
||||
ThemeService.shared.currentTheme
|
||||
.receive(on: DispatchQueue.main)
|
||||
.sink { [weak self] theme in
|
||||
guard let self = self else { return }
|
||||
self.view.backgroundColor = theme.secondarySystemBackgroundColor
|
||||
}
|
||||
.store(in: &disposeBag)
|
||||
view.backgroundColor = .secondarySystemBackground
|
||||
|
||||
tableView.translatesAutoresizingMaskIntoConstraints = false
|
||||
view.addSubview(tableView)
|
||||
|
|
|
@ -38,14 +38,7 @@ extension FavoritedByViewController {
|
|||
|
||||
title = L10n.Scene.FavoritedBy.title
|
||||
|
||||
view.backgroundColor = ThemeService.shared.currentTheme.value.secondarySystemBackgroundColor
|
||||
ThemeService.shared.currentTheme
|
||||
.receive(on: DispatchQueue.main)
|
||||
.sink { [weak self] theme in
|
||||
guard let self = self else { return }
|
||||
self.view.backgroundColor = theme.secondarySystemBackgroundColor
|
||||
}
|
||||
.store(in: &disposeBag)
|
||||
view.backgroundColor = .secondarySystemBackground
|
||||
|
||||
tableView.translatesAutoresizingMaskIntoConstraints = false
|
||||
view.addSubview(tableView)
|
||||
|
|
|
@ -44,14 +44,7 @@ extension RebloggedByViewController {
|
|||
|
||||
title = L10n.Scene.RebloggedBy.title
|
||||
|
||||
view.backgroundColor = ThemeService.shared.currentTheme.value.secondarySystemBackgroundColor
|
||||
ThemeService.shared.currentTheme
|
||||
.receive(on: DispatchQueue.main)
|
||||
.sink { [weak self] theme in
|
||||
guard let self = self else { return }
|
||||
self.view.backgroundColor = theme.secondarySystemBackgroundColor
|
||||
}
|
||||
.store(in: &disposeBag)
|
||||
view.backgroundColor = .secondarySystemBackground
|
||||
|
||||
tableView.translatesAutoresizingMaskIntoConstraints = false
|
||||
view.addSubview(tableView)
|
||||
|
|
|
@ -167,14 +167,7 @@ extension MainTabBarController {
|
|||
|
||||
delegate = self
|
||||
|
||||
view.backgroundColor = ThemeService.shared.currentTheme.value.systemBackgroundColor
|
||||
ThemeService.shared.currentTheme
|
||||
.receive(on: RunLoop.main)
|
||||
.sink { [weak self] theme in
|
||||
guard let self = self else { return }
|
||||
self.view.backgroundColor = theme.tabBarBackgroundColor
|
||||
}
|
||||
.store(in: &disposeBag)
|
||||
view.backgroundColor = .systemBackground
|
||||
|
||||
// seealso: `ThemeService.apply(theme:)`
|
||||
let tabs = Tab.allCases
|
||||
|
|
|
@ -87,14 +87,7 @@ extension RootSplitViewController {
|
|||
|
||||
updateBehavior(size: view.frame.size)
|
||||
|
||||
setupBackground(theme: ThemeService.shared.currentTheme.value)
|
||||
ThemeService.shared.currentTheme
|
||||
.receive(on: DispatchQueue.main)
|
||||
.sink { [weak self] theme in
|
||||
guard let self = self else { return }
|
||||
self.setupBackground(theme: theme)
|
||||
}
|
||||
.store(in: &disposeBag)
|
||||
view.backgroundColor = .separator
|
||||
}
|
||||
|
||||
override func viewWillAppear(_ animated: Bool) {
|
||||
|
@ -112,13 +105,7 @@ extension RootSplitViewController {
|
|||
override var supportedInterfaceOrientations: UIInterfaceOrientationMask {
|
||||
.portraitOnPhone
|
||||
}
|
||||
|
||||
override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) {
|
||||
super.traitCollectionDidChange(previousTraitCollection)
|
||||
|
||||
setupBackground(theme: ThemeService.shared.currentTheme.value)
|
||||
}
|
||||
|
||||
|
||||
private func updateBehavior(size: CGSize) {
|
||||
if size.width > 960 {
|
||||
show(.primary)
|
||||
|
@ -142,15 +129,6 @@ extension RootSplitViewController {
|
|||
|
||||
}
|
||||
|
||||
extension RootSplitViewController {
|
||||
|
||||
private func setupBackground(theme: Theme) {
|
||||
// this set column separator line color
|
||||
view.backgroundColor = theme.separator
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// MARK: - ContentSplitViewControllerDelegate
|
||||
extension RootSplitViewController: ContentSplitViewControllerDelegate {
|
||||
func contentSplitViewController(_ contentSplitViewController: ContentSplitViewController, sidebarViewController: SidebarViewController, didSelectTab tab: MainTabBarController.Tab) {
|
||||
|
|
|
@ -11,27 +11,11 @@ import MastodonCore
|
|||
|
||||
final class SecondaryPlaceholderViewController: UIViewController {
|
||||
var disposeBag = Set<AnyCancellable>()
|
||||
}
|
||||
|
||||
extension SecondaryPlaceholderViewController {
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
||||
setupBackground(theme: ThemeService.shared.currentTheme.value)
|
||||
ThemeService.shared.currentTheme
|
||||
.receive(on: DispatchQueue.main)
|
||||
.sink { [weak self] theme in
|
||||
guard let self = self else { return }
|
||||
self.setupBackground(theme: theme)
|
||||
}
|
||||
.store(in: &disposeBag)
|
||||
view.backgroundColor = .secondarySystemBackground
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
extension SecondaryPlaceholderViewController {
|
||||
private func setupBackground(theme: Theme) {
|
||||
view.backgroundColor = theme.secondarySystemBackgroundColor
|
||||
}
|
||||
}
|
||||
|
|
|
@ -87,14 +87,7 @@ extension SidebarViewController {
|
|||
|
||||
navigationController?.setNavigationBarHidden(true, animated: false)
|
||||
|
||||
setupBackground(theme: ThemeService.shared.currentTheme.value)
|
||||
ThemeService.shared.currentTheme
|
||||
.receive(on: DispatchQueue.main)
|
||||
.sink { [weak self] theme in
|
||||
guard let self = self else { return }
|
||||
self.setupBackground(theme: theme)
|
||||
}
|
||||
.store(in: &disposeBag)
|
||||
view.backgroundColor = SystemTheme.sidebarBackgroundColor
|
||||
|
||||
collectionView.translatesAutoresizingMaskIntoConstraints = false
|
||||
view.addSubview(collectionView)
|
||||
|
@ -145,11 +138,6 @@ extension SidebarViewController {
|
|||
|
||||
}
|
||||
|
||||
private func setupBackground(theme: Theme) {
|
||||
let color: UIColor = theme.sidebarBackgroundColor
|
||||
view.backgroundColor = color
|
||||
}
|
||||
|
||||
override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) {
|
||||
super.viewWillTransition(to: size, with: coordinator)
|
||||
|
||||
|
|
|
@ -92,7 +92,7 @@ extension SidebarListContentView {
|
|||
guard let item = configuration.item else { return }
|
||||
|
||||
// configure state
|
||||
let tintColor = item.isHighlighted ? ThemeService.tintColor.withAlphaComponent(0.5) : ThemeService.tintColor
|
||||
let tintColor = item.isHighlighted ? SystemTheme.tintColor.withAlphaComponent(0.5) : SystemTheme.tintColor
|
||||
imageView.tintColor = tintColor
|
||||
avatarButton.tintColor = tintColor
|
||||
|
||||
|
|
|
@ -37,15 +37,6 @@ final class TrendCollectionViewCell: UICollectionViewCell {
|
|||
extension TrendCollectionViewCell {
|
||||
|
||||
private func _init() {
|
||||
ThemeService.shared.currentTheme
|
||||
.map { $0.secondarySystemGroupedBackgroundColor }
|
||||
.sink { [weak self] backgroundColor in
|
||||
guard let self = self else { return }
|
||||
self.backgroundColor = backgroundColor
|
||||
self.setNeedsUpdateConfiguration()
|
||||
}
|
||||
.store(in: &_disposeBag)
|
||||
|
||||
trendView.translatesAutoresizingMaskIntoConstraints = false
|
||||
contentView.addSubview(trendView)
|
||||
trendView.pinToParent()
|
||||
|
@ -57,9 +48,9 @@ extension TrendCollectionViewCell {
|
|||
var backgroundConfiguration = UIBackgroundConfiguration.listGroupedCell()
|
||||
backgroundConfiguration.backgroundColorTransformer = .init { _ in
|
||||
if state.isHighlighted || state.isSelected {
|
||||
return ThemeService.shared.currentTheme.value.tableViewCellSelectionBackgroundColor
|
||||
return SystemTheme.tableViewCellSelectionBackgroundColor
|
||||
}
|
||||
return ThemeService.shared.currentTheme.value.secondarySystemGroupedBackgroundColor
|
||||
return .secondarySystemGroupedBackground
|
||||
}
|
||||
self.backgroundConfiguration = backgroundConfiguration
|
||||
}
|
||||
|
|
|
@ -54,14 +54,7 @@ extension SearchViewController {
|
|||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
||||
setupAppearance(theme: ThemeService.shared.currentTheme.value)
|
||||
ThemeService.shared.currentTheme
|
||||
.receive(on: DispatchQueue.main)
|
||||
.sink { [weak self] theme in
|
||||
guard let self = self else { return }
|
||||
self.setupAppearance(theme: theme)
|
||||
}
|
||||
.store(in: &disposeBag)
|
||||
setupAppearance()
|
||||
|
||||
title = L10n.Scene.Search.title
|
||||
|
||||
|
@ -86,13 +79,13 @@ extension SearchViewController {
|
|||
}
|
||||
|
||||
extension SearchViewController {
|
||||
private func setupAppearance(theme: Theme) {
|
||||
view.backgroundColor = theme.systemGroupedBackgroundColor
|
||||
private func setupAppearance() {
|
||||
view.backgroundColor = .systemGroupedBackground
|
||||
|
||||
// Match the DiscoveryViewController tab color and remove the double separator.
|
||||
let navigationBarAppearance = UINavigationBarAppearance()
|
||||
navigationBarAppearance.configureWithOpaqueBackground()
|
||||
navigationBarAppearance.backgroundColor = theme.systemBackgroundColor
|
||||
navigationBarAppearance.backgroundColor = .systemBackground
|
||||
navigationBarAppearance.shadowColor = nil
|
||||
|
||||
navigationItem.standardAppearance = navigationBarAppearance
|
||||
|
|
|
@ -106,14 +106,7 @@ final class SearchDetailViewController: UIViewController, NeedsDependency {
|
|||
|
||||
super.viewDidLoad()
|
||||
|
||||
setupBackgroundColor(theme: ThemeService.shared.currentTheme.value)
|
||||
ThemeService.shared.currentTheme
|
||||
.receive(on: RunLoop.main)
|
||||
.sink { [weak self] theme in
|
||||
guard let self = self else { return }
|
||||
self.setupBackgroundColor(theme: theme)
|
||||
}
|
||||
.store(in: &disposeBag)
|
||||
setupBackgroundColor()
|
||||
|
||||
setupSearchBar()
|
||||
|
||||
|
@ -246,8 +239,8 @@ extension SearchDetailViewController {
|
|||
searchBar.delegate = self
|
||||
}
|
||||
|
||||
private func setupBackgroundColor(theme: Theme) {
|
||||
navigationBarBackgroundView.backgroundColor = theme.navigationBarBackgroundColor
|
||||
private func setupBackgroundColor() {
|
||||
navigationBarBackgroundView.backgroundColor = SystemTheme.navigationBarBackgroundColor
|
||||
navigationBar.tintColor = Asset.Colors.Brand.blurple.color
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ class SearchHistoryUserCollectionViewCell: UICollectionViewCell {
|
|||
var backgroundConfiguration = UIBackgroundConfiguration.listGroupedCell()
|
||||
backgroundConfiguration.backgroundColorTransformer = .init { _ in
|
||||
if state.isHighlighted || state.isSelected {
|
||||
return ThemeService.shared.currentTheme.value.tableViewCellSelectionBackgroundColor
|
||||
return SystemTheme.tableViewCellSelectionBackgroundColor
|
||||
} else {
|
||||
return .secondarySystemGroupedBackground
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ extension SearchHistorySection {
|
|||
}
|
||||
|
||||
if state.isHighlighted || state.isSelected {
|
||||
return ThemeService.shared.currentTheme.value.tableViewCellSelectionBackgroundColor
|
||||
return SystemTheme.tableViewCellSelectionBackgroundColor
|
||||
}
|
||||
return .secondarySystemGroupedBackground
|
||||
}
|
||||
|
|
|
@ -36,15 +36,7 @@ extension SearchHistoryViewController {
|
|||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
||||
setupBackgroundColor(theme: ThemeService.shared.currentTheme.value)
|
||||
ThemeService.shared.currentTheme
|
||||
.receive(on: DispatchQueue.main)
|
||||
.sink { [weak self] theme in
|
||||
guard let self = self else { return }
|
||||
self.setupBackgroundColor(theme: theme)
|
||||
}
|
||||
.store(in: &disposeBag)
|
||||
|
||||
view.backgroundColor = .systemGroupedBackground
|
||||
collectionView.translatesAutoresizingMaskIntoConstraints = false
|
||||
view.addSubview(collectionView)
|
||||
collectionView.pinToParent()
|
||||
|
@ -57,12 +49,6 @@ extension SearchHistoryViewController {
|
|||
}
|
||||
}
|
||||
|
||||
extension SearchHistoryViewController {
|
||||
private func setupBackgroundColor(theme: Theme) {
|
||||
view.backgroundColor = theme.systemGroupedBackgroundColor
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - UICollectionViewDelegate
|
||||
extension SearchHistoryViewController: UICollectionViewDelegate {
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ extension SearchResultViewController {
|
|||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
||||
view.backgroundColor = Asset.Theme.System.systemGroupedBackground.color
|
||||
view.backgroundColor = .systemGroupedBackground
|
||||
|
||||
tableView.translatesAutoresizingMaskIntoConstraints = false
|
||||
view.addSubview(tableView)
|
||||
|
|
|
@ -106,7 +106,7 @@ class SettingsViewController: UIViewController, NeedsDependency {
|
|||
tableView.delegate = self
|
||||
tableView.rowHeight = UITableView.automaticDimension
|
||||
tableView.backgroundColor = .clear
|
||||
tableView.separatorColor = ThemeService.shared.currentTheme.value.separator
|
||||
tableView.separatorColor = SystemTheme.separator
|
||||
|
||||
tableView.register(SettingsAppearanceTableViewCell.self, forCellReuseIdentifier: String(describing: SettingsAppearanceTableViewCell.self))
|
||||
tableView.register(SettingsToggleTableViewCell.self, forCellReuseIdentifier: String(describing: SettingsToggleTableViewCell.self))
|
||||
|
@ -207,14 +207,7 @@ extension SettingsViewController {
|
|||
}
|
||||
|
||||
private func setupView() {
|
||||
setupBackgroundColor(theme: ThemeService.shared.currentTheme.value)
|
||||
ThemeService.shared.currentTheme
|
||||
.receive(on: DispatchQueue.main)
|
||||
.sink { [weak self] theme in
|
||||
guard let self = self else { return }
|
||||
self.setupBackgroundColor(theme: theme)
|
||||
}
|
||||
.store(in: &disposeBag)
|
||||
setupBackgroundColor()
|
||||
|
||||
setupNavigation()
|
||||
view.addSubview(tableView)
|
||||
|
@ -224,17 +217,17 @@ extension SettingsViewController {
|
|||
updateSectionHeaderStackViewLayout()
|
||||
}
|
||||
|
||||
private func setupBackgroundColor(theme: Theme) {
|
||||
private func setupBackgroundColor() {
|
||||
view.backgroundColor = UIColor(dynamicProvider: { traitCollection in
|
||||
switch traitCollection.userInterfaceLevel {
|
||||
case .elevated where traitCollection.userInterfaceStyle == .dark:
|
||||
return theme.systemElevatedBackgroundColor
|
||||
return SystemTheme.systemElevatedBackgroundColor
|
||||
default:
|
||||
return theme.secondarySystemBackgroundColor
|
||||
return .secondarySystemBackground
|
||||
}
|
||||
})
|
||||
|
||||
tableView.separatorColor = theme.separator
|
||||
tableView.separatorColor = SystemTheme.separator
|
||||
}
|
||||
|
||||
private func setupNavigation() {
|
||||
|
|
|
@ -144,18 +144,7 @@ extension ContentWarningOverlayView {
|
|||
addGestureRecognizer(tapGestureRecognizer)
|
||||
|
||||
configure(style: .media)
|
||||
setupBackgroundColor(theme: ThemeService.shared.currentTheme.value)
|
||||
ThemeService.shared.currentTheme
|
||||
.receive(on: RunLoop.main)
|
||||
.sink { [weak self] theme in
|
||||
guard let self = self else { return }
|
||||
self.setupBackgroundColor(theme: theme)
|
||||
}
|
||||
.store(in: &_disposeBag)
|
||||
}
|
||||
|
||||
private func setupBackgroundColor(theme: Theme) {
|
||||
contentOverlayView.backgroundColor = theme.contentWarningOverlayBackgroundColor
|
||||
contentOverlayView.backgroundColor = SystemTheme.contentWarningOverlayBackgroundColor
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -21,14 +21,6 @@ extension PollOptionView {
|
|||
|
||||
viewModel.objects.insert(option)
|
||||
|
||||
// background
|
||||
ThemeService.shared.currentTheme
|
||||
.receive(on: DispatchQueue.main)
|
||||
.sink { [weak self] theme in
|
||||
guard let self = self else { return }
|
||||
self.viewModel.roundedBackgroundViewColor = theme.systemElevatedBackgroundColor
|
||||
}
|
||||
.store(in: &disposeBag)
|
||||
// metaContent
|
||||
option.publisher(for: \.title)
|
||||
.map { title -> MetaContent? in
|
||||
|
@ -103,41 +95,24 @@ extension PollOptionView {
|
|||
}
|
||||
.store(in: &disposeBag)
|
||||
// appearance
|
||||
ThemeService.shared.currentTheme
|
||||
.receive(on: DispatchQueue.main)
|
||||
.sink { [weak self] theme in
|
||||
guard let self = self else { return }
|
||||
self.checkmarkBackgroundView.backgroundColor = UIColor(dynamicProvider: { trailtCollection in
|
||||
return trailtCollection.userInterfaceStyle == .light ? .white : theme.tableViewCellSelectionBackgroundColor
|
||||
})
|
||||
}
|
||||
.store(in: &disposeBag)
|
||||
checkmarkBackgroundView.backgroundColor = UIColor(dynamicProvider: { trailtCollection in
|
||||
return trailtCollection.userInterfaceStyle == .light ? .white : SystemTheme.tableViewCellSelectionBackgroundColor
|
||||
})
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
extension PollOptionView {
|
||||
public func configure(historyPollOption option: StatusEdit.Poll.Option) {
|
||||
// background
|
||||
ThemeService.shared.currentTheme
|
||||
.receive(on: DispatchQueue.main)
|
||||
.sink { [weak self] theme in
|
||||
guard let self = self else { return }
|
||||
self.viewModel.roundedBackgroundViewColor = theme.systemElevatedBackgroundColor
|
||||
}
|
||||
.store(in: &disposeBag)
|
||||
viewModel.roundedBackgroundViewColor = SystemTheme.systemElevatedBackgroundColor
|
||||
// metaContent
|
||||
viewModel.metaContent = PlaintextMetaContent(string: option.title)
|
||||
// show left-hand-side dots, otherwise view looks "incomplete"
|
||||
viewModel.selectState = .off
|
||||
// appearance
|
||||
ThemeService.shared.currentTheme
|
||||
.receive(on: DispatchQueue.main)
|
||||
.sink { [weak self] theme in
|
||||
guard let self = self else { return }
|
||||
self.checkmarkBackgroundView.backgroundColor = UIColor(dynamicProvider: { trailtCollection in
|
||||
return trailtCollection.userInterfaceStyle == .light ? .white : theme.tableViewCellSelectionBackgroundColor
|
||||
})
|
||||
}
|
||||
.store(in: &disposeBag)
|
||||
checkmarkBackgroundView.backgroundColor = UIColor(dynamicProvider: { trailtCollection in
|
||||
return trailtCollection.userInterfaceStyle == .light ? .white : SystemTheme.tableViewCellSelectionBackgroundColor
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,8 +25,8 @@ final class ThreadMetaView: UIView {
|
|||
let button = UIButton()
|
||||
button.titleLabel?.font = UIFontMetrics(forTextStyle: .headline).scaledFont(for: .systemFont(ofSize: 15, weight: .semibold))
|
||||
button.setTitle("0 reblog", for: .normal)
|
||||
button.setTitleColor(ThemeService.tintColor, for: .normal)
|
||||
button.setTitleColor(ThemeService.tintColor.withAlphaComponent(0.5), for: .highlighted)
|
||||
button.setTitleColor(SystemTheme.tintColor, for: .normal)
|
||||
button.setTitleColor(SystemTheme.tintColor.withAlphaComponent(0.5), for: .highlighted)
|
||||
return button
|
||||
}()
|
||||
|
||||
|
@ -34,8 +34,8 @@ final class ThreadMetaView: UIView {
|
|||
let button = UIButton()
|
||||
button.titleLabel?.font = UIFontMetrics(forTextStyle: .headline).scaledFont(for: .systemFont(ofSize: 15, weight: .semibold))
|
||||
button.setTitle("0 favorite", for: .normal)
|
||||
button.setTitleColor(ThemeService.tintColor, for: .normal)
|
||||
button.setTitleColor(ThemeService.tintColor.withAlphaComponent(0.5), for: .highlighted)
|
||||
button.setTitleColor(SystemTheme.tintColor, for: .normal)
|
||||
button.setTitleColor(SystemTheme.tintColor.withAlphaComponent(0.5), for: .highlighted)
|
||||
return button
|
||||
}()
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ final class ThreadReplyLoaderTableViewCell: UITableViewCell {
|
|||
let loadMoreButton: UIButton = {
|
||||
let button = HighlightDimmableButton()
|
||||
button.titleLabel?.font = TimelineLoaderTableViewCell.labelFont
|
||||
button.setTitleColor(ThemeService.tintColor, for: .normal)
|
||||
button.setTitleColor(SystemTheme.tintColor, for: .normal)
|
||||
button.setTitle(L10n.Common.Controls.Timeline.Loader.showMoreReplies, for: .normal)
|
||||
return button
|
||||
}()
|
||||
|
@ -86,14 +86,7 @@ extension ThreadReplyLoaderTableViewCell {
|
|||
|
||||
loadMoreButton.addTarget(self, action: #selector(ThreadReplyLoaderTableViewCell.loadMoreButtonDidPressed(_:)), for: .touchUpInside)
|
||||
|
||||
setupBackgroundColor(theme: ThemeService.shared.currentTheme.value)
|
||||
ThemeService.shared.currentTheme
|
||||
.receive(on: RunLoop.main)
|
||||
.sink { [weak self] theme in
|
||||
guard let self = self else { return }
|
||||
self.setupBackgroundColor(theme: theme)
|
||||
}
|
||||
.store(in: &_disposeBag)
|
||||
backgroundColor = .systemGroupedBackground
|
||||
}
|
||||
|
||||
private func resetSeparatorLineLayout() {
|
||||
|
@ -124,11 +117,6 @@ extension ThreadReplyLoaderTableViewCell {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
private func setupBackgroundColor(theme: Theme) {
|
||||
backgroundColor = theme.systemGroupedBackgroundColor
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
extension ThreadReplyLoaderTableViewCell {
|
||||
|
|
|
@ -49,13 +49,13 @@ class StatusEditHistoryViewController: UIViewController {
|
|||
}
|
||||
|
||||
tableView.dataSource = tableViewDataSource
|
||||
tableView.backgroundColor = ThemeService.shared.currentTheme.value.secondarySystemBackgroundColor
|
||||
tableView.backgroundColor = .secondarySystemBackground
|
||||
self.tableViewDataSource = tableViewDataSource
|
||||
|
||||
|
||||
view.addSubview(tableView)
|
||||
|
||||
view.backgroundColor = ThemeService.shared.currentTheme.value.secondarySystemBackgroundColor
|
||||
view.backgroundColor = .secondarySystemBackground
|
||||
setupConstraints()
|
||||
|
||||
title = L10n.Common.Controls.Status.EditHistory.title
|
||||
|
|
|
@ -51,14 +51,7 @@ extension ThreadViewController {
|
|||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
||||
view.backgroundColor = ThemeService.shared.currentTheme.value.secondarySystemBackgroundColor
|
||||
ThemeService.shared.currentTheme
|
||||
.receive(on: DispatchQueue.main)
|
||||
.sink { [weak self] theme in
|
||||
guard let self = self else { return }
|
||||
self.view.backgroundColor = theme.secondarySystemBackgroundColor
|
||||
}
|
||||
.store(in: &disposeBag)
|
||||
view.backgroundColor = .secondarySystemBackground
|
||||
|
||||
navigationItem.title = L10n.Scene.Thread.backTitle
|
||||
navigationItem.titleView = titleView
|
||||
|
|
|
@ -21,7 +21,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
|
|||
AppSecret.default.register()
|
||||
|
||||
// configure appearance
|
||||
ThemeService.shared.apply(theme: ThemeService.shared.currentTheme.value)
|
||||
ThemeService.shared.apply()
|
||||
|
||||
// configure AudioSession
|
||||
try? AVAudioSession.sharedInstance().setCategory(.ambient)
|
||||
|
|
|
@ -37,19 +37,6 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
|
|||
// set tint color
|
||||
window.tintColor = UIColor.label
|
||||
|
||||
ThemeService.shared.currentTheme
|
||||
.receive(on: RunLoop.main)
|
||||
.dropFirst()
|
||||
.sink { [weak self] theme in
|
||||
guard let self = self else { return }
|
||||
guard let window = self.window else { return }
|
||||
window.subviews.forEach { view in
|
||||
view.removeFromSuperview()
|
||||
window.addSubview(view)
|
||||
}
|
||||
}
|
||||
.store(in: &disposeBag)
|
||||
|
||||
let appContext = AppContext.shared
|
||||
let sceneCoordinator = SceneCoordinator(scene: scene, sceneDelegate: self, appContext: appContext)
|
||||
self.coordinator = sceneCoordinator
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
{
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
|
@ -1,38 +0,0 @@
|
|||
{
|
||||
"colors" : [
|
||||
{
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"alpha" : "1.000",
|
||||
"blue" : "0xF7",
|
||||
"green" : "0xF2",
|
||||
"red" : "0xF2"
|
||||
}
|
||||
},
|
||||
"idiom" : "universal"
|
||||
},
|
||||
{
|
||||
"appearances" : [
|
||||
{
|
||||
"appearance" : "luminosity",
|
||||
"value" : "dark"
|
||||
}
|
||||
],
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"alpha" : "1.000",
|
||||
"blue" : "0.263",
|
||||
"green" : "0.208",
|
||||
"red" : "0.192"
|
||||
}
|
||||
},
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
|
@ -1,38 +0,0 @@
|
|||
{
|
||||
"colors" : [
|
||||
{
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"alpha" : "1.000",
|
||||
"blue" : "0.871",
|
||||
"green" : "0.847",
|
||||
"red" : "0.839"
|
||||
}
|
||||
},
|
||||
"idiom" : "universal"
|
||||
},
|
||||
{
|
||||
"appearances" : [
|
||||
{
|
||||
"appearance" : "luminosity",
|
||||
"value" : "dark"
|
||||
}
|
||||
],
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"alpha" : "1.000",
|
||||
"blue" : "0.263",
|
||||
"green" : "0.208",
|
||||
"red" : "0.192"
|
||||
}
|
||||
},
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
|
@ -1,38 +0,0 @@
|
|||
{
|
||||
"colors" : [
|
||||
{
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"alpha" : "1.000",
|
||||
"blue" : "0.922",
|
||||
"green" : "0.898",
|
||||
"red" : "0.867"
|
||||
}
|
||||
},
|
||||
"idiom" : "universal"
|
||||
},
|
||||
{
|
||||
"appearances" : [
|
||||
{
|
||||
"appearance" : "luminosity",
|
||||
"value" : "dark"
|
||||
}
|
||||
],
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"alpha" : "1.000",
|
||||
"blue" : "0.431",
|
||||
"green" : "0.341",
|
||||
"red" : "0.310"
|
||||
}
|
||||
},
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
|
@ -1,38 +0,0 @@
|
|||
{
|
||||
"colors" : [
|
||||
{
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"alpha" : "0.940",
|
||||
"blue" : "0.976",
|
||||
"green" : "0.976",
|
||||
"red" : "0.976"
|
||||
}
|
||||
},
|
||||
"idiom" : "universal"
|
||||
},
|
||||
{
|
||||
"appearances" : [
|
||||
{
|
||||
"appearance" : "luminosity",
|
||||
"value" : "dark"
|
||||
}
|
||||
],
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"alpha" : "1.000",
|
||||
"blue" : "0.263",
|
||||
"green" : "0.208",
|
||||
"red" : "0.192"
|
||||
}
|
||||
},
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
|
@ -1,38 +0,0 @@
|
|||
{
|
||||
"colors" : [
|
||||
{
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"alpha" : "1.000",
|
||||
"blue" : "1.000",
|
||||
"green" : "1.000",
|
||||
"red" : "1.000"
|
||||
}
|
||||
},
|
||||
"idiom" : "universal"
|
||||
},
|
||||
{
|
||||
"appearances" : [
|
||||
{
|
||||
"appearance" : "luminosity",
|
||||
"value" : "dark"
|
||||
}
|
||||
],
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"alpha" : "0.000",
|
||||
"blue" : "1.000",
|
||||
"green" : "1.000",
|
||||
"red" : "1.000"
|
||||
}
|
||||
},
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
|
@ -1,38 +0,0 @@
|
|||
{
|
||||
"colors" : [
|
||||
{
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"alpha" : "1.000",
|
||||
"blue" : "0.996",
|
||||
"green" : "1.000",
|
||||
"red" : "0.996"
|
||||
}
|
||||
},
|
||||
"idiom" : "universal"
|
||||
},
|
||||
{
|
||||
"appearances" : [
|
||||
{
|
||||
"appearance" : "luminosity",
|
||||
"value" : "dark"
|
||||
}
|
||||
],
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"alpha" : "1.000",
|
||||
"blue" : "0.263",
|
||||
"green" : "0.208",
|
||||
"red" : "0.192"
|
||||
}
|
||||
},
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
|
@ -1,38 +0,0 @@
|
|||
{
|
||||
"colors" : [
|
||||
{
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"alpha" : "1.000",
|
||||
"blue" : "0xF7",
|
||||
"green" : "0xF2",
|
||||
"red" : "0xF2"
|
||||
}
|
||||
},
|
||||
"idiom" : "universal"
|
||||
},
|
||||
{
|
||||
"appearances" : [
|
||||
{
|
||||
"appearance" : "luminosity",
|
||||
"value" : "dark"
|
||||
}
|
||||
],
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"alpha" : "1.000",
|
||||
"blue" : "0.133",
|
||||
"green" : "0.106",
|
||||
"red" : "0.098"
|
||||
}
|
||||
},
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
|
@ -1,38 +0,0 @@
|
|||
{
|
||||
"colors" : [
|
||||
{
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"alpha" : "1.000",
|
||||
"blue" : "0xF7",
|
||||
"green" : "0xF2",
|
||||
"red" : "0xF2"
|
||||
}
|
||||
},
|
||||
"idiom" : "universal"
|
||||
},
|
||||
{
|
||||
"appearances" : [
|
||||
{
|
||||
"appearance" : "luminosity",
|
||||
"value" : "dark"
|
||||
}
|
||||
],
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"alpha" : "1.000",
|
||||
"blue" : "0.263",
|
||||
"green" : "0.208",
|
||||
"red" : "0.192"
|
||||
}
|
||||
},
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
|
@ -1,38 +0,0 @@
|
|||
{
|
||||
"colors" : [
|
||||
{
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"alpha" : "1.000",
|
||||
"blue" : "0.996",
|
||||
"green" : "1.000",
|
||||
"red" : "0.996"
|
||||
}
|
||||
},
|
||||
"idiom" : "universal"
|
||||
},
|
||||
{
|
||||
"appearances" : [
|
||||
{
|
||||
"appearance" : "luminosity",
|
||||
"value" : "dark"
|
||||
}
|
||||
],
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"alpha" : "1.000",
|
||||
"blue" : "0.216",
|
||||
"green" : "0.173",
|
||||
"red" : "0.157"
|
||||
}
|
||||
},
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
|
@ -1,38 +0,0 @@
|
|||
{
|
||||
"colors" : [
|
||||
{
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"alpha" : "1.000",
|
||||
"blue" : "0xF2",
|
||||
"green" : "0xED",
|
||||
"red" : "0xE9"
|
||||
}
|
||||
},
|
||||
"idiom" : "universal"
|
||||
},
|
||||
{
|
||||
"appearances" : [
|
||||
{
|
||||
"appearance" : "luminosity",
|
||||
"value" : "dark"
|
||||
}
|
||||
],
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"alpha" : "1.000",
|
||||
"blue" : "0.216",
|
||||
"green" : "0.173",
|
||||
"red" : "0.157"
|
||||
}
|
||||
},
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
|
@ -1,38 +0,0 @@
|
|||
{
|
||||
"colors" : [
|
||||
{
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"alpha" : "1.000",
|
||||
"blue" : "0xF7",
|
||||
"green" : "0xF2",
|
||||
"red" : "0xF2"
|
||||
}
|
||||
},
|
||||
"idiom" : "universal"
|
||||
},
|
||||
{
|
||||
"appearances" : [
|
||||
{
|
||||
"appearance" : "luminosity",
|
||||
"value" : "dark"
|
||||
}
|
||||
],
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"alpha" : "1.000",
|
||||
"blue" : "0.133",
|
||||
"green" : "0.106",
|
||||
"red" : "0.098"
|
||||
}
|
||||
},
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
|
@ -1,38 +0,0 @@
|
|||
{
|
||||
"colors" : [
|
||||
{
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"alpha" : "0.940",
|
||||
"blue" : "0.976",
|
||||
"green" : "0.976",
|
||||
"red" : "0.976"
|
||||
}
|
||||
},
|
||||
"idiom" : "universal"
|
||||
},
|
||||
{
|
||||
"appearances" : [
|
||||
{
|
||||
"appearance" : "luminosity",
|
||||
"value" : "dark"
|
||||
}
|
||||
],
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"alpha" : "1.000",
|
||||
"blue" : "0.263",
|
||||
"green" : "0.208",
|
||||
"red" : "0.192"
|
||||
}
|
||||
},
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
|
@ -1,38 +0,0 @@
|
|||
{
|
||||
"colors" : [
|
||||
{
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"alpha" : "1.000",
|
||||
"blue" : "1.000",
|
||||
"green" : "1.000",
|
||||
"red" : "1.000"
|
||||
}
|
||||
},
|
||||
"idiom" : "universal"
|
||||
},
|
||||
{
|
||||
"appearances" : [
|
||||
{
|
||||
"appearance" : "luminosity",
|
||||
"value" : "dark"
|
||||
}
|
||||
],
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"alpha" : "1.000",
|
||||
"blue" : "0.263",
|
||||
"green" : "0.208",
|
||||
"red" : "0.192"
|
||||
}
|
||||
},
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
|
@ -1,38 +0,0 @@
|
|||
{
|
||||
"colors" : [
|
||||
{
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"alpha" : "1.000",
|
||||
"blue" : "0.922",
|
||||
"green" : "0.898",
|
||||
"red" : "0.867"
|
||||
}
|
||||
},
|
||||
"idiom" : "universal"
|
||||
},
|
||||
{
|
||||
"appearances" : [
|
||||
{
|
||||
"appearance" : "luminosity",
|
||||
"value" : "dark"
|
||||
}
|
||||
],
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"alpha" : "1.000",
|
||||
"blue" : "0.431",
|
||||
"green" : "0.341",
|
||||
"red" : "0.310"
|
||||
}
|
||||
},
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
|
@ -1,38 +0,0 @@
|
|||
{
|
||||
"colors" : [
|
||||
{
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"alpha" : "1.000",
|
||||
"blue" : "0.996",
|
||||
"green" : "1.000",
|
||||
"red" : "0.996"
|
||||
}
|
||||
},
|
||||
"idiom" : "universal"
|
||||
},
|
||||
{
|
||||
"appearances" : [
|
||||
{
|
||||
"appearance" : "luminosity",
|
||||
"value" : "dark"
|
||||
}
|
||||
],
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"alpha" : "1.000",
|
||||
"blue" : "0.216",
|
||||
"green" : "0.173",
|
||||
"red" : "0.157"
|
||||
}
|
||||
},
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
|
@ -1,38 +0,0 @@
|
|||
{
|
||||
"colors" : [
|
||||
{
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"alpha" : "1.000",
|
||||
"blue" : "0xF7",
|
||||
"green" : "0xF2",
|
||||
"red" : "0xF2"
|
||||
}
|
||||
},
|
||||
"idiom" : "universal"
|
||||
},
|
||||
{
|
||||
"appearances" : [
|
||||
{
|
||||
"appearance" : "luminosity",
|
||||
"value" : "dark"
|
||||
}
|
||||
],
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"alpha" : "1.000",
|
||||
"blue" : "0.263",
|
||||
"green" : "0.208",
|
||||
"red" : "0.192"
|
||||
}
|
||||
},
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
{
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
},
|
||||
"properties" : {
|
||||
"provides-namespace" : true
|
||||
}
|
||||
}
|
|
@ -1,38 +0,0 @@
|
|||
{
|
||||
"colors" : [
|
||||
{
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"alpha" : "1.000",
|
||||
"blue" : "0.910",
|
||||
"green" : "0.882",
|
||||
"red" : "0.851"
|
||||
}
|
||||
},
|
||||
"idiom" : "universal"
|
||||
},
|
||||
{
|
||||
"appearances" : [
|
||||
{
|
||||
"appearance" : "luminosity",
|
||||
"value" : "dark"
|
||||
}
|
||||
],
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"alpha" : "1.000",
|
||||
"blue" : "0.431",
|
||||
"green" : "0.341",
|
||||
"red" : "0.310"
|
||||
}
|
||||
},
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
|
@ -1,38 +0,0 @@
|
|||
{
|
||||
"colors" : [
|
||||
{
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"alpha" : "1.000",
|
||||
"blue" : "0.839",
|
||||
"green" : "0.820",
|
||||
"red" : "0.820"
|
||||
}
|
||||
},
|
||||
"idiom" : "universal"
|
||||
},
|
||||
{
|
||||
"appearances" : [
|
||||
{
|
||||
"appearance" : "luminosity",
|
||||
"value" : "dark"
|
||||
}
|
||||
],
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"alpha" : "1.000",
|
||||
"blue" : "0.431",
|
||||
"green" : "0.341",
|
||||
"red" : "0.310"
|
||||
}
|
||||
},
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
|
@ -1,38 +0,0 @@
|
|||
{
|
||||
"colors" : [
|
||||
{
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"alpha" : "1.000",
|
||||
"blue" : "0.600",
|
||||
"green" : "0.600",
|
||||
"red" : "0.600"
|
||||
}
|
||||
},
|
||||
"idiom" : "universal"
|
||||
},
|
||||
{
|
||||
"appearances" : [
|
||||
{
|
||||
"appearance" : "luminosity",
|
||||
"value" : "dark"
|
||||
}
|
||||
],
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"alpha" : "1.000",
|
||||
"blue" : "0.600",
|
||||
"green" : "0.600",
|
||||
"red" : "0.600"
|
||||
}
|
||||
},
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
|
@ -1,38 +0,0 @@
|
|||
{
|
||||
"colors" : [
|
||||
{
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"alpha" : "1.000",
|
||||
"blue" : "1.000",
|
||||
"green" : "1.000",
|
||||
"red" : "1.000"
|
||||
}
|
||||
},
|
||||
"idiom" : "universal"
|
||||
},
|
||||
{
|
||||
"appearances" : [
|
||||
{
|
||||
"appearance" : "luminosity",
|
||||
"value" : "dark"
|
||||
}
|
||||
],
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"alpha" : "1.000",
|
||||
"blue" : "0.118",
|
||||
"green" : "0.110",
|
||||
"red" : "0.110"
|
||||
}
|
||||
},
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
|
@ -1,38 +0,0 @@
|
|||
{
|
||||
"colors" : [
|
||||
{
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"alpha" : "1.000",
|
||||
"blue" : "254",
|
||||
"green" : "255",
|
||||
"red" : "254"
|
||||
}
|
||||
},
|
||||
"idiom" : "universal"
|
||||
},
|
||||
{
|
||||
"appearances" : [
|
||||
{
|
||||
"appearance" : "luminosity",
|
||||
"value" : "dark"
|
||||
}
|
||||
],
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"alpha" : "1.000",
|
||||
"blue" : "0x2D",
|
||||
"green" : "0x2C",
|
||||
"red" : "0x2C"
|
||||
}
|
||||
},
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
|
@ -1,38 +0,0 @@
|
|||
{
|
||||
"colors" : [
|
||||
{
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"alpha" : "1.000",
|
||||
"blue" : "0xF7",
|
||||
"green" : "0xF2",
|
||||
"red" : "0xF2"
|
||||
}
|
||||
},
|
||||
"idiom" : "universal"
|
||||
},
|
||||
{
|
||||
"appearances" : [
|
||||
{
|
||||
"appearance" : "luminosity",
|
||||
"value" : "dark"
|
||||
}
|
||||
],
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"alpha" : "1.000",
|
||||
"blue" : "0x2D",
|
||||
"green" : "0x2C",
|
||||
"red" : "0x2C"
|
||||
}
|
||||
},
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
|
@ -1,38 +0,0 @@
|
|||
{
|
||||
"colors" : [
|
||||
{
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"alpha" : "1.000",
|
||||
"blue" : "0.996",
|
||||
"green" : "1.000",
|
||||
"red" : "0.996"
|
||||
}
|
||||
},
|
||||
"idiom" : "universal"
|
||||
},
|
||||
{
|
||||
"appearances" : [
|
||||
{
|
||||
"appearance" : "luminosity",
|
||||
"value" : "dark"
|
||||
}
|
||||
],
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"alpha" : "1.000",
|
||||
"blue" : "0x00",
|
||||
"green" : "0x00",
|
||||
"red" : "0x00"
|
||||
}
|
||||
},
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
|
@ -1,38 +0,0 @@
|
|||
{
|
||||
"colors" : [
|
||||
{
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"alpha" : "1.000",
|
||||
"blue" : "0xF7",
|
||||
"green" : "0xF2",
|
||||
"red" : "0xF2"
|
||||
}
|
||||
},
|
||||
"idiom" : "universal"
|
||||
},
|
||||
{
|
||||
"appearances" : [
|
||||
{
|
||||
"appearance" : "luminosity",
|
||||
"value" : "dark"
|
||||
}
|
||||
],
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"alpha" : "1.000",
|
||||
"blue" : "0.000",
|
||||
"green" : "0.000",
|
||||
"red" : "0.000"
|
||||
}
|
||||
},
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
|
@ -1,38 +0,0 @@
|
|||
{
|
||||
"colors" : [
|
||||
{
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"alpha" : "1.000",
|
||||
"blue" : "0.996",
|
||||
"green" : "1.000",
|
||||
"red" : "0.996"
|
||||
}
|
||||
},
|
||||
"idiom" : "universal"
|
||||
},
|
||||
{
|
||||
"appearances" : [
|
||||
{
|
||||
"appearance" : "luminosity",
|
||||
"value" : "dark"
|
||||
}
|
||||
],
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"alpha" : "1.000",
|
||||
"blue" : "0.235",
|
||||
"green" : "0.227",
|
||||
"red" : "0.227"
|
||||
}
|
||||
},
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
|
@ -1,38 +0,0 @@
|
|||
{
|
||||
"colors" : [
|
||||
{
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"alpha" : "1.000",
|
||||
"blue" : "0xF7",
|
||||
"green" : "0xF2",
|
||||
"red" : "0xF2"
|
||||
}
|
||||
},
|
||||
"idiom" : "universal"
|
||||
},
|
||||
{
|
||||
"appearances" : [
|
||||
{
|
||||
"appearance" : "luminosity",
|
||||
"value" : "dark"
|
||||
}
|
||||
],
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"alpha" : "1.000",
|
||||
"blue" : "0.235",
|
||||
"green" : "0.227",
|
||||
"red" : "0.227"
|
||||
}
|
||||
},
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
|
@ -1,38 +0,0 @@
|
|||
{
|
||||
"colors" : [
|
||||
{
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"alpha" : "1.000",
|
||||
"blue" : "0.910",
|
||||
"green" : "0.882",
|
||||
"red" : "0.851"
|
||||
}
|
||||
},
|
||||
"idiom" : "universal"
|
||||
},
|
||||
{
|
||||
"appearances" : [
|
||||
{
|
||||
"appearance" : "luminosity",
|
||||
"value" : "dark"
|
||||
}
|
||||
],
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"alpha" : "1.000",
|
||||
"blue" : "0.431",
|
||||
"green" : "0.341",
|
||||
"red" : "0.310"
|
||||
}
|
||||
},
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
|
@ -227,45 +227,16 @@ public enum Asset {
|
|||
public static let light = ImageAsset(name: "Settings/light")
|
||||
}
|
||||
public enum Theme {
|
||||
public enum Mastodon {
|
||||
public static let composePollRowBackground = ColorAsset(name: "Theme/Mastodon/compose.poll.row.background")
|
||||
public static let composeToolbarBackground = ColorAsset(name: "Theme/Mastodon/compose.toolbar.background")
|
||||
public static let contentWarningOverlayBackground = ColorAsset(name: "Theme/Mastodon/content.warning.overlay.background")
|
||||
public static let navigationBarBackground = ColorAsset(name: "Theme/Mastodon/navigation.bar.background")
|
||||
public static let profileFieldCollectionViewBackground = ColorAsset(name: "Theme/Mastodon/profile.field.collection.view.background")
|
||||
public static let secondaryGroupedSystemBackground = ColorAsset(name: "Theme/Mastodon/secondary.grouped.system.background")
|
||||
public static let secondarySystemBackground = ColorAsset(name: "Theme/Mastodon/secondary.system.background")
|
||||
public static let sidebarBackground = ColorAsset(name: "Theme/Mastodon/sidebar.background")
|
||||
public static let systemBackground = ColorAsset(name: "Theme/Mastodon/system.background")
|
||||
public static let systemElevatedBackground = ColorAsset(name: "Theme/Mastodon/system.elevated.background")
|
||||
public static let systemGroupedBackground = ColorAsset(name: "Theme/Mastodon/system.grouped.background")
|
||||
public static let tabBarBackground = ColorAsset(name: "Theme/Mastodon/tab.bar.background")
|
||||
public static let tableViewCellBackground = ColorAsset(name: "Theme/Mastodon/table.view.cell.background")
|
||||
public static let tableViewCellSelectionBackground = ColorAsset(name: "Theme/Mastodon/table.view.cell.selection.background")
|
||||
public static let tertiarySystemBackground = ColorAsset(name: "Theme/Mastodon/tertiary.system.background")
|
||||
public static let tertiarySystemGroupedBackground = ColorAsset(name: "Theme/Mastodon/tertiary.system.grouped.background")
|
||||
public static let notificationStatusBorderColor = ColorAsset(name: "Theme/Mastodon/notification.status.border.color")
|
||||
public static let separator = ColorAsset(name: "Theme/Mastodon/separator")
|
||||
public static let tabBarItemInactiveIconColor = ColorAsset(name: "Theme/Mastodon/tab.bar.item.inactive.icon.color")
|
||||
}
|
||||
public enum System {
|
||||
public static let composePollRowBackground = ColorAsset(name: "Theme/system/compose.poll.row.background")
|
||||
public static let composeToolbarBackground = ColorAsset(name: "Theme/system/compose.toolbar.background")
|
||||
public static let contentWarningOverlayBackground = ColorAsset(name: "Theme/system/content.warning.overlay.background")
|
||||
public static let navigationBarBackground = ColorAsset(name: "Theme/system/navigation.bar.background")
|
||||
public static let profileFieldCollectionViewBackground = ColorAsset(name: "Theme/system/profile.field.collection.view.background")
|
||||
public static let secondaryGroupedSystemBackground = ColorAsset(name: "Theme/system/secondary.grouped.system.background")
|
||||
public static let secondarySystemBackground = ColorAsset(name: "Theme/system/secondary.system.background")
|
||||
public static let sidebarBackground = ColorAsset(name: "Theme/system/sidebar.background")
|
||||
public static let systemBackground = ColorAsset(name: "Theme/system/system.background")
|
||||
public static let systemElevatedBackground = ColorAsset(name: "Theme/system/system.elevated.background")
|
||||
public static let systemGroupedBackground = ColorAsset(name: "Theme/system/system.grouped.background")
|
||||
public static let tabBarBackground = ColorAsset(name: "Theme/system/tab.bar.background")
|
||||
public static let tableViewCellBackground = ColorAsset(name: "Theme/system/table.view.cell.background")
|
||||
public static let tableViewCellSelectionBackground = ColorAsset(name: "Theme/system/table.view.cell.selection.background")
|
||||
public static let tertiarySystemBackground = ColorAsset(name: "Theme/system/tertiary.system.background")
|
||||
public static let tertiarySystemGroupedBackground = ColorAsset(name: "Theme/system/tertiary.system.grouped.background")
|
||||
public static let notificationStatusBorderColor = ColorAsset(name: "Theme/system/notification.status.border.color")
|
||||
public static let separator = ColorAsset(name: "Theme/system/separator")
|
||||
public static let tabBarItemInactiveIconColor = ColorAsset(name: "Theme/system/tab.bar.item.inactive.icon.color")
|
||||
}
|
||||
|
|
|
@ -1,25 +0,0 @@
|
|||
//
|
||||
// Preference+Theme.swift
|
||||
//
|
||||
//
|
||||
// Created by MainasuK on 2022-4-13.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import MastodonExtension
|
||||
|
||||
public enum ThemeName: String, CaseIterable {
|
||||
case system
|
||||
}
|
||||
|
||||
extension UserDefaults {
|
||||
|
||||
@objc public dynamic var currentThemeNameRawValue: String {
|
||||
get {
|
||||
register(defaults: [#function: ThemeName.system.rawValue])
|
||||
return string(forKey: #function) ?? ThemeName.system.rawValue
|
||||
}
|
||||
set { self[#function] = newValue }
|
||||
}
|
||||
|
||||
}
|
|
@ -8,6 +8,7 @@
|
|||
import UIKit
|
||||
import Combine
|
||||
import MastodonLocalization
|
||||
import MastodonAsset
|
||||
|
||||
public enum PollComposeItem: Hashable {
|
||||
case option(Option)
|
||||
|
@ -24,16 +25,11 @@ extension PollComposeItem {
|
|||
// input
|
||||
@Published public var text = ""
|
||||
@Published public var shouldBecomeFirstResponder = false
|
||||
|
||||
// output
|
||||
@Published public var backgroundColor = ThemeService.shared.currentTheme.value.composePollRowBackgroundColor
|
||||
|
||||
public let backgroundColor = SystemTheme.composePollRowBackgroundColor
|
||||
|
||||
public override init() {
|
||||
super.init()
|
||||
|
||||
ThemeService.shared.currentTheme
|
||||
.map { $0.composePollRowBackgroundColor }
|
||||
.assign(to: &$backgroundColor)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -177,12 +177,6 @@ extension SettingService {
|
|||
extension SettingService {
|
||||
|
||||
static func updatePreference(setting: Setting) {
|
||||
// set theme
|
||||
let themeName: ThemeName = .system
|
||||
if UserDefaults.shared.currentThemeNameRawValue != themeName.rawValue {
|
||||
ThemeService.shared.set(themeName: themeName)
|
||||
}
|
||||
|
||||
// set avatar mode
|
||||
if UserDefaults.shared.preferredStaticAvatar != setting.preferredStaticAvatar {
|
||||
UserDefaults.shared.preferredStaticAvatar = setting.preferredStaticAvatar
|
||||
|
|
|
@ -9,39 +9,27 @@ import UIKit
|
|||
import MastodonAsset
|
||||
import MastodonCommon
|
||||
|
||||
struct SystemTheme: Theme {
|
||||
public enum SystemTheme {
|
||||
public static let tintColor = UIColor.label
|
||||
|
||||
let themeName: ThemeName = .system
|
||||
public static let systemElevatedBackgroundColor = Asset.Theme.System.systemElevatedBackground.color
|
||||
public static let navigationBarBackgroundColor = Asset.Theme.System.navigationBarBackground.color
|
||||
|
||||
let systemBackgroundColor = Asset.Theme.System.systemBackground.color
|
||||
let secondarySystemBackgroundColor = Asset.Theme.System.secondarySystemBackground.color
|
||||
let tertiarySystemBackgroundColor = Asset.Theme.System.tertiarySystemBackground.color
|
||||
|
||||
let systemElevatedBackgroundColor = Asset.Theme.System.systemElevatedBackground.color
|
||||
|
||||
let systemGroupedBackgroundColor = Asset.Theme.System.systemGroupedBackground.color
|
||||
let secondarySystemGroupedBackgroundColor = Asset.Theme.System.secondaryGroupedSystemBackground.color
|
||||
let tertiarySystemGroupedBackgroundColor = Asset.Theme.System.tertiarySystemGroupedBackground.color
|
||||
|
||||
let navigationBarBackgroundColor = Asset.Theme.System.navigationBarBackground.color
|
||||
|
||||
let sidebarBackgroundColor = Asset.Theme.System.sidebarBackground.color
|
||||
public static let sidebarBackgroundColor = Asset.Theme.System.sidebarBackground.color
|
||||
|
||||
let tabBarBackgroundColor = Asset.Theme.System.tabBarBackground.color
|
||||
let tabBarItemSelectedIconColor = Asset.Colors.Brand.blurple.color
|
||||
let tabBarItemFocusedIconColor = Asset.Theme.System.tabBarItemInactiveIconColor.color
|
||||
let tabBarItemNormalIconColor = Asset.Theme.System.tabBarItemInactiveIconColor.color
|
||||
let tabBarItemDisabledIconColor = Asset.Theme.System.tabBarItemInactiveIconColor.color
|
||||
public static let tabBarBackgroundColor = Asset.Theme.System.tabBarBackground.color
|
||||
public static let tabBarItemSelectedIconColor = Asset.Colors.Brand.blurple.color
|
||||
public static let tabBarItemFocusedIconColor = Asset.Theme.System.tabBarItemInactiveIconColor.color
|
||||
public static let tabBarItemNormalIconColor = Asset.Theme.System.tabBarItemInactiveIconColor.color
|
||||
public static let tabBarItemDisabledIconColor = Asset.Theme.System.tabBarItemInactiveIconColor.color
|
||||
|
||||
let separator = Asset.Theme.System.separator.color
|
||||
public static let separator = Asset.Theme.System.separator.color
|
||||
|
||||
let tableViewBackgroundColor: UIColor = .clear
|
||||
let tableViewCellBackgroundColor = Asset.Theme.System.tableViewCellBackground.color
|
||||
let tableViewCellSelectionBackgroundColor = Asset.Theme.System.tableViewCellSelectionBackground.color
|
||||
public static let tableViewBackgroundColor: UIColor = .clear
|
||||
public static let tableViewCellBackgroundColor = Asset.Theme.System.tableViewCellBackground.color
|
||||
public static let tableViewCellSelectionBackgroundColor = Asset.Theme.System.tableViewCellSelectionBackground.color
|
||||
|
||||
let contentWarningOverlayBackgroundColor = Asset.Theme.System.contentWarningOverlayBackground.color
|
||||
let profileFieldCollectionViewBackgroundColor = Asset.Theme.System.profileFieldCollectionViewBackground.color
|
||||
let composeToolbarBackgroundColor = Asset.Theme.System.composeToolbarBackground.color
|
||||
let composePollRowBackgroundColor = Asset.Theme.System.composePollRowBackground.color
|
||||
let notificationStatusBorderColor = Asset.Theme.System.notificationStatusBorderColor.color
|
||||
public static let contentWarningOverlayBackgroundColor = Asset.Theme.System.contentWarningOverlayBackground.color
|
||||
public static let composeToolbarBackgroundColor = Asset.Theme.System.composeToolbarBackground.color
|
||||
public static let composePollRowBackgroundColor = Asset.Theme.System.composePollRowBackground.color
|
||||
}
|
||||
|
|
|
@ -1,47 +0,0 @@
|
|||
//
|
||||
// Theme.swift
|
||||
// Mastodon
|
||||
//
|
||||
// Created by MainasuK Cirno on 2021-7-5.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import MastodonCommon
|
||||
|
||||
public protocol Theme {
|
||||
|
||||
var themeName: ThemeName { get }
|
||||
|
||||
var systemBackgroundColor: UIColor { get }
|
||||
var secondarySystemBackgroundColor: UIColor { get }
|
||||
var tertiarySystemBackgroundColor: UIColor { get }
|
||||
|
||||
var systemElevatedBackgroundColor: UIColor { get }
|
||||
|
||||
var systemGroupedBackgroundColor: UIColor { get }
|
||||
var secondarySystemGroupedBackgroundColor: UIColor { get }
|
||||
var tertiarySystemGroupedBackgroundColor: UIColor { get }
|
||||
|
||||
var navigationBarBackgroundColor: UIColor { get }
|
||||
|
||||
var sidebarBackgroundColor: UIColor { get }
|
||||
|
||||
var tabBarBackgroundColor: UIColor { get }
|
||||
var tabBarItemSelectedIconColor: UIColor { get }
|
||||
var tabBarItemFocusedIconColor: UIColor { get }
|
||||
var tabBarItemNormalIconColor: UIColor { get }
|
||||
var tabBarItemDisabledIconColor: UIColor { get }
|
||||
|
||||
var separator: UIColor { get }
|
||||
|
||||
var tableViewBackgroundColor: UIColor { get }
|
||||
var tableViewCellBackgroundColor: UIColor { get }
|
||||
var tableViewCellSelectionBackgroundColor: UIColor { get }
|
||||
|
||||
var contentWarningOverlayBackgroundColor: UIColor { get }
|
||||
var profileFieldCollectionViewBackgroundColor: UIColor { get }
|
||||
var composeToolbarBackgroundColor: UIColor { get }
|
||||
var composePollRowBackgroundColor: UIColor { get }
|
||||
var notificationStatusBorderColor: UIColor { get }
|
||||
|
||||
}
|
|
@ -11,44 +11,14 @@ import MastodonCommon
|
|||
|
||||
// ref: https://zamzam.io/protocol-oriented-themes-for-ios-apps/
|
||||
public final class ThemeService {
|
||||
|
||||
public static let tintColor: UIColor = .label
|
||||
|
||||
// MARK: - Singleton
|
||||
public static let shared = ThemeService()
|
||||
|
||||
public let currentTheme: CurrentValueSubject<Theme, Never>
|
||||
|
||||
private init() {
|
||||
let theme = ThemeName.system.theme
|
||||
currentTheme = CurrentValueSubject(theme)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
extension ThemeName {
|
||||
public var theme: Theme {
|
||||
switch self {
|
||||
case .system:
|
||||
return SystemTheme()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extension ThemeService {
|
||||
public func set(themeName: ThemeName) {
|
||||
UserDefaults.shared.currentThemeNameRawValue = themeName.rawValue
|
||||
|
||||
let theme = themeName.theme
|
||||
apply(theme: theme)
|
||||
currentTheme.value = theme
|
||||
}
|
||||
|
||||
public func apply(theme: Theme) {
|
||||
public func apply() {
|
||||
// set navigation bar appearance
|
||||
let appearance = UINavigationBarAppearance()
|
||||
appearance.configureWithDefaultBackground()
|
||||
appearance.backgroundColor = theme.navigationBarBackgroundColor
|
||||
appearance.backgroundColor = SystemTheme.navigationBarBackgroundColor
|
||||
UINavigationBar.appearance().standardAppearance = appearance
|
||||
UINavigationBar.appearance().compactAppearance = appearance
|
||||
UINavigationBar.appearance().scrollEdgeAppearance = appearance
|
||||
|
@ -63,30 +33,30 @@ extension ThemeService {
|
|||
tabBarItemAppearance.focused.titleTextAttributes = [.foregroundColor: UIColor.clear]
|
||||
tabBarItemAppearance.normal.titleTextAttributes = [.foregroundColor: UIColor.clear]
|
||||
tabBarItemAppearance.disabled.titleTextAttributes = [.foregroundColor: UIColor.clear]
|
||||
tabBarItemAppearance.selected.iconColor = theme.tabBarItemSelectedIconColor
|
||||
tabBarItemAppearance.focused.iconColor = theme.tabBarItemFocusedIconColor
|
||||
tabBarItemAppearance.normal.iconColor = theme.tabBarItemNormalIconColor
|
||||
tabBarItemAppearance.disabled.iconColor = theme.tabBarItemDisabledIconColor
|
||||
tabBarItemAppearance.selected.iconColor = SystemTheme.tabBarItemSelectedIconColor
|
||||
tabBarItemAppearance.focused.iconColor = SystemTheme.tabBarItemFocusedIconColor
|
||||
tabBarItemAppearance.normal.iconColor = SystemTheme.tabBarItemNormalIconColor
|
||||
tabBarItemAppearance.disabled.iconColor = SystemTheme.tabBarItemDisabledIconColor
|
||||
tabBarAppearance.stackedLayoutAppearance = tabBarItemAppearance
|
||||
tabBarAppearance.inlineLayoutAppearance = tabBarItemAppearance
|
||||
tabBarAppearance.compactInlineLayoutAppearance = tabBarItemAppearance
|
||||
|
||||
tabBarAppearance.backgroundColor = theme.tabBarBackgroundColor
|
||||
tabBarAppearance.backgroundColor = SystemTheme.tabBarBackgroundColor
|
||||
UITabBar.appearance().standardAppearance = tabBarAppearance
|
||||
UITabBar.appearance().scrollEdgeAppearance = tabBarAppearance
|
||||
UITabBar.appearance().barTintColor = theme.tabBarBackgroundColor
|
||||
UITabBar.appearance().barTintColor = SystemTheme.tabBarBackgroundColor
|
||||
|
||||
// set table view cell appearance
|
||||
UITableView.appearance().backgroundColor = theme.tableViewBackgroundColor
|
||||
UITableViewCell.appearance().backgroundColor = theme.tableViewCellBackgroundColor
|
||||
UITableView.appearance().backgroundColor = SystemTheme.tableViewBackgroundColor
|
||||
UITableViewCell.appearance().backgroundColor = SystemTheme.tableViewCellBackgroundColor
|
||||
// FIXME: refactor
|
||||
// UITableViewCell.appearance(whenContainedInInstancesOf: [SettingsViewController.self]).backgroundColor = theme.secondarySystemGroupedBackgroundColor
|
||||
// UITableViewCell.appearance().selectionColor = theme.tableViewCellSelectionBackgroundColor
|
||||
// UITableViewCell.appearance(whenContainedInInstancesOf: [SettingsViewController.self]).backgroundColor = .secondarySystemGroupedBackground
|
||||
// UITableViewCell.appearance().selectionColor = SystemTheme.tableViewCellSelectionBackgroundColor
|
||||
|
||||
// set search bar appearance
|
||||
UISearchBar.appearance().tintColor = ThemeService.tintColor
|
||||
UISearchBar.appearance().barTintColor = theme.navigationBarBackgroundColor
|
||||
let cancelButtonAttributes: [NSAttributedString.Key : Any] = [NSAttributedString.Key.foregroundColor: ThemeService.tintColor]
|
||||
UISearchBar.appearance().tintColor = SystemTheme.tintColor
|
||||
UISearchBar.appearance().barTintColor = SystemTheme.navigationBarBackgroundColor
|
||||
let cancelButtonAttributes: [NSAttributedString.Key : Any] = [NSAttributedString.Key.foregroundColor: SystemTheme.tintColor]
|
||||
UIBarButtonItem.appearance(whenContainedInInstancesOf: [UISearchBar.self]).setTitleTextAttributes(cancelButtonAttributes, for: .normal)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,27 +9,13 @@ import UIKit
|
|||
import MastodonCore
|
||||
|
||||
extension UIView {
|
||||
|
||||
static let separatorColor: UIColor = {
|
||||
UIColor(dynamicProvider: { collection in
|
||||
switch collection.userInterfaceStyle {
|
||||
case .dark:
|
||||
return ThemeService.shared.currentTheme.value.separator
|
||||
default:
|
||||
return .separator
|
||||
}
|
||||
})
|
||||
}()
|
||||
|
||||
|
||||
public static var separatorLine: UIView {
|
||||
let line = UIView()
|
||||
line.backgroundColor = UIView.separatorColor
|
||||
line.backgroundColor = .separator
|
||||
return line
|
||||
}
|
||||
|
||||
public static func separatorLineHeight(of view: UIView) -> CGFloat {
|
||||
return 1.0 / view.traitCollection.displayScale
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ final class AutoCompleteViewController: UIViewController {
|
|||
let chevronView = AutoCompleteTopChevronView()
|
||||
let containerBackgroundView: UIView = {
|
||||
let view = UIView()
|
||||
view.backgroundColor = ThemeService.shared.currentTheme.value.systemBackgroundColor
|
||||
view.backgroundColor = .systemBackground
|
||||
return view
|
||||
}()
|
||||
|
||||
|
|
|
@ -20,12 +20,8 @@ final class AutoCompleteTopChevronView: UIView {
|
|||
private let maskLayer = CAShapeLayer()
|
||||
|
||||
var chevronMinX: CGFloat = 0
|
||||
var topViewBackgroundColor = ThemeService.shared.currentTheme.value.systemElevatedBackgroundColor {
|
||||
didSet { setNeedsLayout() }
|
||||
}
|
||||
var bottomViewBackgroundColor = ThemeService.shared.currentTheme.value.systemBackgroundColor {
|
||||
didSet { setNeedsLayout() }
|
||||
}
|
||||
var topViewBackgroundColor = SystemTheme.systemElevatedBackgroundColor
|
||||
var bottomViewBackgroundColor = UIColor.systemBackground
|
||||
|
||||
override init(frame: CGRect) {
|
||||
super.init(frame: frame)
|
||||
|
@ -69,15 +65,6 @@ extension AutoCompleteTopChevronView {
|
|||
|
||||
shadowLayer.fillColor = topViewBackgroundColor.cgColor
|
||||
shadowView.layer.addSublayer(shadowLayer)
|
||||
|
||||
setupBackgroundColor(theme: ThemeService.shared.currentTheme.value)
|
||||
ThemeService.shared.currentTheme
|
||||
.receive(on: DispatchQueue.main)
|
||||
.sink { [weak self] theme in
|
||||
guard let self = self else { return }
|
||||
self.setupBackgroundColor(theme: theme)
|
||||
}
|
||||
.store(in: &disposeBag)
|
||||
}
|
||||
|
||||
override func layoutSubviews() {
|
||||
|
@ -122,13 +109,6 @@ extension AutoCompleteTopChevronView {
|
|||
|
||||
}
|
||||
|
||||
extension AutoCompleteTopChevronView {
|
||||
private func setupBackgroundColor(theme: Theme) {
|
||||
topViewBackgroundColor = theme.systemElevatedBackgroundColor
|
||||
bottomViewBackgroundColor = theme.systemBackgroundColor
|
||||
}
|
||||
}
|
||||
|
||||
extension AutoCompleteTopChevronView {
|
||||
func invertMask(in rect: CGRect) -> CAShapeLayer {
|
||||
let path = UIBezierPath()
|
||||
|
@ -168,7 +148,7 @@ struct AutoCompleteTopChevronView_Previews: PreviewProvider {
|
|||
view.chevronMinX = 10
|
||||
return view
|
||||
}
|
||||
.background(Color(ThemeService.shared.currentTheme.value.systemElevatedBackgroundColor))
|
||||
.background(Color(SystemTheme.systemElevatedBackgroundColor))
|
||||
.padding(20)
|
||||
.previewLayout(.fixed(width: 375 + 40, height: 100 + 40))
|
||||
UIViewPreview(width: 375) {
|
||||
|
@ -181,7 +161,7 @@ struct AutoCompleteTopChevronView_Previews: PreviewProvider {
|
|||
view.chevronMinX = 10
|
||||
return view
|
||||
}
|
||||
.background(Color(ThemeService.shared.currentTheme.value.systemElevatedBackgroundColor))
|
||||
.background(Color(SystemTheme.systemElevatedBackgroundColor))
|
||||
.preferredColorScheme(.dark)
|
||||
.padding(20)
|
||||
.previewLayout(.fixed(width: 375 + 40, height: 100 + 40))
|
||||
|
|
|
@ -89,14 +89,7 @@ extension ComposeContentViewController {
|
|||
viewModel.delegate = self
|
||||
|
||||
// setup view
|
||||
self.setupBackgroundColor(theme: ThemeService.shared.currentTheme.value)
|
||||
ThemeService.shared.currentTheme
|
||||
.receive(on: RunLoop.main)
|
||||
.sink { [weak self] theme in
|
||||
guard let self = self else { return }
|
||||
self.setupBackgroundColor(theme: theme)
|
||||
}
|
||||
.store(in: &disposeBag)
|
||||
setupBackgroundColor()
|
||||
|
||||
// setup tableView
|
||||
tableView.translatesAutoresizingMaskIntoConstraints = false
|
||||
|
@ -311,16 +304,16 @@ extension ComposeContentViewController {
|
|||
}
|
||||
|
||||
extension ComposeContentViewController {
|
||||
private func setupBackgroundColor(theme: Theme) {
|
||||
private func setupBackgroundColor() {
|
||||
let backgroundColor = UIColor(dynamicProvider: { traitCollection in
|
||||
switch traitCollection.userInterfaceStyle {
|
||||
case .light: return .systemBackground
|
||||
default: return theme.systemElevatedBackgroundColor
|
||||
default: return SystemTheme.systemElevatedBackgroundColor
|
||||
}
|
||||
})
|
||||
view.backgroundColor = backgroundColor
|
||||
tableView.backgroundColor = backgroundColor
|
||||
composeContentToolbarBackgroundView.backgroundColor = theme.composeToolbarBackgroundColor
|
||||
composeContentToolbarBackgroundView.backgroundColor = SystemTheme.composeToolbarBackgroundColor
|
||||
}
|
||||
|
||||
private func bindToolbarViewModel() {
|
||||
|
|
|
@ -46,12 +46,6 @@ public struct PollAddOptionRow: View {
|
|||
extension PollAddOptionRow {
|
||||
public class ViewModel: ObservableObject {
|
||||
// output
|
||||
@Published public var backgroundColor = ThemeService.shared.currentTheme.value.composePollRowBackgroundColor
|
||||
|
||||
public init() {
|
||||
ThemeService.shared.currentTheme
|
||||
.map { $0.composePollRowBackgroundColor }
|
||||
.assign(to: &$backgroundColor)
|
||||
}
|
||||
public var backgroundColor = SystemTheme.composePollRowBackgroundColor
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ extension ComposeContentToolbarView {
|
|||
weak var delegate: ComposeContentToolbarViewDelegate?
|
||||
|
||||
// input
|
||||
@Published var backgroundColor = ThemeService.shared.currentTheme.value.composeToolbarBackgroundColor
|
||||
@Published var backgroundColor = SystemTheme.composeToolbarBackgroundColor
|
||||
@Published var suggestedLanguages: [String] = []
|
||||
@Published var highConfidenceSuggestedLanguage: String?
|
||||
@Published var visibility: Mastodon.Entity.Status.Visibility = .public
|
||||
|
@ -43,13 +43,7 @@ extension ComposeContentToolbarView {
|
|||
|
||||
init(delegate: ComposeContentToolbarViewDelegate) {
|
||||
self.delegate = delegate
|
||||
// end init
|
||||
|
||||
ThemeService.shared.currentTheme
|
||||
.map { $0.composeToolbarBackgroundColor }
|
||||
.assign(to: &$backgroundColor)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -47,20 +47,14 @@ extension ProfileCardView {
|
|||
@Published public var familiarFollowers: Mastodon.Entity.FamiliarFollowers?
|
||||
|
||||
init() {
|
||||
backgroundColor = ThemeService.shared.currentTheme.value.systemBackgroundColor
|
||||
Publishers.CombineLatest(
|
||||
ThemeService.shared.currentTheme,
|
||||
$userInterfaceStyle
|
||||
)
|
||||
.sink { [weak self] theme, userInterfaceStyle in
|
||||
backgroundColor = .systemBackground
|
||||
$userInterfaceStyle
|
||||
.sink { [weak self] userInterfaceStyle in
|
||||
guard let self = self else { return }
|
||||
guard let userInterfaceStyle = userInterfaceStyle else { return }
|
||||
switch userInterfaceStyle {
|
||||
case .dark:
|
||||
switch theme.themeName {
|
||||
case .system:
|
||||
self.backgroundColor = theme.secondarySystemBackgroundColor
|
||||
}
|
||||
self.backgroundColor = .secondarySystemBackground
|
||||
case .light, .unspecified:
|
||||
self.backgroundColor = Asset.Scene.Discovery.profileCardBackground.color
|
||||
@unknown default:
|
||||
|
|
|
@ -69,11 +69,7 @@ public final class StatusCardControl: UIControl {
|
|||
public override init(frame: CGRect) {
|
||||
super.init(frame: frame)
|
||||
|
||||
apply(theme: ThemeService.shared.currentTheme.value)
|
||||
|
||||
ThemeService.shared.currentTheme.sink { [weak self] theme in
|
||||
self?.apply(theme: theme)
|
||||
}.store(in: &disposeBag)
|
||||
applyBranding()
|
||||
|
||||
clipsToBounds = true
|
||||
layer.cornerCurve = .continuous
|
||||
|
@ -234,9 +230,9 @@ public final class StatusCardControl: UIControl {
|
|||
}
|
||||
}
|
||||
|
||||
private func apply(theme: Theme) {
|
||||
layer.borderColor = theme.separator.cgColor
|
||||
dividerView.backgroundColor = theme.separator
|
||||
private func applyBranding() {
|
||||
layer.borderColor = SystemTheme.separator.cgColor
|
||||
dividerView.backgroundColor = SystemTheme.separator
|
||||
imageView.backgroundColor = UIColor.tertiarySystemFill
|
||||
}
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue