diff --git a/src/org/thoughtcrime/securesms/database/model/MessageRecord.java b/src/org/thoughtcrime/securesms/database/model/MessageRecord.java index 635a864aa9..ed96413c79 100644 --- a/src/org/thoughtcrime/securesms/database/model/MessageRecord.java +++ b/src/org/thoughtcrime/securesms/database/model/MessageRecord.java @@ -46,7 +46,7 @@ public abstract class MessageRecord extends DisplayRecord { private final Recipient individualRecipient; private final int recipientDeviceId; - private final long id; + public final long id; private final List mismatches; private final List networkFailures; private final int subscriptionId; diff --git a/src/org/thoughtcrime/securesms/jobs/MultiDeviceBlockedUpdateJob.java b/src/org/thoughtcrime/securesms/jobs/MultiDeviceBlockedUpdateJob.java index f575a63b7e..ff001fe49b 100644 --- a/src/org/thoughtcrime/securesms/jobs/MultiDeviceBlockedUpdateJob.java +++ b/src/org/thoughtcrime/securesms/jobs/MultiDeviceBlockedUpdateJob.java @@ -84,7 +84,8 @@ public class MultiDeviceBlockedUpdateJob extends BaseJob implements InjectableTy } } - messageSender.sendMessage(SignalServiceSyncMessage.forBlocked(new BlockedListMessage(blockedIndividuals, blockedGroups)), + // TODO: Message ID + messageSender.sendMessage(0, SignalServiceSyncMessage.forBlocked(new BlockedListMessage(blockedIndividuals, blockedGroups)), UnidentifiedAccessUtil.getAccessForSync(context)); } } diff --git a/src/org/thoughtcrime/securesms/jobs/MultiDeviceConfigurationUpdateJob.java b/src/org/thoughtcrime/securesms/jobs/MultiDeviceConfigurationUpdateJob.java index b960815578..47ddf24105 100644 --- a/src/org/thoughtcrime/securesms/jobs/MultiDeviceConfigurationUpdateJob.java +++ b/src/org/thoughtcrime/securesms/jobs/MultiDeviceConfigurationUpdateJob.java @@ -91,7 +91,8 @@ public class MultiDeviceConfigurationUpdateJob extends BaseJob implements Inject return; } - messageSender.sendMessage(SignalServiceSyncMessage.forConfiguration(new ConfigurationMessage(Optional.of(readReceiptsEnabled), + // TODO: Message ID + messageSender.sendMessage(0, SignalServiceSyncMessage.forConfiguration(new ConfigurationMessage(Optional.of(readReceiptsEnabled), Optional.of(unidentifiedDeliveryIndicatorsEnabled), Optional.of(typingIndicatorsEnabled), Optional.of(linkPreviewsEnabled))), diff --git a/src/org/thoughtcrime/securesms/jobs/MultiDeviceContactUpdateJob.java b/src/org/thoughtcrime/securesms/jobs/MultiDeviceContactUpdateJob.java index d39bd68254..0301c02436 100644 --- a/src/org/thoughtcrime/securesms/jobs/MultiDeviceContactUpdateJob.java +++ b/src/org/thoughtcrime/securesms/jobs/MultiDeviceContactUpdateJob.java @@ -239,7 +239,8 @@ public class MultiDeviceContactUpdateJob extends BaseJob implements InjectableTy .build(); try { - messageSender.sendMessage(SignalServiceSyncMessage.forContacts(new ContactsMessage(attachmentStream, complete)), + // TODO: Message ID + messageSender.sendMessage(0, SignalServiceSyncMessage.forContacts(new ContactsMessage(attachmentStream, complete)), UnidentifiedAccessUtil.getAccessForSync(context)); } catch (IOException ioe) { throw new NetworkException(ioe); diff --git a/src/org/thoughtcrime/securesms/jobs/MultiDeviceGroupUpdateJob.java b/src/org/thoughtcrime/securesms/jobs/MultiDeviceGroupUpdateJob.java index 3611ef6c55..46c894ec24 100644 --- a/src/org/thoughtcrime/securesms/jobs/MultiDeviceGroupUpdateJob.java +++ b/src/org/thoughtcrime/securesms/jobs/MultiDeviceGroupUpdateJob.java @@ -139,7 +139,8 @@ public class MultiDeviceGroupUpdateJob extends BaseJob implements InjectableType .withLength(contactsFile.length()) .build(); - messageSender.sendMessage(SignalServiceSyncMessage.forGroups(attachmentStream), + // TODO: Message ID + messageSender.sendMessage(0, SignalServiceSyncMessage.forGroups(attachmentStream), UnidentifiedAccessUtil.getAccessForSync(context)); } diff --git a/src/org/thoughtcrime/securesms/jobs/MultiDeviceProfileKeyUpdateJob.java b/src/org/thoughtcrime/securesms/jobs/MultiDeviceProfileKeyUpdateJob.java index 593479a2a0..4f92c493c7 100644 --- a/src/org/thoughtcrime/securesms/jobs/MultiDeviceProfileKeyUpdateJob.java +++ b/src/org/thoughtcrime/securesms/jobs/MultiDeviceProfileKeyUpdateJob.java @@ -89,7 +89,8 @@ public class MultiDeviceProfileKeyUpdateJob extends BaseJob implements Injectabl SignalServiceSyncMessage syncMessage = SignalServiceSyncMessage.forContacts(new ContactsMessage(attachmentStream, false)); - messageSender.sendMessage(syncMessage, UnidentifiedAccessUtil.getAccessForSync(context)); + // TODO: Message ID + messageSender.sendMessage(0, syncMessage, UnidentifiedAccessUtil.getAccessForSync(context)); } @Override diff --git a/src/org/thoughtcrime/securesms/jobs/MultiDeviceReadUpdateJob.java b/src/org/thoughtcrime/securesms/jobs/MultiDeviceReadUpdateJob.java index 82e269c899..550f27a889 100644 --- a/src/org/thoughtcrime/securesms/jobs/MultiDeviceReadUpdateJob.java +++ b/src/org/thoughtcrime/securesms/jobs/MultiDeviceReadUpdateJob.java @@ -94,7 +94,8 @@ public class MultiDeviceReadUpdateJob extends BaseJob implements InjectableType readMessages.add(new ReadMessage(messageId.sender, messageId.timestamp)); } - messageSender.sendMessage(SignalServiceSyncMessage.forRead(readMessages), UnidentifiedAccessUtil.getAccessForSync(context)); + // TODO: Message ID + messageSender.sendMessage(0, SignalServiceSyncMessage.forRead(readMessages), UnidentifiedAccessUtil.getAccessForSync(context)); } @Override diff --git a/src/org/thoughtcrime/securesms/jobs/MultiDeviceVerifiedUpdateJob.java b/src/org/thoughtcrime/securesms/jobs/MultiDeviceVerifiedUpdateJob.java index a23fa062f3..60ad48f9df 100644 --- a/src/org/thoughtcrime/securesms/jobs/MultiDeviceVerifiedUpdateJob.java +++ b/src/org/thoughtcrime/securesms/jobs/MultiDeviceVerifiedUpdateJob.java @@ -104,7 +104,8 @@ public class MultiDeviceVerifiedUpdateJob extends BaseJob implements InjectableT VerifiedMessage.VerifiedState verifiedState = getVerifiedState(verifiedStatus); VerifiedMessage verifiedMessage = new VerifiedMessage(canonicalDestination.toPhoneString(), new IdentityKey(identityKey, 0), verifiedState, timestamp); - messageSender.sendMessage(SignalServiceSyncMessage.forVerified(verifiedMessage), + // TODO: Message ID + messageSender.sendMessage(0, SignalServiceSyncMessage.forVerified(verifiedMessage), UnidentifiedAccessUtil.getAccessFor(context, Recipient.from(context, Address.fromSerialized(destination), false))); } catch (InvalidKeyException e) { throw new IOException(e); diff --git a/src/org/thoughtcrime/securesms/jobs/PushDecryptJob.java b/src/org/thoughtcrime/securesms/jobs/PushDecryptJob.java index 5a9ea61c46..eaa92b6778 100644 --- a/src/org/thoughtcrime/securesms/jobs/PushDecryptJob.java +++ b/src/org/thoughtcrime/securesms/jobs/PushDecryptJob.java @@ -864,7 +864,7 @@ public class PushDecryptJob extends BaseJob implements InjectableType { SignalServiceAddress address = new SignalServiceAddress(contactHexEncodedPublicKey); SignalServiceDataMessage message = new SignalServiceDataMessage(System.currentTimeMillis(), ""); Optional access = Optional.absent(); - messageSender.sendMessage(address, access, message); + messageSender.sendMessage(0, address, access, message); // The message ID doesn't matter } catch (Exception e) { Log.d("Loki", "Failed to send empty message to: " + contactHexEncodedPublicKey + "."); } diff --git a/src/org/thoughtcrime/securesms/jobs/PushGroupSendJob.java b/src/org/thoughtcrime/securesms/jobs/PushGroupSendJob.java index 6c2fa39fb2..e378135c62 100644 --- a/src/org/thoughtcrime/securesms/jobs/PushGroupSendJob.java +++ b/src/org/thoughtcrime/securesms/jobs/PushGroupSendJob.java @@ -253,7 +253,8 @@ public class PushGroupSendJob extends PushSendJob implements InjectableType { .asGroupMessage(group) .build(); - return messageSender.sendMessage(addresses, unidentifiedAccess, groupDataMessage); + // TODO: Message ID + return messageSender.sendMessage(0, addresses, unidentifiedAccess, groupDataMessage); } else { SignalServiceGroup group = new SignalServiceGroup(GroupUtil.getDecodedId(groupId)); SignalServiceDataMessage groupMessage = SignalServiceDataMessage.newBuilder() @@ -269,7 +270,8 @@ public class PushGroupSendJob extends PushSendJob implements InjectableType { .withPreviews(previews) .build(); - return messageSender.sendMessage(addresses, unidentifiedAccess, groupMessage); + // TODO: Message ID + return messageSender.sendMessage(0, addresses, unidentifiedAccess, groupMessage); } } diff --git a/src/org/thoughtcrime/securesms/jobs/PushGroupUpdateJob.java b/src/org/thoughtcrime/securesms/jobs/PushGroupUpdateJob.java index 4935e18010..5e85d17817 100644 --- a/src/org/thoughtcrime/securesms/jobs/PushGroupUpdateJob.java +++ b/src/org/thoughtcrime/securesms/jobs/PushGroupUpdateJob.java @@ -118,7 +118,8 @@ public class PushGroupUpdateJob extends BaseJob implements InjectableType { .withExpiration(groupRecipient.getExpireMessages()) .build(); - messageSender.sendMessage(new SignalServiceAddress(source), + // TODO: Message ID + messageSender.sendMessage(0, new SignalServiceAddress(source), UnidentifiedAccessUtil.getAccessFor(context, Recipient.from(context, Address.fromSerialized(source), false)), message); } diff --git a/src/org/thoughtcrime/securesms/jobs/PushMediaSendJob.java b/src/org/thoughtcrime/securesms/jobs/PushMediaSendJob.java index e09de2e3a3..e8870a245b 100644 --- a/src/org/thoughtcrime/securesms/jobs/PushMediaSendJob.java +++ b/src/org/thoughtcrime/securesms/jobs/PushMediaSendJob.java @@ -222,10 +222,10 @@ public class PushMediaSendJob extends PushSendJob implements InjectableType { Optional syncAccess = UnidentifiedAccessUtil.getAccessForSync(context); SignalServiceSyncMessage syncMessage = buildSelfSendSyncMessage(context, mediaMessage, syncAccess); - messageSender.sendMessage(syncMessage, syncAccess); + messageSender.sendMessage(messageId, syncMessage, syncAccess); return syncAccess.isPresent(); } else { - return messageSender.sendMessage(address, UnidentifiedAccessUtil.getAccessFor(context, message.getRecipient()), mediaMessage).getSuccess().isUnidentified(); + return messageSender.sendMessage(messageId, address, UnidentifiedAccessUtil.getAccessFor(context, message.getRecipient()), mediaMessage).getSuccess().isUnidentified(); } } catch (UnregisteredUserException e) { warn(TAG, e); diff --git a/src/org/thoughtcrime/securesms/jobs/PushTextSendJob.java b/src/org/thoughtcrime/securesms/jobs/PushTextSendJob.java index 8c0c509011..32d1718374 100644 --- a/src/org/thoughtcrime/securesms/jobs/PushTextSendJob.java +++ b/src/org/thoughtcrime/securesms/jobs/PushTextSendJob.java @@ -181,10 +181,10 @@ public class PushTextSendJob extends PushSendJob implements InjectableType { Optional syncAccess = UnidentifiedAccessUtil.getAccessForSync(context); SignalServiceSyncMessage syncMessage = buildSelfSendSyncMessage(context, textSecureMessage, syncAccess); - messageSender.sendMessage(syncMessage, syncAccess); + messageSender.sendMessage(messageId, syncMessage, syncAccess); return syncAccess.isPresent(); } else { - return messageSender.sendMessage(address, unidentifiedAccess, textSecureMessage).getSuccess().isUnidentified(); + return messageSender.sendMessage(messageId, address, unidentifiedAccess, textSecureMessage).getSuccess().isUnidentified(); } } catch (UnregisteredUserException e) { warn(TAG, "Failure", e); diff --git a/src/org/thoughtcrime/securesms/jobs/RequestGroupInfoJob.java b/src/org/thoughtcrime/securesms/jobs/RequestGroupInfoJob.java index 31dd8b81f6..e591c24f9d 100644 --- a/src/org/thoughtcrime/securesms/jobs/RequestGroupInfoJob.java +++ b/src/org/thoughtcrime/securesms/jobs/RequestGroupInfoJob.java @@ -79,7 +79,8 @@ public class RequestGroupInfoJob extends BaseJob implements InjectableType { .withTimestamp(System.currentTimeMillis()) .build(); - messageSender.sendMessage(new SignalServiceAddress(source), + // TODO: Message ID + messageSender.sendMessage(0, new SignalServiceAddress(source), UnidentifiedAccessUtil.getAccessFor(context, Recipient.from(context, Address.fromExternal(context, source), false)), message); } diff --git a/src/org/thoughtcrime/securesms/jobs/SendDeliveryReceiptJob.java b/src/org/thoughtcrime/securesms/jobs/SendDeliveryReceiptJob.java index 0a0711f5b2..2fcec3404d 100644 --- a/src/org/thoughtcrime/securesms/jobs/SendDeliveryReceiptJob.java +++ b/src/org/thoughtcrime/securesms/jobs/SendDeliveryReceiptJob.java @@ -83,7 +83,8 @@ public class SendDeliveryReceiptJob extends BaseJob implements InjectableType { Collections.singletonList(messageId), timestamp); - messageSender.sendReceipt(remoteAddress, + // TODO: Message ID + messageSender.sendReceipt(0, remoteAddress, UnidentifiedAccessUtil.getAccessFor(context, Recipient.from(context, Address.fromSerialized(address), false)), receiptMessage); } diff --git a/src/org/thoughtcrime/securesms/jobs/SendReadReceiptJob.java b/src/org/thoughtcrime/securesms/jobs/SendReadReceiptJob.java index 8b3eeb19d0..9328a33045 100644 --- a/src/org/thoughtcrime/securesms/jobs/SendReadReceiptJob.java +++ b/src/org/thoughtcrime/securesms/jobs/SendReadReceiptJob.java @@ -89,7 +89,7 @@ public class SendReadReceiptJob extends BaseJob implements InjectableType { SignalServiceAddress remoteAddress = new SignalServiceAddress(address); SignalServiceReceiptMessage receiptMessage = new SignalServiceReceiptMessage(SignalServiceReceiptMessage.Type.READ, messageIds, timestamp); - messageSender.sendReceipt(remoteAddress, + messageSender.sendReceipt(0, remoteAddress, // The message ID doesn't matter UnidentifiedAccessUtil.getAccessFor(context, Recipient.from(context, Address.fromSerialized(address), false)), receiptMessage); } diff --git a/src/org/thoughtcrime/securesms/jobs/TypingSendJob.java b/src/org/thoughtcrime/securesms/jobs/TypingSendJob.java index 926fde25ef..728a5b6adb 100644 --- a/src/org/thoughtcrime/securesms/jobs/TypingSendJob.java +++ b/src/org/thoughtcrime/securesms/jobs/TypingSendJob.java @@ -96,7 +96,8 @@ public class TypingSendJob extends BaseJob implements InjectableType { List> unidentifiedAccess = Stream.of(recipients).map(r -> UnidentifiedAccessUtil.getAccessFor(context, r)).toList(); SignalServiceTypingMessage typingMessage = new SignalServiceTypingMessage(typing ? Action.STARTED : Action.STOPPED, System.currentTimeMillis(), groupId); - messageSender.sendTyping(addresses, unidentifiedAccess, typingMessage); + // TODO: Message ID + messageSender.sendTyping(0, addresses, unidentifiedAccess, typingMessage); } @Override diff --git a/src/org/thoughtcrime/securesms/service/WebRtcCallService.java b/src/org/thoughtcrime/securesms/service/WebRtcCallService.java index be20047e97..577858b1fe 100644 --- a/src/org/thoughtcrime/securesms/service/WebRtcCallService.java +++ b/src/org/thoughtcrime/securesms/service/WebRtcCallService.java @@ -19,7 +19,6 @@ import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.annotation.WorkerThread; import android.telephony.TelephonyManager; -import org.thoughtcrime.securesms.logging.Log; import android.util.Pair; import com.google.protobuf.InvalidProtocolBufferException; @@ -34,6 +33,7 @@ import org.thoughtcrime.securesms.database.DatabaseFactory; import org.thoughtcrime.securesms.database.RecipientDatabase.VibrateState; import org.thoughtcrime.securesms.dependencies.InjectableType; import org.thoughtcrime.securesms.events.WebRtcViewModel; +import org.thoughtcrime.securesms.logging.Log; import org.thoughtcrime.securesms.notifications.MessageNotifier; import org.thoughtcrime.securesms.permissions.Permissions; import org.thoughtcrime.securesms.recipients.Recipient; @@ -90,12 +90,10 @@ import org.whispersystems.signalservice.internal.util.concurrent.SettableFuture; import java.io.IOException; import java.nio.ByteBuffer; -import java.security.NoSuchAlgorithmException; import java.security.SecureRandom; import java.util.LinkedList; import java.util.List; import java.util.concurrent.Callable; -import java.util.concurrent.CountDownLatch; import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; @@ -1000,7 +998,8 @@ public class WebRtcCallService extends Service implements InjectableType, Callable callable = new Callable() { @Override public Boolean call() throws Exception { - messageSender.sendCallMessage(new SignalServiceAddress(recipient.getAddress().toPhoneString()), + // TODO: Message ID + messageSender.sendCallMessage(0, new SignalServiceAddress(recipient.getAddress().toPhoneString()), UnidentifiedAccessUtil.getAccessFor(WebRtcCallService.this, recipient), callMessage); return true;