feature: retrieving support info from gateway
This commit is contained in:
parent
9fbea76b74
commit
0da108e809
4 changed files with 46 additions and 13 deletions
|
|
@ -10,7 +10,8 @@ namespace apiDefs
|
||||||
AmneziaFreeV3,
|
AmneziaFreeV3,
|
||||||
AmneziaPremiumV1,
|
AmneziaPremiumV1,
|
||||||
AmneziaPremiumV2,
|
AmneziaPremiumV2,
|
||||||
SelfHosted
|
SelfHosted,
|
||||||
|
ExternalV1
|
||||||
};
|
};
|
||||||
|
|
||||||
enum ConfigSource {
|
enum ConfigSource {
|
||||||
|
|
@ -43,6 +44,13 @@ namespace apiDefs
|
||||||
constexpr QLatin1String maxDeviceCount("max_device_count");
|
constexpr QLatin1String maxDeviceCount("max_device_count");
|
||||||
constexpr QLatin1String subscriptionEndDate("subscription_end_date");
|
constexpr QLatin1String subscriptionEndDate("subscription_end_date");
|
||||||
constexpr QLatin1String issuedConfigs("issued_configs");
|
constexpr QLatin1String issuedConfigs("issued_configs");
|
||||||
|
|
||||||
|
constexpr QLatin1String supportInfo("support_info");
|
||||||
|
constexpr QLatin1String email("email");
|
||||||
|
constexpr QLatin1String billingEmail("billing_email");
|
||||||
|
constexpr QLatin1String website("website");
|
||||||
|
constexpr QLatin1String websiteName("website_name");
|
||||||
|
constexpr QLatin1String telegram("telegram");
|
||||||
}
|
}
|
||||||
|
|
||||||
const int requestTimeoutMsecs = 12 * 1000; // 12 secs
|
const int requestTimeoutMsecs = 12 * 1000; // 12 secs
|
||||||
|
|
|
||||||
|
|
@ -53,6 +53,8 @@ QVariant ApiAccountInfoModel::data(const QModelIndex &index, int role) const
|
||||||
} else if (m_accountInfoData.configType == apiDefs::ConfigType::AmneziaFreeV3) {
|
} 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 "
|
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.");
|
"more. YouTube is not included in the free plan.");
|
||||||
|
} else {
|
||||||
|
return "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case IsComponentVisibleRole: {
|
case IsComponentVisibleRole: {
|
||||||
|
|
@ -93,6 +95,8 @@ void ApiAccountInfoModel::updateModel(const QJsonObject &accountInfoObject, cons
|
||||||
|
|
||||||
m_accountInfoData = accountInfoData;
|
m_accountInfoData = accountInfoData;
|
||||||
|
|
||||||
|
m_supportInfo = accountInfoObject.value(apiDefs::key::supportInfo).toObject();
|
||||||
|
|
||||||
endResetModel();
|
endResetModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -121,12 +125,27 @@ QJsonArray ApiAccountInfoModel::getIssuedConfigsInfo()
|
||||||
|
|
||||||
QString ApiAccountInfoModel::getTelegramBotLink()
|
QString ApiAccountInfoModel::getTelegramBotLink()
|
||||||
{
|
{
|
||||||
if (m_accountInfoData.configType == apiDefs::ConfigType::AmneziaFreeV3) {
|
return m_supportInfo.value(apiDefs::key::telegram).toString();
|
||||||
return tr("amnezia_free_support_bot");
|
|
||||||
} else if (m_accountInfoData.configType == apiDefs::ConfigType::AmneziaPremiumV2) {
|
|
||||||
return tr("amnezia_premium_support_bot");
|
|
||||||
}
|
}
|
||||||
return "";
|
|
||||||
|
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
|
QHash<int, QByteArray> ApiAccountInfoModel::roleNames() const
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,12 @@ public slots:
|
||||||
|
|
||||||
QJsonArray getAvailableCountries();
|
QJsonArray getAvailableCountries();
|
||||||
QJsonArray getIssuedConfigsInfo();
|
QJsonArray getIssuedConfigsInfo();
|
||||||
|
|
||||||
QString getTelegramBotLink();
|
QString getTelegramBotLink();
|
||||||
|
QString getEmailLink();
|
||||||
|
QString getBillingEmailLink();
|
||||||
|
QString getSiteLink();
|
||||||
|
QString getFullSiteLink();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QHash<int, QByteArray> roleNames() const override;
|
QHash<int, QByteArray> roleNames() const override;
|
||||||
|
|
@ -51,6 +56,7 @@ private:
|
||||||
AccountInfoData m_accountInfoData;
|
AccountInfoData m_accountInfoData;
|
||||||
QJsonArray m_availableCountries;
|
QJsonArray m_availableCountries;
|
||||||
QJsonArray m_issuedConfigsInfo;
|
QJsonArray m_issuedConfigsInfo;
|
||||||
|
QJsonObject m_supportInfo;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // APIACCOUNTINFOMODEL_H
|
#endif // APIACCOUNTINFOMODEL_H
|
||||||
|
|
|
||||||
|
|
@ -28,24 +28,24 @@ PageType {
|
||||||
id: techSupport
|
id: techSupport
|
||||||
|
|
||||||
readonly property string title: qsTr("Email")
|
readonly property string title: qsTr("Email")
|
||||||
readonly property string description: qsTr("support@amnezia.org")
|
readonly property string description: ApiAccountInfoModel.getEmailLink()
|
||||||
readonly property string link: "mailto:support@amnezia.org"
|
readonly property string link: "mailto:" + ApiAccountInfoModel.getEmailLink()
|
||||||
}
|
}
|
||||||
|
|
||||||
QtObject {
|
QtObject {
|
||||||
id: paymentSupport
|
id: paymentSupport
|
||||||
|
|
||||||
readonly property string title: qsTr("Email Billing & Orders")
|
readonly property string title: qsTr("Email Billing & Orders")
|
||||||
readonly property string description: qsTr("help@vpnpay.io")
|
readonly property string description: ApiAccountInfoModel.getBillingEmailLink()
|
||||||
readonly property string link: "mailto:help@vpnpay.io"
|
readonly property string link: "mailto:" + ApiAccountInfoModel.getBillingEmailLink()
|
||||||
}
|
}
|
||||||
|
|
||||||
QtObject {
|
QtObject {
|
||||||
id: site
|
id: site
|
||||||
|
|
||||||
readonly property string title: qsTr("Website")
|
readonly property string title: qsTr("Website")
|
||||||
readonly property string description: qsTr("amnezia.org")
|
readonly property string description: ApiAccountInfoModel.getSiteLink()
|
||||||
readonly property string link: LanguageModel.getCurrentSiteUrl()
|
readonly property string link: ApiAccountInfoModel.getFullSiteLink()
|
||||||
}
|
}
|
||||||
|
|
||||||
property list<QtObject> supportModel: [
|
property list<QtObject> supportModel: [
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue