v0.2.0: bubble for Android 0.2.0 — chat search, swipe for unread, faster chat opening
Desktop: - Search lists chats whose own name matches first, so a named group isn't pushed out of the top 8 by chats that merely include a member. Android (Rabbit R1) app, 0.2.0: - Pull the chat list past its top for a search box (name, person, number, then group members; archived chats too; Back clears it). - Swipe right to left marks a chat unread / read over a magenta band; left to right still archives (SwipeActions replaces SwipeArchive). - Google Voice chats don't offer voice notes in the paperclip bubble. - Chats open with their newest 60 messages, then the full history; marking read (and the Google Voice network call) waits until they're on screen. Cached pictures show at once, and one slow download no longer blocks the other images. Fixed a contacts reload race. - Sandbox data gains filler chats, a named group and a 4,000-message chat. Also: the Android app, Google Voice support, media, export, emoji and the other work since the first commit, and a CLAUDE.md carrying the privacy rule.
This commit is contained in:
+37
-1
@@ -12,7 +12,7 @@ function fakeApi(all: RawSms[]) {
|
||||
const calls: Array<{ from: string; to: string }> = []
|
||||
return {
|
||||
calls,
|
||||
async getSms({ from, to, limit = 10000 }: { from: string; to: string; limit?: number }) {
|
||||
async getMessages({ from, to, limit = 10000 }: { from: string; to: string; limit?: number }) {
|
||||
calls.push({ from, to })
|
||||
return all.filter((m) => m.date.slice(0, 10) >= from && m.date.slice(0, 10) <= to).slice(0, limit)
|
||||
}
|
||||
@@ -41,6 +41,25 @@ describe('toNewMessage', () => {
|
||||
})
|
||||
})
|
||||
|
||||
describe('toNewMessage (MMS)', () => {
|
||||
const mms = { ...raw(8, '2024-02-03'), message: '', col_media2: '', col_media3: '' }
|
||||
it('maps getMMS media to kind mms', () => {
|
||||
const url = 'https://voip.ms/media/abc/media.jpeg'
|
||||
expect(toNewMessage({ ...mms, col_media1: url, media: [url] })).toMatchObject({ kind: 'mms', media: [{ url }] })
|
||||
expect(toNewMessage({ ...mms, col_media1: url })).toMatchObject({ kind: 'mms', media: [{ url }] })
|
||||
})
|
||||
it('treats rows without media as plain texts', () => {
|
||||
const m = toNewMessage({ ...mms, message: 'long text', col_media1: '', media: [] })
|
||||
expect(m.kind).toBeUndefined()
|
||||
expect(m.media).toBeUndefined()
|
||||
})
|
||||
it('labels text too long for one SMS as a text-only MMS', () => {
|
||||
expect(toNewMessage({ ...mms, message: 'x'.repeat(161) })).toMatchObject({ kind: 'mms' })
|
||||
expect(toNewMessage({ ...mms, message: '😀'.repeat(160) }).kind).toBeUndefined()
|
||||
expect(toNewMessage({ ...mms, message: 'x'.repeat(161) }).media).toBeUndefined()
|
||||
})
|
||||
})
|
||||
|
||||
describe('fetchRange', () => {
|
||||
it('splits a window that hits the page limit so nothing is truncated', async () => {
|
||||
const all = Array.from({ length: 10 }, (_, i) => raw(i, ymd(Date.UTC(2024, 0, 1) + i * DAY)))
|
||||
@@ -74,3 +93,20 @@ describe('SyncEngine backfill', () => {
|
||||
fs.rmSync(dir, { recursive: true, force: true })
|
||||
}, 20_000)
|
||||
})
|
||||
|
||||
describe('SyncEngine poll', () => {
|
||||
it('replaces a failed local copy of a text that voip.ms did send', async () => {
|
||||
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'voipms-sync-'))
|
||||
const db = new MessageDb(path.join(dir, 'm.db'))
|
||||
db.set('backfill_done', '1')
|
||||
const sent = { ...raw(42, ymd(Date.now()), '0'), message: 'see you at 8' }
|
||||
const t = db.insertPending({ did: '5550001111', contact: '5415550142', direction: 'out', body: 'see you at 8', ts: toNewMessage(sent).ts })
|
||||
db.markFailed(t, "voip.ms didn't respond in time.")
|
||||
const engine = new SyncEngine(db, fakeApi([sent]) as unknown as VoipMs, { pollSeconds: 3600, dids: [], backfillFloor: '2010-01-01' })
|
||||
await engine.pollNow()
|
||||
expect(db.getMessage(t)).toBeUndefined()
|
||||
expect(db.getConversationMessages('5550001111', '5415550142').map((m) => [m.id, m.status])).toEqual([[42, 'delivered']])
|
||||
db.close()
|
||||
fs.rmSync(dir, { recursive: true, force: true })
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user