From bdc0ed36ebd53978f9eee37099a8b4b3bd2830bc Mon Sep 17 00:00:00 2001 From: Mikunj Date: Thu, 31 Oct 2019 13:20:07 +1100 Subject: [PATCH] Process public chat messages in a background thread and not the promise thread. --- src/org/thoughtcrime/securesms/loki/LokiPublicChatPoller.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/org/thoughtcrime/securesms/loki/LokiPublicChatPoller.kt b/src/org/thoughtcrime/securesms/loki/LokiPublicChatPoller.kt index 3e6685e429..71a577db75 100644 --- a/src/org/thoughtcrime/securesms/loki/LokiPublicChatPoller.kt +++ b/src/org/thoughtcrime/securesms/loki/LokiPublicChatPoller.kt @@ -25,6 +25,7 @@ import org.whispersystems.signalservice.api.push.SignalServiceAddress import org.whispersystems.signalservice.loki.api.LokiPublicChat import org.whispersystems.signalservice.loki.api.LokiPublicChatAPI import org.whispersystems.signalservice.loki.api.LokiPublicChatMessage +import org.whispersystems.signalservice.loki.utilities.successBackground class LokiPublicChatPoller(private val context: Context, private val group: LokiPublicChat) { private val handler = Handler() @@ -197,7 +198,8 @@ class LokiPublicChatPoller(private val context: Context, private val group: Loki finalize() } } - api.getMessages(group.channel, group.server).success { messages -> + api.getMessages(group.channel, group.server).successBackground { messages -> + // Process messages in the background messages.forEach { message -> if (message.hexEncodedPublicKey != userHexEncodedPublicKey) { processIncomingMessage(message)