From 669e0644eacc855e18054976439b5d688f3f2c0b Mon Sep 17 00:00:00 2001 From: Matthew Chen Date: Tue, 11 Jul 2017 16:11:56 -0400 Subject: [PATCH] Respond to CR. // FREEBIE --- .../ViewControllers/SignalsViewController.m | 19 +++++++------------ .../translations/en.lproj/Localizable.strings | 2 +- 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/Signal/src/ViewControllers/SignalsViewController.m b/Signal/src/ViewControllers/SignalsViewController.m index 56c28ff90..9311f50f4 100644 --- a/Signal/src/ViewControllers/SignalsViewController.m +++ b/Signal/src/ViewControllers/SignalsViewController.m @@ -370,18 +370,13 @@ // visible. The threads often change ordering while in conversation view due // to incoming & outgoing messages. if (self.lastThread) { - NSIndexPath *indexPathOfLastThread = nil; - NSUInteger numberOfSections = [self.threadMappings numberOfSections]; - for (NSUInteger section = 0; !indexPathOfLastThread && section < numberOfSections; section++) { - NSUInteger numberOfItems = [self.threadMappings numberOfItemsInSection:section]; - for (NSUInteger row = 0; !indexPathOfLastThread && row < numberOfItems; row++) { - NSIndexPath *indexPath = [NSIndexPath indexPathForRow:(NSInteger)row inSection:(NSInteger)section]; - TSThread *thread = [self threadForIndexPath:indexPath]; - if ([thread.uniqueId isEqualToString:self.lastThread.uniqueId]) { - indexPathOfLastThread = indexPath; - } - } - } + __block NSIndexPath *indexPathOfLastThread = nil; + [self.uiDatabaseConnection readWithBlock:^(YapDatabaseReadTransaction *transaction) { + indexPathOfLastThread = + [[transaction extension:TSThreadDatabaseViewExtensionName] indexPathForKey:self.lastThread.uniqueId + inCollection:[TSThread collection] + withMappings:self.threadMappings]; + }]; if (indexPathOfLastThread) { [self.tableView scrollToRowAtIndexPath:indexPathOfLastThread diff --git a/Signal/translations/en.lproj/Localizable.strings b/Signal/translations/en.lproj/Localizable.strings index 162afb032..58228ee9a 100644 --- a/Signal/translations/en.lproj/Localizable.strings +++ b/Signal/translations/en.lproj/Localizable.strings @@ -644,7 +644,7 @@ "IN_CALL_TERMINATED" = "Call Ended."; /* Label reminding the user that they are in archive mode. */ -"INBOX_VIEW_ARCHIVE_MODE_REMINDER" = "You're in archive mode. Tap to return to your Inbox."; +"INBOX_VIEW_ARCHIVE_MODE_REMINDER" = "You are viewing your archived messages. Tap to return to your Inbox."; /* Multiline label explaining how to show names instead of phone numbers in your inbox */ "INBOX_VIEW_MISSING_CONTACTS_PERMISSION" = "To see the names of your contacts, update your system settings to allow contact access.";