-
-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adds support for skin variants #2
base: master
Are you sure you want to change the base?
Conversation
This is fantastic, thank you for doing this! I will try to review soon. |
# Does the `EmojiChar` have an alternate skin variant encoding? | ||
# | ||
# @return [Boolean] | ||
def skin_variant? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the number of possible skin variations is constant (either N>1 or 0), this method name should probably be plural, e.g. skin_variations?
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That was my initial thought as well, though there's the variant?
which also checks if there's > 0
variants. So I decided to match the name.
Added some line notes. |
Some additional questions:
Thanks for bearing with me on this, this actually represents a very large upgrade for EmojiData (again, thank you!), so we need to make sure its bulletproof before pulling in and subsequently porting the logic to other platforms. |
@@ -30,6 +30,7 @@ | |||
@usflag = EmojiChar.new({'unified' => '1F1FA-1F1F8'}) | |||
@hourglass = EmojiChar.new({'unified' => '231B', 'variations' => ['231B-FE0F']}) | |||
@cloud = EmojiChar.new({'unified' => '2601', 'variations' => ['2601-FE0F']}) | |||
@ear = EmojiChar.new({'unified' => '1F442', 'skin_variations' => { '1F442-1F3FF' => { 'unified' => '1F442-1F3FF' }}}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For these, I like to mock what we would actually get when parsing emojidata library, so although its going to be verbose we should do this with the full identical list of variations we get for an ear when importing the vendored data.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would that apply to the other EmojiChar instances as well?
@bendikt Apologies, I finally have time to get back to this. I appreciate massively the work you've done. 🙇 I've re-reviewed this in more detail now. My thinking in terms of where we would go from here:
Is this something you'd be willing to take on? (I promise I can be more active in reviewing now! Including pairing if helpful). |
Just a heads up re: updating to latest emoji-data json. There appear to be characters in there that are regular expression special characters and lead to this error when creating
I'm guessing it's the FBS_REGEXP = Regexp.new(
"(?:#{EmojiData.chars({include_variants: true}).map{|ec| Regexp.escape(ec)}.join("|")})"
) More than happy to create a PR for updating the json with this fix in the near future. |
You might want to look at If there's any way I could help with merging in this and #4 so we can recognize new emoji, I'd be happy to volunteer! |
@bhollis if you want to give it a stab, I'd be grateful! I've been pretty tied up with a number of other projects and this has been lower priority. (We can chat on IRC or whatnot if that would help coordination. I'm typically on freenode in |
This pull request adds support for skin variants which will land in iOS 8.3 and OS X 10.10.3
To get this working I had to add some additional methods added to EmojiChar and update the emoji.json
I'll happily adjust the code should there be any issues with it.
Thanks for building this in the first place. This literally saved my sanity today.