Skip to content

Commit a2f6945

Browse files
committed
Decouple DNS server info from content-blockers UI expansion
1 parent ee4ad0a commit a2f6945

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

ios/MullvadVPN/View controllers/VPNSettings/CustomDNSDataSource.swift

+4-10
Original file line numberDiff line numberDiff line change
@@ -563,17 +563,13 @@ final class CustomDNSDataSource: UITableViewDiffableDataSource<
563563
) -> NSDiffableDataSourceSnapshot<Section, Item> {
564564
var snapshot = snapshot
565565

566-
if snapshot.itemIdentifiers(inSection: .contentBlockers).isEmpty {
566+
if viewModel.customDNSPrecondition == .satisfied {
567567
snapshot.deleteItems([.dnsServerInfo])
568568
} else {
569-
if viewModel.customDNSPrecondition == .satisfied {
570-
snapshot.deleteItems([.dnsServerInfo])
569+
if snapshot.itemIdentifiers(inSection: .customDNS).contains(.dnsServerInfo) {
570+
snapshot.reloadItems([.dnsServerInfo])
571571
} else {
572-
if snapshot.itemIdentifiers(inSection: .customDNS).contains(.dnsServerInfo) {
573-
snapshot.reloadItems([.dnsServerInfo])
574-
} else {
575-
snapshot.appendItems([.dnsServerInfo], toSection: .customDNS)
576-
}
572+
snapshot.appendItems([.dnsServerInfo], toSection: .customDNS)
577573
}
578574
}
579575

@@ -618,10 +614,8 @@ final class CustomDNSDataSource: UITableViewDiffableDataSource<
618614

619615
if headerView.isExpanded {
620616
snapshot.deleteItems(Item.contentBlockers)
621-
snapshot.deleteItems([.dnsServerInfo])
622617
} else {
623618
snapshot.appendItems(Item.contentBlockers, toSection: .contentBlockers)
624-
snapshot.appendItems([.dnsServerInfo])
625619
}
626620

627621
headerView.isExpanded.toggle()

0 commit comments

Comments
 (0)