tv-anarchy/Sources/TVAnarchy/StreamPolicySection.swift
Natalie 4a2ceb9781 feat(offline): inline star-to-keep and trash-to-cull on cache rows
Surface the existing pin (keep-from-cull) and per-file delete actions as
visible inline buttons on each offline cache row instead of context-menu-only:
a star toggles protection from auto-cull (and restore-if-missing), a trash
culls that file early. Aligns wording/icons to the star metaphor.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-30 00:12:41 -04:00

24 lines
No EOL
1.2 KiB
Swift

import SwiftUI
import TVAnarchyCore
/// Stream buffer controls for a device with the stream service enabled.
struct StreamPolicySection: View {
@Binding var policy: StreamPolicy
/// When set, caps the buffer slider at half this episode length.
var episodeDuration: Double?
private var maxBuffer: Int { policy.sliderMax(episodeDuration: episodeDuration) }
private var effective: Int { policy.effectiveBufferSeconds(episodeDuration: episodeDuration) }
var body: some View {
VStack(alignment: .leading, spacing: 8) {
Text("Stream buffer").font(.headline)
Stepper("Buffer: \(policy.bufferSeconds)s (effective \(effective)s)",
value: $policy.bufferSeconds, in: 15...maxBuffer, step: 15)
.fixedSize()
.help("Seconds of playback to hold ahead when streaming from the storage server")
Text("Required buffer is capped at half the episode length (\(maxBuffer)s max right now). Higher values absorb jitter on slow links but delay start-of-play.")
.font(.caption).foregroundStyle(.secondary).fixedSize(horizontal: false, vertical: true)
}
}
}