mirror of
https://github.com/rhunk/SnapEnhance.git
synced 2025-05-16 14:17:09 +02:00
feat: bypass message retention policy
This commit is contained in:
parent
bf9444dfb6
commit
ead9e7830b
@ -328,6 +328,10 @@
|
||||
"name": "Disable Replay in FF",
|
||||
"description": "Disables the ability to replay with a long press from the Friend Feed"
|
||||
},
|
||||
"message_preview_length": {
|
||||
"name": "Message Preview Length",
|
||||
"description": "Specify the amount of messages to get previewed"
|
||||
},
|
||||
"prevent_message_sending": {
|
||||
"name": "Prevent Message Sending",
|
||||
"description": "Prevents sending certain types of messages"
|
||||
@ -352,9 +356,9 @@
|
||||
"name": "Gallery Media Send Override",
|
||||
"description": "Spoofs the media source when sending from the Gallery"
|
||||
},
|
||||
"message_preview_length": {
|
||||
"name": "Message Preview Length",
|
||||
"description": "Specify the amount of messages to get previewed"
|
||||
"bypass_message_retention_policy": {
|
||||
"name": "Bypass Message Retention Policy",
|
||||
"description": "Prevents messages from being deleted after viewing them"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -10,6 +10,7 @@ class MessagingTweaks : ConfigContainer() {
|
||||
val hideTypingNotifications = boolean("hide_typing_notifications")
|
||||
val unlimitedSnapViewTime = boolean("unlimited_snap_view_time")
|
||||
val disableReplayInFF = boolean("disable_replay_in_ff")
|
||||
val messagePreviewLength = integer("message_preview_length", defaultValue = 20)
|
||||
val autoSaveMessagesInConversations = multiple("auto_save_messages_in_conversations",
|
||||
"CHAT",
|
||||
"SNAP",
|
||||
@ -27,5 +28,5 @@ class MessagingTweaks : ConfigContainer() {
|
||||
}
|
||||
val messageLogger = boolean("message_logger") { addNotices(FeatureNotice.UNSTABLE); requireRestart() }
|
||||
val galleryMediaSendOverride = boolean("gallery_media_send_override") { nativeHooks() }
|
||||
val messagePreviewLength = integer("message_preview_length", defaultValue = 20)
|
||||
val bypassMessageRetentionPolicy = boolean("bypass_message_retention_policy") { addNotices(FeatureNotice.UNSTABLE); requireRestart() }
|
||||
}
|
@ -57,15 +57,19 @@ class Messaging : Feature("Messaging", loadParams = FeatureLoadParams.ACTIVITY_C
|
||||
}
|
||||
|
||||
with(context.classCache.conversationManager) {
|
||||
Hooker.hook(this, "enterConversation", HookStage.BEFORE) {
|
||||
openedConversationUUID = SnapUUID(it.arg(0))
|
||||
Hooker.hook(this, "enterConversation", HookStage.BEFORE) { param ->
|
||||
openedConversationUUID = SnapUUID(param.arg(0))
|
||||
if (context.config.messaging.bypassMessageRetentionPolicy.get()) {
|
||||
val callback = param.argNullable<Any>(2) ?: return@hook
|
||||
callback::class.java.methods.firstOrNull { it.name == "onSuccess" }?.invoke(callback)
|
||||
param.setResult(null)
|
||||
}
|
||||
}
|
||||
|
||||
Hooker.hook(this, "exitConversation", HookStage.BEFORE) {
|
||||
openedConversationUUID = null
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
override fun asyncInit() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user