From a91b6b35e234df54c82ffe0575ba0b97c862782a Mon Sep 17 00:00:00 2001 From: Michael Kirk Date: Thu, 14 Jun 2018 18:18:29 -0400 Subject: [PATCH 1/2] update UI DB to latest before showing CVC // FREEBIE --- .../ConversationView/ConversationViewController.m | 3 +-- SignalServiceKit/src/Storage/OWSPrimaryStorage.h | 2 ++ SignalServiceKit/src/Storage/OWSPrimaryStorage.m | 11 ++++++++--- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/Signal/src/ViewControllers/ConversationView/ConversationViewController.m b/Signal/src/ViewControllers/ConversationView/ConversationViewController.m index 09cb860b8..5ee6e4e31 100644 --- a/Signal/src/ViewControllers/ConversationView/ConversationViewController.m +++ b/Signal/src/ViewControllers/ConversationView/ConversationViewController.m @@ -435,12 +435,11 @@ typedef enum : NSUInteger { // Cache the cell media for ~24 cells. self.cellMediaCache.countLimit = 24; - [self.uiDatabaseConnection beginLongLivedReadTransaction]; - // We need to update the "unread indicator" _before_ we determine the initial range // size, since it depends on where the unread indicator is placed. self.lastRangeLength = 0; [self ensureDynamicInteractions]; + [[OWSPrimaryStorage sharedManager] updateUIDatabaseConnectionToLatest]; if (thread.uniqueId.length > 0) { self.messageMappings = [[YapDatabaseViewMappings alloc] initWithGroups:@[ thread.uniqueId ] diff --git a/SignalServiceKit/src/Storage/OWSPrimaryStorage.h b/SignalServiceKit/src/Storage/OWSPrimaryStorage.h index 702cbf7cb..7d56683ab 100644 --- a/SignalServiceKit/src/Storage/OWSPrimaryStorage.h +++ b/SignalServiceKit/src/Storage/OWSPrimaryStorage.h @@ -22,6 +22,8 @@ extern NSString *const OWSUIDatabaseConnectionNotificationsKey; @property (nonatomic, readonly) YapDatabaseConnection *dbReadConnection; @property (nonatomic, readonly) YapDatabaseConnection *dbReadWriteConnection; +- (void)updateUIDatabaseConnectionToLatest; + + (YapDatabaseConnection *)dbReadConnection; + (YapDatabaseConnection *)dbReadWriteConnection; diff --git a/SignalServiceKit/src/Storage/OWSPrimaryStorage.m b/SignalServiceKit/src/Storage/OWSPrimaryStorage.m index c30519dd7..dc80c1830 100644 --- a/SignalServiceKit/src/Storage/OWSPrimaryStorage.m +++ b/SignalServiceKit/src/Storage/OWSPrimaryStorage.m @@ -168,10 +168,15 @@ void VerifyRegistrationsForPrimaryStorage(OWSStorage *storage) OWSAssertIsOnMainThread(); DDLogVerbose(@"%@ %s", self.logTag, __PRETTY_FUNCTION__); - + [self updateUIDatabaseConnectionToLatest]; +} + +- (void)updateUIDatabaseConnectionToLatest +{ + // Notify observers we're about to update the database connection [[NSNotificationCenter defaultCenter] postNotificationName:OWSUIDatabaseConnectionWillUpdateNotification object:self.dbNotificationObject]; - + // Move uiDatabaseConnection to the latest commit. // Do so atomically, and fetch all the notifications for each commit we jump. NSArray *notifications = [self.uiDatabaseConnection beginLongLivedReadTransaction]; @@ -182,7 +187,7 @@ void VerifyRegistrationsForPrimaryStorage(OWSStorage *storage) object:self.dbNotificationObject userInfo:userInfo]; } - + - (YapDatabaseConnection *)uiDatabaseConnection { OWSAssertIsOnMainThread(); From 67fe8531c003d886c38cf528409d3da2f0e993e3 Mon Sep 17 00:00:00 2001 From: Matthew Chen Date: Thu, 14 Jun 2018 18:39:49 -0400 Subject: [PATCH 2/2] "Bump build to 2.26.0.25." --- Signal/Signal-Info.plist | 2 +- SignalShareExtension/Info.plist | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Signal/Signal-Info.plist b/Signal/Signal-Info.plist index 29bc1d583..877f051df 100644 --- a/Signal/Signal-Info.plist +++ b/Signal/Signal-Info.plist @@ -38,7 +38,7 @@ CFBundleVersion - 2.26.0.24 + 2.26.0.25 ITSAppUsesNonExemptEncryption LOGS_EMAIL diff --git a/SignalShareExtension/Info.plist b/SignalShareExtension/Info.plist index 3f7dbc0c5..43b2f1a92 100644 --- a/SignalShareExtension/Info.plist +++ b/SignalShareExtension/Info.plist @@ -19,7 +19,7 @@ CFBundleShortVersionString 2.26.0 CFBundleVersion - 2.26.0.24 + 2.26.0.25 ITSAppUsesNonExemptEncryption NSAppTransportSecurity