Made the displayText a property of a Status.
This commit is contained in:
parent
07af483b36
commit
67434c2d0b
@ -37,9 +37,8 @@ final class TwitterStatus: Codable {
|
||||
return "\(userURL)/status/\(idStr)"
|
||||
}
|
||||
|
||||
func renderAsText() -> String? {
|
||||
let statusToRender = retweetedStatus != nil ? retweetedStatus! : self
|
||||
if let text = statusToRender.fullText, let displayRange = statusToRender.displayTextRange, displayRange.count > 1,
|
||||
var displayText: String? {
|
||||
if let text = fullText, let displayRange = displayTextRange, displayRange.count > 1,
|
||||
let startIndex = text.index(text.startIndex, offsetBy: displayRange[0], limitedBy: text.endIndex),
|
||||
let endIndex = text.index(text.startIndex, offsetBy: displayRange[1], limitedBy: text.endIndex) {
|
||||
return String(text[startIndex..<endIndex])
|
||||
@ -48,6 +47,11 @@ final class TwitterStatus: Codable {
|
||||
}
|
||||
}
|
||||
|
||||
func renderAsText() -> String? {
|
||||
let statusToRender = retweetedStatus != nil ? retweetedStatus! : self
|
||||
return statusToRender.displayText
|
||||
}
|
||||
|
||||
func renderAsHTML() -> String? {
|
||||
return nil
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user