[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:
Julien K
2018-10-26 12:15:27 +02:00
parent 095abe0223
commit 77e9ccda46
8 changed files with 284 additions and 20 deletions
@@ -46,7 +46,7 @@ final internal class SampleData {
let messageImages: [UIImage] = [#imageLiteral(resourceName: "img1"), #imageLiteral(resourceName: "img2")]
let messageTypes = ["Text", "Text", "Text", "AttributedText", "Location", "Photo", "Emoji", "Video", "URL", "Phone", "Custom"]
let messageTypes = ["Text", "Text", "Text", "AttributedText", "Location", "Photo", "Emoji", "Video", "URL", "Phone", "Mention", "Hashtag", "Custom"]
let emojis = [
"👍",
@@ -150,6 +150,10 @@ final internal class SampleData {
return MockMessage(text: "https://github.com/MessageKit", sender: sender, messageId: uniqueID, date: date)
case "Phone":
return MockMessage(text: "123-456-7890", sender: sender, messageId: uniqueID, date: date)
case "Mention":
return MockMessage(text: "@messagekit", sender: sender, messageId: uniqueID, date: date)
case "Hashtag":
return MockMessage(text: "#messagekit", sender: sender, messageId: uniqueID, date: date)
case "Custom":
return MockMessage(custom: "Someone left the conversation", sender: system, messageId: uniqueID, date: date)
default: