2023-01-03 19:55:46 +00:00
|
|
|
// Copyright 2020 Signal Messenger, LLC
|
2020-10-30 20:34:04 +00:00
|
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
2022-09-06 20:51:34 +00:00
|
|
|
/* eslint-disable max-classes-per-file */
|
|
|
|
|
2020-07-27 18:15:32 +00:00
|
|
|
import * as Backbone from 'backbone';
|
2020-07-10 18:28:49 +00:00
|
|
|
|
2022-09-06 20:51:34 +00:00
|
|
|
import type { GroupV2ChangeType } from './groups';
|
2022-11-10 04:59:36 +00:00
|
|
|
import type { DraftBodyRangesType, BodyRangesType } from './types/Util';
|
2022-09-06 20:51:34 +00:00
|
|
|
import type { CallHistoryDetailsFromDiskType } from './types/Calling';
|
|
|
|
import type { CustomColorType, ConversationColorType } from './types/Colors';
|
|
|
|
import type { DeviceType } from './textsecure/Types.d';
|
|
|
|
import type { SendMessageChallengeData } from './textsecure/Errors';
|
|
|
|
import type { MessageModel } from './models/messages';
|
|
|
|
import type { ConversationModel } from './models/conversations';
|
|
|
|
import type { ProfileNameChangeType } from './util/getStringForProfileChange';
|
|
|
|
import type { CapabilitiesType } from './textsecure/WebAPI';
|
|
|
|
import type { ReadStatus } from './messages/MessageReadStatus';
|
|
|
|
import type { SendStateByConversationId } from './messages/MessageSendState';
|
|
|
|
import type { GroupNameCollisionsWithIdsByTitle } from './util/groupMemberNameCollisions';
|
|
|
|
|
|
|
|
import type { AttachmentDraftType, AttachmentType } from './types/Attachment';
|
|
|
|
import type { EmbeddedContactType } from './types/EmbeddedContact';
|
2021-07-13 18:54:53 +00:00
|
|
|
import { SignalService as Proto } from './protobuf';
|
2022-09-06 20:51:34 +00:00
|
|
|
import type { AvatarDataType } from './types/Avatar';
|
|
|
|
import type { UUIDStringType } from './types/UUID';
|
|
|
|
import type { ReactionSource } from './reactions/ReactionSource';
|
|
|
|
import type { SeenStatus } from './MessageSeenStatus';
|
|
|
|
import type { GiftBadgeStates } from './components/conversation/Message';
|
|
|
|
import type { LinkPreviewType } from './types/message/LinkPreviews';
|
|
|
|
|
|
|
|
import type { StickerType } from './types/Stickers';
|
2022-10-08 00:19:02 +00:00
|
|
|
import type { StorySendMode } from './types/Stories';
|
2022-09-06 20:51:34 +00:00
|
|
|
import type { MIMEType } from './types/MIME';
|
2022-11-16 20:18:02 +00:00
|
|
|
import type { DurationInSeconds } from './util/durations';
|
2022-11-30 21:47:54 +00:00
|
|
|
import type { AnyPaymentEvent } from './types/Payment';
|
2021-07-13 18:54:53 +00:00
|
|
|
|
|
|
|
import AccessRequiredEnum = Proto.AccessControl.AccessRequired;
|
|
|
|
import MemberRoleEnum = Proto.Member.Role;
|
2020-07-27 18:15:32 +00:00
|
|
|
|
2021-06-17 17:15:10 +00:00
|
|
|
export type LastMessageStatus =
|
|
|
|
| 'paused'
|
|
|
|
| 'error'
|
|
|
|
| 'partial-sent'
|
|
|
|
| 'sending'
|
|
|
|
| 'sent'
|
|
|
|
| 'delivered'
|
2021-07-27 15:42:25 +00:00
|
|
|
| 'read'
|
|
|
|
| 'viewed';
|
2020-07-27 18:15:32 +00:00
|
|
|
|
2021-12-08 19:52:46 +00:00
|
|
|
export type SenderKeyInfoType = {
|
|
|
|
createdAtDate: number;
|
|
|
|
distributionId: string;
|
|
|
|
memberDevices: Array<DeviceType>;
|
|
|
|
};
|
|
|
|
|
2021-01-14 18:07:05 +00:00
|
|
|
export type CustomError = Error & {
|
2020-09-24 20:57:54 +00:00
|
|
|
identifier?: string;
|
|
|
|
number?: string;
|
2021-05-06 00:09:29 +00:00
|
|
|
data?: object;
|
|
|
|
retryAfter?: number;
|
2021-01-14 18:07:05 +00:00
|
|
|
};
|
2020-09-24 20:57:54 +00:00
|
|
|
|
2020-12-01 23:45:39 +00:00
|
|
|
export type GroupMigrationType = {
|
|
|
|
areWeInvited: boolean;
|
|
|
|
droppedMemberIds: Array<string>;
|
|
|
|
invitedMembers: Array<GroupV2PendingMemberType>;
|
|
|
|
};
|
|
|
|
|
2022-06-13 21:39:35 +00:00
|
|
|
export type QuotedAttachment = {
|
|
|
|
contentType: MIMEType;
|
|
|
|
fileName?: string;
|
|
|
|
thumbnail?: AttachmentType;
|
|
|
|
};
|
2022-03-04 21:14:52 +00:00
|
|
|
|
2021-04-14 22:15:57 +00:00
|
|
|
export type QuotedMessageType = {
|
2022-07-13 00:37:21 +00:00
|
|
|
// TODO DESKTOP-3826
|
2022-09-06 20:51:34 +00:00
|
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
2022-07-13 00:37:21 +00:00
|
|
|
attachments: Array<any>;
|
2022-11-30 21:47:54 +00:00
|
|
|
payment?: AnyPaymentEvent;
|
2021-04-14 22:15:57 +00:00
|
|
|
// `author` is an old attribute that holds the author's E164. We shouldn't use it for
|
|
|
|
// new messages, but old messages might have this attribute.
|
|
|
|
author?: string;
|
2021-06-25 16:08:16 +00:00
|
|
|
authorUuid?: string;
|
|
|
|
bodyRanges?: BodyRangesType;
|
2021-07-09 19:36:10 +00:00
|
|
|
id: number;
|
2022-05-11 20:59:58 +00:00
|
|
|
isGiftBadge?: boolean;
|
2021-06-02 16:42:19 +00:00
|
|
|
isViewOnce: boolean;
|
2021-06-25 16:08:16 +00:00
|
|
|
messageId: string;
|
2022-05-11 20:59:58 +00:00
|
|
|
referencedMessageNotFound: boolean;
|
|
|
|
text?: string;
|
2021-04-14 22:15:57 +00:00
|
|
|
};
|
|
|
|
|
2022-03-16 17:30:14 +00:00
|
|
|
type StoryReplyContextType = {
|
|
|
|
attachment?: AttachmentType;
|
|
|
|
authorUuid?: string;
|
|
|
|
messageId: string;
|
|
|
|
};
|
|
|
|
|
2021-05-06 00:09:29 +00:00
|
|
|
export type RetryOptions = Readonly<{
|
|
|
|
type: 'session-reset';
|
|
|
|
uuid: string;
|
|
|
|
e164: string;
|
|
|
|
now: number;
|
|
|
|
}>;
|
|
|
|
|
2021-06-23 16:14:11 +00:00
|
|
|
export type GroupV1Update = {
|
|
|
|
avatarUpdated?: boolean;
|
|
|
|
joined?: Array<string>;
|
|
|
|
left?: string | 'You';
|
|
|
|
name?: string;
|
|
|
|
};
|
|
|
|
|
2021-10-29 23:19:44 +00:00
|
|
|
export type MessageReactionType = {
|
|
|
|
emoji: undefined | string;
|
|
|
|
fromId: string;
|
|
|
|
targetAuthorUuid: string;
|
|
|
|
targetTimestamp: number;
|
|
|
|
timestamp: number;
|
|
|
|
isSentByConversationId?: Record<string, boolean>;
|
|
|
|
};
|
|
|
|
|
2020-09-11 19:37:01 +00:00
|
|
|
export type MessageAttributesType = {
|
2022-05-23 23:07:41 +00:00
|
|
|
bodyAttachment?: AttachmentType;
|
2021-06-17 17:15:10 +00:00
|
|
|
bodyRanges?: BodyRangesType;
|
|
|
|
callHistoryDetails?: CallHistoryDetailsFromDiskType;
|
2022-07-01 00:52:03 +00:00
|
|
|
canReplyToStory?: boolean;
|
2021-06-17 17:15:10 +00:00
|
|
|
changedId?: string;
|
2021-09-24 00:49:05 +00:00
|
|
|
dataMessage?: Uint8Array | null;
|
2021-06-17 17:15:10 +00:00
|
|
|
decrypted_at?: number;
|
|
|
|
deletedForEveryone?: boolean;
|
2020-09-29 22:55:56 +00:00
|
|
|
deletedForEveryoneTimestamp?: number;
|
2021-04-05 22:18:19 +00:00
|
|
|
errors?: Array<CustomError>;
|
2021-06-17 17:15:10 +00:00
|
|
|
expirationStartTimestamp?: number | null;
|
2022-11-16 20:18:02 +00:00
|
|
|
expireTimer?: DurationInSeconds;
|
2020-12-01 23:45:39 +00:00
|
|
|
groupMigration?: GroupMigrationType;
|
2021-06-23 16:14:11 +00:00
|
|
|
group_update?: GroupV1Update;
|
2022-06-10 01:10:20 +00:00
|
|
|
hasAttachments?: boolean | 0 | 1;
|
|
|
|
hasFileAttachments?: boolean | 0 | 1;
|
|
|
|
hasVisualMediaAttachments?: boolean | 0 | 1;
|
2021-06-17 17:15:10 +00:00
|
|
|
isErased?: boolean;
|
|
|
|
isTapToViewInvalid?: boolean;
|
|
|
|
isViewOnce?: boolean;
|
|
|
|
key_changed?: string;
|
|
|
|
local?: boolean;
|
|
|
|
logger?: unknown;
|
|
|
|
message?: unknown;
|
|
|
|
messageTimer?: unknown;
|
|
|
|
profileChange?: ProfileNameChangeType;
|
2022-11-30 21:47:54 +00:00
|
|
|
payment?: AnyPaymentEvent;
|
2021-04-14 22:15:57 +00:00
|
|
|
quote?: QuotedMessageType;
|
2022-11-02 23:48:38 +00:00
|
|
|
reactions?: ReadonlyArray<MessageReactionType>;
|
2021-06-17 17:15:10 +00:00
|
|
|
requiredProtocolVersion?: number;
|
2021-05-06 00:09:29 +00:00
|
|
|
retryOptions?: RetryOptions;
|
2021-08-02 21:55:31 +00:00
|
|
|
sourceDevice?: number;
|
2022-07-01 00:52:03 +00:00
|
|
|
storyDistributionListId?: string;
|
2021-12-08 19:52:46 +00:00
|
|
|
storyId?: string;
|
2022-03-16 17:30:14 +00:00
|
|
|
storyReplyContext?: StoryReplyContextType;
|
2022-11-29 02:07:26 +00:00
|
|
|
storyRecipientsVersion?: number;
|
2021-06-17 17:15:10 +00:00
|
|
|
supportedVersionAtReceive?: unknown;
|
|
|
|
synced?: boolean;
|
|
|
|
unidentifiedDeliveryReceived?: boolean;
|
|
|
|
verified?: boolean;
|
|
|
|
verifiedChanged?: string;
|
2020-09-24 20:57:54 +00:00
|
|
|
|
2020-07-27 18:15:32 +00:00
|
|
|
id: string;
|
2021-06-17 17:15:10 +00:00
|
|
|
type:
|
2021-04-05 22:18:19 +00:00
|
|
|
| 'call-history'
|
2022-12-05 22:46:54 +00:00
|
|
|
| 'change-number-notification'
|
2021-04-05 22:18:19 +00:00
|
|
|
| 'chat-session-refreshed'
|
2022-12-05 22:46:54 +00:00
|
|
|
| 'conversation-merge'
|
2021-05-28 19:11:19 +00:00
|
|
|
| 'delivery-issue'
|
2021-04-05 22:18:19 +00:00
|
|
|
| 'group-v1-migration'
|
|
|
|
| 'group-v2-change'
|
2022-12-05 22:46:54 +00:00
|
|
|
| 'group'
|
2021-05-28 19:11:19 +00:00
|
|
|
| 'incoming'
|
|
|
|
| 'keychange'
|
|
|
|
| 'outgoing'
|
2021-04-05 22:18:19 +00:00
|
|
|
| 'profile-change'
|
2021-12-08 19:52:46 +00:00
|
|
|
| 'story'
|
2021-05-28 19:11:19 +00:00
|
|
|
| 'timer-notification'
|
2021-06-01 20:45:43 +00:00
|
|
|
| 'universal-timer-notification'
|
2021-05-28 19:11:19 +00:00
|
|
|
| 'verified-change';
|
2021-06-17 17:15:10 +00:00
|
|
|
body?: string;
|
|
|
|
attachments?: Array<AttachmentType>;
|
2022-06-13 21:39:35 +00:00
|
|
|
preview?: Array<LinkPreviewType>;
|
|
|
|
sticker?: StickerType;
|
2021-05-03 16:38:20 +00:00
|
|
|
sent_at: number;
|
2021-06-17 17:15:10 +00:00
|
|
|
unidentifiedDeliveries?: Array<string>;
|
2021-08-20 01:56:39 +00:00
|
|
|
contact?: Array<EmbeddedContactType>;
|
2020-09-24 20:57:54 +00:00
|
|
|
conversationId: string;
|
2022-11-02 23:48:38 +00:00
|
|
|
storyReaction?: {
|
|
|
|
emoji: string;
|
|
|
|
targetAuthorUuid: string;
|
|
|
|
targetTimestamp: number;
|
|
|
|
};
|
2022-05-11 20:59:58 +00:00
|
|
|
giftBadge?: {
|
|
|
|
expiration: number;
|
|
|
|
level: number;
|
2022-05-16 19:54:38 +00:00
|
|
|
id: string | undefined;
|
2022-05-11 20:59:58 +00:00
|
|
|
receiptCredentialPresentation: string;
|
|
|
|
state: GiftBadgeStates;
|
|
|
|
};
|
2020-09-09 02:25:05 +00:00
|
|
|
|
|
|
|
expirationTimerUpdate?: {
|
2022-11-16 20:18:02 +00:00
|
|
|
expireTimer?: DurationInSeconds;
|
2020-09-24 20:57:54 +00:00
|
|
|
fromSync?: unknown;
|
2020-09-09 02:25:05 +00:00
|
|
|
source?: string;
|
|
|
|
sourceUuid?: string;
|
|
|
|
};
|
2022-12-05 22:46:54 +00:00
|
|
|
conversationMerge?: {
|
|
|
|
renderInfo: ConversationRenderInfoType;
|
|
|
|
};
|
|
|
|
|
2020-09-09 02:25:05 +00:00
|
|
|
// Legacy fields for timer update notification only
|
|
|
|
flags?: number;
|
|
|
|
groupV2Change?: GroupV2ChangeType;
|
|
|
|
// Required. Used to sort messages in the database for the conversation timeline.
|
2021-04-05 22:18:19 +00:00
|
|
|
received_at: number;
|
2021-03-04 21:44:57 +00:00
|
|
|
received_at_ms?: number;
|
2020-09-09 02:25:05 +00:00
|
|
|
// More of a legacy feature, needed as we were updating the schema of messages in the
|
|
|
|
// background, when we were still in IndexedDB, before attachments had gone to disk
|
|
|
|
// We set this so that the idle message upgrade process doesn't pick this message up
|
2021-06-17 17:15:10 +00:00
|
|
|
schemaVersion?: number;
|
2022-06-20 21:18:23 +00:00
|
|
|
// migrateMessageData will increment this field on every failure and give up
|
|
|
|
// when the value is too high.
|
|
|
|
schemaMigrationAttempts?: number;
|
2021-05-27 20:17:05 +00:00
|
|
|
// This should always be set for new messages, but older messages may not have them. We
|
|
|
|
// may not have these for outbound messages, either, as we have not needed them.
|
|
|
|
serverGuid?: string;
|
2020-09-09 02:25:05 +00:00
|
|
|
serverTimestamp?: number;
|
2020-09-24 20:57:54 +00:00
|
|
|
source?: string;
|
2021-10-26 22:59:08 +00:00
|
|
|
sourceUuid?: UUIDStringType;
|
2020-07-27 18:15:32 +00:00
|
|
|
|
2020-09-24 20:57:54 +00:00
|
|
|
timestamp: number;
|
2020-12-01 23:45:39 +00:00
|
|
|
|
|
|
|
// Backwards-compatibility with prerelease data schema
|
|
|
|
invitedGV2Members?: Array<GroupV2PendingMemberType>;
|
|
|
|
droppedGV2MemberIds?: Array<string>;
|
2021-07-09 19:36:10 +00:00
|
|
|
|
|
|
|
sendHQImages?: boolean;
|
2021-07-19 22:44:49 +00:00
|
|
|
|
2022-04-22 18:35:14 +00:00
|
|
|
// Should only be present for incoming messages and errors
|
2022-09-21 23:54:48 +00:00
|
|
|
readAt?: number;
|
2021-08-12 18:15:55 +00:00
|
|
|
readStatus?: ReadStatus;
|
2022-04-22 18:35:14 +00:00
|
|
|
// Used for all kinds of notifications, as well as incoming messages
|
|
|
|
seenStatus?: SeenStatus;
|
2021-08-12 18:15:55 +00:00
|
|
|
|
2021-07-19 22:44:49 +00:00
|
|
|
// Should only be present for outgoing messages
|
|
|
|
sendStateByConversationId?: SendStateByConversationId;
|
2022-03-04 19:22:31 +00:00
|
|
|
|
|
|
|
// Should only be present for messages deleted for everyone
|
|
|
|
deletedForEveryoneSendStatus?: Record<string, boolean>;
|
|
|
|
deletedForEveryoneFailed?: boolean;
|
2020-09-24 20:57:54 +00:00
|
|
|
};
|
2022-09-06 20:51:34 +00:00
|
|
|
/* eslint-enable camelcase */
|
2020-07-27 18:15:32 +00:00
|
|
|
|
2020-09-24 20:57:54 +00:00
|
|
|
export type ConversationAttributesTypeType = 'private' | 'group';
|
2020-07-27 18:15:32 +00:00
|
|
|
|
2022-03-09 20:23:21 +00:00
|
|
|
export type ConversationLastProfileType = Readonly<{
|
|
|
|
profileKey: string;
|
|
|
|
profileKeyVersion: string;
|
|
|
|
}>;
|
|
|
|
|
2022-07-13 00:37:21 +00:00
|
|
|
export type ValidateConversationType = Pick<
|
|
|
|
ConversationAttributesType,
|
|
|
|
'e164' | 'uuid' | 'type' | 'groupId'
|
|
|
|
>;
|
|
|
|
|
2020-09-11 19:37:01 +00:00
|
|
|
export type ConversationAttributesType = {
|
2021-04-05 22:18:19 +00:00
|
|
|
accessKey?: string | null;
|
2020-10-06 17:06:34 +00:00
|
|
|
addedBy?: string;
|
2021-11-02 23:01:13 +00:00
|
|
|
badges?: Array<
|
|
|
|
| { id: string }
|
|
|
|
| {
|
|
|
|
id: string;
|
|
|
|
expiresAt: number;
|
|
|
|
isVisible: boolean;
|
|
|
|
}
|
|
|
|
>;
|
2020-11-20 17:30:45 +00:00
|
|
|
capabilities?: CapabilitiesType;
|
2020-10-16 18:31:57 +00:00
|
|
|
color?: string;
|
2021-06-08 21:31:35 +00:00
|
|
|
conversationColor?: ConversationColorType;
|
2021-05-28 16:15:17 +00:00
|
|
|
customColor?: CustomColorType;
|
|
|
|
customColorId?: string;
|
2021-02-11 19:21:20 +00:00
|
|
|
discoveredUnregisteredAt?: number;
|
2022-09-19 18:47:49 +00:00
|
|
|
firstUnregisteredAt?: number;
|
2021-08-30 21:32:56 +00:00
|
|
|
draftChanged?: boolean;
|
2023-01-05 21:58:13 +00:00
|
|
|
draftAttachments?: ReadonlyArray<AttachmentDraftType>;
|
2022-11-10 04:59:36 +00:00
|
|
|
draftBodyRanges?: DraftBodyRangesType;
|
2021-04-05 22:18:19 +00:00
|
|
|
draftTimestamp?: number | null;
|
2022-03-04 21:14:52 +00:00
|
|
|
hideStory?: boolean;
|
2022-07-14 00:46:46 +00:00
|
|
|
inbox_position?: number;
|
|
|
|
isPinned?: boolean;
|
|
|
|
lastMessageDeletedForEveryone?: boolean;
|
2021-04-05 22:18:19 +00:00
|
|
|
lastMessageStatus?: LastMessageStatus | null;
|
2022-08-25 16:16:37 +00:00
|
|
|
lastMessageAuthor?: string | null;
|
2022-07-14 00:46:46 +00:00
|
|
|
markedUnread?: boolean;
|
|
|
|
messageCount?: number;
|
2021-04-05 22:18:19 +00:00
|
|
|
messageCountBeforeMessageRequests?: number | null;
|
|
|
|
messageRequestResponseType?: number;
|
|
|
|
muteExpiresAt?: number;
|
2021-08-05 12:35:33 +00:00
|
|
|
dontNotifyForMentionsIfMuted?: boolean;
|
2021-04-23 14:04:05 +00:00
|
|
|
profileAvatar?: null | {
|
|
|
|
hash: string;
|
|
|
|
path: string;
|
|
|
|
};
|
2021-04-05 22:18:19 +00:00
|
|
|
profileKeyCredential?: string | null;
|
2022-07-08 20:46:25 +00:00
|
|
|
profileKeyCredentialExpiration?: number | null;
|
2022-03-09 20:23:21 +00:00
|
|
|
lastProfile?: ConversationLastProfileType;
|
2021-04-05 22:18:19 +00:00
|
|
|
quotedMessageId?: string | null;
|
|
|
|
sealedSender?: unknown;
|
2022-07-14 00:46:46 +00:00
|
|
|
sentMessageCount?: number;
|
2023-01-05 21:58:13 +00:00
|
|
|
sharedGroupNames?: ReadonlyArray<string>;
|
2022-09-15 20:10:46 +00:00
|
|
|
voiceNotePlaybackRate?: number;
|
2020-09-24 20:57:54 +00:00
|
|
|
|
2020-07-27 18:15:32 +00:00
|
|
|
id: string;
|
2020-09-24 20:57:54 +00:00
|
|
|
type: ConversationAttributesTypeType;
|
2021-04-05 22:18:19 +00:00
|
|
|
timestamp?: number | null;
|
2020-07-27 18:15:32 +00:00
|
|
|
|
2020-09-09 02:25:05 +00:00
|
|
|
// Shared fields
|
2020-07-27 18:15:32 +00:00
|
|
|
active_at?: number | null;
|
2020-09-24 20:57:54 +00:00
|
|
|
draft?: string | null;
|
2022-03-29 01:10:08 +00:00
|
|
|
hasPostedStory?: boolean;
|
2020-07-27 18:15:32 +00:00
|
|
|
isArchived?: boolean;
|
2020-09-24 20:57:54 +00:00
|
|
|
lastMessage?: string | null;
|
2020-09-09 02:25:05 +00:00
|
|
|
name?: string;
|
2022-09-27 23:07:00 +00:00
|
|
|
systemGivenName?: string;
|
|
|
|
systemFamilyName?: string;
|
2020-09-09 00:56:23 +00:00
|
|
|
needsStorageServiceSync?: boolean;
|
2020-07-27 18:15:32 +00:00
|
|
|
needsVerification?: boolean;
|
2022-07-14 00:46:46 +00:00
|
|
|
profileSharing?: boolean;
|
2020-07-27 18:15:32 +00:00
|
|
|
storageID?: string;
|
2022-02-08 18:00:18 +00:00
|
|
|
storageVersion?: number;
|
2021-03-18 17:09:27 +00:00
|
|
|
storageUnknownFields?: string;
|
2020-07-27 18:15:32 +00:00
|
|
|
unreadCount?: number;
|
|
|
|
version: number;
|
2020-09-09 02:25:05 +00:00
|
|
|
|
|
|
|
// Private core info
|
2021-10-26 22:59:08 +00:00
|
|
|
uuid?: UUIDStringType;
|
2022-08-09 21:39:00 +00:00
|
|
|
pni?: UUIDStringType;
|
2020-09-09 02:25:05 +00:00
|
|
|
e164?: string;
|
|
|
|
|
|
|
|
// Private other fields
|
2021-01-26 01:01:19 +00:00
|
|
|
about?: string;
|
|
|
|
aboutEmoji?: string;
|
2020-09-24 20:57:54 +00:00
|
|
|
profileFamilyName?: string;
|
|
|
|
profileKey?: string;
|
|
|
|
profileName?: string;
|
2020-09-09 02:25:05 +00:00
|
|
|
verified?: number;
|
2021-03-18 17:09:27 +00:00
|
|
|
profileLastFetchedAt?: number;
|
2021-06-01 20:45:43 +00:00
|
|
|
pendingUniversalTimer?: string;
|
2021-11-01 19:13:35 +00:00
|
|
|
username?: string;
|
2022-08-15 21:53:33 +00:00
|
|
|
shareMyPhoneNumber?: boolean;
|
2022-12-05 22:46:54 +00:00
|
|
|
previousIdentityKey?: string;
|
2023-02-08 00:55:12 +00:00
|
|
|
reportingToken?: string;
|
2020-09-09 02:25:05 +00:00
|
|
|
|
|
|
|
// Group-only
|
|
|
|
groupId?: string;
|
2021-01-29 22:16:48 +00:00
|
|
|
// A shorthand, representing whether the user is part of the group. Not strictly for
|
|
|
|
// when the user manually left the group. But historically, that was the only way
|
|
|
|
// to leave a group.
|
2021-04-05 22:18:19 +00:00
|
|
|
left?: boolean;
|
2020-09-09 02:25:05 +00:00
|
|
|
groupVersion?: number;
|
2022-10-08 00:19:02 +00:00
|
|
|
storySendMode?: StorySendMode;
|
2020-09-09 02:25:05 +00:00
|
|
|
|
|
|
|
// GroupV1 only
|
|
|
|
members?: Array<string>;
|
2020-11-20 17:30:45 +00:00
|
|
|
derivedGroupV2Id?: string;
|
2020-09-09 02:25:05 +00:00
|
|
|
|
|
|
|
// GroupV2 core info
|
|
|
|
masterKey?: string;
|
|
|
|
secretParams?: string;
|
|
|
|
publicParams?: string;
|
|
|
|
revision?: number;
|
2021-12-08 19:52:46 +00:00
|
|
|
senderKeyInfo?: SenderKeyInfoType;
|
2020-09-09 02:25:05 +00:00
|
|
|
|
|
|
|
// GroupV2 other fields
|
|
|
|
accessControl?: {
|
2020-12-01 23:45:39 +00:00
|
|
|
attributes: AccessRequiredEnum;
|
|
|
|
members: AccessRequiredEnum;
|
2020-12-18 19:27:43 +00:00
|
|
|
addFromInviteLink: AccessRequiredEnum;
|
2020-09-09 02:25:05 +00:00
|
|
|
};
|
2021-07-20 20:18:35 +00:00
|
|
|
announcementsOnly?: boolean;
|
2020-09-09 02:25:05 +00:00
|
|
|
avatar?: {
|
|
|
|
url: string;
|
|
|
|
path: string;
|
2021-01-29 22:16:48 +00:00
|
|
|
hash?: string;
|
2020-09-24 20:57:54 +00:00
|
|
|
} | null;
|
2021-08-06 00:17:05 +00:00
|
|
|
avatars?: Array<AvatarDataType>;
|
2021-06-02 00:24:28 +00:00
|
|
|
description?: string;
|
2022-11-16 20:18:02 +00:00
|
|
|
expireTimer?: DurationInSeconds;
|
2020-09-09 02:25:05 +00:00
|
|
|
membersV2?: Array<GroupV2MemberType>;
|
|
|
|
pendingMembersV2?: Array<GroupV2PendingMemberType>;
|
2020-12-18 19:27:43 +00:00
|
|
|
pendingAdminApprovalV2?: Array<GroupV2PendingAdminApprovalType>;
|
2022-03-23 22:34:51 +00:00
|
|
|
bannedMembersV2?: Array<GroupV2BannedMemberType>;
|
2020-12-18 19:27:43 +00:00
|
|
|
groupInviteLinkPassword?: string;
|
2020-11-20 17:30:45 +00:00
|
|
|
previousGroupV1Id?: string;
|
|
|
|
previousGroupV1Members?: Array<string>;
|
2021-06-01 23:30:25 +00:00
|
|
|
acknowledgedGroupNameCollisions?: GroupNameCollisionsWithIdsByTitle;
|
2021-01-29 22:16:48 +00:00
|
|
|
|
|
|
|
// Used only when user is waiting for approval to join via link
|
|
|
|
isTemporary?: boolean;
|
|
|
|
temporaryMemberCount?: number;
|
2021-04-30 19:40:25 +00:00
|
|
|
|
|
|
|
// Avatars are blurred for some unapproved conversations, but users can manually unblur
|
|
|
|
// them. If the avatar was unblurred and then changed, we don't update this value so
|
|
|
|
// the new avatar gets blurred.
|
|
|
|
//
|
|
|
|
// This value is useless once the message request has been approved. We don't clean it
|
|
|
|
// up but could. We don't persist it but could (though we'd probably want to clean it
|
|
|
|
// up in that case).
|
|
|
|
unblurredAvatarPath?: string;
|
2020-09-09 02:25:05 +00:00
|
|
|
};
|
2022-09-06 20:51:34 +00:00
|
|
|
/* eslint-enable camelcase */
|
2020-09-09 02:25:05 +00:00
|
|
|
|
2022-12-05 22:46:54 +00:00
|
|
|
export type ConversationRenderInfoType = Pick<
|
|
|
|
ConversationAttributesType,
|
|
|
|
| 'e164'
|
|
|
|
| 'name'
|
|
|
|
| 'profileFamilyName'
|
|
|
|
| 'profileName'
|
|
|
|
| 'systemGivenName'
|
|
|
|
| 'type'
|
|
|
|
| 'username'
|
|
|
|
>;
|
|
|
|
|
2020-09-09 02:25:05 +00:00
|
|
|
export type GroupV2MemberType = {
|
2021-10-26 22:59:08 +00:00
|
|
|
uuid: UUIDStringType;
|
2020-12-01 23:45:39 +00:00
|
|
|
role: MemberRoleEnum;
|
2020-09-09 02:25:05 +00:00
|
|
|
joinedAtVersion: number;
|
2020-12-18 19:27:43 +00:00
|
|
|
|
|
|
|
// Note that these are temporary flags, generated by applyGroupChange, but eliminated
|
|
|
|
// by applyGroupState. They are used to make our diff-generation more intelligent but
|
|
|
|
// not after that.
|
|
|
|
joinedFromLink?: boolean;
|
|
|
|
approvedByAdmin?: boolean;
|
2020-09-09 02:25:05 +00:00
|
|
|
};
|
2021-01-29 21:19:24 +00:00
|
|
|
|
2020-09-09 02:25:05 +00:00
|
|
|
export type GroupV2PendingMemberType = {
|
2021-10-26 22:59:08 +00:00
|
|
|
addedByUserId?: UUIDStringType;
|
|
|
|
uuid: UUIDStringType;
|
2020-09-09 02:25:05 +00:00
|
|
|
timestamp: number;
|
2020-12-01 23:45:39 +00:00
|
|
|
role: MemberRoleEnum;
|
2020-07-27 18:15:32 +00:00
|
|
|
};
|
2021-01-29 21:19:24 +00:00
|
|
|
|
2022-03-23 22:34:51 +00:00
|
|
|
export type GroupV2BannedMemberType = {
|
|
|
|
uuid: UUIDStringType;
|
|
|
|
timestamp: number;
|
|
|
|
};
|
|
|
|
|
2020-12-18 19:27:43 +00:00
|
|
|
export type GroupV2PendingAdminApprovalType = {
|
2021-10-26 22:59:08 +00:00
|
|
|
uuid: UUIDStringType;
|
2020-12-18 19:27:43 +00:00
|
|
|
timestamp: number;
|
|
|
|
};
|
2020-07-27 18:15:32 +00:00
|
|
|
|
2021-05-06 00:09:29 +00:00
|
|
|
export type ShallowChallengeError = CustomError & {
|
|
|
|
readonly retryAfter: number;
|
|
|
|
readonly data: SendMessageChallengeData;
|
|
|
|
};
|
|
|
|
|
2021-04-26 16:38:50 +00:00
|
|
|
export declare class ConversationModelCollectionType extends Backbone.Collection<ConversationModel> {
|
2020-07-27 18:15:32 +00:00
|
|
|
resetLookups(): void;
|
|
|
|
}
|
|
|
|
|
2021-04-26 16:38:50 +00:00
|
|
|
export declare class MessageModelCollectionType extends Backbone.Collection<MessageModel> {}
|
2021-05-13 19:10:20 +00:00
|
|
|
|
|
|
|
export type ReactionAttributesType = {
|
|
|
|
emoji: string;
|
2023-01-11 22:54:06 +00:00
|
|
|
fromId: string;
|
2021-05-13 19:10:20 +00:00
|
|
|
remove?: boolean;
|
2023-01-11 22:54:06 +00:00
|
|
|
source: ReactionSource;
|
|
|
|
// Necessary to put 1:1 story replies into the right conversation - not the same
|
|
|
|
// conversation as the target message!
|
|
|
|
storyReactionMessage?: MessageModel;
|
2021-05-13 19:10:20 +00:00
|
|
|
targetAuthorUuid: string;
|
|
|
|
targetTimestamp: number;
|
|
|
|
timestamp: number;
|
|
|
|
};
|