mirror of
https://github.com/rhunk/SnapEnhance.git
synced 2025-05-23 18:16:15 +02:00
feat(manager/chat_purge): random delay
This commit is contained in:
parent
c533983fb3
commit
50a43ee6ad
@ -25,6 +25,7 @@ import me.rhunk.snapenhance.common.util.protobuf.ProtoReader
|
|||||||
import me.rhunk.snapenhance.common.util.snap.SnapWidgetBroadcastReceiverHelper
|
import me.rhunk.snapenhance.common.util.snap.SnapWidgetBroadcastReceiverHelper
|
||||||
import me.rhunk.snapenhance.ui.util.AlertDialogs
|
import me.rhunk.snapenhance.ui.util.AlertDialogs
|
||||||
import me.rhunk.snapenhance.ui.util.Dialog
|
import me.rhunk.snapenhance.ui.util.Dialog
|
||||||
|
import kotlin.random.Random
|
||||||
|
|
||||||
class MessagingPreview(
|
class MessagingPreview(
|
||||||
private val context: RemoteSideContext,
|
private val context: RemoteSideContext,
|
||||||
@ -135,7 +136,10 @@ class MessagingPreview(
|
|||||||
|
|
||||||
if (deleteAllConfirmationDialog) {
|
if (deleteAllConfirmationDialog) {
|
||||||
Dialog(onDismissRequest = { deleteAllConfirmationDialog = false }) {
|
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
|
deleteAllConfirmationDialog = false
|
||||||
}, onConfirm = {
|
}, onConfirm = {
|
||||||
deletedMessageCount = 0
|
deletedMessageCount = 0
|
||||||
@ -161,6 +165,7 @@ class MessagingPreview(
|
|||||||
|
|
||||||
fetchedMessages.forEach {
|
fetchedMessages.forEach {
|
||||||
deleteIndividualMessage(it.serverMessageId)
|
deleteIndividualMessage(it.serverMessageId)
|
||||||
|
delay(Random.nextLong(50, 170))
|
||||||
}
|
}
|
||||||
|
|
||||||
lastMessageId = fetchedMessages.first().clientMessageId
|
lastMessageId = fetchedMessages.first().clientMessageId
|
||||||
|
@ -94,6 +94,11 @@ class SocialSection : Section() {
|
|||||||
currentMessagingPreview = messagePreview
|
currentMessagingPreview = messagePreview
|
||||||
}
|
}
|
||||||
messagePreview.Content()
|
messagePreview.Content()
|
||||||
|
DisposableEffect(Unit) {
|
||||||
|
onDispose {
|
||||||
|
currentMessagingPreview = null
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user