threema.d.ts 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848
  1. /**
  2. * This file is part of Threema Web.
  3. *
  4. * Threema Web is free software: you can redistribute it and/or modify it
  5. * under the terms of the GNU Affero General Public License as published by
  6. * the Free Software Foundation, either version 3 of the License, or (at
  7. * your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful, but
  10. * WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero
  12. * General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU Affero General Public License
  15. * along with Threema Web. If not, see <http://www.gnu.org/licenses/>.
  16. */
  17. declare const angular: ng.IAngularStatic;
  18. declare namespace threema {
  19. interface Avatar {
  20. // Low resolution avatar URI
  21. low?: ArrayBuffer;
  22. // High resolution avatar URI
  23. high?: ArrayBuffer;
  24. }
  25. /**
  26. * Messages that are sent through the secure data channel as encrypted msgpack bytes.
  27. */
  28. interface WireMessage {
  29. type: string;
  30. subType: string;
  31. args?: any;
  32. data?: any;
  33. }
  34. type MessageType = 'text' | 'image' | 'video' | 'audio' | 'location' | 'contact' |
  35. 'status' | 'ballot' | 'file' | 'voipStatus' | 'unknown';
  36. type MessageState = 'delivered' | 'read' | 'send-failed' | 'sent' | 'user-ack' |
  37. 'user-dec' | 'pending' | 'timeout' | 'sending';
  38. const enum InitializationStep {
  39. ClientInfo = 'client info',
  40. Conversations = 'conversations',
  41. Receivers = 'receivers',
  42. Profile = 'profile',
  43. }
  44. interface InitializationStepRoutine {
  45. requiredSteps: InitializationStep[];
  46. callback: any;
  47. }
  48. interface Thumbnail {
  49. img?: string;
  50. preview: ArrayBuffer;
  51. width: number;
  52. height: number;
  53. }
  54. const enum EventType {
  55. Created = 'created',
  56. Sent = 'sent',
  57. Delivered = 'delivered',
  58. Read = 'read',
  59. Acked = 'acked',
  60. Modified = 'modified',
  61. }
  62. /**
  63. * A message event, e.g. when it was delivered, read or modified.
  64. */
  65. interface MessageEvent {
  66. // The event type
  67. type: EventType;
  68. // Unix timestamp in seconds
  69. date: number;
  70. }
  71. /**
  72. * A Threema chat message.
  73. */
  74. interface Message {
  75. type: MessageType;
  76. id: string;
  77. body: string;
  78. thumbnail?: Thumbnail;
  79. date?: number;
  80. events?: MessageEvent[];
  81. sortKey: number;
  82. partnerId: string;
  83. isOutbox: boolean;
  84. isStatus: boolean;
  85. caption?: string;
  86. statusType?: 'text' | 'firstUnreadMessage';
  87. unread?: boolean;
  88. state?: MessageState;
  89. quote?: Quote;
  90. file?: FileInfo;
  91. video?: VideoInfo;
  92. audio?: AudioInfo;
  93. voip?: VoipStatusInfo;
  94. location?: LocationInfo;
  95. // only for temporary Messages
  96. temporaryId?: string;
  97. errorMessage?: string;
  98. }
  99. interface FileInfo {
  100. description: string;
  101. name: string;
  102. size: number;
  103. type: string;
  104. inApp: boolean;
  105. }
  106. interface VideoInfo {
  107. duration: number;
  108. size?: number;
  109. }
  110. interface AudioInfo {
  111. duration: number;
  112. }
  113. const enum VoipStatus {
  114. Missed = 1,
  115. Finished = 2,
  116. Rejected = 3,
  117. Aborted = 4,
  118. }
  119. const enum VoipRejectReason {
  120. Unknown = 0,
  121. Busy = 1,
  122. Timeout = 2,
  123. Rejected = 3,
  124. }
  125. interface VoipStatusInfo {
  126. status: VoipStatus;
  127. duration?: number;
  128. reason?: VoipRejectReason;
  129. }
  130. interface LocationInfo {
  131. lat: number;
  132. lon: number;
  133. accuracy: number;
  134. description: string;
  135. address?: string;
  136. }
  137. interface BlobInfo {
  138. buffer: ArrayBuffer;
  139. mimetype: string;
  140. filename: string;
  141. }
  142. /**
  143. * All possible receiver types.
  144. */
  145. type ReceiverType = 'me' | 'contact' | 'group' | 'distributionList';
  146. /**
  147. * Access Object for receivers
  148. */
  149. interface ReceiverAccess {
  150. canDelete?: boolean;
  151. }
  152. interface ContactReceiverAccess extends ReceiverAccess {
  153. canChangeAvatar: boolean;
  154. canChangeFirstName: boolean;
  155. canChangeLastName: boolean;
  156. }
  157. interface GroupReceiverAccess extends ReceiverAccess {
  158. canChangeAvatar: boolean;
  159. canChangeName: boolean;
  160. canChangeMembers?: boolean;
  161. canLeave?: boolean;
  162. canSync?: boolean;
  163. }
  164. interface DistributionListReceiverAccess extends ReceiverAccess {
  165. canChangeMembers?: boolean;
  166. }
  167. const enum IdentityType {
  168. Regular = 0,
  169. Work,
  170. }
  171. /**
  172. * The base class for a receiver. Only type and id.
  173. */
  174. interface BaseReceiver {
  175. id: string;
  176. type: ReceiverType;
  177. }
  178. /**
  179. * A generic receiver.
  180. *
  181. * Note that the id is not unique for all receivers, only for all receivers
  182. * of a certain type. The primary key for a receiver is the tuple (type, id).
  183. */
  184. interface Receiver extends BaseReceiver {
  185. // The display name
  186. displayName: string;
  187. // The color used for the avatar
  188. color: string;
  189. // The avatar, may be set if already fetched
  190. avatar?: Avatar;
  191. // Permissions towards this receiver
  192. access: ReceiverAccess;
  193. // Whether the chat with this receiver is locked. Used for private chats.
  194. locked?: boolean;
  195. // Whether the chat with this receiver is visible. Used for private chats.
  196. visible?: boolean;
  197. }
  198. /**
  199. * A contact.
  200. */
  201. interface ContactReceiver extends Receiver {
  202. // Flag indicating whether this is the own profile or another contact
  203. type: 'contact' | 'me';
  204. // Public nickname, if set
  205. publicNickname?: string;
  206. // First name, if set
  207. firstName?: string;
  208. // Last name, if set
  209. lastName?: string;
  210. // Verification level integer (1-3)
  211. verificationLevel?: number;
  212. // Feature mask
  213. featureMask: number | null;
  214. // The identity state
  215. state: 'ACTIVE' | 'INACTIVE';
  216. // Contact hidden?
  217. hidden: boolean;
  218. // The Threema public key
  219. publicKey: ArrayBuffer;
  220. // System confact information
  221. systemContact?: SystemContact;
  222. // Permissions towards this contact
  223. access: ContactReceiverAccess;
  224. // Whether this is a contact from the same Threema Work package.
  225. // Only relevant for Threema Work users.
  226. isWork?: boolean;
  227. // Whether this contact is blocked
  228. isBlocked?: boolean;
  229. // The identity type.
  230. // 0 - Regular Threema user.
  231. // 1 - Threema Work user.
  232. identityType?: IdentityType;
  233. }
  234. /**
  235. * Own contact.
  236. */
  237. interface MeReceiver extends ContactReceiver {
  238. type: 'me';
  239. }
  240. /**
  241. * A group.
  242. */
  243. interface GroupReceiver extends Receiver {
  244. type: 'group';
  245. disabled: boolean;
  246. members: string[];
  247. administrator: string;
  248. access: GroupReceiverAccess;
  249. createdAt: number;
  250. }
  251. /**
  252. * A distribution list.
  253. */
  254. interface DistributionListReceiver extends Receiver {
  255. type: 'distributionList';
  256. members: string[];
  257. access: DistributionListReceiverAccess;
  258. }
  259. interface SystemContact {
  260. emails?: SystemContactEmail[];
  261. phoneNumbers?: SystemContactPhone[];
  262. }
  263. interface SystemContactEmail {
  264. label: string;
  265. address: string;
  266. }
  267. interface SystemContactPhone {
  268. label: string;
  269. number: string;
  270. }
  271. /**
  272. * A conversation.
  273. */
  274. interface Conversation {
  275. type: ReceiverType;
  276. id: string;
  277. position?: number;
  278. messageCount: number;
  279. unreadCount: number;
  280. latestMessage: Message | null;
  281. receiver?: Receiver;
  282. avatar?: ArrayBuffer;
  283. notifications?: NotificationSettings;
  284. isStarred?: boolean;
  285. }
  286. /**
  287. * A conversation with a position field, used for updating a conversation.
  288. */
  289. interface ConversationWithPosition extends Conversation {
  290. position: number;
  291. }
  292. interface NotificationSettings {
  293. sound: NotificationSound;
  294. dnd: NotificationDnd;
  295. }
  296. interface NotificationSound {
  297. mode: NotificationSoundMode;
  298. }
  299. const enum NotificationSoundMode {
  300. Default = 'default',
  301. Muted = 'muted',
  302. }
  303. interface NotificationDnd {
  304. mode: NotificationDndMode;
  305. mentionOnly?: boolean;
  306. until?: number;
  307. }
  308. const enum NotificationDndMode {
  309. Off = 'off',
  310. On = 'on',
  311. Until = 'until',
  312. }
  313. /**
  314. * A form of the notification settings where things like the "until" mode
  315. * have been processed already.
  316. */
  317. interface SimplifiedNotificationSettings {
  318. sound: {
  319. muted: boolean,
  320. };
  321. dnd: {
  322. enabled: boolean,
  323. mentionOnly: boolean,
  324. };
  325. }
  326. /**
  327. * Connection state in the welcome dialog.
  328. *
  329. * States:
  330. *
  331. * - new: Initial state
  332. * - connecting: Connecting to signaling server
  333. * - push: When trying to reconnect, waiting for push notification to arrive
  334. * - manual_start: When trying to reconnect, waiting for manual session start
  335. * - already_connected: When the user is already connected in another tab or window
  336. * - waiting: Waiting for new-responder message from signaling server
  337. * - peer_handshake: Doing SaltyRTC handshake with the peer
  338. * - loading: Loading initial data
  339. * - done: Initial loading is finished
  340. * - closed: Connection is closed
  341. *
  342. */
  343. type ConnectionBuildupState = 'new' | 'connecting' | 'push' | 'manual_start' | 'already_connected'
  344. | 'waiting' | 'peer_handshake' | 'loading' | 'done' | 'closed';
  345. interface ConnectionBuildupStateChange {
  346. state: ConnectionBuildupState;
  347. prevState: ConnectionBuildupState;
  348. }
  349. /**
  350. * Connection state of the task peer connection.
  351. */
  352. const enum TaskConnectionState {
  353. New = 'new',
  354. Connecting = 'connecting',
  355. Connected = 'connected',
  356. Reconnecting = 'reconnecting',
  357. Disconnected = 'disconnected',
  358. }
  359. /**
  360. * Connection state of the WebRTC peer connection.
  361. */
  362. const enum GlobalConnectionState {
  363. Ok = 'ok',
  364. Warning = 'warning',
  365. Error = 'error',
  366. }
  367. interface GlobalConnectionStateChange {
  368. state: GlobalConnectionState;
  369. prevState: GlobalConnectionState;
  370. }
  371. /**
  372. * Type of message to be sent to a receiver.
  373. */
  374. type MessageContentType = 'text' | 'file';
  375. interface MessageData {
  376. // optional quote object
  377. quote?: Quote;
  378. }
  379. /**
  380. * Payload for a file message.
  381. */
  382. interface FileMessageData extends MessageData {
  383. // File name
  384. name: string;
  385. // File MIME type
  386. fileType: string;
  387. // Size in bytes
  388. size: number;
  389. // File bytes
  390. data: ArrayBuffer;
  391. // Caption string
  392. caption?: string;
  393. // Send as file message
  394. sendAsFile?: boolean;
  395. }
  396. /**
  397. * Payload for a text message.
  398. */
  399. interface TextMessageData extends MessageData {
  400. // Text to be sent
  401. text: string;
  402. }
  403. interface Quote {
  404. identity: string;
  405. text: string;
  406. }
  407. const enum PushTokenType {
  408. Gcm = 'gcm',
  409. Apns = 'apns',
  410. }
  411. const enum PushTokenPrefix {
  412. Gcm = 'g',
  413. Apns = 'a',
  414. }
  415. const enum WakeupType {
  416. // A full reconnect (by entering the password on the main screen).
  417. FullReconnect = '0',
  418. // A wakeup, as implemented by the iOS app.
  419. Wakeup = '1',
  420. }
  421. interface TrustedKeyStoreData {
  422. ownPublicKey: Uint8Array;
  423. ownSecretKey: Uint8Array;
  424. peerPublicKey: Uint8Array;
  425. pushToken: string | null;
  426. pushTokenType: PushTokenType | null;
  427. }
  428. const enum BrowserName {
  429. Chrome = 'chrome',
  430. Firefox = 'firefox',
  431. InternetExplorer = 'ie',
  432. Edge = 'edge',
  433. Opera = 'opera',
  434. Safari = 'safari',
  435. }
  436. interface BrowserInfo {
  437. chrome: boolean;
  438. firefox: boolean;
  439. ie: boolean;
  440. edge: boolean;
  441. opera: boolean;
  442. safari: boolean;
  443. name?: BrowserName;
  444. version?: number;
  445. textInfo?: string;
  446. }
  447. interface PromiseCallbacks {
  448. resolve: (arg: any) => void;
  449. reject: (arg: any) => void;
  450. }
  451. interface PromiseRequestResult<T> {
  452. success: boolean;
  453. error?: string;
  454. data?: T;
  455. }
  456. type OnRemovedCallback = (identity: string) => void;
  457. const enum ControllerModelMode {
  458. NEW = 'new',
  459. VIEW = 'view',
  460. EDIT = 'edit',
  461. CHAT = 'chat',
  462. }
  463. const enum ContactReceiverFeature {
  464. AUDIO = 0x01,
  465. GROUP_CHAT = 0x02,
  466. BALLOT = 0x04,
  467. FILE = 0x08,
  468. VOIP = 0x10,
  469. }
  470. interface ControllerModel<T extends BaseReceiver> {
  471. /**
  472. * The title shown in the header.
  473. */
  474. subject: string;
  475. /**
  476. * Loading state.
  477. */
  478. isLoading: boolean;
  479. /**
  480. * Save the changes, return a promise with the receiver.
  481. */
  482. save(): Promise<T>;
  483. /**
  484. * Delete all messages in this conversation.
  485. */
  486. clean(ev: any): any;
  487. /**
  488. * Validate this receiver.
  489. */
  490. isValid(): boolean;
  491. /*
  492. * Return whether this receiver can be chatted with.
  493. */
  494. canChat(): boolean;
  495. /**
  496. * Can this receiver be edited?
  497. */
  498. canEdit(): boolean;
  499. /**
  500. * Can this receiver be cleaned?
  501. */
  502. canClean(): boolean;
  503. /*
  504. * Return whether this receiver can show a QR code of the public key.
  505. */
  506. canShowQr(): boolean;
  507. /**
  508. * The editing mode, e.g. view or edit this receiver.
  509. */
  510. getMode(): ControllerModelMode;
  511. /**
  512. * Set the on removed callback.
  513. */
  514. setOnRemoved(callback: OnRemovedCallback): void;
  515. /**
  516. * Callback called when the members change.
  517. */
  518. onChangeMembers(identities: string[]): void;
  519. /**
  520. * Return the members of this receiver.
  521. */
  522. getMembers(): string[];
  523. }
  524. interface Alert {
  525. source: string;
  526. type: string;
  527. message: string;
  528. }
  529. interface ReceiverListener {
  530. onConversationRemoved(receiver: Receiver);
  531. }
  532. interface Config {
  533. SELF_HOSTED: boolean;
  534. PREV_PROTOCOL_LAST_VERSION: string | null;
  535. VERSION_MOUNTAIN: string;
  536. VERSION_MOUNTAIN_URL: string;
  537. VERSION_MOUNTAIN_HEIGHT: number;
  538. GIT_BRANCH: string;
  539. SALTYRTC_PORT: number;
  540. SALTYRTC_SERVER_KEY: string | null;
  541. SALTYRTC_HOST: string | null;
  542. SALTYRTC_HOST_PREFIX: string | null;
  543. SALTYRTC_HOST_SUFFIX: string | null;
  544. ICE_SERVERS: RTCIceServer[];
  545. PUSH_URL: string;
  546. DEBUG: boolean;
  547. MSG_DEBUGGING: boolean;
  548. MSGPACK_DEBUGGING: boolean;
  549. ICE_DEBUGGING: boolean;
  550. }
  551. interface InitialConversationData {
  552. draft: string;
  553. initialText: string;
  554. }
  555. interface BrowserMinVersions {
  556. FF: number;
  557. CHROME: number;
  558. OPERA: number;
  559. SAFARI: number;
  560. }
  561. interface BatteryStatus {
  562. percent: number | null;
  563. isCharging: boolean;
  564. }
  565. const enum OperatingSystem {
  566. Android = 'android',
  567. Ios = 'ios',
  568. }
  569. interface ClientInfo {
  570. device: string;
  571. os: OperatingSystem;
  572. osVersion: string;
  573. isWork: boolean;
  574. pushToken?: string;
  575. configuration: AppConfig;
  576. capabilities: AppCapabilities;
  577. }
  578. interface AppConfig {
  579. voipEnabled: boolean;
  580. voipForceTurn: boolean;
  581. largeSingleEmoji: boolean;
  582. showInactiveIDs: boolean;
  583. }
  584. interface AppCapabilities {
  585. maxGroupSize: number;
  586. maxFileSize: number;
  587. distributionLists: boolean;
  588. imageFormat: ImageFormat;
  589. mdm?: MdmRestrictions;
  590. }
  591. /**
  592. * MIME types for the images exchanged between app and browser.
  593. */
  594. interface ImageFormat {
  595. avatar: string;
  596. thumbnail: string;
  597. }
  598. interface MdmRestrictions {
  599. disableAddContact?: boolean;
  600. disableCreateGroup?: boolean;
  601. disableSaveToGallery?: boolean;
  602. disableExport?: boolean;
  603. disableMessagePreview?: boolean;
  604. disableCalls?: boolean;
  605. readonlyProfile?: boolean;
  606. }
  607. interface ProfileUpdate {
  608. publicNickname?: string;
  609. avatar?: ArrayBuffer;
  610. }
  611. interface Profile extends ProfileUpdate {
  612. identity: string;
  613. publicKey: ArrayBuffer;
  614. }
  615. interface Mention {
  616. identity: string;
  617. query: string;
  618. isAll: boolean;
  619. }
  620. interface WordResult {
  621. // The trimmed word
  622. word: string;
  623. // The length of the untrimmed word
  624. realLength: number;
  625. }
  626. const enum ChosenTask {
  627. None = 'none',
  628. WebRTC = 'webrtc',
  629. RelayedData = 'relayed-data',
  630. }
  631. const enum DisconnectReason {
  632. SessionStopped = 'stop',
  633. SessionDeleted = 'delete',
  634. WebclientDisabled = 'disable',
  635. SessionReplaced = 'replace',
  636. }
  637. namespace Container {
  638. interface ReceiverData {
  639. contacts: ContactReceiver[];
  640. groups: GroupReceiver[];
  641. distributionLists: DistributionListReceiver[];
  642. }
  643. interface Converter {
  644. unicodeToEmoji(message);
  645. addReceiverToConversation(receivers: Receivers);
  646. }
  647. interface Filters {
  648. hasData(receivers);
  649. hasContact(contacts);
  650. isValidMessage(contacts);
  651. }
  652. interface Receivers {
  653. me: MeReceiver;
  654. contacts: Map<string, ContactReceiver>;
  655. groups: Map<string, GroupReceiver>;
  656. distributionLists: Map<string, DistributionListReceiver>;
  657. get(receiverType: ReceiverType): Receiver | Map<string, Receiver>;
  658. getData(receiver: BaseReceiver): Receiver | null;
  659. set(data: ReceiverData): void;
  660. setMe(data: MeReceiver): void;
  661. setContacts(data: ContactReceiver[]): void;
  662. setGroups(data: GroupReceiver[]): void;
  663. setDistributionLists(data: DistributionListReceiver[]): void;
  664. extend(receiverType: ReceiverType, data: Receiver): Receiver;
  665. extendDistributionList(data: DistributionListReceiver): DistributionListReceiver;
  666. extendGroup(data: GroupReceiver): GroupReceiver;
  667. extendMe(data: MeReceiver): MeReceiver;
  668. extendContact(data: ContactReceiver): ContactReceiver;
  669. }
  670. interface Conversations {
  671. get(): Conversation[];
  672. set(data: Conversation[]): void;
  673. find(pattern: Conversation | Receiver): Conversation | null;
  674. add(conversation: Conversation): void;
  675. updateOrAdd(conversation: Conversation): Conversation | null;
  676. remove(conversation: Conversation): void;
  677. setFilter(filter: (data: Conversation[]) => Conversation[]): void;
  678. setConverter(converter: (data: Conversation) => Conversation): void;
  679. }
  680. interface Messages {
  681. converter: (data: Message) => Message;
  682. getList(receiver: BaseReceiver): Message[];
  683. clear($scope: ng.IScope): void;
  684. clearReceiverMessages(receiver: BaseReceiver): number;
  685. contains(receiver: BaseReceiver): boolean;
  686. hasMore(receiver: BaseReceiver): boolean;
  687. setMore(receiver: BaseReceiver, more: boolean): void;
  688. getReferenceMsgId(receiver: BaseReceiver): string;
  689. isRequested(receiver: BaseReceiver): boolean;
  690. setRequested(receiver: BaseReceiver): void;
  691. clearRequested(receiver: BaseReceiver): void;
  692. addNewer(receiver: BaseReceiver, messages: Message[]): void;
  693. addOlder(receiver: BaseReceiver, messages: Message[]): void;
  694. update(receiver: BaseReceiver, message: Message): boolean;
  695. setThumbnail(receiver: BaseReceiver, messageId: string, thumbnailImage: string): boolean;
  696. remove(receiver: BaseReceiver, messageId: string): boolean;
  697. removeTemporary(receiver: BaseReceiver, temporaryMessageId: string): boolean;
  698. bindTemporaryToMessageId(receiver: BaseReceiver, temporaryId: string, messageId: string): boolean;
  699. notify(receiver: BaseReceiver, $scope: ng.IScope): void;
  700. register(receiver: BaseReceiver, $scope: ng.IScope, callback: any): Message[];
  701. updateFirstUnreadMessage(receiver: BaseReceiver);
  702. }
  703. interface Typing {
  704. setTyping(receiver: ContactReceiver): void;
  705. unsetTyping(receiver: ContactReceiver): void;
  706. clearAll(): void;
  707. isTyping(receiver: ContactReceiver): boolean;
  708. }
  709. interface Drafts {
  710. setQuote(receiver: Receiver, quote: Quote): void;
  711. removeQuote(receiver: Receiver): void;
  712. getQuote(receiver: Receiver): Quote;
  713. setText(receiver: Receiver, draftMessage: string): void;
  714. removeText(receiver: Receiver): void;
  715. getText(receiver: Receiver): string;
  716. }
  717. interface Factory {
  718. Converter: Container.Converter;
  719. Filters: Container.Filters;
  720. createReceivers: () => Receivers;
  721. createConversations: () => Conversations;
  722. createMessages: () => Messages;
  723. createTyping: () => Typing;
  724. createDrafts: () => Drafts;
  725. }
  726. }
  727. }