#[derive(uniffi::Record, Clone, Debug, PartialEq, Eq)]
pub struct EmojiCategorySnapshot {
pub name: String,
pub emojis: Vec<String>,
}
#[derive(uniffi::Record, Clone, Debug, PartialEq, Eq)]
pub struct EmojiAliasSnapshot {
pub emoji: String,
pub keywords: String,
}
fn cat(name: &str, emojis: &[&str]) -> EmojiCategorySnapshot {
EmojiCategorySnapshot {
name: name.to_string(),
emojis: emojis.iter().map(|s| (*s).to_string()).collect(),
}
}
fn alias(emoji: &str, keywords: &str) -> EmojiAliasSnapshot {
EmojiAliasSnapshot {
emoji: emoji.to_string(),
keywords: keywords.to_string(),
}
}
#[uniffi::export]
pub fn iris_emoji_catalog() -> Vec<EmojiCategorySnapshot> {
vec![
cat(
"Smileys",
&[
"๐",
"๐",
"๐",
"๐",
"๐",
"๐
",
"๐คฃ",
"๐",
"๐",
"๐",
"๐ซ ",
"๐",
"๐",
"๐",
"๐ฅฐ",
"๐",
"๐คฉ",
"๐",
"๐",
"โบ๏ธ",
"๐",
"๐",
"๐ฅฒ",
"๐",
"๐",
"๐",
"๐คช",
"๐",
"๐ค",
"๐ค",
"๐คญ",
"๐ซข",
"๐ซฃ",
"๐คซ",
"๐ค",
"๐ซก",
"๐ค",
"๐คจ",
"๐",
"๐",
"๐ถ",
"๐ซฅ",
"๐ถโ๐ซ๏ธ",
"๐",
"๐",
"๐",
"๐ฌ",
"๐ฎโ๐จ",
"๐คฅ",
"๐",
"๐",
"๐ช",
"๐คค",
"๐ด",
"๐ท",
"๐ค",
"๐ค",
"๐คข",
"๐คฎ",
"๐คง",
"๐ฅต",
"๐ฅถ",
"๐ฅด",
"๐ต",
"๐ตโ๐ซ",
"๐คฏ",
"๐ค ",
"๐ฅณ",
"๐ฅธ",
"๐",
"๐ค",
"๐ง",
"๐",
"๐ซค",
"๐",
"๐",
"โน๏ธ",
"๐ฎ",
"๐ฏ",
"๐ฒ",
"๐ณ",
"๐ฅบ",
"๐ฅน",
"๐ฆ",
"๐ง",
"๐จ",
"๐ฐ",
"๐ฅ",
"๐ข",
"๐ญ",
"๐ฑ",
"๐",
"๐ฃ",
"๐",
"๐",
"๐ฉ",
"๐ซ",
"๐ฅฑ",
"๐ค",
"๐ก",
"๐ ",
"๐คฌ",
"๐",
"๐ฟ",
"๐",
"โ ๏ธ",
"๐ฉ",
"๐คก",
"๐น",
"๐บ",
"๐ป",
"๐ฝ",
"๐พ",
"๐ค",
"๐บ",
"๐ธ",
"๐น",
"๐ป",
"๐ผ",
"๐ฝ",
"๐",
"๐ฟ",
"๐พ",
],
),
cat(
"Hearts",
&[
"โค๏ธ",
"๐งก",
"๐",
"๐",
"๐",
"๐",
"๐ค",
"๐ค",
"๐ค",
"๐",
"๐",
"๐",
"๐",
"๐",
"๐",
"๐",
"๐",
"โฅ๏ธ",
"๐",
"โฃ๏ธ",
"โค๏ธโ๐ฅ",
"โค๏ธโ๐ฉน",
],
),
cat(
"Hands",
&[
"๐", "๐", "๐", "๐ค", "๐ค", "โ๏ธ", "๐ค", "๐ซฐ", "๐ค", "๐ค", "๐ค", "๐", "๐", "๐",
"๐", "โ๏ธ", "โ", "๐ค", "๐", "๐", "๐", "๐ค", "๐", "๐", "๐", "๐ซถ", "๐ช", "๐ซต",
"๐ซฑ", "๐ซฒ",
],
),
cat(
"Animals",
&[
"๐ถ", "๐ฑ", "๐ญ", "๐น", "๐ฐ", "๐ฆ", "๐ป", "๐ผ", "๐จ", "๐ฏ", "๐ฆ", "๐ฎ", "๐ท", "๐ธ",
"๐ต", "๐", "๐", "๐", "๐", "๐ง", "๐ฆ", "๐ฆ
", "๐ฆ", "๐ฆ", "๐", "๐ฆ", "๐", "๐ข",
"๐", "๐ฆ", "๐", "๐ฆ", "๐ฌ", "๐ณ", "๐ฆ",
],
),
cat(
"Food",
&[
"๐", "๐", "๐", "๐", "๐", "๐", "๐", "๐", "๐", "๐ซ", "๐", "๐", "๐ฅญ", "๐",
"๐ฅฅ", "๐ฅ", "๐
", "๐ฅ", "๐ฅ", "๐ฝ", "๐", "๐ฅ", "๐", "๐", "๐", "๐ญ", "๐ฟ", "๐ฅช",
"๐ฎ", "๐ฏ", "๐ฃ", "๐", "๐", "๐ฆ", "๐ฉ", "๐ช", "๐", "๐ฐ", "โ", "๐ต", "๐บ", "๐ฅ",
"๐ท", "๐ฅ",
],
),
cat(
"Activities",
&[
"โฝ", "๐", "๐", "โพ", "๐ฅ", "๐พ", "๐", "๐", "๐ฑ", "๐ช", "๐", "๐ธ", "๐ฅ
", "๐",
"๐", "๐ฅ", "๐", "๐ช", "๐ฅ", "๐ฅ", "๐ฝ", "โธ", "๐ฅ", "๐ท", "๐ช", "๐๏ธ", "๐คธ", "๐คบ",
"๐", "โท", "๐", "๐๏ธ", "๐", "๐ฃ", "๐", "๐คฝ", "๐ด", "๐ต", "๐ฏ", "๐ฎ", "๐ฒ", "๐ผ",
"๐ค", "๐ง", "๐ท", "๐ธ", "๐ฅ",
],
),
cat(
"Travel",
&[
"๐", "๐", "๐", "๐", "๐", "๐", "๐", "๐", "๐", "๐", "๐ป", "๐", "๐", "๐",
"๐ต", "๐", "๐บ", "๐ฒ", "๐ด", "๐น", "๐", "โ๏ธ", "๐", "๐ธ", "๐ถ", "โต", "๐ข", "๐",
"๐บ", "๐ฝ", "๐ผ", "๐ฐ", "๐ก", "๐ข", "๐ ", "๐", "๐", "๐", "๐", "๐", "๐", "๐
",
"๐",
],
),
cat(
"Objects",
&[
"๐ฑ", "๐ป", "โจ๏ธ", "๐ฅ", "๐จ", "๐ฑ", "๐พ", "๐ฟ", "๐ท", "๐ธ", "๐น", "๐ฅ", "๐บ", "๐ป",
"๐", "โ๏ธ", "๐", "๐", "๐ก", "๐ฆ", "๐ฏ", "๐งฏ", "๐ข", "๐ต", "๐ฐ", "๐ณ", "๐", "โ๏ธ",
"๐ง", "๐จ", "๐ ", "โ", "๐ช", "๐ช", "๐ฉ", "โ๏ธ", "๐งฑ", "โ", "๐งฒ", "๐ซ", "๐ฃ", "๐งจ",
],
),
cat(
"Symbols",
&[
"โ
", "โ", "โ๏ธ", "โ", "โญ", "๐ซ", "โ ๏ธ", "๐ฑ", "โ๏ธ", "๐ฏ", "๐ฅ", "โจ", "๐", "โญ",
"๐", "โ๏ธ", "๐", "โก", "โ๏ธ", "๐ฅ", "๐", "๐ง", "๐ฆ", "๐", "๐", "๐", "๐", "๐",
"๐ช
", "๐พ", "๐ฅ", "๐ฅ", "๐ฅ", "๐", "๐", "๐
", "๐ค", "๐ญ", "๐ฏ", "๐ฌ", "๐", "๐",
"๐", "๐", "๐", "๐", "โป๏ธ", "โฎ๏ธ", "โ๏ธ", "โช๏ธ", "๐", "โธ๏ธ", "โก๏ธ", "โฏ๏ธ", "โฆ๏ธ",
],
),
]
}
#[uniffi::export]
pub fn iris_emoji_search_aliases() -> Vec<EmojiAliasSnapshot> {
vec![
alias("๐", "laugh laughing lol haha"),
alias("๐คฃ", "laugh laughing lol haha rolling"),
alias("๐", "smile smiling happy"),
alias("๐", "smile smiling happy"),
alias("๐", "love heart eyes"),
alias("๐ฅฐ", "love hearts"),
alias("๐", "kiss love"),
alias("๐ข", "sad tear crying"),
alias("๐ญ", "sad cry crying"),
alias("๐ ", "angry mad"),
alias("๐คฌ", "angry mad swearing"),
alias("๐", "pray praying thanks thank you please"),
alias("๐", "clap applause"),
alias("๐", "hooray yay hands"),
alias("โค๏ธ", "love heart red"),
alias("โฅ๏ธ", "love heart red"),
alias("๐ฅ", "fire lit hot"),
alias("๐", "party celebrate celebration"),
alias("๐", "party celebrate celebration"),
alias("โจ", "sparkle sparkles"),
alias("โ
", "yes check done"),
alias("โ", "no cross x"),
alias("๐", "eyes look watching"),
alias("๐ฏ", "hundred perfect"),
alias("๐ฎ", "wow surprised shock shocked open mouth"),
alias("๐ฏ", "wow surprised hushed"),
alias("๐ฒ", "wow surprised astonished shock"),
alias("๐คฏ", "mind blown shock wow"),
alias("๐ฑ", "scream shock shocked wow"),
alias("๐ค", "thinking hmm think"),
alias("๐คข", "sick gross nauseated"),
alias("๐คฎ", "sick gross vomit puke"),
alias("๐ฅฑ", "yawn yawning tired bored"),
alias("๐ด", "sleep sleeping tired"),
alias("๐ค", "nerd nerdy glasses"),
alias("๐ง", "monocle inspect curious"),
alias("๐", "skull dead"),
alias("๐ป", "ghost spooky"),
alias("๐คก", "clown"),
alias("๐ฝ", "alien"),
alias("๐ค", "robot bot"),
alias("๐ฉ", "poo poop"),
alias("๐", "devil smiling devil"),
alias("๐", "thumbs up like yes"),
alias("๐", "thumbs down dislike no"),
alias("๐ฅบ", "pleading puppy eyes"),
]
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn catalog_contains_wow_emoji() {
let catalog = iris_emoji_catalog();
let smileys = catalog
.iter()
.find(|c| c.name == "Smileys")
.expect("Smileys category");
assert!(
smileys.emojis.iter().any(|e| e == "๐ฎ"),
"Smileys must include the open-mouth (wow) emoji"
);
}
#[test]
fn aliases_route_wow_to_open_mouth() {
let aliases = iris_emoji_search_aliases();
let hit = aliases
.iter()
.find(|a| a.emoji == "๐ฎ")
.expect("alias entry for open-mouth emoji");
assert!(hit.keywords.contains("wow"));
}
}