feature: added error handling and minor ui fixes

This commit is contained in:
vladimir.kuznetsov 2025-02-10 15:10:59 +07:00
parent 42d3d9b98a
commit 07baf0ed65
16 changed files with 101 additions and 53 deletions

View file

@ -116,8 +116,11 @@ ListView {
PageController.goToPage(PageEnum.PageSettingsApiAvailableCountries)
} else {
PageController.showBusyIndicator(true)
ApiSettingsController.getAccountInfo()
let result = ApiSettingsController.getAccountInfo()
PageController.showBusyIndicator(false)
if (!result) {
return
}
PageController.goToPage(PageEnum.PageSettingsApiServerInfo)
}

View file

@ -303,8 +303,11 @@ PageType {
PageController.goToPage(PageEnum.PageSettingsApiAvailableCountries)
} else {
PageController.showBusyIndicator(true)
ApiSettingsController.getAccountInfo()
let result = ApiSettingsController.getAccountInfo()
PageController.showBusyIndicator(false)
if (!result) {
return
}
PageController.goToPage(PageEnum.PageSettingsApiServerInfo)
}

View file

@ -89,12 +89,15 @@ PageType {
actionButtonImage: "qrc:/images/controls/settings.svg"
headerText: root.processedServer.name
descriptionText: ApiServicesModel.getSelectedServiceData("serviceDescription")
descriptionText: qsTr("Locations for connection")
actionButtonFunction: function() {
PageController.showBusyIndicator(true)
ApiSettingsController.getAccountInfo()
let result = ApiSettingsController.getAccountInfo()
PageController.showBusyIndicator(false)
if (!result) {
return
}
PageController.goToPage(PageEnum.PageSettingsApiServerInfo)
}

View file

@ -75,8 +75,12 @@ PageType {
}
if (fileName !== "") {
PageController.showBusyIndicator(true)
ApiConfigsController.exportNativeConfig(countryCode, fileName)
let result = ApiConfigsController.exportNativeConfig(countryCode, fileName)
PageController.showBusyIndicator(false)
if (result) {
PageController.showNotificationMessage(qsTr("Config file saved"))
}
}
}
}

View file

@ -141,16 +141,20 @@ PageType {
}
footer: ColumnLayout {
id: footer
width: listView.width
spacing: 0
readonly property bool isVisibleForAmneziaFree: ApiAccountInfoModel.data("isComponentVisible")
LabelWithButtonType {
id: vpnKey
Layout.fillWidth: true
Layout.topMargin: 32
visible: false
visible: footer.isVisibleForAmneziaFree
text: qsTr("Subscription key")
rightImageSource: "qrc:/images/controls/chevron-right.svg"
@ -160,12 +164,13 @@ PageType {
}
DividerType {
visible: false
visible: footer.isVisibleForAmneziaFree
}
LabelWithButtonType {
Layout.fillWidth: true
Layout.topMargin: vpnKey.visible ? 0 : 32
visible: footer.isVisibleForAmneziaFree
text: qsTr("Configuration files")
@ -178,10 +183,13 @@ PageType {
}
}
DividerType {}
DividerType {
visible: footer.isVisibleForAmneziaFree
}
LabelWithButtonType {
Layout.fillWidth: true
Layout.topMargin: footer.isVisibleForAmneziaFree ? 0 : 32
text: qsTr("Support")
rightImageSource: "qrc:/images/controls/chevron-right.svg"

View file

@ -44,12 +44,14 @@ PageType {
LabelWithButtonType {
Layout.fillWidth: true
readonly property string telegramBotLink: ApiAccountInfoModel.getTelegramBotLink()
text: qsTr("Telegram")
descriptionText: qsTr("@amnezia_premium_support_bot")
descriptionText: "@" + telegramBotLink
rightImageSource: "qrc:/images/controls/external-link.svg"
clickedFunction: function() {
Qt.openUrlExternally(qsTr("https://t.me/amnezia_premium_support_bot"))
Qt.openUrlExternally("https://t.me/" + telegramBotLink)
}
}

View file

@ -96,8 +96,11 @@ PageType {
if (ServersModel.getProcessedServerData("isServerFromGatewayApi")) {
PageController.showBusyIndicator(true)
ApiSettingsController.getAccountInfo()
let result = ApiSettingsController.getAccountInfo()
PageController.showBusyIndicator(false)
if (!result) {
return
}
PageController.goToPage(PageEnum.PageSettingsApiServerInfo)
} else {

View file

@ -224,6 +224,14 @@ PageType {
}
}
Connections {
target: ApiSettingsController
function onErrorOccurred(error) {
PageController.showErrorMessage(error)
}
}
StackViewType {
id: tabBarStackView
objectName: "tabBarStackView"