From 79938aa177927f14ff5e2213bc43363e8e0fc064 Mon Sep 17 00:00:00 2001 From: "Alexander \"PapaTutuWawa" Date: Sun, 30 Jul 2023 22:28:16 +0200 Subject: [PATCH] fix: Fix self-replies after receiving another message If the order of events is - 1 or more messages received - 1 reply - 1 message received, then the self-reply will be grouped together with the message above it. --- .../java/me/polynom/moxplatform_android/Notifications.kt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/moxplatform_android/android/src/main/java/me/polynom/moxplatform_android/Notifications.kt b/packages/moxplatform_android/android/src/main/java/me/polynom/moxplatform_android/Notifications.kt index 083575f..a33d50e 100644 --- a/packages/moxplatform_android/android/src/main/java/me/polynom/moxplatform_android/Notifications.kt +++ b/packages/moxplatform_android/android/src/main/java/me/polynom/moxplatform_android/Notifications.kt @@ -162,7 +162,12 @@ fun showMessagingNotification(context: Context, notification: Api.MessagingNotif val message = notification.messages[i] // Build the sender - val sender = Person.Builder().apply { + // NOTE: Note that we set it to null if message.sender == null because otherwise this results in + // a bogus Person object which messes with the "self-message" display as Android expects + // null in that case. + val sender = if (message.sender == null) + null + else Person.Builder().apply { setName(message.sender) setKey(message.jid)