2021-09-25 13:48:22 +05:30
|
|
|
import Defaults
|
|
|
|
import Foundation
|
|
|
|
import SwiftUI
|
|
|
|
|
|
|
|
struct SettingsView: View {
|
2021-09-29 19:59:17 +05:30
|
|
|
#if os(macOS)
|
|
|
|
private enum Tabs: Hashable {
|
|
|
|
case playback, instances
|
|
|
|
}
|
|
|
|
#endif
|
2021-09-25 13:48:22 +05:30
|
|
|
|
2021-09-29 19:59:17 +05:30
|
|
|
#if os(iOS)
|
|
|
|
@Environment(\.dismiss) private var dismiss
|
|
|
|
#endif
|
2021-09-25 13:48:22 +05:30
|
|
|
|
|
|
|
var body: some View {
|
|
|
|
#if os(macOS)
|
|
|
|
TabView {
|
|
|
|
Form {
|
|
|
|
InstancesSettingsView()
|
|
|
|
}
|
|
|
|
.tabItem {
|
|
|
|
Label("Instances", systemImage: "server.rack")
|
|
|
|
}
|
|
|
|
.tag(Tabs.instances)
|
|
|
|
|
|
|
|
Form {
|
|
|
|
PlaybackSettingsView()
|
|
|
|
}
|
|
|
|
.tabItem {
|
|
|
|
Label("Playback", systemImage: "play.rectangle.on.rectangle.fill")
|
|
|
|
}
|
|
|
|
.tag(Tabs.playback)
|
|
|
|
}
|
|
|
|
.padding(20)
|
2021-09-27 03:33:33 +05:30
|
|
|
.frame(width: 400, height: 310)
|
2021-09-25 13:48:22 +05:30
|
|
|
#else
|
|
|
|
NavigationView {
|
|
|
|
List {
|
2021-09-28 23:36:05 +05:30
|
|
|
#if os(tvOS)
|
|
|
|
AccountSelectionView()
|
|
|
|
#endif
|
2021-09-25 13:48:22 +05:30
|
|
|
InstancesSettingsView()
|
|
|
|
PlaybackSettingsView()
|
|
|
|
}
|
|
|
|
.navigationTitle("Settings")
|
2021-09-27 03:33:33 +05:30
|
|
|
.toolbar {
|
|
|
|
ToolbarItem(placement: .navigationBarTrailing) {
|
|
|
|
#if !os(tvOS)
|
2021-09-28 23:36:05 +05:30
|
|
|
Button("Done") {
|
|
|
|
dismiss()
|
|
|
|
}
|
2021-09-27 03:33:33 +05:30
|
|
|
.keyboardShortcut(.cancelAction)
|
|
|
|
#endif
|
2021-09-25 13:48:22 +05:30
|
|
|
}
|
2021-09-27 03:33:33 +05:30
|
|
|
}
|
2021-09-28 23:36:05 +05:30
|
|
|
.frame(maxWidth: 1000)
|
2021-09-27 03:33:33 +05:30
|
|
|
#if os(iOS)
|
|
|
|
.listStyle(.insetGrouped)
|
|
|
|
#endif
|
2021-09-25 13:48:22 +05:30
|
|
|
}
|
2021-09-28 23:36:05 +05:30
|
|
|
#if os(tvOS)
|
|
|
|
.background(.thickMaterial)
|
|
|
|
#endif
|
2021-09-25 13:48:22 +05:30
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
struct SettingsView_Previews: PreviewProvider {
|
|
|
|
static var previews: some View {
|
|
|
|
SettingsView()
|
2021-09-29 17:15:00 +05:30
|
|
|
.injectFixtureEnvironmentObjects()
|
2021-09-25 13:48:22 +05:30
|
|
|
#if os(macOS)
|
|
|
|
.frame(width: 600, height: 300)
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|