From eef7c0491261b0e217742fd1bf76c01f8ac77b73 Mon Sep 17 00:00:00 2001 From: Ali Ali Date: Mon, 6 May 2024 20:52:40 +1000 Subject: [PATCH] Issue-1206 - Remove unneccessary view model --- Gemfile.lock | 1 + Mastodon/Diffable/Report/ReportSection.swift | 6 +++--- .../ReportStatusTableViewCell+ViewModel.swift | 15 ++------------- 3 files changed, 6 insertions(+), 16 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 55a766f2b..7aae35fde 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -217,6 +217,7 @@ GEM PLATFORMS arm64-darwin-21 arm64-darwin-22 + arm64-darwin-23 x86_64-darwin-21 x86_64-darwin-22 diff --git a/Mastodon/Diffable/Report/ReportSection.swift b/Mastodon/Diffable/Report/ReportSection.swift index 4461dc2f6..c2fb24936 100644 --- a/Mastodon/Diffable/Report/ReportSection.swift +++ b/Mastodon/Diffable/Report/ReportSection.swift @@ -50,7 +50,7 @@ extension ReportSection { context: context, tableView: tableView, cell: cell, - viewModel: .init(value: status), + status: status, configuration: configuration ) return cell @@ -86,7 +86,7 @@ extension ReportSection { context: AppContext, tableView: UITableView, cell: ReportStatusTableViewCell, - viewModel: ReportStatusTableViewCell.ViewModel, + status: MastodonStatus, configuration: Configuration ) { StatusSection.setupStatusPollDataSource( @@ -100,7 +100,7 @@ extension ReportSection { cell.configure( tableView: tableView, - viewModel: viewModel + status: status ) } diff --git a/Mastodon/Scene/Report/Share/Cell/ReportStatusTableViewCell+ViewModel.swift b/Mastodon/Scene/Report/Share/Cell/ReportStatusTableViewCell+ViewModel.swift index f5078847a..a89d6a2b2 100644 --- a/Mastodon/Scene/Report/Share/Cell/ReportStatusTableViewCell+ViewModel.swift +++ b/Mastodon/Scene/Report/Share/Cell/ReportStatusTableViewCell+ViewModel.swift @@ -8,29 +8,18 @@ import UIKit import MastodonSDK -extension ReportStatusTableViewCell { - // todo: refactor / remove this - final class ViewModel { - let value: MastodonStatus - - init(value: MastodonStatus) { - self.value = value - } - } -} - extension ReportStatusTableViewCell { func configure( tableView: UITableView, - viewModel: ViewModel + status: MastodonStatus ) { if statusView.frame == .zero { // set status view width 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 .removeDuplicates()