diff --git a/common/src/main/assets/lang/en_US.json b/common/src/main/assets/lang/en_US.json index 2db20be2..8ec53b9e 100644 --- a/common/src/main/assets/lang/en_US.json +++ b/common/src/main/assets/lang/en_US.json @@ -466,6 +466,10 @@ "name": "Bypass Message Retention Policy", "description": "Prevents messages from being deleted after viewing them" }, + "bypass_message_action_restrictions": { + "name": "Bypass Message Action Restrictions", + "description": "Allows you to react to a snap without having opened it or to save an unsaveable message" + }, "remove_groups_locked_status": { "name": "Remove Groups Locked Status", "description": "Allows you to view group information after being kicked" diff --git a/common/src/main/kotlin/me/rhunk/snapenhance/common/config/impl/MessagingTweaks.kt b/common/src/main/kotlin/me/rhunk/snapenhance/common/config/impl/MessagingTweaks.kt index f0618993..c2eda29a 100644 --- a/common/src/main/kotlin/me/rhunk/snapenhance/common/config/impl/MessagingTweaks.kt +++ b/common/src/main/kotlin/me/rhunk/snapenhance/common/config/impl/MessagingTweaks.kt @@ -80,5 +80,6 @@ class MessagingTweaks : ConfigContainer() { val galleryMediaSendOverride = boolean("gallery_media_send_override") { nativeHooks() } val stripMediaMetadata = multiple("strip_media_metadata", "hide_caption_text", "hide_snap_filters", "hide_extras", "remove_audio_note_duration", "remove_audio_note_transcript_capability") { requireRestart() } val bypassMessageRetentionPolicy = boolean("bypass_message_retention_policy") { addNotices(FeatureNotice.UNSTABLE); requireRestart() } + val bypassMessageActionRestrictions = boolean("bypass_message_action_restrictions") { requireRestart() } val removeGroupsLockedStatus = boolean("remove_groups_locked_status") { requireRestart() } } \ No newline at end of file diff --git a/core/src/main/kotlin/me/rhunk/snapenhance/core/features/FeatureManager.kt b/core/src/main/kotlin/me/rhunk/snapenhance/core/features/FeatureManager.kt index 56afcf58..6bc62094 100644 --- a/core/src/main/kotlin/me/rhunk/snapenhance/core/features/FeatureManager.kt +++ b/core/src/main/kotlin/me/rhunk/snapenhance/core/features/FeatureManager.kt @@ -123,6 +123,7 @@ class FeatureManager( DisableMemoriesSnapFeed(), AccountSwitcher(), RemoveGroupsLockedStatus(), + BypassMessageActionRestrictions(), ) initializeFeatures() diff --git a/core/src/main/kotlin/me/rhunk/snapenhance/core/features/impl/messaging/BypassMessageActionRestrictions.kt b/core/src/main/kotlin/me/rhunk/snapenhance/core/features/impl/messaging/BypassMessageActionRestrictions.kt new file mode 100644 index 00000000..9862a063 --- /dev/null +++ b/core/src/main/kotlin/me/rhunk/snapenhance/core/features/impl/messaging/BypassMessageActionRestrictions.kt @@ -0,0 +1,17 @@ +package me.rhunk.snapenhance.core.features.impl.messaging + +import me.rhunk.snapenhance.core.event.events.impl.BuildMessageEvent +import me.rhunk.snapenhance.core.features.Feature +import me.rhunk.snapenhance.core.features.FeatureLoadParams + +class BypassMessageActionRestrictions : Feature("Bypass Message Action Restrictions", loadParams = FeatureLoadParams.ACTIVITY_CREATE_SYNC) { + override fun onActivityCreate() { + if (!context.config.messaging.bypassMessageActionRestrictions.get()) return + context.event.subscribe(BuildMessageEvent::class, priority = 102) { event -> + event.message.messageMetadata?.apply { + isSaveable = true + isReactable = true + } + } + } +} \ No newline at end of file