Remove old emoji and sticker pickers

This commit is contained in:
Jamie
2025-10-07 12:01:24 -07:00
committed by GitHub
parent 8b8f9a8f91
commit b73563ad9d
80 changed files with 533 additions and 4693 deletions

View File

@@ -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;
});
}