mirror of
https://github.com/ReVanced/revanced-patches.git
synced 2026-01-21 01:53:56 +00:00
feat(Instagram): Add Hide navigation buttons patch (#5678)
Co-authored-by: LisoUseInAIKyrios <118716522+LisoUseInAIKyrios@users.noreply.github.com> Co-authored-by: oSumAtrIX <johan.melkonyan1@web.de>
This commit is contained in:
@@ -264,6 +264,10 @@ public final class app/revanced/patches/instagram/ads/HideAdsPatchKt {
|
|||||||
public static final fun getHideAdsPatch ()Lapp/revanced/patcher/patch/BytecodePatch;
|
public static final fun getHideAdsPatch ()Lapp/revanced/patcher/patch/BytecodePatch;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public final class app/revanced/patches/instagram/hide/navigation/HideNavigationButtonsKt {
|
||||||
|
public static final fun getHideNavigationButtonsPatch ()Lapp/revanced/patcher/patch/BytecodePatch;
|
||||||
|
}
|
||||||
|
|
||||||
public final class app/revanced/patches/instagram/misc/signature/SignatureCheckPatchKt {
|
public final class app/revanced/patches/instagram/misc/signature/SignatureCheckPatchKt {
|
||||||
public static final fun getSignatureCheckPatch ()Lapp/revanced/patcher/patch/BytecodePatch;
|
public static final fun getSignatureCheckPatch ()Lapp/revanced/patcher/patch/BytecodePatch;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,29 @@
|
|||||||
|
|
||||||
|
package app.revanced.patches.instagram.hide.navigation
|
||||||
|
|
||||||
|
import app.revanced.patcher.fingerprint
|
||||||
|
import com.android.tools.smali.dexlib2.Opcode
|
||||||
|
|
||||||
|
internal val tabCreateButtonsLoopStartFingerprint = fingerprint {
|
||||||
|
returns("V")
|
||||||
|
strings("InstagramMainActivity.createTabButtons")
|
||||||
|
opcodes(
|
||||||
|
//Loop Start
|
||||||
|
Opcode.IF_GE, // Check if index is finished (index, size)
|
||||||
|
//Injection
|
||||||
|
Opcode.INVOKE_INTERFACE,
|
||||||
|
Opcode.MOVE_RESULT_OBJECT
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
internal val tabCreateButtonsLoopEndFingerprint = fingerprint {
|
||||||
|
returns("V")
|
||||||
|
strings("InstagramMainActivity.createTabButtons")
|
||||||
|
opcodes(
|
||||||
|
Opcode.IPUT_OBJECT,
|
||||||
|
// Injection Jump
|
||||||
|
Opcode.ADD_INT_LIT8, //Increase Index
|
||||||
|
Opcode.GOTO_16 // Jump to loopStart
|
||||||
|
// LoopEnd
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -0,0 +1,78 @@
|
|||||||
|
package app.revanced.patches.instagram.hide.navigation
|
||||||
|
|
||||||
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
|
||||||
|
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||||
|
import app.revanced.patcher.patch.booleanOption
|
||||||
|
import app.revanced.patcher.patch.bytecodePatch
|
||||||
|
import app.revanced.patcher.util.smali.ExternalLabel
|
||||||
|
import app.revanced.util.findFreeRegister
|
||||||
|
import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
|
||||||
|
import java.util.logging.Logger
|
||||||
|
|
||||||
|
@Suppress("unused")
|
||||||
|
val hideNavigationButtonsPatch = bytecodePatch(
|
||||||
|
name = "Hide navigation buttons",
|
||||||
|
description = "Hides navigation bar buttons, such as the Reels and Create button.",
|
||||||
|
use = false
|
||||||
|
) {
|
||||||
|
compatibleWith("com.instagram.android")
|
||||||
|
|
||||||
|
val hideReels by booleanOption(
|
||||||
|
key = "hideReels",
|
||||||
|
default = true,
|
||||||
|
title = "Hide Reels"
|
||||||
|
)
|
||||||
|
|
||||||
|
val hideCreate by booleanOption(
|
||||||
|
key = "hideCreate",
|
||||||
|
default = true,
|
||||||
|
title = "Hide Create"
|
||||||
|
)
|
||||||
|
|
||||||
|
execute {
|
||||||
|
if (!hideReels!! && !hideCreate!!) {
|
||||||
|
return@execute Logger.getLogger(this::class.java.name).warning(
|
||||||
|
"No hide navigation buttons options are enabled. No changes made."
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
tabCreateButtonsLoopStartFingerprint.method.apply {
|
||||||
|
// Check the current loop index, and skip over adding the
|
||||||
|
// navigation button view if the index matches a given button.
|
||||||
|
|
||||||
|
val startIndex = tabCreateButtonsLoopStartFingerprint.patternMatch!!.startIndex
|
||||||
|
val endIndex = tabCreateButtonsLoopEndFingerprint.patternMatch!!.endIndex
|
||||||
|
val insertIndex = startIndex + 1
|
||||||
|
val loopIndexRegister = getInstruction<TwoRegisterInstruction>(startIndex).registerA
|
||||||
|
val freeRegister = findFreeRegister(insertIndex, loopIndexRegister)
|
||||||
|
val instruction = getInstruction(endIndex - 1)
|
||||||
|
|
||||||
|
var instructions = buildString {
|
||||||
|
if (hideCreate!!) {
|
||||||
|
appendLine(
|
||||||
|
"""
|
||||||
|
const v$freeRegister, 0x2
|
||||||
|
if-eq v$freeRegister, v$loopIndexRegister, :skipAddView
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hideReels!!) {
|
||||||
|
appendLine(
|
||||||
|
"""
|
||||||
|
const v$freeRegister, 0x3
|
||||||
|
if-eq v$freeRegister, v$loopIndexRegister, :skipAddView
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
addInstructionsWithLabels(
|
||||||
|
insertIndex,
|
||||||
|
instructions,
|
||||||
|
ExternalLabel("skipAddView", instruction)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Reference in New Issue
Block a user