Skip to content

Commit 3a81587

Browse files
committed
Sync v5.31.1
* **Spotify - Unlock Premium:** Fix hiding context menu ads for latest version * **Spotify - Unlock Premium:** Remove wrongfully hidden non ad browse sections * **Spotify:** Remove other ads type from the browse screen * **Spotify:** Remove support for old versions * **YouTube - Hide ads:** Hide new type of general ad
1 parent ae119b4 commit 3a81587

File tree

5 files changed

+47
-52
lines changed

5 files changed

+47
-52
lines changed

app/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ android {
1515
applicationId = "io.github.chsbuffer.revancedxposed"
1616
versionCode = 20
1717
versionName = "1.0.$versionCode"
18-
val patchVersion = "5.30.0"
18+
val patchVersion = "5.31.1"
1919
buildConfigField("String", "PATCH_VERSION", "\"$patchVersion\"")
2020
}
2121
flavorDimensions += "abi"

app/src/main/java/io/github/chsbuffer/revancedxposed/spotify/SanitizeSharingLinks.kt

Lines changed: 37 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -5,26 +5,26 @@ import app.revanced.extension.spotify.misc.privacy.SanitizeSharingLinksPatch
55
import de.robv.android.xposed.XC_MethodHook
66
import de.robv.android.xposed.XposedHelpers
77
import io.github.chsbuffer.revancedxposed.ScopedHook
8-
import io.github.chsbuffer.revancedxposed.strings
8+
import io.github.chsbuffer.revancedxposed.fingerprint
99
import java.lang.reflect.Modifier
1010

1111
fun SpotifyHook.SanitizeSharingLinks() {
1212
getDexMethod("shareCopyUrlFingerprint") {
13-
findMethod {
14-
matcher {
15-
if (IS_SPOTIFY_LEGACY_APP_TARGET) {
16-
returnType("java.lang.Object")
17-
paramTypes("java.lang.Object")
18-
strings("clipboard", "createNewSession failed")
19-
name("apply")
20-
} else {
21-
returnType("java.lang.Object")
22-
paramTypes("java.lang.Object")
23-
strings("clipboard", "Spotify Link")
24-
name("invokeSuspend")
25-
}
13+
runCatching {
14+
fingerprint {
15+
returns("Ljava/lang/Object;")
16+
parameters("Ljava/lang/Object;")
17+
strings("clipboard", "Spotify Link")
18+
methodMatcher { name = "invokeSuspend" }
19+
}
20+
}.getOrElse {
21+
fingerprint {
22+
returns("Ljava/lang/Object;")
23+
parameters("Ljava/lang/Object;")
24+
strings("clipboard", "createNewSession failed")
25+
methodMatcher { name = "apply" }
2626
}
27-
}.single()
27+
}
2828
}.hookMethod(
2929
ScopedHook(
3030
XposedHelpers.findMethodExact(
@@ -43,22 +43,32 @@ fun SpotifyHook.SanitizeSharingLinks() {
4343
)
4444

4545
getDexMethod("formatAndroidShareSheetUrlFingerprint") {
46-
findMethod {
47-
matcher {
48-
returnType("java.lang.String")
49-
addUsingNumber('\n'.code)
50-
if (IS_SPOTIFY_LEGACY_APP_TARGET) {
51-
modifiers = Modifier.PUBLIC
52-
paramTypes("com.spotify.share.social.sharedata.ShareData", "java.lang.String")
53-
} else {
46+
runCatching {
47+
findMethod {
48+
matcher {
49+
returnType("java.lang.String")
50+
addUsingNumber('\n'.code)
5451
modifiers = Modifier.PUBLIC or Modifier.STATIC
5552
paramTypes(null, "java.lang.String")
5653
}
54+
}.single {
55+
// exclude
56+
// `(PlayerState, String) -> String` usingNumbers(1, 10); usingStrings("")
57+
!it.usingStrings.contains("")
58+
}
59+
}.getOrElse {
60+
findMethod {
61+
matcher {
62+
returnType("java.lang.String")
63+
addUsingNumber('\n'.code)
64+
modifiers = Modifier.PUBLIC
65+
paramTypes("com.spotify.share.social.sharedata.ShareData", "java.lang.String")
66+
}
67+
}.single {
68+
// exclude
69+
// `(PlayerState, String) -> String` usingNumbers(1, 10); usingStrings("")
70+
!it.usingStrings.contains("")
5771
}
58-
}.single {
59-
// exclude
60-
// `(PlayerState, String) -> String` usingNumbers(1, 10); usingStrings("")
61-
!it.usingStrings.contains("")
6272
}
6373
}.hookMethod(object : XC_MethodHook() {
6474
override fun beforeHookedMethod(param: MethodHookParam) {

app/src/main/java/io/github/chsbuffer/revancedxposed/spotify/SpotifyHook.kt

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import android.content.Context
66
import app.revanced.extension.shared.Logger
77
import app.revanced.extension.shared.Utils
88
import app.revanced.extension.spotify.misc.UnlockPremiumPatch
9+
import com.spotify.remoteconfig.internal.AccountAttribute
910
import de.robv.android.xposed.XC_MethodHook
1011
import de.robv.android.xposed.XposedBridge
1112
import de.robv.android.xposed.XposedHelpers
@@ -34,9 +35,6 @@ class SpotifyHook(app: Application, lpparam: LoadPackageParam) : BaseHook(app, l
3435
::UnlockPremium,
3536
)
3637

37-
val IS_SPOTIFY_LEGACY_APP_TARGET =
38-
runCatching { classLoader.loadClass("com.spotify.music.MainActivity") }.isSuccess
39-
4038
fun Extension() {
4139
// Logger
4240
Utils.setContext(app)
@@ -77,16 +75,10 @@ class SpotifyHook(app: Application, lpparam: LoadPackageParam) : BaseHook(app, l
7775
fun SpotifyHook.UnlockPremium() {
7876
// Override the attributes map in the getter method.
7977
getDexMethod("productStateProtoFingerprint") {
80-
findClass {
81-
matcher {
82-
if (IS_SPOTIFY_LEGACY_APP_TARGET) className("com.spotify.ucs.proto.v0.UcsResponseWrapper\$AccountAttributesResponse")
83-
else className("com.spotify.remoteconfig.internal.ProductStateProto")
84-
}
85-
}.findMethod {
86-
matcher {
87-
returnType = "java.util.Map"
88-
}
89-
}.single().also { method ->
78+
fingerprint {
79+
returns("Ljava/util/Map;")
80+
classMatcher { descriptor = "Lcom/spotify/remoteconfig/internal/ProductStateProto;" }
81+
}.also { method ->
9082
getDexField("attributesMapField") {
9183
method.usingFields.single().field
9284
}
@@ -95,7 +87,7 @@ fun SpotifyHook.UnlockPremium() {
9587
val field = getDexField("attributesMapField").toField()
9688
override fun beforeHookedMethod(param: MethodHookParam) {
9789
Logger.printDebug { field.get(param.thisObject)!!.toString() }
98-
UnlockPremiumPatch.overrideAttributes(field.get(param.thisObject) as Map<String, *>)
90+
UnlockPremiumPatch.overrideAttributes(field.get(param.thisObject) as Map<String, AccountAttribute>)
9991
}
10092
})
10193

@@ -118,12 +110,6 @@ fun SpotifyHook.UnlockPremium() {
118110
}
119111
})
120112

121-
// following patches may not support legacy Spotify version.
122-
if (IS_SPOTIFY_LEGACY_APP_TARGET) {
123-
Utils.showToastShort("Patching a legacy Spotify version. Patch functionality may be limited.")
124-
return
125-
}
126-
127113
// Enable choosing a specific song/artist via Google Assistant.
128114
getDexMethod("contextFromJsonFingerprint") {
129115
fingerprint {

app/src/main/java/io/github/chsbuffer/revancedxposed/youtube/ad/HideAds.kt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,15 @@ fun YoutubeHook.HideAds() {
1717
)
1818

1919
PreferenceScreen.ADS.addPreferences(
20-
SwitchPreference("revanced_hide_creator_store_shelves"),
20+
SwitchPreference("revanced_hide_creator_store_shelf"),
2121
// SwitchPreference("revanced_hide_end_screen_store_banner"),
2222
SwitchPreference("revanced_hide_fullscreen_ads"),
2323
SwitchPreference("revanced_hide_general_ads"),
2424
SwitchPreference("revanced_hide_merchandise_banners"),
2525
SwitchPreference("revanced_hide_paid_promotion_label"),
2626
SwitchPreference("revanced_hide_self_sponsor_ads"),
27-
SwitchPreference("revanced_hide_tagged_products"),
27+
SwitchPreference("revanced_hide_shopping_links"),
2828
SwitchPreference("revanced_hide_view_products_banner"),
29-
SwitchPreference("revanced_hide_visit_store_button"),
3029
SwitchPreference("revanced_hide_web_search_results"),
3130
)
3231

revanced-patches

Submodule revanced-patches updated 193 files

0 commit comments

Comments
 (0)