fix: delete premium V2 migration link from Free config Settings (#1671)

* delete premium V2 update link from Free config Settings

* Add debug logs

* Add property for checking if server config is premium

* remove debug logs
This commit is contained in:
aiamnezia 2025-07-02 06:07:56 +04:00 committed by GitHub
parent 979ab42c5a
commit f0626e2eca
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 14 additions and 4 deletions

View file

@ -8,6 +8,8 @@
#include <AmneziaVPN-Swift.h> #include <AmneziaVPN-Swift.h>
#endif #endif
#include "core/api/apiUtils.h"
namespace namespace
{ {
namespace configKey namespace configKey
@ -427,7 +429,7 @@ void ServersModel::updateDefaultServerContainersModel()
emit defaultServerContainersUpdated(containers); emit defaultServerContainersUpdated(containers);
} }
QJsonObject ServersModel::getServerConfig(const int serverIndex) QJsonObject ServersModel::getServerConfig(const int serverIndex) const
{ {
return m_servers.at(serverIndex).toObject(); return m_servers.at(serverIndex).toObject();
} }
@ -814,3 +816,8 @@ const QString ServersModel::getDefaultServerImagePathCollapsed()
} }
return QString("qrc:/countriesFlags/images/flagKit/%1.svg").arg(countryCode.toUpper()); return QString("qrc:/countriesFlags/images/flagKit/%1.svg").arg(countryCode.toUpper());
} }
bool ServersModel::processedServerIsPremium() const
{
return apiUtils::isPremiumServer(getServerConfig(m_processedServerIndex));
}

View file

@ -63,6 +63,9 @@ public:
Q_PROPERTY(bool isDefaultServerFromApi READ isDefaultServerFromApi NOTIFY defaultServerIndexChanged) Q_PROPERTY(bool isDefaultServerFromApi READ isDefaultServerFromApi NOTIFY defaultServerIndexChanged)
Q_PROPERTY(int processedIndex READ getProcessedServerIndex WRITE setProcessedServerIndex NOTIFY processedServerIndexChanged) Q_PROPERTY(int processedIndex READ getProcessedServerIndex WRITE setProcessedServerIndex NOTIFY processedServerIndexChanged)
Q_PROPERTY(bool processedServerIsPremium READ processedServerIsPremium NOTIFY processedServerChanged)
bool processedServerIsPremium() const;
public slots: public slots:
void setDefaultServerIndex(const int index); void setDefaultServerIndex(const int index);
@ -92,7 +95,7 @@ public slots:
void removeServer(); void removeServer();
void removeServer(const int serverIndex); void removeServer(const int serverIndex);
QJsonObject getServerConfig(const int serverIndex); QJsonObject getServerConfig(const int serverIndex) const;
void reloadDefaultServerContainerConfig(); void reloadDefaultServerContainerConfig();
void updateContainerConfig(const int containerIndex, const QJsonObject config); void updateContainerConfig(const int containerIndex, const QJsonObject config);

View file

@ -260,7 +260,7 @@ PageType {
LabelWithButtonType { LabelWithButtonType {
id: labelWithButton6 id: labelWithButton6
visible: ServersModel.getProcessedServerData("isServerFromTelegramApi") visible: ServersModel.getProcessedServerData("isServerFromTelegramApi") && ServersModel.processedServerIsPremium
Layout.fillWidth: true Layout.fillWidth: true
text: qsTr("Switch to the new Amnezia Premium subscription") text: qsTr("Switch to the new Amnezia Premium subscription")
@ -273,7 +273,7 @@ PageType {
} }
DividerType { DividerType {
visible: ServersModel.getProcessedServerData("isServerFromTelegramApi") visible: ServersModel.getProcessedServerData("isServerFromTelegramApi") && ServersModel.processedServerIsPremium
} }
} }
} }