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 seekGestureSpeed = Key<Double>("seekGestureSpeed", default: 0.5)
static let seekGestureSensitivity = Key<Double>("seekGestureSensitivity", default: 20.0) static let seekGestureSensitivity = Key<Double>("seekGestureSensitivity", default: 20.0)
static let showKeywords = Key<Bool>("showKeywords", default: false) static let showKeywords = Key<Bool>("showKeywords", default: false)
static let showHistoryInPlayer = Key<Bool>("showHistoryInPlayer", default: false)
#if !os(tvOS) #if !os(tvOS)
static let commentsPlacement = Key<CommentsPlacement>("commentsPlacement", default: .separate) static let commentsPlacement = Key<CommentsPlacement>("commentsPlacement", default: .separate)
#endif #endif

View File

@ -49,9 +49,6 @@ final class AppleAVPlayerViewController: UIViewController {
infoViewControllers.append(infoViewController([.comments], title: "Comments")) infoViewControllers.append(infoViewController([.comments], title: "Comments"))
var queueSections = [NowPlayingView.ViewSection.playingNext] 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"),

View File

@ -15,7 +15,6 @@ 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 {
@ -27,9 +26,6 @@ struct PlayerQueueView: View {
if sidebarQueue { if sidebarQueue {
related related
} }
if saveHistory, showHistoryInPlayer {
playedPreviously
}
} }
.listRowBackground(Color.clear) .listRowBackground(Color.clear)
#if !os(iOS) #if !os(iOS)
@ -108,28 +104,6 @@ struct PlayerQueueView: View {
watches.filter { $0.videoID != player.currentVideo?.videoID } 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 { @ViewBuilder private var related: some View {
if let related = player.currentVideo?.related, !related.isEmpty { if let related = player.currentVideo?.related, !related.isEmpty {
Section(header: Text("Related")) { Section(header: Text("Related")) {

View File

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

View File

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

View File

@ -4,10 +4,10 @@ import SwiftUI
struct NowPlayingView: View { struct NowPlayingView: View {
enum ViewSection: CaseIterable { 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 var inInfoViewController = false
@State private var repliesID: Comment.ID? @State private var repliesID: Comment.ID?
@ -20,7 +20,6 @@ struct NowPlayingView: View {
@EnvironmentObject<RecentsModel> private var recents @EnvironmentObject<RecentsModel> private var recents
@Default(.saveHistory) private var saveHistory @Default(.saveHistory) private var saveHistory
@Default(.showHistoryInPlayer) private var showHistoryInPlayer
var body: some View { var body: some View {
if inInfoViewController { 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 sections.contains(.comments) {
if comments.disabled { if comments.disabled {
NoCommentsView(text: "Comments are disabled".localized(), systemImage: "xmark.circle.fill") NoCommentsView(text: "Comments are disabled".localized(), systemImage: "xmark.circle.fill")