mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-05-05 00:54:32 +02:00
fix(YouTube/Hide account menu): improve patch method
This commit is contained in:
parent
a28c05ab6a
commit
82b0ada662
@ -13,7 +13,7 @@ import app.revanced.patches.youtube.general.accountmenu.fingerprints.AccountMenu
|
||||
import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch
|
||||
import app.revanced.patches.youtube.utils.settings.SettingsPatch
|
||||
import app.revanced.util.integrations.Constants.GENERAL
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction
|
||||
|
||||
@Patch(
|
||||
name = "Hide account menu",
|
||||
@ -49,27 +49,23 @@ object AccountMenuPatch : BytecodePatch(
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
AccountMenuParentFingerprint.result?.let { parentResult ->
|
||||
AccountMenuFingerprint.also { it.resolve(context, parentResult.classDef) }.result?.let {
|
||||
AccountMenuFingerprint.also {
|
||||
it.resolve(
|
||||
context,
|
||||
parentResult.classDef
|
||||
)
|
||||
}.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
val targetIndex = it.scanResult.patternScanResult!!.startIndex + 1
|
||||
val register = getInstruction<OneRegisterInstruction>(targetIndex).registerA
|
||||
val targetIndex = it.scanResult.patternScanResult!!.startIndex + 2
|
||||
val targetInstruction = getInstruction<FiveRegisterInstruction>(targetIndex)
|
||||
|
||||
addInstruction(
|
||||
targetIndex + 1,
|
||||
"invoke-static {v$register}, $GENERAL->hideAccountMenu(Landroid/text/Spanned;)V"
|
||||
targetIndex,
|
||||
"invoke-static {v${targetInstruction.registerC}, v${targetInstruction.registerD}}, " +
|
||||
"$GENERAL->hideAccountMenu(Landroid/view/View;Ljava/lang/CharSequence;)V"
|
||||
)
|
||||
}
|
||||
} ?: throw AccountMenuFingerprint.exception
|
||||
|
||||
parentResult.mutableMethod.apply {
|
||||
val endIndex = parentResult.scanResult.patternScanResult!!.endIndex
|
||||
val register = getInstruction<OneRegisterInstruction>(endIndex).registerA
|
||||
|
||||
addInstruction(
|
||||
endIndex + 1,
|
||||
"sput-object v$register, $GENERAL->compactLink:Landroid/view/View;"
|
||||
)
|
||||
}
|
||||
} ?: throw AccountMenuParentFingerprint.exception
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user