feat(kakaotalk): Add patch to remove shop tab from the bottom navigation bar

This commit is contained in:
2025-05-04 03:14:33 +09:00
parent 82e530a510
commit 647756008e
3 changed files with 84 additions and 0 deletions

View File

@ -257,6 +257,10 @@ public final class app/revanced/patches/kakaotalk/chatroom/Remove300PlusLimitPat
public static final fun getRemove300PlusLimitOpenChatRoomPatch ()Lapp/revanced/patcher/patch/BytecodePatch;
}
public final class app/revanced/patches/kakaotalk/misc/RemoveShopTabPatchKt {
public static final fun getRemoveShopTabPatch ()Lapp/revanced/patcher/patch/BytecodePatch;
}
public final class app/revanced/patches/kakaotalk/signature/VerifyingSignaturePatchKt {
public static final fun getVerifyingSignaturePatch ()Lapp/revanced/patcher/patch/BytecodePatch;
}

View File

@ -0,0 +1,45 @@
package app.revanced.patches.kakaotalk.misc
import app.revanced.patcher.extensions.InstructionExtensions.instructions
import app.revanced.patcher.extensions.InstructionExtensions.removeInstruction
import app.revanced.patcher.patch.Package
import app.revanced.patcher.patch.bytecodePatch
import app.revanced.patches.kakaotalk.misc.fingerprints.removeShopTabFingerprint
import app.revanced.util.getReference
import com.android.tools.smali.dexlib2.Opcode
import com.android.tools.smali.dexlib2.builder.instruction.BuilderInstruction21c
import com.android.tools.smali.dexlib2.builder.instruction.BuilderInstruction35c
import com.android.tools.smali.dexlib2.iface.reference.FieldReference
import com.android.tools.smali.dexlib2.iface.reference.MethodReference
val removeShopTabPatch = bytecodePatch(
name = "Remove shop tab",
description = "Removes the shop tab from the bottom navigation bar.",
) {
compatibleWith(Package("com.kakao.talk", setOf("25.3.5")))
execute {
val method = removeShopTabFingerprint.method
val insns = method.instructions
val matches = insns.mapIndexedNotNull { idx, inst ->
if (inst is BuilderInstruction35c
&& inst.opcode == Opcode.INVOKE_VIRTUAL
&& (inst.getReference<MethodReference>()?.name == "add")
) {
val prev = insns.getOrNull(idx - 1) as? BuilderInstruction21c
val fldName = (prev?.reference as? FieldReference)?.name
if (fldName == "SHOPPING_TAB" || fldName == "CALL_TAB") {
Pair(idx - 1, idx)
} else null
} else null
}
matches
.sortedByDescending { it.second }
.forEach { (loadIdx, invokeIdx) ->
method.removeInstruction(invokeIdx)
method.removeInstruction(loadIdx)
}
}
}

View File

@ -0,0 +1,35 @@
package app.revanced.patches.kakaotalk.misc.fingerprints
import app.revanced.patcher.extensions.InstructionExtensions.instructions
import app.revanced.patcher.fingerprint
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod.Companion.toMutable
import app.revanced.util.getReference
import com.android.tools.smali.dexlib2.AccessFlags
import com.android.tools.smali.dexlib2.Opcode
import com.android.tools.smali.dexlib2.iface.reference.StringReference
internal val removeShopTabFingerprint = fingerprint {
accessFlags(AccessFlags.PUBLIC, AccessFlags.FINAL)
returns("V")
parameters()
strings("webtoon")
// custom { method, classDef ->
// !method.toMutable().instructions.any {
// it.opcode == Opcode.CONST_STRING && !it.getReference<StringReference>()!!.string.contains("webtoon")
// }
// }
opcodes(
Opcode.IGET_OBJECT,
Opcode.INVOKE_VIRTUAL,
Opcode.SGET_OBJECT,
Opcode.INVOKE_VIRTUAL,
Opcode.INVOKE_STATIC,
Opcode.MOVE_RESULT_OBJECT,
Opcode.INVOKE_INTERFACE,
Opcode.MOVE_RESULT,
Opcode.CONST_4,
Opcode.IF_EQZ,
Opcode.SGET_OBJECT,
Opcode.GOTO,
)
}