feature: added page for export api native configs

This commit is contained in:
vladimir.kuznetsov 2025-02-07 22:22:14 +07:00
parent 389c1f5327
commit 42d3d9b98a
30 changed files with 461 additions and 129 deletions

View file

@ -112,11 +112,13 @@ ListView {
ServersModel.processedIndex = index
if (ServersModel.getProcessedServerData("isServerFromGatewayApi")) {
ApiSettingsController.getAccountInfo()
if (ServersModel.getProcessedServerData("isCountrySelectionAvailable")) {
PageController.goToPage(PageEnum.PageSettingsApiAvailableCountries)
} else {
PageController.showBusyIndicator(true)
ApiSettingsController.getAccountInfo()
PageController.showBusyIndicator(false)
PageController.goToPage(PageEnum.PageSettingsApiServerInfo)
}
} else {

View file

@ -299,11 +299,13 @@ PageType {
ServersModel.processedIndex = ServersModel.defaultIndex
if (ServersModel.getProcessedServerData("isServerFromGatewayApi")) {
ApiSettingsController.getAccountInfo()
if (ServersModel.getProcessedServerData("isCountrySelectionAvailable")) {
PageController.goToPage(PageEnum.PageSettingsApiAvailableCountries)
} else {
PageController.showBusyIndicator(true)
ApiSettingsController.getAccountInfo()
PageController.showBusyIndicator(false)
PageController.goToPage(PageEnum.PageSettingsApiServerInfo)
}
} else {

View file

@ -92,6 +92,10 @@ PageType {
descriptionText: ApiServicesModel.getSelectedServiceData("serviceDescription")
actionButtonFunction: function() {
PageController.showBusyIndicator(true)
ApiSettingsController.getAccountInfo()
PageController.showBusyIndicator(false)
PageController.goToPage(PageEnum.PageSettingsApiServerInfo)
}
}

View file

@ -20,31 +20,67 @@ PageType {
id: windows
readonly property string title: qsTr("Windows")
readonly property string imageSource: "qrc:/images/controls/external-link.svg"
readonly property var handler: function() {
Qt.openUrlExternally(LanguageModel.getCurrentSiteUrl())
}
readonly property string link: qsTr("")
}
QtObject {
id: macos
readonly property string title: qsTr("macOS")
readonly property string link: qsTr("")
}
QtObject {
id: android
readonly property string title: qsTr("Android")
readonly property string link: qsTr("")
}
QtObject {
id: androidTv
readonly property string title: qsTr("AndroidTV")
readonly property string link: qsTr("")
}
QtObject {
id: ios
readonly property string title: qsTr("iOS")
readonly property string link: qsTr("")
}
QtObject {
id: linux
readonly property string title: qsTr("Windows")
readonly property string imageSource: "qrc:/images/controls/external-link.svg"
readonly property var handler: function() {
Qt.openUrlExternally(LanguageModel.getCurrentSiteUrl())
}
readonly property string title: qsTr("Linux")
readonly property string link: qsTr("")
}
QtObject {
id: routers
readonly property string title: qsTr("Routers")
readonly property string link: qsTr("")
}
property list<QtObject> instructionsModel: [
windows,
linux
macos,
android,
androidTv,
ios,
linux,
routers
]
ListViewType {
id: listView
anchors.fill: parent
anchors.topMargin: 20
anchors.bottomMargin: 24
model: instructionsModel
@ -62,8 +98,8 @@ PageType {
Layout.rightMargin: 16
Layout.leftMargin: 16
headerText: "Support"
descriptionText: qsTr("Our technical support specialists are ready to help you at any time")
headerText: qsTr("How to connect on another device")
descriptionText: qsTr("Instructions on the Amnezia website")
}
}
@ -76,9 +112,11 @@ PageType {
Layout.topMargin: 6
text: title
leftImageSource: imageSource
rightImageSource: "qrc:/images/controls/external-link.svg"
clickedFunction: handler
clickedFunction: function() {
Qt.openUrlExternally(link)
}
}
DividerType {}

View file

@ -0,0 +1,87 @@
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import QtQuick.Dialogs
import QtCore
import SortFilterProxyModel 0.2
import PageEnum 1.0
import Style 1.0
import "./"
import "../Controls2"
import "../Controls2/TextTypes"
import "../Config"
import "../Components"
PageType {
id: root
property string configExtension: ".conf"
property string configCaption: qsTr("Save AmneziaVPN config")
ListViewType {
id: listView
anchors.fill: parent
anchors.topMargin: 20
anchors.bottomMargin: 24
model: ApiCountryModel
header: ColumnLayout {
width: listView.width
BackButtonType {
id: backButton
}
HeaderType {
id: header
Layout.fillWidth: true
Layout.rightMargin: 16
Layout.leftMargin: 16
headerText: qsTr("Configuration files")
descriptionText: qsTr("To connect a router or AmneziaWG application")
}
}
delegate: ColumnLayout {
width: listView.width
LabelWithButtonType {
id: telegramButton
Layout.fillWidth: true
Layout.topMargin: 6
text: countryName
leftImageSource: "qrc:/countriesFlags/images/flagKit/" + countryImageCode + ".svg"
rightImageSource: "qrc:/images/controls/download.svg"
clickedFunction: function() {
var fileName = ""
if (GC.isMobile()) {
fileName = countryCode + configExtension
} else {
fileName = SystemController.getFileName(configCaption,
qsTr("Config files (*" + configExtension + ")"),
StandardPaths.standardLocations(StandardPaths.DocumentsLocation) + "/" + countryCode,
true,
configExtension)
}
if (fileName !== "") {
PageController.showBusyIndicator(true)
ApiConfigsController.exportNativeConfig(countryCode, fileName)
PageController.showBusyIndicator(false)
}
}
}
DividerType {}
}
}
}

View file

@ -105,7 +105,7 @@ PageType {
actionButtonImage: "qrc:/images/controls/edit-3.svg"
headerText: root.processedServer.name
descriptionText: ApiServicesModel.getSelectedServiceData("serviceDescription")
descriptionText: ApiAccountInfoModel.data("serviceDescription")
actionButtonFunction: function() {
serverNameEditDrawer.openTriggered()
@ -145,6 +145,8 @@ PageType {
spacing: 0
LabelWithButtonType {
id: vpnKey
Layout.fillWidth: true
Layout.topMargin: 32
@ -157,17 +159,22 @@ PageType {
}
}
DividerType {}
DividerType {
visible: false
}
LabelWithButtonType {
Layout.fillWidth: true
Layout.topMargin: vpnKey.visible ? 0 : 32
text: qsTr("Configuration files")
descriptionText: qsTr("To connect the router")
descriptionText: qsTr("To connect a router or AmneziaWG application")
rightImageSource: "qrc:/images/controls/chevron-right.svg"
clickedFunction: function() {
ApiSettingsController.updateApiCountryModel()
PageController.goToPage(PageEnum.PageSettingsApiNativeConfigs)
}
}

View file

@ -37,7 +37,7 @@ PageType {
Layout.rightMargin: 16
Layout.leftMargin: 16
headerText: "Support"
headerText: qsTr("Support")
descriptionText: qsTr("Our technical support specialists are ready to help you at any time")
}

View file

@ -95,7 +95,9 @@ PageType {
ServersModel.processedIndex = index
if (ServersModel.getProcessedServerData("isServerFromGatewayApi")) {
PageController.showBusyIndicator(true)
ApiSettingsController.getAccountInfo()
PageController.showBusyIndicator(false)
PageController.goToPage(PageEnum.PageSettingsApiServerInfo)
} else {