Improve handling of db modifications while conversation view is not observing.

pull/1/head
Matthew Chen 7 years ago
parent 2ac7716771
commit 5444fc73b0

@ -931,10 +931,12 @@ typedef NS_ENUM(NSInteger, CellState) { kArchiveState, kInboxState };
DDLogVerbose(@"%@ %s", self.logTag, __PRETTY_FUNCTION__);
// External database modifications can't be converted into incremental updates,
// so rebuild everything. This is expensive and usually isn't necessary, but
// there's no alternative.
[self resetMappings];
if (self.shouldObserveDBModifications) {
// External database modifications can't be converted into incremental updates,
// so rebuild everything. This is expensive and usually isn't necessary, but
// there's no alternative.
[self resetMappings];
}
}
- (void)yapDatabaseModified:(NSNotification *)notification

@ -129,16 +129,18 @@ NS_ASSUME_NONNULL_BEGIN
DDLogVerbose(@"%@ %s", self.logTag, __PRETTY_FUNCTION__);
// External database modifications can't be converted into incremental updates,
// so rebuild everything. This is expensive and usually isn't necessary, but
// there's no alternative.
[self.uiDatabaseConnection beginLongLivedReadTransaction];
[self.uiDatabaseConnection readWithBlock:^(YapDatabaseReadTransaction *transaction) {
[self.threadMappings updateWithTransaction:transaction];
}];
[self updateThreads];
[self.delegate threadListDidChange];
if (self.shouldObserveDBModifications) {
// External database modifications can't be converted into incremental updates,
// so rebuild everything. This is expensive and usually isn't necessary, but
// there's no alternative.
[self.uiDatabaseConnection beginLongLivedReadTransaction];
[self.uiDatabaseConnection readWithBlock:^(YapDatabaseReadTransaction *transaction) {
[self.threadMappings updateWithTransaction:transaction];
}];
[self updateThreads];
[self.delegate threadListDidChange];
}
}
- (void)yapDatabaseModified:(NSNotification *)notification

Loading…
Cancel
Save