Merge pull request #913 from JulienKode/CustomDetectorType

[DetectorType][MessageLabel] Add custom, mention and hashtag detector type 👻
This commit is contained in:
Nathan Tannar
2019-03-24 17:39:48 -07:00
committed by GitHub
10 changed files with 290 additions and 28 deletions
@@ -279,11 +279,14 @@ extension AdvancedExampleViewController: 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