Skip to content

Commit

Permalink
something
Browse files Browse the repository at this point in the history
  • Loading branch information
whoeevee committed Jun 2, 2024
1 parent 400a289 commit e258ebc
Show file tree
Hide file tree
Showing 23 changed files with 461 additions and 381 deletions.
8 changes: 7 additions & 1 deletion EeveeSpotify.plist
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
{ Filter = { Bundles = ( "com.spotify.client" ); }; }
{
Filter = {
Bundles = (
"com.spotify.client",
);
};
}
2 changes: 1 addition & 1 deletion Sources/EeveeSpotify/DataLoaderServiceHooks.x.swift
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ class SPTDataLoaderServiceHook: ClassHook<NSObject> {
OfflineHelper.dataBuffer = Data()

var customizeMessage = try CustomizeMessage(serializedData: buffer)
modifyAttributes(&customizeMessage.response.attributes.accountAttributes)
modifyRemoteConfiguration(&customizeMessage.response)

orig.URLSession(
session,
Expand Down
1 change: 0 additions & 1 deletion Sources/EeveeSpotify/Helpers/PopUpHelper.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import UIKit
import Orion
import Foundation

class PopUpHelper {

Expand Down
1 change: 0 additions & 1 deletion Sources/EeveeSpotify/Helpers/WindowHelper.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import UIKit
import Foundation

class WindowHelper {

Expand Down
3 changes: 1 addition & 2 deletions Sources/EeveeSpotify/Lyrics/Helpers/LyricsHelper.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import UIKit
import Foundation

class LyricsHelper {

Expand Down Expand Up @@ -40,7 +39,7 @@ class LyricsHelper {
lyricLines = lines.map { line in

let match = line.firstMatch(
"\\[(?<minute>\\d{2}):(?<seconds>\\d{2}\\.\\d{2})\\] ?(?<content>.*)"
"\\[(?<minute>\\d{2}):(?<seconds>\\d{2}\\.?\\d*)\\] ?(?<content>.*)"
)!

var captures: [String: String] = [:]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ enum GeniusDataResponse: Decodable {
)
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ import Foundation
struct GeniusHitResult: Decodable {
var id: Int
var title: String
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,4 @@ extension String {
withTemplate: ""
)
}
}
}
84 changes: 84 additions & 0 deletions Sources/EeveeSpotify/Premium/DynamicPremium+ModifyFunctions.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
import Foundation

func modifyRemoteConfiguration(_ configuration: inout UcsResponse) {
modifyAttributes(&configuration.attributes.accountAttributes)
}

func modifyAttributes(_ attributes: inout [String: AccountAttribute]) {

attributes["type"] = AccountAttribute.with {
$0.stringValue = "premium"
}
attributes["player-license"] = AccountAttribute.with {
$0.stringValue = "premium"
}
attributes["financial-product"] = AccountAttribute.with {
$0.stringValue = "pr:premium,tc:0"
}
attributes["name"] = AccountAttribute.with {
$0.stringValue = "Spotify Premium"
}
attributes["payments-initial-campaign"] = AccountAttribute.with {
$0.stringValue = "default"
}

//

attributes["unrestricted"] = AccountAttribute.with {
$0.boolValue = true
}
attributes["catalogue"] = AccountAttribute.with {
$0.stringValue = "premium"
}
attributes["streaming-rules"] = AccountAttribute.with {
$0.stringValue = ""
}
attributes["pause-after"] = AccountAttribute.with {
$0.longValue = 0
}
attributes["on-demand"] = AccountAttribute.with {
$0.boolValue = true
}

//

attributes["ads"] = AccountAttribute.with {
$0.boolValue = false
}

attributes.removeValue(forKey: "ad-use-adlogic")
attributes.removeValue(forKey: "ad-catalogues")

//

attributes["shuffle-eligible"] = AccountAttribute.with {
$0.boolValue = true
}
attributes["high-bitrate"] = AccountAttribute.with {
$0.boolValue = true
}
attributes["offline"] = AccountAttribute.with {
$0.boolValue = true
}
attributes["nft-disabled"] = AccountAttribute.with {
$0.stringValue = "1"
}
attributes["can_use_superbird"] = AccountAttribute.with {
$0.boolValue = true
}
attributes["social-session"] = AccountAttribute.with {
$0.boolValue = true
}
attributes["social-session-free-tier"] = AccountAttribute.with {
$0.boolValue = false
}

//

attributes["com.spotify.madprops.delivered.by.ucs"] = AccountAttribute.with {
$0.boolValue = true
}
attributes["com.spotify.madprops.use.ucs.product.state"] = AccountAttribute.with {
$0.boolValue = true
}
}
66 changes: 1 addition & 65 deletions Sources/EeveeSpotify/Premium/DynamicPremium.x.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,70 +20,6 @@ func showOfflineBnkMethodSetPopUp() {
)
}

func modifyAttributes(_ attributes: inout [String: AccountAttribute]) {

attributes["type"] = AccountAttribute.with {
$0.stringValue = "premium"
}
attributes["player-license"] = AccountAttribute.with {
$0.stringValue = "premium"
}
attributes["financial-product"] = AccountAttribute.with {
$0.stringValue = "pr:premium,tc:0"
}
attributes["name"] = AccountAttribute.with {
$0.stringValue = "Spotify Premium"
}

//

attributes["unrestricted"] = AccountAttribute.with {
$0.boolValue = true
}
attributes["catalogue"] = AccountAttribute.with {
$0.stringValue = "premium"
}
attributes["streaming-rules"] = AccountAttribute.with {
$0.stringValue = ""
}
attributes["pause-after"] = AccountAttribute.with {
$0.longValue = 0
}

//

attributes["ads"] = AccountAttribute.with {
$0.boolValue = false
}

attributes.removeValue(forKey: "ad-use-adlogic")
attributes.removeValue(forKey: "ad-catalogues")

//

attributes["shuffle-eligible"] = AccountAttribute.with {
$0.boolValue = true
}
attributes["high-bitrate"] = AccountAttribute.with {
$0.boolValue = true
}
attributes["offline"] = AccountAttribute.with {
$0.boolValue = true
}
attributes["nft-disabled"] = AccountAttribute.with {
$0.stringValue = "1"
}
attributes["can_use_superbird"] = AccountAttribute.with {
$0.boolValue = true
}

//

attributes["com.spotify.madprops.use.ucs.product.state"] = AccountAttribute.with {
$0.boolValue = true
}
}

class SPTCoreURLSessionDataDelegateHook: ClassHook<NSObject> {

static let targetName = "SPTCoreURLSessionDataDelegate"
Expand Down Expand Up @@ -128,7 +64,7 @@ class SPTCoreURLSessionDataDelegateHook: ClassHook<NSObject> {

if UserDefaults.patchType == .requests {

modifyAttributes(&bootstrapMessage.attributes)
modifyRemoteConfiguration(&bootstrapMessage.ucsResponse)

orig.URLSession(
session,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
//
// File.swift
//
//
// Created by eevee on 28/05/2024.
//

import Foundation

extension BootstrapMessage {

var attributes: [String: AccountAttribute] {
var ucsResponse: UcsResponse {
get {
self.wrapper.oneMoreWrapper.message.response
}
set(ucsResponse) {
self.wrapper.oneMoreWrapper.message.response = ucsResponse
}
}

var attributes: Dictionary<String, AccountAttribute> {
get {
self.wrapper.oneMoreWrapper.message.response.attributes.accountAttributes
self.ucsResponse.attributes.accountAttributes
}
set(attributes) {
self.wrapper.oneMoreWrapper.message.response.attributes.accountAttributes = attributes
self.ucsResponse.attributes.accountAttributes = attributes
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import Foundation

extension UcsResponse {

var assignedValues: [AssignedValue] {
get {
self.resolve.configuration.assignedValues
}
set(assignedValues) {
self.resolve.configuration.assignedValues = assignedValues
}
}
}
25 changes: 25 additions & 0 deletions Sources/EeveeSpotify/Premium/TrackRowsEnabler.x.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import Orion

class SPTFreeTierArtistHubRemoteURLResolverHook: ClassHook<NSObject> {

static let targetName = "SPTFreeTierArtistHubRemoteURLResolver"

func initWithViewURI(
_ uri: NSURL,
onDemandSet: Any,
onDemandTrialService: Any,
trackRowsEnabled: Bool,
productState: SPTCoreProductState
) -> Target {

return orig.initWithViewURI(
uri,
onDemandSet: onDemandSet,
onDemandTrialService: onDemandTrialService,
trackRowsEnabled: UserDefaults.patchType.isPatching
? true
: trackRowsEnabled,
productState: productState
)
}
}
55 changes: 55 additions & 0 deletions Sources/EeveeSpotify/Settings/EeveeSettings.x.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import Orion
import UIKit

class ProfileSettingsSectionHook: ClassHook<NSObject> {

static let targetName = "ProfileSettingsSection"

func numberOfRows() -> Int {
return 2
}

func didSelectRow(_ row: Int) {

if row == 1 {

let rootSettingsController = WindowHelper.shared.findFirstViewController(
"RootSettingsViewController"
)!

let eeveeSettingsController = EeveeSettingsViewController(rootSettingsController.view.bounds)

rootSettingsController.navigationController!.pushViewController(
eeveeSettingsController,
animated: true
)

return
}

orig.didSelectRow(row)
}

func cellForRow(_ row: Int) -> UITableViewCell {

if row == 1 {

let settingsTableCell = Dynamic.SPTSettingsTableViewCell
.alloc(interface: SPTSettingsTableViewCell.self)
.initWithStyle(3, reuseIdentifier: "EeveeSpotify")

let tableViewCell = Dynamic.convert(settingsTableCell, to: UITableViewCell.self)

tableViewCell.accessoryView = type(
of: Dynamic.SPTDisclosureAccessoryView
.alloc(interface: SPTDisclosureAccessoryView.self)
)
.disclosureAccessoryView()

tableViewCell.textLabel?.text = "EeveeSpotify"
return tableViewCell
}

return orig.cellForRow(row)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import SwiftUI
import UIKit

class EeveeSettingsViewController: SPTPageViewController {

let frame: CGRect

init(_ frame: CGRect) {
self.frame = frame
super.init(nibName: nil, bundle: nil)
}

required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}

override func viewDidLoad() {
super.viewDidLoad()

self.title = "EeveeSpotify"

let hostingController = UIHostingController(rootView: EeveeSettingsView())
hostingController.view.frame = frame

view.addSubview(hostingController.view)
addChild(hostingController)
hostingController.didMove(toParent: self)
}
}
Loading

0 comments on commit e258ebc

Please sign in to comment.