Files
bubble/src/shared/api.ts
T
trav 8c84feaa91 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.
2026-11-06 02:19:56 -08:00

70 lines
3.1 KiB
TypeScript

// The typed bridge exposed to the renderer as window.api.
import type { AddressBook, ChatExport, ContactInfo, NewContact, Conversation, Credentials, Did, Message, OutgoingAttachment, SearchHit, Settings, SyncStatus, Theme } from './types'
export interface AppState {
configured: boolean
username?: string
settings: Settings
dataDir: string
dids: Did[]
keyringBackend: string
gvoiceNumber?: string // set when Google Voice is connected
}
export interface RabbitStatus {
adb: boolean // adb is installed
bundledVersion?: string // the Android app this build carries
device?: { serial: string; model: string; installedVersion?: string }
}
export interface Api {
getState(): Promise<AppState>
testCredentials(creds: Credentials): Promise<Did[]>
saveSetup(creds: Credentials, settings: Settings): Promise<void>
updateSettings(settings: Settings): Promise<void>
setTheme(theme: Theme): Promise<void>
signOut(): Promise<void>
connectGoogleVoice(): Promise<void>
connectGoogleVoiceCookies(text: string): Promise<void>
disconnectGoogleVoice(): Promise<void>
rabbitStatus(): Promise<RabbitStatus>
rabbitInstall(mode?: 'full' | 'update'): Promise<void> // update: app only, keeps its data
rabbitSync(): Promise<void>
onRabbitProgress(cb: (step: string) => void): () => void
listContacts(): Promise<ContactInfo[]>
listAddressBooks(): Promise<{ books: AddressBook[]; default?: string }>
addContact(c: NewContact): Promise<string> // resolves with the book's name
listConversations(): Promise<Conversation[]>
getMessages(did: string, contact: string): Promise<Message[]>
markRead(did: string, contact: string): Promise<void>
markUnread(did: string, contact: string): Promise<void>
setArchived(did: string, contact: string, archived: boolean): Promise<void>
setName(did: string, contact: string, name: string | null): Promise<void>
// Unsent composer text, by contact; kept until sent or cleared.
getDrafts(): Promise<Record<string, string>>
setDraft(contact: string, text: string): Promise<void>
search(query: string, scope?: { did: string; contact: string }): Promise<SearchHit[]>
send(did: string, contact: string, text: string, attachments?: OutgoingAttachment[]): Promise<void>
deleteFailed(id: number): Promise<void>
retryFailed(id: number): Promise<void>
saveMedia(id: number, index: number): Promise<void>
exportChat(did: string, contact: string, opts: ChatExport): Promise<boolean> // false: no file chosen
readMedia(id: number, index: number): Promise<{ mime: string; data: Uint8Array<ArrayBuffer> }>
copyImage(png: Uint8Array): Promise<void> // onto the system clipboard
syncStatus(): Promise<SyncStatus>
pollNow(): Promise<void>
openDataFolder(): Promise<void>
snapshotNow(): Promise<string>
chooseDataDir(): Promise<string | undefined>
onMessages(cb: (msgs: Message[]) => void): () => void
onConversationsChanged(cb: () => void): () => void
onSyncStatus(cb: (s: SyncStatus) => void): () => void
onContactsChanged(cb: () => void): () => void
onStateChanged(cb: () => void): () => void
onOpenConversation(cb: (key: { did: string; contact: string }) => void): () => void
}