mirror of
https://github.com/yattee/yattee.git
synced 2026-11-04 02:47:18 +00:00
Let the user hide the account pickers outside Settings
This commit is contained in:
@@ -289,7 +289,9 @@ struct HistoryListView: View {
|
||||
}
|
||||
}
|
||||
|
||||
DataContextSwitcherButton()
|
||||
if appEnvironment?.settingsManager.showAccountPickers ?? true {
|
||||
DataContextSwitcherButton()
|
||||
}
|
||||
}
|
||||
.focusSection()
|
||||
.padding(.horizontal, 48)
|
||||
@@ -329,8 +331,10 @@ struct HistoryListView: View {
|
||||
ToolbarSpacer(.flexible, placement: .primaryAction)
|
||||
}
|
||||
#endif
|
||||
ToolbarItem(placement: viewOptionsPlacement) {
|
||||
DataContextSwitcherMenu()
|
||||
if appEnvironment?.settingsManager.showAccountPickers ?? true {
|
||||
ToolbarItem(placement: viewOptionsPlacement) {
|
||||
DataContextSwitcherMenu()
|
||||
}
|
||||
}
|
||||
// View options button (always visible)
|
||||
ToolbarItem(placement: viewOptionsPlacement) {
|
||||
|
||||
@@ -178,8 +178,10 @@ struct HomeView: View {
|
||||
#endif
|
||||
.toolbar {
|
||||
#if !os(tvOS)
|
||||
ToolbarItem(placement: switcherPlacement) {
|
||||
DataContextSwitcherMenu()
|
||||
if settingsManager?.showAccountPickers ?? true {
|
||||
ToolbarItem(placement: switcherPlacement) {
|
||||
DataContextSwitcherMenu()
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#if !os(tvOS) && !os(macOS)
|
||||
|
||||
@@ -229,8 +229,10 @@ struct PlaylistsListView: View {
|
||||
ToolbarSpacer(.flexible, placement: .primaryAction)
|
||||
}
|
||||
#endif
|
||||
ToolbarItem(placement: viewOptionsPlacement) {
|
||||
DataContextSwitcherMenu()
|
||||
if appEnvironment?.settingsManager.showAccountPickers ?? true {
|
||||
ToolbarItem(placement: viewOptionsPlacement) {
|
||||
DataContextSwitcherMenu()
|
||||
}
|
||||
}
|
||||
ToolbarItem(placement: viewOptionsPlacement) {
|
||||
Button {
|
||||
@@ -425,7 +427,9 @@ struct PlaylistsListView: View {
|
||||
Label(String(localized: "viewOptions.title"), systemImage: "slider.horizontal.3")
|
||||
}
|
||||
|
||||
DataContextSwitcherButton()
|
||||
if appEnvironment?.settingsManager.showAccountPickers ?? true {
|
||||
DataContextSwitcherButton()
|
||||
}
|
||||
}
|
||||
.focusSection()
|
||||
.padding(.horizontal, 48)
|
||||
|
||||
@@ -427,12 +427,14 @@ struct UnifiedTabView: View {
|
||||
VStack(spacing: 0) {
|
||||
sidebarList
|
||||
|
||||
Divider()
|
||||
// The window has no toolbar of its own to hang this off, and the
|
||||
// sidebar is the one chrome every tab shares.
|
||||
DataContextSwitcherSettingsRow()
|
||||
.padding(.horizontal, 12)
|
||||
.padding(.vertical, 8)
|
||||
if settingsManager?.showAccountPickers ?? true {
|
||||
Divider()
|
||||
// The window has no toolbar of its own to hang this off, and the
|
||||
// sidebar is the one chrome every tab shares.
|
||||
DataContextSwitcherSettingsRow()
|
||||
.padding(.horizontal, 12)
|
||||
.padding(.vertical, 8)
|
||||
}
|
||||
}
|
||||
#else
|
||||
sidebarList
|
||||
|
||||
@@ -138,6 +138,8 @@ struct AccountsListView: View {
|
||||
}
|
||||
|
||||
orphanSection
|
||||
|
||||
pickerVisibilitySection
|
||||
}
|
||||
#if os(macOS)
|
||||
.formStyle(.grouped)
|
||||
@@ -221,6 +223,28 @@ struct AccountsListView: View {
|
||||
}
|
||||
}
|
||||
|
||||
/// Whether the switcher is offered outside this screen at all — the
|
||||
/// toolbar menus, the tvOS buttons, the macOS sidebar row. Lives at the
|
||||
/// bottom of this screen because this screen keeps its own switcher either
|
||||
/// way: turning the pickers off must leave a place to turn them back on.
|
||||
@ViewBuilder
|
||||
private var pickerVisibilitySection: some View {
|
||||
if let settings = appEnvironment?.settingsManager {
|
||||
@Bindable var settings = settings
|
||||
|
||||
Section {
|
||||
Toggle(isOn: $settings.showAccountPickers) {
|
||||
Label(
|
||||
String(localized: "accounts.showPickers"),
|
||||
systemImage: "person.crop.circle.badge.checkmark"
|
||||
)
|
||||
}
|
||||
} footer: {
|
||||
Text(String(localized: "accounts.showPickers.footer"))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Rows
|
||||
|
||||
@ViewBuilder
|
||||
|
||||
@@ -492,8 +492,10 @@ struct SubscriptionsView: View {
|
||||
.toolbarTitleDisplayMode(.inlineLarge)
|
||||
#endif
|
||||
.toolbar {
|
||||
ToolbarItem(placement: viewOptionsPlacement) {
|
||||
DataContextSwitcherMenu()
|
||||
if appEnvironment?.settingsManager.showAccountPickers ?? true {
|
||||
ToolbarItem(placement: viewOptionsPlacement) {
|
||||
DataContextSwitcherMenu()
|
||||
}
|
||||
}
|
||||
ToolbarItem(placement: viewOptionsPlacement) {
|
||||
Button {
|
||||
@@ -907,7 +909,9 @@ struct SubscriptionsView: View {
|
||||
}
|
||||
.buttonStyle(.bordered)
|
||||
|
||||
DataContextSwitcherButton()
|
||||
if appEnvironment?.settingsManager.showAccountPickers ?? true {
|
||||
DataContextSwitcherButton()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user