mirror of
https://github.com/yattee/yattee.git
synced 2024-12-22 21:43:41 +00:00
Add settings to tvOS tab menu (fix #119)
This commit is contained in:
parent
d330771fef
commit
d670a76635
@ -13,6 +13,9 @@ final class NavigationModel: ObservableObject {
|
|||||||
case recentlyOpened(String)
|
case recentlyOpened(String)
|
||||||
case nowPlaying
|
case nowPlaying
|
||||||
case search
|
case search
|
||||||
|
#if os(tvOS)
|
||||||
|
case settings
|
||||||
|
#endif
|
||||||
|
|
||||||
var stringValue: String {
|
var stringValue: String {
|
||||||
switch self {
|
switch self {
|
||||||
@ -34,6 +37,10 @@ final class NavigationModel: ObservableObject {
|
|||||||
return "recentlyOpened"
|
return "recentlyOpened"
|
||||||
case .search:
|
case .search:
|
||||||
return "search"
|
return "search"
|
||||||
|
#if os(tvOS)
|
||||||
|
case .settings: // swiftlint:disable:this switch_case_alignment
|
||||||
|
return "settings"
|
||||||
|
#endif
|
||||||
default:
|
default:
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
@ -78,8 +78,24 @@ struct SettingsView: View {
|
|||||||
}
|
}
|
||||||
.padding(20)
|
.padding(20)
|
||||||
.frame(width: 480, height: windowHeight)
|
.frame(width: 480, height: windowHeight)
|
||||||
|
#else
|
||||||
|
Group {
|
||||||
|
#if os(tvOS)
|
||||||
|
settingsList
|
||||||
#else
|
#else
|
||||||
NavigationView {
|
NavigationView {
|
||||||
|
settingsList
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
.sheet(isPresented: $presentingInstanceForm) {
|
||||||
|
InstanceForm(savedInstanceID: $savedFormInstanceID)
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
#if !os(macOS)
|
||||||
|
var settingsList: some View {
|
||||||
List {
|
List {
|
||||||
#if os(tvOS)
|
#if os(tvOS)
|
||||||
AccountSelectionView()
|
AccountSelectionView()
|
||||||
@ -154,14 +170,7 @@ struct SettingsView: View {
|
|||||||
.listStyle(.insetGrouped)
|
.listStyle(.insetGrouped)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
.sheet(isPresented: $presentingInstanceForm) {
|
|
||||||
InstanceForm(savedInstanceID: $savedFormInstanceID)
|
|
||||||
}
|
|
||||||
#if os(tvOS)
|
|
||||||
.background(Color.background(scheme: colorScheme))
|
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
#if os(macOS)
|
#if os(macOS)
|
||||||
private var windowHeight: Double {
|
private var windowHeight: Double {
|
||||||
|
@ -10,6 +10,7 @@ struct TVNavigationView: View {
|
|||||||
@Default(.visibleSections) private var visibleSections
|
@Default(.visibleSections) private var visibleSections
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
|
NavigationView {
|
||||||
TabView(selection: navigation.tabSelectionBinding) {
|
TabView(selection: navigation.tabSelectionBinding) {
|
||||||
if visibleSections.contains(.favorites) {
|
if visibleSections.contains(.favorites) {
|
||||||
FavoritesView()
|
FavoritesView()
|
||||||
@ -48,6 +49,12 @@ struct TVNavigationView: View {
|
|||||||
SearchView()
|
SearchView()
|
||||||
.tabItem { Image(systemName: "magnifyingglass") }
|
.tabItem { Image(systemName: "magnifyingglass") }
|
||||||
.tag(TabSelection.search)
|
.tag(TabSelection.search)
|
||||||
|
|
||||||
|
SettingsView()
|
||||||
|
.navigationBarHidden(true)
|
||||||
|
.tabItem { Image(systemName: "gear") }
|
||||||
|
.tag(TabSelection.settings)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
.fullScreenCover(isPresented: $navigation.presentingSettings) { SettingsView() }
|
.fullScreenCover(isPresented: $navigation.presentingSettings) { SettingsView() }
|
||||||
.fullScreenCover(isPresented: $navigation.presentingAddToPlaylist) {
|
.fullScreenCover(isPresented: $navigation.presentingAddToPlaylist) {
|
||||||
@ -68,7 +75,6 @@ struct TVNavigationView: View {
|
|||||||
ChannelPlaylistView(playlist: playlist)
|
ChannelPlaylistView(playlist: playlist)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.onPlayPauseCommand { navigation.presentingSettings.toggle() }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user