2 Commits

Author SHA1 Message Date
cardoso 33e24166ee Bump version 2020-08-07 11:38:08 -03:00
cardoso 6588647286 Support unicode characters inside shortcode 2020-08-07 11:37:32 -03:00
3 changed files with 6 additions and 3 deletions
+4 -1
View File
@@ -30,5 +30,8 @@ let exampleEmojis: [String: EmojiSource] = [
// aliases
"banana": .alias("banana_dance"),
"parrot": .alias("party_parrot")
"parrot": .alias("party_parrot"),
// unicode inside shortcode
"": .character("😊")
]
+1 -1
View File
@@ -8,7 +8,7 @@
Pod::Spec.new do |s|
s.name = 'Streamoji'
s.version = '0.1.7'
s.version = '0.1.8'
s.summary = 'Custom emoji rendering library for iOS apps with support for GIF & images.'
s.swift_version = '5.2'
@@ -41,7 +41,7 @@ extension NSAttributedString {
}
ranges.append(NSRange(location: lastMatchIndex, length: length - lastMatchIndex))
let regex = try? NSRegularExpression(pattern: ":(\\w|-|\\+)+:", options: [])
let regex = try? NSRegularExpression(pattern: ":(\\w|[^\\x00-\\x7F]+|-|\\+)+:", options: [])
let matchRanges = ranges.map { range in regex?.matches(in: string, options: [], range: range).map { $0.range(at: 0) } ?? [] }
return matchRanges.reduce(into: [NSRange]()) { $0.append(contentsOf: $1) }
}