feature: retrieving support info from gateway (#1483)
* feature: retrieving support info from gateway * feature: added "external-premium" service-type * chore: fixed external premium visability
This commit is contained in:
parent
68db721089
commit
7fd71a8408
8 changed files with 67 additions and 21 deletions
|
|
@ -310,7 +310,7 @@ bool ApiConfigsController::deactivateDevice()
|
|||
auto serverConfigObject = m_serversModel->getServerConfig(serverIndex);
|
||||
auto apiConfigObject = serverConfigObject.value(configKey::apiConfig).toObject();
|
||||
|
||||
if (apiUtils::getConfigType(serverConfigObject) != apiDefs::ConfigType::AmneziaPremiumV2) {
|
||||
if (!apiUtils::isPremiumServer(serverConfigObject)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -345,7 +345,7 @@ bool ApiConfigsController::deactivateExternalDevice(const QString &uuid, const Q
|
|||
auto serverConfigObject = m_serversModel->getServerConfig(serverIndex);
|
||||
auto apiConfigObject = serverConfigObject.value(configKey::apiConfig).toObject();
|
||||
|
||||
if (apiUtils::getConfigType(serverConfigObject) != apiDefs::ConfigType::AmneziaPremiumV2) {
|
||||
if (!apiUtils::isPremiumServer(serverConfigObject)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ bool ApiSettingsController::getAccountInfo(bool reload)
|
|||
|
||||
QByteArray responseBody;
|
||||
|
||||
if (apiUtils::getConfigType(serverConfig) == apiDefs::ConfigType::AmneziaPremiumV2) {
|
||||
if (apiUtils::isPremiumServer(serverConfig)) {
|
||||
ErrorCode errorCode = gatewayController.post(QString("%1v1/account_info"), apiPayload, responseBody);
|
||||
if (errorCode != ErrorCode::NoError) {
|
||||
emit errorOccurred(errorCode);
|
||||
|
|
|
|||
|
|
@ -48,15 +48,19 @@ QVariant ApiAccountInfoModel::data(const QModelIndex &index, int role) const
|
|||
}
|
||||
case ServiceDescriptionRole: {
|
||||
if (m_accountInfoData.configType == apiDefs::ConfigType::AmneziaPremiumV2) {
|
||||
return tr("Classic VPN for seamless work, downloading large files, and watching videos. Access all websites and online resources. "
|
||||
return tr("Classic VPN for seamless work, downloading large files, and watching videos. Access all websites and online "
|
||||
"resources. "
|
||||
"Speeds up to 200 Mbps");
|
||||
} else if (m_accountInfoData.configType == apiDefs::ConfigType::AmneziaFreeV3) {
|
||||
return tr("Free unlimited access to a basic set of websites such as Facebook, Instagram, Twitter (X), Discord, Telegram and "
|
||||
"more. YouTube is not included in the free plan.");
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
case IsComponentVisibleRole: {
|
||||
return m_accountInfoData.configType == apiDefs::ConfigType::AmneziaPremiumV2;
|
||||
return m_accountInfoData.configType == apiDefs::ConfigType::AmneziaPremiumV2
|
||||
|| m_accountInfoData.configType == apiDefs::ConfigType::ExternalPremium;
|
||||
}
|
||||
case HasExpiredWorkerRole: {
|
||||
for (int i = 0; i < m_issuedConfigsInfo.size(); i++) {
|
||||
|
|
@ -93,6 +97,8 @@ void ApiAccountInfoModel::updateModel(const QJsonObject &accountInfoObject, cons
|
|||
|
||||
m_accountInfoData = accountInfoData;
|
||||
|
||||
m_supportInfo = accountInfoObject.value(apiDefs::key::supportInfo).toObject();
|
||||
|
||||
endResetModel();
|
||||
}
|
||||
|
||||
|
|
@ -121,12 +127,27 @@ QJsonArray ApiAccountInfoModel::getIssuedConfigsInfo()
|
|||
|
||||
QString ApiAccountInfoModel::getTelegramBotLink()
|
||||
{
|
||||
if (m_accountInfoData.configType == apiDefs::ConfigType::AmneziaFreeV3) {
|
||||
return tr("amnezia_free_support_bot");
|
||||
} else if (m_accountInfoData.configType == apiDefs::ConfigType::AmneziaPremiumV2) {
|
||||
return tr("amnezia_premium_support_bot");
|
||||
}
|
||||
return "";
|
||||
return m_supportInfo.value(apiDefs::key::telegram).toString();
|
||||
}
|
||||
|
||||
QString ApiAccountInfoModel::getEmailLink()
|
||||
{
|
||||
return m_supportInfo.value(apiDefs::key::email).toString();
|
||||
}
|
||||
|
||||
QString ApiAccountInfoModel::getBillingEmailLink()
|
||||
{
|
||||
return m_supportInfo.value(apiDefs::key::billingEmail).toString();
|
||||
}
|
||||
|
||||
QString ApiAccountInfoModel::getSiteLink()
|
||||
{
|
||||
return m_supportInfo.value(apiDefs::key::websiteName).toString();
|
||||
}
|
||||
|
||||
QString ApiAccountInfoModel::getFullSiteLink()
|
||||
{
|
||||
return m_supportInfo.value(apiDefs::key::website).toString();
|
||||
}
|
||||
|
||||
QHash<int, QByteArray> ApiAccountInfoModel::roleNames() const
|
||||
|
|
|
|||
|
|
@ -33,7 +33,12 @@ public slots:
|
|||
|
||||
QJsonArray getAvailableCountries();
|
||||
QJsonArray getIssuedConfigsInfo();
|
||||
|
||||
QString getTelegramBotLink();
|
||||
QString getEmailLink();
|
||||
QString getBillingEmailLink();
|
||||
QString getSiteLink();
|
||||
QString getFullSiteLink();
|
||||
|
||||
protected:
|
||||
QHash<int, QByteArray> roleNames() const override;
|
||||
|
|
@ -51,6 +56,7 @@ private:
|
|||
AccountInfoData m_accountInfoData;
|
||||
QJsonArray m_availableCountries;
|
||||
QJsonArray m_issuedConfigsInfo;
|
||||
QJsonObject m_supportInfo;
|
||||
};
|
||||
|
||||
#endif // APIACCOUNTINFOMODEL_H
|
||||
|
|
|
|||
|
|
@ -28,24 +28,24 @@ PageType {
|
|||
id: techSupport
|
||||
|
||||
readonly property string title: qsTr("Email")
|
||||
readonly property string description: qsTr("support@amnezia.org")
|
||||
readonly property string link: "mailto:support@amnezia.org"
|
||||
readonly property string description: ApiAccountInfoModel.getEmailLink()
|
||||
readonly property string link: "mailto:" + ApiAccountInfoModel.getEmailLink()
|
||||
}
|
||||
|
||||
QtObject {
|
||||
id: paymentSupport
|
||||
|
||||
readonly property string title: qsTr("Email Billing & Orders")
|
||||
readonly property string description: qsTr("help@vpnpay.io")
|
||||
readonly property string link: "mailto:help@vpnpay.io"
|
||||
readonly property string description: ApiAccountInfoModel.getBillingEmailLink()
|
||||
readonly property string link: "mailto:" + ApiAccountInfoModel.getBillingEmailLink()
|
||||
}
|
||||
|
||||
QtObject {
|
||||
id: site
|
||||
|
||||
readonly property string title: qsTr("Website")
|
||||
readonly property string description: qsTr("amnezia.org")
|
||||
readonly property string link: LanguageModel.getCurrentSiteUrl()
|
||||
readonly property string description: ApiAccountInfoModel.getSiteLink()
|
||||
readonly property string link: ApiAccountInfoModel.getFullSiteLink()
|
||||
}
|
||||
|
||||
property list<QtObject> supportModel: [
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue