Remove obsolete code (#540)

This commit is contained in:
Nathan Mattes 2022-11-09 16:13:05 +01:00
parent 83de4049d8
commit 2d17253c65
4 changed files with 5 additions and 23 deletions

View File

@ -18,16 +18,14 @@ enum PickServerSection: Equatable, Hashable {
extension PickServerSection {
static func tableViewDiffableDataSource(
for tableView: UITableView,
dependency: NeedsDependency,
pickServerCellDelegate: PickServerCellDelegate
dependency: NeedsDependency
) -> UITableViewDiffableDataSource<PickServerSection, PickServerItem> {
tableView.register(OnboardingHeadlineTableViewCell.self, forCellReuseIdentifier: String(describing: OnboardingHeadlineTableViewCell.self))
tableView.register(PickServerCell.self, forCellReuseIdentifier: String(describing: PickServerCell.self))
tableView.register(PickServerLoaderTableViewCell.self, forCellReuseIdentifier: String(describing: PickServerLoaderTableViewCell.self))
return UITableViewDiffableDataSource(tableView: tableView) { [
weak dependency,
weak pickServerCellDelegate
weak dependency
] tableView, indexPath, item -> UITableViewCell? in
guard let _ = dependency else { return nil }
switch item {
@ -37,7 +35,6 @@ extension PickServerSection {
case .server(let server, let attribute):
let cell = tableView.dequeueReusableCell(withIdentifier: String(describing: PickServerCell.self), for: indexPath) as! PickServerCell
PickServerSection.configure(cell: cell, server: server, attribute: attribute)
cell.delegate = pickServerCellDelegate
return cell
case .loader(let attribute):
let cell = tableView.dequeueReusableCell(withIdentifier: String(describing: PickServerLoaderTableViewCell.self), for: indexPath) as! PickServerLoaderTableViewCell

View File

@ -143,8 +143,7 @@ extension MastodonPickServerViewController {
viewModel.setupDiffableDataSource(
for: tableView,
dependency: self,
pickServerServerSectionTableHeaderViewDelegate: self,
pickServerCellDelegate: self
pickServerServerSectionTableHeaderViewDelegate: self
)
KeyboardResponderService
@ -504,11 +503,6 @@ extension MastodonPickServerViewController: PickServerServerSectionTableHeaderVi
}
}
// MARK: - PickServerCellDelegate
extension MastodonPickServerViewController: PickServerCellDelegate {
}
// MARK: - OnboardingViewControllerAppearance
extension MastodonPickServerViewController: OnboardingViewControllerAppearance { }

View File

@ -13,8 +13,7 @@ extension MastodonPickServerViewModel {
func setupDiffableDataSource(
for tableView: UITableView,
dependency: NeedsDependency,
pickServerServerSectionTableHeaderViewDelegate: PickServerServerSectionTableHeaderViewDelegate,
pickServerCellDelegate: PickServerCellDelegate
pickServerServerSectionTableHeaderViewDelegate: PickServerServerSectionTableHeaderViewDelegate
) {
// set section header
serverSectionHeaderView.diffableDataSource = CategoryPickerSection.collectionViewDiffableDataSource(
@ -34,8 +33,7 @@ extension MastodonPickServerViewModel {
// set tableView
diffableDataSource = PickServerSection.tableViewDiffableDataSource(
for: tableView,
dependency: dependency,
pickServerCellDelegate: pickServerCellDelegate
dependency: dependency
)
var snapshot = NSDiffableDataSourceSnapshot<PickServerSection, PickServerItem>()

View File

@ -14,15 +14,8 @@ import Kanna
import MastodonAsset
import MastodonLocalization
//TODO: @zeitschlag Remove Delegate
protocol PickServerCellDelegate: AnyObject {
// func pickServerCell(_ cell: PickServerCell, expandButtonPressed button: UIButton)
}
class PickServerCell: UITableViewCell {
weak var delegate: PickServerCellDelegate?
var disposeBag = Set<AnyCancellable>()
let containerView: UIStackView = {