Updater now not skippable on first app start

updater no longer pops up when no new updates are found
This commit is contained in:
2019-01-05 19:06:57 +01:00
parent a9bf767f8d
commit dbdafb6bd5
2 changed files with 24 additions and 10 deletions

View File

@@ -10,18 +10,20 @@ namespace RothenburgAR.UI
public class UpdaterViewBehaviour : BaseViewBehaviour
{
public UnityEngine.UI.Slider ProgressBar;
public GameObject UpdateDialog;
public GameObject UpdateProgressDialog;
public GameObject UpdateConfirmationDialog;
public GameObject UpdateCompletedDialog;
public GameObject UpdateFailedDialog;
public GameObject ButtonBack;
private bool allowAbort = true;
private UpdateState lastUpdateState = UpdateState.UpdatesFound;
private void Start()
{
UpdateDialog.SetActive(true);
UpdateProgressDialog.SetActive(true);
UpdateConfirmationDialog.SetActive(false);
UpdateCompletedDialog.SetActive(false);
UpdateFailedDialog.SetActive(false);
@@ -31,7 +33,7 @@ namespace RothenburgAR.UI
if (UIManager.Instance.StartingUp)
{
allowAbort = false;
//TODO disable all ExitView() calls in UI and ensure they are not enabled otherwise
ButtonBack.SetActive(false);
}
UIManager.Instance.StartingUp = false;
@@ -46,7 +48,7 @@ namespace RothenburgAR.UI
if (state == lastUpdateState) return;
lastUpdateState = state;
UpdateDialog.SetActive(false);
UpdateProgressDialog.SetActive(false);
UpdateConfirmationDialog.SetActive(false);
UpdateCompletedDialog.SetActive(false);
UpdateFailedDialog.SetActive(false);
@@ -59,18 +61,24 @@ namespace RothenburgAR.UI
case UpdateState.UpdatesFound:
case UpdateState.Downloading:
UpdateDialog.SetActive(true);
UpdateProgressDialog.SetActive(true);
break;
case UpdateState.Completed:
UpdateCompletedDialog.SetActive(true);
//TODO add "apply upgrades" button which Destroys all DontDestroyOnLoads and reloads the scene
break;
case UpdateState.Failed:
UpdateFailedDialog.SetActive(true);
break;
case UpdateState.NoInternet:
//TODO display dialog
break;
case UpdateState.UpToDate:
//TODO display dialog
break;
}
}
@@ -86,7 +94,7 @@ namespace RothenburgAR.UI
public void ApplyUpdates()
{
//DisplayManager.ResetInstance();
//DisplayManager.ResetInstance(); // Not necessary
LanguageManager.Instance.ResetInstance();
InputManager.Instance.ResetInstance();

View File

@@ -14,11 +14,13 @@ namespace RothenburgAR.Updater
{
public enum UpdateState
{
UpToDate,
UpdatesFound,
ConfirmationPending,
Downloading,
Completed,
Failed
Failed,
NoInternet
}
public class UpdateManager : Singleton<UpdateManager>
@@ -41,6 +43,7 @@ namespace RothenburgAR.Updater
{
// just continue to app
UpdatesCompleted();
UpdateState = UpdateState.NoInternet;
return;
}
@@ -80,6 +83,7 @@ namespace RothenburgAR.Updater
if (VersionAnswer.Data.TrueForAll(d => d.Meta.Status == VersionStatus.ok && d.Tracker.Status == VersionStatus.ok))
{
UpdateState = UpdateState.UpToDate;
StartCoroutine(CheckFiles());
return;
}
@@ -448,9 +452,11 @@ namespace RothenburgAR.Updater
if (!UIManager.Instance.StartingUp)
UIManager.Instance.SwitchToView(ViewName.UpdaterView);
}
public void UpdatesCompleted()
{
if (UpdateState == UpdateState.UpToDate) return;
UpdateState = UpdateState.Completed;
if (!UIManager.Instance.StartingUp)