feat: fulfill the content warning when compose reply post

This commit is contained in:
CMK 2021-04-19 19:13:20 +08:00
parent 81a1028f20
commit 4041929b3e
2 changed files with 5 additions and 0 deletions

View File

@ -77,6 +77,7 @@ extension ComposeStatusSection {
return cell
case .input(let replyToStatusObjectID, let attribute):
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: String(describing: ComposeStatusContentCollectionViewCell.self), for: indexPath) as! ComposeStatusContentCollectionViewCell
cell.statusContentWarningEditorView.textView.text = attribute.contentWarningContent.value
cell.textEditorView.text = attribute.composeContent.value ?? ""
managedObjectContext.perform {
guard let replyToStatusObjectID = replyToStatusObjectID,

View File

@ -112,6 +112,10 @@ final class ComposeViewModel {
for acct in mentionAccts {
UITextChecker.learnWord(acct)
}
if let spoilerText = status.spoilerText, !spoilerText.isEmpty {
self.isContentWarningComposing.value = true
self.composeStatusAttribute.contentWarningContent.value = spoilerText
}
let initialComposeContent = mentionAccts.joined(separator: " ")
let preInsertedContent: String? = initialComposeContent.isEmpty ? nil : initialComposeContent + " "