mirror of
https://github.com/oxen-io/session-ios.git
synced 2023-12-13 21:30:14 +01:00
Flush writes from other processes.
This commit is contained in:
parent
1ff4f85247
commit
4e1e232825
|
@ -4170,9 +4170,11 @@ typedef enum : NSUInteger {
|
|||
if (hasAddedNewItems) {
|
||||
NSIndexPath *_Nullable indexPathToShow = [self firstIndexPathAtPreviousLastUnreadTimestamp];
|
||||
if (indexPathToShow) {
|
||||
[self.collectionView scrollToItemAtIndexPath:indexPathToShow
|
||||
atScrollPosition:UICollectionViewScrollPositionCenteredVertically
|
||||
animated:YES];
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[self.collectionView scrollToItemAtIndexPath:indexPathToShow
|
||||
atScrollPosition:UICollectionViewScrollPositionCenteredVertically
|
||||
animated:YES];
|
||||
});
|
||||
}
|
||||
}
|
||||
self.previousLastUnreadTimestamp = nil;
|
||||
|
@ -4307,6 +4309,14 @@ typedef enum : NSUInteger {
|
|||
[self ensureDynamicInteractions];
|
||||
[self updateBackButtonUnreadCount];
|
||||
[self updateNavigationBarSubtitleLabel];
|
||||
|
||||
// There appears to be a bug in YapDatabase that sometimes delays modifications
|
||||
// made in another process (e.g. the SAE) from showing up in other processes.
|
||||
// There's a simple workaround: a trivial write to the database flushes changes
|
||||
// made from other processes.
|
||||
[self.editingDatabaseConnection setObject:[NSUUID UUID].UUIDString
|
||||
forKey:@"conversation_view_noop_mod"
|
||||
inCollection:@"temp"];
|
||||
}
|
||||
|
||||
#pragma mark - ConversationCollectionViewDelegate
|
||||
|
|
|
@ -76,7 +76,10 @@ typedef NSData *_Nullable (^CreateDatabaseMetadataBlock)(void);
|
|||
OWSAssert(delegate);
|
||||
OWSAssert(delegate.areAllRegistrationsComplete || self.canWriteBeforeStorageReady);
|
||||
|
||||
OWSBackgroundTask *backgroundTask = [OWSBackgroundTask backgroundTaskWithLabelStr:__PRETTY_FUNCTION__];
|
||||
OWSBackgroundTask *_Nullable backgroundTask = nil;
|
||||
if (CurrentAppContext().isMainApp) {
|
||||
backgroundTask = [OWSBackgroundTask backgroundTaskWithLabelStr:__PRETTY_FUNCTION__];
|
||||
}
|
||||
[super readWriteWithBlock:block];
|
||||
backgroundTask = nil;
|
||||
}
|
||||
|
@ -100,7 +103,10 @@ typedef NSData *_Nullable (^CreateDatabaseMetadataBlock)(void);
|
|||
OWSAssert(delegate);
|
||||
OWSAssert(delegate.areAllRegistrationsComplete || self.canWriteBeforeStorageReady);
|
||||
|
||||
__block OWSBackgroundTask *backgroundTask = [OWSBackgroundTask backgroundTaskWithLabelStr:__PRETTY_FUNCTION__];
|
||||
__block OWSBackgroundTask *_Nullable backgroundTask = nil;
|
||||
if (CurrentAppContext().isMainApp) {
|
||||
backgroundTask = [OWSBackgroundTask backgroundTaskWithLabelStr:__PRETTY_FUNCTION__];
|
||||
}
|
||||
[super asyncReadWriteWithBlock:block completionQueue:completionQueue completionBlock:^{
|
||||
if (completionBlock) {
|
||||
completionBlock();
|
||||
|
|
Loading…
Reference in a new issue