summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Jan Mulder <jlmulder@xs4all.nl>2017-10-17 13:28:36 +0200
committerGravatar Jan Mulder <jlmulder@xs4all.nl>2017-10-17 14:29:17 +0200
commitf7da06c76bfab30fb21224955626ba74095251ba (patch)
tree7f548ff5b5fa2b5e5a13f9fc1f9fa05e1d70c052
parent16b395a8989732db2dda835e347176afb8e414b6 (diff)
downloadsubsurface-f7da06c76bfab30fb21224955626ba74095251ba.tar.gz
mobile: fix initial setup with no repo or meta info
First, obviously, I could have squashed this small commit into the previous one, but I explicly decided not to. It shows the fragility of all this credential processing code, and the complex flow control troughout the code. Testing on a brand new install, and immediately going for a no cloud setup, the PIN screen was shown, instead of an empty divelist. Looking at this small code change shows why. In case of a no cloud situation, there is no PIN to verify (or email and passwd rules checked). So just do not force us there. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
-rw-r--r--mobile-widgets/qmlmanager.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/mobile-widgets/qmlmanager.cpp b/mobile-widgets/qmlmanager.cpp
index 6d2d8039a..b0e597f6f 100644
--- a/mobile-widgets/qmlmanager.cpp
+++ b/mobile-widgets/qmlmanager.cpp
@@ -197,9 +197,18 @@ void QMLManager::openLocalThenRemote(QString url)
if (error) {
appendTextToLog(QStringLiteral("loading dives from cache failed %1").arg(error));
setNotificationText(tr("Opening local data file failed"));
- // have cloud credentials, but there is no local repo (yet).
- // this implies that the PIN verify is still to be done
- setCredentialStatus(CS_NEED_TO_VERIFY);
+ /* there can be 2 reasons for this:
+ * 1) we have cloud credentials, but there is no local repo (yet).
+ * This implies that the PIN verify is still to be done.
+ * 2) we are in a very clean state after installing the app, and
+ * want to use a NO CLOUD setup. The intial repo has no initial
+ * commit in it, so its master branch does not yet exist. We do not
+ * care about this, as the very first commit of dive data to the
+ * no cloud repo solves this.
+ */
+
+ if (credentialStatus() != CS_NOCLOUD)
+ setCredentialStatus(CS_NEED_TO_VERIFY);
} else {
// if we can load from the cache, we know that we have a valid cloud account
if (credentialStatus() == CS_UNKNOWN)