mirror of
https://github.com/rhunk/SnapEnhance.git
synced 2025-05-29 13:00:17 +02:00
refactor: NativeUnaryCallEvent
This commit is contained in:
parent
b925e8f546
commit
47e9a0e0b1
@ -299,7 +299,7 @@ class HomeSection : Section() {
|
|||||||
.scale(1.75f)
|
.scale(1.75f)
|
||||||
)
|
)
|
||||||
Text(
|
Text(
|
||||||
text = ("\u0065" + "\u0063" + "\u006e" + "\u0061" + "\u0068" + "\u006e" + "\u0045" + "\u0070" + "\u0061" + "\u006e" + "\u0053").reversed(),
|
text = arrayOf("\u0065", "\u0063", "\u006e", "\u0061", "\u0068", "\u006e", "\u0045", "\u0070", "\u0061", "\u006e", "\u0053").reversed().joinToString(""),
|
||||||
fontSize = 30.sp,
|
fontSize = 30.sp,
|
||||||
modifier = Modifier.padding(16.dp),
|
modifier = Modifier.padding(16.dp),
|
||||||
)
|
)
|
||||||
|
@ -18,7 +18,7 @@ import me.rhunk.snapenhance.core.bridge.BridgeClient
|
|||||||
import me.rhunk.snapenhance.core.bridge.loadFromBridge
|
import me.rhunk.snapenhance.core.bridge.loadFromBridge
|
||||||
import me.rhunk.snapenhance.core.data.SnapClassCache
|
import me.rhunk.snapenhance.core.data.SnapClassCache
|
||||||
import me.rhunk.snapenhance.core.event.events.impl.SnapWidgetBroadcastReceiveEvent
|
import me.rhunk.snapenhance.core.event.events.impl.SnapWidgetBroadcastReceiveEvent
|
||||||
import me.rhunk.snapenhance.core.event.events.impl.UnaryCallEvent
|
import me.rhunk.snapenhance.core.event.events.impl.NativeUnaryCallEvent
|
||||||
import me.rhunk.snapenhance.core.util.LSPatchUpdater
|
import me.rhunk.snapenhance.core.util.LSPatchUpdater
|
||||||
import me.rhunk.snapenhance.core.util.hook.HookStage
|
import me.rhunk.snapenhance.core.util.hook.HookStage
|
||||||
import me.rhunk.snapenhance.core.util.hook.hook
|
import me.rhunk.snapenhance.core.util.hook.hook
|
||||||
@ -165,7 +165,7 @@ class SnapEnhance {
|
|||||||
if (appContext.config.experimental.nativeHooks.globalState != true) return@apply
|
if (appContext.config.experimental.nativeHooks.globalState != true) return@apply
|
||||||
initOnce(appContext.androidContext.classLoader)
|
initOnce(appContext.androidContext.classLoader)
|
||||||
nativeUnaryCallCallback = { request ->
|
nativeUnaryCallCallback = { request ->
|
||||||
appContext.event.post(UnaryCallEvent(request.uri, request.buffer)) {
|
appContext.event.post(NativeUnaryCallEvent(request.uri, request.buffer)) {
|
||||||
request.buffer = buffer
|
request.buffer = buffer
|
||||||
request.canceled = canceled
|
request.canceled = canceled
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@ package me.rhunk.snapenhance.core.event.events.impl
|
|||||||
|
|
||||||
import me.rhunk.snapenhance.core.event.events.AbstractHookEvent
|
import me.rhunk.snapenhance.core.event.events.AbstractHookEvent
|
||||||
|
|
||||||
class UnaryCallEvent(
|
class NativeUnaryCallEvent(
|
||||||
val uri: String,
|
val uri: String,
|
||||||
var buffer: ByteArray
|
var buffer: ByteArray
|
||||||
) : AbstractHookEvent()
|
) : AbstractHookEvent()
|
@ -22,7 +22,7 @@ import me.rhunk.snapenhance.core.event.events.impl.AddViewEvent
|
|||||||
import me.rhunk.snapenhance.core.event.events.impl.BindViewEvent
|
import me.rhunk.snapenhance.core.event.events.impl.BindViewEvent
|
||||||
import me.rhunk.snapenhance.core.event.events.impl.BuildMessageEvent
|
import me.rhunk.snapenhance.core.event.events.impl.BuildMessageEvent
|
||||||
import me.rhunk.snapenhance.core.event.events.impl.SendMessageWithContentEvent
|
import me.rhunk.snapenhance.core.event.events.impl.SendMessageWithContentEvent
|
||||||
import me.rhunk.snapenhance.core.event.events.impl.UnaryCallEvent
|
import me.rhunk.snapenhance.core.event.events.impl.NativeUnaryCallEvent
|
||||||
import me.rhunk.snapenhance.core.features.FeatureLoadParams
|
import me.rhunk.snapenhance.core.features.FeatureLoadParams
|
||||||
import me.rhunk.snapenhance.core.features.MessagingRuleFeature
|
import me.rhunk.snapenhance.core.features.MessagingRuleFeature
|
||||||
import me.rhunk.snapenhance.core.features.impl.messaging.Messaging
|
import me.rhunk.snapenhance.core.features.impl.messaging.Messaging
|
||||||
@ -417,7 +417,7 @@ class EndToEndEncryption : MessagingRuleFeature(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
context.event.subscribe(UnaryCallEvent::class) { event ->
|
context.event.subscribe(NativeUnaryCallEvent::class) { event ->
|
||||||
if (event.uri != "/messagingcoreservice.MessagingCoreService/CreateContentMessage") return@subscribe
|
if (event.uri != "/messagingcoreservice.MessagingCoreService/CreateContentMessage") return@subscribe
|
||||||
val protoReader = ProtoReader(event.buffer)
|
val protoReader = ProtoReader(event.buffer)
|
||||||
var hasStory = false
|
var hasStory = false
|
||||||
|
@ -3,7 +3,7 @@ package me.rhunk.snapenhance.core.features.impl.messaging
|
|||||||
import me.rhunk.snapenhance.common.data.NotificationType
|
import me.rhunk.snapenhance.common.data.NotificationType
|
||||||
import me.rhunk.snapenhance.common.util.protobuf.ProtoEditor
|
import me.rhunk.snapenhance.common.util.protobuf.ProtoEditor
|
||||||
import me.rhunk.snapenhance.core.event.events.impl.SendMessageWithContentEvent
|
import me.rhunk.snapenhance.core.event.events.impl.SendMessageWithContentEvent
|
||||||
import me.rhunk.snapenhance.core.event.events.impl.UnaryCallEvent
|
import me.rhunk.snapenhance.core.event.events.impl.NativeUnaryCallEvent
|
||||||
import me.rhunk.snapenhance.core.features.Feature
|
import me.rhunk.snapenhance.core.features.Feature
|
||||||
import me.rhunk.snapenhance.core.features.FeatureLoadParams
|
import me.rhunk.snapenhance.core.features.FeatureLoadParams
|
||||||
import me.rhunk.snapenhance.core.util.hook.HookStage
|
import me.rhunk.snapenhance.core.util.hook.HookStage
|
||||||
@ -13,7 +13,7 @@ class PreventMessageSending : Feature("Prevent message sending", loadParams = Fe
|
|||||||
override fun asyncOnActivityCreate() {
|
override fun asyncOnActivityCreate() {
|
||||||
val preventMessageSending by context.config.messaging.preventMessageSending
|
val preventMessageSending by context.config.messaging.preventMessageSending
|
||||||
|
|
||||||
context.event.subscribe(UnaryCallEvent::class, { preventMessageSending.contains("snap_replay") }) { event ->
|
context.event.subscribe(NativeUnaryCallEvent::class, { preventMessageSending.contains("snap_replay") }) { event ->
|
||||||
if (event.uri != "/messagingcoreservice.MessagingCoreService/UpdateContentMessage") return@subscribe
|
if (event.uri != "/messagingcoreservice.MessagingCoreService/UpdateContentMessage") return@subscribe
|
||||||
event.buffer = ProtoEditor(event.buffer).apply {
|
event.buffer = ProtoEditor(event.buffer).apply {
|
||||||
edit(3) {
|
edit(3) {
|
||||||
|
@ -4,7 +4,7 @@ import me.rhunk.snapenhance.common.data.ContentType
|
|||||||
import me.rhunk.snapenhance.common.util.protobuf.ProtoEditor
|
import me.rhunk.snapenhance.common.util.protobuf.ProtoEditor
|
||||||
import me.rhunk.snapenhance.common.util.protobuf.ProtoReader
|
import me.rhunk.snapenhance.common.util.protobuf.ProtoReader
|
||||||
import me.rhunk.snapenhance.core.event.events.impl.SendMessageWithContentEvent
|
import me.rhunk.snapenhance.core.event.events.impl.SendMessageWithContentEvent
|
||||||
import me.rhunk.snapenhance.core.event.events.impl.UnaryCallEvent
|
import me.rhunk.snapenhance.core.event.events.impl.NativeUnaryCallEvent
|
||||||
import me.rhunk.snapenhance.core.features.Feature
|
import me.rhunk.snapenhance.core.features.Feature
|
||||||
import me.rhunk.snapenhance.core.features.FeatureLoadParams
|
import me.rhunk.snapenhance.core.features.FeatureLoadParams
|
||||||
import me.rhunk.snapenhance.core.messaging.MessageSender
|
import me.rhunk.snapenhance.core.messaging.MessageSender
|
||||||
@ -29,7 +29,7 @@ class SendOverride : Feature("Send Override", loadParams = FeatureLoadParams.INI
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun init() {
|
override fun init() {
|
||||||
context.event.subscribe(UnaryCallEvent::class) { event ->
|
context.event.subscribe(NativeUnaryCallEvent::class) { event ->
|
||||||
if (event.uri != "/messagingcoreservice.MessagingCoreService/CreateContentMessage") return@subscribe
|
if (event.uri != "/messagingcoreservice.MessagingCoreService/CreateContentMessage") return@subscribe
|
||||||
val protoEditor = ProtoEditor(event.buffer)
|
val protoEditor = ProtoEditor(event.buffer)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user