summaryrefslogtreecommitdiffhomepage
path: root/ios
diff options
context:
space:
mode:
authormojganii <mojgan.jelodar@codic.se>2024-04-10 11:20:26 +0200
committerBug Magnet <marco.nikic@mullvad.net>2024-04-11 10:44:58 +0200
commit8beace5e3051f04021214a9fb2a5c19c8e3b0d46 (patch)
tree9da62df83aee06d7e3255612f03666bd2ccb6403 /ios
parentef5c33f520a7e5d43819eabcbac0e2effb59fc70 (diff)
downloadmullvadvpn-8beace5e3051f04021214a9fb2a5c19c8e3b0d46.tar.xz
mullvadvpn-8beace5e3051f04021214a9fb2a5c19c8e3b0d46.zip
Revise navigation for empty Custom Lists
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])