From 7705e54e679f5e57ccd9d548381a9313334fba8a Mon Sep 17 00:00:00 2001 From: CMK Date: Tue, 16 Mar 2021 11:23:19 +0800 Subject: [PATCH] chore: renaming --- Mastodon/Diffiable/Item/ComposeStatusItem.swift | 8 ++++---- Mastodon/Diffiable/Section/ComposeStatusSection.swift | 4 ++-- Mastodon/Scene/Compose/ComposeViewController.swift | 2 +- Mastodon/Scene/Compose/ComposeViewModel+Diffable.swift | 8 ++++---- Mastodon/Scene/Compose/ComposeViewModel.swift | 2 +- .../HomeTimelineViewController+DebugAction.swift | 8 ++++---- 6 files changed, 16 insertions(+), 16 deletions(-) diff --git a/Mastodon/Diffiable/Item/ComposeStatusItem.swift b/Mastodon/Diffiable/Item/ComposeStatusItem.swift index 812a27a6f..79655b946 100644 --- a/Mastodon/Diffiable/Item/ComposeStatusItem.swift +++ b/Mastodon/Diffiable/Item/ComposeStatusItem.swift @@ -10,14 +10,14 @@ import Combine import CoreData enum ComposeStatusItem { - case replyTo(tootObjectID: NSManagedObjectID) - case toot(replyToTootObjectID: NSManagedObjectID?, attribute: ComposeTootAttribute) + case replyTo(statusObjectID: NSManagedObjectID) + case input(replyToStatusObjectID: NSManagedObjectID?, attribute: ComposeStatusAttribute) } extension ComposeStatusItem: Hashable { } extension ComposeStatusItem { - final class ComposeTootAttribute: Equatable, Hashable { + final class ComposeStatusAttribute: Equatable, Hashable { private let id = UUID() let avatarURL = CurrentValueSubject(nil) @@ -25,7 +25,7 @@ extension ComposeStatusItem { let username = CurrentValueSubject(nil) let composeContent = CurrentValueSubject(nil) - static func == (lhs: ComposeTootAttribute, rhs: ComposeTootAttribute) -> Bool { + static func == (lhs: ComposeStatusAttribute, rhs: ComposeStatusAttribute) -> Bool { return lhs.avatarURL.value == rhs.avatarURL.value && lhs.displayName.value == rhs.displayName.value && lhs.username.value == rhs.username.value && diff --git a/Mastodon/Diffiable/Section/ComposeStatusSection.swift b/Mastodon/Diffiable/Section/ComposeStatusSection.swift index ce08fc009..835007dcc 100644 --- a/Mastodon/Diffiable/Section/ComposeStatusSection.swift +++ b/Mastodon/Diffiable/Section/ComposeStatusSection.swift @@ -37,7 +37,7 @@ extension ComposeStatusSection { let cell = tableView.dequeueReusableCell(withIdentifier: String(describing: ComposeRepliedToTootContentTableViewCell.self), for: indexPath) as! ComposeRepliedToTootContentTableViewCell // TODO: return cell - case .toot(let replyToTootObjectID, let attribute): + case .input(let replyToTootObjectID, let attribute): let cell = tableView.dequeueReusableCell(withIdentifier: String(describing: ComposeTootContentTableViewCell.self), for: indexPath) as! ComposeTootContentTableViewCell managedObjectContext.perform { guard let replyToTootObjectID = replyToTootObjectID, @@ -67,7 +67,7 @@ extension ComposeStatusSection { extension ComposeStatusSection { static func configure( cell: ComposeTootContentTableViewCell, - attribute: ComposeStatusItem.ComposeTootAttribute + attribute: ComposeStatusItem.ComposeStatusAttribute ) { // set avatar attribute.avatarURL diff --git a/Mastodon/Scene/Compose/ComposeViewController.swift b/Mastodon/Scene/Compose/ComposeViewController.swift index 7ad5f7174..84531b114 100644 --- a/Mastodon/Scene/Compose/ComposeViewController.swift +++ b/Mastodon/Scene/Compose/ComposeViewController.swift @@ -176,7 +176,7 @@ extension ComposeViewController { let items = diffableDataSource.snapshot().itemIdentifiers for item in items { switch item { - case .toot: + case .input: guard let indexPath = diffableDataSource.indexPath(for: item), let cell = tableView.cellForRow(at: indexPath) as? ComposeTootContentTableViewCell else { continue diff --git a/Mastodon/Scene/Compose/ComposeViewModel+Diffable.swift b/Mastodon/Scene/Compose/ComposeViewModel+Diffable.swift index b175aaca1..a3a0515e6 100644 --- a/Mastodon/Scene/Compose/ComposeViewModel+Diffable.swift +++ b/Mastodon/Scene/Compose/ComposeViewModel+Diffable.swift @@ -26,11 +26,11 @@ extension ComposeViewModel { var snapshot = NSDiffableDataSourceSnapshot() snapshot.appendSections([.repliedTo, .status]) switch composeKind { - case .reply(let tootObjectID): - snapshot.appendItems([.replyTo(tootObjectID: tootObjectID)], toSection: .repliedTo) - snapshot.appendItems([.toot(replyToTootObjectID: tootObjectID, attribute: composeTootAttribute)], toSection: .status) + case .reply(let statusObjectID): + snapshot.appendItems([.replyTo(statusObjectID: statusObjectID)], toSection: .repliedTo) + snapshot.appendItems([.input(replyToStatusObjectID: statusObjectID, attribute: composeStatusAttribute)], toSection: .repliedTo) case .post: - snapshot.appendItems([.toot(replyToTootObjectID: nil, attribute: composeTootAttribute)], toSection: .status) + snapshot.appendItems([.input(replyToStatusObjectID: nil, attribute: composeStatusAttribute)], toSection: .status) } diffableDataSource.apply(snapshot, animatingDifferences: false) } diff --git a/Mastodon/Scene/Compose/ComposeViewModel.swift b/Mastodon/Scene/Compose/ComposeViewModel.swift index 097de6ae5..a357b8740 100644 --- a/Mastodon/Scene/Compose/ComposeViewModel.swift +++ b/Mastodon/Scene/Compose/ComposeViewModel.swift @@ -17,7 +17,7 @@ final class ComposeViewModel { // input let context: AppContext let composeKind: ComposeStatusSection.ComposeKind - let composeTootAttribute = ComposeStatusItem.ComposeTootAttribute() + let composeStatusAttribute = ComposeStatusItem.ComposeStatusAttribute() let composeContent = CurrentValueSubject("") let activeAuthentication: CurrentValueSubject diff --git a/Mastodon/Scene/HomeTimeline/HomeTimelineViewController+DebugAction.swift b/Mastodon/Scene/HomeTimeline/HomeTimelineViewController+DebugAction.swift index 08696db9d..548409fbc 100644 --- a/Mastodon/Scene/HomeTimeline/HomeTimelineViewController+DebugAction.swift +++ b/Mastodon/Scene/HomeTimeline/HomeTimelineViewController+DebugAction.swift @@ -76,9 +76,9 @@ extension HomeTimelineViewController { identifier: nil, options: [], children: [50, 100, 150, 200, 250, 300].map { count in - UIAction(title: "Drop Recent \(count) Toots", image: nil, attributes: [], handler: { [weak self] action in + UIAction(title: "Drop Recent \(count) Statuses", image: nil, attributes: [], handler: { [weak self] action in guard let self = self else { return } - self.dropRecentTootsAction(action, count: count) + self.dropRecentStatusAction(action, count: count) }) } ) @@ -118,11 +118,11 @@ extension HomeTimelineViewController { tableView.scrollToRow(at: IndexPath(row: index, section: 0), at: .middle, animated: true) tableView.blinkRow(at: IndexPath(row: index, section: 0)) } else { - print("Not found poll toot") + print("Not found status contains poll") } } - @objc private func dropRecentTootsAction(_ sender: UIAction, count: Int) { + @objc private func dropRecentStatusAction(_ sender: UIAction, count: Int) { guard let diffableDataSource = viewModel.diffableDataSource else { return } let snapshotTransitioning = diffableDataSource.snapshot()