commit 01e7b07e4b9ecc33e747ecc1c41ca682c6e7c263 parent 9977d6ae674f07d7e5882f5e29118c5b9589ab44 Author: rhunk <101876869+rhunk@users.noreply.github.com> Date: Wed, 17 May 2023 14:47:02 +0200 missing class Diffstat:
A | app/src/main/kotlin/me/rhunk/snapenhance/features/impl/privacy/PreventMessageSending.kt | | | 38 | ++++++++++++++++++++++++++++++++++++++ |
1 file changed, 38 insertions(+), 0 deletions(-)
diff --git a/app/src/main/kotlin/me/rhunk/snapenhance/features/impl/privacy/PreventMessageSending.kt b/app/src/main/kotlin/me/rhunk/snapenhance/features/impl/privacy/PreventMessageSending.kt @@ -0,0 +1,37 @@ +package me.rhunk.snapenhance.features.impl.privacy + +import me.rhunk.snapenhance.config.ConfigProperty +import me.rhunk.snapenhance.data.ContentType +import me.rhunk.snapenhance.data.wrapper.impl.MessageContent +import me.rhunk.snapenhance.features.Feature +import me.rhunk.snapenhance.features.FeatureLoadParams +import me.rhunk.snapenhance.hook.HookStage +import me.rhunk.snapenhance.hook.Hooker + +class PreventMessageSending : Feature("Send message override", loadParams = FeatureLoadParams.ACTIVITY_CREATE_ASYNC) { + override fun asyncOnActivityCreate() { + Hooker.hook( + context.classCache.conversationManager, + "sendMessageWithContent", + HookStage.BEFORE + ) { param -> + val message = MessageContent(param.arg(1)) + val contentType = message.contentType + + if (context.config.bool(ConfigProperty.PREVENT_STATUS_NOTIFICATIONS)) { + if (contentType == ContentType.STATUS_SAVE_TO_CAMERA_ROLL || + contentType == ContentType.STATUS_CALL_MISSED_AUDIO || + contentType == ContentType.STATUS_CALL_MISSED_VIDEO) { + param.setResult(null) + } + } + + if (context.config.bool(ConfigProperty.PREVENT_SCREENSHOT_NOTIFICATIONS)) { + if (contentType == ContentType.STATUS_CONVERSATION_CAPTURE_SCREENSHOT || + contentType == ContentType.STATUS_CONVERSATION_CAPTURE_RECORD) { + param.setResult(null) + } + } + } + } +}+ \ No newline at end of file