bugfix/minor-ui-fixes (#1363)

* bugfix: fixed amfree availability display

* bugfix: fixed selection of exported config type

* chore: hide ad label

* chore: hide ampremium for mobile platforms
This commit is contained in:
Nethius 2025-01-15 12:04:48 +07:00 committed by GitHub
parent 1cfa4e0630
commit 665a2911be
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 27 additions and 14 deletions

View file

@ -68,17 +68,19 @@ QVariant ApiServicesModel::data(const QModelIndex &index, int role) const
return tr("Classic VPN for comfortable work, downloading large files and watching videos. " return tr("Classic VPN for comfortable work, downloading large files and watching videos. "
"Works for any sites. Speed up to %1 MBit/s") "Works for any sites. Speed up to %1 MBit/s")
.arg(speed); .arg(speed);
} else if (serviceType == serviceType::amneziaFree){ } else if (serviceType == serviceType::amneziaFree) {
QString description = tr("VPN to access blocked sites in regions with high levels of Internet censorship. "); QString description = tr("VPN to access blocked sites in regions with high levels of Internet censorship. ");
if (!isServiceAvailable) { if (!isServiceAvailable) {
description += tr("<p><a style=\"color: #EB5757;\">Not available in your region. If you have VPN enabled, disable it, return to the previous screen, and try again.</a>"); description += tr("<p><a style=\"color: #EB5757;\">Not available in your region. If you have VPN enabled, disable it, "
"return to the previous screen, and try again.</a>");
} }
return description; return description;
} }
} }
case ServiceDescriptionRole: { case ServiceDescriptionRole: {
if (serviceType == serviceType::amneziaPremium) { if (serviceType == serviceType::amneziaPremium) {
return tr("Amnezia Premium - A classic VPN for comfortable work, downloading large files, and watching videos in high resolution. " return tr("Amnezia Premium - A classic VPN for comfortable work, downloading large files, and watching videos in high "
"resolution. "
"It works for all websites, even in countries with the highest level of internet censorship."); "It works for all websites, even in countries with the highest level of internet censorship.");
} else { } else {
return tr("Amnezia Free is a free VPN to bypass blocking in countries with high levels of internet censorship"); return tr("Amnezia Free is a free VPN to bypass blocking in countries with high levels of internet censorship");
@ -143,7 +145,15 @@ void ApiServicesModel::updateModel(const QJsonObject &data)
m_selectedServiceIndex = 0; m_selectedServiceIndex = 0;
} else { } else {
for (const auto &service : services) { for (const auto &service : services) {
m_services.push_back(getApiServicesData(service.toObject())); auto serviceObject = service.toObject();
#if defined(Q_OS_ANDROID) || defined(Q_OS_IOS)
if (serviceObject.value(configKey::serviceType).toString() == serviceType::amneziaPremium) {
continue;
}
#endif
m_services.push_back(getApiServicesData(serviceObject));
} }
} }
@ -228,7 +238,7 @@ QHash<int, QByteArray> ApiServicesModel::roleNames() const
ApiServicesModel::ApiServicesData ApiServicesModel::getApiServicesData(const QJsonObject &data) ApiServicesModel::ApiServicesData ApiServicesModel::getApiServicesData(const QJsonObject &data)
{ {
auto serviceInfo = data.value(configKey::serviceInfo).toObject(); auto serviceInfo = data.value(configKey::serviceInfo).toObject();
auto serviceType = data.value(configKey::serviceType).toString(); auto serviceType = data.value(configKey::serviceType).toString();
auto serviceProtocol = data.value(configKey::serviceProtocol).toString(); auto serviceProtocol = data.value(configKey::serviceProtocol).toString();
auto availableCountries = data.value(configKey::availableCountries).toArray(); auto availableCountries = data.value(configKey::availableCountries).toArray();
@ -247,7 +257,7 @@ ApiServicesModel::ApiServicesData ApiServicesModel::getApiServicesData(const QJs
serviceData.storeEndpoint = serviceInfo.value(configKey::storeEndpoint).toString(); serviceData.storeEndpoint = serviceInfo.value(configKey::storeEndpoint).toString();
if (serviceInfo.value(configKey::isAvailable).isBool()) { if (data.value(configKey::isAvailable).isBool()) {
serviceData.isServiceAvailable = data.value(configKey::isAvailable).toBool(); serviceData.isServiceAvailable = data.value(configKey::isAvailable).toBool();
} else { } else {
serviceData.isServiceAvailable = true; serviceData.isServiceAvailable = true;

View file

@ -20,8 +20,9 @@ Rectangle {
color: AmneziaStyle.color.transparent color: AmneziaStyle.color.transparent
radius: 13 radius: 13
visible: GC.isDesktop() && ServersModel.isDefaultServerFromApi visible: false
&& ServersModel.isDefaultServerDefaultContainerHasSplitTunneling && SettingsController.isHomeAdLabelVisible // visible: GC.isDesktop() && ServersModel.isDefaultServerFromApi
// && ServersModel.isDefaultServerDefaultContainerHasSplitTunneling && SettingsController.isHomeAdLabelVisible
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent

View file

@ -481,9 +481,11 @@ PageType {
headerText: qsTr("Connection format") headerText: qsTr("Connection format")
listView: ListViewWithRadioButtonType { listView: ListViewWithRadioButtonType {
id: exportTypeSelectorListView
onCurrentIndexChanged: { onCurrentIndexChanged: {
exportTypeSelector.currentIndex = currentIndex exportTypeSelector.currentIndex = exportTypeSelectorListView.selectedIndex
exportTypeSelector.text = selectedText exportTypeSelector.text = exportTypeSelectorListView.selectedText
} }
rootWidth: root.width rootWidth: root.width
@ -494,14 +496,14 @@ PageType {
currentIndex: 0 currentIndex: 0
clickedFunction: function() { clickedFunction: function() {
exportTypeSelector.text = selectedText exportTypeSelector.text = exportTypeSelectorListView.selectedText
exportTypeSelector.currentIndex = currentIndex exportTypeSelector.currentIndex = exportTypeSelectorListView.selectedIndex
exportTypeSelector.closeTriggered() exportTypeSelector.closeTriggered()
} }
Component.onCompleted: { Component.onCompleted: {
exportTypeSelector.text = selectedText exportTypeSelector.text = exportTypeSelectorListView.selectedText
exportTypeSelector.currentIndex = currentIndex exportTypeSelector.currentIndex = exportTypeSelectorListView.selectedIndex
} }
} }
} }