2022-09-30 13:28:09 +02:00
|
|
|
//
|
|
|
|
// ComposeContentViewModel.swift
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// Created by MainasuK on 22/9/30.
|
|
|
|
//
|
|
|
|
|
|
|
|
import Foundation
|
2022-10-10 13:14:52 +02:00
|
|
|
import CoreDataStack
|
2022-09-30 13:28:09 +02:00
|
|
|
import MastodonCore
|
|
|
|
|
2022-10-10 13:14:52 +02:00
|
|
|
public final class ComposeContentViewModel: NSObject, ObservableObject {
|
|
|
|
|
|
|
|
// tableViewCell
|
|
|
|
let composeReplyToTableViewCell = ComposeReplyToTableViewCell()
|
2022-09-30 13:28:09 +02:00
|
|
|
|
|
|
|
// input
|
|
|
|
let context: AppContext
|
2022-10-10 13:14:52 +02:00
|
|
|
let kind: Kind
|
|
|
|
|
|
|
|
public init(
|
|
|
|
context: AppContext,
|
|
|
|
kind: Kind
|
|
|
|
) {
|
2022-09-30 13:28:09 +02:00
|
|
|
self.context = context
|
2022-10-10 13:14:52 +02:00
|
|
|
self.kind = kind
|
|
|
|
super.init()
|
|
|
|
// end init
|
2022-09-30 13:28:09 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2022-10-10 13:14:52 +02:00
|
|
|
|
|
|
|
extension ComposeContentViewModel {
|
|
|
|
public enum Kind {
|
|
|
|
case post
|
|
|
|
case hashtag(hashtag: String)
|
|
|
|
case mention(user: ManagedObjectRecord<MastodonUser>)
|
|
|
|
case reply(status: ManagedObjectRecord<Status>)
|
|
|
|
}
|
|
|
|
|
|
|
|
public enum ViewState {
|
|
|
|
case fold // snap to input
|
|
|
|
case expand // snap to reply
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|