From f7da06c76bfab30fb21224955626ba74095251ba Mon Sep 17 00:00:00 2001 From: Jan Mulder Date: Tue, 17 Oct 2017 13:28:36 +0200 Subject: 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 --- mobile-widgets/qmlmanager.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'mobile-widgets') 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) -- cgit v1.2.3-70-g09d2