Select row when pool group is disclosable

No checkmark. Ugly yet the lesser evil.
This commit is contained in:
Davide De Rosa 2019-04-06 20:14:54 +02:00
parent a63525c19a
commit b3eea07ee1
2 changed files with 8 additions and 3 deletions

View File

@ -71,7 +71,7 @@ class ProviderPoolViewController: UIViewController {
title = L10n.Service.Cells.Provider.Pool.caption
tableView.reloadData()
if let ip = selectedIndexPath {
tableView.scrollToRowAsync(at: ip)
tableView.selectRowAsync(at: ip)
}
}
}
@ -106,10 +106,9 @@ extension ProviderPoolViewController: UITableViewDataSource, UITableViewDelegate
let cell = Cells.setting.dequeue(from: tableView, for: indexPath)
cell.imageView?.image = pool.logo
cell.leftText = pool.localizedName
// FIXME: checkmark overridden when count > 1
if groupPools.count > 1 {
cell.rightText = pool.area?.uppercased()
cell.accessoryType = .detailDisclosureButton
cell.accessoryType = .detailDisclosureButton // no checkmark!
} else {
cell.rightText = pool.areaId?.uppercased()
cell.applyChecked(pool.id == currentPool?.id, Theme.current)

View File

@ -230,4 +230,10 @@ public extension UITableView {
self?.scrollToRow(at: indexPath, at: .middle, animated: false)
}
}
func selectRowAsync(at indexPath: IndexPath) {
DispatchQueue.main.async { [weak self] in
self?.selectRow(at: indexPath, animated: false, scrollPosition: .middle)
}
}
}