diff --git a/patches/api/patches.api b/patches/api/patches.api index c600fb698..90a874dc8 100644 --- a/patches/api/patches.api +++ b/patches/api/patches.api @@ -248,6 +248,11 @@ public final class app/revanced/patches/kakaotalk/changemodel/ChangeModelPatchKt public static final fun getChangeModelPatch ()Lapp/revanced/patcher/patch/BytecodePatch; } +public final class app/revanced/patches/kakaotalk/chatroom/Remove300PlusLimitPatchKt { + public static final fun getRemove300PlusLimitBaseChatRoomPatch ()Lapp/revanced/patcher/patch/BytecodePatch; + public static final fun getRemove300PlusLimitOpenChatRoomPatch ()Lapp/revanced/patcher/patch/BytecodePatch; +} + public final class app/revanced/patches/kakaotalk/signature/VerifyingSignaturePatchKt { public static final fun getVerifyingSignaturePatch ()Lapp/revanced/patcher/patch/BytecodePatch; } diff --git a/patches/src/main/kotlin/app/revanced/patches/kakaotalk/chatroom/Remove300PlusLimitPatch.kt b/patches/src/main/kotlin/app/revanced/patches/kakaotalk/chatroom/Remove300PlusLimitPatch.kt new file mode 100644 index 000000000..47d5f3c34 --- /dev/null +++ b/patches/src/main/kotlin/app/revanced/patches/kakaotalk/chatroom/Remove300PlusLimitPatch.kt @@ -0,0 +1,59 @@ +package app.revanced.patches.kakaotalk.chatroom + +import app.revanced.patcher.extensions.InstructionExtensions.instructions +import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction +import app.revanced.patcher.patch.bytecodePatch +import app.revanced.patcher.patch.Package +import app.revanced.patches.kakaotalk.chatroom.fingerprints.remove300PlusLimitBaseChatRoomFingerprint +import app.revanced.patches.kakaotalk.chatroom.fingerprints.remove300PlusLimitOpenChatRoomFingerprint +import com.android.tools.smali.dexlib2.Opcode +import com.android.tools.smali.dexlib2.builder.instruction.BuilderInstruction10t +import com.android.tools.smali.dexlib2.builder.instruction.BuilderInstruction22t + +@Suppress("unused") +val remove300PlusLimitBaseChatRoomPatch = bytecodePatch( + name = "Disable 300+ unread limit (BaseChatRoom)", + description = "Always show the real unread count instead of '300+' in base chatroom list" +) { + compatibleWith(Package("com.kakao.talk", setOf("25.3.5"))) + + execute { + val method = remove300PlusLimitBaseChatRoomFingerprint.method + + val branches = method.instructions + .filterIsInstance() + .filter { it.opcode == Opcode.IF_LT } + .toList() + + branches.forEach { iflt -> + val idx = method.instructions.indexOf(iflt) + val gotoInsn = BuilderInstruction10t( + Opcode.GOTO, + iflt.target + ) + method.replaceInstruction(idx, gotoInsn) + } + } +} + +@Suppress("unused") +val remove300PlusLimitOpenChatRoomPatch = bytecodePatch( + name = "Disable 300+ unread limit (OpenChatRoom)", + description = "Always show the real unread count instead of '300+' in open chatroom list" +) { + compatibleWith(Package("com.kakao.talk", setOf("25.3.5"))) + + execute { + val method = remove300PlusLimitOpenChatRoomFingerprint.method + + method.instructions + .filterIsInstance() + .filter { it.opcode == Opcode.IF_LT } + .toList() + .forEach { iflt -> + val idx = method.instructions.indexOf(iflt) + val gotoInsn = BuilderInstruction10t(Opcode.GOTO, iflt.target) + method.replaceInstruction(idx, gotoInsn) + } + } +} diff --git a/patches/src/main/kotlin/app/revanced/patches/kakaotalk/chatroom/fingerprints/Remove300PlusLimitFingerprint.kt b/patches/src/main/kotlin/app/revanced/patches/kakaotalk/chatroom/fingerprints/Remove300PlusLimitFingerprint.kt new file mode 100644 index 000000000..f81510d3f --- /dev/null +++ b/patches/src/main/kotlin/app/revanced/patches/kakaotalk/chatroom/fingerprints/Remove300PlusLimitFingerprint.kt @@ -0,0 +1,20 @@ +package app.revanced.patches.kakaotalk.chatroom.fingerprints + +import app.revanced.patcher.fingerprint +import com.android.tools.smali.dexlib2.AccessFlags + +@Suppress("unused") +internal val remove300PlusLimitBaseChatRoomFingerprint = fingerprint { + accessFlags(AccessFlags.PUBLIC, AccessFlags.FINAL) + returns("V") + parameters("Lcom/kakao/talk/widget/ViewBindable;") + strings("300+") +} + +@Suppress("unused") +internal val remove300PlusLimitOpenChatRoomFingerprint = fingerprint { + accessFlags(AccessFlags.PUBLIC, AccessFlags.FINAL) + returns("V") + parameters() + strings("300+") +} \ No newline at end of file