ensure atomic write to wasSeen property

// FREEBIE
pull/1/head
Michael Kirk 8 years ago
parent 6d00aac046
commit 4b8544d5f7

@ -39,13 +39,12 @@ class MarkIdentityAsSeenJob: NSObject {
private func markAsSeenIfNecessary(recipientId: String) { private func markAsSeenIfNecessary(recipientId: String) {
guard let identity = OWSRecipientIdentity.fetch(uniqueId: recipientId) else { guard let identity = OWSRecipientIdentity.fetch(uniqueId: recipientId) else {
Logger.verbose("\(TAG) no existing identity for recipient: \(recipientId). No messages with them yet?") Logger.verbose("\(self.TAG) no existing identity for recipient: \(recipientId). No messages with them yet?")
return return
} }
if !identity.wasSeen { if !identity.wasSeen {
Logger.info("\(TAG) marking identity as seen for recipient: \(recipientId)") Logger.info("\(self.TAG) marking identity as seen for recipient: \(recipientId)")
identity.markAsSeen() identity.updateAsSeen()
identity.save()
} }
} }
} }

Loading…
Cancel
Save