Skip to content

Commit 8b9e044

Browse files
NuckyzoSumAtrIX
andauthored
fix(Spotify - Unlock Premium): Fix hiding context menu ads on newest versions (#5318)
Co-authored-by: oSumAtrIX <[email protected]>
1 parent d3c9dc6 commit 8b9e044

File tree

2 files changed

+32
-2
lines changed

2 files changed

+32
-2
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package app.revanced;
2+
3+
public interface ContextMenuItemPlaceholder {
4+
Object getViewModel();
5+
}

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

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,10 @@ internal val contextMenuViewModelClassFingerprint = fingerprint {
4242
strings("ContextMenuViewModel(header=")
4343
}
4444

45-
internal val contextMenuViewModelAddItemFingerprint = fingerprint {
45+
/**
46+
* Used in versions older than "9.0.60.128".
47+
*/
48+
internal val oldContextMenuViewModelAddItemFingerprint = fingerprint {
4649
parameters("L")
4750
returns("V")
4851
custom { method, _ ->
@@ -52,6 +55,28 @@ internal val contextMenuViewModelAddItemFingerprint = fingerprint {
5255
}
5356
}
5457

58+
internal val contextMenuViewModelConstructorFingerprint = fingerprint {
59+
accessFlags(AccessFlags.PUBLIC, AccessFlags.CONSTRUCTOR)
60+
parameters("L", "Z", "Ljava/util/List;")
61+
}
62+
63+
/**
64+
* Used to find the interface name of a context menu item.
65+
*/
66+
internal val browsePodcastsContextMenuItemClassFingerprint = fingerprint {
67+
strings("browse_podcast_item", "ui_navigate")
68+
}
69+
70+
internal const val CONTEXT_MENU_ITEM_PLACEHOLDER_CLASS_NAME = "Lapp/revanced/ContextMenuItemPlaceholder;"
71+
internal val extensionFilterContextMenuItemsFingerprint = fingerprint {
72+
accessFlags(AccessFlags.PUBLIC, AccessFlags.STATIC)
73+
returns("Ljava/util/List;")
74+
parameters("Ljava/util/List;")
75+
custom { method, classDef ->
76+
method.name == "filterContextMenuItems" && classDef.type == EXTENSION_CLASS_DESCRIPTOR
77+
}
78+
}
79+
5580
internal val getViewModelFingerprint = fingerprint {
5681
custom { method, _ -> method.name == "getViewModel" }
5782
}
@@ -93,7 +118,7 @@ internal val abstractProtobufListEnsureIsMutableFingerprint = fingerprint {
93118
}
94119
}
95120

96-
private fun structureGetSectionsFingerprint(className: String) = fingerprint {
121+
internal fun structureGetSectionsFingerprint(className: String) = fingerprint {
97122
custom { method, classDef ->
98123
classDef.endsWith(className) && method.indexOfFirstInstruction {
99124
opcode == Opcode.IGET_OBJECT && getReference<FieldReference>()?.name == "sections_"

0 commit comments

Comments
 (0)