Skip to content

Commit 1bf9582

Browse files
committed
feat(X): Add Hide view count patch
1 parent ea09d4b commit 1bf9582

File tree

3 files changed

+44
-0
lines changed

3 files changed

+44
-0
lines changed

api/revanced-patches.api

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1065,6 +1065,12 @@ public final class app/revanced/patches/twitch/misc/settings/SettingsResourcePat
10651065
public static final field INSTANCE Lapp/revanced/patches/twitch/misc/settings/SettingsResourcePatch;
10661066
}
10671067

1068+
public final class app/revanced/patches/twitter/layout/viewcount/HideViewCountPatch : app/revanced/patcher/patch/BytecodePatch {
1069+
public static final field INSTANCE Lapp/revanced/patches/twitter/layout/viewcount/HideViewCountPatch;
1070+
public fun execute (Lapp/revanced/patcher/data/BytecodeContext;)V
1071+
public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V
1072+
}
1073+
10681074
public final class app/revanced/patches/twitter/misc/dynamiccolor/DynamicColorPatch : app/revanced/patcher/patch/ResourcePatch {
10691075
public static final field INSTANCE Lapp/revanced/patches/twitter/misc/dynamiccolor/DynamicColorPatch;
10701076
public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
package app.revanced.patches.twitter.layout.viewcount
2+
3+
4+
import app.revanced.patcher.data.BytecodeContext
5+
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
6+
import app.revanced.patcher.patch.BytecodePatch
7+
import app.revanced.patcher.patch.annotation.CompatiblePackage
8+
import app.revanced.patcher.patch.annotation.Patch
9+
import app.revanced.patches.twitter.layout.viewcount.fingerprints.ViewCountsEnabledFingerprint
10+
import app.revanced.util.exception
11+
12+
@Patch(
13+
name = "Hide view count",
14+
description = "Hides the view count of Posts.",
15+
compatiblePackages = [CompatiblePackage("com.twitter.android")],
16+
use = false
17+
)
18+
@Suppress("unused")
19+
object HideViewCountPatch : BytecodePatch(
20+
setOf(ViewCountsEnabledFingerprint)
21+
) {
22+
override fun execute(context: BytecodeContext) =
23+
ViewCountsEnabledFingerprint.result?.mutableMethod?.addInstructions(
24+
0,
25+
"""
26+
const/4 v0, 0x0
27+
return v0
28+
"""
29+
) ?: throw ViewCountsEnabledFingerprint.exception
30+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package app.revanced.patches.twitter.layout.viewcount.fingerprints
2+
3+
import app.revanced.patcher.fingerprint.MethodFingerprint
4+
5+
internal object ViewCountsEnabledFingerprint : MethodFingerprint(
6+
returnType = "Z",
7+
strings = listOf("view_counts_public_visibility_enabled")
8+
)

0 commit comments

Comments
 (0)