fix: fix crash in server pick view when user input search text
fix: fix in pick server view, user cound is always zero
This commit is contained in:
jk234ert 2021-03-01 17:08:31 +08:00
parent 0e96a2f1d0
commit cff6a1d9ef
4 changed files with 5 additions and 6 deletions

View File

@ -103,7 +103,9 @@ extension MastodonPickServerViewController {
.sink { _ in
} receiveValue: { [weak self] servers in
self?.tableView.beginUpdates()
self?.tableView.reloadSections(IndexSet(integer: 3), with: .automatic)
self?.tableView.endUpdates()
if let selectedServer = self?.viewModel.selectedServer.value, servers.contains(selectedServer) {
// Previously selected server is still in the list, do nothing
} else {
@ -291,8 +293,7 @@ extension MastodonPickServerViewController: UITableViewDelegate {
// Same reason as above
return 10
case .serverList:
// Header with 1 height as the separator
return 1
return 0
}
}

View File

@ -80,8 +80,6 @@ class MastodonPickServerViewModel: NSObject {
weak var tableView: UITableView?
// private var expandServerDomainSet = Set<String>()
var mastodonPinBasedAuthenticationViewController: UIViewController?
init(context: AppContext, mode: PickServerMode) {

View File

@ -231,7 +231,7 @@ extension PickServerCell {
// Set bottom separator
seperator.leadingAnchor.constraint(equalTo: containerView.leadingAnchor),
containerView.trailingAnchor.constraint(equalTo: seperator.trailingAnchor),
containerView.bottomAnchor.constraint(equalTo: seperator.bottomAnchor),
containerView.topAnchor.constraint(equalTo: seperator.topAnchor),
seperator.heightAnchor.constraint(equalToConstant: 1).priority(.defaultHigh),
domainLabel.topAnchor.constraint(equalTo: containerView.layoutMarginsGuide.topAnchor),

View File

@ -47,7 +47,7 @@ extension Mastodon.Entity {
case approvalRequired = "approval_required"
case invitesEnabled = "invites_enabled"
case urls
case statistics
case statistics = "stats"
case thumbnail
case contactAccount = "contact_account"