generated from ReVanced/revanced-patches-template
-
-
Notifications
You must be signed in to change notification settings - Fork 316
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Tumblr): Add
Disable dashboard ads
patch (#2979)
Co-authored-by: oSumAtrIX <[email protected]>
- v5.8.2-dev.1
- v5.8.1
- v5.8.1-dev.1
- v5.8.0
- v5.8.0-dev.8
- v5.8.0-dev.7
- v5.8.0-dev.6
- v5.8.0-dev.5
- v5.8.0-dev.4
- v5.8.0-dev.3
- v5.8.0-dev.2
- v5.8.0-dev.1
- v5.7.2
- v5.7.2-dev.2
- v5.7.2-dev.1
- v5.7.1
- v5.7.1-dev.5
- v5.7.1-dev.4
- v5.7.1-dev.3
- v5.7.1-dev.2
- v5.7.1-dev.1
- v5.7.0
- v5.7.0-dev.1
- v5.6.1-dev.4
- v5.6.1-dev.3
- v5.6.1-dev.2
- v5.6.1-dev.1
- v5.6.0
- v5.6.0-dev.6
- v5.6.0-dev.5
- v5.6.0-dev.4
- v5.6.0-dev.3
- v5.6.0-dev.2
- v5.6.0-dev.1
- v5.5.2-dev.2
- v5.5.2-dev.1
- v5.5.1
- v5.5.1-dev.1
- v5.5.0
- v5.5.0-dev.5
- v5.5.0-dev.4
- v5.5.0-dev.3
- v5.5.0-dev.2
- v5.5.0-dev.1
- v5.4.1-dev.1
- v5.4.0
- v5.4.0-dev.11
- v5.4.0-dev.10
- v5.4.0-dev.9
- v5.4.0-dev.8
- v5.4.0-dev.7
- v5.4.0-dev.6
- v5.4.0-dev.5
- v5.4.0-dev.4
- v5.4.0-dev.3
- v5.4.0-dev.2
- v5.4.0-dev.1
- v5.3.0
- v5.3.0-dev.7
- v5.3.0-dev.6
- v5.3.0-dev.5
- v5.3.0-dev.4
- v5.3.0-dev.3
- v5.3.0-dev.2
- v5.3.0-dev.1
- v5.2.4-dev.3
- v5.2.4-dev.2
- v5.2.4-dev.1
- v5.2.3
- v5.2.3-dev.1
- v5.2.2
- v5.2.2-dev.1
- v5.2.1
- v5.2.1-dev.5
- v5.2.1-dev.4
- v5.2.1-dev.3
- v5.2.1-dev.2
- v5.2.1-dev.1
- v5.2.0
- v5.2.0-dev.7
- v5.2.0-dev.6
- v5.2.0-dev.5
- v5.2.0-dev.4
- v5.2.0-dev.3
- v5.2.0-dev.2
- v5.2.0-dev.1
- v5.1.1-dev.2
- v5.1.1-dev.1
- v5.1.0
- v5.1.0-dev.3
- v5.1.0-dev.2
- v5.1.0-dev.1
- v5.0.3-dev.5
- v5.0.3-dev.4
- v5.0.3-dev.3
- v5.0.3-dev.2
- v5.0.3-dev.1
- v5.0.2
- v5.0.2-dev.2
- v5.0.2-dev.1
- v5.0.1
- v5.0.1-dev.4
- v5.0.1-dev.3
- v5.0.1-dev.2
- v5.0.1-dev.1
- v5.0.0
- v5.0.0-dev.4
- v5.0.0-dev.3
- v5.0.0-dev.2
- v5.0.0-dev.1
- v4.18.0-dev.6
- v4.18.0-dev.5
- v4.18.0-dev.4
- v4.18.0-dev.3
- v4.18.0-dev.2
- v4.18.0-dev.1
- v4.17.0
- v4.17.0-dev.13
- v4.17.0-dev.12
- v4.17.0-dev.11
- v4.17.0-dev.10
- v4.17.0-dev.9
- v4.17.0-dev.8
- v4.17.0-dev.7
- v4.17.0-dev.6
- v4.17.0-dev.5
- v4.17.0-dev.4
- v4.17.0-dev.3
- v4.17.0-dev.2
- v4.17.0-dev.1
- v4.16.0
- v4.16.0-dev.7
- v4.16.0-dev.6
- v4.16.0-dev.5
- v4.16.0-dev.4
- v4.16.0-dev.3
- v4.16.0-dev.2
- v4.16.0-dev.1
- v4.15.1-dev.2
- v4.15.1-dev.1
- v4.15.0
- v4.15.0-dev.1
- v4.14.2-dev.2
- v4.14.2-dev.1
- v4.14.1
- v4.14.1-dev.1
- v4.14.0
- v4.14.0-dev.15
- v4.14.0-dev.14
- v4.14.0-dev.13
- v4.14.0-dev.12
- v4.14.0-dev.11
- v4.14.0-dev.10
- v4.14.0-dev.9
- v4.14.0-dev.8
- v4.14.0-dev.7
- v4.14.0-dev.6
- v4.14.0-dev.5
- v4.14.0-dev.4
- v4.14.0-dev.3
- v4.14.0-dev.2
- v4.14.0-dev.1
- v4.13.4-dev.2
- v4.13.4-dev.1
- v4.13.3
- v4.13.3-dev.1
- v4.13.2
- v4.13.2-dev.1
- v4.13.1
- v4.13.1-dev.1
- v4.13.0
- v4.13.0-dev.2
- v4.13.0-dev.1
- v4.12.1-dev.1
- v4.12.0
- v4.12.0-dev.17
- v4.12.0-dev.16
- v4.12.0-dev.15
- v4.12.0-dev.14
- v4.12.0-dev.13
- v4.12.0-dev.12
- v4.12.0-dev.11
- v4.12.0-dev.10
- v4.12.0-dev.9
- v4.12.0-dev.8
- v4.12.0-dev.7
- v4.12.0-dev.6
- v4.12.0-dev.5
- v4.12.0-dev.4
- v4.12.0-dev.3
- v4.12.0-dev.2
- v4.12.0-dev.1
- v4.11.1-dev.1
- v4.11.0
- v4.11.0-dev.7
- v4.11.0-dev.6
- v4.11.0-dev.5
- v4.11.0-dev.4
- v4.11.0-dev.3
- v4.11.0-dev.2
- v4.11.0-dev.1
- v4.10.1-dev.2
- v4.10.1-dev.1
- v4.10.0
- v4.10.0-dev.10
- v4.10.0-dev.9
- v4.10.0-dev.8
- v4.10.0-dev.7
- v4.10.0-dev.6
- v4.10.0-dev.5
- v4.10.0-dev.4
- v4.10.0-dev.3
- v4.10.0-dev.2
- v4.10.0-dev.1
- v4.9.0
- v4.9.0-dev.7
- v4.9.0-dev.6
- v4.9.0-dev.5
- v4.9.0-dev.4
- v4.9.0-dev.3
- v4.9.0-dev.2
- v4.9.0-dev.1
- v4.8.3
- v4.8.3-dev.4
- v4.8.3-dev.3
- v4.8.3-dev.2
- v4.8.3-dev.1
- v4.8.2
- v4.8.2-dev.1
- v4.8.1
- v4.8.1-dev.1
- v4.8.0
- v4.8.0-dev.24
- v4.8.0-dev.23
- v4.8.0-dev.22
- v4.8.0-dev.21
- v4.8.0-dev.20
- v4.8.0-dev.19
- v4.8.0-dev.18
- v4.8.0-dev.17
- v4.8.0-dev.16
- v4.8.0-dev.15
- v4.8.0-dev.14
- v4.8.0-dev.13
- v4.8.0-dev.12
- v4.8.0-dev.11
- v4.8.0-dev.10
- v4.8.0-dev.9
- v4.8.0-dev.8
- v4.8.0-dev.7
- v4.8.0-dev.6
- v4.8.0-dev.5
- v4.8.0-dev.4
- v4.8.0-dev.3
- v4.8.0-dev.2
- v4.8.0-dev.1
- v4.7.0
- v4.7.0-dev.16
- v4.7.0-dev.15
- v4.7.0-dev.14
- v4.7.0-dev.13
- v4.7.0-dev.12
- v4.7.0-dev.11
- v4.7.0-dev.10
- v4.7.0-dev.9
- v4.7.0-dev.8
- v4.7.0-dev.7
- v4.7.0-dev.6
- v4.7.0-dev.5
- v4.7.0-dev.4
- v4.7.0-dev.3
- v4.7.0-dev.2
- v4.7.0-dev.1
- v4.6.1-dev.3
- v4.6.1-dev.2
- v4.6.1-dev.1
- v4.6.0
- v4.6.0-dev.1
- v4.5.1-dev.2
- v4.5.1-dev.1
- v4.5.0
- v4.5.0-dev.2
- v4.5.0-dev.1
- v4.4.0
- v4.4.0-dev.15
- v4.4.0-dev.14
- v4.4.0-dev.13
- v4.4.0-dev.12
- v4.4.0-dev.11
- v4.4.0-dev.10
- v4.4.0-dev.9
- v4.4.0-dev.8
- v4.4.0-dev.7
- v4.4.0-dev.6
- v4.4.0-dev.5
- v4.4.0-dev.4
- v4.4.0-dev.3
- v4.4.0-dev.2
- v4.4.0-dev.1
- v4.3.0
- v4.3.0-dev.13
- v4.3.0-dev.12
- v4.3.0-dev.11
- v4.3.0-dev.10
- v4.3.0-dev.9
- v4.3.0-dev.8
- v4.3.0-dev.7
- v4.3.0-dev.6
- v4.3.0-dev.5
- v4.3.0-dev.4
- v4.3.0-dev.3
- v4.3.0-dev.2
- v4.3.0-dev.1
- v4.2.0
- v4.2.0-dev.1
- v4.1.1-dev.1
- v4.1.0
- v4.1.0-dev.2
- v4.1.0-dev.1
- v4.0.3-dev.2
- v4.0.3-dev.1
- v4.0.2
- v4.0.2-dev.2
- v4.0.2-dev.1
- v4.0.1
- v4.0.1-dev.2
- v4.0.1-dev.1
- v4.0.0
- v4.0.0-dev.15
- v4.0.0-dev.14
- v4.0.0-dev.13
- v4.0.0-dev.12
- v4.0.0-dev.11
- v4.0.0-dev.10
- v4.0.0-dev.9
- v4.0.0-dev.8
- v4.0.0-dev.7
- v4.0.0-dev.6
- v4.0.0-dev.5
- v4.0.0-dev.4
- v4.0.0-dev.3
- v4.0.0-dev.2
- v4.0.0-dev.1
- v3.3.0-dev.2
- v3.3.0-dev.1
- v3.2.0
- v3.2.0-dev.9
- v3.2.0-dev.8
- v3.2.0-dev.7
- v3.2.0-dev.6
- v3.2.0-dev.5
- v3.2.0-dev.4
- v3.2.0-dev.3
- v3.2.0-dev.2
- v3.2.0-dev.1
- v3.1.0
- v3.1.0-dev.1
- v3.0.1
- v3.0.1-dev.1
- v3.0.0
- v3.0.0-dev.11
- v3.0.0-dev.10
- v3.0.0-dev.9
- v3.0.0-dev.8
- v3.0.0-dev.7
- v3.0.0-dev.6
- v3.0.0-dev.5
- v3.0.0-dev.4
- v3.0.0-dev.3
- v3.0.0-dev.2
- v3.0.0-dev.1
- v2.203.0-dev.2
- v2.203.0-dev.1
- v2.202.0
- v2.202.0-dev.4
- v2.202.0-dev.3
- v2.202.0-dev.2
- v2.202.0-dev.1
- v2.201.2-dev.1
- v2.201.1
- v2.201.1-dev.2
- v2.201.1-dev.1
- v2.201.0
- v2.201.0-dev.1
- v2.200.1-dev.1
- v2.200.0
- v2.200.0-dev.3
- v2.200.0-dev.2
- v2.200.0-dev.1
- v2.199.0
- v2.198.1-dev.2
- v2.198.1-dev.1
- v2.198.0
- v2.198.0-dev.1
- v2.197.1-dev.2
- v2.197.1-dev.1
- v2.197.0
- v2.197.0-dev.5
- v2.197.0-dev.4
- v2.197.0-dev.3
- v2.197.0-dev.2
- v2.197.0-dev.1
- v2.196.1-dev.6
- v2.196.1-dev.5
- v2.196.1-dev.4
- v2.196.1-dev.3
- v2.196.1-dev.2
- v2.196.1-dev.1
- v2.196.0
- v2.196.0-dev.14
- v2.196.0-dev.13
- v2.196.0-dev.12
- v2.196.0-dev.11
- v2.196.0-dev.10
- v2.196.0-dev.9
- v2.196.0-dev.8
- v2.196.0-dev.7
- v2.196.0-dev.6
- v2.196.0-dev.5
- v2.196.0-dev.4
- v2.196.0-dev.3
- v2.196.0-dev.2
- v2.196.0-dev.1
- v2.195.1-dev.2
- v2.195.1-dev.1
- v2.195.0
- v2.195.0-dev.5
- v2.195.0-dev.4
- v2.195.0-dev.3
- v2.195.0-dev.2
- v2.195.0-dev.1
- v2.194.1-dev.1
- v2.194.0
- v2.194.0-dev.3
- v2.194.0-dev.2
- v2.194.0-dev.1
- v2.193.1-dev.2
- v2.193.1-dev.1
- v2.193.0
- v2.193.0-dev.7
- v2.193.0-dev.6
- v2.193.0-dev.5
- v2.193.0-dev.4
- v2.193.0-dev.3
- v2.193.0-dev.2
- v2.193.0-dev.1
- v2.192.0
- v2.192.0-dev.3
- v2.192.0-dev.2
- v2.192.0-dev.1
- v2.191.1-dev.1
- v2.191.0
- v2.191.0-dev.33
- v2.191.0-dev.32
- v2.191.0-dev.31
- v2.191.0-dev.30
- v2.191.0-dev.29
- v2.191.0-dev.28
- v2.191.0-dev.27
- v2.191.0-dev.26
- v2.191.0-dev.25
- v2.191.0-dev.24
- v2.191.0-dev.23
- v2.191.0-dev.22
- v2.191.0-dev.21
- v2.191.0-dev.20
- v2.191.0-dev.19
- v2.191.0-dev.18
- v2.191.0-dev.17
- v2.191.0-dev.16
- v2.191.0-dev.15
- v2.191.0-dev.14
- v2.191.0-dev.13
- v2.191.0-dev.12
- v2.191.0-dev.11
- v2.191.0-dev.10
- v2.191.0-dev.9
- v2.191.0-dev.8
- v2.191.0-dev.7
- v2.191.0-dev.6
- v2.191.0-dev.5
- v2.191.0-dev.4
- v2.191.0-dev.3
- v2.191.0-dev.2
- v2.191.0-dev.1
Showing
2 changed files
with
46 additions
and
0 deletions.
There are no files selected for viewing
12 changes: 12 additions & 0 deletions
12
src/main/kotlin/app/revanced/patches/tumblr/ads/fingerprints/AdWaterfallFingerprint.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package app.revanced.patches.tumblr.ads.fingerprints | ||
|
||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint | ||
|
||
// The Tumblr app sends a request to /v2/timeline/dashboard which replies with an array of elements | ||
// to show in the user dashboard. These element have different type ids (post, title, carousel, etc.) | ||
// The standard dashboard Ad has the id client_side_ad_waterfall, and this string has to be in the code | ||
// to handle ads and provide their appearance. | ||
// If we just replace this string in the tumblr code with anything else, it will fail to recognize the | ||
// dashboard object type and just skip it. This is a bit weird, but it shouldn't break | ||
// unless they change the api (unlikely) or explicitly Change the tumblr code to prevent this. | ||
object AdWaterfallFingerprint : MethodFingerprint(strings = listOf("client_side_ad_waterfall")) |
34 changes: 34 additions & 0 deletions
34
src/main/kotlin/app/revanced/patches/tumblr/ads/patch/DisableDashboardAds.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package app.revanced.patches.tumblr.ads.patch | ||
|
||
import app.revanced.extensions.exception | ||
import app.revanced.patcher.annotation.Compatibility | ||
import app.revanced.patcher.annotation.Description | ||
import app.revanced.patcher.annotation.Name | ||
import app.revanced.patcher.annotation.Package | ||
import app.revanced.patcher.data.BytecodeContext | ||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction | ||
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction | ||
import app.revanced.patcher.patch.BytecodePatch | ||
import app.revanced.patcher.patch.annotations.Patch | ||
import app.revanced.patches.tumblr.ads.fingerprints.AdWaterfallFingerprint | ||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction | ||
|
||
@Patch | ||
@Name("Disable dashboard ads") | ||
@Description("Disables ads in the dashboard.") | ||
@Compatibility([Package("com.tumblr")]) | ||
class DisableDashboardAds : BytecodePatch( | ||
listOf(AdWaterfallFingerprint) | ||
) { | ||
override fun execute(context: BytecodeContext) = AdWaterfallFingerprint.result?.let { | ||
it.scanResult.stringsScanResult!!.matches.forEach { match -> | ||
// We just replace all occurrences of "client_side_ad_waterfall" with anything else | ||
// so the app fails to handle ads in the timeline elements array and just skips them. | ||
// See AdWaterfallFingerprint for more info. | ||
val stringRegister = it.mutableMethod.getInstruction<OneRegisterInstruction>(match.index).registerA | ||
it.mutableMethod.replaceInstruction( | ||
match.index, "const-string v$stringRegister, \"dummy\"" | ||
) | ||
} | ||
} ?: throw AdWaterfallFingerprint.exception | ||
} |