diff --git a/Sources/EeveeSpotify/Premium/DynamicPremium+ModifyingFunctions.swift b/Sources/EeveeSpotify/Premium/DynamicPremium+ModifyingFunctions.swift index 6da5a7d..5957194 100644 --- a/Sources/EeveeSpotify/Premium/DynamicPremium+ModifyingFunctions.swift +++ b/Sources/EeveeSpotify/Premium/DynamicPremium+ModifyingFunctions.swift @@ -10,20 +10,18 @@ func modifyRemoteConfiguration(_ configuration: inout UcsResponse) { modifyAssignedValues(&configuration.assignedValues) } +private let propertyToRemoveNames = [ + "enable_common_capping", + "enable_pns_common_capping", + "enable_pick_and_shuffle_common_capping", + "enable_pick_and_shuffle_dynamic_cap", + "pick_and_shuffle_timecap", // capping + "should_nova_scroll_use_scrollsita" // 😡😡😡 + // spotify, stop changing the scroll logic +] + func modifyAssignedValues(_ values: inout [AssignedValue]) { - if let index = values.firstIndex(where: { $0.propertyID.name == "enable_pick_and_shuffle_common_capping" }) { - values[index].enumValue = EnumValue.with { - $0.value = "Disabled" - } - } - - if let index = values.firstIndex(where: { $0.propertyID.name == "enable_pick_and_shuffle_dynamic_cap" }) { - values[index].boolValue = BoolValue.with { - $0.value = false - } - } - - values.removeAll(where: { $0.propertyID.name == "pick_and_shuffle_timecap" }) + values.removeAll(where: { propertyToRemoveNames.contains($0.propertyID.name) }) values.removeAll(where: { $0.propertyID.scope == "ios-feature-queue" }) } diff --git a/Sources/EeveeSpotify/Premium/ServerSidedReminder.x.swift b/Sources/EeveeSpotify/Premium/ServerSidedReminder.x.swift index 9b96ea2..d093d32 100644 --- a/Sources/EeveeSpotify/Premium/ServerSidedReminder.x.swift +++ b/Sources/EeveeSpotify/Premium/ServerSidedReminder.x.swift @@ -8,8 +8,31 @@ private func showHighQualityPopUp() { ) } +private func showPlaylistDownloadingPopUp(_ isPlaylist: Bool, onSecondaryClick: (() -> Void)?) { + PopUpHelper.showPopUp( + message: "playlist_downloading_popup".localized, + buttonText: "OK".uiKitLocalized, + secondButtonText: isPlaylist + ? "download_local_playlist".localized + : nil, + onSecondaryClick: onSecondaryClick + ) +} + +// + +class StreamQualitySettingsSectionHook: ClassHook { + typealias Group = IOS14PremiumPatchingGroup + static let targetName = "StreamQualitySettingsSection" + + func shouldResetSelection() -> Bool { + showHighQualityPopUp() + return true + } +} + class ListRowInteractionListenerViewHook: ClassHook { - typealias Group = ModernPremiumPatchingGroup + typealias Group = NonIOS14PremiumPatchingGroup static let targetName = "_TtC15Settings_ECMKit30ListRowInteractionListenerView" func performAction() { @@ -25,18 +48,10 @@ class ListRowInteractionListenerViewHook: ClassHook { } } -class StreamQualitySettingsSectionHook: ClassHook { - typealias Group = LegacyPremiumPatchingGroup - static let targetName = "StreamQualitySettingsSection" - - func shouldResetSelection() -> Bool { - showHighQualityPopUp() - return true - } -} +// class ContentOffliningUIHelperImplementationHook: ClassHook { - typealias Group = BasePremiumPatchingGroup + typealias Group = IOS14And15PremiumPatchingGroup static let targetName = "Offline_ContentOffliningUIImpl.ContentOffliningUIHelperImplementation" func downloadToggledWithCurrentAvailability( @@ -48,13 +63,9 @@ class ContentOffliningUIHelperImplementationHook: ClassHook { ) { let isPlaylist = Dynamic.convert(pageURI, to: SPTURL.self) .isPlaylistURL() - - PopUpHelper.showPopUp( - message: "playlist_downloading_popup".localized, - buttonText: "OK".uiKitLocalized, - secondButtonText: isPlaylist - ? "download_local_playlist".localized - : nil, + + showPlaylistDownloadingPopUp( + isPlaylist, onSecondaryClick: isPlaylist ? { self.orig.downloadToggledWithCurrentAvailability( @@ -69,3 +80,36 @@ class ContentOffliningUIHelperImplementationHook: ClassHook { ) } } + +class ContentOffliningUIHelperImplementationModernHook: ClassHook { + typealias Group = LatestPremiumPatchingGroup + static let targetName = "Offline_ContentOffliningUIImpl.ContentOffliningUIHelperImplementation" + + func downloadToggledWithCurrentAvailability( + _ availability: NSInteger, + addAction: NSObject, + removeAction: NSObject, + pageIdentifier: NSString, + pageURI: NSURL, + interactionID: NSString + ) { + let isPlaylist = Dynamic.convert(pageURI, to: SPTURL.self) + .isPlaylistURL() + + showPlaylistDownloadingPopUp( + isPlaylist, + onSecondaryClick: isPlaylist + ? { + self.orig.downloadToggledWithCurrentAvailability( + availability, + addAction: addAction, + removeAction: removeAction, + pageIdentifier: pageIdentifier, + pageURI: pageURI, + interactionID: interactionID + ) + } + : nil + ) + } +} diff --git a/Sources/EeveeSpotify/Tweak.x.swift b/Sources/EeveeSpotify/Tweak.x.swift index 04097f1..935e49e 100644 --- a/Sources/EeveeSpotify/Tweak.x.swift +++ b/Sources/EeveeSpotify/Tweak.x.swift @@ -11,17 +11,26 @@ func exitApplication() { struct BasePremiumPatchingGroup: HookGroup { } -struct LegacyPremiumPatchingGroup: HookGroup { } -struct ModernPremiumPatchingGroup: HookGroup { } +struct IOS14PremiumPatchingGroup: HookGroup { } +struct NonIOS14PremiumPatchingGroup: HookGroup { } +struct IOS14And15PremiumPatchingGroup: HookGroup { } +struct LatestPremiumPatchingGroup: HookGroup { } func activatePremiumPatchingGroup() { BasePremiumPatchingGroup().activate() if EeveeSpotify.hookTarget == .lastAvailableiOS14 { - LegacyPremiumPatchingGroup().activate() + IOS14PremiumPatchingGroup().activate() } else { - ModernPremiumPatchingGroup().activate() + NonIOS14PremiumPatchingGroup().activate() + + if EeveeSpotify.hookTarget == .lastAvailableiOS15 { + IOS14And15PremiumPatchingGroup().activate() + } + else { + LatestPremiumPatchingGroup().activate() + } } } @@ -42,6 +51,8 @@ struct EeveeSpotify: Tweak { } init() { + OfflineHelper.resetData(clearCaches: true) + if UserDefaults.experimentsOptions.showInstagramDestination { InstgramDestinationGroup().activate() }