1
0
mirror of https://github.com/yattee/yattee.git synced 2024-12-14 06:10:32 +05:30
yattee/Shared/Settings/BrowsingSettings.swift

51 lines
1.4 KiB
Swift
Raw Normal View History

2021-11-05 04:55:51 +05:30
import Defaults
import SwiftUI
struct BrowsingSettings: View {
@Default(.channelOnThumbnail) private var channelOnThumbnail
@Default(.timeOnThumbnail) private var timeOnThumbnail
2021-11-08 02:21:22 +05:30
#if os(iOS)
@Default(.tabNavigationSection) private var tabNavigationSection
#endif
2021-11-05 04:55:51 +05:30
var body: some View {
2021-11-08 02:21:22 +05:30
Section(header: SettingsHeader(text: "Browsing"), footer: footer) {
2021-11-05 04:55:51 +05:30
Toggle("Display channel names on thumbnails", isOn: $channelOnThumbnail)
Toggle("Display video length on thumbnails", isOn: $timeOnThumbnail)
2021-11-08 02:21:22 +05:30
#if os(iOS)
preferredTabPicker
#endif
2021-11-05 04:55:51 +05:30
}
.frame(minWidth: 0, maxWidth: .infinity, alignment: .leading)
#if os(macOS)
Spacer()
#endif
}
2021-11-08 02:21:22 +05:30
var footer: some View {
#if os(iOS)
Text("This tab will be displayed when there is no space to display all tabs")
#else
EmptyView()
#endif
}
#if os(iOS)
var preferredTabPicker: some View {
Picker("Preferred tab", selection: $tabNavigationSection) {
Text("Trending").tag(TabNavigationSectionSetting.trending)
Text("Popular").tag(TabNavigationSectionSetting.popular)
}
}
#endif
2021-11-05 04:55:51 +05:30
}
struct BrowsingSettings_Previews: PreviewProvider {
static var previews: some View {
BrowsingSettings()
.injectFixtureEnvironmentObjects()
}
}