mirror of
https://github.com/MessageKit/MessageKit.git
synced 2026-02-06 19:03:19 +00:00
[DetectorType] add .mention, .hashtag and .custon() to detect your own pattern
[DetectorType] Put mention and hashtag as var [CHANGELOG] Update [DetectorType] Update to have at least 4 characters and more [CHANGELOG] Update [DetectorType] [MessageLabel] run NSDataDetector once [MessageLabel] Run NSDataDetector once [Testing] Add testing and pass rangesOfDetectors as internal [Refactoring] [Filter] only .custom [Examples]
This commit is contained in:
@@ -49,11 +49,14 @@ extension BasicExampleViewController: MessagesDisplayDelegate {
|
||||
}
|
||||
|
||||
func detectorAttributes(for detector: DetectorType, and message: MessageType, at indexPath: IndexPath) -> [NSAttributedString.Key: Any] {
|
||||
return MessageLabel.defaultAttributes
|
||||
switch detector {
|
||||
case .hashtag, .mention: return [.foregroundColor: UIColor.blue]
|
||||
default: return MessageLabel.defaultAttributes
|
||||
}
|
||||
}
|
||||
|
||||
func enabledDetectors(for message: MessageType, at indexPath: IndexPath, in messagesCollectionView: MessagesCollectionView) -> [DetectorType] {
|
||||
return [.url, .address, .phoneNumber, .date, .transitInformation]
|
||||
return [.url, .address, .phoneNumber, .date, .transitInformation, .mention, .hashtag]
|
||||
}
|
||||
|
||||
// MARK: - All Messages
|
||||
|
||||
Reference in New Issue
Block a user