feature: added issued configs info parsing
This commit is contained in:
parent
eda24765e7
commit
c2b17c128d
6 changed files with 87 additions and 28 deletions
|
@ -8,14 +8,6 @@
|
|||
namespace
|
||||
{
|
||||
Logger logger("AccountInfoModel");
|
||||
|
||||
namespace configKey
|
||||
{
|
||||
constexpr char availableCountries[] = "available_countries";
|
||||
constexpr char activeDeviceCount[] = "active_device_count";
|
||||
constexpr char maxDeviceCount[] = "max_device_count";
|
||||
constexpr char subscriptionEndDate[] = "subscription_end_date";
|
||||
}
|
||||
}
|
||||
|
||||
ApiAccountInfoModel::ApiAccountInfoModel(QObject *parent) : QAbstractListModel(parent)
|
||||
|
@ -77,11 +69,12 @@ void ApiAccountInfoModel::updateModel(const QJsonObject &accountInfoObject, cons
|
|||
|
||||
AccountInfoData accountInfoData;
|
||||
|
||||
m_availableCountries = accountInfoObject.value(configKey::availableCountries).toArray();
|
||||
m_availableCountries = accountInfoObject.value(apiDefs::key::availableCountries).toArray();
|
||||
m_issuedConfigsInfo = accountInfoObject.value(apiDefs::key::issuedConfigs).toArray();
|
||||
|
||||
accountInfoData.activeDeviceCount = accountInfoObject.value(configKey::activeDeviceCount).toInt();
|
||||
accountInfoData.maxDeviceCount = accountInfoObject.value(configKey::maxDeviceCount).toInt();
|
||||
accountInfoData.subscriptionEndDate = accountInfoObject.value(configKey::subscriptionEndDate).toString();
|
||||
accountInfoData.activeDeviceCount = accountInfoObject.value(apiDefs::key::activeDeviceCount).toInt();
|
||||
accountInfoData.maxDeviceCount = accountInfoObject.value(apiDefs::key::maxDeviceCount).toInt();
|
||||
accountInfoData.subscriptionEndDate = accountInfoObject.value(apiDefs::key::subscriptionEndDate).toString();
|
||||
|
||||
accountInfoData.configType = apiUtils::getConfigType(serverConfig);
|
||||
|
||||
|
@ -108,6 +101,11 @@ QJsonArray ApiAccountInfoModel::getAvailableCountries()
|
|||
return m_availableCountries;
|
||||
}
|
||||
|
||||
QJsonArray ApiAccountInfoModel::getIssuedConfigsInfo()
|
||||
{
|
||||
return m_issuedConfigsInfo;
|
||||
}
|
||||
|
||||
QString ApiAccountInfoModel::getTelegramBotLink()
|
||||
{
|
||||
if (m_accountInfoData.configType == apiDefs::ConfigType::AmneziaFreeV3) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue