Various improvements

This commit is contained in:
Ali
2023-10-23 17:41:52 +04:00
parent b43fa0ecb5
commit 75ee418716
14 changed files with 228 additions and 40 deletions

View File

@@ -3382,7 +3382,25 @@ class ChatControllerNode: ASDisplayNode, UIScrollViewDelegate {
if let replyMessageSubject = self.chatPresentationInterfaceState.interfaceState.replyMessageSubject, let quote = replyMessageSubject.quote {
if let replyMessage = self.chatPresentationInterfaceState.replyMessage {
if !replyMessage.text.contains(quote.text) {
let nsText = replyMessage.text as NSString
var startIndex = 0
var found = false
while true {
let range = nsText.range(of: quote.text, range: NSRange(location: startIndex, length: nsText.length - startIndex))
if range.location != NSNotFound {
let subEntities = messageTextEntitiesInRange(entities: replyMessage.textEntitiesAttribute?.entities ?? [], range: range, onlyQuoteable: true)
if subEntities == quote.entities {
found = true
break
}
startIndex = range.upperBound
} else {
break
}
}
if !found {
//TODO:localize
let authorName: String = (replyMessage.author.flatMap(EnginePeer.init))?.compactDisplayTitle ?? ""
let errorTextData = self.chatPresentationInterfaceState.strings.Chat_ErrorQuoteOutdatedText(authorName)