mirror of
https://github.com/yattee/yattee.git
synced 2026-05-12 18:35:05 +00:00
Add List/Grid layout option for Home sections
Introduces a "Display sections as" picker in Home settings with List and Grid modes. Grid renders each section as a horizontal shelf of video cards, defaulting to Grid on tvOS and List on iOS/macOS. Per-platform defaults are preserved via a platform-specific settings key. On tvOS the shelf is a focus section so swiping up/down between rows of different lengths works without getting stuck at the end of a row.
This commit is contained in:
@@ -63,6 +63,7 @@ enum SettingsKey: String, CaseIterable {
|
||||
case homeSectionOrder
|
||||
case homeSectionVisibility
|
||||
case homeSectionItemsLimit
|
||||
case homeSectionLayout
|
||||
|
||||
// Tab Bar (compact size class)
|
||||
case tabBarItemOrder
|
||||
@@ -124,7 +125,7 @@ enum SettingsKey: String, CaseIterable {
|
||||
case .preferredQuality, .cellularQuality, .macPlayerMode, .listStyle,
|
||||
// Home layout — different UI paradigms per platform
|
||||
.homeShortcutOrder, .homeShortcutVisibility, .homeShortcutLayout,
|
||||
.homeSectionOrder, .homeSectionVisibility, .homeSectionItemsLimit,
|
||||
.homeSectionOrder, .homeSectionVisibility, .homeSectionItemsLimit, .homeSectionLayout,
|
||||
// Tab bar (compact size class) layout
|
||||
.tabBarItemOrder, .tabBarItemVisibility, .tabBarStartupTab,
|
||||
// Sidebar layout/selection
|
||||
|
||||
@@ -95,6 +95,21 @@ extension SettingsManager {
|
||||
}
|
||||
}
|
||||
|
||||
/// Layout mode for home sections (list or grid). Default is list on iOS/macOS, grid on tvOS.
|
||||
var homeSectionLayout: HomeSectionLayout {
|
||||
get {
|
||||
if let cached = _homeSectionLayout { return cached }
|
||||
guard let rawValue = string(for: .homeSectionLayout) else {
|
||||
return HomeSectionLayout.platformDefault
|
||||
}
|
||||
return HomeSectionLayout(rawValue: rawValue) ?? HomeSectionLayout.platformDefault
|
||||
}
|
||||
set {
|
||||
_homeSectionLayout = newValue
|
||||
set(newValue.rawValue, for: .homeSectionLayout)
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Home Section Settings
|
||||
|
||||
/// Ordered list of home sections. Default order is bookmarks, history, downloads.
|
||||
|
||||
@@ -107,6 +107,7 @@ final class SettingsManager {
|
||||
var _homeSectionOrder: [HomeSectionItem]?
|
||||
var _homeSectionVisibility: [HomeSectionItem: Bool]?
|
||||
var _homeSectionItemsLimit: Int?
|
||||
var _homeSectionLayout: HomeSectionLayout?
|
||||
|
||||
// Tab bar settings (compact size class only - iOS)
|
||||
var _tabBarItemOrder: [TabBarItem]?
|
||||
@@ -446,6 +447,7 @@ final class SettingsManager {
|
||||
_homeSectionOrder = nil
|
||||
_homeSectionVisibility = nil
|
||||
_homeSectionItemsLimit = nil
|
||||
_homeSectionLayout = nil
|
||||
_tabBarItemOrder = nil
|
||||
_tabBarItemVisibility = nil
|
||||
_sidebarMainItemOrder = nil
|
||||
|
||||
Reference in New Issue
Block a user