- Right-click a message (or photo): a quick reaction row above Copy, + for every emoji, and "Customize quick reactions…" there to change the row (saved in settings as quickReactions; default ❤️ 👍 👎 😂 ‼️ ❓). Yours shows sunk; clicking it again takes it back. A reaction goes out as an ordinary text worded like an iPhone's ("Loved “…”", "Reacted 🎉 to “…”", "Removed a heart from “…”"), long messages quoted cut short. - Tapbacks in other languages ("Le encanta “…”", "Hat „…“ geliebt", "A aimé « … »"...): read from the words around the quote, and only folded when the quote matches an earlier message. A failed reaction stays in view. - "Edited to “…”": applied to the sender's message from the last 20 minutes that reads most like it (or their only one); the bubble says "Edited", and clicking it shows the earlier texts. Reactions to the old text still land. - Popovers re-fit the window when they grow.
151 lines
4.2 KiB
TypeScript
151 lines
4.2 KiB
TypeScript
// 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 <dataDir>/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<string, string> // 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 = ''
|