| 
						
						
							
								
							
						
						
					 | 
					 | 
					@ -64,13 +64,29 @@ NSString *const TSSecondaryDevicesDatabaseViewExtensionName = @"TSSecondaryDevic
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    return self;
 | 
					 | 
					 | 
					 | 
					    return self;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					}
 | 
					 | 
					 | 
					 | 
					}
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					+ (BOOL)hasPendingViewRegistrations
 | 
					 | 
					 | 
					 | 
					- (BOOL)hasPendingViewRegistrations
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					{
 | 
					 | 
					 | 
					 | 
					{
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    OWSAssert([NSThread isMainThread]);
 | 
					 | 
					 | 
					 | 
					    @synchronized(self)
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        return !self.areAllAsyncRegistrationsComplete;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					}
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					+ (BOOL)hasPendingViewRegistrations
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					{
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    return ![TSDatabaseView sharedInstance].areAllAsyncRegistrationsComplete;
 | 
					 | 
					 | 
					 | 
					    return ![TSDatabaseView sharedInstance].areAllAsyncRegistrationsComplete;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					}
 | 
					 | 
					 | 
					 | 
					}
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					- (void)setAreAllAsyncRegistrationsComplete
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					{
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    @synchronized(self)
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        OWSAssert(!self.areAllAsyncRegistrationsComplete);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        self.areAllAsyncRegistrationsComplete = YES;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					}
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					+ (void)registerMessageDatabaseViewWithName:(NSString *)viewName
 | 
					 | 
					 | 
					 | 
					+ (void)registerMessageDatabaseViewWithName:(NSString *)viewName
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                               viewGrouping:(YapDatabaseViewGrouping *)viewGrouping
 | 
					 | 
					 | 
					 | 
					                               viewGrouping:(YapDatabaseViewGrouping *)viewGrouping
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                                    version:(NSString *)version
 | 
					 | 
					 | 
					 | 
					                                    version:(NSString *)version
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -423,8 +439,9 @@ NSString *const TSSecondaryDevicesDatabaseViewExtensionName = @"TSSecondaryDevic
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    // All async registrations are complete when writes are unblocked.
 | 
					 | 
					 | 
					 | 
					    // All async registrations are complete when writes are unblocked.
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    [[TSStorageManager sharedManager].newDatabaseConnection
 | 
					 | 
					 | 
					 | 
					    [[TSStorageManager sharedManager].newDatabaseConnection
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        asyncReadWriteWithBlock:^(YapDatabaseReadWriteTransaction *_Nonnull transaction) {
 | 
					 | 
					 | 
					 | 
					        asyncReadWriteWithBlock:^(YapDatabaseReadWriteTransaction *_Nonnull transaction) {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            [TSDatabaseView.sharedInstance setAreAllAsyncRegistrationsComplete];
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            dispatch_async(dispatch_get_main_queue(), ^{
 | 
					 | 
					 | 
					 | 
					            dispatch_async(dispatch_get_main_queue(), ^{
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                TSDatabaseView.sharedInstance.areAllAsyncRegistrationsComplete = YES;
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                [[NSNotificationCenter defaultCenter]
 | 
					 | 
					 | 
					 | 
					                [[NSNotificationCenter defaultCenter]
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    postNotificationName:kNSNotificationName_DatabaseViewRegistrationComplete
 | 
					 | 
					 | 
					 | 
					                    postNotificationName:kNSNotificationName_DatabaseViewRegistrationComplete
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                                  object:nil
 | 
					 | 
					 | 
					 | 
					                                  object:nil
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
					 | 
					
 
 |