2018-04-10 01:26:48 +02:00
|
|
|
import { Attachment } from './Attachment';
|
2018-04-25 20:15:06 +02:00
|
|
|
import { IndexableBoolean, IndexablePresence } from './IndexedDB';
|
2018-04-10 01:26:48 +02:00
|
|
|
|
2021-01-18 00:58:34 +01:00
|
|
|
export type Message = UserMessage;
|
2020-07-13 09:10:20 +02:00
|
|
|
export type UserMessage = IncomingMessage;
|
2018-04-10 01:26:48 +02:00
|
|
|
|
2018-04-13 22:25:52 +02:00
|
|
|
export type IncomingMessage = Readonly<
|
|
|
|
{
|
|
|
|
type: 'incoming';
|
|
|
|
// Required
|
|
|
|
attachments: Array<Attachment>;
|
|
|
|
id: string;
|
|
|
|
received_at: number;
|
2018-04-10 01:26:48 +02:00
|
|
|
|
2018-04-13 22:25:52 +02:00
|
|
|
// Optional
|
|
|
|
body?: string;
|
|
|
|
decrypted_at?: number;
|
|
|
|
errors?: Array<any>;
|
2018-05-10 00:12:31 +02:00
|
|
|
expireTimer?: number;
|
2018-04-13 22:25:52 +02:00
|
|
|
flags?: number;
|
|
|
|
source?: string;
|
|
|
|
sourceDevice?: number;
|
|
|
|
} & SharedMessageProperties &
|
2018-04-25 20:15:06 +02:00
|
|
|
MessageSchemaVersion5 &
|
2018-04-13 22:25:52 +02:00
|
|
|
ExpirationTimerUpdate
|
|
|
|
>;
|
2018-04-12 00:36:11 +02:00
|
|
|
|
|
|
|
type SharedMessageProperties = Readonly<{
|
|
|
|
conversationId: string;
|
|
|
|
sent_at: number;
|
2018-04-10 01:26:48 +02:00
|
|
|
timestamp: number;
|
2018-04-12 00:36:11 +02:00
|
|
|
}>;
|
|
|
|
|
2018-04-14 04:09:56 +02:00
|
|
|
type ExpirationTimerUpdate = Partial<
|
|
|
|
Readonly<{
|
|
|
|
expirationTimerUpdate: Readonly<{
|
|
|
|
expireTimer: number;
|
|
|
|
fromSync: boolean;
|
2021-01-27 23:46:15 +01:00
|
|
|
source: string;
|
2018-04-14 04:09:56 +02:00
|
|
|
}>;
|
|
|
|
}>
|
|
|
|
>;
|
2018-04-10 01:26:48 +02:00
|
|
|
|
2018-04-25 20:15:06 +02:00
|
|
|
type MessageSchemaVersion5 = Partial<
|
2018-04-14 04:09:56 +02:00
|
|
|
Readonly<{
|
|
|
|
hasAttachments: IndexableBoolean;
|
2018-04-25 20:15:06 +02:00
|
|
|
hasVisualMediaAttachments: IndexablePresence;
|
|
|
|
hasFileAttachments: IndexablePresence;
|
2018-04-14 04:09:56 +02:00
|
|
|
}>
|
|
|
|
>;
|
2018-05-05 03:19:54 +02:00
|
|
|
|
2020-05-25 03:40:17 +02:00
|
|
|
export type LokiProfile = {
|
|
|
|
displayName: string;
|
2021-11-29 07:40:46 +01:00
|
|
|
avatarPointer?: string;
|
2021-01-29 01:29:24 +01:00
|
|
|
profileKey: Uint8Array | null;
|
2020-05-25 03:40:17 +02:00
|
|
|
};
|