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:
@@ -0,0 +1,36 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { compressionSteps, formatBytes } from '../src/renderer/src/media'
|
||||
import { guessMime, mediaKind } from '@shared/mime'
|
||||
import { previewText } from '../src/renderer/src/format'
|
||||
|
||||
describe('compressionSteps', () => {
|
||||
it('tries full size first, then shrinks toward an 640px long edge', () => {
|
||||
const steps = compressionSteps(4032, 3024)
|
||||
expect(steps[0]).toEqual({ scale: 1, quality: 0.85 })
|
||||
const scales = [...new Set(steps.map((s) => s.scale))]
|
||||
expect(scales).toEqual([1, 2048 / 4032, 1600 / 4032, 1280 / 4032, 1024 / 4032, 800 / 4032, 640 / 4032])
|
||||
expect(steps).toHaveLength(scales.length * 3)
|
||||
})
|
||||
it('never upscales small images', () => {
|
||||
const scales = [...new Set(compressionSteps(900, 700).map((s) => s.scale))]
|
||||
expect(scales).toEqual([1, 800 / 900, 640 / 900])
|
||||
})
|
||||
})
|
||||
|
||||
describe('media helpers', () => {
|
||||
it('guesses types from voip.ms URLs and file names', () => {
|
||||
expect(guessMime('https://voip.ms/media/MTc4/media.jpeg')).toBe('image/jpeg')
|
||||
expect(mediaKind({ url: 'https://voip.ms/media/x/media.mp4' })).toBe('video')
|
||||
expect(mediaKind({ file: 'abc.bin' })).toBe('file')
|
||||
expect(mediaKind({ mime: 'audio/amr' })).toBe('audio')
|
||||
})
|
||||
it('formats sizes', () => {
|
||||
expect(formatBytes(900 * 1024)).toBe('900 KB')
|
||||
expect(formatBytes(6.2 * 1024 * 1024)).toBe('6.2 MB')
|
||||
})
|
||||
it('labels media in conversation previews', () => {
|
||||
expect(previewText({ lastBody: '', lastMedia: { mime: 'image/jpeg' } })).toBe('📷 Photo')
|
||||
expect(previewText({ lastBody: 'look!', lastMedia: { url: 'x/media.jpeg' } })).toBe('📷 look!')
|
||||
expect(previewText({ lastBody: 'hi\nthere' })).toBe('hi there')
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user