Files
bubble/scripts/gen-emoji.mjs
T
trav 09a46aa35c v0.7.0: bubble for Android 0.7.0 — react to messages, reactions in other languages, and edits
Android, ported from the desktop's reactions.ts / edits.ts (same readings:
checked side by side on the same 32 cases):
- Long-press a message: the quick reaction row (yours lit, tap again to take
  it back), + for every emoji (EmojiPicker, the desktop's emoji list as
  res/raw/emoji_list.txt, minus any the font can't draw), and Copy text.
- Settings → Reactions → Quick reactions: pick a spot, then its emoji; Reset.
- Tapbacks in other languages fold like the desktop's; "Edited to “…”" edits
  its message, which says "Edited · time"; tap it for the earlier texts.
- Chat list and notifications preview an edit as "✏️ new text".
- push_sandbox.py has a Spanish tapback and an edit to try it on.

Desktop: version 0.7.0; gen-emoji also writes the Android list.
2026-11-10 17:38:09 -08:00

24 lines
1.2 KiB
JavaScript

// Builds src/renderer/src/emoji-data.json — a compact [emoji, shortnames[]]
// list in picker order — and the Android app's res/raw/emoji_list.txt (the
// same emoji, one per line, for its reaction picker) from emoji-datasource (the shortcode set Signal and
// Slack use). Run with `npm run gen:emoji` after bumping emoji-datasource.
import { mkdirSync, readFileSync, writeFileSync } from 'node:fs'
import { createRequire } from 'node:module'
const require = createRequire(import.meta.url)
const source = JSON.parse(readFileSync(require.resolve('emoji-datasource/emoji.json'), 'utf8'))
const toChar = (unified) => String.fromCodePoint(...unified.split('-').map((h) => parseInt(h, 16)))
const data = source
.filter((e) => e.has_img_apple && !e.obsoleted_by)
.sort((a, b) => a.sort_order - b.sort_order)
.map((e) => [toChar(e.unified), e.short_names])
const out = new URL('../src/renderer/src/emoji-data.json', import.meta.url)
writeFileSync(out, JSON.stringify(data) + '\n')
const raw = new URL('../android/app/src/main/res/raw/', import.meta.url)
mkdirSync(raw, { recursive: true })
writeFileSync(new URL('emoji_list.txt', raw), data.map(([char]) => char).join('\n') + '\n')
console.log(`wrote ${data.length} emoji`)