2019-09-06 02:30:58 +00:00
|
|
|
//
|
|
|
|
// AccountListTableViewController.swift
|
|
|
|
// Tusker
|
|
|
|
//
|
|
|
|
// Created by Shadowfacts on 9/5/19.
|
|
|
|
// Copyright © 2019 Shadowfacts. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
import UIKit
|
|
|
|
|
2019-09-06 21:45:49 +00:00
|
|
|
class AccountListTableViewController: EnhancedTableViewController {
|
2019-09-06 02:30:58 +00:00
|
|
|
|
|
|
|
private let accountCell = "accountCell"
|
|
|
|
|
2020-01-05 20:25:07 +00:00
|
|
|
let mastodonController: MastodonController
|
|
|
|
|
2019-09-06 02:30:58 +00:00
|
|
|
let accountIDs: [String]
|
|
|
|
|
2020-01-05 20:25:07 +00:00
|
|
|
init(accountIDs: [String], mastodonController: MastodonController) {
|
2019-09-06 02:30:58 +00:00
|
|
|
self.accountIDs = accountIDs
|
2020-01-05 20:25:07 +00:00
|
|
|
self.mastodonController = mastodonController
|
2019-09-06 02:30:58 +00:00
|
|
|
|
2019-09-06 21:45:49 +00:00
|
|
|
super.init(style: .grouped)
|
2019-09-06 02:30:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
required init?(coder: NSCoder) {
|
|
|
|
fatalError("init(coder:) has not been implemented")
|
|
|
|
}
|
|
|
|
|
|
|
|
override func viewDidLoad() {
|
|
|
|
super.viewDidLoad()
|
|
|
|
|
2021-02-07 16:34:04 +00:00
|
|
|
dragEnabled = true
|
|
|
|
|
2019-09-06 02:30:58 +00:00
|
|
|
tableView.register(UINib(nibName: "AccountTableViewCell", bundle: .main), forCellReuseIdentifier: accountCell)
|
|
|
|
|
2020-05-13 02:24:51 +00:00
|
|
|
tableView.rowHeight = UITableView.automaticDimension
|
|
|
|
tableView.estimatedRowHeight = 66
|
2019-09-06 03:16:45 +00:00
|
|
|
|
|
|
|
tableView.alwaysBounceVertical = true
|
|
|
|
|
|
|
|
tableView.tableHeaderView = UIView(frame: CGRect(x: 0, y: 0, width: 0, height: CGFloat.leastNormalMagnitude))
|
2019-09-06 02:30:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// MARK: - Table view data source
|
|
|
|
|
|
|
|
override func numberOfSections(in tableView: UITableView) -> Int {
|
|
|
|
return 1
|
|
|
|
}
|
|
|
|
|
|
|
|
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
|
|
|
|
return accountIDs.count
|
|
|
|
}
|
|
|
|
|
|
|
|
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
|
|
|
|
guard let cell = tableView.dequeueReusableCell(withIdentifier: accountCell, for: indexPath) as? AccountTableViewCell else { fatalError() }
|
|
|
|
|
|
|
|
let id = accountIDs[indexPath.row]
|
|
|
|
cell.delegate = self
|
2020-01-06 00:54:28 +00:00
|
|
|
cell.updateUI(accountID: id)
|
2019-09-06 02:30:58 +00:00
|
|
|
|
|
|
|
return cell
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2020-01-05 20:25:07 +00:00
|
|
|
extension AccountListTableViewController: TuskerNavigationDelegate {
|
|
|
|
var apiController: MastodonController { mastodonController }
|
|
|
|
}
|
2022-05-02 03:04:56 +00:00
|
|
|
|
|
|
|
extension AccountListTableViewController: ToastableViewController {
|
|
|
|
}
|
|
|
|
|
|
|
|
extension AccountListTableViewController: MenuActionProvider {
|
|
|
|
}
|