mirror of
https://github.com/yattee/yattee.git
synced 2024-12-22 21:43:41 +00:00
parent
ae144ea82f
commit
59f48c739a
@ -185,6 +185,7 @@ extension Defaults.Keys {
|
|||||||
static let trendingCountry = Key<Country>("trendingCountry", default: .us)
|
static let trendingCountry = Key<Country>("trendingCountry", default: .us)
|
||||||
|
|
||||||
static let visibleSections = Key<Set<VisibleSection>>("visibleSections", default: [.subscriptions, .trending, .playlists])
|
static let visibleSections = Key<Set<VisibleSection>>("visibleSections", default: [.subscriptions, .trending, .playlists])
|
||||||
|
static let startupSection = Key<StartupSection>("startupSection", default: .home)
|
||||||
|
|
||||||
#if os(iOS)
|
#if os(iOS)
|
||||||
static let honorSystemOrientationLock = Key<Bool>("honorSystemOrientationLock", default: true)
|
static let honorSystemOrientationLock = Key<Bool>("honorSystemOrientationLock", default: true)
|
||||||
@ -340,6 +341,31 @@ enum VisibleSection: String, CaseIterable, Comparable, Defaults.Serializable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
enum StartupSection: String, CaseIterable, Defaults.Serializable {
|
||||||
|
case home, subscriptions, popular, trending, playlists, search
|
||||||
|
|
||||||
|
var label: String {
|
||||||
|
rawValue.capitalized.localized()
|
||||||
|
}
|
||||||
|
|
||||||
|
var tabSelection: TabSelection {
|
||||||
|
switch self {
|
||||||
|
case .home:
|
||||||
|
return .home
|
||||||
|
case .subscriptions:
|
||||||
|
return .subscriptions
|
||||||
|
case .popular:
|
||||||
|
return .popular
|
||||||
|
case .trending:
|
||||||
|
return .trending
|
||||||
|
case .playlists:
|
||||||
|
return .playlists
|
||||||
|
case .search:
|
||||||
|
return .search
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
enum WatchedVideoStyle: String, Defaults.Serializable {
|
enum WatchedVideoStyle: String, Defaults.Serializable {
|
||||||
case nothing, badge, decreasedOpacity, both
|
case nothing, badge, decreasedOpacity, both
|
||||||
|
|
||||||
|
@ -17,6 +17,7 @@ struct BrowsingSettings: View {
|
|||||||
@Default(.timeOnThumbnail) private var timeOnThumbnail
|
@Default(.timeOnThumbnail) private var timeOnThumbnail
|
||||||
@Default(.showOpenActionsToolbarItem) private var showOpenActionsToolbarItem
|
@Default(.showOpenActionsToolbarItem) private var showOpenActionsToolbarItem
|
||||||
@Default(.visibleSections) private var visibleSections
|
@Default(.visibleSections) private var visibleSections
|
||||||
|
@Default(.startupSection) private var startupSection
|
||||||
@Default(.playerButtonSingleTapGesture) private var playerButtonSingleTapGesture
|
@Default(.playerButtonSingleTapGesture) private var playerButtonSingleTapGesture
|
||||||
@Default(.playerButtonDoubleTapGesture) private var playerButtonDoubleTapGesture
|
@Default(.playerButtonDoubleTapGesture) private var playerButtonDoubleTapGesture
|
||||||
@Default(.playerButtonShowsControlButtonsWhenMinimized) private var playerButtonShowsControlButtonsWhenMinimized
|
@Default(.playerButtonShowsControlButtonsWhenMinimized) private var playerButtonShowsControlButtonsWhenMinimized
|
||||||
@ -50,7 +51,7 @@ struct BrowsingSettings: View {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#if os(tvOS)
|
#if os(tvOS)
|
||||||
.frame(maxWidth: 1000)
|
.frame(maxWidth: 1200)
|
||||||
#else
|
#else
|
||||||
.frame(minWidth: 0, maxWidth: .infinity, alignment: .leading)
|
.frame(minWidth: 0, maxWidth: .infinity, alignment: .leading)
|
||||||
#endif
|
#endif
|
||||||
@ -60,25 +61,28 @@ struct BrowsingSettings: View {
|
|||||||
private var sections: some View {
|
private var sections: some View {
|
||||||
Group {
|
Group {
|
||||||
homeSettings
|
homeSettings
|
||||||
|
if !accounts.isEmpty {
|
||||||
|
startupSectionPicker
|
||||||
|
visibleSectionsSettings
|
||||||
|
}
|
||||||
let interface = interfaceSettings
|
let interface = interfaceSettings
|
||||||
#if os(tvOS)
|
#if os(tvOS)
|
||||||
if !accounts.isEmpty {
|
if !accounts.isEmpty {
|
||||||
interface
|
interface
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
playerBarSettings
|
|
||||||
interface
|
interface
|
||||||
|
playerBarSettings
|
||||||
#endif
|
#endif
|
||||||
if !accounts.isEmpty {
|
if !accounts.isEmpty {
|
||||||
thumbnailsSettings
|
thumbnailsSettings
|
||||||
visibleSectionsSettings
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ViewBuilder private var homeSettings: some View {
|
@ViewBuilder private var homeSettings: some View {
|
||||||
if !accounts.isEmpty {
|
if !accounts.isEmpty {
|
||||||
Section(header: SettingsHeader(text: "Home".localized())) {
|
Section {
|
||||||
#if os(macOS)
|
#if os(macOS)
|
||||||
Button {
|
Button {
|
||||||
presentingHomeSettingsSheet = true
|
presentingHomeSettingsSheet = true
|
||||||
@ -204,37 +208,28 @@ struct BrowsingSettings: View {
|
|||||||
|
|
||||||
private var visibleSectionsSettings: some View {
|
private var visibleSectionsSettings: some View {
|
||||||
Section(header: SettingsHeader(text: "Sections".localized())) {
|
Section(header: SettingsHeader(text: "Sections".localized())) {
|
||||||
#if os(macOS)
|
ForEach(VisibleSection.allCases, id: \.self) { section in
|
||||||
let list = ForEach(VisibleSection.allCases, id: \.self) { section in
|
MultiselectRow(
|
||||||
MultiselectRow(
|
title: section.title,
|
||||||
title: section.title,
|
selected: visibleSections.contains(section)
|
||||||
selected: visibleSections.contains(section)
|
) { value in
|
||||||
) { value in
|
toggleSection(section, value: value)
|
||||||
toggleSection(section, value: value)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Group {
|
private var startupSectionPicker: some View {
|
||||||
if #available(macOS 12.0, *) {
|
Group {
|
||||||
list
|
#if os(tvOS)
|
||||||
.listStyle(.inset(alternatesRowBackgrounds: true))
|
SettingsHeader(text: "Startup section".localized())
|
||||||
} else {
|
|
||||||
list
|
|
||||||
.listStyle(.inset)
|
|
||||||
}
|
|
||||||
|
|
||||||
Spacer()
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
ForEach(VisibleSection.allCases, id: \.self) { section in
|
|
||||||
MultiselectRow(
|
|
||||||
title: section.title,
|
|
||||||
selected: visibleSections.contains(section)
|
|
||||||
) { value in
|
|
||||||
toggleSection(section, value: value)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
Picker("Startup section", selection: $startupSection) {
|
||||||
|
ForEach(StartupSection.allCases, id: \.rawValue) { section in
|
||||||
|
Text(section.label).tag(section)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.modifier(SettingsPickerModifier())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -243,7 +243,7 @@ struct SettingsView: View {
|
|||||||
private var windowHeight: Double {
|
private var windowHeight: Double {
|
||||||
switch selection {
|
switch selection {
|
||||||
case .browsing:
|
case .browsing:
|
||||||
return 880
|
return 720
|
||||||
case .player:
|
case .player:
|
||||||
return 480
|
return 480
|
||||||
case .controls:
|
case .controls:
|
||||||
|
@ -152,7 +152,8 @@ struct YatteeApp: App {
|
|||||||
recents.clear()
|
recents.clear()
|
||||||
}
|
}
|
||||||
|
|
||||||
var section = Defaults[.showHome] ? TabSelection.home : Defaults[.visibleSections].min()?.tabSelection
|
let startupSection = Defaults[.startupSection]
|
||||||
|
var section: TabSelection? = startupSection.tabSelection
|
||||||
|
|
||||||
#if os(macOS)
|
#if os(macOS)
|
||||||
if section == .playlists {
|
if section == .playlists {
|
||||||
|
Loading…
Reference in New Issue
Block a user