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

View File

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