commit 114dccb7c2eaf92b70f95dd6bf52275dec3eef9a
parent 51a2fe88cd3a9db26de6d0809d78e49e10f5e459
Author: rhunk <101876869+rhunk@users.noreply.github.com>
Date:   Tue, 19 Mar 2024 00:51:13 +0100

feat(core): ovf & director mode message indicators

Diffstat:
Mcommon/src/main/assets/lang/en_US.json | 4+++-
Mcommon/src/main/kotlin/me/rhunk/snapenhance/common/config/impl/UserInterfaceTweaks.kt | 2+-
Mcore/src/main/kotlin/me/rhunk/snapenhance/core/features/impl/ui/MessageIndicators.kt | 28+++++++++++++++++++++++++++-
3 files changed, 31 insertions(+), 3 deletions(-)

diff --git a/common/src/main/assets/lang/en_US.json b/common/src/main/assets/lang/en_US.json @@ -980,7 +980,9 @@ "message_indicators": { "encryption_indicator": "Adds a \uD83D\uDD12 icon next to messages that have been sent only to you", "platform_indicator": "Adds the platform icon from which a media was sent (e.g. Android, iOS, Web)", - "location_indicator": "Adds a \uD83D\uDCCD icon to snaps when they have been sent with location enabled" + "location_indicator": "Adds a \uD83D\uDCCD icon to snaps when they have been sent with location enabled", + "ovf_editor_indicator": "Indicates if a snap has been sent using OVF Editor", + "director_mode_indicator": "Adds a \u270F\uFE0F icon to snaps when they have been sent using Director Mode, which can be used to send gallery images as snaps" } } }, diff --git a/common/src/main/kotlin/me/rhunk/snapenhance/common/config/impl/UserInterfaceTweaks.kt b/common/src/main/kotlin/me/rhunk/snapenhance/common/config/impl/UserInterfaceTweaks.kt @@ -47,7 +47,7 @@ class UserInterfaceTweaks : ConfigContainer() { val disableSpotlight = boolean("disable_spotlight") { requireRestart() } val hideSettingsGear = boolean("hide_settings_gear") { requireRestart() } val verticalStoryViewer = boolean("vertical_story_viewer") { requireRestart() } - val messageIndicators = multiple("message_indicators", "encryption_indicator", "platform_indicator", "location_indicator") { requireRestart() } + val messageIndicators = multiple("message_indicators", "encryption_indicator", "platform_indicator", "location_indicator", "ovf_editor_indicator", "director_mode_indicator") { requireRestart() } val stealthModeIndicator = boolean("stealth_mode_indicator") { requireRestart() } val editTextOverride = multiple("edit_text_override", "multi_line_chat_input", "bypass_text_input_limit") { requireRestart(); addNotices(FeatureNotice.BAN_RISK, FeatureNotice.INTERNAL_BEHAVIOR) diff --git a/core/src/main/kotlin/me/rhunk/snapenhance/core/features/impl/ui/MessageIndicators.kt b/core/src/main/kotlin/me/rhunk/snapenhance/core/features/impl/ui/MessageIndicators.kt @@ -11,14 +11,18 @@ import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size import androidx.compose.material.icons.Icons import androidx.compose.material.icons.filled.Android +import androidx.compose.material.icons.filled.Edit import androidx.compose.material.icons.filled.Laptop import androidx.compose.material.icons.filled.LocationOn import androidx.compose.material.icons.filled.Lock +import androidx.compose.material3.Text import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.ColorFilter +import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.unit.dp +import androidx.compose.ui.unit.sp import me.rhunk.snapenhance.common.data.ContentType import me.rhunk.snapenhance.common.ui.createComposeView import me.rhunk.snapenhance.common.util.protobuf.ProtoReader @@ -52,6 +56,10 @@ class MessageIndicators : Feature("Message Indicators", loadParams = FeatureLoad val sentFromIosDevice = if (reader.containsPath(4, 4, 3)) !reader.containsPath(4, 4, 3, 3, 17) else reader.getVarInt(4, 4, 11, 17, 7) != null val sentFromWebApp = reader.getVarInt(4, 4, *(if (reader.containsPath(4, 4, 3)) intArrayOf(3, 3, 22, 1) else intArrayOf(11, 22, 1))) == 7L val sentWithLocation = reader.getVarInt(4, 4, 11, 17, 5) != null + val sentUsingOvfEditor = (reader.getString(4, 4, 11, 12, 1) ?: reader.getString(4, 4, 11, 13, 4, 1, 2, 12, 20, 1)) == "c13129f7-fe4a-44c4-9b9d-e0b26fee8f82" + val sentUsingDirectorMode = reader.followPath(4, 4, 11, 28)?.let { + (it.getVarInt(1) to it.getVarInt(2)) == (0L to 0L) + } == true || reader.getByteArray(4, 4, 11, 13, 4, 1, 2, 12, 27, 1) != null createComposeView(event.view.context) { Box( @@ -60,7 +68,9 @@ class MessageIndicators : Feature("Message Indicators", loadParams = FeatureLoad .padding(top = 4.dp, end = 1.dp), contentAlignment = Alignment.BottomEnd ) { - Row { + Row( + verticalAlignment = Alignment.CenterVertically + ) { if (messageIndicatorsConfig.contains("location_indicator")) { if (sentWithLocation) { Image( @@ -91,6 +101,22 @@ class MessageIndicators : Feature("Message Indicators", loadParams = FeatureLoad modifier = Modifier.size(15.dp) ) } + if (sentUsingDirectorMode && messageIndicatorsConfig.contains("director_mode_indicator")) { + Image( + imageVector = Icons.Default.Edit, + colorFilter = ColorFilter.tint(Color.Red), + contentDescription = null, + modifier = Modifier.size(15.dp) + ) + } + if (sentUsingOvfEditor && messageIndicatorsConfig.contains("ovf_editor_indicator")) { + Text( + text = "OVF", + color = Color.Red, + fontWeight = FontWeight.ExtraBold, + fontSize = 10.sp, + ) + } } } }.apply {