// Types shared between the main process, preload bridge and renderer. export type Direction = 'in' | 'out' export type MessageStatus = 'delivered' | 'pending' | 'failed' export type MessageKind = 'sms' | 'mms' export type Theme = 'system' | 'light' | 'dark' // The app icon: the original dark photo, or its negative (lighter). export type IconStyle = 'dark' | 'inverted' // One MMS attachment. `url` is where voip.ms serves it; `file` is our cached // copy (a name inside /media), filled in once downloaded or sent. export interface MediaRef { url?: string file?: string mime?: string width?: number height?: number } // "Export chat": which days, which format, and the names shown in the chat. export interface ChatExport { from?: string // YYYY-MM-DD, inclusive; neither = all time to?: string format: 'pdf' | 'txt' attachments: boolean // PDF only: show photos (otherwise "[Photo]") title: string // the chat's name as shown names: Record // group senders' names, by number } // An attachment on its way out (already compressed by the renderer). export interface OutgoingAttachment { name: string mime: string data: Uint8Array width?: number height?: number } export interface Message { id: number did: string contact: string direction: Direction body: string ts: number // epoch ms, UTC kind: MessageKind status: MessageStatus media?: MediaRef[] error?: string // why a send failed sender?: string // who sent an incoming group message (normalized number) } export interface Conversation { did: string contact: string lastBody: string lastTs: number lastDirection: Direction lastKind: MessageKind lastMedia?: MediaRef // first attachment of the last message, if any lastSender?: string // sender of the last message, in group chats name?: string // a name you gave the conversation (local only) unread: number markedUnread: boolean // manually marked unread (shown as a dot) archived: boolean } export interface ContactInfo { name: string number: string // normalized label?: string // e.g. "cell", "work" photo?: string // data: URL book: string } export interface AddressBook { uid: string name: string account: string // e.g. the Nextcloud account it belongs to } export interface NewContact { first: string last: string org: string number: string // E.164 book?: string // address book uid; default: GNOME Contacts' own default } export interface SearchHit { id: number did: string contact: string ts: number direction: Direction snippet: string // contains  /  markers around matched text } export type Provider = 'voipms' | 'gvoice' | 'sim' export interface Did { did: string description: string smsEnabled: boolean provider?: Provider // absent = voip.ms } export interface SyncStatus { phase: 'idle' | 'backfill' | 'polling' | 'error' | 'unconfigured' backfillCursor?: string // YYYY-MM-DD the backfill has reached backfillDone: boolean lastPoll?: number error?: string total: number gvoice?: GvStatus } // Google Voice syncs on its own, so it reports separately. export interface GvStatus { phase: 'idle' | 'backfill' | 'polling' | 'error' | 'signedOut' backfillDone: boolean lastPoll?: number error?: string } // 'signal': Signal Desktop vibes; 'trave': the house look (shared-resources/design.html). export type Look = 'signal' | 'trave' export interface Settings { pollSeconds: number dids: string[] // DIDs to sync; empty = all SMS-enabled defaultDid?: string backfillFloor: string // YYYY-MM-DD, stop backfill here theme: Theme icon?: IconStyle // absent = dark notifications: boolean // new messages go to the notification list contactBook?: string // where "Add to contacts" puts them; default: GNOME Contacts' default look?: Look // absent = travewave hideMenuBar?: boolean // until Alt is tapped (design.html#menubar); absent = hidden showTooltips?: boolean // design.html#tooltips; absent = shown quickReactions?: string[] // a message's quick reaction row; absent = ❤️ 👍 👎 😂 ‼️ ❓ } export interface Credentials { username: string password: string } export const SNIPPET_START = '' export const SNIPPET_END = ''