diff --git a/Sources/EeveeSpotify/Premium/DynamicPremium+ModifyBootstrap.x.swift b/Sources/EeveeSpotify/Premium/DynamicPremium+ModifyBootstrap.x.swift index a04e320..3f831e8 100644 --- a/Sources/EeveeSpotify/Premium/DynamicPremium+ModifyBootstrap.x.swift +++ b/Sources/EeveeSpotify/Premium/DynamicPremium+ModifyBootstrap.x.swift @@ -69,7 +69,7 @@ class SpotifySessionDelegateBootstrapHook: ClassHook, SpotifySessionDe } else { UserDefaults.patchType = .requests - ServerSidedReminder().activate() + PremiumPatching().activate() } NSLog("[EeveeSpotify] Fetched bootstrap, \(UserDefaults.patchType) was set") diff --git a/Sources/EeveeSpotify/Premium/LikedSongsEnabler.x.swift b/Sources/EeveeSpotify/Premium/LikedSongsEnabler.x.swift new file mode 100644 index 0000000..7179c38 --- /dev/null +++ b/Sources/EeveeSpotify/Premium/LikedSongsEnabler.x.swift @@ -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 { + 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) + } +} diff --git a/Sources/EeveeSpotify/Premium/ServerSidedReminder.x.swift b/Sources/EeveeSpotify/Premium/ServerSidedReminder.x.swift index d4de6ab..b5fb61f 100644 --- a/Sources/EeveeSpotify/Premium/ServerSidedReminder.x.swift +++ b/Sources/EeveeSpotify/Premium/ServerSidedReminder.x.swift @@ -1,10 +1,8 @@ import Orion import UIKit -struct ServerSidedReminder: HookGroup { } - class StreamQualitySettingsSectionHook: ClassHook { - typealias Group = ServerSidedReminder + typealias Group = PremiumPatching static let targetName = "StreamQualitySettingsSection" func shouldResetSelection() -> Bool { @@ -27,7 +25,7 @@ private func showOfflineModePopUp() { } class FTPDownloadActionHook: ClassHook { - typealias Group = ServerSidedReminder + typealias Group = PremiumPatching static let targetName = "ListUXPlatform_FreeTierPlaylistImpl.FTPDownloadAction" func execute(_ idk: Any) { @@ -36,7 +34,7 @@ class FTPDownloadActionHook: ClassHook { } class UIButtonHook: ClassHook { - typealias Group = ServerSidedReminder + typealias Group = PremiumPatching func setHighlighted(_ highlighted: Bool) { diff --git a/Sources/EeveeSpotify/Premium/TrackRowsEnabler.x.swift b/Sources/EeveeSpotify/Premium/TrackRowsEnabler.x.swift index 7d81ca8..73ab869 100644 --- a/Sources/EeveeSpotify/Premium/TrackRowsEnabler.x.swift +++ b/Sources/EeveeSpotify/Premium/TrackRowsEnabler.x.swift @@ -1,7 +1,7 @@ import Orion class SPTFreeTierArtistHubRemoteURLResolverHook: ClassHook { - + typealias Group = PremiumPatching static let targetName = "SPTFreeTierArtistHubRemoteURLResolver" func initWithViewURI( @@ -11,14 +11,11 @@ class SPTFreeTierArtistHubRemoteURLResolverHook: ClassHook { trackRowsEnabled: Bool, productState: SPTCoreProductState ) -> Target { - return orig.initWithViewURI( uri, onDemandSet: onDemandSet, onDemandTrialService: onDemandTrialService, - trackRowsEnabled: UserDefaults.patchType.isPatching - ? true - : trackRowsEnabled, + trackRowsEnabled: true, productState: productState ) } diff --git a/Sources/EeveeSpotify/Tweak.x.swift b/Sources/EeveeSpotify/Tweak.x.swift index 088fd32..ee630bb 100644 --- a/Sources/EeveeSpotify/Tweak.x.swift +++ b/Sources/EeveeSpotify/Tweak.x.swift @@ -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() } } } diff --git a/layout/Library/Application Support/EeveeSpotify.bundle/en.lproj/Localizable.strings b/layout/Library/Application Support/EeveeSpotify.bundle/en.lproj/Localizable.strings index 329e0fc..b9b557d 100644 --- a/layout/Library/Application Support/EeveeSpotify.bundle/en.lproj/Localizable.strings +++ b/layout/Library/Application Support/EeveeSpotify.bundle/en.lproj/Localizable.strings @@ -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"; diff --git a/layout/Library/Application Support/EeveeSpotify.bundle/ru.lproj/Localizable.strings b/layout/Library/Application Support/EeveeSpotify.bundle/ru.lproj/Localizable.strings index 266c6d7..fc84c72 100644 --- a/layout/Library/Application Support/EeveeSpotify.bundle/ru.lproj/Localizable.strings +++ b/layout/Library/Application Support/EeveeSpotify.bundle/ru.lproj/Localizable.strings @@ -99,3 +99,7 @@ unknown_error = "Неизвестная ошибка"; song_is_instrumental = "Это инструментальная композиция."; let_the_music_play = "Пусть заиграет музыка..."; + +// liked songs title, should match official spotify loc + +liked_songs = "Тебе понравилось";