Skip to content

Commit 59516d5

Browse files
committed
Fix availability of user action buttons
1 parent ab4008c commit 59516d5

File tree

2 files changed

+24
-7
lines changed

2 files changed

+24
-7
lines changed

Assets/PatchKit Patcher/Scripts/Patcher.cs

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -564,12 +564,17 @@ private void ThreadWaitForUserDecision(CancellationToken cancellationToken)
564564

565565
DebugLogger.LogVariable(isInstalled, "isInstalled");
566566

567-
_canRepairApp.Value = false; // not implemented
568-
_canInstallApp.Value = !isInstalled;
569-
_canCheckForAppUpdates.Value = isInstalled;
570-
_canStartApp.Value = isInstalled;
567+
bool canRepairApp = false; // not implemented
568+
bool canInstallApp = !isInstalled;
569+
bool canCheckForAppUpdates = isInstalled;
570+
bool canStartApp = isInstalled;
571571

572-
if (_canInstallApp.Value && _configuration.AutomaticallyInstallApp && !_hasAutomaticallyInstalledApp)
572+
_canRepairApp.Value = false;
573+
_canInstallApp.Value = false;
574+
_canCheckForAppUpdates.Value = false;
575+
_canStartApp.Value = false;
576+
577+
if (canInstallApp && _configuration.AutomaticallyInstallApp && !_hasAutomaticallyInstalledApp)
573578
{
574579
DebugLogger.Log("Automatically deciding to install app.");
575580
_hasAutomaticallyInstalledApp = true;
@@ -578,7 +583,7 @@ private void ThreadWaitForUserDecision(CancellationToken cancellationToken)
578583
return;
579584
}
580585

581-
if (_canCheckForAppUpdates.Value && _configuration.AutomaticallyCheckForAppUpdates &&
586+
if (canCheckForAppUpdates && _configuration.AutomaticallyCheckForAppUpdates &&
582587
!_hasAutomaticallyCheckedForAppUpdate)
583588
{
584589
DebugLogger.Log("Automatically deciding to check for app updates.");
@@ -588,20 +593,31 @@ private void ThreadWaitForUserDecision(CancellationToken cancellationToken)
588593
return;
589594
}
590595

591-
if (_canStartApp.Value && _configuration.AutomaticallyStartApp && !_hasAutomaticallyStartedApp)
596+
if (canStartApp && _configuration.AutomaticallyStartApp && !_hasAutomaticallyStartedApp)
592597
{
593598
DebugLogger.Log("Automatically deciding to start app.");
594599
_hasAutomaticallyStartedApp = true;
595600
_userDecision = UserDecision.StartAppAutomatically;
596601
return;
597602
}
598603

604+
_canRepairApp.Value = canRepairApp;
605+
_canInstallApp.Value = canInstallApp;
606+
_canCheckForAppUpdates.Value = canCheckForAppUpdates;
607+
_canStartApp.Value = canStartApp;
608+
599609
_userDecisionSetEvent.Reset();
600610
using (cancellationToken.Register(() => _userDecisionSetEvent.Set()))
601611
{
602612
cancellationToken.ThrowIfCancellationRequested();
603613
_userDecisionSetEvent.WaitOne();
604614
}
615+
616+
_canRepairApp.Value = false;
617+
_canInstallApp.Value = false;
618+
_canCheckForAppUpdates.Value = false;
619+
_canStartApp.Value = false;
620+
605621
cancellationToken.ThrowIfCancellationRequested();
606622

607623
DebugLogger.Log(string.Format("Waiting for user decision result: {0}.", _userDecision));

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
3636
- Pre update integrity checking uses the Repair strategy
3737

3838
### Fixed
39+
- Availability of user action buttons (update, start & check for updates)
3940
- Handling of the ZLib exception
4041
- Invalid handling of patcher-data-location argument with spaces
4142

0 commit comments

Comments
 (0)