mirror of
https://github.com/oxen-io/session-android.git
synced 2025-02-19 20:18:26 +00:00
Fix note to self message syncing.
Don't send messages if we're sending to ourselves, instead we just send a regular sync message.
This commit is contained in:
parent
10ec395915
commit
3298d665e9
@ -274,7 +274,7 @@ public class PushMediaSendJob extends PushSendJob implements InjectableType {
|
||||
Optional<UnidentifiedAccessPair> syncAccess = UnidentifiedAccessUtil.getAccessForSync(context);
|
||||
SignalServiceSyncMessage syncMessage = buildSelfSendSyncMessage(context, mediaMessage, syncAccess);
|
||||
|
||||
messageSender.sendMessage(messageId, syncMessage, syncAccess);
|
||||
messageSender.sendMessage(templateMessageId, syncMessage, syncAccess);
|
||||
return syncAccess.isPresent();
|
||||
} else {
|
||||
LokiSyncMessage syncMessage = null;
|
||||
|
@ -225,12 +225,12 @@ public class PushTextSendJob extends PushSendJob implements InjectableType {
|
||||
Optional<UnidentifiedAccessPair> syncAccess = UnidentifiedAccessUtil.getAccessForSync(context);
|
||||
SignalServiceSyncMessage syncMessage = buildSelfSendSyncMessage(context, textSecureMessage, syncAccess);
|
||||
|
||||
messageSender.sendMessage(messageId, syncMessage, syncAccess);
|
||||
messageSender.sendMessage(templateMessageId, syncMessage, syncAccess);
|
||||
return syncAccess.isPresent();
|
||||
} else {
|
||||
LokiSyncMessage syncMessage = null;
|
||||
if (shouldSendSyncMessage) {
|
||||
// Set the sync message destination the primary device, this way it will show that we sent a message to the primary device and not a secondary device
|
||||
// Set the sync message destination to the primary device, this way it will show that we sent a message to the primary device and not a secondary device
|
||||
String primaryDevice = MultiDeviceUtilitiesKt.getPrimaryDevicePublicKey(address.getNumber());
|
||||
SignalServiceAddress primaryAddress = primaryDevice == null ? address : new SignalServiceAddress(primaryDevice);
|
||||
// We also need to use the original message id and not -1
|
||||
|
@ -10,6 +10,7 @@ import org.thoughtcrime.securesms.dependencies.InjectableType;
|
||||
import org.thoughtcrime.securesms.jobmanager.Data;
|
||||
import org.thoughtcrime.securesms.jobmanager.Job;
|
||||
import org.thoughtcrime.securesms.logging.Log;
|
||||
import org.thoughtcrime.securesms.loki.MultiDeviceUtilitiesKt;
|
||||
import org.thoughtcrime.securesms.recipients.Recipient;
|
||||
import org.thoughtcrime.securesms.util.GroupUtil;
|
||||
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
||||
@ -96,9 +97,8 @@ public class TypingSendJob extends BaseJob implements InjectableType {
|
||||
List<Optional<UnidentifiedAccessPair>> unidentifiedAccess = Stream.of(recipients).map(r -> UnidentifiedAccessUtil.getAccessFor(context, r)).toList();
|
||||
SignalServiceTypingMessage typingMessage = new SignalServiceTypingMessage(typing ? Action.STARTED : Action.STOPPED, System.currentTimeMillis(), groupId);
|
||||
|
||||
// Loki - Don't send typing indicators in group chats
|
||||
if (!recipient.isGroupRecipient()) {
|
||||
// TODO: Message ID
|
||||
// Loki - Don't send typing indicators in group chats or to ourselves
|
||||
if (!recipient.isGroupRecipient() && !MultiDeviceUtilitiesKt.isOneOfOurDevices(context, recipient.getAddress())) {
|
||||
messageSender.sendTyping(0, addresses, unidentifiedAccess, typingMessage);
|
||||
}
|
||||
}
|
||||
|
@ -269,6 +269,14 @@ public class MessageSender {
|
||||
jobManager.add(new PushTextSendJob(messageId, recipient.getAddress()));
|
||||
return;
|
||||
}
|
||||
|
||||
// Note to self
|
||||
boolean isNoteToSelf = MultiDeviceUtilitiesKt.isOneOfOurDevices(context, recipient.getAddress());
|
||||
if (isNoteToSelf) {
|
||||
jobManager.add(new PushTextSendJob(messageId, recipient.getAddress()));
|
||||
return;
|
||||
}
|
||||
|
||||
boolean[] hasSentSyncMessage = { false };
|
||||
|
||||
MultiDeviceUtilitiesKt.getAllDevicePublicKeys(context, recipientPublicKey, storageAPI, (devicePublicKey, isFriend, friendCount) -> {
|
||||
@ -305,6 +313,13 @@ public class MessageSender {
|
||||
return;
|
||||
}
|
||||
|
||||
// Note to self
|
||||
boolean isNoteToSelf = MultiDeviceUtilitiesKt.isOneOfOurDevices(context, recipient.getAddress());
|
||||
if (isNoteToSelf) {
|
||||
jobManager.add(new PushTextSendJob(messageId, recipient.getAddress()));
|
||||
return;
|
||||
}
|
||||
|
||||
boolean[] hasSentSyncMessage = { false };
|
||||
|
||||
MultiDeviceUtilitiesKt.getAllDevicePublicKeys(context, recipientPublicKey, storageAPI, (devicePublicKey, isFriend, friendCount) -> {
|
||||
|
Loading…
x
Reference in New Issue
Block a user