commit edba5922413b3eb2af0fd454333c145727a8ae0f
parent d85ff40c45ade47f9966131801d6b939db72396b
Author: rhunk <101876869+rhunk@users.noreply.github.com>
Date:   Fri, 26 May 2023 22:00:53 +0200

fix: no sound for live snaps

Diffstat:
Mapp/src/main/kotlin/me/rhunk/snapenhance/features/impl/extras/UnlimitedSnapViewTime.kt | 16++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/app/src/main/kotlin/me/rhunk/snapenhance/features/impl/extras/UnlimitedSnapViewTime.kt b/app/src/main/kotlin/me/rhunk/snapenhance/features/impl/extras/UnlimitedSnapViewTime.kt @@ -9,6 +9,7 @@ import me.rhunk.snapenhance.features.FeatureLoadParams import me.rhunk.snapenhance.hook.HookStage import me.rhunk.snapenhance.hook.Hooker import me.rhunk.snapenhance.util.protobuf.ProtoEditor +import me.rhunk.snapenhance.util.protobuf.ProtoReader class UnlimitedSnapViewTime : Feature("UnlimitedSnapViewTime", loadParams = FeatureLoadParams.ACTIVITY_CREATE_SYNC) { @@ -20,12 +21,15 @@ class UnlimitedSnapViewTime : if (message.messageState != MessageState.COMMITTED) return@hookConstructor if (message.messageContent.contentType != ContentType.SNAP) return@hookConstructor - message.messageContent.content = ProtoEditor(message.messageContent.content).apply { - edit(11, 5, 2) { - writeConstant(5, 0) - writeBuffer(6, byteArrayOf()) - } - }.toByteArray() + with(message.messageContent) { + val hasSound = ProtoReader(this.content).getInt(11, 5, 2, 5)!! + this.content = ProtoEditor(this.content).apply { + edit(11, 5, 2) { + writeConstant(5, hasSound) + writeBuffer(6, byteArrayOf()) + } + }.toByteArray() + } } } }