liked tracks!!

This commit is contained in:
eevee
2024-09-21 22:50:02 +03:00
parent 5168c7ec20
commit eeaa55e4fd
7 changed files with 67 additions and 12 deletions

View File

@@ -69,7 +69,7 @@ class SpotifySessionDelegateBootstrapHook: ClassHook<NSObject>, SpotifySessionDe
}
else {
UserDefaults.patchType = .requests
ServerSidedReminder().activate()
PremiumPatching().activate()
}
NSLog("[EeveeSpotify] Fetched bootstrap, \(UserDefaults.patchType) was set")

View File

@@ -0,0 +1,50 @@
import Orion
private let likedTracksRow: [String: Any] = [
"id": "artist-entity-view-liked-tracks-row",
"text": [ "title": "liked_songs".localized ]
]
class HUBViewModelBuilderImplementationHook: ClassHook<NSObject> {
typealias Group = PremiumPatching
static let targetName: String = "HUBViewModelBuilderImplementation"
func addJSONDictionary(_ dictionary: NSDictionary?) {
guard let dictionary = dictionary else {
return
}
let mutableDictionary = NSMutableDictionary(dictionary: dictionary)
let id = dictionary["id"] as? String
if id == "artist-entity-view" {
guard var components = dictionary["body"] as? [[String: Any]] else {
orig.addJSONDictionary(dictionary)
return
}
if let index = components.firstIndex(
where: { $0["id"] as? String == "artist-entity-view-artist-tab-container" }
) {
if var childrenArray = components[index]["children"] as? [[String: Any]],
var innerChildrenArray = childrenArray[0]["children"] as? [Any] {
innerChildrenArray.insert(likedTracksRow, at: 0)
childrenArray[0]["children"] = innerChildrenArray
components[index]["children"] = childrenArray
}
}
else if let index = components.firstIndex(
where: { $0["id"] as? String == "artist-entity-view-top-tracks-combined" }
) {
components.insert(likedTracksRow, at: index)
}
mutableDictionary["body"] = components
}
orig.addJSONDictionary(mutableDictionary)
}
}

View File

@@ -1,10 +1,8 @@
import Orion
import UIKit
struct ServerSidedReminder: HookGroup { }
class StreamQualitySettingsSectionHook: ClassHook<NSObject> {
typealias Group = ServerSidedReminder
typealias Group = PremiumPatching
static let targetName = "StreamQualitySettingsSection"
func shouldResetSelection() -> Bool {
@@ -27,7 +25,7 @@ private func showOfflineModePopUp() {
}
class FTPDownloadActionHook: ClassHook<NSObject> {
typealias Group = ServerSidedReminder
typealias Group = PremiumPatching
static let targetName = "ListUXPlatform_FreeTierPlaylistImpl.FTPDownloadAction"
func execute(_ idk: Any) {
@@ -36,7 +34,7 @@ class FTPDownloadActionHook: ClassHook<NSObject> {
}
class UIButtonHook: ClassHook<UIButton> {
typealias Group = ServerSidedReminder
typealias Group = PremiumPatching
func setHighlighted(_ highlighted: Bool) {

View File

@@ -1,7 +1,7 @@
import Orion
class SPTFreeTierArtistHubRemoteURLResolverHook: ClassHook<NSObject> {
typealias Group = PremiumPatching
static let targetName = "SPTFreeTierArtistHubRemoteURLResolver"
func initWithViewURI(
@@ -11,14 +11,11 @@ class SPTFreeTierArtistHubRemoteURLResolverHook: ClassHook<NSObject> {
trackRowsEnabled: Bool,
productState: SPTCoreProductState
) -> Target {
return orig.initWithViewURI(
uri,
onDemandSet: onDemandSet,
onDemandTrialService: onDemandTrialService,
trackRowsEnabled: UserDefaults.patchType.isPatching
? true
: trackRowsEnabled,
trackRowsEnabled: true,
productState: productState
)
}

View File

@@ -8,6 +8,8 @@ func exitApplication() {
}
}
struct PremiumPatching: HookGroup { }
struct EeveeSpotify: Tweak {
static let version = "5.2"
@@ -19,7 +21,7 @@ struct EeveeSpotify: Tweak {
}
if UserDefaults.patchType.isPatching {
ServerSidedReminder().activate()
PremiumPatching().activate()
}
}
}

View File

@@ -101,3 +101,7 @@ unknown_error = "Unknown Error";
song_is_instrumental = "This song is instrumental.";
let_the_music_play = "Let the music play...";
// liked songs title, should match official spotify loc
liked_songs = "Liked songs";

View File

@@ -99,3 +99,7 @@ unknown_error = "Неизвестная ошибка";
song_is_instrumental = "Это инструментальная композиция.";
let_the_music_play = "Пусть заиграет музыка...";
// liked songs title, should match official spotify loc
liked_songs = "Тебе понравилось";