Mobile: simpify startup logic

When starting the mobile app, I noticed a short display of an empty
page with title "Cloud creditials" just before showing the
divelist. Simply a not nice visual effect.

This commit simplifies some logic and resolves this. As the code
in this part is fragile, this is tested for normal and clean
startup of the app, switching credentials, from no cloud to
valid account (which even nicely imports the no cloud dives:
this surprised me as I have never seen this working).

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
This commit is contained in:
Jan Mulder 2018-10-02 13:16:12 +02:00 committed by Dirk Hohndel
parent 26de89364c
commit 42eae7e48b

View file

@ -334,12 +334,8 @@ Kirigami.ScrollablePage {
visible: opacity > 0 visible: opacity > 0
Behavior on opacity { NumberAnimation { duration: Kirigami.Units.shortDuration } } Behavior on opacity { NumberAnimation { duration: Kirigami.Units.shortDuration } }
function setupActions() { function setupActions() {
if (visible) { if (prefs.credentialStatus === CloudStatus.CS_VERIFIED ||
page.actions.main = null prefs.credentialStatus === CloudStatus.CS_NOCLOUD) {
page.actions.right = null
page.title = qsTr("Cloud credentials")
} else if (prefs.credentialStatus === CloudStatus.CS_VERIFIED ||
prefs.credentialStatus === CloudStatus.CS_NOCLOUD) {
page.actions.main = page.downloadFromDCAction page.actions.main = page.downloadFromDCAction
page.actions.right = page.addDiveAction page.actions.right = page.addDiveAction
page.title = qsTr("Dive list") page.title = qsTr("Dive list")
@ -348,7 +344,7 @@ Kirigami.ScrollablePage {
} else { } else {
page.actions.main = null page.actions.main = null
page.actions.right = null page.actions.right = null
page.title = qsTr("Dive list") page.title = qsTr("Cloud credentials")
} }
} }
onVisibleChanged: { onVisibleChanged: {