mirror of
https://github.com/yattee/yattee.git
synced 2026-10-26 14:42:53 +00:00
Move comments pill mode into the comments page settings
The pill mode now lives on CommentsPageSettings and is edited in the comments page editor instead of a standalone settings section. The legacy value on PlayerPillSettings is kept for decoding old presets and migrated by effectivePanelSettings. Comments are loaded when either the comments page is enabled or the pill is not disabled.
This commit is contained in:
@@ -100,8 +100,18 @@ struct PlayerControlsLayout: Codable, Hashable, Sendable {
|
||||
// MARK: - Panel Settings
|
||||
|
||||
/// Returns the effective details panel settings, using defaults if not set.
|
||||
/// Migrates the legacy comments pill mode (once stored on the player pill
|
||||
/// settings) into the comments page settings; the migrated value persists
|
||||
/// the first time the panel settings are edited and saved.
|
||||
var effectivePanelSettings: PanelSettings {
|
||||
panelSettings ?? .default
|
||||
var settings = panelSettings ?? .default
|
||||
if let legacyMode = playerPillSettings?.commentsPillMode,
|
||||
settings.configuration(for: .comments)?.commentsSettings.pillMode == nil {
|
||||
var comments = settings.configuration(for: .comments)?.commentsSettings ?? CommentsPageSettings()
|
||||
comments.pillMode = legacyMode
|
||||
settings.updateSettings(.comments(comments), for: .comments)
|
||||
}
|
||||
return settings
|
||||
}
|
||||
|
||||
// MARK: - Defaults
|
||||
|
||||
Reference in New Issue
Block a user