@@ -599,7 +599,7 @@ - (void)handleMessageWithIdentifier:(int32_t)identifier data:(NSData *)data
599599 } else if (identifier == SPUSentUpdateAppcastItemData) {
600600 SUAppcastItem *updateItem = (data != nil ) ? (SUAppcastItem *)SPUUnarchiveRootObjectSecurely (data, [SUAppcastItem class ]) : nil ;
601601 if (updateItem != nil ) {
602- SPUInstallationInfo *installationInfo = [[SPUInstallationInfo alloc ] initWithAppcastItem: updateItem canSilentlyInstall: [_installer canInstallSilently ] ];
602+ SPUInstallationInfo *installationInfo = [[SPUInstallationInfo alloc ] initWithAppcastItem: updateItem];
603603
604604 NSData *archivedData = SPUArchiveRootObjectSecurely (installationInfo);
605605 if (archivedData != nil ) {
@@ -612,7 +612,7 @@ - (void)handleMessageWithIdentifier:(int32_t)identifier data:(NSData *)data
612612 uint8_t showsUI = *((const uint8_t *)data.bytes + 1 );
613613
614614 dispatch_async (dispatch_get_main_queue (), ^{
615- // This flag has an impact on interactive type installations and showing UI progress during non-interactive installations
615+ // This flag has an impact on showing UI progress during installations
616616 self->_shouldShowUI = (BOOL )showsUI;
617617 // Don't test if the application was alive initially, leave that to the progress agent if we decide to relaunch
618618 self->_shouldRelaunch = (BOOL )relaunch;
@@ -679,18 +679,16 @@ - (void)startInstallation SPU_OBJC_DIRECT
679679 return ;
680680 }
681681
682- uint8_t canPerformSilentInstall = (uint8_t )[installer canInstallSilently ];
683-
684682 dispatch_async (dispatch_get_main_queue (), ^{
685683 self->_installer = installer;
686684
687685 os_unfair_lock_lock (&self->_newConnectionLock );
688686 self->_performedStage1Installation = YES ;
689687 os_unfair_lock_unlock (&self->_newConnectionLock );
690688
691- uint8_t sendInformation[] = {canPerformSilentInstall, (uint8_t )self->_targetTerminated } ;
689+ uint8_t targetTerminated = (uint8_t )self->_targetTerminated ;
692690
693- NSData *sendData = [NSData dataWithBytes: sendInformation length: sizeof (sendInformation )];
691+ NSData *sendData = [NSData dataWithBytes: &targetTerminated length: sizeof (targetTerminated )];
694692
695693 [self ->_communicator handleMessageWithIdentifier: SPUInstallationFinishedStage1 data: sendData];
696694
@@ -705,37 +703,27 @@ - (void)startInstallation SPU_OBJC_DIRECT
705703
706704- (void )performStage2Installation SPU_OBJC_DIRECT
707705{
708- BOOL canPerformSecondStage = _shouldShowUI || [_installer canInstallSilently ];
709- if (canPerformSecondStage) {
710- _performedStage2Installation = YES ;
706+ _performedStage2Installation = YES ;
707+
708+ dispatch_async (dispatch_get_main_queue (), ^{
709+ uint8_t targetTerminated = (uint8_t )self->_targetTerminated ;
711710
712- dispatch_async (dispatch_get_main_queue (), ^{
713- uint8_t targetTerminated = (uint8_t )self->_targetTerminated ;
714-
715- NSData *sendData = [NSData dataWithBytes: &targetTerminated length: sizeof (targetTerminated)];
716- [self ->_communicator handleMessageWithIdentifier: SPUInstallationFinishedStage2 data: sendData];
717-
718- // Don't check if the target is already terminated, leave that to the progress agent
719- // We could be slightly off if there were multiple instances running
720- [self ->_agentConnection.agent sendTerminationSignal ];
721- });
722- } else {
723- _installer = nil ;
711+ NSData *sendData = [NSData dataWithBytes: &targetTerminated length: sizeof (targetTerminated)];
712+ [self ->_communicator handleMessageWithIdentifier: SPUInstallationFinishedStage2 data: sendData];
724713
725- dispatch_async ( dispatch_get_main_queue (), ^{
726- [ self cleanupAndExitWithStatus: EXIT_FAILURE error: [ NSError errorWithDomain: SUSparkleErrorDomain code: SPUInstallerError userInfo: @{ NSLocalizedDescriptionKey : @" Error: Failed to resume installer on stage 2 because installation cannot be installed silently " }]];
727- }) ;
728- }
714+ // Don't check if the target is already terminated, leave that to the progress agent
715+ // We could be slightly off if there were multiple instances running
716+ [ self ->_agentConnection.agent sendTerminationSignal ] ;
717+ });
729718}
730719
731720- (void )finishInstallationAfterHostTermination SPU_OBJC_DIRECT
732721{
733722 assert (self->_targetTerminated );
734723
735- // Show our installer progress UI tool if only after a certain amount of time passes,
736- // and if our installer is silent (i.e, doesn't show progress on its own)
724+ // Show our installer progress UI tool if only after a certain amount of time passes
737725 __block BOOL shouldShowUIProgress = YES ;
738- if (self->_shouldShowUI && [ self ->_installer canInstallSilently ] ) {
726+ if (self->_shouldShowUI ) {
739727 // Ask the updater if it is still alive
740728 // If they are, we will receive a pong response back
741729 // Reset if we received a pong just to be on the safe side
0 commit comments