summaryrefslogtreecommitdiffhomepage
path: root/ios
diff options
context:
space:
mode:
Diffstat (limited to 'ios')
-rw-r--r--ios/MullvadVPN/Coordinators/CustomLists/ListCustomListCoordinator.swift14
-rw-r--r--ios/MullvadVPN/Coordinators/CustomLists/ListCustomListViewController.swift17
2 files changed, 8 insertions, 23 deletions
diff --git a/ios/MullvadVPN/Coordinators/CustomLists/ListCustomListCoordinator.swift b/ios/MullvadVPN/Coordinators/CustomLists/ListCustomListCoordinator.swift
index fbdab2fba8..2b238dd1e5 100644
--- a/ios/MullvadVPN/Coordinators/CustomLists/ListCustomListCoordinator.swift
+++ b/ios/MullvadVPN/Coordinators/CustomLists/ListCustomListCoordinator.swift
@@ -62,9 +62,7 @@ class ListCustomListCoordinator: Coordinator, Presentable, Presenting {
guard let self else { return }
popToList()
editCustomListCoordinator.removeFromParent()
-
self.updateRelayConstraints(for: action, in: list)
- self.listViewController.updateDataSource(reloadExisting: action == .save)
}
coordinator.start()
@@ -97,9 +95,13 @@ class ListCustomListCoordinator: Coordinator, Presentable, Presenting {
}
private func popToList() {
- guard let listController = navigationController.viewControllers
- .first(where: { $0 is ListCustomListViewController }) else { return }
-
- navigationController.popToViewController(listController, animated: true)
+ if interactor.fetchAll().isEmpty {
+ navigationController.dismiss(animated: true)
+ didFinish?(self)
+ } else if let listController = navigationController.viewControllers
+ .first(where: { $0 is ListCustomListViewController }) {
+ navigationController.popToViewController(listController, animated: true)
+ listViewController.updateDataSource(reloadExisting: true, animated: false)
+ }
}
}
diff --git a/ios/MullvadVPN/Coordinators/CustomLists/ListCustomListViewController.swift b/ios/MullvadVPN/Coordinators/CustomLists/ListCustomListViewController.swift
index 78a14a298c..74b185169c 100644
--- a/ios/MullvadVPN/Coordinators/CustomLists/ListCustomListViewController.swift
+++ b/ios/MullvadVPN/Coordinators/CustomLists/ListCustomListViewController.swift
@@ -34,22 +34,6 @@ class ListCustomListViewController: UIViewController {
private var dataSource: DataSource?
private var fetchedItems: [CustomList] = []
private var tableView = UITableView(frame: .zero, style: .plain)
-
- private let emptyListLabel: UILabel = {
- let textLabel = UILabel()
- textLabel.font = .preferredFont(forTextStyle: .title2)
- textLabel.textColor = .secondaryTextColor
- textLabel.textAlignment = .center
- textLabel.numberOfLines = .zero
- textLabel.lineBreakStrategy = []
- textLabel.text = NSLocalizedString(
- "CustomList",
- value: "No custom list to display",
- comment: ""
- )
- return textLabel
- }()
-
var didSelectItem: ((CustomList) -> Void)?
var didFinish: (() -> Void)?
@@ -75,7 +59,6 @@ class ListCustomListViewController: UIViewController {
func updateDataSource(reloadExisting: Bool, animated: Bool = true) {
fetchedItems = interactor.fetchAll()
- tableView.backgroundView = fetchedItems.isEmpty ? emptyListLabel : nil
var snapshot = NSDiffableDataSourceSnapshot<SectionIdentifier, ItemIdentifier>()
snapshot.appendSections([.default])