From bc1af80733995baf5788a360b6f1e3bf0022c61e Mon Sep 17 00:00:00 2001 From: Michael Kirk Date: Wed, 8 Feb 2017 09:57:45 -0500 Subject: [PATCH] Log when we mark a message as read locally This is in pursuit of some now (for me) un-reproducible behavior where messages on some clients were being immediately marked as read. // FREEBIE --- src/Messages/Interactions/TSIncomingMessage.m | 20 ++++++++++++++++--- src/Messages/TSCall.m | 14 +++++++++++++ 2 files changed, 31 insertions(+), 3 deletions(-) diff --git a/src/Messages/Interactions/TSIncomingMessage.m b/src/Messages/Interactions/TSIncomingMessage.m index e83889f4f..5cec33496 100644 --- a/src/Messages/Interactions/TSIncomingMessage.m +++ b/src/Messages/Interactions/TSIncomingMessage.m @@ -1,5 +1,6 @@ -// Created by Frederic Jacobs on 15/11/14. -// Copyright (c) 2014 Open Whisper Systems. All rights reserved. +// +// Copyright (c) 2017 Open Whisper Systems. All rights reserved. +// #import "TSIncomingMessage.h" #import "TSContactThread.h" @@ -127,9 +128,22 @@ NSString *const TSIncomingMessageWasReadOnThisDeviceNotification = @"TSIncomingM - (void)markAsReadWithoutNotificationWithTransaction:(YapDatabaseReadWriteTransaction *)transaction { + DDLogInfo(@"%@ marking as read uniqueId: %@ which has timestamp: %llu", self.tag, self.uniqueId, self.timestamp); _read = YES; [self saveWithTransaction:transaction]; - [transaction touchObjectForKey:self.uniqueThreadId inCollection:[TSThread collection]]; + [self touchThreadWithTransaction:transaction]; +} + +#pragma mark - Logging + ++ (NSString *)tag +{ + return [NSString stringWithFormat:@"[%@]", self.class]; +} + +- (NSString *)tag +{ + return self.class.tag; } @end diff --git a/src/Messages/TSCall.m b/src/Messages/TSCall.m index c9f508768..d3f3631c7 100644 --- a/src/Messages/TSCall.m +++ b/src/Messages/TSCall.m @@ -75,6 +75,8 @@ NSUInteger TSCallCurrentSchemaVersion = 1; - (void)markAsReadLocallyWithTransaction:(YapDatabaseReadWriteTransaction *)transaction { + DDLogInfo(@"%@ marking as read uniqueId: %@ which has timestamp: %llu", self.tag, self.uniqueId, self.timestamp); + _read = YES; [self saveWithTransaction:transaction]; @@ -89,6 +91,18 @@ NSUInteger TSCallCurrentSchemaVersion = 1; }]; } +#pragma mark - Logging + ++ (NSString *)tag +{ + return [NSString stringWithFormat:@"[%@]", self.class]; +} + +- (NSString *)tag +{ + return self.class.tag; +} + @end NS_ASSUME_NONNULL_END