|
|
@ -153,48 +153,34 @@ void runAsyncRegistrationsForStorage(OWSStorage *storage)
|
|
|
|
pendingRegistrationConnectionSet.count);
|
|
|
|
pendingRegistrationConnectionSet.count);
|
|
|
|
|
|
|
|
|
|
|
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
|
if (pendingRegistrationConnectionSet.count > 0) {
|
|
|
|
for (YapDatabaseConnection *dbConnection in pendingRegistrationConnectionSet) {
|
|
|
|
for (YapDatabaseConnection *dbConnection in pendingRegistrationConnectionSet) {
|
|
|
|
[dbConnection
|
|
|
|
[dbConnection
|
|
|
|
flushTransactionsWithCompletionQueue:dispatch_get_main_queue()
|
|
|
|
flushTransactionsWithCompletionQueue:dispatch_get_main_queue()
|
|
|
|
completionBlock:^{
|
|
|
|
completionBlock:^{
|
|
|
|
OWSAssertIsOnMainThread();
|
|
|
|
OWSAssertIsOnMainThread();
|
|
|
|
OWSAssert(!self.areAsyncRegistrationsComplete);
|
|
|
|
|
|
|
|
|
|
|
|
[pendingRegistrationConnectionSet
|
|
|
|
[pendingRegistrationConnectionSet
|
|
|
|
removeObject:dbConnection];
|
|
|
|
removeObject:dbConnection];
|
|
|
|
if (pendingRegistrationConnectionSet.count
|
|
|
|
if (pendingRegistrationConnectionSet.count > 0) {
|
|
|
|
> 0) {
|
|
|
|
DDLogVerbose(@"%@ registration "
|
|
|
|
DDLogVerbose(@"%@ registration "
|
|
|
|
@"connection flushed.",
|
|
|
|
@"connection flushed.",
|
|
|
|
self.logTag);
|
|
|
|
self.logTag);
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
DDLogVerbose(@"%@ async registrations complete.",
|
|
|
|
[self
|
|
|
|
self.logTag);
|
|
|
|
markAsyncRegistrationsAsCompleteWithCompletion:
|
|
|
|
|
|
|
|
completion];
|
|
|
|
self.areAsyncRegistrationsComplete = YES;
|
|
|
|
}];
|
|
|
|
|
|
|
|
}
|
|
|
|
completion();
|
|
|
|
} else {
|
|
|
|
}];
|
|
|
|
[self markAsyncRegistrationsAsCompleteWithCompletion:completion];
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}];
|
|
|
|
}];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
- (void)markAsyncRegistrationsAsCompleteWithCompletion:(void (^_Nonnull)(void))completion
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
OWSAssertIsOnMainThread();
|
|
|
|
|
|
|
|
OWSAssert(!self.areAsyncRegistrationsComplete);
|
|
|
|
|
|
|
|
OWSAssert(completion);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DDLogVerbose(@"%@ async registrations complete.", self.logTag);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
self.areAsyncRegistrationsComplete = YES;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
completion();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+ (void)protectFiles
|
|
|
|
+ (void)protectFiles
|
|
|
|
{
|
|
|
|
{
|
|
|
|
DDLogInfo(
|
|
|
|
DDLogInfo(
|
|
|
|