chore: renaming
This commit is contained in:
parent
1a60428f2a
commit
7705e54e67
|
@ -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<URL?, Never>(nil)
|
||||
|
@ -25,7 +25,7 @@ extension ComposeStatusItem {
|
|||
let username = CurrentValueSubject<String?, Never>(nil)
|
||||
let composeContent = CurrentValueSubject<String?, Never>(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 &&
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -26,11 +26,11 @@ extension ComposeViewModel {
|
|||
var snapshot = NSDiffableDataSourceSnapshot<ComposeStatusSection, ComposeStatusItem>()
|
||||
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)
|
||||
}
|
||||
|
|
|
@ -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<String, Never>("")
|
||||
let activeAuthentication: CurrentValueSubject<MastodonAuthentication?, Never>
|
||||
|
||||
|
|
|
@ -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()
|
||||
|
||||
|
|
Loading…
Reference in New Issue