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.
- Loading branch information
Showing
3 changed files
with
44 additions
and
0 deletions.
There are no files selected for viewing
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
30 changes: 30 additions & 0 deletions
30
src/main/kotlin/app/revanced/patches/twitter/layout/viewcount/HideViewCountPatch.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,30 @@ | ||
package app.revanced.patches.twitter.layout.viewcount | ||
|
||
|
||
import app.revanced.patcher.data.BytecodeContext | ||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions | ||
import app.revanced.patcher.patch.BytecodePatch | ||
import app.revanced.patcher.patch.annotation.CompatiblePackage | ||
import app.revanced.patcher.patch.annotation.Patch | ||
import app.revanced.patches.twitter.layout.viewcount.fingerprints.ViewCountsEnabledFingerprint | ||
import app.revanced.util.exception | ||
|
||
@Patch( | ||
name = "Hide view count", | ||
description = "Hides the view count of Posts.", | ||
compatiblePackages = [CompatiblePackage("com.twitter.android")], | ||
use = false | ||
) | ||
@Suppress("unused") | ||
object HideViewCountPatch : BytecodePatch( | ||
setOf(ViewCountsEnabledFingerprint) | ||
) { | ||
override fun execute(context: BytecodeContext) = | ||
ViewCountsEnabledFingerprint.result?.mutableMethod?.addInstructions( | ||
0, | ||
""" | ||
const/4 v0, 0x0 | ||
return v0 | ||
""" | ||
) ?: throw ViewCountsEnabledFingerprint.exception | ||
} |
8 changes: 8 additions & 0 deletions
8
...pp/revanced/patches/twitter/layout/viewcount/fingerprints/ViewCountsEnabledFingerprint.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,8 @@ | ||
package app.revanced.patches.twitter.layout.viewcount.fingerprints | ||
|
||
import app.revanced.patcher.fingerprint.MethodFingerprint | ||
|
||
internal object ViewCountsEnabledFingerprint : MethodFingerprint( | ||
returnType = "Z", | ||
strings = listOf("view_counts_public_visibility_enabled") | ||
) |