From c6387e7c6a790cf47d298915fcc29afba470e6b0 Mon Sep 17 00:00:00 2001 From: Matthew Chen Date: Thu, 24 Jan 2019 17:04:38 -0500 Subject: [PATCH] Simplify the logic to flush database changes. --- .../ConversationView/ConversationViewModel.m | 28 ------------------- 1 file changed, 28 deletions(-) diff --git a/Signal/src/ViewControllers/ConversationView/ConversationViewModel.m b/Signal/src/ViewControllers/ConversationView/ConversationViewModel.m index 59dbbd414..8356e391d 100644 --- a/Signal/src/ViewControllers/ConversationView/ConversationViewModel.m +++ b/Signal/src/ViewControllers/ConversationView/ConversationViewModel.m @@ -345,34 +345,6 @@ static const int kYapDatabaseRangeMaxLength = 25000; { // See comments in primaryStorage.touchDbAsync. [self.primaryStorage touchDbAsync]; - - id _Nullable firstViewItem = self.viewItems.firstObject; - if (firstViewItem) { - __weak ConversationViewModel *weakSelf = self; - dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.15 * NSEC_PER_SEC)), - dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), - ^{ - ConversationViewModel *_Nullable strongSelf = weakSelf; - if (!strongSelf) { - return; - } - if (CurrentAppContext().reportedApplicationState == UIApplicationStateBackground) { - return; - } - [strongSelf.editingDatabaseConnection - readWriteWithBlock:^(YapDatabaseReadWriteTransaction *transaction) { - // Reload the interaction to ensure it still exists. - TSInteraction *_Nullable interaction = - [TSInteraction fetchObjectWithUniqueID:firstViewItem.interaction.uniqueId - transaction:transaction]; - if (!interaction) { - // Interaction appears to have been deleted. - return; - } - [interaction touchWithTransaction:transaction]; - }]; - }); - } } - (void)dealloc