Initial commit
This commit is contained in:
73
mlbTVOS/Views/SettingsView.swift
Normal file
73
mlbTVOS/Views/SettingsView.swift
Normal file
@@ -0,0 +1,73 @@
|
||||
import SwiftUI
|
||||
|
||||
struct SettingsView: View {
|
||||
@Environment(GamesViewModel.self) private var viewModel
|
||||
|
||||
private let resolutions = [
|
||||
("best", "Best Quality"),
|
||||
("1080p60", "1080p 60fps"),
|
||||
("720p60", "720p 60fps"),
|
||||
("540p", "540p"),
|
||||
("adaptive", "Adaptive"),
|
||||
]
|
||||
|
||||
var body: some View {
|
||||
@Bindable var vm = viewModel
|
||||
|
||||
NavigationStack {
|
||||
Form {
|
||||
Section("Server") {
|
||||
LabeledContent("URL", value: viewModel.serverBaseURL)
|
||||
}
|
||||
|
||||
Section("Default Quality") {
|
||||
ForEach(resolutions, id: \.0) { res in
|
||||
Button {
|
||||
vm.defaultResolution = res.0
|
||||
} label: {
|
||||
HStack {
|
||||
Text(res.1)
|
||||
Spacer()
|
||||
if viewModel.defaultResolution == res.0 {
|
||||
Image(systemName: "checkmark")
|
||||
.foregroundStyle(.blue)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Section("Active Streams (\(viewModel.activeStreams.count)/4)") {
|
||||
if viewModel.activeStreams.isEmpty {
|
||||
Text("No active streams")
|
||||
.foregroundStyle(.secondary)
|
||||
} else {
|
||||
ForEach(viewModel.activeStreams) { stream in
|
||||
HStack {
|
||||
Text(stream.label)
|
||||
.fontWeight(.bold)
|
||||
Text(stream.game.displayTitle)
|
||||
.foregroundStyle(.secondary)
|
||||
Spacer()
|
||||
Button(role: .destructive) {
|
||||
viewModel.removeStream(id: stream.id)
|
||||
} label: {
|
||||
Image(systemName: "trash")
|
||||
}
|
||||
}
|
||||
}
|
||||
Button("Clear All Streams", role: .destructive) {
|
||||
viewModel.clearAllStreams()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Section("About") {
|
||||
LabeledContent("Version", value: "1.0")
|
||||
LabeledContent("Server", value: "mlbserver")
|
||||
}
|
||||
}
|
||||
.navigationTitle("Settings")
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user