fix: background color may set with delay issue
This commit is contained in:
parent
31a79cbef0
commit
489f8d0448
|
@ -144,13 +144,12 @@ extension ComposeViewController {
|
|||
self.title = title
|
||||
}
|
||||
.store(in: &disposeBag)
|
||||
view.backgroundColor = ThemeService.shared.currentTheme.value.systemElevatedBackgroundColor
|
||||
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.view.backgroundColor = theme.systemElevatedBackgroundColor
|
||||
self.tableView.backgroundColor = theme.systemElevatedBackgroundColor
|
||||
self.setupBackgroundColor(theme: theme)
|
||||
}
|
||||
.store(in: &disposeBag)
|
||||
navigationItem.leftBarButtonItem = cancelBarButtonItem
|
||||
|
@ -607,6 +606,11 @@ extension ComposeViewController {
|
|||
// })
|
||||
}
|
||||
|
||||
private func setupBackgroundColor(theme: Theme) {
|
||||
view.backgroundColor = theme.systemElevatedBackgroundColor
|
||||
tableView.backgroundColor = theme.systemElevatedBackgroundColor
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
extension ComposeViewController {
|
||||
|
|
|
@ -58,7 +58,8 @@ extension HashtagTimelineViewController {
|
|||
title = "#\(viewModel.hashtag)"
|
||||
titleView.update(title: viewModel.hashtag, subtitle: nil, emojiDict: [:])
|
||||
navigationItem.titleView = titleView
|
||||
|
||||
|
||||
view.backgroundColor = ThemeService.shared.currentTheme.value.secondarySystemBackgroundColor
|
||||
ThemeService.shared.currentTheme
|
||||
.receive(on: RunLoop.main)
|
||||
.sink { [weak self] theme in
|
||||
|
|
|
@ -80,8 +80,8 @@ extension HomeTimelineViewController {
|
|||
override func viewDidLoad() {
|
||||
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
|
||||
|
|
|
@ -48,7 +48,8 @@ final class NotificationViewController: UIViewController, NeedsDependency {
|
|||
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
|
||||
|
|
|
@ -238,13 +238,12 @@ extension NotificationStatusTableViewCell {
|
|||
statusView.bottomAnchor.constraint(equalTo: statusContainerView.layoutMarginsGuide.bottomAnchor),
|
||||
])
|
||||
|
||||
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.statusContainerView.backgroundColor = UIColor(dynamicProvider: { traitCollection in
|
||||
return traitCollection.userInterfaceStyle == .light ? theme.systemBackgroundColor : theme.tertiarySystemGroupedBackgroundColor
|
||||
})
|
||||
self.setupBackgroundColor(theme: theme)
|
||||
}
|
||||
.store(in: &disposeBag)
|
||||
// remove item don't display
|
||||
|
@ -286,6 +285,16 @@ extension NotificationStatusTableViewCell {
|
|||
|
||||
}
|
||||
|
||||
extension NotificationStatusTableViewCell {
|
||||
|
||||
private func setupBackgroundColor(theme: Theme) {
|
||||
statusContainerView.backgroundColor = UIColor(dynamicProvider: { traitCollection in
|
||||
return traitCollection.userInterfaceStyle == .light ? theme.systemBackgroundColor : theme.tertiarySystemGroupedBackgroundColor
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
extension NotificationStatusTableViewCell {
|
||||
@objc private func avatarImageViewTapGestureRecognizerHandler(_ sender: UITapGestureRecognizer) {
|
||||
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function)
|
||||
|
|
|
@ -88,6 +88,7 @@ extension ProfileHeaderViewController {
|
|||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
||||
view.backgroundColor = ThemeService.shared.currentTheme.value.systemGroupedBackgroundColor
|
||||
ThemeService.shared.currentTheme
|
||||
.receive(on: RunLoop.main)
|
||||
.sink { [weak self] theme in
|
||||
|
|
|
@ -141,7 +141,8 @@ extension ProfileViewController {
|
|||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
||||
|
||||
view.backgroundColor = ThemeService.shared.currentTheme.value.secondarySystemBackgroundColor
|
||||
ThemeService.shared.currentTheme
|
||||
.receive(on: RunLoop.main)
|
||||
.sink { [weak self] theme in
|
||||
|
|
|
@ -135,14 +135,12 @@ extension SearchViewController {
|
|||
navigationItem.compactAppearance = barAppearance
|
||||
navigationItem.scrollEdgeAppearance = barAppearance
|
||||
|
||||
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.view.backgroundColor = theme.systemGroupedBackgroundColor
|
||||
self.searchHeader.backgroundColor = theme.systemGroupedBackgroundColor
|
||||
self.searchingTableView.backgroundColor = theme.systemBackgroundColor
|
||||
self.statusBar.backgroundColor = theme.navigationBarBackgroundColor
|
||||
self.setupBackgroundColor(theme: theme)
|
||||
}
|
||||
.store(in: &disposeBag)
|
||||
|
||||
|
@ -171,6 +169,13 @@ extension SearchViewController {
|
|||
viewModel.viewDidAppeared.send()
|
||||
}
|
||||
|
||||
private func setupBackgroundColor(theme: Theme) {
|
||||
view.backgroundColor = theme.systemGroupedBackgroundColor
|
||||
searchHeader.backgroundColor = theme.systemGroupedBackgroundColor
|
||||
searchingTableView.backgroundColor = theme.systemBackgroundColor
|
||||
statusBar.backgroundColor = theme.navigationBarBackgroundColor
|
||||
}
|
||||
|
||||
func setupSearchBar() {
|
||||
searchBar.delegate = self
|
||||
view.addSubview(searchBar)
|
||||
|
|
|
@ -205,27 +205,12 @@ class SettingsViewController: UIViewController, NeedsDependency {
|
|||
}
|
||||
|
||||
private func setupView() {
|
||||
self.view.backgroundColor = UIColor(dynamicProvider: { traitCollection in
|
||||
switch traitCollection.userInterfaceLevel {
|
||||
case .elevated where traitCollection.userInterfaceStyle == .dark:
|
||||
return ThemeService.shared.currentTheme.value.systemElevatedBackgroundColor
|
||||
default:
|
||||
return ThemeService.shared.currentTheme.value.secondarySystemBackgroundColor
|
||||
}
|
||||
})
|
||||
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.view.backgroundColor = UIColor(dynamicProvider: { traitCollection in
|
||||
switch traitCollection.userInterfaceLevel {
|
||||
case .elevated where traitCollection.userInterfaceStyle == .dark:
|
||||
return theme.systemElevatedBackgroundColor
|
||||
default:
|
||||
return theme.secondarySystemBackgroundColor
|
||||
}
|
||||
})
|
||||
|
||||
self.setupBackgroundColor(theme: theme)
|
||||
}
|
||||
.store(in: &disposeBag)
|
||||
|
||||
|
@ -241,6 +226,17 @@ class SettingsViewController: UIViewController, NeedsDependency {
|
|||
|
||||
updateSectionHeaderStackViewLayout()
|
||||
}
|
||||
|
||||
private func setupBackgroundColor(theme: Theme) {
|
||||
view.backgroundColor = UIColor(dynamicProvider: { traitCollection in
|
||||
switch traitCollection.userInterfaceLevel {
|
||||
case .elevated where traitCollection.userInterfaceStyle == .dark:
|
||||
return theme.systemElevatedBackgroundColor
|
||||
default:
|
||||
return theme.secondarySystemBackgroundColor
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
private func setupNavigation() {
|
||||
navigationController?.navigationBar.prefersLargeTitles = true
|
||||
|
|
|
@ -51,7 +51,8 @@ extension ThreadViewController {
|
|||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
||||
|
||||
view.backgroundColor = ThemeService.shared.currentTheme.value.secondarySystemBackgroundColor
|
||||
ThemeService.shared.currentTheme
|
||||
.receive(on: RunLoop.main)
|
||||
.sink { [weak self] theme in
|
||||
|
|
Loading…
Reference in New Issue