feat: set status content direction if possible. resolve #295

This commit is contained in:
CMK 2021-10-08 19:05:28 +08:00
parent b5052cca5e
commit 58daa930cb
2 changed files with 10 additions and 0 deletions

View File

@ -720,6 +720,15 @@ extension StatusSection {
statusItemAttribute: Item.StatusAttribute
) {
// set content
let paragraphStyle = cell.statusView.contentMetaText.paragraphStyle
if let language = (status.reblog ?? status).language {
let direction = Locale.characterDirection(forLanguage: language)
paragraphStyle.alignment = direction == .rightToLeft ? .right : .left
} else {
paragraphStyle.alignment = .natural
}
cell.statusView.contentMetaText.paragraphStyle = paragraphStyle
if let content = content {
cell.statusView.contentMetaText.configure(content: content)
cell.statusView.contentMetaText.textView.accessibilityLabel = content.trimmed

View File

@ -217,6 +217,7 @@ final class StatusView: UIView {
let style = NSMutableParagraphStyle()
style.lineSpacing = 5
style.paragraphSpacing = 8
style.alignment = .natural
return style
}()
metaText.textAttributes = [