Skip to content

Commit dcde393

Browse files
authored
fix(Spotify - Unlock Premium): Fix hiding context menu ads for latest version (#5415)
1 parent c4673f5 commit dcde393

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

extensions/spotify/src/main/java/app/revanced/extension/spotify/misc/UnlockPremiumPatch.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,13 +97,13 @@ private static class OverrideAttribute {
9797
*/
9898
private static final List<List<ComponentFilter>> CONTEXT_MENU_ITEMS_COMPONENT_FILTERS = List.of(
9999
// "Listen to music ad-free" upsell on playlists.
100-
List.of(new ResourceIdComponentFilter("context_menu_remove_ads", "id")),
100+
List.of(new ResourceIdComponentFilter("context_menu_remove_ads", "string")),
101101
// "Listen to music ad-free" upsell on albums.
102-
List.of(new ResourceIdComponentFilter("playlist_entity_reinventfree_adsfree_context_menu_item", "id")),
102+
List.of(new ResourceIdComponentFilter("playlist_entity_reinventfree_adsfree_context_menu_item", "string")),
103103
// "Start a Jam" context menu item, but only filtered if the user does not have premium and the item is
104104
// being used as a Premium upsell (ad).
105105
List.of(
106-
new ResourceIdComponentFilter("group_session_context_menu_start", "id"),
106+
new ResourceIdComponentFilter("group_session_context_menu_start", "string"),
107107
new StringComponentFilter("isPremiumUpsell=true")
108108
)
109109
);
@@ -227,7 +227,8 @@ public static boolean isFilteredContextMenuItem(Object contextMenuItem) {
227227
if (componentFilter.filterUnavailable()) {
228228
Logger.printInfo(() -> "isFilteredContextMenuItem: Filter " +
229229
componentFilter.getFilterRepresentation() + " not available, skipping");
230-
continue;
230+
allMatch = false;
231+
break;
231232
}
232233

233234
if (!stringifiedContextMenuItem.contains(componentFilter.getFilterValue())) {

patches/src/main/kotlin/app/revanced/patches/spotify/misc/Fingerprints.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ internal val contextMenuViewModelConstructorFingerprint = fingerprint {
4949
/**
5050
* Used to find the interface name of a context menu item.
5151
*/
52-
internal val browsePodcastsContextMenuItemClassFingerprint = fingerprint {
53-
strings("browse_podcast_item", "ui_navigate")
52+
internal val removeAdsContextMenuItemClassFingerprint = fingerprint {
53+
strings("remove_ads_item", "ui_navigate")
5454
}
5555

5656
internal const val CONTEXT_MENU_ITEM_CLASS_DESCRIPTOR_PLACEHOLDER = "Lapp/revanced/ContextMenuItemPlaceholder;"

patches/src/main/kotlin/app/revanced/patches/spotify/misc/UnlockPremiumPatch.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ val unlockPremiumPatch = bytecodePatch(
161161
// minified names used at runtime. The instructions need to match the original names so we can call the
162162
// method in the extension.
163163
extensionFilterContextMenuItemsFingerprint.method.apply {
164-
val contextMenuItemInterfaceClassDef = browsePodcastsContextMenuItemClassFingerprint
164+
val contextMenuItemInterfaceClassDef = removeAdsContextMenuItemClassFingerprint
165165
.originalClassDef
166166
.interfaces
167167
.firstOrNull()

0 commit comments

Comments
 (0)