Skip to content

Commit

Permalink
Only allow single emojis for reactions
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesrisberg committed Mar 30, 2018
1 parent 2bda4de commit ab92d9c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion Emojr/EmoteView.swift
Expand Up @@ -64,7 +64,7 @@ class EmoteView: UIView {
}

@IBAction func emoteButtonTouched() {
if let post = emojiField.text?.emojiString {
if let post = emojiField.text?.emojiString, !post.isEmpty {
emojiField.text = ""
controller!.postFormReturnedPost(post)
}
Expand Down Expand Up @@ -97,6 +97,12 @@ extension EmoteView: UITextFieldDelegate {
}

func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool {
if reacting && !string.isEmpty {
if let text = textField.text, text.glyphCount > 0 && text.isSingleEmoji {
return false
}
}

return emojiSearchView.textField(textField, shouldChangeCharactersIn: range, replacementString: string)
}
}

0 comments on commit ab92d9c

Please sign in to comment.