Merge tag '2.24.0.9'

pull/1/head
Matthew Chen 8 years ago
commit 2c43d20ee8

@ -38,7 +38,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>2.24.0.8</string>
<string>2.24.0.9</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>LOGS_EMAIL</key>

@ -140,17 +140,6 @@ class CallViewController: OWSViewController, CallObserver, CallServiceObserver,
super.init(nibName: nil, bundle: nil)
allAudioSources = Set(callUIAdapter.audioService.availableInputs)
assert(callUIAdapter.audioService.delegate == nil)
callUIAdapter.audioService.delegate = self
observeNotifications()
}
func observeNotifications() {
NotificationCenter.default.addObserver(self,
selector: #selector(didBecomeActive),
name: NSNotification.Name.OWSApplicationDidBecomeActive,
object: nil)
}
deinit {
@ -208,6 +197,14 @@ class CallViewController: OWSViewController, CallObserver, CallServiceObserver,
call.addObserverAndSyncState(observer: self)
SignalApp.shared().callService.addObserverAndSyncState(observer: self)
assert(callUIAdapter.audioService.delegate == nil)
callUIAdapter.audioService.delegate = self
NotificationCenter.default.addObserver(self,
selector: #selector(didBecomeActive),
name: NSNotification.Name.OWSApplicationDidBecomeActive,
object: nil)
}
// MARK: - Create Views

@ -6,9 +6,6 @@
NS_ASSUME_NONNULL_BEGIN
void runSyncRegistrationsForStorage(OWSStorage *storage);
void runAsyncRegistrationsForStorage(OWSStorage *storage);
@interface OWSPrimaryStorage : OWSStorage
- (instancetype)init NS_UNAVAILABLE;

@ -30,9 +30,10 @@ void runSyncRegistrationsForStorage(OWSStorage *storage)
[TSDatabaseView registerCrossProcessNotifier:storage];
}
void runAsyncRegistrationsForStorage(OWSStorage *storage)
void runAsyncRegistrationsForStorage(OWSStorage *storage, dispatch_block_t completion)
{
OWSCAssert(storage);
OWSCAssert(completion);
// Asynchronously register other extensions.
//
@ -57,7 +58,9 @@ void runAsyncRegistrationsForStorage(OWSStorage *storage)
[OWSFailedMessagesJob asyncRegisterDatabaseExtensionsWithPrimaryStorage:storage];
[OWSFailedAttachmentDownloadsJob asyncRegisterDatabaseExtensionsWithPrimaryStorage:storage];
[OWSMediaGalleryFinder asyncRegisterDatabaseExtensionsWithPrimaryStorage:storage];
[TSDatabaseView asyncRegisterLazyRestoreAttachmentsDatabaseView:storage];
// NOTE: Always pass the completion to the _LAST_ of the async database
// view registrations.
[TSDatabaseView asyncRegisterLazyRestoreAttachmentsDatabaseView:storage completion:completion];
}
#pragma mark -
@ -132,41 +135,18 @@ void runAsyncRegistrationsForStorage(OWSStorage *storage)
{
OWSAssert(completion);
[((OWSDatabase *)self.database)collectRegistrationConnections];
DDLogVerbose(@"%@ async registrations enqueuing.", self.logTag);
runAsyncRegistrationsForStorage(self);
runAsyncRegistrationsForStorage(self, ^{
OWSAssertIsOnMainThread();
DDLogVerbose(@"%@ async registrations enqueued.", self.logTag);
OWSAssert(!self.areAsyncRegistrationsComplete);
// Block until all async registrations are complete.
//
// NOTE: This has to happen on the "registration connections" for this
// database.
NSMutableSet<YapDatabaseConnection *> *pendingRegistrationConnectionSet =
[[((OWSDatabase *)self.database)clearCollectedRegistrationConnections] mutableCopy];
DDLogVerbose(@"%@ flushing registration connections: %zd.", self.logTag, pendingRegistrationConnectionSet.count);
dispatch_async(dispatch_get_main_queue(), ^{
for (YapDatabaseConnection *dbConnection in pendingRegistrationConnectionSet) {
[dbConnection
flushTransactionsWithCompletionQueue:dispatch_get_main_queue()
completionBlock:^{
OWSAssertIsOnMainThread();
OWSAssert(!self.areAsyncRegistrationsComplete);
[pendingRegistrationConnectionSet removeObject:dbConnection];
if (pendingRegistrationConnectionSet.count > 0) {
DDLogVerbose(@"%@ registration connection flushed.", self.logTag);
return;
}
DDLogVerbose(@"%@ async registrations complete.", self.logTag);
self.areAsyncRegistrationsComplete = YES;
completion();
}];
}
DDLogVerbose(@"%@ async registrations complete.", self.logTag);
self.areAsyncRegistrationsComplete = YES;
completion();
});
}

@ -44,12 +44,6 @@ extern NSString *const StorageIsReadyNotification;
options:(YapDatabaseOptions *)inOptions
delegate:(id<OWSDatabaseConnectionDelegate>)delegate NS_DESIGNATED_INITIALIZER;
// Starts collecting references to the registration connections.
- (void)collectRegistrationConnections;
// Stops collecting references to the registration connections and returns
// all collected connections.
- (NSSet<YapDatabaseConnection *> *)clearCollectedRegistrationConnections;
@end
#pragma mark -
@ -77,6 +71,9 @@ extern NSString *const StorageIsReadyNotification;
#endif
- (void)asyncRegisterExtension:(YapDatabaseExtension *)extension withName:(NSString *)extensionName;
- (void)asyncRegisterExtension:(YapDatabaseExtension *)extension
withName:(NSString *)extensionName
completion:(nullable dispatch_block_t)completion;
- (nullable id)registeredExtension:(NSString *)extensionName;

@ -134,8 +134,6 @@ typedef NSData *_Nullable (^CreateDatabaseMetadataBlock)(void);
@property (atomic, weak) id<OWSDatabaseConnectionDelegate> delegate;
@property (nonatomic, readonly, nullable) NSMutableSet<YapDatabaseConnection *> *registrationConnectionSet;
@end
#pragma mark -
@ -185,29 +183,9 @@ typedef NSData *_Nullable (^CreateDatabaseMetadataBlock)(void);
((OWSDatabaseConnection *)connection).canWriteBeforeStorageReady = YES;
#endif
[self.registrationConnectionSet addObject:connection];
return connection;
}
- (void)collectRegistrationConnections
{
OWSAssert(!self.registrationConnectionSet);
_registrationConnectionSet = [NSMutableSet set];
}
- (NSSet<YapDatabaseConnection *> *)clearCollectedRegistrationConnections
{
OWSAssert(self.registrationConnectionSet);
NSSet<YapDatabaseConnection *> *registrationConnectionSetCopy = [self.registrationConnectionSet copy];
_registrationConnectionSet = nil;
return registrationConnectionSetCopy;
}
@end
#pragma mark -
@ -509,6 +487,13 @@ typedef NSData *_Nullable (^CreateDatabaseMetadataBlock)(void);
- (void)asyncRegisterExtension:(YapDatabaseExtension *)extension
withName:(NSString *)extensionName
{
[self asyncRegisterExtension:extension withName:extensionName completion:nil];
}
- (void)asyncRegisterExtension:(YapDatabaseExtension *)extension
withName:(NSString *)extensionName
completion:(nullable dispatch_block_t)completion
{
[self.database asyncRegisterExtension:extension
withName:extensionName
@ -518,6 +503,12 @@ typedef NSData *_Nullable (^CreateDatabaseMetadataBlock)(void);
} else {
DDLogVerbose(@"%@ asyncRegisterExtension succeeded: %@", self.logTag, extensionName);
}
dispatch_async(dispatch_get_main_queue(), ^{
if (completion) {
completion();
}
});
}];
}

@ -58,6 +58,7 @@ extern NSString *const TSLazyRestoreAttachmentsDatabaseViewExtensionName;
+ (void)asyncRegisterSecondaryDevicesDatabaseView:(OWSStorage *)storage;
+ (void)asyncRegisterLazyRestoreAttachmentsDatabaseView:(OWSStorage *)storage;
+ (void)asyncRegisterLazyRestoreAttachmentsDatabaseView:(OWSStorage *)storage
completion:(nullable dispatch_block_t)completion;
@end

@ -343,6 +343,7 @@ NSString *const TSLazyRestoreAttachmentsGroup = @"TSLazyRestoreAttachmentsGroup"
}
+ (void)asyncRegisterLazyRestoreAttachmentsDatabaseView:(OWSStorage *)storage
completion:(nullable dispatch_block_t)completion
{
YapDatabaseViewGrouping *viewGrouping = [YapDatabaseViewGrouping withObjectBlock:^NSString *_Nullable(
YapDatabaseReadTransaction *transaction, NSString *collection, NSString *key, id object) {
@ -391,7 +392,9 @@ NSString *const TSLazyRestoreAttachmentsGroup = @"TSLazyRestoreAttachmentsGroup"
[[YapWhitelistBlacklist alloc] initWithWhitelist:[NSSet setWithObject:[TSAttachment collection]]];
YapDatabaseView *view =
[[YapDatabaseAutoView alloc] initWithGrouping:viewGrouping sorting:viewSorting versionTag:@"3" options:options];
[storage asyncRegisterExtension:view withName:TSLazyRestoreAttachmentsDatabaseViewExtensionName];
[storage asyncRegisterExtension:view
withName:TSLazyRestoreAttachmentsDatabaseViewExtensionName
completion:completion];
}
+ (id)unseenDatabaseViewExtension:(YapDatabaseReadTransaction *)transaction

@ -19,7 +19,7 @@
<key>CFBundleShortVersionString</key>
<string>2.24.0</string>
<key>CFBundleVersion</key>
<string>2.24.0.8</string>
<string>2.24.0.9</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>NSAppTransportSecurity</key>

Loading…
Cancel
Save