jellyflood/Swiftfin tvOS/Views/SettingsView/VideoPlayerSettingsView.swift
Joe e4fd98c244
[tvOS] Settings Cleanup (#1163)
* Settings Cleanup. Replace strings with labels. Enforce the same font. Ensure Forms don't get clipped by their boundries. Create consistent, reusable button sizing/coloring. Apply to all Settings Pages.

* Remove custom Button/Form styling in exchange for just using .scrollClipDisabled()

* Swap back to Jellyfin Purple from Purple.

* Remove Check Button. Check all Section Inits where possible. Make Server Details Server non-focusable.

Create a new menu for Server Details selection. This is a WIP awaiting feedback from https://github.com/jellyfin/Swiftfin/pull/1163#discussion_r1705957885

---------

Co-authored-by: Joseph Kribs <joseph@kribs.net>
2024-08-06 20:56:24 -06:00

95 lines
3.0 KiB
Swift

//
// Swiftfin is subject to the terms of the Mozilla Public
// License, v2.0. If a copy of the MPL was not distributed with this
// file, you can obtain one at https://mozilla.org/MPL/2.0/.
//
// Copyright (c) 2024 Jellyfin & Jellyfin Contributors
//
import Defaults
import SwiftUI
struct VideoPlayerSettingsView: View {
@Default(.VideoPlayer.Subtitle.subtitleFontName)
private var subtitleFontName
@Default(.VideoPlayer.jumpBackwardLength)
private var jumpBackwardLength
@Default(.VideoPlayer.jumpForwardLength)
private var jumpForwardLength
@Default(.VideoPlayer.resumeOffset)
private var resumeOffset
@Default(.VideoPlayer.Transition.pauseOnBackground)
private var pauseOnBackground
@Default(.VideoPlayer.Transition.playOnActive)
private var playOnActive
@EnvironmentObject
private var router: VideoPlayerSettingsCoordinator.Router
@State
private var isPresentingResumeOffsetStepper: Bool = false
var body: some View {
SplitFormWindowView()
.descriptionView {
Image(systemName: "tv")
.resizable()
.aspectRatio(contentMode: .fit)
.frame(maxWidth: 400)
}
.contentView {
Section {
ChevronButton(
L10n.offset,
subtitle: resumeOffset.secondLabel
)
.onSelect {
isPresentingResumeOffsetStepper = true
}
} header: {
L10n.resume.text
} footer: {
L10n.resumeOffsetDescription.text
}
Section {
ChevronButton(L10n.subtitleFont, subtitle: subtitleFontName)
.onSelect {
router.route(to: \.fontPicker, $subtitleFontName)
}
} header: {
L10n.subtitles.text
} footer: {
L10n.subtitlesDisclaimer.text
}
Section(L10n.playback) {
Toggle(L10n.pauseOnBackground, isOn: $pauseOnBackground)
Toggle(L10n.playOnActive, isOn: $playOnActive)
}
.navigationTitle(L10n.videoPlayer.text)
.blurFullScreenCover(isPresented: $isPresentingResumeOffsetStepper) {
StepperView(
title: L10n.resumeOffsetTitle,
description: L10n.resumeOffsetDescription,
value: $resumeOffset,
range: 0 ... 30,
step: 1
)
.valueFormatter {
$0.secondLabel
}
.onCloseSelected {
isPresentingResumeOffsetStepper = false
}
}
}
}
}