From ccace53b83f753c8ce20a8a004a5645baeff58b2 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Sun, 3 Nov 2019 05:06:10 -0800 Subject: Mobile: remember if we were able to open the local cache If there is a local cache, we at least once successfully accessed the cloud, so this is a valid cloud based git tree. Without this change we run into a subtle bug: after a fresh install, or when switching users, when the cloud data is accessed the very first time, we don't remember that this was indeed loaded from the cloud. So if we then download from a dive computer or make any other changes to the dive log, we cannot save those dives to cloud storage - but we fail silently doing so. Which to the user would look that inexplicable data loss. Signed-off-by: Dirk Hohndel --- mobile-widgets/qmlmanager.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'mobile-widgets') diff --git a/mobile-widgets/qmlmanager.cpp b/mobile-widgets/qmlmanager.cpp index 1aadc6b50..983f192be 100644 --- a/mobile-widgets/qmlmanager.cpp +++ b/mobile-widgets/qmlmanager.cpp @@ -302,6 +302,9 @@ void QMLManager::openLocalThenRemote(QString url) QMLPrefs::instance()->setCredentialStatus(qPrefCloudStorage::CS_NEED_TO_VERIFY); } else { // if we can load from the cache, we know that we have a valid cloud account + // and we know that there was at least one successful sync with the cloud when + // that local cache was created - so there is a common ancestor + setLoadFromCloud(true); if (QMLPrefs::instance()->credentialStatus() == qPrefCloudStorage::CS_UNKNOWN) QMLPrefs::instance()->setCredentialStatus(qPrefCloudStorage::CS_VERIFIED); if (git_prefs.unit_system == IMPERIAL) -- cgit v1.2.3-70-g09d2