mirror of
https://github.com/yattee/yattee.git
synced 2025-08-05 02:04:07 +00:00
Refactor hide shorts
This commit is contained in:
@@ -6,7 +6,7 @@ struct ContentItemView: View {
|
||||
let item: ContentItem
|
||||
@Environment(\.listingStyle) private var listingStyle
|
||||
@Environment(\.noListingDividers) private var noListingDividers
|
||||
@Environment(\.hideShorts) private var hideShorts
|
||||
@Default(.hideShorts) private var hideShorts
|
||||
@Default(.hideWatched) private var hideWatched
|
||||
|
||||
@FetchRequest private var watchRequest: FetchedResults<Watch>
|
||||
|
@@ -1,14 +1,15 @@
|
||||
import Defaults
|
||||
import SwiftUI
|
||||
|
||||
struct HideShortsButtons: View {
|
||||
@Binding var hide: Bool
|
||||
@Default(.hideShorts) private var hideShorts
|
||||
|
||||
var body: some View {
|
||||
Button {
|
||||
hide.toggle()
|
||||
hideShorts.toggle()
|
||||
} label: {
|
||||
Group {
|
||||
if hide {
|
||||
if hideShorts {
|
||||
Label("Short videos: hidden", systemImage: "bolt.slash.fill")
|
||||
.help("Short videos: hidden")
|
||||
} else {
|
||||
@@ -27,7 +28,7 @@ struct HideShortsButtons: View {
|
||||
struct HideShortsButtons_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
VStack {
|
||||
HideShortsButtons(hide: .constant(true))
|
||||
HideShortsButtons()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -10,7 +10,6 @@ struct PopularView: View {
|
||||
@State private var error: RequestError?
|
||||
|
||||
@Default(.popularListingStyle) private var popularListingStyle
|
||||
@Default(.hideShorts) private var hideShorts
|
||||
|
||||
var resource: Resource? {
|
||||
accounts.api.popular
|
||||
@@ -76,7 +75,7 @@ struct PopularView: View {
|
||||
}
|
||||
|
||||
ToolbarItem {
|
||||
HideShortsButtons(hide: $hideShorts)
|
||||
HideShortsButtons()
|
||||
}
|
||||
}
|
||||
#else
|
||||
@@ -95,7 +94,7 @@ struct PopularView: View {
|
||||
|
||||
Section {
|
||||
HideWatchedButtons()
|
||||
HideShortsButtons(hide: $hideShorts)
|
||||
HideShortsButtons()
|
||||
}
|
||||
|
||||
Section {
|
||||
@@ -135,7 +134,7 @@ struct PopularView: View {
|
||||
Spacer()
|
||||
ListingStyleButtons(listingStyle: $popularListingStyle)
|
||||
HideWatchedButtons()
|
||||
HideShortsButtons(hide: $hideShorts)
|
||||
HideShortsButtons()
|
||||
|
||||
Button {
|
||||
resource?.load()
|
||||
|
Reference in New Issue
Block a user