Automatically mark as read any messages sent by current user from another device.

// FREEBIE
This commit is contained in:
Matthew Chen 2017-02-04 13:15:15 -05:00
parent 4e8ab21c41
commit 6d356e4b67

View file

@ -633,6 +633,15 @@ NS_ASSUME_NONNULL_BEGIN
if (thread && incomingMessage) {
[incomingMessage saveWithTransaction:transaction];
// Any messages sent from the current user - from this device or another - should be
// automatically marked as read.
if ([TSAccountManager isRegistered]) {
BOOL shouldMarkMessageAsRead = [envelope.source isEqualToString:[TSAccountManager localNumber]];
if (shouldMarkMessageAsRead) {
[incomingMessage markAsReadLocallyWithTransaction:transaction];
}
}
// Android allows attachments to be sent with body.
if ([attachmentIds count] > 0 && body != nil && ![body isEqualToString:@""]) {
// We want the text to be displayed under the attachment