mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 21:33:26 +00:00
RTL and LTR mixed languages fix for optimal timestamp support (#1055)
* fix * fixed RTL and LTR timestamp for all the cases! also improved the testing * changelog * better and less convoluted solution * Update ElementX/Sources/Screens/RoomScreen/View/Timeline/FormattedBodyText.swift Co-authored-by: Alfonso Grillo <alfogrillo@gmail.com> * pr suggestion and removed prefix in reality it creates more issues than improvements, and is not really needed --------- Co-authored-by: Alfonso Grillo <alfogrillo@gmail.com>
This commit is contained in:
@@ -64,15 +64,12 @@ extension String {
|
||||
}
|
||||
|
||||
extension String {
|
||||
static func generateBreakableWhitespaceEnd(whitespaceCount: Int, isRTL: Bool) -> String {
|
||||
static func generateBreakableWhitespaceEnd(whitespaceCount: Int, layoutDirection: LayoutDirection) -> String {
|
||||
guard whitespaceCount > 0 else {
|
||||
return ""
|
||||
}
|
||||
|
||||
var whiteSpaces = ""
|
||||
if isRTL {
|
||||
whiteSpaces = "\u{202e}"
|
||||
}
|
||||
var whiteSpaces = layoutDirection.isolateLayoutUnicodeString
|
||||
|
||||
// fixed size whitespace of size 1/3 em per character
|
||||
whiteSpaces += String(repeating: "\u{2004}", count: whitespaceCount)
|
||||
|
||||
Reference in New Issue
Block a user