mobile: add ability to delete cloud account

Apple store rules require this.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2022-08-07 17:11:05 -07:00
parent 941aaf5b65
commit 32bc034f41
9 changed files with 159 additions and 0 deletions

View file

@ -0,0 +1,75 @@
// SPDX-License-Identifier: GPL-2.0
import QtQuick 2.6
import QtQuick.Layouts 1.2
import org.kde.kirigami 2.4 as Kirigami
import org.subsurfacedivelog.mobile 1.0
Kirigami.ScrollablePage {
id: deleteAccountPage
property int pageWidth: deleteAccountPage.width - deleteAccountPage.leftPadding - deleteAccountPage.rightPadding
title: qsTr("Delete Subsurface Cloud Account")
background: Rectangle { color: subsurfaceTheme.backgroundColor }
ColumnLayout {
spacing: Kirigami.Units.largeSpacing
width: deleteAccountPage.width
Layout.margins: Kirigami.Units.gridUnit / 2
Kirigami.Heading {
text: qsTr("Delete Subsurface Cloud Account")
color: subsurfaceTheme.textColor
Layout.topMargin: Kirigami.Units.gridUnit
Layout.alignment: Qt.AlignHCenter
Layout.maximumWidth: pageWidth
wrapMode: TextEdit.NoWrap
fontSizeMode: Text.Fit
}
Kirigami.Heading {
text: qsTr("Deleting your Subsurface Cloud account is permanent.\n") +
qsTr("There is no way to undo this action.")
level: 4
color: subsurfaceTheme.textColor
Layout.alignment: Qt.AlignHCenter
Layout.topMargin: Kirigami.Units.largeSpacing * 3
Layout.maximumWidth: pageWidth
wrapMode: TextEdit.WrapAtWordBoundaryOrAnywhere
anchors.horizontalCenter: parent.Center
horizontalAlignment: Text.AlignHCenter
}
Kirigami.Heading {
text: PrefCloudStorage.cloud_storage_email
level: 4
color: subsurfaceTheme.textColor
Layout.alignment: Qt.AlignHCenter
Layout.topMargin: Kirigami.Units.largeSpacing * 3
Layout.maximumWidth: pageWidth
wrapMode: TextEdit.WrapAtWordBoundaryOrAnywhere
anchors.horizontalCenter: parent.Center
horizontalAlignment: Text.AlignHCenter
}
TemplateButton {
id: deleteCloudAccount
Layout.alignment: Qt.AlignHCenter
text: qsTr("delete cloud account")
onClicked: {
manager.appendTextToLog("request to delete account confirmed")
manager.deleteAccount()
rootItem.returnTopPage()
}
}
TemplateButton {
id: dontDeleteCloudAccount
Layout.alignment: Qt.AlignHCenter
text: qsTr("never mind")
onClicked: {
manager.appendTextToLog("request to delete account cancelled")
rootItem.returnTopPage()
}
}
}
}

View file

@ -61,6 +61,15 @@ TemplatePage {
text: describe[Backend.cloud_verification_status]
Layout.preferredHeight: Kirigami.Units.gridUnit * 1.5
}
TemplateButton {
id: deleteCloudAccount
enabled: Backend.cloud_verification_status !== Enums.CS_NOCLOUD
text: qsTr("Delete Account")
onClicked: {
manager.appendTextToLog("requesting account deletion");
showPage(deleteAccount)
}
}
}
TemplateLine {
visible: sectionGeneral.isExpanded

View file

@ -783,6 +783,10 @@ if you have network connectivity and want to sync your data to cloud storage."),
id: settingsWindow
}
DeleteAccount {
id: deleteAccount
}
CopySettings {
id: settingsCopyWindow
visible: false

View file

@ -19,6 +19,7 @@
<!-- ********** qml ********** -->
<file>About.qml</file>
<file>CloudCredentials.qml</file>
<file>DeleteAccount.qml</file>
<file>DiveDetails.qml</file>
<file>DiveDetailsEdit.qml</file>
<file>DiveDetailsView.qml</file>