From 97b25507d2342eeef170996b506c1384c5453165 Mon Sep 17 00:00:00 2001 From: Niels Andriesse Date: Fri, 26 Jul 2019 15:17:12 +1000 Subject: [PATCH] Partially fix background message issue --- res/layout/activity_account_details.xml | 1 - res/layout/activity_key_pair.xml | 1 - res/layout/activity_new_conversation.xml | 5 ++--- .../securesms/jobs/PushDecryptJob.java | 18 +++++------------- 4 files changed, 7 insertions(+), 18 deletions(-) diff --git a/res/layout/activity_account_details.xml b/res/layout/activity_account_details.xml index a47391c5fd..3e6fb561a8 100644 --- a/res/layout/activity_account_details.xml +++ b/res/layout/activity_account_details.xml @@ -5,7 +5,6 @@ xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" - android:fillViewport="true" tools:context=".loki.AccountDetailsActivity"> + android:layout_height="match_parent"> diff --git a/src/org/thoughtcrime/securesms/jobs/PushDecryptJob.java b/src/org/thoughtcrime/securesms/jobs/PushDecryptJob.java index 7fa8e087f5..79fb5baf8d 100644 --- a/src/org/thoughtcrime/securesms/jobs/PushDecryptJob.java +++ b/src/org/thoughtcrime/securesms/jobs/PushDecryptJob.java @@ -89,7 +89,6 @@ import org.whispersystems.libsignal.state.PreKeyBundle; import org.whispersystems.libsignal.state.SignalProtocolStore; import org.whispersystems.libsignal.util.guava.Optional; import org.whispersystems.signalservice.api.SignalServiceMessageSender; -import org.whispersystems.signalservice.api.crypto.UnidentifiedAccessPair; import org.whispersystems.signalservice.api.messages.SignalServiceContent; import org.whispersystems.signalservice.api.messages.SignalServiceDataMessage; import org.whispersystems.signalservice.api.messages.SignalServiceDataMessage.Preview; @@ -490,14 +489,7 @@ public class PushDecryptJob extends BaseJob implements InjectableType { Log.d("Loki", "Sending a ping back to " + content.getSender() + "."); String contactID = DatabaseFactory.getThreadDatabase(context).getRecipientForThreadId(threadId).getAddress().toString(); - SignalServiceMessageSender messageSender = ApplicationContext.getInstance(context).communicationModule.provideSignalMessageSender(); - SignalServiceAddress address = new SignalServiceAddress(contactID); - SignalServiceDataMessage message = new SignalServiceDataMessage(System.currentTimeMillis(), ""); - try { - messageSender.sendMessage(0, address, Optional.absent(), message); // The message ID doesn't matter - } catch (Exception e) { - Log.d("Loki", "Failed to send background message to: " + contactID + "."); - } + sendBackgroundMessage(contactID); SecurityEvent.broadcastSecurityUpdateEvent(context); MessageNotifier.updateNotification(context, threadId); @@ -919,11 +911,11 @@ public class PushDecryptJob extends BaseJob implements InjectableType { } private void sendBackgroundMessage(String contactHexEncodedPublicKey) { + SignalServiceMessageSender messageSender = ApplicationContext.getInstance(context).communicationModule.provideSignalMessageSender(); + SignalServiceAddress address = new SignalServiceAddress(contactHexEncodedPublicKey); + SignalServiceDataMessage message = new SignalServiceDataMessage(System.currentTimeMillis(), ""); try { - SignalServiceAddress address = new SignalServiceAddress(contactHexEncodedPublicKey); - SignalServiceDataMessage message = new SignalServiceDataMessage(System.currentTimeMillis(), ""); - Optional access = Optional.absent(); - messageSender.sendMessage(0, address, access, message); // The message ID doesn't matter + messageSender.sendMessage(0, address, Optional.absent(), message); // The message ID doesn't matter } catch (Exception e) { Log.d("Loki", "Failed to send background message to: " + contactHexEncodedPublicKey + "."); }