Merge branch 'sync-read' into bug-fixes
This commit is contained in:
commit
bfc1e96c9d
|
@ -139,7 +139,11 @@ public class NotificationPresenter: NSObject, NotificationsProtocol {
|
||||||
switch notification.object {
|
switch notification.object {
|
||||||
case let incomingMessage as TSIncomingMessage:
|
case let incomingMessage as TSIncomingMessage:
|
||||||
Logger.debug("canceled notification for message: \(incomingMessage)")
|
Logger.debug("canceled notification for message: \(incomingMessage)")
|
||||||
cancelNotifications(threadId: incomingMessage.uniqueThreadId)
|
if let identifier = incomingMessage.notificationIdentifier {
|
||||||
|
cancelNotification(identifier)
|
||||||
|
} else {
|
||||||
|
cancelNotifications(threadId: incomingMessage.uniqueThreadId)
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
|
@ -326,8 +326,11 @@ extension MessageReceiver {
|
||||||
tsMessage.openGroupServerMessageID = serverID
|
tsMessage.openGroupServerMessageID = serverID
|
||||||
tsMessage.save(with: transaction)
|
tsMessage.save(with: transaction)
|
||||||
}
|
}
|
||||||
// Start expiration for sync messages
|
if let tsOutgoingMessage = TSMessage.fetch(uniqueId: tsMessageID, transaction: transaction) as? TSOutgoingMessage,
|
||||||
if let tsOutgoingMessage = TSMessage.fetch(uniqueId: tsMessageID, transaction: transaction) as? TSOutgoingMessage {
|
let thread = TSThread.fetch(uniqueId: threadID, transaction: transaction) {
|
||||||
|
// Mark previous messages as read if there is a sync message
|
||||||
|
OWSReadReceiptManager.shared().markAsReadLocally(beforeSortId: tsOutgoingMessage.sortId, thread: thread)
|
||||||
|
// Start expiration for sync messages
|
||||||
OWSDisappearingMessagesJob.shared().startAnyExpiration(for: tsOutgoingMessage, expirationStartedAt: NSDate.millisecondTimestamp(), transaction: transaction)
|
OWSDisappearingMessagesJob.shared().startAnyExpiration(for: tsOutgoingMessage, expirationStartedAt: NSDate.millisecondTimestamp(), transaction: transaction)
|
||||||
}
|
}
|
||||||
// Notify the user if needed
|
// Notify the user if needed
|
||||||
|
|
Loading…
Reference in New Issue