feat(core/e2ee): native hooks warning

This commit is contained in:
rhunk
2023-10-31 01:09:49 +01:00
parent 407e69d184
commit a936f1fbc7

View File

@ -33,6 +33,7 @@ import me.rhunk.snapenhance.core.util.EvictingMap
import me.rhunk.snapenhance.core.util.ktx.getObjectField
import me.rhunk.snapenhance.core.wrapper.impl.MessageContent
import me.rhunk.snapenhance.core.wrapper.impl.SnapUUID
import me.rhunk.snapenhance.nativelib.NativeLib
import java.security.MessageDigest
import kotlin.random.Random
@ -393,6 +394,12 @@ class EndToEndEncryption : MessagingRuleFeature(
return@subscribe
}
if (!NativeLib.initialized) {
context.longToast("Failed to send! Please enable Native Hooks in the settings.")
event.canceled = true
return@subscribe
}
event.addInvokeLater {
if (messageContent.contentType == ContentType.SNAP) {
messageContent.contentType = ContentType.EXTERNAL_MEDIA