use of org.thoughtcrime.securesms.database.MessagingDatabase.SyncMessageId in project Signal-Android by WhisperSystems.
the class PushReceivedJob method handleReceipt.
private void handleReceipt(SignalServiceEnvelope envelope) {
Log.w(TAG, String.format("Received receipt: (XXXXX, %d)", envelope.getTimestamp()));
DatabaseFactory.getMmsSmsDatabase(context).incrementDeliveryReceiptCount(new SyncMessageId(envelope.getSource(), envelope.getTimestamp()));
}
use of org.thoughtcrime.securesms.database.MessagingDatabase.SyncMessageId in project Signal-Android by signalapp.
the class PushReceivedJob method handleReceipt.
private void handleReceipt(SignalServiceEnvelope envelope) {
Log.w(TAG, String.format("Received receipt: (XXXXX, %d)", envelope.getTimestamp()));
DatabaseFactory.getMmsSmsDatabase(context).incrementDeliveryReceiptCount(new SyncMessageId(Address.fromExternal(context, envelope.getSource()), envelope.getTimestamp()), System.currentTimeMillis());
}
use of org.thoughtcrime.securesms.database.MessagingDatabase.SyncMessageId 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());
}
use of org.thoughtcrime.securesms.database.MessagingDatabase.SyncMessageId in project Signal-Android by signalapp.
the class MarkReadReceiver method process.
public static void process(@NonNull Context context, @NonNull List<MarkedMessageInfo> markedReadMessages) {
if (markedReadMessages.isEmpty())
return;
List<SyncMessageId> syncMessageIds = new LinkedList<>();
for (MarkedMessageInfo messageInfo : markedReadMessages) {
scheduleDeletion(context, messageInfo.getExpirationInfo());
syncMessageIds.add(messageInfo.getSyncMessageId());
}
ApplicationContext.getInstance(context).getJobManager().add(new MultiDeviceReadUpdateJob(context, syncMessageIds));
Map<Address, List<SyncMessageId>> addressMap = Stream.of(markedReadMessages).map(MarkedMessageInfo::getSyncMessageId).collect(Collectors.groupingBy(SyncMessageId::getAddress));
for (Address address : addressMap.keySet()) {
List<Long> timestamps = Stream.of(addressMap.get(address)).map(SyncMessageId::getTimetamp).toList();
ApplicationContext.getInstance(context).getJobManager().add(new SendReadReceiptJob(context, address, timestamps));
}
}
use of org.thoughtcrime.securesms.database.MessagingDatabase.SyncMessageId in project Signal-Android by signalapp.
the class PushDecryptJob method handleReadReceipt.
private void handleReadReceipt(@NonNull SignalServiceEnvelope envelope, @NonNull SignalServiceReceiptMessage message) {
if (TextSecurePreferences.isReadReceiptsEnabled(context)) {
for (long timestamp : message.getTimestamps()) {
Log.w(TAG, String.format("Received encrypted read receipt: (XXXXX, %d)", timestamp));
DatabaseFactory.getMmsSmsDatabase(context).incrementReadReceiptCount(new SyncMessageId(Address.fromExternal(context, envelope.getSource()), timestamp), envelope.getTimestamp());
}
}
}
Aggregations