diff --git a/src/org/thoughtcrime/securesms/components/emoji/EmojiUtil.java b/src/org/thoughtcrime/securesms/components/emoji/EmojiUtil.java deleted file mode 100644 index 459615223..000000000 --- a/src/org/thoughtcrime/securesms/components/emoji/EmojiUtil.java +++ /dev/null @@ -1,75 +0,0 @@ -package org.thoughtcrime.securesms.components.emoji; - -import androidx.annotation.NonNull; - -import org.thoughtcrime.securesms.util.Pair; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -public final class EmojiUtil { - - private static final Map VARIATION_MAP = new HashMap<>(); - - static { - for (EmojiPageModel page : EmojiPages.DATA_PAGES) { - for (Emoji emoji : page.getDisplayEmoji()) { - for (String variation : emoji.getVariations()) { - VARIATION_MAP.put(variation, emoji.getValue()); - } - } - } - } - - public static final int MAX_EMOJI_LENGTH; - static { - int max = 0; - for (EmojiPageModel page : EmojiPages.DATA_PAGES) { - for (String emoji : page.getEmoji()) { - max = Math.max(max, emoji.length()); - } - } - MAX_EMOJI_LENGTH = max; - } - - private EmojiUtil() {} - - public static List getDisplayPages() { - return EmojiPages.DISPLAY_PAGES; - } - - /** - * This will return all ways we know of expressing a singular emoji. This is to aid in search, - * where some platforms may send an emoji we've locally marked as 'obsolete'. - */ - public static @NonNull Set getAllRepresentations(@NonNull String emoji) { - Set out = new HashSet<>(); - - out.add(emoji); - - for (Pair pair : EmojiPages.OBSOLETE) { - if (pair.first().equals(emoji)) { - out.add(pair.second()); - } else if (pair.second().equals(emoji)) { - out.add(pair.first()); - } - } - - return out; - } - - /** - * When provided an emoji that is a skin variation of another, this will return the default yellow - * version. This is to aid in search, so using a variation will still find all emojis tagged with - * the default version. - * - * If the emoji has no skin variations, this function will return the original emoji. - */ - public static @NonNull String getCanonicalRepresentation(@NonNull String emoji) { - String canonical = VARIATION_MAP.get(emoji); - return canonical != null ? canonical : emoji; - } -}