mirror of
https://github.com/yattee/yattee.git
synced 2026-11-01 09:27:18 +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:
@@ -50,6 +50,7 @@ struct InstanceBrowseView: View {
|
||||
@AppStorage var rowStyle: VideoRowStyle
|
||||
@AppStorage var gridColumnCount: Int
|
||||
@AppStorage var hideWatched: Bool
|
||||
@AppStorage var hideShorts: Bool
|
||||
|
||||
// View options UI state
|
||||
@State private var showViewOptions = false
|
||||
@@ -74,6 +75,7 @@ struct InstanceBrowseView: View {
|
||||
_rowStyle = AppStorage(wrappedValue: .regular, "instanceBrowse.\(instance.id).rowStyle")
|
||||
_gridColumnCount = AppStorage(wrappedValue: 2, "instanceBrowse.\(instance.id).gridColumns")
|
||||
_hideWatched = AppStorage(wrappedValue: false, "instanceBrowse.\(instance.id).hideWatched")
|
||||
_hideShorts = AppStorage(wrappedValue: false, "instanceBrowse.\(instance.id).hideShorts")
|
||||
}
|
||||
|
||||
/// List style from centralized settings.
|
||||
@@ -126,6 +128,7 @@ struct InstanceBrowseView: View {
|
||||
rowStyle: $rowStyle,
|
||||
gridColumns: $gridColumnCount,
|
||||
hideWatched: $hideWatched,
|
||||
hideShorts: $hideShorts,
|
||||
maxGridColumns: gridConfig.maxColumns
|
||||
)
|
||||
}
|
||||
@@ -826,6 +829,10 @@ struct InstanceBrowseView: View {
|
||||
return !entry.isFinished
|
||||
}
|
||||
}
|
||||
|
||||
if hideShorts {
|
||||
videos = videos.filter { !$0.isKnownShort }
|
||||
}
|
||||
|
||||
return videos
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user