mirror of
https://github.com/amnezia-vpn/DefaultVPN.git
synced 2026-05-17 08:36:37 +03:00
* feat: iap for apple now use storekit2 * fix: fixed error 101 on connection event * feat: enhance StoreKit2Helper to handle entitlements and improve restore service from App Store functionality * chore: add isInAppPurchase and isTestPurchase in primary config * refactor: use end_date from primary config for renew ui * fix: hide renew button for free * fix: hide renew button for appstore purchases * feat: add new premium info page * feat: add new free info page * chore: minor fixes * refactor: move plan and benefits into separate models * fix: fixed expired status when configs without an end date * feat: add trial api support * chore: add api message parsing for 422 error * feat: move privacy policy and term of use to gateway * feat: add iap support for new premium info page * chore: minor fixes * chore: minor fix * chore: minor fixes * feat: additional parsing for storekit subscription plans * chore: minor codestyle fixes * chore: simplify benefits * chore: hide extend buttons on external premium * feat: add trial error processing * fix: remove wrong check from tiral handler * chore: cleanup --------- Co-authored-by: spectrum <yyy@amnezia.org>
73 lines
1.8 KiB
C++
73 lines
1.8 KiB
C++
#ifndef APIACCOUNTINFOMODEL_H
|
|
#define APIACCOUNTINFOMODEL_H
|
|
|
|
#include <QAbstractListModel>
|
|
#include <QJsonArray>
|
|
#include <QJsonObject>
|
|
|
|
#include "core/api/apiDefs.h"
|
|
|
|
class ApiAccountInfoModel : public QAbstractListModel
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
enum Roles {
|
|
SubscriptionStatusRole = Qt::UserRole + 1,
|
|
ConnectedDevicesRole,
|
|
ServiceDescriptionRole,
|
|
EndDateRole,
|
|
IsComponentVisibleRole,
|
|
IsSubscriptionRenewalAvailableRole,
|
|
HasExpiredWorkerRole,
|
|
IsProtocolSelectionSupportedRole,
|
|
IsSubscriptionExpiredRole,
|
|
IsSubscriptionExpiringSoonRole,
|
|
IsInAppPurchaseRole
|
|
};
|
|
|
|
explicit ApiAccountInfoModel(QObject *parent = nullptr);
|
|
|
|
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
|
|
|
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
|
|
|
public slots:
|
|
void updateModel(const QJsonObject &accountInfoObject, const QJsonObject &serverConfig);
|
|
QVariant data(const QString &roleString);
|
|
QJsonArray getAvailableCountries();
|
|
QJsonArray getIssuedConfigsInfo();
|
|
|
|
QString getTelegramBotLink();
|
|
QString getEmailLink();
|
|
QString getBillingEmailLink();
|
|
QString getSiteLink();
|
|
QString getFullSiteLink();
|
|
|
|
protected:
|
|
QHash<int, QByteArray> roleNames() const override;
|
|
|
|
private:
|
|
struct AccountInfoData
|
|
{
|
|
QString subscriptionEndDate;
|
|
int activeDeviceCount;
|
|
int maxDeviceCount;
|
|
|
|
apiDefs::ConfigType configType;
|
|
|
|
QStringList supportedProtocols;
|
|
|
|
QString subscriptionDescription;
|
|
|
|
bool isInAppPurchase = false;
|
|
};
|
|
|
|
AccountInfoData m_accountInfoData;
|
|
QJsonArray m_availableCountries;
|
|
QJsonArray m_issuedConfigsInfo;
|
|
QJsonObject m_supportInfo;
|
|
};
|
|
|
|
#endif // APIACCOUNTINFOMODEL_H
|