From dbdafb6bd5353a70146e0344287c0a95ce7779ec Mon Sep 17 00:00:00 2001 From: Matt Date: Sat, 5 Jan 2019 19:06:57 +0100 Subject: [PATCH] Updater now not skippable on first app start updater no longer pops up when no new updates are found --- .../Scripts/UI/UpdaterViewBehaviour.cs | 24 ++++++++++++------- .../Scripts/Updater/UpdateManager.cs | 10 ++++++-- 2 files changed, 24 insertions(+), 10 deletions(-) diff --git a/Assets/RothenburgAR/Scripts/UI/UpdaterViewBehaviour.cs b/Assets/RothenburgAR/Scripts/UI/UpdaterViewBehaviour.cs index ca04b3c..d4a0d68 100644 --- a/Assets/RothenburgAR/Scripts/UI/UpdaterViewBehaviour.cs +++ b/Assets/RothenburgAR/Scripts/UI/UpdaterViewBehaviour.cs @@ -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(); diff --git a/Assets/RothenburgAR/Scripts/Updater/UpdateManager.cs b/Assets/RothenburgAR/Scripts/Updater/UpdateManager.cs index 5d6c8b9..82905ba 100644 --- a/Assets/RothenburgAR/Scripts/Updater/UpdateManager.cs +++ b/Assets/RothenburgAR/Scripts/Updater/UpdateManager.cs @@ -14,11 +14,13 @@ namespace RothenburgAR.Updater { public enum UpdateState { + UpToDate, UpdatesFound, ConfirmationPending, Downloading, Completed, - Failed + Failed, + NoInternet } public class UpdateManager : Singleton @@ -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)