1#[derive(uniffi::Record, Clone, Debug, PartialEq, Eq)]
7pub struct EmojiCategorySnapshot {
8 pub name: String,
9 pub emojis: Vec<String>,
10}
11
12#[derive(uniffi::Record, Clone, Debug, PartialEq, Eq)]
13pub struct EmojiAliasSnapshot {
14 pub emoji: String,
15 pub keywords: String,
16}
17
18fn cat(name: &str, emojis: &[&str]) -> EmojiCategorySnapshot {
19 EmojiCategorySnapshot {
20 name: name.to_string(),
21 emojis: emojis.iter().map(|s| (*s).to_string()).collect(),
22 }
23}
24
25fn alias(emoji: &str, keywords: &str) -> EmojiAliasSnapshot {
26 EmojiAliasSnapshot {
27 emoji: emoji.to_string(),
28 keywords: keywords.to_string(),
29 }
30}
31
32#[uniffi::export]
33pub fn iris_emoji_catalog() -> Vec<EmojiCategorySnapshot> {
34 vec![
35 cat(
36 "Smileys",
37 &[
38 "๐",
39 "๐",
40 "๐",
41 "๐",
42 "๐",
43 "๐
",
44 "๐คฃ",
45 "๐",
46 "๐",
47 "๐",
48 "๐ซ ",
49 "๐",
50 "๐",
51 "๐",
52 "๐ฅฐ",
53 "๐",
54 "๐คฉ",
55 "๐",
56 "๐",
57 "โบ๏ธ",
58 "๐",
59 "๐",
60 "๐ฅฒ",
61 "๐",
62 "๐",
63 "๐",
64 "๐คช",
65 "๐",
66 "๐ค",
67 "๐ค",
68 "๐คญ",
69 "๐ซข",
70 "๐ซฃ",
71 "๐คซ",
72 "๐ค",
73 "๐ซก",
74 "๐ค",
75 "๐คจ",
76 "๐",
77 "๐",
78 "๐ถ",
79 "๐ซฅ",
80 "๐ถโ๐ซ๏ธ",
81 "๐",
82 "๐",
83 "๐",
84 "๐ฌ",
85 "๐ฎโ๐จ",
86 "๐คฅ",
87 "๐",
88 "๐",
89 "๐ช",
90 "๐คค",
91 "๐ด",
92 "๐ท",
93 "๐ค",
94 "๐ค",
95 "๐คข",
96 "๐คฎ",
97 "๐คง",
98 "๐ฅต",
99 "๐ฅถ",
100 "๐ฅด",
101 "๐ต",
102 "๐ตโ๐ซ",
103 "๐คฏ",
104 "๐ค ",
105 "๐ฅณ",
106 "๐ฅธ",
107 "๐",
108 "๐ค",
109 "๐ง",
110 "๐",
111 "๐ซค",
112 "๐",
113 "๐",
114 "โน๏ธ",
115 "๐ฎ",
116 "๐ฏ",
117 "๐ฒ",
118 "๐ณ",
119 "๐ฅบ",
120 "๐ฅน",
121 "๐ฆ",
122 "๐ง",
123 "๐จ",
124 "๐ฐ",
125 "๐ฅ",
126 "๐ข",
127 "๐ญ",
128 "๐ฑ",
129 "๐",
130 "๐ฃ",
131 "๐",
132 "๐",
133 "๐ฉ",
134 "๐ซ",
135 "๐ฅฑ",
136 "๐ค",
137 "๐ก",
138 "๐ ",
139 "๐คฌ",
140 "๐",
141 "๐ฟ",
142 "๐",
143 "โ ๏ธ",
144 "๐ฉ",
145 "๐คก",
146 "๐น",
147 "๐บ",
148 "๐ป",
149 "๐ฝ",
150 "๐พ",
151 "๐ค",
152 "๐บ",
153 "๐ธ",
154 "๐น",
155 "๐ป",
156 "๐ผ",
157 "๐ฝ",
158 "๐",
159 "๐ฟ",
160 "๐พ",
161 ],
162 ),
163 cat(
164 "Hearts",
165 &[
166 "โค๏ธ",
167 "๐งก",
168 "๐",
169 "๐",
170 "๐",
171 "๐",
172 "๐ค",
173 "๐ค",
174 "๐ค",
175 "๐",
176 "๐",
177 "๐",
178 "๐",
179 "๐",
180 "๐",
181 "๐",
182 "๐",
183 "โฅ๏ธ",
184 "๐",
185 "โฃ๏ธ",
186 "โค๏ธโ๐ฅ",
187 "โค๏ธโ๐ฉน",
188 ],
189 ),
190 cat(
191 "Hands",
192 &[
193 "๐", "๐", "๐", "๐ค", "๐ค", "โ๏ธ", "๐ค", "๐ซฐ", "๐ค", "๐ค", "๐ค", "๐", "๐", "๐",
194 "๐", "โ๏ธ", "โ", "๐ค", "๐", "๐", "๐", "๐ค", "๐", "๐", "๐", "๐ซถ", "๐ช", "๐ซต",
195 "๐ซฑ", "๐ซฒ",
196 ],
197 ),
198 cat(
199 "Animals",
200 &[
201 "๐ถ", "๐ฑ", "๐ญ", "๐น", "๐ฐ", "๐ฆ", "๐ป", "๐ผ", "๐จ", "๐ฏ", "๐ฆ", "๐ฎ", "๐ท", "๐ธ",
202 "๐ต", "๐", "๐", "๐", "๐", "๐ง", "๐ฆ", "๐ฆ
", "๐ฆ", "๐ฆ", "๐", "๐ฆ", "๐", "๐ข",
203 "๐", "๐ฆ", "๐", "๐ฆ", "๐ฌ", "๐ณ", "๐ฆ",
204 ],
205 ),
206 cat(
207 "Food",
208 &[
209 "๐", "๐", "๐", "๐", "๐", "๐", "๐", "๐", "๐", "๐ซ", "๐", "๐", "๐ฅญ", "๐",
210 "๐ฅฅ", "๐ฅ", "๐
", "๐ฅ", "๐ฅ", "๐ฝ", "๐", "๐ฅ", "๐", "๐", "๐", "๐ญ", "๐ฟ", "๐ฅช",
211 "๐ฎ", "๐ฏ", "๐ฃ", "๐", "๐", "๐ฆ", "๐ฉ", "๐ช", "๐", "๐ฐ", "โ", "๐ต", "๐บ", "๐ฅ",
212 "๐ท", "๐ฅ",
213 ],
214 ),
215 cat(
216 "Activities",
217 &[
218 "โฝ", "๐", "๐", "โพ", "๐ฅ", "๐พ", "๐", "๐", "๐ฑ", "๐ช", "๐", "๐ธ", "๐ฅ
", "๐",
219 "๐", "๐ฅ", "๐", "๐ช", "๐ฅ", "๐ฅ", "๐ฝ", "โธ", "๐ฅ", "๐ท", "๐ช", "๐๏ธ", "๐คธ", "๐คบ",
220 "๐", "โท", "๐", "๐๏ธ", "๐", "๐ฃ", "๐", "๐คฝ", "๐ด", "๐ต", "๐ฏ", "๐ฎ", "๐ฒ", "๐ผ",
221 "๐ค", "๐ง", "๐ท", "๐ธ", "๐ฅ",
222 ],
223 ),
224 cat(
225 "Travel",
226 &[
227 "๐", "๐", "๐", "๐", "๐", "๐", "๐", "๐", "๐", "๐", "๐ป", "๐", "๐", "๐",
228 "๐ต", "๐", "๐บ", "๐ฒ", "๐ด", "๐น", "๐", "โ๏ธ", "๐", "๐ธ", "๐ถ", "โต", "๐ข", "๐",
229 "๐บ", "๐ฝ", "๐ผ", "๐ฐ", "๐ก", "๐ข", "๐ ", "๐", "๐", "๐", "๐", "๐", "๐", "๐
",
230 "๐",
231 ],
232 ),
233 cat(
234 "Objects",
235 &[
236 "๐ฑ", "๐ป", "โจ๏ธ", "๐ฅ", "๐จ", "๐ฑ", "๐พ", "๐ฟ", "๐ท", "๐ธ", "๐น", "๐ฅ", "๐บ", "๐ป",
237 "๐", "โ๏ธ", "๐", "๐", "๐ก", "๐ฆ", "๐ฏ", "๐งฏ", "๐ข", "๐ต", "๐ฐ", "๐ณ", "๐", "โ๏ธ",
238 "๐ง", "๐จ", "๐ ", "โ", "๐ช", "๐ช", "๐ฉ", "โ๏ธ", "๐งฑ", "โ", "๐งฒ", "๐ซ", "๐ฃ", "๐งจ",
239 ],
240 ),
241 cat(
242 "Symbols",
243 &[
244 "โ
", "โ", "โ๏ธ", "โ", "โญ", "๐ซ", "โ ๏ธ", "๐ฑ", "โ๏ธ", "๐ฏ", "๐ฅ", "โจ", "๐", "โญ",
245 "๐", "โ๏ธ", "๐", "โก", "โ๏ธ", "๐ฅ", "๐", "๐ง", "๐ฆ", "๐", "๐", "๐", "๐", "๐",
246 "๐ช
", "๐พ", "๐ฅ", "๐ฅ", "๐ฅ", "๐", "๐", "๐
", "๐ค", "๐ญ", "๐ฏ", "๐ฌ", "๐", "๐",
247 "๐", "๐", "๐", "๐", "โป๏ธ", "โฎ๏ธ", "โ๏ธ", "โช๏ธ", "๐", "โธ๏ธ", "โก๏ธ", "โฏ๏ธ", "โฆ๏ธ",
248 ],
249 ),
250 ]
251}
252
253#[uniffi::export]
254pub fn iris_emoji_search_aliases() -> Vec<EmojiAliasSnapshot> {
255 vec![
256 alias("๐", "laugh laughing lol haha"),
257 alias("๐คฃ", "laugh laughing lol haha rolling"),
258 alias("๐", "smile smiling happy"),
259 alias("๐", "smile smiling happy"),
260 alias("๐", "love heart eyes"),
261 alias("๐ฅฐ", "love hearts"),
262 alias("๐", "kiss love"),
263 alias("๐ข", "sad tear crying"),
264 alias("๐ญ", "sad cry crying"),
265 alias("๐ ", "angry mad"),
266 alias("๐คฌ", "angry mad swearing"),
267 alias("๐", "pray praying thanks thank you please"),
268 alias("๐", "clap applause"),
269 alias("๐", "hooray yay hands"),
270 alias("โค๏ธ", "love heart red"),
271 alias("โฅ๏ธ", "love heart red"),
272 alias("๐ฅ", "fire lit hot"),
273 alias("๐", "party celebrate celebration"),
274 alias("๐", "party celebrate celebration"),
275 alias("โจ", "sparkle sparkles"),
276 alias("โ
", "yes check done"),
277 alias("โ", "no cross x"),
278 alias("๐", "eyes look watching"),
279 alias("๐ฏ", "hundred perfect"),
280 alias("๐ฎ", "wow surprised shock shocked open mouth"),
281 alias("๐ฏ", "wow surprised hushed"),
282 alias("๐ฒ", "wow surprised astonished shock"),
283 alias("๐คฏ", "mind blown shock wow"),
284 alias("๐ฑ", "scream shock shocked wow"),
285 alias("๐ค", "thinking hmm think"),
286 alias("๐คข", "sick gross nauseated"),
287 alias("๐คฎ", "sick gross vomit puke"),
288 alias("๐ฅฑ", "yawn yawning tired bored"),
289 alias("๐ด", "sleep sleeping tired"),
290 alias("๐ค", "nerd nerdy glasses"),
291 alias("๐ง", "monocle inspect curious"),
292 alias("๐", "skull dead"),
293 alias("๐ป", "ghost spooky"),
294 alias("๐คก", "clown"),
295 alias("๐ฝ", "alien"),
296 alias("๐ค", "robot bot"),
297 alias("๐ฉ", "poo poop"),
298 alias("๐", "devil smiling devil"),
299 alias("๐", "thumbs up like yes"),
300 alias("๐", "thumbs down dislike no"),
301 alias("๐ฅบ", "pleading puppy eyes"),
302 ]
303}
304
305#[cfg(test)]
306mod tests {
307 use super::*;
308
309 #[test]
310 fn catalog_contains_wow_emoji() {
311 let catalog = iris_emoji_catalog();
312 let smileys = catalog
313 .iter()
314 .find(|c| c.name == "Smileys")
315 .expect("Smileys category");
316 assert!(
317 smileys.emojis.iter().any(|e| e == "๐ฎ"),
318 "Smileys must include the open-mouth (wow) emoji"
319 );
320 }
321
322 #[test]
323 fn aliases_route_wow_to_open_mouth() {
324 let aliases = iris_emoji_search_aliases();
325 let hit = aliases
326 .iter()
327 .find(|a| a.emoji == "๐ฎ")
328 .expect("alias entry for open-mouth emoji");
329 assert!(hit.keywords.contains("wow"));
330 }
331}