feature: added pages for subscription settings feature
This commit is contained in:
parent
3f55f6a629
commit
b183a3b232
27 changed files with 856 additions and 287 deletions
|
|
@ -8,8 +8,8 @@
|
|||
#include "amnezia_application.h"
|
||||
#include "configurators/wireguard_configurator.h"
|
||||
#include "core/enums/apiEnums.h"
|
||||
#include "version.h"
|
||||
#include "gatewayController.h"
|
||||
#include "version.h"
|
||||
|
||||
namespace
|
||||
{
|
||||
|
|
@ -213,10 +213,29 @@ void ApiController::updateServerConfigFromApi(const QString &installationUuid, c
|
|||
}
|
||||
}
|
||||
|
||||
ErrorCode ApiController::getAccountInfo(const QString &userCountryCode, const QString &serviceType, const QJsonObject &authData,
|
||||
QByteArray &responseBody)
|
||||
{
|
||||
GatewayController gatewayController(m_gatewayEndpoint, m_isDevEnvironment, requestTimeoutMsecs);
|
||||
|
||||
QJsonObject apiPayload;
|
||||
apiPayload[configKey::userCountryCode] = userCountryCode;
|
||||
apiPayload[configKey::serviceType] = serviceType;
|
||||
apiPayload[configKey::authData] = authData;
|
||||
|
||||
ErrorCode errorCode = gatewayController.post(QString("%1v1/account_info"), apiPayload, responseBody);
|
||||
|
||||
return errorCode;
|
||||
}
|
||||
|
||||
ErrorCode ApiController::getServicesList(QByteArray &responseBody)
|
||||
{
|
||||
GatewayController gatewayController(m_gatewayEndpoint, m_isDevEnvironment, requestTimeoutMsecs);
|
||||
ErrorCode errorCode = gatewayController.get("%1v1/services", responseBody);
|
||||
|
||||
QJsonObject apiPayload;
|
||||
apiPayload[configKey::osVersion] = QSysInfo::productType();
|
||||
|
||||
ErrorCode errorCode = gatewayController.post(QString("%1v1/services"), apiPayload, responseBody);
|
||||
if (errorCode == ErrorCode::NoError) {
|
||||
if (!responseBody.contains("services")) {
|
||||
return ErrorCode::ApiServicesMissingError;
|
||||
|
|
@ -254,3 +273,24 @@ ErrorCode ApiController::getConfigForService(const QString &installationUuid, co
|
|||
|
||||
return errorCode;
|
||||
}
|
||||
|
||||
ErrorCode ApiController::getNativeConfig(const QString &userCountryCode, const QString &serviceType, const QString &protocol,
|
||||
const QString &serverCountryCode, const QJsonObject &authData, QString &nativeConfig)
|
||||
{
|
||||
GatewayController gatewayController(m_gatewayEndpoint, m_isDevEnvironment, requestTimeoutMsecs);
|
||||
|
||||
ApiPayloadData apiPayloadData = generateApiPayloadData(protocol);
|
||||
|
||||
QJsonObject apiPayload = fillApiPayload(protocol, apiPayloadData);
|
||||
apiPayload[configKey::userCountryCode] = userCountryCode;
|
||||
apiPayload[configKey::serverCountryCode] = serverCountryCode;
|
||||
apiPayload[configKey::serviceType] = serviceType;
|
||||
apiPayload[configKey::authData] = authData;
|
||||
|
||||
QByteArray responseBody;
|
||||
ErrorCode errorCode = gatewayController.post(QString("%1v1/country_config"), apiPayload, responseBody);
|
||||
|
||||
nativeConfig = responseBody;
|
||||
|
||||
return errorCode;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,9 +19,14 @@ public:
|
|||
public slots:
|
||||
void updateServerConfigFromApi(const QString &installationUuid, const int serverIndex, QJsonObject serverConfig);
|
||||
|
||||
ErrorCode getAccountInfo(const QString &userCountryCode, const QString &serviceType, const QJsonObject &authData,
|
||||
QByteArray &responseBody);
|
||||
ErrorCode getServicesList(QByteArray &responseBody);
|
||||
ErrorCode getConfigForService(const QString &installationUuid, const QString &userCountryCode, const QString &serviceType,
|
||||
const QString &protocol, const QString &serverCountryCode, const QJsonObject &authData, QJsonObject &serverConfig);
|
||||
const QString &protocol, const QString &serverCountryCode, const QJsonObject &authData,
|
||||
QJsonObject &serverConfig);
|
||||
ErrorCode getNativeConfig(const QString &userCountryCode, const QString &serviceType, const QString &protocol,
|
||||
const QString &serverCountryCode, const QJsonObject &authData, QString &nativeConfig);
|
||||
|
||||
signals:
|
||||
void errorOccurred(ErrorCode errorCode);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue