-
-
Notifications
You must be signed in to change notification settings - Fork 438
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(messenger): add
disable-typing-indicator
patch (#2115)
Co-authored-by: oSumAtrIX <[email protected]>
- Loading branch information
Showing
2 changed files
with
44 additions
and
0 deletions.
There are no files selected for viewing
15 changes: 15 additions & 0 deletions
15
.../app/revanced/patches/messenger/inputfield/fingerprints/SendTypingIndicatorFingerprint.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package app.revanced.patches.messenger.inputfield.fingerprints | ||
|
||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint | ||
import org.jf.dexlib2.dexbacked.value.DexBackedStringEncodedValue | ||
|
||
object SendTypingIndicatorFingerprint : MethodFingerprint( | ||
returnType = "V", | ||
parameters = listOf(), | ||
customFingerprint = { methodDef, classDef -> | ||
methodDef.name == "run" && classDef.fields.any { | ||
it.name == "__redex_internal_original_name" | ||
&& (it.initialValue as? DexBackedStringEncodedValue)?.value == "ConversationTypingContext\$sendActiveStateRunnable\$1" | ||
} | ||
} | ||
) |
29 changes: 29 additions & 0 deletions
29
src/main/kotlin/app/revanced/patches/messenger/inputfield/patch/DisableTypingIndicator.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package app.revanced.patches.messenger.inputfield.patch | ||
|
||
import app.revanced.extensions.toErrorResult | ||
import app.revanced.patcher.annotation.Compatibility | ||
import app.revanced.patcher.annotation.Description | ||
import app.revanced.patcher.annotation.Name | ||
import app.revanced.patcher.annotation.Package | ||
import app.revanced.patcher.annotation.Version | ||
import app.revanced.patcher.data.BytecodeContext | ||
import app.revanced.patcher.extensions.replaceInstruction | ||
import app.revanced.patcher.patch.BytecodePatch | ||
import app.revanced.patcher.patch.PatchResult | ||
import app.revanced.patcher.patch.PatchResultSuccess | ||
import app.revanced.patcher.patch.annotations.Patch | ||
import app.revanced.patches.messenger.inputfield.fingerprints.SendTypingIndicatorFingerprint | ||
|
||
@Patch | ||
@Name("disable-typing-indicator") | ||
@Description("Disables the indicator while typing a message") | ||
@Compatibility([Package("com.facebook.orca")]) | ||
@Version("0.0.1") | ||
class DisableTypingIndicator : BytecodePatch(listOf(SendTypingIndicatorFingerprint)) { | ||
override fun execute(context: BytecodeContext): PatchResult { | ||
SendTypingIndicatorFingerprint.result?.mutableMethod?.replaceInstruction(0, "return-void") | ||
?: throw SendTypingIndicatorFingerprint.toErrorResult() | ||
|
||
return PatchResultSuccess() | ||
} | ||
} |