mirror of
https://github.com/yattee/yattee.git
synced 2026-11-01 01:17:20 +00:00
Configure details panel sections on iPhone and honor their order
iPhone has no page switcher: the portrait panel already rendered one info page with chapters and related videos as collapsible inline sections. The landscape floating panel now renders the same panel (no page bar, comments stay on the pill/overlay), and the settings screen calls the list "Sections" there, with the page bar labels toggle hidden. The inline sections were hardcoded to chapters then related and ignored the configured order, enablement, and thumbnail toggles. The info page now receives the enabled section pages from PanelSettings.inlineSections(in:) and renders them in list order with their own settings.
This commit is contained in:
@@ -411,6 +411,26 @@ struct PanelSettings: Codable, Hashable, Sendable {
|
||||
return result
|
||||
}
|
||||
|
||||
/// Page types the info page can render as collapsible inline sections
|
||||
/// below the description (iPhone, and the stacked iPad portrait panel).
|
||||
static let inlineSectionTypes: Set<PanelPageType> = [.chapters, .related]
|
||||
|
||||
/// iPhone has no page switcher: every host renders one info page with
|
||||
/// inline sections, so settings talk about "sections" rather than "pages".
|
||||
static var isSectionsOnlyDevice: Bool {
|
||||
#if os(iOS)
|
||||
return UIDevice.current.userInterfaceIdiom == .phone
|
||||
#else
|
||||
return false
|
||||
#endif
|
||||
}
|
||||
|
||||
/// Enabled pages an inline-sections host renders below the video info,
|
||||
/// in configured order, with their per-page element settings.
|
||||
func inlineSections(in region: PanelRegion? = nil) -> [PanelPageConfiguration] {
|
||||
enabledPages(in: region).filter { Self.inlineSectionTypes.contains($0.pageType) }
|
||||
}
|
||||
|
||||
/// Whether a page type is enabled in this configuration.
|
||||
func isPageEnabled(_ pageType: PanelPageType) -> Bool {
|
||||
enabledPages().contains { $0.pageType == pageType }
|
||||
|
||||
Reference in New Issue
Block a user