1
0
mirror of https://github.com/yattee/yattee.git synced 2025-01-09 19:10:32 +05:30

Add toggle for dislikes

This commit is contained in:
Arkadiusz Fal 2022-03-20 21:31:19 +01:00
parent 7d740931b7
commit 9d7ebb3bd9
6 changed files with 147 additions and 3 deletions

View File

@ -228,6 +228,10 @@ final class PlayerModel: ObservableObject {
}
}
guard Defaults[.enableReturnYouTubeDislike] else {
return
}
self?.returnYouTubeDislike.loadDislikes(videoID: video.videoID) { [weak self] dislikes in
self?.currentItem?.video?.dislikes = dislikes
}

View File

@ -23,6 +23,8 @@ extension Defaults.Keys {
static let sponsorBlockInstance = Key<String>("sponsorBlockInstance", default: "https://sponsor.ajay.app")
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: [
.init(section: .trending("US", "default")),
.init(section: .trending("GB", "default")),

View File

@ -28,6 +28,8 @@ struct PlayerSettings: View {
@Default(.closePiPAndOpenPlayerOnEnteringForeground) private var closePiPAndOpenPlayerOnEnteringForeground
#endif
@Default(.enableReturnYouTubeDislike) private var enableReturnYouTubeDislike
#if os(iOS)
private var idiom: UIUserInterfaceIdiom {
UIDevice.current.userInterfaceIdiom
@ -84,6 +86,7 @@ struct PlayerSettings: View {
keywordsToggle
showHistoryToggle
channelSubscribersToggle
returnYouTubeDislikeToggle
}
Section(header: SettingsHeader(text: "Picture in Picture")) {
@ -200,6 +203,10 @@ struct PlayerSettings: View {
Toggle("Show subscribers count", isOn: $channelSubscribers)
}
private var returnYouTubeDislikeToggle: some View {
Toggle("Enable Return YouTube Dislike", isOn: $enableReturnYouTubeDislike)
}
private var pauseOnHidingPlayerToggle: some View {
Toggle("Pause when player is closed", isOn: $pauseOnHidingPlayer)
}

View File

@ -179,7 +179,7 @@ struct SettingsView: View {
case .browsing:
return 350
case .player:
return 450
return 470
case .history:
return 480
case .sponsorBlock:

View File

@ -23,6 +23,8 @@ import SwiftUI
@EnvironmentObject<PlayerModel> private var player
func makeNSView(context _: Context) -> some NSView {
player.mpvBackend.client = client
client.layer = layer
layer.client = client
@ -31,8 +33,6 @@ import SwiftUI
view.layer = client.layer
view.wantsLayer = true
player.mpvBackend.client = client
return view
}

View File

@ -0,0 +1,131 @@
{
"pins" : [
{
"identity" : "alamofire",
"kind" : "remoteSourceControl",
"location" : "https://github.com/Alamofire/Alamofire.git",
"state" : {
"revision" : "f82c23a8a7ef8dc1a49a8bfc6a96883e79121864",
"version" : "5.5.0"
}
},
{
"identity" : "defaults",
"kind" : "remoteSourceControl",
"location" : "https://github.com/sindresorhus/Defaults",
"state" : {
"revision" : "119f654d44f7b90f00dc11f7dd1c94a36f12576b",
"version" : "6.2.1"
}
},
{
"identity" : "libwebp-xcode",
"kind" : "remoteSourceControl",
"location" : "https://github.com/SDWebImage/libwebp-Xcode.git",
"state" : {
"revision" : "2b3b43faaef54d1b897482428428357b7f7cd08b",
"version" : "1.2.1"
}
},
{
"identity" : "pincache",
"kind" : "remoteSourceControl",
"location" : "https://github.com/pinterest/PINCache",
"state" : {
"branch" : "master",
"revision" : "9ca06045b5aff12ee8c0ef5880aa8469c4896144"
}
},
{
"identity" : "pinoperation",
"kind" : "remoteSourceControl",
"location" : "https://github.com/pinterest/PINOperation.git",
"state" : {
"revision" : "44d8ca154a4e75a028a5548c31ff3a53b90cef15",
"version" : "1.2.1"
}
},
{
"identity" : "sdwebimage",
"kind" : "remoteSourceControl",
"location" : "https://github.com/SDWebImage/SDWebImage.git",
"state" : {
"revision" : "2e63d0061da449ad0ed130768d05dceb1496de44",
"version" : "5.12.5"
}
},
{
"identity" : "sdwebimagepinplugin",
"kind" : "remoteSourceControl",
"location" : "https://github.com/SDWebImage/SDWebImagePINPlugin.git",
"state" : {
"revision" : "bd73a4fb30352ec311303d811559c9c46df4caa4",
"version" : "0.3.0"
}
},
{
"identity" : "sdwebimageswiftui",
"kind" : "remoteSourceControl",
"location" : "https://github.com/SDWebImage/SDWebImageSwiftUI.git",
"state" : {
"revision" : "cd8625b7cf11a97698e180d28bb7d5d357196678",
"version" : "2.0.2"
}
},
{
"identity" : "sdwebimagewebpcoder",
"kind" : "remoteSourceControl",
"location" : "https://github.com/SDWebImage/SDWebImageWebPCoder.git",
"state" : {
"revision" : "95a6838df13bc08d8064cf7e048b787b6e52348d",
"version" : "0.8.4"
}
},
{
"identity" : "siesta",
"kind" : "remoteSourceControl",
"location" : "https://github.com/bustoutsolutions/siesta",
"state" : {
"revision" : "43f34046ebb5beb6802200353c473af303bbc31e",
"version" : "1.5.2"
}
},
{
"identity" : "sparkle",
"kind" : "remoteSourceControl",
"location" : "https://github.com/sparkle-project/Sparkle",
"state" : {
"branch" : "2.x",
"revision" : "f250bead4b943ef9711c61274a1f52e380afa0e8"
}
},
{
"identity" : "swift-log",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-log.git",
"state" : {
"revision" : "5d66f7ba25daf4f94100e7022febf3c75e37a6c7",
"version" : "1.4.2"
}
},
{
"identity" : "swiftui-introspect",
"kind" : "remoteSourceControl",
"location" : "https://github.com/siteline/SwiftUI-Introspect.git",
"state" : {
"revision" : "f2616860a41f9d9932da412a8978fec79c06fe24",
"version" : "0.1.4"
}
},
{
"identity" : "swiftyjson",
"kind" : "remoteSourceControl",
"location" : "https://github.com/SwiftyJSON/SwiftyJSON.git",
"state" : {
"revision" : "b3dcd7dbd0d488e1a7077cb33b00f2083e382f07",
"version" : "5.0.1"
}
}
],
"version" : 2
}