mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-24 07:05:35 +00:00
Refactoring
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
import Foundation
|
||||
import UIKit
|
||||
import Postbox
|
||||
import TelegramCore
|
||||
|
||||
public struct MessageMediaEditingOptions: OptionSet {
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import Foundation
|
||||
import TextFormat
|
||||
import Postbox
|
||||
import TelegramCore
|
||||
import AccountContext
|
||||
|
||||
@@ -78,7 +77,7 @@ public func chatTextInputAddLinkAttribute(_ state: ChatTextInputState, selection
|
||||
}
|
||||
}
|
||||
|
||||
public func chatTextInputAddMentionAttribute(_ state: ChatTextInputState, peer: Peer) -> ChatTextInputState {
|
||||
public func chatTextInputAddMentionAttribute(_ state: ChatTextInputState, peer: EnginePeer) -> ChatTextInputState {
|
||||
let inputText = NSMutableAttributedString(attributedString: state.inputText)
|
||||
|
||||
let range = NSMakeRange(state.selectionRange.startIndex, state.selectionRange.endIndex - state.selectionRange.startIndex)
|
||||
@@ -91,9 +90,9 @@ public func chatTextInputAddMentionAttribute(_ state: ChatTextInputState, peer:
|
||||
let selectionPosition = range.lowerBound + (replacementText as NSString).length
|
||||
|
||||
return ChatTextInputState(inputText: inputText, selectionRange: selectionPosition ..< selectionPosition)
|
||||
} else if !EnginePeer(peer).compactDisplayTitle.isEmpty {
|
||||
} else if !peer.compactDisplayTitle.isEmpty {
|
||||
let replacementText = NSMutableAttributedString()
|
||||
replacementText.append(NSAttributedString(string: EnginePeer(peer).compactDisplayTitle, attributes: [ChatTextInputAttributes.textMention: ChatTextInputTextMentionAttribute(peerId: peer.id)]))
|
||||
replacementText.append(NSAttributedString(string: peer.compactDisplayTitle, attributes: [ChatTextInputAttributes.textMention: ChatTextInputTextMentionAttribute(peerId: peer.id)]))
|
||||
replacementText.append(NSAttributedString(string: " "))
|
||||
|
||||
let updatedRange = NSRange(location: range.location , length: range.length)
|
||||
|
||||
Reference in New Issue
Block a user