From 104a548eb2f32b0f494910dbf920b8b30efa431c Mon Sep 17 00:00:00 2001 From: Matthew Chen Date: Fri, 16 Jun 2017 17:35:25 -0400 Subject: [PATCH] Ensure message mapping is up-to-date when app returns from background. // FREEBIE --- .../ConversationView/MessagesViewController.m | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Signal/src/ViewControllers/ConversationView/MessagesViewController.m b/Signal/src/ViewControllers/ConversationView/MessagesViewController.m index f7c0c053d7..42cda74c61 100644 --- a/Signal/src/ViewControllers/ConversationView/MessagesViewController.m +++ b/Signal/src/ViewControllers/ConversationView/MessagesViewController.m @@ -561,6 +561,13 @@ typedef enum : NSUInteger { // or on another device. [self hideInputIfNeeded]; + // We need to `beginLongLivedReadTransaction` before we update our + // mapping in order to jump to the most recent commit. + [self.uiDatabaseConnection beginLongLivedReadTransaction]; + [self.uiDatabaseConnection readWithBlock:^(YapDatabaseReadTransaction *transaction) { + [self.messageMappings updateWithTransaction:transaction]; + }]; + [self toggleObservers:YES]; // restart any animations that were stopped e.g. while inspecting the contact info screens.