@@ -457,6 +457,7 @@ final class VPNSettingsDataSource: UITableViewDiffableDataSource<
457
457
header. accessibilityIdentifier = . wireGuardPortsCell
458
458
header. titleLabel. text = title
459
459
header. accessibilityCustomActionName = title
460
+ header. isExpanded = isExpanded ( . wireGuardPorts)
460
461
header. infoButtonHandler = { [ weak self] in
461
462
if let self {
462
463
self . delegate? . showInfo ( for: . wireGuardPorts)
@@ -500,6 +501,7 @@ final class VPNSettingsDataSource: UITableViewDiffableDataSource<
500
501
header. accessibilityIdentifier = . wireGuardObfuscationCell
501
502
header. titleLabel. text = title
502
503
header. accessibilityCustomActionName = title
504
+ header. isExpanded = isExpanded ( . wireGuardObfuscation)
503
505
header. didCollapseHandler = { [ weak self] header in
504
506
guard let self else { return }
505
507
@@ -529,6 +531,7 @@ final class VPNSettingsDataSource: UITableViewDiffableDataSource<
529
531
header. accessibilityIdentifier = . udpOverTCPPortCell
530
532
header. titleLabel. text = title
531
533
header. accessibilityCustomActionName = title
534
+ header. isExpanded = isExpanded ( . wireGuardObfuscationPort)
532
535
header. didCollapseHandler = { [ weak self] header in
533
536
guard let self else { return }
534
537
@@ -558,6 +561,7 @@ final class VPNSettingsDataSource: UITableViewDiffableDataSource<
558
561
header. accessibilityIdentifier = . quantumResistantTunnelCell
559
562
header. titleLabel. text = title
560
563
header. accessibilityCustomActionName = title
564
+ header. isExpanded = isExpanded ( . quantumResistance)
561
565
header. didCollapseHandler = { [ weak self] header in
562
566
guard let self else { return }
563
567
@@ -593,6 +597,11 @@ final class VPNSettingsDataSource: UITableViewDiffableDataSource<
593
597
594
598
return nil
595
599
}
600
+
601
+ private func isExpanded( _ section: Section ) -> Bool {
602
+ let snapshot = snapshot ( )
603
+ return snapshot. numberOfItems ( inSection: section) != 0
604
+ }
596
605
}
597
606
598
607
extension VPNSettingsDataSource : VPNSettingsCellEventHandler {
0 commit comments