From ed241d1d42ce5bb9c1967946a81f06600f5ce9f2 Mon Sep 17 00:00:00 2001 From: Peder Johnsen Date: Sat, 23 Mar 2019 15:34:46 +0000 Subject: [PATCH] Revert skin tone emoji on search code --- src/components/picker/nimble-picker.js | 1 - src/components/search.js | 2 +- src/utils/emoji-index/nimble-emoji-index.js | 27 ++++----------------- 3 files changed, 6 insertions(+), 24 deletions(-) diff --git a/src/components/picker/nimble-picker.js b/src/components/picker/nimble-picker.js index 3ccc500..736e92f 100644 --- a/src/components/picker/nimble-picker.js +++ b/src/components/picker/nimble-picker.js @@ -522,7 +522,6 @@ export default class NimblePicker extends React.PureComponent { ref={this.setSearchRef} onSearch={this.handleSearch} data={this.data} - set={set} i18n={this.i18n} emojisToShowFilter={emojisToShowFilter} include={include} diff --git a/src/components/search.js b/src/components/search.js index bfb05ef..b8cbfc8 100644 --- a/src/components/search.js +++ b/src/components/search.js @@ -17,7 +17,7 @@ export default class Search extends React.PureComponent { } this.data = props.data - this.emojiIndex = new NimbleEmojiIndex(this.data, props.set) + this.emojiIndex = new NimbleEmojiIndex(this.data) this.setRef = this.setRef.bind(this) this.clear = this.clear.bind(this) this.handleKeyUp = this.handleKeyUp.bind(this) diff --git a/src/utils/emoji-index/nimble-emoji-index.js b/src/utils/emoji-index/nimble-emoji-index.js index f4a3b90..8b1bdc3 100644 --- a/src/utils/emoji-index/nimble-emoji-index.js +++ b/src/utils/emoji-index/nimble-emoji-index.js @@ -1,15 +1,13 @@ import { getData, getSanitizedData, intersect } from '..' import { uncompress } from '../data' -import store from '../store' export default class NimbleEmojiIndex { - constructor(data, set) { + constructor(data) { if (data.compressed) { uncompress(data) } this.data = data || {} - this.set = set || null this.originalPool = {} this.index = {} this.emojis = {} @@ -22,7 +20,7 @@ export default class NimbleEmojiIndex { buildIndex() { for (let emoji in this.data.emojis) { let emojiData = this.data.emojis[emoji], - { short_names, emoticons, skin_variations } = emojiData, + { short_names, emoticons } = emojiData, id = short_names[0] if (emoticons) { @@ -35,16 +33,7 @@ export default class NimbleEmojiIndex { }) } - // If skin variations include them - if (skin_variations) { - this.emojis[id] = {} - for (let skinTone = 1; skinTone <= 6; skinTone++) { - this.emojis[id][skinTone] = getSanitizedData({id: id, skin: skinTone}, skinTone, this.set, this.data) - } - } else { - this.emojis[id] = getSanitizedData(id, null, this.set, this.data) - } - + this.emojis[id] = getSanitizedData(id, null, null, this.data) this.originalPool[id] = emojiData } } @@ -81,8 +70,6 @@ export default class NimbleEmojiIndex { if (this.customEmojisList != custom) this.addCustomToPool(custom, this.originalPool) - const skinTone = store.get('skin') || 1; - maxResults || (maxResults = 75) include || (include = []) exclude || (exclude = []) @@ -92,7 +79,7 @@ export default class NimbleEmojiIndex { if (value.length) { if (value == '-' || value == '-1') { - return [this.emojis['-1'][skinTone]] + return [this.emojis['-1']] } var values = value.toLowerCase().split(/[\s|,|\-|_]+/), @@ -161,11 +148,7 @@ export default class NimbleEmojiIndex { let score = subIndex + 1 if (sub == id) score = 0 - if (this.emojis[id] && this.emojis[id][skinTone]) { - aIndex.results.push(this.emojis[id][skinTone]) - } else { - aIndex.results.push(this.emojis[id]) - } + aIndex.results.push(this.emojis[id]) aIndex.pool[id] = emoji scores[id] = score