mirror of
https://github.com/yattee/yattee.git
synced 2024-11-09 15:58:20 +00:00
Allow hiding comments
This commit is contained in:
parent
af75afa912
commit
f5e509c091
@ -36,6 +36,8 @@ final class PlayerSettingsGroupExporter: SettingsGroupExporter {
|
|||||||
export["pauseOnEnteringBackground"].bool = Defaults[.pauseOnEnteringBackground]
|
export["pauseOnEnteringBackground"].bool = Defaults[.pauseOnEnteringBackground]
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
export["showComments"].bool = Defaults[.showComments]
|
||||||
|
|
||||||
#if !os(tvOS)
|
#if !os(tvOS)
|
||||||
export["showScrollToTopInComments"].bool = Defaults[.showScrollToTopInComments]
|
export["showScrollToTopInComments"].bool = Defaults[.showScrollToTopInComments]
|
||||||
#endif
|
#endif
|
||||||
|
@ -83,6 +83,9 @@ struct PlayerSettingsGroupImporter {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if let showComments = json["showComments"].bool {
|
||||||
|
Defaults[.showComments] = showComments
|
||||||
|
}
|
||||||
#if !os(tvOS)
|
#if !os(tvOS)
|
||||||
if let showScrollToTopInComments = json["showScrollToTopInComments"].bool {
|
if let showScrollToTopInComments = json["showScrollToTopInComments"].bool {
|
||||||
Defaults[.showScrollToTopInComments] = showScrollToTopInComments
|
Defaults[.showScrollToTopInComments] = showScrollToTopInComments
|
||||||
|
@ -85,6 +85,7 @@ extension Defaults.Keys {
|
|||||||
|
|
||||||
static let playerSidebar = Key<PlayerSidebarSetting>("playerSidebar", default: .defaultValue)
|
static let playerSidebar = Key<PlayerSidebarSetting>("playerSidebar", default: .defaultValue)
|
||||||
static let showKeywords = Key<Bool>("showKeywords", default: false)
|
static let showKeywords = Key<Bool>("showKeywords", default: false)
|
||||||
|
static let showComments = Key<Bool>("showComments", default: true)
|
||||||
#if !os(tvOS)
|
#if !os(tvOS)
|
||||||
static let showScrollToTopInComments = Key<Bool>("showScrollToTopInComments", default: true)
|
static let showScrollToTopInComments = Key<Bool>("showScrollToTopInComments", default: true)
|
||||||
#endif
|
#endif
|
||||||
|
@ -189,6 +189,7 @@ struct VideoDetails: View {
|
|||||||
@Default(.showChapterThumbnails) private var showChapterThumbnails
|
@Default(.showChapterThumbnails) private var showChapterThumbnails
|
||||||
@Default(.showChapterThumbnailsOnlyWhenDifferent) private var showChapterThumbnailsOnlyWhenDifferent
|
@Default(.showChapterThumbnailsOnlyWhenDifferent) private var showChapterThumbnailsOnlyWhenDifferent
|
||||||
@Default(.showRelated) private var showRelated
|
@Default(.showRelated) private var showRelated
|
||||||
|
@Default(.showComments) private var showComments
|
||||||
#if !os(tvOS)
|
#if !os(tvOS)
|
||||||
@Default(.showScrollToTopInComments) private var showScrollToTopInComments
|
@Default(.showScrollToTopInComments) private var showScrollToTopInComments
|
||||||
#endif
|
#endif
|
||||||
@ -284,6 +285,8 @@ struct VideoDetails: View {
|
|||||||
switch page {
|
switch page {
|
||||||
case .queue:
|
case .queue:
|
||||||
return !sidebarQueue && player.isAdvanceToNextItemAvailable
|
return !sidebarQueue && player.isAdvanceToNextItemAvailable
|
||||||
|
case .comments:
|
||||||
|
return showComments
|
||||||
default:
|
default:
|
||||||
return !video.isLocal
|
return !video.isLocal
|
||||||
}
|
}
|
||||||
@ -362,10 +365,12 @@ struct VideoDetails: View {
|
|||||||
PlayerQueueView(sidebarQueue: false)
|
PlayerQueueView(sidebarQueue: false)
|
||||||
.padding(.horizontal)
|
.padding(.horizontal)
|
||||||
case .comments:
|
case .comments:
|
||||||
CommentsView()
|
if showComments {
|
||||||
.onAppear {
|
CommentsView()
|
||||||
comments.loadIfNeeded()
|
.onAppear {
|
||||||
}
|
comments.loadIfNeeded()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.padding(.bottom, 60)
|
.padding(.bottom, 60)
|
||||||
|
@ -8,6 +8,7 @@ struct PlayerSettings: View {
|
|||||||
@Default(.playerSidebar) private var playerSidebar
|
@Default(.playerSidebar) private var playerSidebar
|
||||||
|
|
||||||
@Default(.showKeywords) private var showKeywords
|
@Default(.showKeywords) private var showKeywords
|
||||||
|
@Default(.showComments) private var showComments
|
||||||
#if !os(tvOS)
|
#if !os(tvOS)
|
||||||
@Default(.showScrollToTopInComments) private var showScrollToTopInComments
|
@Default(.showScrollToTopInComments) private var showScrollToTopInComments
|
||||||
@Default(.collapsedLinesDescription) private var collapsedLinesDescription
|
@Default(.collapsedLinesDescription) private var collapsedLinesDescription
|
||||||
@ -175,6 +176,7 @@ struct PlayerSettings: View {
|
|||||||
if !accounts.isEmpty {
|
if !accounts.isEmpty {
|
||||||
keywordsToggle
|
keywordsToggle
|
||||||
|
|
||||||
|
commentsToggle
|
||||||
#if !os(tvOS)
|
#if !os(tvOS)
|
||||||
showScrollToTopInCommentsToggle
|
showScrollToTopInCommentsToggle
|
||||||
#endif
|
#endif
|
||||||
@ -250,9 +252,13 @@ struct PlayerSettings: View {
|
|||||||
.modifier(SettingsPickerModifier())
|
.modifier(SettingsPickerModifier())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private var commentsToggle: some View {
|
||||||
|
Toggle("Show comments", isOn: $showComments)
|
||||||
|
}
|
||||||
|
|
||||||
#if !os(tvOS)
|
#if !os(tvOS)
|
||||||
private var showScrollToTopInCommentsToggle: some View {
|
private var showScrollToTopInCommentsToggle: some View {
|
||||||
Toggle("Show scroll to top button in comments", isOn: $showScrollToTopInComments)
|
Toggle("Show scroll to top button in comments", isOn: $showScrollToTopInComments).disabled(!showComments)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user