feature: add country selection page (#5)
* Add country selection page for premium * Add countryCode property * Fix country visibility logic * Add premium settings * Fix binding loop * Add settings page * Add logging settings page * Add confirmation dialog for server removing * Fix flag size * Fix flags sizes * chore: added translation files --------- Co-authored-by: vladimir.kuznetsov <nethiuswork@gmail.com>
This commit is contained in:
parent
e12e9a6587
commit
ffb398e231
21 changed files with 7692 additions and 2946 deletions
179
client/ui/qml/DefaultVpn/Pages/PageSettingsApiServerInfo.qml
Normal file
179
client/ui/qml/DefaultVpn/Pages/PageSettingsApiServerInfo.qml
Normal file
|
|
@ -0,0 +1,179 @@
|
|||
pragma ComponentBehavior: Bound
|
||||
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Layouts
|
||||
|
||||
import PageEnum 1.0
|
||||
import Config 1.0
|
||||
|
||||
import "../Components"
|
||||
import "../Controls"
|
||||
import "../Controls/TextTypes"
|
||||
|
||||
Page {
|
||||
id: root
|
||||
|
||||
Component.onCompleted: checkSubscriptionStatus()
|
||||
|
||||
// This timer is used to delay the opening of the expired subscription dialog
|
||||
// to avoid conflicts of blur effect with transition to the page animation
|
||||
Timer {
|
||||
id: subscriptionDialogTimer
|
||||
interval: 280
|
||||
repeat: false
|
||||
onTriggered: expiredSubscriptionDialog.open()
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: ApiAccountInfoModel
|
||||
function onModelReset() {
|
||||
checkSubscriptionStatus()
|
||||
}
|
||||
}
|
||||
|
||||
function checkSubscriptionStatus() {
|
||||
const status = ApiAccountInfoModel.data("subscriptionStatus")
|
||||
if (status === "expired") {
|
||||
subscriptionDialogTimer.start()
|
||||
}
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
anchors.fill: parent
|
||||
spacing: 0
|
||||
anchors.leftMargin: 8
|
||||
anchors.rightMargin: 8
|
||||
|
||||
RowLayout {
|
||||
Layout.topMargin: 8
|
||||
|
||||
WhiteButtonNoBorder {
|
||||
id: backButton
|
||||
imageSource: "qrc:/images/controls/arrow-left.svg"
|
||||
|
||||
onClicked: PageController.closePage()
|
||||
}
|
||||
|
||||
Item {
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
Layout.fillWidth: true
|
||||
Layout.leftMargin: 8
|
||||
Layout.rightMargin: 8
|
||||
Layout.topMargin: 8
|
||||
spacing: 0
|
||||
|
||||
Header1TextType {
|
||||
id: header
|
||||
|
||||
Layout.fillWidth: true
|
||||
|
||||
text: qsTr("Amnezia Premium settings")
|
||||
|
||||
horizontalAlignment: Qt.AlignLeft
|
||||
verticalAlignment: Qt.AlignVCenter
|
||||
}
|
||||
|
||||
XSmallTextType {
|
||||
Layout.topMargin: 24
|
||||
Layout.fillWidth: true
|
||||
|
||||
text: qsTr("Subscription expires on")
|
||||
color: Style.color.black
|
||||
}
|
||||
|
||||
MediumTextType {
|
||||
Layout.topMargin: 6
|
||||
Layout.fillWidth: true
|
||||
|
||||
text: ApiAccountInfoModel.data("endDate")
|
||||
color: Style.color.black
|
||||
}
|
||||
|
||||
WhiteButtonWithBorder {
|
||||
Layout.topMargin: 24
|
||||
Layout.fillWidth: true
|
||||
|
||||
text: qsTr("Reset API configuration")
|
||||
|
||||
onClicked: {
|
||||
if (ServersModel.isDefaultServerCurrentlyProcessed() && ConnectionController.isConnected) {
|
||||
PageController.showNotificationMessage(qsTr("Cannot reload API config during active connection"))
|
||||
} else {
|
||||
resetConfirmationDialog.open()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
WhiteButtonWithBorder {
|
||||
Layout.topMargin: 56
|
||||
Layout.fillWidth: true
|
||||
|
||||
text: qsTr("Delete")
|
||||
defaultTextColor: Style.color.error
|
||||
hoveredTextColor: Style.color.error
|
||||
pressedTextColor: Style.color.error
|
||||
|
||||
onClicked: {
|
||||
if (ServersModel.isDefaultServerCurrentlyProcessed() && ConnectionController.isConnected) {
|
||||
PageController.showNotificationMessage(qsTr("Cannot remove server during active connection"))
|
||||
} else {
|
||||
deleteConfirmationDialog.open()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
Layout.fillHeight: true
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
}
|
||||
|
||||
ConfirmationDialog {
|
||||
id: resetConfirmationDialog
|
||||
title: qsTr("Reset API configuration?")
|
||||
description: qsTr("This will reload the API configuration from the server")
|
||||
confirmButtonText: qsTr("Reset")
|
||||
cancelButtonText: qsTr("Cancel")
|
||||
|
||||
onConfirm: function() {
|
||||
PageController.showBusyIndicator(true)
|
||||
ApiConfigsController.updateServiceFromGateway(ServersModel.processedIndex, "", "", true)
|
||||
PageController.showBusyIndicator(false)
|
||||
}
|
||||
}
|
||||
|
||||
ConfirmationDialog {
|
||||
id: deleteConfirmationDialog
|
||||
title: qsTr("Are you sure you want to remove the server from the app?")
|
||||
description: qsTr("You won't be able to connect to it")
|
||||
confirmButtonText: qsTr("Yes, delete anyway")
|
||||
cancelButtonText: qsTr("No, keep it")
|
||||
|
||||
onConfirm: function() {
|
||||
PageController.showBusyIndicator(true)
|
||||
if (ApiConfigsController.deactivateDevice()) {
|
||||
InstallController.removeProcessedServer()
|
||||
PageController.closePage()
|
||||
}
|
||||
PageController.showBusyIndicator(false)
|
||||
}
|
||||
}
|
||||
|
||||
ConfirmationDialog {
|
||||
id: expiredSubscriptionDialog
|
||||
title: qsTr("Amnezia Premium subscription has expired")
|
||||
description: qsTr("Order a new subscription")
|
||||
confirmButtonText: qsTr("Go to order")
|
||||
cancelButtonText: qsTr("Close")
|
||||
|
||||
onConfirm: function() {
|
||||
Qt.openUrlExternally("https://storage.googleapis.com/kldscp/vpnpay.io/ru/amnezia-premium")
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue