Merge branch 'mkirk/update-ui-db-to-latest' into release/2.26.0

pull/1/head
Michael Kirk 7 years ago
commit 72ff5d4c98

@ -435,12 +435,11 @@ typedef enum : NSUInteger {
// Cache the cell media for ~24 cells. // Cache the cell media for ~24 cells.
self.cellMediaCache.countLimit = 24; self.cellMediaCache.countLimit = 24;
[self.uiDatabaseConnection beginLongLivedReadTransaction];
// We need to update the "unread indicator" _before_ we determine the initial range // We need to update the "unread indicator" _before_ we determine the initial range
// size, since it depends on where the unread indicator is placed. // size, since it depends on where the unread indicator is placed.
self.lastRangeLength = 0; self.lastRangeLength = 0;
[self ensureDynamicInteractions]; [self ensureDynamicInteractions];
[[OWSPrimaryStorage sharedManager] updateUIDatabaseConnectionToLatest];
if (thread.uniqueId.length > 0) { if (thread.uniqueId.length > 0) {
self.messageMappings = [[YapDatabaseViewMappings alloc] initWithGroups:@[ thread.uniqueId ] self.messageMappings = [[YapDatabaseViewMappings alloc] initWithGroups:@[ thread.uniqueId ]

@ -22,6 +22,8 @@ extern NSString *const OWSUIDatabaseConnectionNotificationsKey;
@property (nonatomic, readonly) YapDatabaseConnection *dbReadConnection; @property (nonatomic, readonly) YapDatabaseConnection *dbReadConnection;
@property (nonatomic, readonly) YapDatabaseConnection *dbReadWriteConnection; @property (nonatomic, readonly) YapDatabaseConnection *dbReadWriteConnection;
- (void)updateUIDatabaseConnectionToLatest;
+ (YapDatabaseConnection *)dbReadConnection; + (YapDatabaseConnection *)dbReadConnection;
+ (YapDatabaseConnection *)dbReadWriteConnection; + (YapDatabaseConnection *)dbReadWriteConnection;

@ -168,6 +168,11 @@ void VerifyRegistrationsForPrimaryStorage(OWSStorage *storage)
OWSAssertIsOnMainThread(); OWSAssertIsOnMainThread();
DDLogVerbose(@"%@ %s", self.logTag, __PRETTY_FUNCTION__); DDLogVerbose(@"%@ %s", self.logTag, __PRETTY_FUNCTION__);
[self updateUIDatabaseConnectionToLatest];
}
- (void)updateUIDatabaseConnectionToLatest
{
// Notify observers we're about to update the database connection // Notify observers we're about to update the database connection
[[NSNotificationCenter defaultCenter] postNotificationName:OWSUIDatabaseConnectionWillUpdateNotification object:self.dbNotificationObject]; [[NSNotificationCenter defaultCenter] postNotificationName:OWSUIDatabaseConnectionWillUpdateNotification object:self.dbNotificationObject];

Loading…
Cancel
Save