Adds message forwarding

This commit is contained in:
Josh Perez 2021-04-27 15:35:35 -07:00 committed by GitHub
parent cd489a35fd
commit d203f125c6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
42 changed files with 1638 additions and 139 deletions

View file

@ -2,11 +2,7 @@
// SPDX-License-Identifier: AGPL-3.0-only
import { omit } from 'lodash';
import { createSelector } from 'reselect';
import { useSelector } from 'react-redux';
import { StateType } from '../reducer';
import * as storageShim from '../../shims/storage';
import { isShortName } from '../../components/emoji/lib';
import { useBoundActions } from '../../util/hooks';
// State
@ -54,6 +50,7 @@ export type ItemsActionType =
// Action Creators
export const actions = {
onSetSkinTone,
putItem,
putItemExternal,
removeItem,
@ -72,6 +69,10 @@ function putItem(key: string, value: unknown): ItemPutAction {
};
}
function onSetSkinTone(tone: number): ItemPutAction {
return putItem('skinTone', tone);
}
function putItemExternal(key: string, value: unknown): ItemPutExternalAction {
return {
type: 'items/PUT_EXTERNAL',
@ -133,13 +134,3 @@ export function reducer(
return state;
}
// Selectors
const selectRecentEmojis = createSelector(
({ emojis }: StateType) => emojis.recents,
recents => recents.filter(isShortName)
);
export const useRecentEmojis = (): Array<string> =>
useSelector(selectRecentEmojis);