signal-desktop/js/modules/emojis.js

30 lines
585 B
JavaScript
Raw Normal View History

2020-10-30 20:34:04 +00:00
// Copyright 2019-2020 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
2019-05-24 23:58:27 +00:00
const { take } = require('lodash');
const { getRecentEmojis } = require('../../ts/sql/Client').default;
2019-05-24 23:58:27 +00:00
module.exports = {
getInitialState,
load,
};
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;
}