Fix glitching themes on follow system fix #253

This commit is contained in:
Thomas Ricouard 2023-01-22 06:53:18 +01:00
parent a79c5691e0
commit fd28864063
7 changed files with 14 additions and 10 deletions

View File

@ -1,4 +1,5 @@
import AppAccount
import DesignSystem
import Env
import Explore
import Models
@ -7,6 +8,7 @@ import Shimmer
import SwiftUI
struct ExploreTab: View {
@EnvironmentObject private var theme: Theme
@EnvironmentObject private var preferences: UserPreferences
@EnvironmentObject private var currentAccount: CurrentAccount
@EnvironmentObject private var client: Client
@ -18,6 +20,7 @@ struct ExploreTab: View {
ExploreView()
.withAppRouter()
.withSheetDestinations(sheetDestinations: $routerPath.presentedSheet)
.toolbarBackground(theme.primaryBackgroundColor.opacity(0.50), for: .navigationBar)
.toolbar {
statusEditorToolbarItem(routerPath: routerPath,
visibility: preferences.serverPreferences?.postVisibility ?? .pub)

View File

@ -1,6 +1,7 @@
import Account
import AppAccount
import Conversations
import DesignSystem
import Env
import Models
import Network
@ -8,6 +9,7 @@ import Shimmer
import SwiftUI
struct MessagesTab: View {
@EnvironmentObject private var theme: Theme
@EnvironmentObject private var watcher: StreamWatcher
@EnvironmentObject private var client: Client
@EnvironmentObject private var currentAccount: CurrentAccount
@ -26,6 +28,7 @@ struct MessagesTab: View {
}
}
}
.toolbarBackground(theme.primaryBackgroundColor.opacity(0.50), for: .navigationBar)
.id(currentAccount.account?.id)
}
.onChange(of: $popToRootTab.wrappedValue) { popToRootTab in

View File

@ -1,4 +1,5 @@
import AppAccount
import DesignSystem
import Env
import Models
import Network
@ -7,6 +8,7 @@ import SwiftUI
import Timeline
struct NotificationsTab: View {
@EnvironmentObject private var theme: Theme
@EnvironmentObject private var client: Client
@EnvironmentObject private var watcher: StreamWatcher
@EnvironmentObject private var currentAccount: CurrentAccount
@ -30,6 +32,7 @@ struct NotificationsTab: View {
}
}
}
.toolbarBackground(theme.primaryBackgroundColor.opacity(0.50), for: .navigationBar)
.id(currentAccount.account?.id)
}
.onAppear {

View File

@ -1,6 +1,7 @@
import Account
import AppAccount
import Conversations
import DesignSystem
import Env
import Models
import Network
@ -8,6 +9,7 @@ import Shimmer
import SwiftUI
struct ProfileTab: View {
@EnvironmentObject private var theme: Theme
@EnvironmentObject private var client: Client
@EnvironmentObject private var currentAccount: CurrentAccount
@StateObject private var routerPath = RouterPath()
@ -26,6 +28,7 @@ struct ProfileTab: View {
}
}
}
.toolbarBackground(theme.primaryBackgroundColor.opacity(0.50), for: .navigationBar)
.id(currentAccount.account?.id)
} else {
AccountDetailView(account: .placeholder())

View File

@ -16,17 +16,8 @@ struct DisplaySettingsView: View {
Toggle("settings.display.theme.systemColor", isOn: $theme.followSystemColorScheme)
themeSelectorButton
ColorPicker("settings.display.theme.tint", selection: $theme.tintColor)
.onChange(of: theme.tintColor) { _ in
theme.followSystemColorScheme = false
}
ColorPicker("settings.display.theme.background", selection: $theme.primaryBackgroundColor)
.onChange(of: theme.primaryBackgroundColor) { _ in
theme.followSystemColorScheme = false
}
ColorPicker("settings.display.theme.secondary-background", selection: $theme.secondaryBackgroundColor)
.onChange(of: theme.primaryBackgroundColor) { _ in
theme.followSystemColorScheme = false
}
}
.listRowBackground(theme.primaryBackgroundColor)

View File

@ -32,7 +32,7 @@ struct SettingsTabs: View {
.background(theme.secondaryBackgroundColor)
.navigationTitle(Text("settings.title"))
.navigationBarTitleDisplayMode(.inline)
.toolbarBackground(theme.primaryBackgroundColor, for: .navigationBar)
.toolbarBackground(theme.primaryBackgroundColor.opacity(0.50), for: .navigationBar)
.withAppRouter()
.withSheetDestinations(sheetDestinations: $routerPath.presentedSheet)
}

View File

@ -35,6 +35,7 @@ struct TimelineTab: View {
.toolbar {
toolbarView
}
.toolbarBackground(theme.primaryBackgroundColor.opacity(0.50), for: .navigationBar)
.id(currentAccount.account?.id)
}
.onAppear {