mirror of
https://github.com/rhunk/SnapEnhance.git
synced 2025-04-29 22:24:35 +02:00
feat(core/message_logger): deleted message color
Signed-off-by: rhunk <101876869+rhunk@users.noreply.github.com>
This commit is contained in:
parent
2c435a3760
commit
1e290149ec
@ -473,9 +473,12 @@ class AlertDialogs(
|
||||
|
||||
ColorPickerDialog(
|
||||
initialColor = currentColor,
|
||||
setProperty = {
|
||||
setProperty = setProperty@{
|
||||
currentColor = it
|
||||
property.value.setAny(it?.toArgb())
|
||||
if (it == null) {
|
||||
property.value.setAny(property.value.defaultValues?.firstOrNull() ?: return@setProperty)
|
||||
}
|
||||
},
|
||||
dismiss = dismiss
|
||||
)
|
||||
|
@ -713,6 +713,10 @@
|
||||
"message_filter": {
|
||||
"name": "Message Filter",
|
||||
"description": "Select which messages should get logged (empty for all messages)"
|
||||
},
|
||||
"deleted_message_color": {
|
||||
"name": "Deleted Message Color",
|
||||
"description": "Sets the color of deleted messages"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -72,7 +72,7 @@ open class ConfigContainer(
|
||||
key: String,
|
||||
defaultValue: Int? = null,
|
||||
params: ConfigParamsBuilder = {}
|
||||
) = registerProperty(key, DataProcessors.INT_COLOR, PropertyValue(defaultValue), params)
|
||||
) = registerProperty(key, DataProcessors.INT_COLOR, PropertyValue(defaultValue, defaultValues = defaultValue?.let { listOf(it) }), params)
|
||||
|
||||
fun toJson(exportSensitiveData: Boolean = true): JsonObject {
|
||||
val json = JsonObject()
|
||||
|
@ -9,6 +9,10 @@ import me.rhunk.snapenhance.common.util.PURGE_TRANSLATION_KEY
|
||||
import me.rhunk.snapenhance.common.util.PURGE_VALUES
|
||||
|
||||
class MessagingTweaks : ConfigContainer() {
|
||||
companion object {
|
||||
const val DELETED_MESSAGE_COLOR = 0x6Eb71c1c;
|
||||
}
|
||||
|
||||
inner class HalfSwipeNotifierConfig : ConfigContainer(hasGlobalState = true) {
|
||||
val minDuration: PropertyValue<Int> = integer("min_duration", defaultValue = 0) {
|
||||
inputCheck = { it.toIntOrNull()?.coerceAtLeast(0) != null && maxDuration.get() >= it.toInt() }
|
||||
@ -24,7 +28,6 @@ class MessagingTweaks : ConfigContainer() {
|
||||
customOptionTranslationPath = PURGE_TRANSLATION_KEY
|
||||
disabledKey = PURGE_DISABLED_KEY
|
||||
}.apply { set("3_days") }
|
||||
|
||||
val messageFilter = multiple("message_filter", "CHAT",
|
||||
"SNAP",
|
||||
"NOTE",
|
||||
@ -33,6 +36,7 @@ class MessagingTweaks : ConfigContainer() {
|
||||
) {
|
||||
customOptionTranslationPath = "content_type"
|
||||
}
|
||||
val deletedMessageColor = color("deleted_message_color", DELETED_MESSAGE_COLOR)
|
||||
}
|
||||
|
||||
class BetterNotifications: ConfigContainer() {
|
||||
@ -89,7 +93,7 @@ class MessagingTweaks : ConfigContainer() {
|
||||
val notificationBlacklist = multiple("notification_blacklist", *NotificationType.getIncomingValues().map { it.key }.toTypedArray()) {
|
||||
customOptionTranslationPath = "features.options.notifications"
|
||||
}
|
||||
val messageLogger = container("message_logger", MessageLoggerConfig()) { addNotices(FeatureNotice.UNSTABLE); requireRestart() }
|
||||
val messageLogger = container("message_logger", MessageLoggerConfig()) { requireRestart() }
|
||||
val galleryMediaSendOverride = unique("gallery_media_send_override", "always_ask", "SNAP", "NOTE", "SAVEABLE_SNAP") { requireRestart(); nativeHooks() }
|
||||
val stripMediaMetadata = multiple("strip_media_metadata", "hide_caption_text", "hide_snap_filters", "hide_extras", "remove_audio_note_duration", "remove_audio_note_transcript_capability") { requireRestart() }
|
||||
val bypassMessageRetentionPolicy = boolean("bypass_message_retention_policy") { addNotices(FeatureNotice.UNSTABLE); requireRestart() }
|
||||
|
@ -9,6 +9,7 @@ import com.google.gson.JsonObject
|
||||
import com.google.gson.JsonParser
|
||||
import me.rhunk.snapenhance.bridge.logger.BridgeLoggedMessage
|
||||
import me.rhunk.snapenhance.bridge.logger.LoggedChatEdit
|
||||
import me.rhunk.snapenhance.common.config.impl.MessagingTweaks
|
||||
import me.rhunk.snapenhance.common.data.ContentType
|
||||
import me.rhunk.snapenhance.common.data.MessageState
|
||||
import me.rhunk.snapenhance.common.data.QuotedMessageContentStatus
|
||||
@ -28,7 +29,6 @@ class MessageLogger : Feature("MessageLogger") {
|
||||
companion object {
|
||||
const val PREFETCH_MESSAGE_COUNT = 20
|
||||
const val PREFETCH_FEED_COUNT = 20
|
||||
const val DELETED_MESSAGE_COLOR = 0x6Eb71c1c
|
||||
}
|
||||
|
||||
private val loggerInterface by lazyBridge { context.bridgeClient.getMessageLogger() }
|
||||
@ -186,7 +186,7 @@ class MessageLogger : Feature("MessageLogger") {
|
||||
event.view.addForegroundDrawable("deletedMessage", ShapeDrawable(object: Shape() {
|
||||
override fun draw(canvas: Canvas, paint: Paint) {
|
||||
canvas.drawRect(0f, 0f, canvas.width.toFloat(), canvas.height.toFloat(), Paint().apply {
|
||||
color = DELETED_MESSAGE_COLOR
|
||||
color = context.config.messaging.messageLogger.deletedMessageColor.getNullable() ?: MessagingTweaks.DELETED_MESSAGE_COLOR
|
||||
})
|
||||
}
|
||||
}))
|
||||
|
Loading…
x
Reference in New Issue
Block a user