From 32b3e89c5432e17da3d3b1d082ab23c425cade8e Mon Sep 17 00:00:00 2001 From: Matthew Chen Date: Fri, 26 Jan 2018 17:31:45 -0500 Subject: [PATCH 1/5] Elaborate Debug & Internal UI. --- .../AppSettingsViewController.m | 8 ++++- .../ViewControllers/DebugUI/DebugUIMessages.m | 33 ++++++++++++++++--- .../SignalsNavigationController.m | 6 +++- 3 files changed, 41 insertions(+), 6 deletions(-) diff --git a/Signal/src/ViewControllers/AppSettingsViewController.m b/Signal/src/ViewControllers/AppSettingsViewController.m index 8774344dab..b7fee9fa26 100644 --- a/Signal/src/ViewControllers/AppSettingsViewController.m +++ b/Signal/src/ViewControllers/AppSettingsViewController.m @@ -108,10 +108,16 @@ - (void)updateTableContents { OWSTableContents *contents = [OWSTableContents new]; - OWSTableSection *section = [OWSTableSection new]; __weak AppSettingsViewController *weakSelf = self; +#ifdef INTERNAL + OWSTableSection *internalSection = [OWSTableSection new]; + [section addItem:[OWSTableItem softCenterLabelItemWithText:@"Internal Build"]]; + [contents addSection:internalSection]; +#endif + + OWSTableSection *section = [OWSTableSection new]; [section addItem:[OWSTableItem itemWithCustomCellBlock:^{ return [weakSelf profileHeaderCell]; } diff --git a/Signal/src/ViewControllers/DebugUI/DebugUIMessages.m b/Signal/src/ViewControllers/DebugUI/DebugUIMessages.m index 99657f5c67..d21f8d2679 100644 --- a/Signal/src/ViewControllers/DebugUI/DebugUIMessages.m +++ b/Signal/src/ViewControllers/DebugUI/DebugUIMessages.m @@ -1,5 +1,5 @@ // -// Copyright (c) 2017 Open Whisper Systems. All rights reserved. +// Copyright (c) 2018 Open Whisper Systems. All rights reserved. // #import "DebugUIMessages.h" @@ -124,6 +124,10 @@ NS_ASSUME_NONNULL_BEGIN actionBlock:^{ [DebugUIMessages sendFakeMessages:10 * 1000 thread:thread]; }], + [OWSTableItem itemWithTitle:@"Create 100k fake messages" + actionBlock:^{ + [DebugUIMessages sendFakeMessages:100 * 1000 thread:thread]; + }], [OWSTableItem itemWithTitle:@"Create 1 fake unread messages" actionBlock:^{ [DebugUIMessages createFakeUnreadMessages:1 thread:thread]; @@ -282,9 +286,24 @@ NS_ASSUME_NONNULL_BEGIN [DebugUIMessages createNewGroups:1000 recipientId:recipientId]; }]]; } + if ([thread isKindOfClass:[TSGroupThread class]]) { + TSGroupThread *groupThread = (TSGroupThread *)thread; + [items addObject:[OWSTableItem itemWithTitle:@"Send message to all members" + actionBlock:^{ + [DebugUIMessages sendMessages:1 toAllMembersOfGroup:groupThread]; + }]]; + } return [OWSTableSection sectionWithTitle:self.name items:items]; } ++ (void)sendMessages:(int)counter toAllMembersOfGroup:(TSGroupThread *)groupThread +{ + for (NSString *recipientId in groupThread.groupModel.groupMemberIds) { + TSContactThread *contactThread = [TSContactThread getOrCreateThreadWithContactId:recipientId]; + [DebugUIMessages sendTextMessages:counter thread:contactThread]; + } +} + + (void)sendTextMessageInThread:(TSThread *)thread counter:(int)counter { DDLogInfo(@"%@ sendTextMessageInThread: %d", self.logTag, counter); @@ -964,9 +983,15 @@ NS_ASSUME_NONNULL_BEGIN + (void)sendFakeMessages:(NSUInteger)counter thread:(TSThread *)thread { - [TSStorageManager.dbReadWriteConnection readWriteWithBlock:^(YapDatabaseReadWriteTransaction *transaction) { - [self sendFakeMessages:counter thread:thread transaction:transaction]; - }]; + NSUInteger remainder = counter; + while (remainder > 0) { + NSUInteger batchSize = MIN((NSUInteger)2500, remainder); + [TSStorageManager.dbReadWriteConnection + readWriteWithBlock:^(YapDatabaseReadWriteTransaction *transaction) { + [self sendFakeMessages:counter thread:thread transaction:transaction]; + }]; + remainder -= batchSize; + } } + (void)sendFakeMessages:(NSUInteger)counter diff --git a/Signal/src/ViewControllers/SignalsNavigationController.m b/Signal/src/ViewControllers/SignalsNavigationController.m index 5314fd7dd7..d48c88592e 100644 --- a/Signal/src/ViewControllers/SignalsNavigationController.m +++ b/Signal/src/ViewControllers/SignalsNavigationController.m @@ -1,5 +1,5 @@ // -// Copyright (c) 2017 Open Whisper Systems. All rights reserved. +// Copyright (c) 2018 Open Whisper Systems. All rights reserved. // #import "SignalsNavigationController.h" @@ -36,7 +36,11 @@ static double const STALLED_PROGRESS = 0.9; CGRect bar = self.navigationBar.frame; _socketStatusView.frame = CGRectMake(0, bar.size.height - 1.0f, self.view.frame.size.width, 1.0f); _socketStatusView.progress = 0.0f; +#ifdef INTERNAL + _socketStatusView.progressTintColor = [UIColor ows_destructiveRedColor]; +#else _socketStatusView.progressTintColor = [UIColor ows_fadedBlueColor]; +#endif if (![_socketStatusView superview]) { [self.navigationBar addSubview:_socketStatusView]; From 9d101c3f53645d01b09351a6e4cfcde4e3c3c907 Mon Sep 17 00:00:00 2001 From: Matthew Chen Date: Fri, 26 Jan 2018 17:46:49 -0500 Subject: [PATCH 2/5] 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 d21f8d2679..9f3ba3cd32 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 e07c066134..d52f056a40 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 d91d036bbb..b13c33db2a 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]; From 6f7f1b3b086f791051a70a4d2ce0359951e84806 Mon Sep 17 00:00:00 2001 From: Matthew Chen Date: Mon, 29 Jan 2018 10:11:19 -0500 Subject: [PATCH 3/5] Improve pre-migration testing tools. --- Signal/src/AppDelegate.m | 20 ++++----- .../ViewControllers/DebugUI/DebugUIMessages.m | 42 ++++++++++++++----- .../src/Storage/TSStorageManager.m | 4 ++ SignalServiceKit/src/Util/OWSFileSystem.h | 2 + SignalServiceKit/src/Util/OWSFileSystem.m | 14 +++++++ 5 files changed, 61 insertions(+), 21 deletions(-) diff --git a/Signal/src/AppDelegate.m b/Signal/src/AppDelegate.m index fd644f29c9..01a7273348 100644 --- a/Signal/src/AppDelegate.m +++ b/Signal/src/AppDelegate.m @@ -785,16 +785,16 @@ static NSString *const kURLHostVerifyPrefix = @"verify"; self.isEnvironmentSetup = YES; -#ifdef DEBUG - // A bug in orphan cleanup could be disastrous so let's only - // run it in DEBUG builds for a few releases. - // - // TODO: Release to production once we have analytics. - // TODO: Orphan cleanup is somewhat expensive - not least in doing a bunch - // of disk access. We might want to only run it "once per version" - // or something like that in production. - [OWSOrphanedDataCleaner auditAndCleanupAsync:nil]; -#endif + //#ifdef DEBUG + // // A bug in orphan cleanup could be disastrous so let's only + // // run it in DEBUG builds for a few releases. + // // + // // TODO: Release to production once we have analytics. + // // TODO: Orphan cleanup is somewhat expensive - not least in doing a bunch + // // of disk access. We might want to only run it "once per version" + // // or something like that in production. + // [OWSOrphanedDataCleaner auditAndCleanupAsync:nil]; + //#endif [OWSProfileManager.sharedManager fetchLocalUsersProfile]; [[OWSReadReceiptManager sharedManager] prepareCachedValues]; diff --git a/Signal/src/ViewControllers/DebugUI/DebugUIMessages.m b/Signal/src/ViewControllers/DebugUI/DebugUIMessages.m index 9f3ba3cd32..4c7692cf6e 100644 --- a/Signal/src/ViewControllers/DebugUI/DebugUIMessages.m +++ b/Signal/src/ViewControllers/DebugUI/DebugUIMessages.m @@ -128,6 +128,10 @@ NS_ASSUME_NONNULL_BEGIN actionBlock:^{ [DebugUIMessages sendFakeMessages:100 * 1000 thread:thread]; }], + [OWSTableItem itemWithTitle:@"Create 100k fake text messages" + actionBlock:^{ + [DebugUIMessages sendFakeMessages:100 * 1000 thread:thread isTextOnly:YES]; + }], [OWSTableItem itemWithTitle:@"Create 1 fake unread messages" actionBlock:^{ [DebugUIMessages createFakeUnreadMessages:1 thread:thread]; @@ -983,27 +987,42 @@ NS_ASSUME_NONNULL_BEGIN + (void)sendFakeMessages:(NSUInteger)counter thread:(TSThread *)thread { - NSUInteger remainder = counter; - while (remainder > 0) { - NSUInteger batchSize = MIN((NSUInteger)2500, remainder); - [TSStorageManager.dbReadWriteConnection - readWriteWithBlock:^(YapDatabaseReadWriteTransaction *transaction) { - [self sendFakeMessages:counter thread:thread transaction:transaction]; - }]; - remainder -= batchSize; - DDLogInfo(@"%@ sendFakeMessages %zd / %zd", self.logTag, counter - remainder, counter); + [self sendFakeMessages:counter thread:thread isTextOnly:NO]; +} + ++ (void)sendFakeMessages:(NSUInteger)counter thread:(TSThread *)thread isTextOnly:(BOOL)isTextOnly +{ + const NSUInteger kMaxBatchSize = 2500; + if (counter < kMaxBatchSize) { + [TSStorageManager.dbReadWriteConnection readWriteWithBlock:^(YapDatabaseReadWriteTransaction *transaction) { + [self sendFakeMessages:counter thread:thread isTextOnly:isTextOnly transaction:transaction]; + }]; + } else { + dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ + NSUInteger remainder = counter; + while (remainder > 0) { + NSUInteger batchSize = MIN(kMaxBatchSize, remainder); + [TSStorageManager.dbReadWriteConnection + readWriteWithBlock:^(YapDatabaseReadWriteTransaction *transaction) { + [self sendFakeMessages:batchSize thread:thread isTextOnly:isTextOnly transaction:transaction]; + }]; + remainder -= batchSize; + DDLogInfo(@"%@ sendFakeMessages %zd / %zd", self.logTag, counter - remainder, counter); + } + }); } } + (void)sendFakeMessages:(NSUInteger)counter thread:(TSThread *)thread + isTextOnly:(BOOL)isTextOnly transaction:(YapDatabaseReadWriteTransaction *)transaction { DDLogInfo(@"%@ sendFakeMessages: %zd", self.logTag, counter); for (NSUInteger i = 0; i < counter; i++) { NSString *randomText = [self randomText]; - switch (arc4random_uniform(4)) { + switch (arc4random_uniform(isTextOnly ? 2 : 4)) { case 0: { TSIncomingMessage *message = [[TSIncomingMessage alloc] initWithTimestamp:[NSDate ows_millisecondTimeStamp] @@ -1038,6 +1057,7 @@ NS_ASSUME_NONNULL_BEGIN relay:@"" sourceFilename:@"test.mp3" attachmentType:TSAttachmentTypeDefault]; + pointer.state = TSAttachmentPointerStateFailed; [pointer saveWithTransaction:transaction]; TSIncomingMessage *message = [[TSIncomingMessage alloc] initWithTimestamp:[NSDate ows_millisecondTimeStamp] @@ -1280,7 +1300,7 @@ NS_ASSUME_NONNULL_BEGIN }, ^(YapDatabaseReadWriteTransaction *transaction) { NSUInteger messageCount = (NSUInteger)(1 + arc4random_uniform(4)); - [self sendFakeMessages:messageCount thread:thread transaction:transaction]; + [self sendFakeMessages:messageCount thread:thread isTextOnly:NO transaction:transaction]; }, ^(YapDatabaseReadWriteTransaction *transaction) { NSUInteger messageCount = (NSUInteger)(1 + arc4random_uniform(4)); diff --git a/SignalServiceKit/src/Storage/TSStorageManager.m b/SignalServiceKit/src/Storage/TSStorageManager.m index f77ebec86d..23b1c32953 100644 --- a/SignalServiceKit/src/Storage/TSStorageManager.m +++ b/SignalServiceKit/src/Storage/TSStorageManager.m @@ -141,6 +141,10 @@ void runAsyncRegistrationsForStorage(OWSStorage *storage) + (void)protectFiles { + DDLogInfo(@"%@ Database file size: %@", self.logTag, [OWSFileSystem fileSizeOfPath:self.legacyDatabaseFilePath]); + DDLogInfo(@"%@ \t SHM file size: %@", self.logTag, [OWSFileSystem fileSizeOfPath:self.legacyDatabaseFilePath_SHM]); + DDLogInfo(@"%@ \t WAL file size: %@", self.logTag, [OWSFileSystem fileSizeOfPath:self.legacyDatabaseFilePath_WAL]); + // The old database location was in the Document directory, // so protect the database files individually. [OWSFileSystem protectFileOrFolderAtPath:self.legacyDatabaseFilePath]; diff --git a/SignalServiceKit/src/Util/OWSFileSystem.h b/SignalServiceKit/src/Util/OWSFileSystem.h index cf6f091ce7..d81d94fb30 100644 --- a/SignalServiceKit/src/Util/OWSFileSystem.h +++ b/SignalServiceKit/src/Util/OWSFileSystem.h @@ -35,6 +35,8 @@ NS_ASSUME_NONNULL_BEGIN // Returns nil on failure. + (nullable NSString *)writeDataToTemporaryFile:(NSData *)data fileExtension:(NSString *_Nullable)fileExtension; ++ (nullable NSNumber *)fileSizeOfPath:(NSString *)filePath; + @end NS_ASSUME_NONNULL_END diff --git a/SignalServiceKit/src/Util/OWSFileSystem.m b/SignalServiceKit/src/Util/OWSFileSystem.m index bd089cca6e..a95ae43953 100644 --- a/SignalServiceKit/src/Util/OWSFileSystem.m +++ b/SignalServiceKit/src/Util/OWSFileSystem.m @@ -200,6 +200,20 @@ NS_ASSUME_NONNULL_BEGIN return tempFilePath; } ++ (nullable NSNumber *)fileSizeOfPath:(NSString *)filePath +{ + NSFileManager *fileManager = [NSFileManager defaultManager]; + NSError *_Nullable error; + unsigned long long fileSize = + [[fileManager attributesOfItemAtPath:filePath error:&error][NSFileSize] unsignedLongLongValue]; + if (error) { + DDLogError(@"%@ Couldn't fetch file size[%@]: %@", self.logTag, filePath, error); + return nil; + } else { + return @(fileSize); + } +} + @end NS_ASSUME_NONNULL_END From 3609275c20bc13f093d3200a745a70b04ddbd856 Mon Sep 17 00:00:00 2001 From: Matthew Chen Date: Mon, 29 Jan 2018 11:05:33 -0500 Subject: [PATCH 4/5] Handle malformed row updates. --- .../ConversationViewController.m | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/Signal/src/ViewControllers/ConversationView/ConversationViewController.m b/Signal/src/ViewControllers/ConversationView/ConversationViewController.m index 4ffc5f843d..bec4f2a96a 100644 --- a/Signal/src/ViewControllers/ConversationView/ConversationViewController.m +++ b/Signal/src/ViewControllers/ConversationView/ConversationViewController.m @@ -2834,23 +2834,26 @@ typedef NS_ENUM(NSInteger, MessagesRangeSizeMode) { // We need to reload any modified interactions _before_ we call // reloadViewItems. BOOL hasDeletions = NO; + BOOL hasMalformedRowChange = NO; for (YapDatabaseViewRowChange *rowChange in rowChanges) { switch (rowChange.type) { case YapDatabaseViewChangeUpdate: { YapCollectionKey *collectionKey = rowChange.collectionKey; - OWSAssert(collectionKey.key.length > 0); if (collectionKey.key) { ConversationViewItem *viewItem = self.viewItemCache[collectionKey.key]; [self reloadInteractionForViewItem:viewItem]; + } else { + hasMalformedRowChange = YES; } break; } case YapDatabaseViewChangeDelete: { // Discard cached view items after deletes. YapCollectionKey *collectionKey = rowChange.collectionKey; - OWSAssert(collectionKey.key.length > 0); if (collectionKey.key) { [self.viewItemCache removeObjectForKey:collectionKey.key]; + } else { + hasMalformedRowChange = YES; } hasDeletions = YES; break; @@ -2858,6 +2861,19 @@ typedef NS_ENUM(NSInteger, MessagesRangeSizeMode) { default: break; } + if (hasMalformedRowChange) { + break; + } + } + + if (hasMalformedRowChange) { + // These errors seems to be very rare; they can only be reproduced + // using the more extreme actions in the debug UI. + DDLogError(@"%@ hasMalformedRowChange", self.logTag); + [self.collectionView reloadData]; + [self updateLastVisibleTimestamp]; + [self cleanUpUnreadIndicatorIfNecessary]; + return; } NSUInteger oldViewItemCount = self.viewItems.count; From 7ebeeda5f9cf9011b4db83af4a6e3932337b03c5 Mon Sep 17 00:00:00 2001 From: Matthew Chen Date: Mon, 29 Jan 2018 12:50:17 -0500 Subject: [PATCH 5/5] Clean up ahead of PR. --- Signal/src/AppDelegate.m | 20 +++++++++---------- .../ViewControllers/DebugUI/DebugUIMessages.m | 8 -------- .../SignalsNavigationController.m | 6 +----- .../Messages/Attachments/TSAttachmentStream.m | 4 ++-- .../Messages/Interactions/TSIncomingMessage.m | 6 +++--- 5 files changed, 16 insertions(+), 28 deletions(-) diff --git a/Signal/src/AppDelegate.m b/Signal/src/AppDelegate.m index 01a7273348..fd644f29c9 100644 --- a/Signal/src/AppDelegate.m +++ b/Signal/src/AppDelegate.m @@ -785,16 +785,16 @@ static NSString *const kURLHostVerifyPrefix = @"verify"; self.isEnvironmentSetup = YES; - //#ifdef DEBUG - // // A bug in orphan cleanup could be disastrous so let's only - // // run it in DEBUG builds for a few releases. - // // - // // TODO: Release to production once we have analytics. - // // TODO: Orphan cleanup is somewhat expensive - not least in doing a bunch - // // of disk access. We might want to only run it "once per version" - // // or something like that in production. - // [OWSOrphanedDataCleaner auditAndCleanupAsync:nil]; - //#endif +#ifdef DEBUG + // A bug in orphan cleanup could be disastrous so let's only + // run it in DEBUG builds for a few releases. + // + // TODO: Release to production once we have analytics. + // TODO: Orphan cleanup is somewhat expensive - not least in doing a bunch + // of disk access. We might want to only run it "once per version" + // or something like that in production. + [OWSOrphanedDataCleaner auditAndCleanupAsync:nil]; +#endif [OWSProfileManager.sharedManager fetchLocalUsersProfile]; [[OWSReadReceiptManager sharedManager] prepareCachedValues]; diff --git a/Signal/src/ViewControllers/DebugUI/DebugUIMessages.m b/Signal/src/ViewControllers/DebugUI/DebugUIMessages.m index 4c7692cf6e..3f53fbe08a 100644 --- a/Signal/src/ViewControllers/DebugUI/DebugUIMessages.m +++ b/Signal/src/ViewControllers/DebugUI/DebugUIMessages.m @@ -1030,8 +1030,6 @@ NS_ASSUME_NONNULL_BEGIN authorId:@"+19174054215" sourceDeviceId:0 messageBody:randomText]; - // DDLogError(@"%@ sendFakeMessages incoming timestamp: %llu.", self.logTag, - // message.timestamp); [message markAsReadWithTransaction:transaction sendReadReceipt:NO updateExpiration:NO]; break; } @@ -1040,8 +1038,6 @@ NS_ASSUME_NONNULL_BEGIN [[TSOutgoingMessage alloc] initWithTimestamp:[NSDate ows_millisecondTimeStamp] inThread:thread messageBody:randomText]; - // DDLogError(@"%@ sendFakeMessages outgoing timestamp: %llu.", self.logTag, - // message.timestamp); [message saveWithTransaction:transaction]; [message updateWithMessageState:TSOutgoingMessageStateUnsent transaction:transaction]; break; @@ -1069,8 +1065,6 @@ NS_ASSUME_NONNULL_BEGIN pointer.uniqueId, ] expiresInSeconds:0]; - // DDLogError(@"%@ sendFakeMessages incoming attachment timestamp: %llu.", self.logTag, - // message.timestamp); [message markAsReadWithTransaction:transaction sendReadReceipt:NO updateExpiration:NO]; break; } @@ -1081,8 +1075,6 @@ NS_ASSUME_NONNULL_BEGIN messageBody:nil isVoiceMessage:NO expiresInSeconds:0]; - // DDLogError(@"%@ sendFakeMessages outgoing attachment timestamp: %llu.", self.logTag, - // message.timestamp); NSString *filename = @"test.mp3"; UInt32 filesize = 16; diff --git a/Signal/src/ViewControllers/SignalsNavigationController.m b/Signal/src/ViewControllers/SignalsNavigationController.m index d48c88592e..5314fd7dd7 100644 --- a/Signal/src/ViewControllers/SignalsNavigationController.m +++ b/Signal/src/ViewControllers/SignalsNavigationController.m @@ -1,5 +1,5 @@ // -// Copyright (c) 2018 Open Whisper Systems. All rights reserved. +// Copyright (c) 2017 Open Whisper Systems. All rights reserved. // #import "SignalsNavigationController.h" @@ -36,11 +36,7 @@ static double const STALLED_PROGRESS = 0.9; CGRect bar = self.navigationBar.frame; _socketStatusView.frame = CGRectMake(0, bar.size.height - 1.0f, self.view.frame.size.width, 1.0f); _socketStatusView.progress = 0.0f; -#ifdef INTERNAL - _socketStatusView.progressTintColor = [UIColor ows_destructiveRedColor]; -#else _socketStatusView.progressTintColor = [UIColor ows_fadedBlueColor]; -#endif if (![_socketStatusView superview]) { [self.navigationBar addSubview:_socketStatusView]; diff --git a/SignalServiceKit/src/Messages/Attachments/TSAttachmentStream.m b/SignalServiceKit/src/Messages/Attachments/TSAttachmentStream.m index d52f056a40..e07c066134 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 data to file: %@", self.logTag, filePath); + DDLogInfo(@"%@ Writing attachment 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 data source to file: %@", self.logTag, filePath); + DDLogInfo(@"%@ Writing attachment 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 b13c33db2a..d91d036bbb 100644 --- a/SignalServiceKit/src/Messages/Interactions/TSIncomingMessage.m +++ b/SignalServiceKit/src/Messages/Interactions/TSIncomingMessage.m @@ -1,5 +1,5 @@ // -// Copyright (c) 2018 Open Whisper Systems. All rights reserved. +// Copyright (c) 2017 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];