Skip to content

Commit

Permalink
refactor(Twitter): refactor button class Hook
Browse files Browse the repository at this point in the history
  • Loading branch information
swakwork committed Jan 28, 2025
1 parent cdb2067 commit 2bf411a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import app.revanced.patcher.fingerprint.MethodFingerprint
import app.revanced.patcher.patch.PatchException
import app.revanced.patcher.util.smali.ExternalLabel
import com.android.tools.smali.dexlib2.Opcode
import com.android.tools.smali.dexlib2.builder.instruction.BuilderInstruction21c
import com.android.tools.smali.dexlib2.dexbacked.reference.DexBackedFieldReference
import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction
import crimera.patches.twitter.misc.settings.SettingsPatch

Expand All @@ -24,7 +26,6 @@ object ShareMenuButtonAddHook : MethodFingerprint(
buttonReference: String?,
functionName: String,
) {
val buttonClass = "Lcom/twitter/model/core/v;"
val result = result ?: throw PatchException("ShareMenuButtonAddHook not found")

val method = result.mutableMethod
Expand All @@ -34,6 +35,16 @@ object ShareMenuButtonAddHook : MethodFingerprint(

val addMethod = method.getInstruction<ReferenceInstruction>(addMethodIndex).reference.toString()

val buttonClass =
(
(
method
.getInstruction<BuilderInstruction21c>(
addMethodIndex - 1,
).reference
)as DexBackedFieldReference
).definingClass

method.addInstructionsWithLabels(
0,
"""
Expand Down

This file was deleted.

0 comments on commit 2bf411a

Please sign in to comment.