onmyway133 / Smile

:smile: Emoji in Swift
https://onmyway133.com/apps/
Other
519 stars 45 forks source link

Some emoji is missing #10

Open aleksandrshoshiashvili opened 6 years ago

aleksandrshoshiashvili commented 6 years ago

For example: ⏰⌛️💳🆙...

I suggest to update switch:

switch value {
        case 0x1F600...0x1F64F,
             0x1F300...0x1F5FF,
             0x1F680...0x1F6FF,
             0x1F1E6...0x1F1FF,
             0x2600...0x26FF,
             0x2700...0x27BF,
             0xFE00...0xFE0F,
             0x1F900...0x1F9FF,
             65024...65039,
             8400...8447,
             9100...9300,
             127000...127600:
            return true
        default:
            return false
        }
Francescu commented 6 years ago

Thanks @aleksandrshoshiashvili

I pushed a first fix for this.

When I tried

XCTAssertEqual(Smile.extractEmojis(string: "Hello ⏰⌛️💳🆙."), "⏰⌛️💳🆙")

I got

XCTAssertEqual failed: ("⏰️💳🆙") is not equal to ("⏰⌛️💳🆙")

Only ⌛️ seems to bug.

Which function failed with the other emojis?

Also, thanks a lot for the unicode ranges! Where did you get those from?

aleksandrshoshiashvili commented 6 years ago

@Francescu I tested the validator for TextField by entering all the emoji one by one, so I found out that Smile.isEmoji returned wrong result for some of them. I printed their unicodes and update switch according to it :)

Unfortunately, I forgot what exactly the emoji are wrong, because I did it couple of weeks ago, just decided to share my finding with you.

Francescu commented 6 years ago

@aleksandrshoshiashvili wow, nice! Thanks a lot for the answers.

I'll dig more and use the isEmoji function to tests the emojis.