mirror of
https://github.com/yattee/yattee.git
synced 2026-06-04 13:54:19 +00:00
Surfaces Continue Watching, Recent Feed, and Recent Bookmarks in the
Apple TV Home top shelf when Yattee is focused. Tapping a tile opens
the video via the existing yattee://video/{id} deep link.
- New YatteeTopShelf app extension target (tvOS only). LD_ENTRY_POINT is
overridden to _NSExtensionMain; the tv-app-extension product type
defaults to _TVExtensionMain which is for the pre-tvOS-13 legacy API
and crashes modern TVTopShelfContentProvider subclasses at launch.
- Main app writes per-section JSON snapshots (capped at 10 items each)
to a shared App Group UserDefaults suite after bookmark, watch-history,
and feed-cache changes, plus an initial write on launch.
- Enabled-sections list is mirrored to the same App Group so the
extension can respect the user's selection without touching SwiftData.
- Settings → Top Shelf (tvOS only) lets the user toggle sections.
- Deep link playback shows a loading toast while video details are
fetched, and an error toast if no source is configured.
165 lines
5.0 KiB
Swift
165 lines
5.0 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 showWatchedCheckmark
|
|
|
|
// Playback
|
|
case preferredQuality
|
|
case cellularQuality
|
|
case autoplay
|
|
case backgroundPlayback
|
|
case dashEnabled
|
|
case preferredAudioLanguage
|
|
case preferredSubtitlesLanguage
|
|
case resumeAction
|
|
|
|
// SponsorBlock
|
|
case sponsorBlockEnabled
|
|
case sponsorBlockCategories
|
|
case sponsorBlockAPIURL
|
|
|
|
// Return YouTube Dislike
|
|
case returnYouTubeDislikeEnabled
|
|
|
|
// DeArrow
|
|
case deArrowEnabled
|
|
case deArrowReplaceTitles
|
|
case deArrowReplaceThumbnails
|
|
case deArrowAPIURL
|
|
case deArrowThumbnailAPIURL
|
|
|
|
// Platform-specific
|
|
case macPlayerMode
|
|
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 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
|
|
|
|
// Details panel
|
|
case floatingDetailsPanelSide // Landscape only - which side the panel appears on
|
|
case floatingDetailsPanelWidth // Resizable panel width in wide layout
|
|
case landscapeDetailsPanelVisible
|
|
case landscapeDetailsPanelPinned
|
|
|
|
// 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, .macPlayerMode, .listStyle,
|
|
// Home layout — different UI paradigms per platform
|
|
.homeShortcutOrder, .homeShortcutVisibility, .homeShortcutLayout,
|
|
.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
|
|
.floatingDetailsPanelSide, .floatingDetailsPanelWidth,
|
|
.landscapeDetailsPanelVisible, .landscapeDetailsPanelPinned,
|
|
// 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
|
|
}
|
|
}
|
|
}
|