2022-01-27 14:23:39 +01:00
|
|
|
//
|
|
|
|
// ReportItem.swift
|
|
|
|
// Mastodon
|
|
|
|
//
|
|
|
|
// Created by MainasuK on 2022-1-27.
|
|
|
|
//
|
|
|
|
|
|
|
|
import Foundation
|
2022-02-08 05:36:06 +01:00
|
|
|
import CoreDataStack
|
2022-01-27 14:23:39 +01:00
|
|
|
|
|
|
|
enum ReportItem: Hashable {
|
2022-02-08 05:36:06 +01:00
|
|
|
case header(context: HeaderContext)
|
|
|
|
case status(record: ManagedObjectRecord<Status>)
|
|
|
|
case comment(context: CommentContext)
|
|
|
|
case result(record: ManagedObjectRecord<MastodonUser>)
|
|
|
|
case bottomLoader
|
|
|
|
}
|
|
|
|
|
|
|
|
extension ReportItem {
|
|
|
|
struct HeaderContext: Hashable {
|
|
|
|
let primaryLabelText: String
|
|
|
|
let secondaryLabelText: String
|
|
|
|
}
|
2022-01-27 14:23:39 +01:00
|
|
|
|
2022-02-08 05:36:06 +01:00
|
|
|
class CommentContext: Hashable {
|
|
|
|
let id = UUID()
|
|
|
|
@Published var comment: String = ""
|
|
|
|
|
|
|
|
static func == (
|
|
|
|
lhs: ReportItem.CommentContext,
|
|
|
|
rhs: ReportItem.CommentContext
|
|
|
|
) -> Bool {
|
|
|
|
lhs.comment == rhs.comment
|
|
|
|
}
|
|
|
|
|
|
|
|
func hash(into hasher: inout Hasher) {
|
|
|
|
hasher.combine(id)
|
|
|
|
}
|
|
|
|
}
|
2022-01-27 14:23:39 +01:00
|
|
|
}
|