Include spoiler text count when applicable (#281)

This commit is contained in:
Sean Goldin 2023-01-22 11:50:45 -06:00 committed by GitHub
parent 29f6bf0579
commit 0ad5f17b5a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View file

@ -201,7 +201,7 @@ struct StatusEditorAccessoryView: View {
}
private var characterCountView: some View {
Text("\((currentInstance.instance?.configuration?.statuses.maxCharacters ?? 500) - viewModel.statusText.string.utf16.count)")
Text("\((currentInstance.instance?.configuration?.statuses.maxCharacters ?? 500) - viewModel.statusText.string.utf16.count - viewModel.spoilerTextCount)")
.foregroundColor(.gray)
.font(.scaledCallout)
}

View file

@ -21,6 +21,10 @@ public class StatusEditorViewModel: ObservableObject {
}
}
var spoilerTextCount: Int {
spoilerOn ? spoilerText.utf16.count : 0
}
@Published var backupStatusText: NSAttributedString?
@Published var showPoll: Bool = false