feat: snap to chat media
This commit is contained in:
@@ -304,6 +304,10 @@
|
||||
"name": "Prevent Message Sending",
|
||||
"description": "Prevents sending certain types of messages"
|
||||
},
|
||||
"snap_to_chat_media": {
|
||||
"name": "Snap to Chat Media",
|
||||
"description": "Converts snaps to chat external media"
|
||||
},
|
||||
"better_notifications": {
|
||||
"name": "Better Notifications",
|
||||
"description": "Adds more information in received notifications"
|
||||
|
||||
@@ -17,6 +17,7 @@ class MessagingTweaks : ConfigContainer() {
|
||||
"EXTERNAL_MEDIA",
|
||||
"STICKER"
|
||||
)
|
||||
val snapToChatMedia = boolean("snap_to_chat_media")
|
||||
val preventMessageSending = multiple("prevent_message_sending", *NotificationType.getOutgoingValues().map { it.key }.toTypedArray()) {
|
||||
customOptionTranslationPath = "features.options.notifications"
|
||||
}
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
package me.rhunk.snapenhance.features.impl.spying
|
||||
|
||||
import me.rhunk.snapenhance.core.util.protobuf.ProtoReader
|
||||
import me.rhunk.snapenhance.core.util.protobuf.ProtoWriter
|
||||
import me.rhunk.snapenhance.data.ContentType
|
||||
import me.rhunk.snapenhance.data.wrapper.impl.Message
|
||||
import me.rhunk.snapenhance.features.Feature
|
||||
import me.rhunk.snapenhance.features.FeatureLoadParams
|
||||
import me.rhunk.snapenhance.hook.HookStage
|
||||
import me.rhunk.snapenhance.hook.hookConstructor
|
||||
|
||||
class SnapToChatMedia : Feature("SnapToChatMedia", loadParams = FeatureLoadParams.ACTIVITY_CREATE_SYNC) {
|
||||
override fun onActivityCreate() {
|
||||
if (!context.config.messaging.snapToChatMedia.get()) return
|
||||
context.classCache.message.hookConstructor(HookStage.AFTER) { param ->
|
||||
val message = Message(param.thisObject())
|
||||
|
||||
if (message.messageContent.contentType != ContentType.SNAP) return@hookConstructor
|
||||
|
||||
val snapMessageContent = ProtoReader(message.messageContent.content).followPath(11)?.getBuffer() ?: return@hookConstructor
|
||||
message.messageContent.content = ProtoWriter().apply {
|
||||
from(3) {
|
||||
addBuffer(3, snapMessageContent)
|
||||
}
|
||||
}.toByteArray()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -15,6 +15,7 @@ import me.rhunk.snapenhance.features.impl.privacy.PreventMessageSending
|
||||
import me.rhunk.snapenhance.features.impl.spying.AnonymousStoryViewing
|
||||
import me.rhunk.snapenhance.features.impl.spying.MessageLogger
|
||||
import me.rhunk.snapenhance.features.impl.spying.PreventReadReceipts
|
||||
import me.rhunk.snapenhance.features.impl.spying.SnapToChatMedia
|
||||
import me.rhunk.snapenhance.features.impl.spying.StealthMode
|
||||
import me.rhunk.snapenhance.features.impl.tweaks.*
|
||||
import me.rhunk.snapenhance.features.impl.ui.ClientBootstrapOverride
|
||||
@@ -84,6 +85,7 @@ class FeatureManager(private val context: ModContext) : Manager {
|
||||
AddFriendSourceSpoof::class,
|
||||
DisableReplayInFF::class,
|
||||
OldBitmojiSelfie::class,
|
||||
SnapToChatMedia::class,
|
||||
)
|
||||
|
||||
initializeFeatures()
|
||||
|
||||
Reference in New Issue
Block a user