From cff6a1d9efd3105fec46570a86a401f02088970d Mon Sep 17 00:00:00 2001 From: jk234ert Date: Mon, 1 Mar 2021 17:08:31 +0800 Subject: [PATCH] fix: #30 fix: fix crash in server pick view when user input search text fix: fix in pick server view, user cound is always zero --- .../PickServer/MastodonPickServerViewController.swift | 5 +++-- .../Onboarding/PickServer/MastodonPickServerViewModel.swift | 2 -- .../Onboarding/PickServer/TableViewCell/PickServerCell.swift | 2 +- .../MastodonSDK/Entity/Mastodon+Entity+Instance.swift | 2 +- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/Mastodon/Scene/Onboarding/PickServer/MastodonPickServerViewController.swift b/Mastodon/Scene/Onboarding/PickServer/MastodonPickServerViewController.swift index 9e10cd329..fb42192a5 100644 --- a/Mastodon/Scene/Onboarding/PickServer/MastodonPickServerViewController.swift +++ b/Mastodon/Scene/Onboarding/PickServer/MastodonPickServerViewController.swift @@ -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 } } diff --git a/Mastodon/Scene/Onboarding/PickServer/MastodonPickServerViewModel.swift b/Mastodon/Scene/Onboarding/PickServer/MastodonPickServerViewModel.swift index 3a701f09f..a3b2a8768 100644 --- a/Mastodon/Scene/Onboarding/PickServer/MastodonPickServerViewModel.swift +++ b/Mastodon/Scene/Onboarding/PickServer/MastodonPickServerViewModel.swift @@ -80,8 +80,6 @@ class MastodonPickServerViewModel: NSObject { weak var tableView: UITableView? -// private var expandServerDomainSet = Set() - var mastodonPinBasedAuthenticationViewController: UIViewController? init(context: AppContext, mode: PickServerMode) { diff --git a/Mastodon/Scene/Onboarding/PickServer/TableViewCell/PickServerCell.swift b/Mastodon/Scene/Onboarding/PickServer/TableViewCell/PickServerCell.swift index 711822186..0ded9392f 100644 --- a/Mastodon/Scene/Onboarding/PickServer/TableViewCell/PickServerCell.swift +++ b/Mastodon/Scene/Onboarding/PickServer/TableViewCell/PickServerCell.swift @@ -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), diff --git a/MastodonSDK/Sources/MastodonSDK/Entity/Mastodon+Entity+Instance.swift b/MastodonSDK/Sources/MastodonSDK/Entity/Mastodon+Entity+Instance.swift index 18e41b3e0..226af40f8 100644 --- a/MastodonSDK/Sources/MastodonSDK/Entity/Mastodon+Entity+Instance.swift +++ b/MastodonSDK/Sources/MastodonSDK/Entity/Mastodon+Entity+Instance.swift @@ -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"