use of org.whispersystems.signalservice.api.messages.multidevice.ReadMessage in project Signal-Android by WhisperSystems.
the class MultiDeviceReadUpdateJob method onRun.
@Override
public void onRun(MasterSecret masterSecret) throws IOException, UntrustedIdentityException {
if (!TextSecurePreferences.isMultiDevice(context)) {
Log.w(TAG, "Not multi device...");
return;
}
List<ReadMessage> readMessages = new LinkedList<>();
for (SerializableSyncMessageId messageId : messageIds) {
readMessages.add(new ReadMessage(messageId.sender, messageId.timestamp));
}
SignalServiceMessageSender messageSender = messageSenderFactory.create();
messageSender.sendMessage(SignalServiceSyncMessage.forRead(readMessages));
}
use of org.whispersystems.signalservice.api.messages.multidevice.ReadMessage in project Signal-Android by WhisperSystems.
the class PushDecryptJob method handleSynchronizeReadMessage.
private void handleSynchronizeReadMessage(@NonNull MasterSecretUnion masterSecret, @NonNull List<ReadMessage> readMessages, long envelopeTimestamp) {
for (ReadMessage readMessage : readMessages) {
List<Pair<Long, Long>> expiringText = DatabaseFactory.getSmsDatabase(context).setTimestampRead(new SyncMessageId(readMessage.getSender(), readMessage.getTimestamp()), envelopeTimestamp);
List<Pair<Long, Long>> expiringMedia = DatabaseFactory.getMmsDatabase(context).setTimestampRead(new SyncMessageId(readMessage.getSender(), readMessage.getTimestamp()), envelopeTimestamp);
for (Pair<Long, Long> expiringMessage : expiringText) {
ApplicationContext.getInstance(context).getExpiringMessageManager().scheduleDeletion(expiringMessage.first, false, envelopeTimestamp, expiringMessage.second);
}
for (Pair<Long, Long> expiringMessage : expiringMedia) {
ApplicationContext.getInstance(context).getExpiringMessageManager().scheduleDeletion(expiringMessage.first, true, envelopeTimestamp, expiringMessage.second);
}
}
MessageNotifier.setLastDesktopActivityTimestamp(envelopeTimestamp);
MessageNotifier.cancelDelayedNotifications();
MessageNotifier.updateNotification(context, masterSecret.getMasterSecret().orNull());
}
Aggregations