use of org.thoughtcrime.securesms.notifications.MessageNotifier in project Signal-Android by WhisperSystems.
the class MessageContentProcessor method handleSynchronizeViewedMessage.
private void handleSynchronizeViewedMessage(@NonNull List<ViewedMessage> viewedMessages, long envelopeTimestamp) {
log(envelopeTimestamp, "Synchronize view message. Count: " + viewedMessages.size() + ", Timestamps: " + viewedMessages.stream().map(ViewedMessage::getTimestamp));
List<Long> toMarkViewed = Stream.of(viewedMessages).map(message -> {
RecipientId author = Recipient.externalPush(message.getSender()).getId();
return SignalDatabase.mmsSms().getMessageFor(message.getTimestamp(), author);
}).filter(message -> message != null && message.isMms()).map(MessageRecord::getId).toList();
SignalDatabase.mms().setIncomingMessagesViewed(toMarkViewed);
MessageNotifier messageNotifier = ApplicationDependencies.getMessageNotifier();
messageNotifier.setLastDesktopActivityTimestamp(envelopeTimestamp);
messageNotifier.cancelDelayedNotifications();
messageNotifier.updateNotification(context);
}
use of org.thoughtcrime.securesms.notifications.MessageNotifier in project Signal-Android by WhisperSystems.
the class MessageContentProcessor method handleSynchronizeReadMessage.
private void handleSynchronizeReadMessage(@NonNull List<ReadMessage> readMessages, long envelopeTimestamp, @NonNull Recipient senderRecipient) {
log(envelopeTimestamp, "Synchronize read message. Count: " + readMessages.size() + ", Timestamps: " + readMessages.stream().map(ReadMessage::getTimestamp));
Map<Long, Long> threadToLatestRead = new HashMap<>();
SignalDatabase.mmsSms().setTimestampRead(senderRecipient, readMessages, envelopeTimestamp, threadToLatestRead);
List<MessageDatabase.MarkedMessageInfo> markedMessages = SignalDatabase.threads().setReadSince(threadToLatestRead, false);
if (Util.hasItems(markedMessages)) {
Log.i(TAG, "Updating past messages: " + markedMessages.size());
MarkReadReceiver.process(context, markedMessages);
}
MessageNotifier messageNotifier = ApplicationDependencies.getMessageNotifier();
messageNotifier.setLastDesktopActivityTimestamp(envelopeTimestamp);
messageNotifier.cancelDelayedNotifications();
messageNotifier.updateNotification(context);
}
use of org.thoughtcrime.securesms.notifications.MessageNotifier in project Signal-Android by signalapp.
the class MessageContentProcessor method handleSynchronizeViewedMessage.
private void handleSynchronizeViewedMessage(@NonNull List<ViewedMessage> viewedMessages, long envelopeTimestamp) {
log(envelopeTimestamp, "Synchronize view message. Count: " + viewedMessages.size() + ", Timestamps: " + viewedMessages.stream().map(ViewedMessage::getTimestamp));
List<Long> toMarkViewed = Stream.of(viewedMessages).map(message -> {
RecipientId author = Recipient.externalPush(message.getSender()).getId();
return SignalDatabase.mmsSms().getMessageFor(message.getTimestamp(), author);
}).filter(message -> message != null && message.isMms()).map(MessageRecord::getId).toList();
SignalDatabase.mms().setIncomingMessagesViewed(toMarkViewed);
MessageNotifier messageNotifier = ApplicationDependencies.getMessageNotifier();
messageNotifier.setLastDesktopActivityTimestamp(envelopeTimestamp);
messageNotifier.cancelDelayedNotifications();
messageNotifier.updateNotification(context);
}
use of org.thoughtcrime.securesms.notifications.MessageNotifier in project Signal-Android by signalapp.
the class MessageContentProcessor method handleSynchronizeViewOnceOpenMessage.
private void handleSynchronizeViewOnceOpenMessage(@NonNull ViewOnceOpenMessage openMessage, long envelopeTimestamp) {
log(envelopeTimestamp, "Handling a view-once open for message: " + openMessage.getTimestamp());
RecipientId author = Recipient.externalPush(openMessage.getSender()).getId();
long timestamp = openMessage.getTimestamp();
MessageRecord record = SignalDatabase.mmsSms().getMessageFor(timestamp, author);
if (record != null && record.isMms()) {
SignalDatabase.attachments().deleteAttachmentFilesForViewOnceMessage(record.getId());
} else {
warn(String.valueOf(envelopeTimestamp), "Got a view-once open message for a message we don't have!");
}
MessageNotifier messageNotifier = ApplicationDependencies.getMessageNotifier();
messageNotifier.setLastDesktopActivityTimestamp(envelopeTimestamp);
messageNotifier.cancelDelayedNotifications();
messageNotifier.updateNotification(context);
}
use of org.thoughtcrime.securesms.notifications.MessageNotifier in project Signal-Android by WhisperSystems.
the class MessageContentProcessor method handleSynchronizeViewOnceOpenMessage.
private void handleSynchronizeViewOnceOpenMessage(@NonNull ViewOnceOpenMessage openMessage, long envelopeTimestamp) {
log(envelopeTimestamp, "Handling a view-once open for message: " + openMessage.getTimestamp());
RecipientId author = Recipient.externalPush(openMessage.getSender()).getId();
long timestamp = openMessage.getTimestamp();
MessageRecord record = SignalDatabase.mmsSms().getMessageFor(timestamp, author);
if (record != null && record.isMms()) {
SignalDatabase.attachments().deleteAttachmentFilesForViewOnceMessage(record.getId());
} else {
warn(String.valueOf(envelopeTimestamp), "Got a view-once open message for a message we don't have!");
}
MessageNotifier messageNotifier = ApplicationDependencies.getMessageNotifier();
messageNotifier.setLastDesktopActivityTimestamp(envelopeTimestamp);
messageNotifier.cancelDelayedNotifications();
messageNotifier.updateNotification(context);
}
Aggregations