Add “Frequently Used” support to custom emojis

release
Etienne Lemay 2017-05-27 13:15:17 -04:00
parent e28dc4da55
commit e95f515268
2 changed files with 12 additions and 2 deletions

View File

@ -72,10 +72,19 @@ export default class Category extends React.Component {
var { name, emojis, perLine } = this.props
if (name == 'Recent') {
let { custom } = this.props
let frequentlyUsed = frequently.get(perLine)
if (frequentlyUsed.length) {
emojis = frequentlyUsed
emojis = frequentlyUsed.map((id) => {
for (let emoji of custom) {
if (emoji.id === id) {
return emoji
}
}
return id
})
}
}

View File

@ -12,7 +12,7 @@ import { Anchors, Category, Emoji, Preview, Search } from '.'
const RECENT_CATEGORY = { name: 'Recent', emojis: null }
const SEARCH_CATEGORY = { name: 'Search', emojis: null, anchor: false }
const CUSTOM_CATEGORY = { name: 'Custom', emojis: null }
const CUSTOM_CATEGORY = { name: 'Custom', emojis: [] }
const I18N = {
search: 'Search',
@ -357,6 +357,7 @@ export default class Picker extends React.Component {
native={native}
hasStickyPosition={this.hasStickyPosition}
i18n={this.i18n}
custom={category.name == 'Recent' ? CUSTOM_CATEGORY.emojis : undefined}
emojiProps={{
native: native,
skin: skin,