Refactor views

This commit is contained in:
Arkadiusz Fal
2026-02-09 01:13:02 +01:00
parent 8464464199
commit 612dce6b9f
43 changed files with 143 additions and 125 deletions

View File

@@ -41,13 +41,14 @@ enum VideoContextMenuContext {
/// View modifier that attaches VideoContextMenu and its required sheets.
struct VideoContextMenuModifier: ViewModifier {
@Environment(\.appEnvironment) private var appEnvironment
let video: Video
var customActions: [VideoContextAction] = []
var context: VideoContextMenuContext = .default
var startTime: Double? = nil
var watchProgress: Double? = nil
@Environment(\.appEnvironment) private var appEnvironment
@State private var showingPlaylistSheet = false
@State private var showingDownloadSheet = false
@State private var showingDeleteDownloadConfirmation = false
@@ -128,6 +129,8 @@ struct VideoContextMenuModifier: ViewModifier {
/// The actual menu content (uses bindings from parent for sheet presentation).
/// All observable values are snapshotted at init time to prevent redraws during playback.
struct VideoContextMenuContent: View {
@Environment(\.appEnvironment) private var appEnvironment
let video: Video
var customActions: [VideoContextAction] = []
var context: VideoContextMenuContext = .default
@@ -137,8 +140,6 @@ struct VideoContextMenuContent: View {
@Binding var showingDeleteDownloadConfirmation: Bool
@Binding var downloadToDelete: Download?
@Environment(\.appEnvironment) private var appEnvironment
// MARK: - Snapshotted Values (captured at init to prevent observation)
/// Snapshotted remote control enabled state.
@@ -592,13 +593,14 @@ extension View {
/// A dropdown menu view for videos, showing context menu actions.
/// Used in player views where the video is already playing.
struct VideoContextMenuView: View {
@Environment(\.appEnvironment) private var appEnvironment
let video: Video
let accentColor: Color
var buttonSize: CGFloat = 32
var buttonBackgroundStyle: ButtonBackgroundStyle = .none
var theme: ControlsTheme = .dark
@Environment(\.appEnvironment) private var appEnvironment
@State private var showingPlaylistSheet = false
@State private var showingDownloadSheet = false
@State private var showingDeleteDownloadConfirmation = false