summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJon Petersson <jon.petersson@mullvad.net>2025-04-16 13:45:12 +0200
committerJon Petersson <jon.petersson@mullvad.net>2025-04-16 13:45:12 +0200
commit39ba789961173400a53def2d02abdccc2ac91af9 (patch)
tree8a52418d769cf107aa5980f568c77391fb313ed1
parente0ed94fbf54e66eb15e4b7ef4dcddcafb8695dc1 (diff)
parent1765d814709deebbea19623110402f39e39ddc3b (diff)
downloadmullvadvpn-39ba789961173400a53def2d02abdccc2ac91af9.tar.xz
mullvadvpn-39ba789961173400a53def2d02abdccc2ac91af9.zip
Merge branch 'add-a-label-that-hints-at-how-to-create-custom-lists-ios-1056'
-rw-r--r--ios/MullvadVPN/View controllers/SelectLocation/LocationDataSource.swift34
1 files changed, 29 insertions, 5 deletions
diff --git a/ios/MullvadVPN/View controllers/SelectLocation/LocationDataSource.swift b/ios/MullvadVPN/View controllers/SelectLocation/LocationDataSource.swift
index bbb4e1125c..4b7485aae5 100644
--- a/ios/MullvadVPN/View controllers/SelectLocation/LocationDataSource.swift
+++ b/ios/MullvadVPN/View controllers/SelectLocation/LocationDataSource.swift
@@ -253,14 +253,14 @@ extension LocationDataSource: UITableViewDelegate {
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
switch sections[section] {
case .allLocations:
- return LocationSectionHeaderFooterView(
+ LocationSectionHeaderFooterView(
configuration: LocationSectionHeaderFooterView.Configuration(
name: LocationSection.allLocations.header,
style: .header
)
)
case .customLists:
- return LocationSectionHeaderFooterView(configuration: LocationSectionHeaderFooterView.Configuration(
+ LocationSectionHeaderFooterView(configuration: LocationSectionHeaderFooterView.Configuration(
name: LocationSection.customLists.header,
style: .header,
primaryAction: UIAction(
@@ -281,16 +281,40 @@ extension LocationDataSource: UITableViewDelegate {
directionalEdgeInsets: NSDirectionalEdgeInsets(top: 24, leading: 16, bottom: 0, trailing: 16)
))
case .customLists:
- return nil
+ guard dataSources[section].nodes.isEmpty else {
+ return nil
+ }
+
+ let text = NSMutableAttributedString(string: NSLocalizedString(
+ "CUSTOM_LIST_FOOTER",
+ tableName: "SelectLocation",
+ value: "To create a custom list, tap on ",
+ comment: ""
+ ))
+
+ text.append(NSAttributedString(string: "\""))
+
+ if let image = UIImage(systemName: "ellipsis") {
+ text.append(NSAttributedString(attachment: NSTextAttachment(image: image)))
+ } else {
+ text.append(NSAttributedString(string: "..."))
+ }
+
+ text.append(NSAttributedString(string: "\""))
+
+ var contentConfiguration = UIListContentConfiguration.mullvadGroupedFooter(tableStyle: tableView.style)
+ contentConfiguration.attributedText = text
+
+ return UIListContentView(configuration: contentConfiguration)
}
}
func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
switch sections[section] {
case .allLocations:
- return dataSources[section].nodes.isEmpty ? 80 : .zero
+ dataSources[section].nodes.isEmpty ? 80 : .zero
case .customLists:
- return 24
+ dataSources[section].nodes.isEmpty ? UITableView.automaticDimension : 24
}
}