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:
Arkadiusz Fal
2026-09-25 23:54:27 +02:00
parent 9387bdf42c
commit a81e618e74
8 changed files with 181 additions and 38 deletions

View File

@@ -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 }