2022-01-27 14:23:39 +01:00
|
|
|
//
|
|
|
|
// RecommendAccountSection.swift
|
|
|
|
// Mastodon
|
|
|
|
//
|
|
|
|
// Created by sxiaojian on 2021/4/1.
|
|
|
|
//
|
|
|
|
|
|
|
|
import CoreData
|
|
|
|
import CoreDataStack
|
|
|
|
import Foundation
|
|
|
|
import MastodonSDK
|
|
|
|
import UIKit
|
|
|
|
import MetaTextKit
|
|
|
|
import MastodonMeta
|
|
|
|
import Combine
|
2022-10-08 07:43:06 +02:00
|
|
|
import MastodonCore
|
2022-01-27 14:23:39 +01:00
|
|
|
|
|
|
|
enum RecommendAccountSection: Equatable, Hashable {
|
|
|
|
case main
|
|
|
|
}
|
|
|
|
|
2022-02-10 12:30:41 +01:00
|
|
|
extension RecommendAccountSection {
|
|
|
|
|
|
|
|
struct Configuration {
|
2022-10-09 14:07:57 +02:00
|
|
|
let authContext: AuthContext
|
2022-02-10 12:30:41 +01:00
|
|
|
weak var suggestionAccountTableViewCellDelegate: SuggestionAccountTableViewCellDelegate?
|
|
|
|
}
|
|
|
|
|
|
|
|
static func tableViewDiffableDataSource(
|
|
|
|
tableView: UITableView,
|
|
|
|
context: AppContext,
|
|
|
|
configuration: Configuration
|
|
|
|
) -> UITableViewDiffableDataSource<RecommendAccountSection, RecommendAccountItem> {
|
|
|
|
UITableViewDiffableDataSource(tableView: tableView) { tableView, indexPath, item -> UITableViewCell? in
|
|
|
|
let cell = tableView.dequeueReusableCell(withIdentifier: String(describing: SuggestionAccountTableViewCell.self)) as! SuggestionAccountTableViewCell
|
|
|
|
switch item {
|
2023-11-13 14:44:26 +01:00
|
|
|
case .account(let account, let relationship):
|
|
|
|
cell.delegate = configuration.suggestionAccountTableViewCellDelegate
|
|
|
|
cell.configure(account: account, relationship: relationship)
|
2022-02-10 12:30:41 +01:00
|
|
|
}
|
|
|
|
return cell
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|