Support additional sticker states
Co-authored-by: scott@signal.org Co-authored-by: ken@signal.org
This commit is contained in:
parent
41880cfe66
commit
be5d0837f8
35 changed files with 925 additions and 249 deletions
|
@ -3,7 +3,7 @@ import { mapDispatchToProps } from '../actions';
|
|||
import { StickerPreviewModal } from '../../components/stickers/StickerPreviewModal';
|
||||
import { StateType } from '../reducer';
|
||||
|
||||
import { getIntl, getStickersPath } from '../selectors/user';
|
||||
import { getIntl, getStickersPath, getTempPath } from '../selectors/user';
|
||||
import {
|
||||
getBlessedPacks,
|
||||
getPacks,
|
||||
|
@ -18,33 +18,17 @@ type ExternalProps = {
|
|||
const mapStateToProps = (state: StateType, props: ExternalProps) => {
|
||||
const { packId } = props;
|
||||
const stickersPath = getStickersPath(state);
|
||||
const tempPath = getTempPath(state);
|
||||
|
||||
const packs = getPacks(state);
|
||||
const blessedPacks = getBlessedPacks(state);
|
||||
const pack = packs[packId];
|
||||
|
||||
if (!pack) {
|
||||
throw new Error(`Cannot find pack ${packId}`);
|
||||
}
|
||||
const translated = translatePackFromDB(
|
||||
pack,
|
||||
packs,
|
||||
blessedPacks,
|
||||
stickersPath
|
||||
);
|
||||
|
||||
return {
|
||||
...props,
|
||||
pack: {
|
||||
...translated,
|
||||
cover: translated.cover
|
||||
? translated.cover
|
||||
: {
|
||||
id: 0,
|
||||
url: 'nonexistent',
|
||||
packId,
|
||||
emoji: 'WTF',
|
||||
},
|
||||
},
|
||||
pack: pack
|
||||
? translatePackFromDB(pack, packs, blessedPacks, stickersPath, tempPath)
|
||||
: undefined,
|
||||
i18n: getIntl(state),
|
||||
};
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue