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