TunnelsManager: get rid of index management

No need for premature optimization. There aren't that many tunnels most
of the time, and calling sort on a partially sorted array is fast.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
Jason A. Donenfeld
2018-11-03 03:40:23 +01:00
parent 9439e00047
commit 007d6d9c58
3 changed files with 33 additions and 51 deletions
@@ -312,11 +312,11 @@ extension TunnelsListTableViewController: TunnelsManagerDelegate {
func tunnelModified(at index: Int) {
tableView.reloadRows(at: [IndexPath(row: index, section: 0)], with: .automatic)
}
func tunnelsChanged() {
tableView.reloadData()
func tunnelMoved(at oldIndex: Int, to newIndex: Int) {
tableView.moveRow(at: IndexPath(row: oldIndex, section: 0), to: IndexPath(row: newIndex, section: 0))
}
func tunnelRemoved(at index: Int) {
tableView.deleteRows(at: [IndexPath(row: index, section: 0)], with: .automatic)
}