Skip to content

Commit

Permalink
Don't update proxies when selecting a proxy (#2414)
Browse files Browse the repository at this point in the history
  • Loading branch information
zeitschlag committed Dec 8, 2024
1 parent 43aacd2 commit 8251d8b
Showing 1 changed file with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,14 @@ class ProxySettingsViewController: UITableViewController {

required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") }

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

let proxies = dcContext.getProxies()
self.proxies = proxies
self.selectedProxy = proxies.first
}

// MARK: - Actions

private func selectProxy(at indexPath: IndexPath) {
Expand Down Expand Up @@ -134,6 +142,7 @@ class ProxySettingsViewController: UITableViewController {

self.proxies.remove(at: indexPath.row)
self.dcContext.setProxies(proxyURLs: proxies)
self.dcAccounts.restartIO()
DispatchQueue.main.async {
self.toggleProxyCell.uiSwitch.isEnabled = (self.proxies.isEmpty == false)
self.tableView.reloadData()
Expand Down Expand Up @@ -164,12 +173,7 @@ class ProxySettingsViewController: UITableViewController {

@objc private func handleConnectivityChanged(_ notification: Notification) {
DispatchQueue.main.async { [weak self] in
guard let self else { return }

let proxies = dcContext.getProxies()
self.proxies = proxies
self.selectedProxy = proxies.first
self.tableView.reloadData()
self?.tableView.reloadData()
}
}
}
Expand Down

0 comments on commit 8251d8b

Please sign in to comment.