generated from ReVanced/revanced-patches-template
-
Notifications
You must be signed in to change notification settings - Fork 34
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
18 changed files
with
482 additions
and
164 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
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
org.gradle.parallel = true | ||
org.gradle.caching = true | ||
kotlin.code.style = official | ||
version = 1.39.0-dev.1 | ||
version = 1.41.0 |
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
63 changes: 63 additions & 0 deletions
63
src/main/kotlin/crimera/patches/twitter/timeline/hideNudgeButtons/HideNudgeButtonPatch.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,63 @@ | ||
package crimera.patches.twitter.timeline.hideNudgeButtons | ||
|
||
import app.revanced.patcher.data.BytecodeContext | ||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels | ||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction | ||
import app.revanced.patcher.extensions.InstructionExtensions.getInstructions | ||
import app.revanced.patcher.fingerprint.MethodFingerprint | ||
import app.revanced.patcher.patch.BytecodePatch | ||
import app.revanced.patcher.patch.PatchException | ||
import app.revanced.patcher.patch.annotation.CompatiblePackage | ||
import app.revanced.patcher.patch.annotation.Patch | ||
import app.revanced.patcher.util.smali.ExternalLabel | ||
import com.android.tools.smali.dexlib2.Opcode | ||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction | ||
import com.android.tools.smali.dexlib2.iface.instruction.formats.Instruction23x | ||
import com.android.tools.smali.dexlib2.iface.instruction.formats.Instruction35c | ||
import crimera.patches.twitter.misc.settings.SettingsPatch | ||
import crimera.patches.twitter.misc.settings.fingerprints.SettingsStatusLoadFingerprint | ||
|
||
object HideNudgeButtonPatchFingerprint : MethodFingerprint( | ||
strings = listOf("viewDelegate", "viewModel"), | ||
customFingerprint = {_, classDef -> | ||
classDef.type.endsWith("FollowNudgeButtonViewDelegateBinder;") | ||
} | ||
) | ||
|
||
@Patch( | ||
name = "Hide nudge button", | ||
description = "Hides follow/subscribe/follow back buttons on posts", | ||
compatiblePackages = [CompatiblePackage("com.twitter.android")], | ||
dependencies = [SettingsPatch::class], | ||
use = true, | ||
) | ||
@Suppress("unused") | ||
object HideNudgeButtonPatch:BytecodePatch( | ||
setOf(HideNudgeButtonPatchFingerprint,SettingsStatusLoadFingerprint) | ||
) { | ||
const val HOOK_DESCRIPTOR = | ||
"invoke-static {}, ${SettingsPatch.PREF_DESCRIPTOR};->hideNudgeButton()Z" | ||
|
||
override fun execute(context: BytecodeContext) { | ||
val result = HideNudgeButtonPatchFingerprint.result | ||
?: throw PatchException("HideNudgeButtonPatchFingerprint not found") | ||
|
||
val method = result.mutableMethod | ||
val instructions = method.getInstructions() | ||
|
||
val dummyRegIndex = instructions.first { it.opcode == Opcode.APUT_OBJECT}.location.index | ||
val dummyReg = method.getInstruction<Instruction23x>(dummyRegIndex).registerC | ||
|
||
method.addInstructionsWithLabels(dummyRegIndex+2,""" | ||
$HOOK_DESCRIPTOR | ||
move-result v$dummyReg | ||
if-eqz v$dummyReg, :piko | ||
const/16 v$dummyReg, 0x8 | ||
invoke-virtual {p1, v$dummyReg}, Landroidx/appcompat/widget/AppCompatButton;->setVisibility(I)V | ||
""".trimIndent(), ExternalLabel("piko",instructions.first { it.opcode == Opcode.INVOKE_STATIC && it.location.index > dummyRegIndex }) | ||
) | ||
|
||
SettingsStatusLoadFingerprint.enableSettings("hideNudgeButton") | ||
|
||
} | ||
} |
59 changes: 59 additions & 0 deletions
59
src/main/kotlin/crimera/patches/twitter/timeline/hideSocialProof/HideSoialProofPatch.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,59 @@ | ||
package crimera.patches.twitter.timeline.hideSocialProof | ||
|
||
import app.revanced.patcher.data.BytecodeContext | ||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels | ||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction | ||
import app.revanced.patcher.extensions.InstructionExtensions.getInstructions | ||
import app.revanced.patcher.fingerprint.MethodFingerprint | ||
import app.revanced.patcher.patch.BytecodePatch | ||
import app.revanced.patcher.patch.PatchException | ||
import app.revanced.patcher.patch.annotation.CompatiblePackage | ||
import app.revanced.patcher.patch.annotation.Patch | ||
import app.revanced.patcher.util.smali.ExternalLabel | ||
import com.android.tools.smali.dexlib2.Opcode | ||
import com.android.tools.smali.dexlib2.iface.instruction.formats.Instruction23x | ||
import crimera.patches.twitter.misc.settings.SettingsPatch | ||
import crimera.patches.twitter.misc.settings.fingerprints.SettingsStatusLoadFingerprint | ||
|
||
object HideSocialProofPatchFingerprint : MethodFingerprint( | ||
|
||
customFingerprint = {methodDef, classDef -> | ||
classDef.type.endsWith("SocialProofView;") && methodDef.name == "setSocialProofData" | ||
} | ||
) | ||
|
||
@Patch( | ||
name = "Hide followed by context", | ||
description = "Hides followed by context under profile", | ||
compatiblePackages = [CompatiblePackage("com.twitter.android")], | ||
dependencies = [SettingsPatch::class], | ||
use = true, | ||
) | ||
@Suppress("unused") | ||
object HideSocialProofPatch:BytecodePatch( | ||
setOf(HideSocialProofPatchFingerprint,SettingsStatusLoadFingerprint) | ||
) { | ||
const val HOOK_DESCRIPTOR = | ||
"invoke-static {}, ${SettingsPatch.PREF_DESCRIPTOR};->hideSocialProof()Z" | ||
|
||
override fun execute(context: BytecodeContext) { | ||
val result = HideSocialProofPatchFingerprint.result | ||
?: throw PatchException("HideSocialProofPatchFingerprint not found") | ||
|
||
val method = result.mutableMethod | ||
val instructions = method.getInstructions() | ||
|
||
|
||
|
||
method.addInstructionsWithLabels(0,""" | ||
$HOOK_DESCRIPTOR | ||
move-result v0 | ||
if-eqz v0, :piko | ||
return-void | ||
""".trimIndent(), ExternalLabel("piko",instructions.first { it.opcode == Opcode.CONST_4}) | ||
) | ||
|
||
SettingsStatusLoadFingerprint.enableSettings("hideSocialProof") | ||
|
||
} | ||
} |
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
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
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
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
Oops, something went wrong.