From 92b588c866ed94d5d74d55aeb60cd44736be33c0 Mon Sep 17 00:00:00 2001 From: brosssh <44944126+brosssh@users.noreply.github.com> Date: Fri, 27 Jun 2025 13:34:13 +0200 Subject: [PATCH] feat(Spotify): Remove ads section from browse (#5193) --- .../spotify/browsita/v1/resolved/Section.java | 6 +++++ .../patches/spotify/misc/Fingerprints.kt | 22 ++++++++++++++----- 2 files changed, 22 insertions(+), 6 deletions(-) create mode 100644 extensions/spotify/stub/src/main/java/com/spotify/browsita/v1/resolved/Section.java diff --git a/extensions/spotify/stub/src/main/java/com/spotify/browsita/v1/resolved/Section.java b/extensions/spotify/stub/src/main/java/com/spotify/browsita/v1/resolved/Section.java new file mode 100644 index 000000000..af3fd9aa3 --- /dev/null +++ b/extensions/spotify/stub/src/main/java/com/spotify/browsita/v1/resolved/Section.java @@ -0,0 +1,6 @@ +package com.spotify.browsita.v1.resolved; + +public final class Section { + public static final int BRAND_ADS_FIELD_NUMBER = 6; + public int sectionTypeCase_; +} diff --git a/patches/src/main/kotlin/app/revanced/patches/spotify/misc/Fingerprints.kt b/patches/src/main/kotlin/app/revanced/patches/spotify/misc/Fingerprints.kt index a797763a0..3ac589fc8 100644 --- a/patches/src/main/kotlin/app/revanced/patches/spotify/misc/Fingerprints.kt +++ b/patches/src/main/kotlin/app/revanced/patches/spotify/misc/Fingerprints.kt @@ -93,18 +93,28 @@ internal val abstractProtobufListEnsureIsMutableFingerprint = fingerprint { } } -internal val homeSectionFingerprint = fingerprint { - custom { _, classDef -> classDef.endsWith("homeapi/proto/Section;") } -} - -internal val homeStructureGetSectionsFingerprint = fingerprint { +private fun structureGetSectionsFingerprint(className: String) = fingerprint { custom { method, classDef -> - classDef.endsWith("homeapi/proto/HomeStructure;") && method.indexOfFirstInstruction { + classDef.endsWith(className) && method.indexOfFirstInstruction { opcode == Opcode.IGET_OBJECT && getReference()?.name == "sections_" } >= 0 } } +internal val homeSectionFingerprint = fingerprint { + custom { _, classDef -> classDef.endsWith("homeapi/proto/Section;") } +} + +internal val homeStructureGetSectionsFingerprint = + structureGetSectionsFingerprint("homeapi/proto/HomeStructure;") + +internal val browseSectionFingerprint = fingerprint { + custom { _, classDef -> classDef.endsWith("browsita/v1/resolved/Section;") } +} + +internal val browseStructureGetSectionsFingerprint = + structureGetSectionsFingerprint("browsita/v1/resolved/BrowseStructure;") + internal fun reactivexFunctionApplyWithClassInitFingerprint(className: String) = fingerprint { returns("Ljava/lang/Object;") parameters("Ljava/lang/Object;")