Skip to content

Commit

Permalink
Remove duplicated detail
Browse files Browse the repository at this point in the history
  • Loading branch information
quanganhdo committed Mar 18, 2024
1 parent ff7ea22 commit b4daa7b
Showing 1 changed file with 1 addition and 28 deletions.
29 changes: 1 addition & 28 deletions DuckDuckGo/NetworkProtectionDebugViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ final class NetworkProtectionDebugViewController: UITableViewController {
Sections.simulateFailure: "Simulate Failure",
Sections.registrationKey: "Registration Key",
Sections.networkPath: "Network Path",
Sections.lastDisconnectError: "Last Disconnect Error",
Sections.connectionTest: "Connection Test",
Sections.vpnConfiguration: "VPN Configuration",
Sections.vpnMetadata: "VPN Metadata",
Expand All @@ -63,7 +62,6 @@ final class NetworkProtectionDebugViewController: UITableViewController {
case registrationKey
case connectionTest
case networkPath
case lastDisconnectError
case vpnConfiguration
case vpnMetadata
}
Expand Down Expand Up @@ -107,10 +105,6 @@ final class NetworkProtectionDebugViewController: UITableViewController {
case networkPath
}

enum LastDisconnectErrorRows: Int, CaseIterable {
case lastDisconnectError
}

enum ConnectionTestRows: Int, CaseIterable {
case runConnectionTest
}
Expand All @@ -132,7 +126,7 @@ final class NetworkProtectionDebugViewController: UITableViewController {
private let pathMonitor = NWPathMonitor()

private var currentNetworkPath: String?
private var lastDisconnectError: String?
private var lastError: String?
private var baseConfigurationData: String?
private var fullProtocolConfigurationData: String?
private var vpnMetadata: VPNMetadata?
Expand Down Expand Up @@ -166,7 +160,6 @@ final class NetworkProtectionDebugViewController: UITableViewController {

override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
loadLastDisconnectError()
loadConfigurationData()
startPathMonitor()

Expand Down Expand Up @@ -221,9 +214,6 @@ final class NetworkProtectionDebugViewController: UITableViewController {
case .networkPath:
configure(cell, forNetworkPathRow: indexPath.row)

case .lastDisconnectError:
configure(cell, forLastDisconnectErrorRow: indexPath.row)

case .connectionTest:
configure(cell, forConnectionTestRow: indexPath.row)

Expand Down Expand Up @@ -252,7 +242,6 @@ final class NetworkProtectionDebugViewController: UITableViewController {
case .simulateFailure: return SimulateFailureRows.allCases.count
case .registrationKey: return RegistrationKeyRows.allCases.count
case .networkPath: return NetworkPathRows.allCases.count
case .lastDisconnectError: return LastDisconnectErrorRows.allCases.count
case .connectionTest: return ConnectionTestRows.allCases.count + connectionTestResults.count
case .vpnConfiguration: return ConfigurationRows.allCases.count
case .vpnMetadata: return MetadataRows.allCases.count
Expand Down Expand Up @@ -281,8 +270,6 @@ final class NetworkProtectionDebugViewController: UITableViewController {
didSelectRegistrationKeyAction(at: indexPath)
case .networkPath:
break
case .lastDisconnectError:
break
case .connectionTest:
if indexPath.row == connectionTestResults.count {
Task {
Expand Down Expand Up @@ -464,20 +451,6 @@ final class NetworkProtectionDebugViewController: UITableViewController {
pathMonitor.start(queue: .main)
}

// MARK: Last disconnect error

private func configure(_ cell: UITableViewCell, forLastDisconnectErrorRow row: Int) {
cell.textLabel?.font = .monospacedSystemFont(ofSize: 13.0, weight: .regular)
cell.textLabel?.text = lastDisconnectError ?? "Loading Last Disconnect Error..."
}

private func loadLastDisconnectError() {
Task { @MainActor in
lastDisconnectError = await DefaultVPNMetadataCollector().lastDisconnectError()
tableView.reloadData()
}
}

// MARK: Connection Test

private func configure(_ cell: UITableViewCell, forConnectionTestRow row: Int) {
Expand Down

0 comments on commit b4daa7b

Please sign in to comment.