From 5a130703f9d21403cc746d0fc0b9a0514099a170 Mon Sep 17 00:00:00 2001 From: Matthew Chen Date: Sat, 11 Mar 2017 10:01:45 -0300 Subject: [PATCH] Update conversation view title when group name changes. // FREEBIE --- .../Models/TSMessageAdapaters/TSMessageAdapter.m | 4 +++- .../src/view controllers/MessagesViewController.m | 13 ++++--------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/Signal/src/Models/TSMessageAdapaters/TSMessageAdapter.m b/Signal/src/Models/TSMessageAdapaters/TSMessageAdapter.m index 10223111c..0d9c37f79 100644 --- a/Signal/src/Models/TSMessageAdapaters/TSMessageAdapter.m +++ b/Signal/src/Models/TSMessageAdapaters/TSMessageAdapter.m @@ -182,7 +182,9 @@ // repurposing call display for info message stuff for group updates, ! adapter will know because the date // is nil. // - // TODO: This doesn't seem like a good idea. + // TODO: I suspect that we'll want a separate model + // that conforms to for info + // messages. CallStatus status = 0; if (adapter.infoMessageType == TSInfoMessageTypeGroupQuit) { status = kGroupUpdateLeft; diff --git a/Signal/src/view controllers/MessagesViewController.m b/Signal/src/view controllers/MessagesViewController.m index 47358c4af..5cc451fbb 100644 --- a/Signal/src/view controllers/MessagesViewController.m +++ b/Signal/src/view controllers/MessagesViewController.m @@ -2083,14 +2083,11 @@ typedef enum : NSUInteger { // Currently, we update thread and message state every time // the database is modified. That doesn't seem optimal, but // in practice it's efficient enough. - // - // - dispatch_async(dispatch_get_main_queue(), ^{ - [self updateContents]; - }); -} -- (void)updateContents { + // We need to `beginLongLivedReadTransaction` before we update our + // models in order to jump to the most recent commit. + NSArray *notifications = [self.uiDatabaseConnection beginLongLivedReadTransaction]; + [self updateBackButtonAsync]; if (isGroupConversation) { @@ -2104,8 +2101,6 @@ typedef enum : NSUInteger { [self setNavigationTitle]; } - NSArray *notifications = [self.uiDatabaseConnection beginLongLivedReadTransaction]; - if (![[self.uiDatabaseConnection ext:TSMessageDatabaseViewExtensionName] hasChangesForNotifications:notifications]) { [self.uiDatabaseConnection readWithBlock:^(YapDatabaseReadTransaction *transaction) {