Skip to content

Commit

Permalink
bugfix/minor-ui-fixes (#1363)
Browse files Browse the repository at this point in the history
* bugfix: fixed amfree availability display

* bugfix: fixed selection of exported config type

* chore: hide ad label

* chore: hide ampremium for mobile platforms
  • Loading branch information
Nethius authored Jan 15, 2025
1 parent 1cfa4e0 commit 665a291
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 14 deletions.
22 changes: 16 additions & 6 deletions client/ui/models/apiServicesModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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. "
"Works for any sites. Speed up to %1 MBit/s")
.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. ");
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;
}
}
case ServiceDescriptionRole: {
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.");
} else {
return tr("Amnezia Free is a free VPN to bypass blocking in countries with high levels of internet censorship");
Expand Down Expand Up @@ -143,7 +145,15 @@ void ApiServicesModel::updateModel(const QJsonObject &data)
m_selectedServiceIndex = 0;
} else {
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));
}
}

Expand Down Expand Up @@ -228,7 +238,7 @@ QHash<int, QByteArray> ApiServicesModel::roleNames() const

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 serviceProtocol = data.value(configKey::serviceProtocol).toString();
auto availableCountries = data.value(configKey::availableCountries).toArray();
Expand All @@ -247,7 +257,7 @@ ApiServicesModel::ApiServicesData ApiServicesModel::getApiServicesData(const QJs

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();
} else {
serviceData.isServiceAvailable = true;
Expand Down
5 changes: 3 additions & 2 deletions client/ui/qml/Components/AdLabel.qml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ Rectangle {
color: AmneziaStyle.color.transparent
radius: 13

visible: GC.isDesktop() && ServersModel.isDefaultServerFromApi
&& ServersModel.isDefaultServerDefaultContainerHasSplitTunneling && SettingsController.isHomeAdLabelVisible
visible: false
// visible: GC.isDesktop() && ServersModel.isDefaultServerFromApi
// && ServersModel.isDefaultServerDefaultContainerHasSplitTunneling && SettingsController.isHomeAdLabelVisible

MouseArea {
anchors.fill: parent
Expand Down
14 changes: 8 additions & 6 deletions client/ui/qml/Pages2/PageShare.qml
Original file line number Diff line number Diff line change
Expand Up @@ -481,9 +481,11 @@ PageType {
headerText: qsTr("Connection format")

listView: ListViewWithRadioButtonType {
id: exportTypeSelectorListView

onCurrentIndexChanged: {
exportTypeSelector.currentIndex = currentIndex
exportTypeSelector.text = selectedText
exportTypeSelector.currentIndex = exportTypeSelectorListView.selectedIndex
exportTypeSelector.text = exportTypeSelectorListView.selectedText
}

rootWidth: root.width
Expand All @@ -494,14 +496,14 @@ PageType {
currentIndex: 0

clickedFunction: function() {
exportTypeSelector.text = selectedText
exportTypeSelector.currentIndex = currentIndex
exportTypeSelector.text = exportTypeSelectorListView.selectedText
exportTypeSelector.currentIndex = exportTypeSelectorListView.selectedIndex
exportTypeSelector.closeTriggered()
}

Component.onCompleted: {
exportTypeSelector.text = selectedText
exportTypeSelector.currentIndex = currentIndex
exportTypeSelector.text = exportTypeSelectorListView.selectedText
exportTypeSelector.currentIndex = exportTypeSelectorListView.selectedIndex
}
}
}
Expand Down

0 comments on commit 665a291

Please sign in to comment.