From b67cb61fd86f39bec904c8a7b90dbb257ea00882 Mon Sep 17 00:00:00 2001 From: jk234ert Date: Thu, 25 Feb 2021 16:52:41 +0800 Subject: [PATCH] chore: fix conflicts --- Mastodon/Scene/PickServer/PickServerViewController.swift | 5 +++-- Mastodon/Scene/PickServer/TableViewCell/PickServerCell.swift | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Mastodon/Scene/PickServer/PickServerViewController.swift b/Mastodon/Scene/PickServer/PickServerViewController.swift index a42a623f..d02276f3 100644 --- a/Mastodon/Scene/PickServer/PickServerViewController.swift +++ b/Mastodon/Scene/PickServer/PickServerViewController.swift @@ -120,7 +120,7 @@ extension PickServerViewController { .receive(on: DispatchQueue.main) .sink { [weak self] error in guard let self = self else { return } - let alertController = UIAlertController(error, preferredStyle: .alert) + let alertController = UIAlertController(for: error, title: "Error", preferredStyle: .alert) let okAction = UIAlertAction(title: L10n.Common.Controls.Actions.ok, style: .default, handler: nil) alertController.addAction(okAction) self.coordinator.present( @@ -385,7 +385,8 @@ extension PickServerViewController: PickServerCellDelegate { } tableView.performBatchUpdates(updates) { _ in - if let modeChangeIndex = self.viewModel.searchedServers.value.firstIndex(where: { $0 == server }) { + // Scroll to fully show the expanded cell, do not scroll when collapse + if newMode == .expand, let modeChangeIndex = self.viewModel.searchedServers.value.firstIndex(where: { $0 == server }), self.tableView.indexPathsForVisibleRows?.last?.row == modeChangeIndex { self.tableView.scrollToRow(at: IndexPath(row: modeChangeIndex, section: 3), at: .bottom, animated: true) } } diff --git a/Mastodon/Scene/PickServer/TableViewCell/PickServerCell.swift b/Mastodon/Scene/PickServer/TableViewCell/PickServerCell.swift index 97fac53b..a6a330ce 100644 --- a/Mastodon/Scene/PickServer/TableViewCell/PickServerCell.swift +++ b/Mastodon/Scene/PickServer/TableViewCell/PickServerCell.swift @@ -243,7 +243,7 @@ extension PickServerCell { checkbox.centerYAnchor.constraint(equalTo: domainLabel.centerYAnchor), descriptionLabel.leadingAnchor.constraint(equalTo: bgView.leadingAnchor, constant: 16), - descriptionLabel.topAnchor.constraint(equalTo: domainLabel.firstBaselineAnchor, constant: 8), + descriptionLabel.topAnchor.constraint(equalTo: domainLabel.firstBaselineAnchor, constant: 8).priority(.defaultHigh), bgView.trailingAnchor.constraint(equalTo: descriptionLabel.trailingAnchor, constant: 16), // Set expandBox constraints