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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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