yattee/Shared/Settings/PlaybackSettings.swift

66 lines
1.7 KiB
Swift
Raw Normal View History

2021-09-25 08:18:22 +00:00
import Defaults
import SwiftUI
2021-10-23 11:51:02 +00:00
struct PlaybackSettings: View {
2021-09-25 08:18:22 +00:00
@Default(.quality) private var quality
2021-11-03 23:00:17 +00:00
@Default(.playerSidebar) private var playerSidebar
#if os(iOS)
private var idiom: UIUserInterfaceIdiom {
UIDevice.current.userInterfaceIdiom
}
#endif
2021-09-25 08:18:22 +00:00
var body: some View {
Section(header: Text("Quality")) {
Picker("Quality", selection: $quality) {
ForEach(Stream.ResolutionSetting.allCases, id: \.self) { resolution in
Text(resolution.description).tag(resolution)
}
}
.labelsHidden()
#if os(iOS)
.pickerStyle(.automatic)
#elseif os(tvOS)
.pickerStyle(.inline)
2021-09-25 08:18:22 +00:00
#endif
2021-11-03 23:00:17 +00:00
}
#if os(iOS)
if idiom == .pad {
playerSidebarSection
}
#elseif os(macOS)
playerSidebarSection
#endif
#if os(macOS)
Spacer()
#endif
}
private var playerSidebarSection: some View {
Section(header: Text("Player Sidebar")) {
Picker("Player Sidebar", selection: $playerSidebar) {
#if os(macOS)
Text("Show").tag(PlayerSidebarSetting.always)
#endif
2021-09-25 08:18:22 +00:00
2021-11-03 23:00:17 +00:00
#if os(iOS)
Text("Show when space permits").tag(PlayerSidebarSetting.whenFits)
#endif
Text("Hide").tag(PlayerSidebarSetting.never)
}
.labelsHidden()
#if os(iOS)
.pickerStyle(.automatic)
#elseif os(tvOS)
.pickerStyle(.inline)
2021-09-25 08:18:22 +00:00
#endif
}
}
}