mirror of
https://github.com/yattee/yattee.git
synced 2026-10-23 21:22:53 +00:00
Pages list - Info is pinned first and always enabled in every layout: normalized pages force it to the front and enabled (older presets self-correct), disabling it is a no-op, and any move that would displace it snaps back. The iOS/macOS list renders it outside the reorderable ForEach (no drag handle, nothing drops above it) and the editors hide its enabled toggle; tvOS also hides its move buttons. The "at least one page must stay enabled" guard and its strings are gone since Info always counts. - iPhone never renders queue or comments as pages, so its Sections list hides them (PanelSettings.hiddenSettingsPageTypes). Reordering goes through moveVisiblePages, which keeps hidden entries in their stored slots. Comments get their own group on the Details Panel screen (pill mode + avatars) and the overlay hosts pass the avatars flag. Default visibility - "When Player Opens" is now configured per orientation (portraitDefaultVisibility / landscapeDefaultVisibility). The legacy single value is still decoded and seeds both until set individually; presets that never set it default to portrait Visible, landscape Hidden. macOS shows one picker (no portrait layout). - "Remember Last" no longer leaks across orientations: separate remembered flags, written by the portrait toggles and by the wide and corner layouts respectively, with the old shared flag read once as a fallback. The corner layout seeded from the portrait resolution before; it now uses landscape. Section options (iOS inline-sections hosts) - Chapters and Related editors gain "Expanded by Default" (on by default). The Info editor gains a Description group with "Expanded by Default" (off) and a "Collapsed Lines" stepper (1–10, default 3). Applied when the panel appears and on each video change. - Expanding a collapsed section scrolls its header to the top of the panel: PanelPageScrollView can hand its scroll proxy to page content and each inline section is wrapped in one anchored container. - The portrait panel's bottom fade sized its touch blocker from a stale "expanded comments pill" answer that ignored collapse on scroll, so a collapsed section header (the last item) sat under it and could not be tapped. The predicate now tracks the pill's actual collapse state.
196 lines
6.5 KiB
Swift
196 lines
6.5 KiB
Swift
//
|
|
// SettingsKey.swift
|
|
// Yattee
|
|
//
|
|
// Keys used for storing settings in UserDefaults and iCloud.
|
|
//
|
|
|
|
import Foundation
|
|
|
|
/// Keys for storing settings values.
|
|
/// Used internally by SettingsManager for persistence.
|
|
enum SettingsKey: String, CaseIterable {
|
|
// General
|
|
case theme
|
|
case accentColor
|
|
case customAccentColor
|
|
case accentColorDark
|
|
case customAccentColorDark
|
|
case useSeparateDarkAccentColor
|
|
case showWatchedCheckmark
|
|
|
|
// Accounts
|
|
case showAccountPickers
|
|
|
|
// Playback
|
|
case preferredQuality
|
|
case cellularQuality
|
|
case autoplay
|
|
case backgroundPlayback
|
|
case preferredAudioLanguage
|
|
case preferredSubtitlesLanguage
|
|
case resumeAction
|
|
case tvOSMenuButtonClosesVideo
|
|
case allowSoftwareDecodedFormats
|
|
case audioOnlyMode
|
|
|
|
// SponsorBlock
|
|
case sponsorBlockEnabled
|
|
case sponsorBlockCategories
|
|
case sponsorBlockAPIURL
|
|
|
|
// Return YouTube Dislike
|
|
case returnYouTubeDislikeEnabled
|
|
|
|
// DeArrow
|
|
case deArrowEnabled
|
|
case deArrowReplaceTitles
|
|
case deArrowReplaceThumbnails
|
|
case deArrowAPIURL
|
|
case deArrowThumbnailAPIURL
|
|
|
|
// Short link resolution
|
|
case resolveShortLinksEnabled
|
|
|
|
// Platform-specific
|
|
case macPlayerSeparateWindow
|
|
case macPlayerFloating
|
|
case macControlsBarOffsetX // Normalized X offset of macOS control bar from default position
|
|
case macControlsBarOffsetY // Normalized Y offset of macOS control bar from default position
|
|
case playerSheetAutoResize
|
|
case listStyle
|
|
|
|
// Feed
|
|
case feedCacheValidityMinutes
|
|
|
|
// Player
|
|
case keepPlayerPinned
|
|
case hapticFeedbackEnabled
|
|
case hapticFeedbackIntensity
|
|
case inAppOrientationLock
|
|
case rotateToMatchAspectRatio
|
|
case preferPortraitBrowsing
|
|
|
|
// Home
|
|
case homeShortcutOrder
|
|
case homeShortcutVisibility
|
|
case homeShortcutLayout
|
|
case homeShortcutCardStyle
|
|
case homeShortcutCardColor
|
|
case homeShortcutColorfulPalette
|
|
case homeShortcutCustomPaletteColors
|
|
case homeSectionOrder
|
|
case homeSectionVisibility
|
|
case homeSectionItemsLimit
|
|
case homeSectionLayout
|
|
|
|
// Top Shelf (tvOS)
|
|
case topShelfSections
|
|
|
|
// Tab Bar (compact size class)
|
|
case tabBarItemOrder
|
|
case tabBarItemVisibility
|
|
case tabBarStartupTab
|
|
|
|
// Sidebar
|
|
case sidebarMainItemOrder
|
|
case sidebarMainItemVisibility
|
|
case sidebarStartupTab
|
|
case sidebarSourcesEnabled
|
|
case sidebarSourceSort
|
|
case sidebarSourcesLimitEnabled
|
|
case sidebarMaxSources
|
|
case sidebarChannelsEnabled
|
|
case sidebarMaxChannels
|
|
case sidebarChannelSort
|
|
case sidebarChannelsLimitEnabled
|
|
case sidebarPlaylistsEnabled
|
|
case sidebarMaxPlaylists
|
|
case sidebarPlaylistSort
|
|
case sidebarPlaylistsLimitEnabled
|
|
|
|
// Remote Control
|
|
case remoteControlCustomDeviceName
|
|
case remoteControlHideWhenBackgrounded
|
|
|
|
// Advanced
|
|
case showAdvancedStreamDetails
|
|
case showPlayerAreaDebug
|
|
case showTVDebugButton
|
|
case verboseMPVLogging
|
|
case verboseRemoteControlLogging
|
|
case mpvBufferSeconds
|
|
case mpvUseEDLStreams
|
|
case zoomTransitionsEnabled
|
|
case tvMatchDisplayFrameRate
|
|
case tvMatchDisplayDynamicRange
|
|
case tvAudioDelayMs
|
|
case tvVideoSyncMode
|
|
|
|
// Details panel
|
|
case floatingDetailsPanelWidth // Resizable panel width in wide layout
|
|
case landscapeDetailsPanelVisible
|
|
case landscapeDetailsPanelPinned
|
|
case detailsPanelLastVisible // Legacy shared "remember" value (pre-split); read as fallback only
|
|
case portraitDetailsPanelLastVisible // Last user-set portrait visibility, for the "remember" default
|
|
case landscapeDetailsPanelLastVisible // Last user-set landscape visibility, for the "remember" default
|
|
case cornerPanelColumnWidth // Corner layout - width of the side column
|
|
|
|
// Player Controls
|
|
case activeControlsPresetID
|
|
|
|
// Video Swipe Actions
|
|
case videoSwipeActionOrder
|
|
case videoSwipeActionVisibility
|
|
|
|
// Onboarding
|
|
case onboardingCompleted
|
|
|
|
/// Whether this key should have platform-specific prefixes.
|
|
/// Platform-specific keys are stored under a `iOS.` / `macOS.` / `tvOS.` prefix
|
|
/// in both UserDefaults and iCloud, so each platform family syncs independently.
|
|
var isPlatformSpecific: Bool {
|
|
switch self {
|
|
case .preferredQuality, .cellularQuality, .allowSoftwareDecodedFormats, .audioOnlyMode,
|
|
.macPlayerSeparateWindow, .macPlayerFloating, .listStyle,
|
|
.macControlsBarOffsetX, .macControlsBarOffsetY,
|
|
// Home layout — different UI paradigms per platform
|
|
.homeShortcutOrder, .homeShortcutVisibility, .homeShortcutLayout, .homeShortcutCardStyle,
|
|
.homeShortcutCardColor, .homeShortcutColorfulPalette, .homeShortcutCustomPaletteColors,
|
|
.homeSectionOrder, .homeSectionVisibility, .homeSectionItemsLimit, .homeSectionLayout,
|
|
// Top Shelf — tvOS only
|
|
.topShelfSections,
|
|
// Tab bar (compact size class) layout
|
|
.tabBarItemOrder, .tabBarItemVisibility, .tabBarStartupTab,
|
|
// Sidebar layout/selection
|
|
.sidebarMainItemOrder, .sidebarMainItemVisibility, .sidebarStartupTab,
|
|
.sidebarSourcesEnabled, .sidebarSourceSort, .sidebarSourcesLimitEnabled, .sidebarMaxSources,
|
|
.sidebarChannelsEnabled, .sidebarMaxChannels, .sidebarChannelSort, .sidebarChannelsLimitEnabled,
|
|
.sidebarPlaylistsEnabled, .sidebarMaxPlaylists, .sidebarPlaylistSort, .sidebarPlaylistsLimitEnabled,
|
|
// Player details panel — iOS/iPadOS only, different on other platforms
|
|
.floatingDetailsPanelWidth,
|
|
.landscapeDetailsPanelVisible, .landscapeDetailsPanelPinned,
|
|
.detailsPanelLastVisible, .portraitDetailsPanelLastVisible, .landscapeDetailsPanelLastVisible,
|
|
.cornerPanelColumnWidth,
|
|
// Video swipe actions — touch-gesture feature
|
|
.videoSwipeActionOrder, .videoSwipeActionVisibility:
|
|
return true
|
|
default:
|
|
return false
|
|
}
|
|
}
|
|
|
|
/// Whether this key should only be stored locally (not synced to iCloud).
|
|
/// Used for device-specific settings like custom device name for remote control.
|
|
var isLocalOnly: Bool {
|
|
switch self {
|
|
case .remoteControlCustomDeviceName, .remoteControlHideWhenBackgrounded,
|
|
.activeControlsPresetID, // Per-device preset selection
|
|
.onboardingCompleted: // Per-device onboarding state
|
|
return true
|
|
default:
|
|
return false
|
|
}
|
|
}
|
|
}
|