Add option to show/hide history of videos in player queue view

This commit is contained in:
Arkadiusz Fal 2022-01-02 20:36:18 +01:00
parent 9ede4b9b1f
commit 117057dd0e
4 changed files with 17 additions and 2 deletions

View File

@ -36,6 +36,7 @@ extension Defaults.Keys {
#endif #endif
static let channelOnThumbnail = Key<Bool>("channelOnThumbnail", default: true) static let channelOnThumbnail = Key<Bool>("channelOnThumbnail", default: true)
static let timeOnThumbnail = Key<Bool>("timeOnThumbnail", default: true) static let timeOnThumbnail = Key<Bool>("timeOnThumbnail", default: true)
static let showHistoryInPlayer = Key<Bool>("showHistoryInPlayer", default: false)
static let quality = Key<ResolutionSetting>("quality", default: .best) static let quality = Key<ResolutionSetting>("quality", default: .best)
static let playerSidebar = Key<PlayerSidebarSetting>("playerSidebar", default: PlayerSidebarSetting.defaultValue) static let playerSidebar = Key<PlayerSidebarSetting>("playerSidebar", default: PlayerSidebarSetting.defaultValue)

View File

@ -13,6 +13,7 @@ struct PlayerQueueView: View {
@EnvironmentObject<PlayerModel> private var player @EnvironmentObject<PlayerModel> private var player
@Default(.saveHistory) private var saveHistory @Default(.saveHistory) private var saveHistory
@Default(.showHistoryInPlayer) private var showHistoryInPlayer
var body: some View { var body: some View {
List { List {
@ -21,7 +22,7 @@ struct PlayerQueueView: View {
if sidebarQueue { if sidebarQueue {
related related
} }
if saveHistory { if saveHistory, showHistoryInPlayer {
playedPreviously playedPreviously
} }
} }

View File

@ -66,9 +66,15 @@ final class PlayerViewController: UIViewController {
if CommentsModel.enabled { if CommentsModel.enabled {
infoViewControllers.append(infoViewController([.comments], title: "Comments")) infoViewControllers.append(infoViewController([.comments], title: "Comments"))
} }
var queueSections = [NowPlayingView.ViewSection.playingNext]
if Defaults[.showHistoryInPlayer] {
queueSections.append(.playedPreviously)
}
infoViewControllers.append(contentsOf: [ infoViewControllers.append(contentsOf: [
infoViewController([.related], title: "Related"), infoViewController([.related], title: "Related"),
infoViewController([.playingNext, .playedPreviously], title: "Playing Next") infoViewController(queueSections, title: "Queue")
]) ])
playerView.customInfoViewControllers = infoViewControllers playerView.customInfoViewControllers = infoViewControllers

View File

@ -6,6 +6,7 @@ struct PlaybackSettings: View {
@Default(.playerInstanceID) private var playerInstanceID @Default(.playerInstanceID) private var playerInstanceID
@Default(.quality) private var quality @Default(.quality) private var quality
@Default(.playerSidebar) private var playerSidebar @Default(.playerSidebar) private var playerSidebar
@Default(.showHistoryInPlayer) private var showHistory
@Default(.showKeywords) private var showKeywords @Default(.showKeywords) private var showKeywords
@Default(.showChannelSubscribers) private var channelSubscribers @Default(.showChannelSubscribers) private var channelSubscribers
@Default(.pauseOnHidingPlayer) private var pauseOnHidingPlayer @Default(.pauseOnHidingPlayer) private var pauseOnHidingPlayer
@ -33,6 +34,7 @@ struct PlaybackSettings: View {
} }
keywordsToggle keywordsToggle
showHistoryToggle
channelSubscribersToggle channelSubscribersToggle
pauseOnHidingPlayerToggle pauseOnHidingPlayerToggle
} }
@ -58,6 +60,7 @@ struct PlaybackSettings: View {
#endif #endif
keywordsToggle keywordsToggle
showHistoryToggle
channelSubscribersToggle channelSubscribersToggle
pauseOnHidingPlayerToggle pauseOnHidingPlayerToggle
@ -132,6 +135,10 @@ struct PlaybackSettings: View {
Toggle("Show video keywords", isOn: $showKeywords) Toggle("Show video keywords", isOn: $showKeywords)
} }
private var showHistoryToggle: some View {
Toggle("Show history of videos", isOn: $showHistory)
}
private var channelSubscribersToggle: some View { private var channelSubscribersToggle: some View {
Toggle("Show channel subscribers count", isOn: $channelSubscribers) Toggle("Show channel subscribers count", isOn: $channelSubscribers)
} }