mirror of
https://github.com/yattee/yattee.git
synced 2025-01-10 19:40:33 +05:30
Add toggle for dislikes
This commit is contained in:
parent
4eda07dac8
commit
eaa019caa3
@ -226,6 +226,10 @@ final class PlayerModel: ObservableObject {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
guard Defaults[.enableReturnYouTubeDislike] else {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
self?.returnYouTubeDislike.loadDislikes(videoID: video.videoID) { [weak self] dislikes in
|
self?.returnYouTubeDislike.loadDislikes(videoID: video.videoID) { [weak self] dislikes in
|
||||||
self?.currentItem?.video?.dislikes = dislikes
|
self?.currentItem?.video?.dislikes = dislikes
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,8 @@ extension Defaults.Keys {
|
|||||||
static let sponsorBlockInstance = Key<String>("sponsorBlockInstance", default: "https://sponsor.ajay.app")
|
static let sponsorBlockInstance = Key<String>("sponsorBlockInstance", default: "https://sponsor.ajay.app")
|
||||||
static let sponsorBlockCategories = Key<Set<String>>("sponsorBlockCategories", default: Set(SponsorBlockAPI.categories))
|
static let sponsorBlockCategories = Key<Set<String>>("sponsorBlockCategories", default: Set(SponsorBlockAPI.categories))
|
||||||
|
|
||||||
|
static let enableReturnYouTubeDislike = Key<Bool>("enableReturnYouTubeDislike", default: false)
|
||||||
|
|
||||||
static let favorites = Key<[FavoriteItem]>("favorites", default: [
|
static let favorites = Key<[FavoriteItem]>("favorites", default: [
|
||||||
.init(section: .trending("US", "default")),
|
.init(section: .trending("US", "default")),
|
||||||
.init(section: .trending("GB", "default")),
|
.init(section: .trending("GB", "default")),
|
||||||
|
@ -27,6 +27,8 @@ struct PlayerSettings: View {
|
|||||||
@Default(.closePiPAndOpenPlayerOnEnteringForeground) private var closePiPAndOpenPlayerOnEnteringForeground
|
@Default(.closePiPAndOpenPlayerOnEnteringForeground) private var closePiPAndOpenPlayerOnEnteringForeground
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@Default(.enableReturnYouTubeDislike) private var enableReturnYouTubeDislike
|
||||||
|
|
||||||
#if os(iOS)
|
#if os(iOS)
|
||||||
private var idiom: UIUserInterfaceIdiom {
|
private var idiom: UIUserInterfaceIdiom {
|
||||||
UIDevice.current.userInterfaceIdiom
|
UIDevice.current.userInterfaceIdiom
|
||||||
@ -82,6 +84,7 @@ struct PlayerSettings: View {
|
|||||||
|
|
||||||
keywordsToggle
|
keywordsToggle
|
||||||
showHistoryToggle
|
showHistoryToggle
|
||||||
|
returnYouTubeDislikeToggle
|
||||||
}
|
}
|
||||||
|
|
||||||
Section(header: SettingsHeader(text: "Picture in Picture")) {
|
Section(header: SettingsHeader(text: "Picture in Picture")) {
|
||||||
@ -194,6 +197,10 @@ struct PlayerSettings: View {
|
|||||||
Toggle("Show history", isOn: $showHistory)
|
Toggle("Show history", isOn: $showHistory)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private var returnYouTubeDislikeToggle: some View {
|
||||||
|
Toggle("Enable Return YouTube Dislike", isOn: $enableReturnYouTubeDislike)
|
||||||
|
}
|
||||||
|
|
||||||
private var pauseOnHidingPlayerToggle: some View {
|
private var pauseOnHidingPlayerToggle: some View {
|
||||||
Toggle("Pause when player is closed", isOn: $pauseOnHidingPlayer)
|
Toggle("Pause when player is closed", isOn: $pauseOnHidingPlayer)
|
||||||
}
|
}
|
||||||
|
@ -179,7 +179,7 @@ struct SettingsView: View {
|
|||||||
case .browsing:
|
case .browsing:
|
||||||
return 350
|
return 350
|
||||||
case .player:
|
case .player:
|
||||||
return 450
|
return 470
|
||||||
case .history:
|
case .history:
|
||||||
return 480
|
return 480
|
||||||
case .sponsorBlock:
|
case .sponsorBlock:
|
||||||
|
@ -23,6 +23,8 @@ import SwiftUI
|
|||||||
@EnvironmentObject<PlayerModel> private var player
|
@EnvironmentObject<PlayerModel> private var player
|
||||||
|
|
||||||
func makeNSView(context _: Context) -> some NSView {
|
func makeNSView(context _: Context) -> some NSView {
|
||||||
|
player.mpvBackend.client = client
|
||||||
|
|
||||||
client.layer = layer
|
client.layer = layer
|
||||||
layer.client = client
|
layer.client = client
|
||||||
|
|
||||||
@ -31,8 +33,6 @@ import SwiftUI
|
|||||||
view.layer = client.layer
|
view.layer = client.layer
|
||||||
view.wantsLayer = true
|
view.wantsLayer = true
|
||||||
|
|
||||||
player.mpvBackend.client = client
|
|
||||||
|
|
||||||
return view
|
return view
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user