mirror of
https://github.com/rhunk/SnapEnhance.git
synced 2025-05-16 22:27: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",
|
"name": "Disable Replay in FF",
|
||||||
"description": "Disables the ability to replay with a long press from the Friend Feed"
|
"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": {
|
"prevent_message_sending": {
|
||||||
"name": "Prevent Message Sending",
|
"name": "Prevent Message Sending",
|
||||||
"description": "Prevents sending certain types of messages"
|
"description": "Prevents sending certain types of messages"
|
||||||
@ -352,9 +356,9 @@
|
|||||||
"name": "Gallery Media Send Override",
|
"name": "Gallery Media Send Override",
|
||||||
"description": "Spoofs the media source when sending from the Gallery"
|
"description": "Spoofs the media source when sending from the Gallery"
|
||||||
},
|
},
|
||||||
"message_preview_length": {
|
"bypass_message_retention_policy": {
|
||||||
"name": "Message Preview Length",
|
"name": "Bypass Message Retention Policy",
|
||||||
"description": "Specify the amount of messages to get previewed"
|
"description": "Prevents messages from being deleted after viewing them"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -10,6 +10,7 @@ class MessagingTweaks : ConfigContainer() {
|
|||||||
val hideTypingNotifications = boolean("hide_typing_notifications")
|
val hideTypingNotifications = boolean("hide_typing_notifications")
|
||||||
val unlimitedSnapViewTime = boolean("unlimited_snap_view_time")
|
val unlimitedSnapViewTime = boolean("unlimited_snap_view_time")
|
||||||
val disableReplayInFF = boolean("disable_replay_in_ff")
|
val disableReplayInFF = boolean("disable_replay_in_ff")
|
||||||
|
val messagePreviewLength = integer("message_preview_length", defaultValue = 20)
|
||||||
val autoSaveMessagesInConversations = multiple("auto_save_messages_in_conversations",
|
val autoSaveMessagesInConversations = multiple("auto_save_messages_in_conversations",
|
||||||
"CHAT",
|
"CHAT",
|
||||||
"SNAP",
|
"SNAP",
|
||||||
@ -27,5 +28,5 @@ class MessagingTweaks : ConfigContainer() {
|
|||||||
}
|
}
|
||||||
val messageLogger = boolean("message_logger") { addNotices(FeatureNotice.UNSTABLE); requireRestart() }
|
val messageLogger = boolean("message_logger") { addNotices(FeatureNotice.UNSTABLE); requireRestart() }
|
||||||
val galleryMediaSendOverride = boolean("gallery_media_send_override") { nativeHooks() }
|
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) {
|
with(context.classCache.conversationManager) {
|
||||||
Hooker.hook(this, "enterConversation", HookStage.BEFORE) {
|
Hooker.hook(this, "enterConversation", HookStage.BEFORE) { param ->
|
||||||
openedConversationUUID = SnapUUID(it.arg(0))
|
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) {
|
Hooker.hook(this, "exitConversation", HookStage.BEFORE) {
|
||||||
openedConversationUUID = null
|
openedConversationUUID = null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun asyncInit() {
|
override fun asyncInit() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user