Reorder checks in initialization sequence
This commit is contained in:
		
					parent
					
						
							
								77ceb8ee67
							
						
					
				
			
			
				commit
				
					
						51a9f62778
					
				
			
		
					 1 changed files with 17 additions and 24 deletions
				
			
		| 
						 | 
					@ -1410,8 +1410,6 @@ export async function startApp(): Promise<void> {
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    window.dispatchEvent(new Event('storage_ready'));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    void badgeImageFileDownloader.checkForFilesToDownload();
 | 
					    void badgeImageFileDownloader.checkForFilesToDownload();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    initializeExpiringMessageService(singleProtoJobQueue);
 | 
					    initializeExpiringMessageService(singleProtoJobQueue);
 | 
				
			||||||
| 
						 | 
					@ -1922,6 +1920,11 @@ export async function startApp(): Promise<void> {
 | 
				
			||||||
        return unlinkAndDisconnect();
 | 
					        return unlinkAndDisconnect();
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      if (!window.textsecure.storage.user.getPni()) {
 | 
				
			||||||
 | 
					        log.error('PNI not captured during registration, unlinking softly');
 | 
				
			||||||
 | 
					        return unlinkAndDisconnect();
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      if (connectCount === 1) {
 | 
					      if (connectCount === 1) {
 | 
				
			||||||
        try {
 | 
					        try {
 | 
				
			||||||
          // Note: we always have to register our capabilities all at once, so we do this
 | 
					          // Note: we always have to register our capabilities all at once, so we do this
 | 
				
			||||||
| 
						 | 
					@ -1939,11 +1942,6 @@ export async function startApp(): Promise<void> {
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      if (!window.textsecure.storage.user.getPni()) {
 | 
					 | 
				
			||||||
        log.error('PNI not captured during registration, unlinking softly');
 | 
					 | 
				
			||||||
        return unlinkAndDisconnect();
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      if (firstRun === true && !areWePrimaryDevice) {
 | 
					      if (firstRun === true && !areWePrimaryDevice) {
 | 
				
			||||||
        if (!window.storage.get('accountEntropyPool')) {
 | 
					        if (!window.storage.get('accountEntropyPool')) {
 | 
				
			||||||
          const lastSent =
 | 
					          const lastSent =
 | 
				
			||||||
| 
						 | 
					@ -2028,23 +2026,18 @@ export async function startApp(): Promise<void> {
 | 
				
			||||||
            installed: true,
 | 
					            installed: true,
 | 
				
			||||||
          }));
 | 
					          }));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
          if (window.ConversationController.areWePrimaryDevice()) {
 | 
					          if (!window.ConversationController.areWePrimaryDevice()) {
 | 
				
			||||||
            log.warn(
 | 
					            log.info('firstRun: requesting stickers', operations.length);
 | 
				
			||||||
              'background/connect: We are primary device; not sending sticker pack sync'
 | 
					            try {
 | 
				
			||||||
            );
 | 
					              await singleProtoJobQueue.add(
 | 
				
			||||||
            return;
 | 
					                MessageSender.getStickerPackSync(operations)
 | 
				
			||||||
          }
 | 
					              );
 | 
				
			||||||
 | 
					            } catch (error) {
 | 
				
			||||||
          log.info('firstRun: requesting stickers', operations.length);
 | 
					              log.error(
 | 
				
			||||||
          try {
 | 
					                'connect: Failed to queue sticker sync message',
 | 
				
			||||||
            await singleProtoJobQueue.add(
 | 
					                Errors.toLogFormat(error)
 | 
				
			||||||
              MessageSender.getStickerPackSync(operations)
 | 
					              );
 | 
				
			||||||
            );
 | 
					            }
 | 
				
			||||||
          } catch (error) {
 | 
					 | 
				
			||||||
            log.error(
 | 
					 | 
				
			||||||
              'connect: Failed to queue sticker sync message',
 | 
					 | 
				
			||||||
              Errors.toLogFormat(error)
 | 
					 | 
				
			||||||
            );
 | 
					 | 
				
			||||||
          }
 | 
					          }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue