2019-05-24 23:58:27 +00:00
|
|
|
const { take } = require('lodash');
|
|
|
|
const { getRecentEmojis } = require('./data');
|
2019-07-25 16:28:44 +00:00
|
|
|
const { replaceColons } = require('../../ts/components/emoji/lib');
|
2019-05-24 23:58:27 +00:00
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
getInitialState,
|
|
|
|
load,
|
|
|
|
replaceColons,
|
|
|
|
};
|
|
|
|
|
|
|
|
let initialState = null;
|
|
|
|
|
|
|
|
async function load() {
|
|
|
|
const recents = await getRecentEmojisForRedux();
|
|
|
|
|
|
|
|
initialState = {
|
|
|
|
recents: take(recents, 32),
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
async function getRecentEmojisForRedux() {
|
|
|
|
const recent = await getRecentEmojis();
|
|
|
|
return recent.map(e => e.shortName);
|
|
|
|
}
|
|
|
|
|
|
|
|
function getInitialState() {
|
|
|
|
return initialState;
|
|
|
|
}
|