From e85bf7a45da82b1abf664a9ab481e3e46035f647 Mon Sep 17 00:00:00 2001 From: Ryan ZHAO Date: Thu, 11 Mar 2021 15:56:40 +1100 Subject: [PATCH] fix replying from push notification --- .../securesms/notifications/RemoteReplyReceiver.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/src/main/java/org/thoughtcrime/securesms/notifications/RemoteReplyReceiver.java b/app/src/main/java/org/thoughtcrime/securesms/notifications/RemoteReplyReceiver.java index dd11c8be43..4ae3463f32 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/notifications/RemoteReplyReceiver.java +++ b/app/src/main/java/org/thoughtcrime/securesms/notifications/RemoteReplyReceiver.java @@ -27,6 +27,7 @@ import androidx.core.app.RemoteInput; import org.session.libsession.messaging.messages.signal.OutgoingTextMessage; import org.session.libsession.messaging.messages.visible.VisibleMessage; +import org.session.libsession.messaging.sending_receiving.MessageSender; import org.session.libsignal.utilities.logging.Log; import org.thoughtcrime.securesms.ApplicationContext; import org.session.libsession.messaging.threads.Address; @@ -72,6 +73,7 @@ public class RemoteReplyReceiver extends BroadcastReceiver { Recipient recipient = Recipient.from(context, address, false); long threadId = DatabaseFactory.getThreadDatabase(context).getOrCreateThreadIdFor(recipient); VisibleMessage message = new VisibleMessage(); + message.setSentTimestamp(System.currentTimeMillis()); message.setText(responseText.toString()); switch (replyMethod) { @@ -79,6 +81,7 @@ public class RemoteReplyReceiver extends BroadcastReceiver { OutgoingMediaMessage reply = OutgoingMediaMessage.from(message, recipient, Collections.emptyList(), null, null); try { DatabaseFactory.getMmsDatabase(context).insertMessageOutbox(reply, threadId, false, null); + MessageSender.send(message, address); } catch (MmsException e) { Log.w(TAG, e); } @@ -87,6 +90,7 @@ public class RemoteReplyReceiver extends BroadcastReceiver { case SecureMessage: { OutgoingTextMessage reply = OutgoingTextMessage.from(message, recipient); DatabaseFactory.getSmsDatabase(context).insertMessageOutbox(threadId, reply, false, System.currentTimeMillis(), null); + MessageSender.send(message, address); break; } default: