Remove "Show history in player"

This commit is contained in:
Arkadiusz Fal 2022-11-11 14:54:12 +01:00
parent 99e20f54a2
commit 5eafbb1151
6 changed files with 3 additions and 65 deletions

View File

@ -115,7 +115,6 @@ extension Defaults.Keys {
static let seekGestureSpeed = Key<Double>("seekGestureSpeed", default: 0.5)
static let seekGestureSensitivity = Key<Double>("seekGestureSensitivity", default: 20.0)
static let showKeywords = Key<Bool>("showKeywords", default: false)
static let showHistoryInPlayer = Key<Bool>("showHistoryInPlayer", default: false)
#if !os(tvOS)
static let commentsPlacement = Key<CommentsPlacement>("commentsPlacement", default: .separate)
#endif

View File

@ -49,9 +49,6 @@ final class AppleAVPlayerViewController: UIViewController {
infoViewControllers.append(infoViewController([.comments], title: "Comments"))
var queueSections = [NowPlayingView.ViewSection.playingNext]
if Defaults[.showHistoryInPlayer] {
queueSections.append(.playedPreviously)
}
infoViewControllers.append(contentsOf: [
infoViewController([.related], title: "Related"),

View File

@ -15,7 +15,6 @@ struct PlayerQueueView: View {
@EnvironmentObject<PlayerModel> private var player
@Default(.saveHistory) private var saveHistory
@Default(.showHistoryInPlayer) private var showHistoryInPlayer
var body: some View {
List {
@ -27,9 +26,6 @@ struct PlayerQueueView: View {
if sidebarQueue {
related
}
if saveHistory, showHistoryInPlayer {
playedPreviously
}
}
.listRowBackground(Color.clear)
#if !os(iOS)
@ -108,28 +104,6 @@ struct PlayerQueueView: View {
watches.filter { $0.videoID != player.currentVideo?.videoID }
}
var playedPreviously: some View {
Group {
if !visibleWatches.isEmpty {
Section(header: Text("History")) {
ForEach(visibleWatches, id: \.videoID) { watch in
PlayerQueueRow(
item: PlayerQueueItem.from(watch, video: player.historyVideo(watch.videoID)),
history: true,
fullScreen: $fullScreen
)
.onAppear {
player.loadHistoryVideoDetails(watch.videoID)
}
.contextMenu {
VideoContextMenuView(video: watch.video)
}
}
}
}
}
}
@ViewBuilder private var related: some View {
if let related = player.currentVideo?.related, !related.isEmpty {
Section(header: Text("Related")) {

View File

@ -19,7 +19,7 @@ struct LocationsSettings: View {
settings
Spacer()
#else
List {
Group {
settings
}
#if os(iOS)

View File

@ -6,7 +6,6 @@ struct PlayerSettings: View {
@Default(.playerInstanceID) private var playerInstanceID
@Default(.playerSidebar) private var playerSidebar
@Default(.showHistoryInPlayer) private var showHistory
@Default(.playerControlsLayout) private var playerControlsLayout
@Default(.fullScreenPlayerControlsLayout) private var fullScreenPlayerControlsLayout
@Default(.horizontalPlayerGestureEnabled) private var horizontalPlayerGestureEnabled
@ -99,7 +98,6 @@ struct PlayerSettings: View {
#endif
keywordsToggle
showHistoryToggle
if !accounts.isDemo {
returnYouTubeDislikeToggle
@ -225,10 +223,6 @@ struct PlayerSettings: View {
Toggle("Show keywords", isOn: $showKeywords)
}
private var showHistoryToggle: some View {
Toggle("Show history", isOn: $showHistory)
}
private var returnYouTubeDislikeToggle: some View {
Toggle("Enable Return YouTube Dislike", isOn: $enableReturnYouTubeDislike)
}

View File

@ -4,10 +4,10 @@ import SwiftUI
struct NowPlayingView: View {
enum ViewSection: CaseIterable {
case nowPlaying, playingNext, playedPreviously, related, comments, chapters
case nowPlaying, playingNext, related, comments, chapters
}
var sections = [ViewSection.nowPlaying, .playingNext, .playedPreviously, .related]
var sections = [ViewSection.nowPlaying, .playingNext, .related]
var inInfoViewController = false
@State private var repliesID: Comment.ID?
@ -20,7 +20,6 @@ struct NowPlayingView: View {
@EnvironmentObject<RecentsModel> private var recents
@Default(.saveHistory) private var saveHistory
@Default(.showHistoryInPlayer) private var showHistoryInPlayer
var body: some View {
if inInfoViewController {
@ -99,31 +98,6 @@ struct NowPlayingView: View {
}
}
if sections.contains(.playedPreviously), saveHistory, showHistoryInPlayer, !visibleWatches.isEmpty {
Section(header: Text("Played Previously")) {
ForEach(visibleWatches, id: \.videoID) { watch in
Button {
player.playHistory(
PlayerQueueItem.from(watch, video: player.historyVideo(watch.videoID))
)
player.show()
} label: {
VideoBanner(
video: player.historyVideo(watch.videoID),
playbackTime: CMTime.secondsInDefaultTimescale(watch.stoppedAt),
videoDuration: watch.videoDuration
)
}
.onAppear {
player.loadHistoryVideoDetails(watch.videoID)
}
.contextMenu {
VideoContextMenuView(video: watch.video)
}
}
}
}
if sections.contains(.comments) {
if comments.disabled {
NoCommentsView(text: "Comments are disabled".localized(), systemImage: "xmark.circle.fill")