Skip to content

Commit 498ebd8

Browse files
committed
fixes
1 parent 8f8ead1 commit 498ebd8

3 files changed

Lines changed: 88 additions & 35 deletions

File tree

Sources/EeveeSpotify/Premium/DynamicPremium+ModifyingFunctions.swift

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,18 @@ func modifyRemoteConfiguration(_ configuration: inout UcsResponse) {
1010
modifyAssignedValues(&configuration.assignedValues)
1111
}
1212

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
21+
]
22+
1323
func modifyAssignedValues(_ values: inout [AssignedValue]) {
14-
if let index = values.firstIndex(where: { $0.propertyID.name == "enable_pick_and_shuffle_common_capping" }) {
15-
values[index].enumValue = EnumValue.with {
16-
$0.value = "Disabled"
17-
}
18-
}
19-
20-
if let index = values.firstIndex(where: { $0.propertyID.name == "enable_pick_and_shuffle_dynamic_cap" }) {
21-
values[index].boolValue = BoolValue.with {
22-
$0.value = false
23-
}
24-
}
25-
26-
values.removeAll(where: { $0.propertyID.name == "pick_and_shuffle_timecap" })
24+
values.removeAll(where: { propertyToRemoveNames.contains($0.propertyID.name) })
2725
values.removeAll(where: { $0.propertyID.scope == "ios-feature-queue" })
2826
}
2927

Sources/EeveeSpotify/Premium/ServerSidedReminder.x.swift

Lines changed: 62 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,31 @@ private func showHighQualityPopUp() {
88
)
99
}
1010

11+
private func showPlaylistDownloadingPopUp(_ isPlaylist: Bool, onSecondaryClick: (() -> Void)?) {
12+
PopUpHelper.showPopUp(
13+
message: "playlist_downloading_popup".localized,
14+
buttonText: "OK".uiKitLocalized,
15+
secondButtonText: isPlaylist
16+
? "download_local_playlist".localized
17+
: nil,
18+
onSecondaryClick: onSecondaryClick
19+
)
20+
}
21+
22+
//
23+
24+
class StreamQualitySettingsSectionHook: ClassHook<NSObject> {
25+
typealias Group = IOS14PremiumPatchingGroup
26+
static let targetName = "StreamQualitySettingsSection"
27+
28+
func shouldResetSelection() -> Bool {
29+
showHighQualityPopUp()
30+
return true
31+
}
32+
}
33+
1134
class ListRowInteractionListenerViewHook: ClassHook<UIView> {
12-
typealias Group = ModernPremiumPatchingGroup
35+
typealias Group = NonIOS14PremiumPatchingGroup
1336
static let targetName = "_TtC15Settings_ECMKit30ListRowInteractionListenerView"
1437

1538
func performAction() {
@@ -25,18 +48,10 @@ class ListRowInteractionListenerViewHook: ClassHook<UIView> {
2548
}
2649
}
2750

28-
class StreamQualitySettingsSectionHook: ClassHook<NSObject> {
29-
typealias Group = LegacyPremiumPatchingGroup
30-
static let targetName = "StreamQualitySettingsSection"
31-
32-
func shouldResetSelection() -> Bool {
33-
showHighQualityPopUp()
34-
return true
35-
}
36-
}
51+
//
3752

3853
class ContentOffliningUIHelperImplementationHook: ClassHook<NSObject> {
39-
typealias Group = BasePremiumPatchingGroup
54+
typealias Group = IOS14And15PremiumPatchingGroup
4055
static let targetName = "Offline_ContentOffliningUIImpl.ContentOffliningUIHelperImplementation"
4156

4257
func downloadToggledWithCurrentAvailability(
@@ -48,13 +63,9 @@ class ContentOffliningUIHelperImplementationHook: ClassHook<NSObject> {
4863
) {
4964
let isPlaylist = Dynamic.convert(pageURI, to: SPTURL.self)
5065
.isPlaylistURL()
51-
52-
PopUpHelper.showPopUp(
53-
message: "playlist_downloading_popup".localized,
54-
buttonText: "OK".uiKitLocalized,
55-
secondButtonText: isPlaylist
56-
? "download_local_playlist".localized
57-
: nil,
66+
67+
showPlaylistDownloadingPopUp(
68+
isPlaylist,
5869
onSecondaryClick: isPlaylist
5970
? {
6071
self.orig.downloadToggledWithCurrentAvailability(
@@ -69,3 +80,36 @@ class ContentOffliningUIHelperImplementationHook: ClassHook<NSObject> {
6980
)
7081
}
7182
}
83+
84+
class ContentOffliningUIHelperImplementationModernHook: ClassHook<NSObject> {
85+
typealias Group = LatestPremiumPatchingGroup
86+
static let targetName = "Offline_ContentOffliningUIImpl.ContentOffliningUIHelperImplementation"
87+
88+
func downloadToggledWithCurrentAvailability(
89+
_ availability: NSInteger,
90+
addAction: NSObject,
91+
removeAction: NSObject,
92+
pageIdentifier: NSString,
93+
pageURI: NSURL,
94+
interactionID: NSString
95+
) {
96+
let isPlaylist = Dynamic.convert(pageURI, to: SPTURL.self)
97+
.isPlaylistURL()
98+
99+
showPlaylistDownloadingPopUp(
100+
isPlaylist,
101+
onSecondaryClick: isPlaylist
102+
? {
103+
self.orig.downloadToggledWithCurrentAvailability(
104+
availability,
105+
addAction: addAction,
106+
removeAction: removeAction,
107+
pageIdentifier: pageIdentifier,
108+
pageURI: pageURI,
109+
interactionID: interactionID
110+
)
111+
}
112+
: nil
113+
)
114+
}
115+
}

Sources/EeveeSpotify/Tweak.x.swift

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,26 @@ func exitApplication() {
1111

1212
struct BasePremiumPatchingGroup: HookGroup { }
1313

14-
struct LegacyPremiumPatchingGroup: HookGroup { }
15-
struct ModernPremiumPatchingGroup: HookGroup { }
14+
struct IOS14PremiumPatchingGroup: HookGroup { }
15+
struct NonIOS14PremiumPatchingGroup: HookGroup { }
16+
struct IOS14And15PremiumPatchingGroup: HookGroup { }
17+
struct LatestPremiumPatchingGroup: HookGroup { }
1618

1719
func activatePremiumPatchingGroup() {
1820
BasePremiumPatchingGroup().activate()
1921

2022
if EeveeSpotify.hookTarget == .lastAvailableiOS14 {
21-
LegacyPremiumPatchingGroup().activate()
23+
IOS14PremiumPatchingGroup().activate()
2224
}
2325
else {
24-
ModernPremiumPatchingGroup().activate()
26+
NonIOS14PremiumPatchingGroup().activate()
27+
28+
if EeveeSpotify.hookTarget == .lastAvailableiOS15 {
29+
IOS14And15PremiumPatchingGroup().activate()
30+
}
31+
else {
32+
LatestPremiumPatchingGroup().activate()
33+
}
2534
}
2635
}
2736

@@ -42,6 +51,8 @@ struct EeveeSpotify: Tweak {
4251
}
4352

4453
init() {
54+
OfflineHelper.resetData(clearCaches: true)
55+
4556
if UserDefaults.experimentsOptions.showInstagramDestination {
4657
InstgramDestinationGroup().activate()
4758
}

0 commit comments

Comments
 (0)