Issue-1206 - Remove unneccessary view model

This commit is contained in:
Ali Ali 2024-05-06 20:52:40 +10:00
parent 8d97b5a51e
commit eef7c04912
3 changed files with 6 additions and 16 deletions

View File

@ -217,6 +217,7 @@ GEM
PLATFORMS PLATFORMS
arm64-darwin-21 arm64-darwin-21
arm64-darwin-22 arm64-darwin-22
arm64-darwin-23
x86_64-darwin-21 x86_64-darwin-21
x86_64-darwin-22 x86_64-darwin-22

View File

@ -50,7 +50,7 @@ extension ReportSection {
context: context, context: context,
tableView: tableView, tableView: tableView,
cell: cell, cell: cell,
viewModel: .init(value: status), status: status,
configuration: configuration configuration: configuration
) )
return cell return cell
@ -86,7 +86,7 @@ extension ReportSection {
context: AppContext, context: AppContext,
tableView: UITableView, tableView: UITableView,
cell: ReportStatusTableViewCell, cell: ReportStatusTableViewCell,
viewModel: ReportStatusTableViewCell.ViewModel, status: MastodonStatus,
configuration: Configuration configuration: Configuration
) { ) {
StatusSection.setupStatusPollDataSource( StatusSection.setupStatusPollDataSource(
@ -100,7 +100,7 @@ extension ReportSection {
cell.configure( cell.configure(
tableView: tableView, tableView: tableView,
viewModel: viewModel status: status
) )
} }

View File

@ -8,29 +8,18 @@
import UIKit import UIKit
import MastodonSDK import MastodonSDK
extension ReportStatusTableViewCell {
// todo: refactor / remove this
final class ViewModel {
let value: MastodonStatus
init(value: MastodonStatus) {
self.value = value
}
}
}
extension ReportStatusTableViewCell { extension ReportStatusTableViewCell {
func configure( func configure(
tableView: UITableView, tableView: UITableView,
viewModel: ViewModel status: MastodonStatus
) { ) {
if statusView.frame == .zero { if statusView.frame == .zero {
// set status view width // set status view width
statusView.frame.size.width = tableView.frame.width - ReportStatusTableViewCell.checkboxLeadingMargin - ReportStatusTableViewCell.checkboxSize.width - ReportStatusTableViewCell.statusViewLeadingSpacing statusView.frame.size.width = tableView.frame.width - ReportStatusTableViewCell.checkboxLeadingMargin - ReportStatusTableViewCell.checkboxSize.width - ReportStatusTableViewCell.statusViewLeadingSpacing
} }
statusView.configure(status: viewModel.value) statusView.configure(status: status)
statusView.viewModel.$isContentReveal statusView.viewModel.$isContentReveal
.removeDuplicates() .removeDuplicates()