From 9d101c3f53645d01b09351a6e4cfcde4e3c3c907 Mon Sep 17 00:00:00 2001 From: Matthew Chen Date: Fri, 26 Jan 2018 17:46:49 -0500 Subject: [PATCH] Elaborate Debug & Internal UI. --- .../src/ViewControllers/DebugUI/DebugUIMessages.m | 15 +++++++++++---- .../src/Messages/Attachments/TSAttachmentStream.m | 4 ++-- .../src/Messages/Interactions/TSIncomingMessage.m | 6 +++--- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/Signal/src/ViewControllers/DebugUI/DebugUIMessages.m b/Signal/src/ViewControllers/DebugUI/DebugUIMessages.m index d21f8d267..9f3ba3cd3 100644 --- a/Signal/src/ViewControllers/DebugUI/DebugUIMessages.m +++ b/Signal/src/ViewControllers/DebugUI/DebugUIMessages.m @@ -991,6 +991,7 @@ NS_ASSUME_NONNULL_BEGIN [self sendFakeMessages:counter thread:thread transaction:transaction]; }]; remainder -= batchSize; + DDLogInfo(@"%@ sendFakeMessages %zd / %zd", self.logTag, counter - remainder, counter); } } @@ -1010,7 +1011,8 @@ NS_ASSUME_NONNULL_BEGIN authorId:@"+19174054215" sourceDeviceId:0 messageBody:randomText]; - DDLogError(@"%@ sendFakeMessages incoming timestamp: %llu.", self.logTag, message.timestamp); + // DDLogError(@"%@ sendFakeMessages incoming timestamp: %llu.", self.logTag, + // message.timestamp); [message markAsReadWithTransaction:transaction sendReadReceipt:NO updateExpiration:NO]; break; } @@ -1019,8 +1021,10 @@ NS_ASSUME_NONNULL_BEGIN [[TSOutgoingMessage alloc] initWithTimestamp:[NSDate ows_millisecondTimeStamp] inThread:thread messageBody:randomText]; - DDLogError(@"%@ sendFakeMessages outgoing timestamp: %llu.", self.logTag, message.timestamp); + // DDLogError(@"%@ sendFakeMessages outgoing timestamp: %llu.", self.logTag, + // message.timestamp); [message saveWithTransaction:transaction]; + [message updateWithMessageState:TSOutgoingMessageStateUnsent transaction:transaction]; break; } case 2: { @@ -1045,7 +1049,8 @@ NS_ASSUME_NONNULL_BEGIN pointer.uniqueId, ] expiresInSeconds:0]; - DDLogError(@"%@ sendFakeMessages incoming attachment timestamp: %llu.", self.logTag, message.timestamp); + // DDLogError(@"%@ sendFakeMessages incoming attachment timestamp: %llu.", self.logTag, + // message.timestamp); [message markAsReadWithTransaction:transaction sendReadReceipt:NO updateExpiration:NO]; break; } @@ -1056,7 +1061,8 @@ NS_ASSUME_NONNULL_BEGIN messageBody:nil isVoiceMessage:NO expiresInSeconds:0]; - DDLogError(@"%@ sendFakeMessages outgoing attachment timestamp: %llu.", self.logTag, message.timestamp); + // DDLogError(@"%@ sendFakeMessages outgoing attachment timestamp: %llu.", self.logTag, + // message.timestamp); NSString *filename = @"test.mp3"; UInt32 filesize = 16; @@ -1075,6 +1081,7 @@ NS_ASSUME_NONNULL_BEGIN message.attachmentFilenameMap[attachmentStream.uniqueId] = filename; } [message saveWithTransaction:transaction]; + [message updateWithMessageState:TSOutgoingMessageStateUnsent transaction:transaction]; break; } } diff --git a/SignalServiceKit/src/Messages/Attachments/TSAttachmentStream.m b/SignalServiceKit/src/Messages/Attachments/TSAttachmentStream.m index e07c06613..d52f056a4 100644 --- a/SignalServiceKit/src/Messages/Attachments/TSAttachmentStream.m +++ b/SignalServiceKit/src/Messages/Attachments/TSAttachmentStream.m @@ -162,7 +162,7 @@ NS_ASSUME_NONNULL_BEGIN OWSFail(@"%@ Missing path for attachment.", self.logTag); return NO; } - DDLogInfo(@"%@ Writing attachment to file: %@", self.logTag, filePath); + DDLogInfo(@"%@ Writing attachment data to file: %@", self.logTag, filePath); return [data writeToFile:filePath options:0 error:error]; } @@ -175,7 +175,7 @@ NS_ASSUME_NONNULL_BEGIN OWSFail(@"%@ Missing path for attachment.", self.logTag); return NO; } - DDLogInfo(@"%@ Writing attachment to file: %@", self.logTag, filePath); + DDLogInfo(@"%@ Writing attachment data source to file: %@", self.logTag, filePath); return [dataSource writeToPath:filePath]; } diff --git a/SignalServiceKit/src/Messages/Interactions/TSIncomingMessage.m b/SignalServiceKit/src/Messages/Interactions/TSIncomingMessage.m index d91d036bb..b13c33db2 100644 --- a/SignalServiceKit/src/Messages/Interactions/TSIncomingMessage.m +++ b/SignalServiceKit/src/Messages/Interactions/TSIncomingMessage.m @@ -1,5 +1,5 @@ // -// Copyright (c) 2017 Open Whisper Systems. All rights reserved. +// Copyright (c) 2018 Open Whisper Systems. All rights reserved. // #import "TSIncomingMessage.h" @@ -156,8 +156,8 @@ NS_ASSUME_NONNULL_BEGIN return; } - DDLogDebug( - @"%@ marking as read uniqueId: %@ which has timestamp: %llu", self.logTag, self.uniqueId, self.timestamp); + // DDLogDebug( + // @"%@ marking as read uniqueId: %@ which has timestamp: %llu", self.logTag, self.uniqueId, self.timestamp); _read = YES; [self saveWithTransaction:transaction]; [self touchThreadWithTransaction:transaction];