diff options
author | Jan Mulder <jlmulder@xs4all.nl> | 2017-08-01 11:38:59 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2017-09-04 07:38:30 -0700 |
commit | 190d80e509e24b242024cda28d7caf546250fab1 (patch) | |
tree | 41e53e2f77bc0d6b568bc196964d82a695a61fdc /mobile-widgets | |
parent | b9404b09059095b92147496f2fb4bc07c90faaaa (diff) | |
download | subsurface-190d80e509e24b242024cda28d7caf546250fab1.tar.gz |
mobile: remove superfluous state VALID_EMAIL
This is a no-brainer removal of the VALID_EMAIL state used in QMLManager.
All current usage of this state is "if state is VALID or VALID_EMAIL",
so there is no distinction between the two states.
It is even a little different. The comment suggests "when we can open
a local cloud storage, tied to a cloud account (so explicitly not
the no-cloud status), we have at least a valid email". While this
is formally true, this implies that there is also a cloud account
on the cloud server (ie. the cloud account is in a VERIFIED state).
In other words: currently, there can't exist a valid local storage
that is tied to a valid email adress, without valid cloud account
on the server.
Notice that this touches the discussion on GitHub for commit
e76f527fe530636 (pull request #520). Can we implement the creation
of a valid cloud account without data link to the cloud server?
Currently, we need the server to confirm the email address (for
example for uniqueness reasons on server side). Obviously, we could
hack our way out of this, but we have a perfect solution already
in place. Create a no-cloud account, and transfer that later to
a true and valid cloud account.
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
Diffstat (limited to 'mobile-widgets')
-rw-r--r-- | mobile-widgets/qml/DiveList.qml | 6 | ||||
-rw-r--r-- | mobile-widgets/qml/main.qml | 6 | ||||
-rw-r--r-- | mobile-widgets/qmlmanager.cpp | 4 | ||||
-rw-r--r-- | mobile-widgets/qmlmanager.h | 1 |
4 files changed, 8 insertions, 9 deletions
diff --git a/mobile-widgets/qml/DiveList.qml b/mobile-widgets/qml/DiveList.qml index 72302e0bb..1dccb5b75 100644 --- a/mobile-widgets/qml/DiveList.qml +++ b/mobile-widgets/qml/DiveList.qml @@ -24,7 +24,7 @@ Kirigami.ScrollablePage { supportsRefreshing: true onRefreshingChanged: { if (refreshing) { - if (manager.credentialStatus === QMLManager.VALID || manager.credentialStatus === QMLManager.VALID_EMAIL) { + if (manager.credentialStatus === QMLManager.VALID) { console.log("User pulled down dive list - syncing with cloud storage") detailsWindow.endEditMode() manager.saveChangesCloud(true) @@ -266,7 +266,7 @@ Kirigami.ScrollablePage { StartPage { id: startPage anchors.fill: parent - opacity: credentialStatus === QMLManager.NOCLOUD || (credentialStatus === QMLManager.VALID || credentialStatus === QMLManager.VALID_EMAIL) ? 0 : 1 + opacity: credentialStatus === QMLManager.NOCLOUD || (credentialStatus === QMLManager.VALID) ? 0 : 1 visible: opacity > 0 Behavior on opacity { NumberAnimation { duration: Kirigami.Units.shortDuration } } function setupActions() { @@ -274,7 +274,7 @@ Kirigami.ScrollablePage { page.actions.main = page.saveAction page.actions.right = page.offlineAction page.title = qsTr("Cloud credentials") - } else if(manager.credentialStatus === QMLManager.VALID || manager.credentialStatus === QMLManager.VALID_EMAIL || manager.credentialStatus === QMLManager.NOCLOUD) { + } else if(manager.credentialStatus === QMLManager.VALID || manager.credentialStatus === QMLManager.NOCLOUD) { page.actions.main = page.downloadFromDCAction page.actions.right = page.addDiveAction page.title = qsTr("Dive list") diff --git a/mobile-widgets/qml/main.qml b/mobile-widgets/qml/main.qml index e9560036d..e34e89e50 100644 --- a/mobile-widgets/qml/main.qml +++ b/mobile-widgets/qml/main.qml @@ -120,7 +120,7 @@ Kirigami.ApplicationWindow { if (manager.credentialStatus == QMLManager.UNKNOWN) { // the user has asked to change credentials - if the credentials before that // were valid, go back to dive list - if (oldStatus == QMLManager.VALID || oldStatus == QMLManager.VALID_EMAIL) { + if (oldStatus == QMLManager.VALID) { manager.credentialStatus = oldStatus } } @@ -134,7 +134,7 @@ Kirigami.ApplicationWindow { Kirigami.Action { iconName: "icons/ic_add.svg" text: qsTr("Add dive manually") - enabled: manager.credentialStatus === QMLManager.VALID || manager.credentialStatus === QMLManager.VALID_EMAIL || manager.credentialStatus === QMLManager.NOCLOUD + enabled: manager.credentialStatus === QMLManager.VALID || manager.credentialStatus === QMLManager.NOCLOUD onTriggered: { returnTopPage() // otherwise odd things happen with the page stack startAddDive() @@ -159,7 +159,7 @@ Kirigami.ApplicationWindow { Kirigami.Action { iconName: "icons/cloud_sync.svg" text: qsTr("Manual sync with cloud") - enabled: manager.credentialStatus === QMLManager.VALID || manager.credentialStatus === QMLManager.VALID_EMAIL || manager.credentialStatus === QMLManager.NOCLOUD + enabled: manager.credentialStatus === QMLManager.VALID || manager.credentialStatus === QMLManager.NOCLOUD onTriggered: { if (manager.credentialStatus === QMLManager.NOCLOUD) { returnTopPage() diff --git a/mobile-widgets/qmlmanager.cpp b/mobile-widgets/qmlmanager.cpp index a38d98df0..8f8f06163 100644 --- a/mobile-widgets/qmlmanager.cpp +++ b/mobile-widgets/qmlmanager.cpp @@ -173,9 +173,9 @@ void QMLManager::openLocalThenRemote(QString url) appendTextToLog(QStringLiteral("loading dives from cache failed %1").arg(error)); setNotificationText(tr("Opening local data file failed")); } else { - // if we can load from the cache, we know that we have at least a valid email + // if we can load from the cache, we know that we have a valid cloud account if (credentialStatus() == UNKNOWN) - setCredentialStatus(VALID_EMAIL); + setCredentialStatus(VALID); prefs.unit_system = git_prefs.unit_system; if (git_prefs.unit_system == IMPERIAL) git_prefs.units = IMPERIAL_units; diff --git a/mobile-widgets/qmlmanager.h b/mobile-widgets/qmlmanager.h index 71f6b8cf9..d1595cd5f 100644 --- a/mobile-widgets/qmlmanager.h +++ b/mobile-widgets/qmlmanager.h @@ -52,7 +52,6 @@ public: INCOMPLETE, UNKNOWN, INVALID, - VALID_EMAIL, VALID, NOCLOUD }; |