mirror of
https://github.com/yattee/yattee.git
synced 2026-10-23 21:22:53 +00:00
Add a Hide Shorts toggle to the view options
Videos carry isShort from Yattee Server and Piped, and Invidious feed entries are taken as Shorts when they arrive with no length and aren't live or upcoming: the feed comes from RSS, which lists Shorts, while lengths come from the Videos tab, which doesn't. Subscriptions, search and instance browse hide videos known to be Shorts when the toggle is on; videos whose source can't tell are always shown.
This commit is contained in:
@@ -44,6 +44,7 @@ struct SubscriptionsView: View {
|
||||
@AppStorage("subscriptionsRowStyle") private var rowStyle: VideoRowStyle = .regular
|
||||
@AppStorage("subscriptionsGridColumns") private var gridColumns = 2
|
||||
@AppStorage("subscriptionsHideWatched") private var hideWatched = false
|
||||
@AppStorage("subscriptionsHideShorts") private var hideShorts = false
|
||||
@AppStorage("subscriptionsChannelStripSize") private var channelStripSize: ChannelStripSize = .normal
|
||||
@AppStorage("subscriptionsShowSidebar") private var showSidebar = true
|
||||
/// Whether the last completed load produced enough channels for the sidebar,
|
||||
@@ -126,8 +127,13 @@ struct SubscriptionsView: View {
|
||||
Text("common.on").tag(true)
|
||||
Text("common.off").tag(false)
|
||||
}
|
||||
PlatformMenuPicker(String(localized: "viewOptions.hideShorts"), selection: $hideShorts) {
|
||||
Text("common.on").tag(true)
|
||||
Text("common.off").tag(false)
|
||||
}
|
||||
#else
|
||||
Toggle("viewOptions.hideWatched", isOn: $hideWatched)
|
||||
Toggle("viewOptions.hideShorts", isOn: $hideShorts)
|
||||
#endif
|
||||
|
||||
#if os(iOS)
|
||||
@@ -245,7 +251,7 @@ struct SubscriptionsView: View {
|
||||
.joined(separator: "|")
|
||||
}
|
||||
|
||||
/// Videos filtered by selected channel and watch status.
|
||||
/// Videos filtered by selected channel, watch status and Shorts.
|
||||
private var filteredVideos: [Video] {
|
||||
var videos = feedCache.videos
|
||||
|
||||
@@ -253,6 +259,10 @@ struct SubscriptionsView: View {
|
||||
videos = videos.filter { $0.author.id == channelID }
|
||||
}
|
||||
|
||||
if hideShorts {
|
||||
videos = videos.filter { !$0.isKnownShort }
|
||||
}
|
||||
|
||||
if hideWatched {
|
||||
videos = videos.filter { video in
|
||||
guard let entry = watchEntriesMap[video.id.videoID] else { return true }
|
||||
|
||||
Reference in New Issue
Block a user