mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2026-04-26 03:18:17 +01:00
Remove old emoji and sticker pickers
This commit is contained in:
@@ -3,10 +3,12 @@
|
||||
|
||||
import lodash from 'lodash';
|
||||
import { createLogger } from '../logging/log.js';
|
||||
import { DEFAULT_PREFERRED_REACTION_EMOJI_SHORT_NAMES } from './constants.js';
|
||||
import { convertShortName } from '../components/emoji/lib.js';
|
||||
import { DEFAULT_PREFERRED_REACTION_EMOJI_PARENT_KEYS } from './constants.js';
|
||||
import { isValidReactionEmoji } from './isValidReactionEmoji.js';
|
||||
import type { EmojiSkinTone } from '../components/fun/data/emojis.js';
|
||||
import {
|
||||
getEmojiVariantByParentKeyAndSkinTone,
|
||||
type EmojiSkinTone,
|
||||
} from '../components/fun/data/emojis.js';
|
||||
|
||||
const { times } = lodash;
|
||||
|
||||
@@ -16,7 +18,7 @@ const MAX_STORED_LENGTH = 20;
|
||||
const MAX_ITEM_LENGTH = 20;
|
||||
|
||||
const PREFERRED_REACTION_EMOJI_COUNT =
|
||||
DEFAULT_PREFERRED_REACTION_EMOJI_SHORT_NAMES.length;
|
||||
DEFAULT_PREFERRED_REACTION_EMOJI_PARENT_KEYS.length;
|
||||
|
||||
export function getPreferredReactionEmoji(
|
||||
storedValue: unknown,
|
||||
@@ -32,27 +34,27 @@ export function getPreferredReactionEmoji(
|
||||
return storedItem;
|
||||
}
|
||||
|
||||
const fallbackShortName: undefined | string =
|
||||
DEFAULT_PREFERRED_REACTION_EMOJI_SHORT_NAMES[index];
|
||||
if (!fallbackShortName) {
|
||||
const fallbackParentKey =
|
||||
DEFAULT_PREFERRED_REACTION_EMOJI_PARENT_KEYS.at(index);
|
||||
if (fallbackParentKey == null) {
|
||||
log.error(
|
||||
'Index is out of range. Is the preferred count larger than the list of fallbacks?'
|
||||
);
|
||||
return '❤️';
|
||||
}
|
||||
|
||||
const fallbackEmoji = convertShortName(
|
||||
fallbackShortName,
|
||||
const fallbackEmoji = getEmojiVariantByParentKeyAndSkinTone(
|
||||
fallbackParentKey,
|
||||
emojiSkinToneDefault
|
||||
);
|
||||
if (!fallbackEmoji) {
|
||||
if (fallbackEmoji == null) {
|
||||
log.error(
|
||||
'No fallback emoji. Does the fallback list contain an invalid short name?'
|
||||
);
|
||||
return '❤️';
|
||||
}
|
||||
|
||||
return fallbackEmoji;
|
||||
return fallbackEmoji.value;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user