From 3c0e1b7a23dab3e4c87c0e315a10f7d15e7a06b0 Mon Sep 17 00:00:00 2001 From: rhunk <101876869+rhunk@users.noreply.github.com> Date: Thu, 9 May 2024 16:06:43 +0200 Subject: [PATCH] feat(message_decoder): memories story share --- .../impl/downloader/decoder/MessageDecoder.kt | 25 +++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/core/src/main/kotlin/me/rhunk/snapenhance/core/features/impl/downloader/decoder/MessageDecoder.kt b/core/src/main/kotlin/me/rhunk/snapenhance/core/features/impl/downloader/decoder/MessageDecoder.kt index dc947104..a54fc4b4 100644 --- a/core/src/main/kotlin/me/rhunk/snapenhance/core/features/impl/downloader/decoder/MessageDecoder.kt +++ b/core/src/main/kotlin/me/rhunk/snapenhance/core/features/impl/downloader/decoder/MessageDecoder.kt @@ -138,6 +138,19 @@ object MessageDecoder { } } + fun ProtoReader.decodeShares() { + // saved story + followPath(24, 2) { + decodeSnapDocMedia(AttachmentType.EXTERNAL_MEDIA, this) + } + // memories story + followPath(11) { + eachBuffer(3) { + decodeSnapDocMedia(AttachmentType.EXTERNAL_MEDIA, this) + } + } + } + // media keys protoReader.eachBuffer(4, 5) { getByteArray(1, 3)?.also { mediaKey -> @@ -157,8 +170,8 @@ object MessageDecoder { followPath(4) { decodeSticker(this) } // shares - followPath(5, 24, 2) { - decodeSnapDocMedia(AttachmentType.EXTERNAL_MEDIA, this) + followPath(5) { + decodeShares() } // audio notes @@ -189,8 +202,16 @@ object MessageDecoder { // attached sticker followPath(13) { decodeSticker(this) } + // reply shares + followPath(14) { decodeShares() } + // attached audio note followPath(15) { decodeSnapDocMediaPlayback(AttachmentType.NOTE, this) } + + // reply snap + followPath(17) { + decodeSnapDocMedia(AttachmentType.SNAP, this) + } } // snaps