Skip to content

Commit ea9bf66

Browse files
committed
fixes
1 parent 6b89139 commit ea9bf66

13 files changed

Lines changed: 100 additions & 22 deletions

Sources/EeveeSpotify/Lyrics/CustomLyrics+AllTracksLyrics.x.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class SPTPlayerTrackHook: ClassHook<NSObject> {
2020

2121
guard shouldOverrideLocalTrackURI,
2222
let absoluteString = uri?.absoluteString,
23-
absoluteString.hasPrefix("spotify:local:") else {
23+
absoluteString.isLocalTrackIdentifier else {
2424
return uri
2525
}
2626

Sources/EeveeSpotify/Lyrics/CustomLyrics.x.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,9 @@ func getLyricsDataForCurrentTrack(_ originalPath: String, originalLyrics: Lyrics
128128
throw LyricsError.noCurrentTrack
129129
}
130130

131-
if !originalPath.contains(track.trackIdentifier) {
131+
let trackIdentifier = track.trackIdentifier
132+
133+
if !trackIdentifier.isEmpty && !originalPath.contains(trackIdentifier) {
132134
throw LyricsError.trackMismatch
133135
}
134136

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
extension String {
2+
var isLocalTrackIdentifier: Bool {
3+
self.hasPrefix("spotify:local:")
4+
}
5+
}

Sources/EeveeSpotify/Lyrics/NowPlayingScrollViewControllerInstanceHook.x.swift

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,26 @@ var scrollDataSource: NowPlayingScrollDataSourceImplementation?
88
var nowPlayingScrollViewController: NowPlayingScrollViewController?
99
var npvScrollViewController: NPVScrollViewController?
1010

11+
class LegacyNowPlayingPlatformSwiftServiceImplementationHook: ClassHook<NSObject> {
12+
typealias Group = IOS14PremiumPatchingGroup
13+
static let targetName = "NowPlaying_PlatformImpl.NowPlayingPlatformSwiftServiceImplementation"
14+
15+
func provideStatefulPlayer() -> StatefulPlayerImplementation {
16+
statefulPlayer = orig.provideStatefulPlayer()
17+
return statefulPlayer!
18+
}
19+
}
20+
21+
class NowPlayingPlatformSwiftServiceImplementationHook: ClassHook<NSObject> {
22+
typealias Group = NonIOS14PremiumPatchingGroup
23+
static let targetName = "NowPlaying_PlatformImpl.NowPlayingPlatformSwiftServiceImplementation"
24+
25+
func provideStatefulPlayerWithFeatureIdentifier(_ identifier: NSString) -> StatefulPlayerImplementation {
26+
statefulPlayer = orig.provideStatefulPlayerWithFeatureIdentifier(identifier)
27+
return statefulPlayer!
28+
}
29+
}
30+
1131
class NowPlayingScrollPrivateServiceImplementationHook: ClassHook<NSObject> {
1232
typealias Group = BaseLyricsGroup
1333
static let targetName = "NowPlaying_ScrollImpl.NowPlayingScrollPrivateServiceImplementation"
@@ -22,7 +42,6 @@ class NowPlayingScrollPrivateServiceImplementationHook: ClassHook<NSObject> {
2242
)
2343
}
2444
else {
25-
statefulPlayer = Ivars<StatefulPlayerImplementation>(dependencies).statefulPlayer
2645
scrollDataSource = Ivars<NowPlayingScrollDataSourceImplementation>(target)
2746
.$__lazy_storage_$_scrollDataSource
2847
npvScrollViewController = Dynamic.convert(

Sources/EeveeSpotify/Premium/DynamicPremium+ModifyingFunctions.swift

Lines changed: 50 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,65 @@ import Foundation
22
import UIKit
33

44
func modifyRemoteConfiguration(_ configuration: inout UcsResponse) {
5+
modifyAttributes(&configuration.attributes.accountAttributes)
6+
57
if UserDefaults.overwriteConfiguration {
68
configuration.resolve.configuration = try! BundleHelper.shared.resolveConfiguration()
79
}
8-
9-
modifyAttributes(&configuration.attributes.accountAttributes)
10-
modifyAssignedValues(&configuration.assignedValues)
10+
else {
11+
modifyAssignedValues(&configuration.assignedValues)
12+
}
1113
}
1214

13-
private let propertyToRemoveNames = [
14-
"enable_common_capping",
15-
"enable_pns_common_capping",
16-
"enable_pick_and_shuffle_common_capping",
17-
"enable_pick_and_shuffle_dynamic_cap",
18-
"pick_and_shuffle_timecap", // capping
19-
"should_nova_scroll_use_scrollsita" // 😡😡😡
20-
// spotify, stop changing the scroll logic
15+
private let propertyReplacements = [
16+
// capping
17+
EeveePropertyReplacement(name: "enable_common_capping", modification: .remove),
18+
EeveePropertyReplacement(name: "enable_pns_common_capping", modification: .remove),
19+
EeveePropertyReplacement(name: "enable_pick_and_shuffle_common_capping", modification: .remove),
20+
EeveePropertyReplacement(name: "enable_pick_and_shuffle_dynamic_cap", modification: .remove),
21+
EeveePropertyReplacement(name: "pick_and_shuffle_timecap", modification: .remove),
22+
EeveePropertyReplacement(scope: "ios-feature-queue", modification: .remove),
23+
24+
// also capping idk
25+
EeveePropertyReplacement(name: "enable_free_on_demand_experiment", modification: .remove),
26+
EeveePropertyReplacement(name: "enable_free_on_demand_context_menu_experiment", modification: .remove),
27+
EeveePropertyReplacement(name: "enable_mft_plus_queue", modification: .remove),
28+
EeveePropertyReplacement(name: "enable_mft_plus_extended_queue", modification: .remove),
29+
EeveePropertyReplacement(name: "enable_playback_timeout_service", modification: .setBool(false)),
30+
EeveePropertyReplacement(name: "enable_playback_timeout_error_ui", modification: .setBool(false)),
31+
EeveePropertyReplacement(name: "playback_timeout_action", modification: .setEnum("Nothing")),
32+
EeveePropertyReplacement(name: "is_remove_from_queue_enabled_for_mft_plus", modification: .remove),
33+
EeveePropertyReplacement(name: "is_reordering_for_mft_plus_allowed", modification: .remove),
34+
35+
// 😡😡😡 spotify, stop changing the scroll logic
36+
EeveePropertyReplacement(name: "should_nova_scroll_use_scrollsita", modification: .remove)
2137
]
2238

23-
func modifyAssignedValues(_ values: inout [AssignedValue]) {
24-
values.removeAll(where: { propertyToRemoveNames.contains($0.propertyID.name) })
25-
values.removeAll(where: { $0.propertyID.scope == "ios-feature-queue" })
39+
private func modifyAssignedValues(_ values: inout [AssignedValue]) {
40+
for replacement in propertyReplacements {
41+
let matchingIndices = values.indices.filter({ index in
42+
let value = values[index]
43+
let nameMatches = replacement.name.map { value.propertyID.name == $0 } ?? true
44+
let scopeMatches = replacement.scope.map { value.propertyID.scope == $0 } ?? true
45+
return nameMatches && scopeMatches
46+
})
47+
48+
for index in matchingIndices.sorted(by: >) {
49+
switch replacement.modification {
50+
case .remove:
51+
values.remove(at: index)
52+
53+
case .setBool(let newValue):
54+
values[index].boolValue = BoolValue.with { $0.value = newValue }
55+
56+
case .setEnum(let newValue):
57+
values[index].enumValue = EnumValue.with { $0.value = newValue }
58+
}
59+
}
60+
}
2661
}
2762

28-
func modifyAttributes(_ attributes: inout [String: AccountAttribute]) {
63+
private func modifyAttributes(_ attributes: inout [String: AccountAttribute]) {
2964
let oneYearFromNow = Calendar.current.date(byAdding: .year, value: 1, to: Date())!
3065

3166
let formatter = ISO8601DateFormatter()

Sources/EeveeSpotify/Premium/Models/PatchType.swift renamed to Sources/EeveeSpotify/Premium/Models/EeveePatchType.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import Foundation
22

3-
enum PatchType: Int {
3+
enum EeveePatchType: Int {
44
case notSet
55
case disabled
66
case requests
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
enum EeveePropertyModification {
2+
case remove
3+
case setBool(Bool)
4+
case setEnum(String)
5+
}
6+
7+
struct EeveePropertyReplacement {
8+
let scope: String?
9+
let name: String?
10+
let modification: EeveePropertyModification
11+
12+
init(name: String? = nil, scope: String? = nil, modification: EeveePropertyModification) {
13+
self.name = name
14+
self.scope = scope
15+
self.modification = modification
16+
}
17+
}

Sources/EeveeSpotify/Premium/Models/Account.pb.swift renamed to Sources/EeveeSpotify/Premium/Models/Protobuf/Account.pb.swift

File renamed without changes.

Sources/EeveeSpotify/Premium/Models/PremiumPlanRow.pb.swift renamed to Sources/EeveeSpotify/Premium/Models/Protobuf/PremiumPlanRow.pb.swift

File renamed without changes.

Sources/EeveeSpotify/Premium/Models/SpotifyPlan.pb.swift renamed to Sources/EeveeSpotify/Premium/Models/Protobuf/SpotifyPlan.pb.swift

File renamed without changes.

0 commit comments

Comments
 (0)