mirror of
https://github.com/quik-sms/quik.git
synced 2026-11-23 06:08:52 +01:00
remove pii logs
This commit is contained in:
@@ -68,15 +68,6 @@ object EmojiReactionUtils {
|
|||||||
)
|
)
|
||||||
|
|
||||||
fun parseEmojiReaction(body: String): ParsedEmojiReaction? {
|
fun parseEmojiReaction(body: String): ParsedEmojiReaction? {
|
||||||
// Log the raw message with unicode escapes for debugging
|
|
||||||
val escapedBody = body.map { char ->
|
|
||||||
when (char.code) {
|
|
||||||
in 0x20..0x7E -> char.toString() // printable ASCII
|
|
||||||
else -> "\\u${char.code.toString(16).padStart(4, '0')}"
|
|
||||||
}
|
|
||||||
}.joinToString("")
|
|
||||||
Timber.d("Parsing body: \"$escapedBody\"") // TODO: are we okay logging SMS content?
|
|
||||||
|
|
||||||
val removal = parseRemoval(body)
|
val removal = parseRemoval(body)
|
||||||
if (removal != null) return removal
|
if (removal != null) return removal
|
||||||
|
|
||||||
@@ -132,14 +123,14 @@ object EmojiReactionUtils {
|
|||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
fun removeEmojiReaction(
|
private fun removeEmojiReaction(
|
||||||
reactionMessage: Message,
|
reactionMessage: Message,
|
||||||
parsedReaction: ParsedEmojiReaction,
|
reaction: ParsedEmojiReaction,
|
||||||
targetMessage: Message?,
|
targetMessage: Message?,
|
||||||
realm: Realm,
|
realm: Realm,
|
||||||
) {
|
) {
|
||||||
if (targetMessage == null) {
|
if (targetMessage == null) {
|
||||||
Timber.w("Cannot remove emoji reaction: no target message found for '${parsedReaction.originalMessage}'")
|
Timber.w("Cannot remove emoji reaction '${reaction.emoji}': no target message found")
|
||||||
reactionMessage.isEmojiReaction = true
|
reactionMessage.isEmojiReaction = true
|
||||||
realm.insertOrUpdate(reactionMessage)
|
realm.insertOrUpdate(reactionMessage)
|
||||||
return
|
return
|
||||||
@@ -148,14 +139,14 @@ object EmojiReactionUtils {
|
|||||||
val existingReaction = realm.where(EmojiReaction::class.java)
|
val existingReaction = realm.where(EmojiReaction::class.java)
|
||||||
.equalTo("targetMessageId", targetMessage.id)
|
.equalTo("targetMessageId", targetMessage.id)
|
||||||
.equalTo("senderAddress", reactionMessage.address)
|
.equalTo("senderAddress", reactionMessage.address)
|
||||||
.equalTo("emoji", parsedReaction.emoji)
|
.equalTo("emoji", reaction.emoji)
|
||||||
.findFirst()
|
.findFirst()
|
||||||
|
|
||||||
if (existingReaction != null) {
|
if (existingReaction != null) {
|
||||||
existingReaction.deleteFromRealm()
|
existingReaction.deleteFromRealm()
|
||||||
Timber.d("Removed emoji reaction: ${parsedReaction.emoji} from ${reactionMessage.address} to message ${targetMessage.id}")
|
Timber.d("Removed emoji reaction: ${reaction.emoji} to message ${targetMessage.id}")
|
||||||
} else {
|
} else {
|
||||||
Timber.w("No existing emoji reaction found to remove: ${parsedReaction.emoji} from ${reactionMessage.address} to message ${targetMessage.id}")
|
Timber.w("No existing emoji reaction found to remove: ${reaction.emoji} to message ${targetMessage.id}")
|
||||||
}
|
}
|
||||||
|
|
||||||
reactionMessage.isEmojiReaction = true
|
reactionMessage.isEmojiReaction = true
|
||||||
@@ -189,9 +180,9 @@ object EmojiReactionUtils {
|
|||||||
realm.insertOrUpdate(reactionMessage)
|
realm.insertOrUpdate(reactionMessage)
|
||||||
|
|
||||||
if (targetMessage != null) {
|
if (targetMessage != null) {
|
||||||
Timber.i("Saved emoji reaction: ${reaction.emoji} from ${reaction.senderAddress} to message ${targetMessage.id}")
|
Timber.i("Saved emoji reaction: ${reaction.emoji} to message ${targetMessage.id}")
|
||||||
} else {
|
} else {
|
||||||
Timber.w("Saved emoji reaction without target message: ${reaction.emoji} from ${reaction.senderAddress}")
|
Timber.w("Saved emoji reaction without target message: ${reaction.emoji}")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user