commit 50a43ee6ad81cd41cb6f70f96c9e990932856b32
parent c533983fb3ee67d4a744ca7e85c80287ce87bf28
Author: rhunk <101876869+rhunk@users.noreply.github.com>
Date: Sun, 15 Oct 2023 00:49:28 +0200
feat(manager/chat_purge): random delay
Diffstat:
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/app/src/main/kotlin/me/rhunk/snapenhance/ui/manager/sections/social/MessagingPreview.kt b/app/src/main/kotlin/me/rhunk/snapenhance/ui/manager/sections/social/MessagingPreview.kt
@@ -25,6 +25,7 @@ import me.rhunk.snapenhance.common.util.protobuf.ProtoReader
import me.rhunk.snapenhance.common.util.snap.SnapWidgetBroadcastReceiverHelper
import me.rhunk.snapenhance.ui.util.AlertDialogs
import me.rhunk.snapenhance.ui.util.Dialog
+import kotlin.random.Random
class MessagingPreview(
private val context: RemoteSideContext,
@@ -135,7 +136,10 @@ class MessagingPreview(
if (deleteAllConfirmationDialog) {
Dialog(onDismissRequest = { deleteAllConfirmationDialog = false }) {
- alertDialogs.ConfirmDialog(title = "Are you sure you want to delete all your messages?", onDismiss = {
+ alertDialogs.ConfirmDialog(
+ title = "Are you sure you want to delete all your messages?",
+ message = "Warning: This action may flag your account for spam if used excessively.",
+ onDismiss = {
deleteAllConfirmationDialog = false
}, onConfirm = {
deletedMessageCount = 0
@@ -161,6 +165,7 @@ class MessagingPreview(
fetchedMessages.forEach {
deleteIndividualMessage(it.serverMessageId)
+ delay(Random.nextLong(50, 170))
}
lastMessageId = fetchedMessages.first().clientMessageId
diff --git a/app/src/main/kotlin/me/rhunk/snapenhance/ui/manager/sections/social/SocialSection.kt b/app/src/main/kotlin/me/rhunk/snapenhance/ui/manager/sections/social/SocialSection.kt
@@ -94,6 +94,11 @@ class SocialSection : Section() {
currentMessagingPreview = messagePreview
}
messagePreview.Content()
+ DisposableEffect(Unit) {
+ onDispose {
+ currentMessagingPreview = null
+ }
+ }
}
}
}