2023-01-03 11:55:46 -08:00
|
|
|
// Copyright 2020 Signal Messenger, LLC
|
2020-10-30 15:34:04 -05:00
|
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
2020-07-27 14:15:32 -04:00
|
|
|
import * as Backbone from 'backbone';
|
2024-07-24 13:14:11 -07:00
|
|
|
import type { ReadonlyDeep } from 'type-fest';
|
2020-07-10 11:28:49 -07:00
|
|
|
|
2022-09-06 20:51:34 +00:00
|
|
|
import type { GroupV2ChangeType } from './groups';
|
2023-04-14 11:16:28 -07:00
|
|
|
import type { DraftBodyRanges, RawBodyRange } from './types/BodyRange';
|
2022-09-06 20:51:34 +00:00
|
|
|
import type { CustomColorType, ConversationColorType } from './types/Colors';
|
|
|
|
import type { SendMessageChallengeData } from './textsecure/Errors';
|
|
|
|
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';
|
|
|
|
|
2024-05-23 17:06:41 -04:00
|
|
|
import type {
|
|
|
|
AttachmentDraftType,
|
|
|
|
AttachmentType,
|
|
|
|
ThumbnailType,
|
|
|
|
} from './types/Attachment';
|
2022-09-06 20:51:34 +00:00
|
|
|
import type { EmbeddedContactType } from './types/EmbeddedContact';
|
2021-07-13 11:54:53 -07:00
|
|
|
import { SignalService as Proto } from './protobuf';
|
2023-10-30 09:24:28 -07:00
|
|
|
import type { AvatarDataType, ContactAvatarType } from './types/Avatar';
|
2023-08-10 18:43:33 +02:00
|
|
|
import type { AciString, PniString, ServiceIdString } from './types/ServiceId';
|
|
|
|
import type { StoryDistributionIdString } from './types/StoryDistributionId';
|
2022-09-06 20:51:34 +00:00
|
|
|
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-07 17:19:02 -07:00
|
|
|
import type { StorySendMode } from './types/Stories';
|
2022-09-06 20:51:34 +00:00
|
|
|
import type { MIMEType } from './types/MIME';
|
2022-11-16 12:18:02 -08:00
|
|
|
import type { DurationInSeconds } from './util/durations';
|
2022-11-30 13:47:54 -08:00
|
|
|
import type { AnyPaymentEvent } from './types/Payment';
|
2021-07-13 11:54:53 -07:00
|
|
|
|
|
|
|
import AccessRequiredEnum = Proto.AccessControl.AccessRequired;
|
|
|
|
import MemberRoleEnum = Proto.Member.Role;
|
2024-03-12 09:29:31 -07:00
|
|
|
import type { MessageRequestResponseEvent } from './types/MessageRequestResponseEvent';
|
2024-11-20 11:38:45 -05:00
|
|
|
import type { QuotedMessageForComposerType } from './state/ducks/composer';
|
2020-07-27 14:15:32 -04:00
|
|
|
|
2021-06-17 10:15:10 -07:00
|
|
|
export type LastMessageStatus =
|
|
|
|
| 'paused'
|
|
|
|
| 'error'
|
|
|
|
| 'partial-sent'
|
|
|
|
| 'sending'
|
|
|
|
| 'sent'
|
|
|
|
| 'delivered'
|
2021-07-27 10:42:25 -05:00
|
|
|
| 'read'
|
|
|
|
| 'viewed';
|
2020-07-27 14:15:32 -04:00
|
|
|
|
2023-08-10 18:43:33 +02:00
|
|
|
export type SenderKeyDeviceType = {
|
|
|
|
id: number;
|
2023-08-16 22:54:39 +02:00
|
|
|
serviceId: ServiceIdString;
|
2023-08-10 18:43:33 +02:00
|
|
|
registrationId: number;
|
|
|
|
};
|
|
|
|
|
2021-12-08 11:52:46 -08:00
|
|
|
export type SenderKeyInfoType = {
|
|
|
|
createdAtDate: number;
|
|
|
|
distributionId: string;
|
2023-08-10 18:43:33 +02:00
|
|
|
memberDevices: Array<SenderKeyDeviceType>;
|
2021-12-08 11:52:46 -08:00
|
|
|
};
|
|
|
|
|
2021-01-14 12:07:05 -06:00
|
|
|
export type CustomError = Error & {
|
2023-08-10 18:43:33 +02:00
|
|
|
serviceId?: ServiceIdString;
|
2020-09-24 13:57:54 -07:00
|
|
|
number?: string;
|
2021-05-05 17:09:29 -07:00
|
|
|
data?: object;
|
|
|
|
retryAfter?: number;
|
2021-01-14 12:07:05 -06:00
|
|
|
};
|
2020-09-24 13:57:54 -07:00
|
|
|
|
2020-12-01 15:45:39 -08:00
|
|
|
export type GroupMigrationType = {
|
|
|
|
areWeInvited: boolean;
|
2024-04-30 06:24:21 -07:00
|
|
|
droppedMemberIds?: Array<string>;
|
|
|
|
invitedMembers?: Array<LegacyMigrationPendingMemberType>;
|
|
|
|
|
|
|
|
// We don't generate data like this; these were added to support import/export
|
|
|
|
droppedMemberCount?: number;
|
|
|
|
invitedMemberCount?: number;
|
2020-12-01 15:45:39 -08:00
|
|
|
};
|
|
|
|
|
2024-05-23 17:06:41 -04:00
|
|
|
export type QuotedAttachmentType = {
|
2022-06-13 14:39:35 -07:00
|
|
|
contentType: MIMEType;
|
|
|
|
fileName?: string;
|
2024-05-23 17:06:41 -04:00
|
|
|
thumbnail?: ThumbnailType;
|
2022-06-13 14:39:35 -07:00
|
|
|
};
|
2022-03-04 16:14:52 -05:00
|
|
|
|
2021-04-14 15:15:57 -07:00
|
|
|
export type QuotedMessageType = {
|
2024-05-23 17:06:41 -04:00
|
|
|
attachments: ReadonlyArray<QuotedAttachmentType>;
|
2022-11-30 13:47:54 -08:00
|
|
|
payment?: AnyPaymentEvent;
|
2021-04-14 15:15:57 -07: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;
|
2023-08-16 22:54:39 +02:00
|
|
|
authorAci?: AciString;
|
2023-04-10 09:31:45 -07:00
|
|
|
bodyRanges?: ReadonlyArray<RawBodyRange>;
|
2024-11-12 17:00:46 -05:00
|
|
|
// id can be null if the referenced message was not found and we imported this quote
|
|
|
|
// from backup
|
|
|
|
id: number | null;
|
2022-05-11 13:59:58 -07:00
|
|
|
isGiftBadge?: boolean;
|
2021-06-02 09:42:19 -07:00
|
|
|
isViewOnce: boolean;
|
2022-05-11 13:59:58 -07:00
|
|
|
referencedMessageNotFound: boolean;
|
|
|
|
text?: string;
|
2024-11-20 11:38:45 -05:00
|
|
|
/** @deprecated `messageId` is used only in composer state, but still may exist in DB
|
|
|
|
* records, particularly for messages sent from this device */
|
|
|
|
messageId?: string;
|
2021-04-14 15:15:57 -07:00
|
|
|
};
|
|
|
|
|
2022-03-16 13:30:14 -04:00
|
|
|
type StoryReplyContextType = {
|
|
|
|
attachment?: AttachmentType;
|
2023-08-16 22:54:39 +02:00
|
|
|
authorAci?: AciString;
|
2022-03-16 13:30:14 -04:00
|
|
|
messageId: string;
|
|
|
|
};
|
|
|
|
|
2021-06-23 11:14:11 -05:00
|
|
|
export type GroupV1Update = {
|
|
|
|
avatarUpdated?: boolean;
|
|
|
|
joined?: Array<string>;
|
|
|
|
left?: string | 'You';
|
|
|
|
name?: string;
|
|
|
|
};
|
|
|
|
|
2021-10-29 18:19:44 -05:00
|
|
|
export type MessageReactionType = {
|
|
|
|
emoji: undefined | string;
|
|
|
|
fromId: string;
|
|
|
|
targetTimestamp: number;
|
|
|
|
timestamp: number;
|
|
|
|
isSentByConversationId?: Record<string, boolean>;
|
|
|
|
};
|
|
|
|
|
2023-11-17 10:16:48 -08:00
|
|
|
// Note: when adding to the set of things that can change via edits, sendNormalMessage.ts
|
2024-03-25 12:21:14 -07:00
|
|
|
// needs more usage of get/setPropForTimestamp. Also, these fields must match the fields
|
|
|
|
// in MessageAttributesType.
|
2023-03-27 19:48:57 -04:00
|
|
|
export type EditHistoryType = {
|
|
|
|
attachments?: Array<AttachmentType>;
|
|
|
|
body?: string;
|
2024-01-30 13:22:23 -08:00
|
|
|
bodyAttachment?: AttachmentType;
|
2023-04-10 09:31:45 -07:00
|
|
|
bodyRanges?: ReadonlyArray<RawBodyRange>;
|
2023-03-27 19:48:57 -04:00
|
|
|
preview?: Array<LinkPreviewType>;
|
2023-04-20 12:31:59 -04:00
|
|
|
quote?: QuotedMessageType;
|
2023-08-15 19:24:19 -04:00
|
|
|
sendStateByConversationId?: SendStateByConversationId;
|
2023-03-27 19:48:57 -04:00
|
|
|
timestamp: number;
|
2024-03-25 12:21:14 -07:00
|
|
|
received_at: number;
|
|
|
|
received_at_ms?: number;
|
2024-09-16 17:40:52 -07:00
|
|
|
serverTimestamp?: number;
|
|
|
|
readStatus?: ReadStatus;
|
|
|
|
unidentifiedDeliveryReceived?: boolean;
|
2023-03-27 19:48:57 -04:00
|
|
|
};
|
|
|
|
|
2024-04-30 06:24:21 -07:00
|
|
|
type MessageType =
|
|
|
|
| 'call-history'
|
|
|
|
| 'change-number-notification'
|
|
|
|
| 'chat-session-refreshed'
|
|
|
|
| 'conversation-merge'
|
|
|
|
| 'delivery-issue'
|
|
|
|
| 'group-v1-migration'
|
|
|
|
| 'group-v2-change'
|
|
|
|
| 'group'
|
|
|
|
| 'incoming'
|
2024-05-22 09:34:19 -07:00
|
|
|
| 'joined-signal-notification'
|
2024-04-30 06:24:21 -07:00
|
|
|
| 'keychange'
|
|
|
|
| 'outgoing'
|
|
|
|
| 'phone-number-discovery'
|
|
|
|
| 'profile-change'
|
|
|
|
| 'story'
|
|
|
|
| 'timer-notification'
|
|
|
|
| 'universal-timer-notification'
|
|
|
|
| 'contact-removed-notification'
|
|
|
|
| 'title-transition-notification'
|
|
|
|
| 'verified-change'
|
|
|
|
| 'message-request-response-event';
|
|
|
|
|
2020-09-11 12:37:01 -07:00
|
|
|
export type MessageAttributesType = {
|
2022-05-23 16:07:41 -07:00
|
|
|
bodyAttachment?: AttachmentType;
|
2023-04-10 09:31:45 -07:00
|
|
|
bodyRanges?: ReadonlyArray<RawBodyRange>;
|
2023-08-08 17:53:06 -07:00
|
|
|
callId?: string;
|
2022-06-30 20:52:03 -04:00
|
|
|
canReplyToStory?: boolean;
|
2021-06-17 10:15:10 -07:00
|
|
|
changedId?: string;
|
2021-09-23 17:49:05 -07:00
|
|
|
dataMessage?: Uint8Array | null;
|
2021-06-17 10:15:10 -07:00
|
|
|
decrypted_at?: number;
|
|
|
|
deletedForEveryone?: boolean;
|
2020-09-29 15:55:56 -07:00
|
|
|
deletedForEveryoneTimestamp?: number;
|
2021-04-05 15:18:19 -07:00
|
|
|
errors?: Array<CustomError>;
|
2021-06-17 10:15:10 -07:00
|
|
|
expirationStartTimestamp?: number | null;
|
2022-11-16 12:18:02 -08:00
|
|
|
expireTimer?: DurationInSeconds;
|
2020-12-01 15:45:39 -08:00
|
|
|
groupMigration?: GroupMigrationType;
|
2021-06-23 11:14:11 -05:00
|
|
|
group_update?: GroupV1Update;
|
2022-06-09 18:10:20 -07:00
|
|
|
hasAttachments?: boolean | 0 | 1;
|
|
|
|
hasFileAttachments?: boolean | 0 | 1;
|
|
|
|
hasVisualMediaAttachments?: boolean | 0 | 1;
|
2023-05-23 17:59:07 -04:00
|
|
|
mentionsMe?: boolean | 0 | 1;
|
2021-06-17 10:15:10 -07:00
|
|
|
isErased?: boolean;
|
|
|
|
isTapToViewInvalid?: boolean;
|
|
|
|
isViewOnce?: boolean;
|
2023-03-27 19:48:57 -04:00
|
|
|
editHistory?: Array<EditHistoryType>;
|
|
|
|
editMessageTimestamp?: number;
|
2024-03-25 12:21:14 -07:00
|
|
|
editMessageReceivedAt?: number;
|
|
|
|
editMessageReceivedAtMs?: number;
|
2021-06-17 10:15:10 -07:00
|
|
|
key_changed?: string;
|
|
|
|
local?: boolean;
|
|
|
|
logger?: unknown;
|
|
|
|
message?: unknown;
|
|
|
|
messageTimer?: unknown;
|
2024-03-12 09:29:31 -07:00
|
|
|
messageRequestResponseEvent?: MessageRequestResponseEvent;
|
2021-06-17 10:15:10 -07:00
|
|
|
profileChange?: ProfileNameChangeType;
|
2022-11-30 13:47:54 -08:00
|
|
|
payment?: AnyPaymentEvent;
|
2021-04-14 15:15:57 -07:00
|
|
|
quote?: QuotedMessageType;
|
2022-11-02 16:48:38 -07:00
|
|
|
reactions?: ReadonlyArray<MessageReactionType>;
|
2021-06-17 10:15:10 -07:00
|
|
|
requiredProtocolVersion?: number;
|
2024-06-13 16:26:26 -07:00
|
|
|
sms?: boolean;
|
2021-08-02 14:55:31 -07:00
|
|
|
sourceDevice?: number;
|
2023-08-10 18:43:33 +02:00
|
|
|
storyDistributionListId?: StoryDistributionIdString;
|
2021-12-08 11:52:46 -08:00
|
|
|
storyId?: string;
|
2022-03-16 13:30:14 -04:00
|
|
|
storyReplyContext?: StoryReplyContextType;
|
2022-11-28 18:07:26 -08:00
|
|
|
storyRecipientsVersion?: number;
|
2021-06-17 10:15:10 -07:00
|
|
|
supportedVersionAtReceive?: unknown;
|
|
|
|
synced?: boolean;
|
|
|
|
unidentifiedDeliveryReceived?: boolean;
|
|
|
|
verified?: boolean;
|
|
|
|
verifiedChanged?: string;
|
2020-09-24 13:57:54 -07:00
|
|
|
|
2020-07-27 14:15:32 -04:00
|
|
|
id: string;
|
2024-04-30 06:24:21 -07:00
|
|
|
type: MessageType;
|
2021-06-17 10:15:10 -07:00
|
|
|
body?: string;
|
|
|
|
attachments?: Array<AttachmentType>;
|
2022-06-13 14:39:35 -07:00
|
|
|
preview?: Array<LinkPreviewType>;
|
|
|
|
sticker?: StickerType;
|
2021-05-03 11:38:20 -05:00
|
|
|
sent_at: number;
|
2021-06-17 10:15:10 -07:00
|
|
|
unidentifiedDeliveries?: Array<string>;
|
2021-08-19 18:56:39 -07:00
|
|
|
contact?: Array<EmbeddedContactType>;
|
2020-09-24 13:57:54 -07:00
|
|
|
conversationId: string;
|
2022-11-02 16:48:38 -07:00
|
|
|
storyReaction?: {
|
|
|
|
emoji: string;
|
2023-08-16 22:54:39 +02:00
|
|
|
targetAuthorAci: AciString;
|
2022-11-02 16:48:38 -07:00
|
|
|
targetTimestamp: number;
|
|
|
|
};
|
2024-09-16 17:40:52 -07:00
|
|
|
giftBadge?:
|
|
|
|
| {
|
|
|
|
state:
|
|
|
|
| GiftBadgeStates.Unopened
|
|
|
|
| GiftBadgeStates.Opened
|
|
|
|
| GiftBadgeStates.Redeemed;
|
|
|
|
expiration: number;
|
|
|
|
level: number;
|
|
|
|
id: string | undefined;
|
|
|
|
receiptCredentialPresentation: string;
|
|
|
|
}
|
|
|
|
| {
|
|
|
|
state: GiftBadgeStates.Failed;
|
|
|
|
};
|
2020-09-08 19:25:05 -07:00
|
|
|
|
|
|
|
expirationTimerUpdate?: {
|
2022-11-16 12:18:02 -08:00
|
|
|
expireTimer?: DurationInSeconds;
|
2020-09-24 13:57:54 -07:00
|
|
|
fromSync?: unknown;
|
2020-09-08 19:25:05 -07:00
|
|
|
source?: string;
|
2023-08-16 22:54:39 +02:00
|
|
|
sourceServiceId?: ServiceIdString;
|
2020-09-08 19:25:05 -07:00
|
|
|
};
|
2023-10-23 19:40:42 +02:00
|
|
|
phoneNumberDiscovery?: {
|
|
|
|
e164: string;
|
|
|
|
};
|
2022-12-05 14:46:54 -08:00
|
|
|
conversationMerge?: {
|
|
|
|
renderInfo: ConversationRenderInfoType;
|
|
|
|
};
|
2024-03-06 15:59:51 -08:00
|
|
|
titleTransition?: {
|
|
|
|
renderInfo: ConversationRenderInfoType;
|
|
|
|
};
|
2022-12-05 14:46:54 -08:00
|
|
|
|
2020-09-08 19:25:05 -07: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 15:18:19 -07:00
|
|
|
received_at: number;
|
2021-03-04 16:44:57 -05:00
|
|
|
received_at_ms?: number;
|
2020-09-08 19:25:05 -07: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 10:15:10 -07:00
|
|
|
schemaVersion?: number;
|
2022-06-20 14:18:23 -07:00
|
|
|
// migrateMessageData will increment this field on every failure and give up
|
|
|
|
// when the value is too high.
|
|
|
|
schemaMigrationAttempts?: number;
|
2021-05-27 16:17:05 -04: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-08 19:25:05 -07:00
|
|
|
serverTimestamp?: number;
|
2020-09-24 13:57:54 -07:00
|
|
|
source?: string;
|
2023-08-16 22:54:39 +02:00
|
|
|
sourceServiceId?: ServiceIdString;
|
2020-07-27 14:15:32 -04:00
|
|
|
|
2020-09-24 13:57:54 -07:00
|
|
|
timestamp: number;
|
2020-12-01 15:45:39 -08:00
|
|
|
|
|
|
|
// Backwards-compatibility with prerelease data schema
|
2023-08-16 22:54:39 +02:00
|
|
|
invitedGV2Members?: Array<LegacyMigrationPendingMemberType>;
|
2020-12-01 15:45:39 -08:00
|
|
|
droppedGV2MemberIds?: Array<string>;
|
2021-07-09 12:36:10 -07:00
|
|
|
|
|
|
|
sendHQImages?: boolean;
|
2021-07-19 17:44:49 -05:00
|
|
|
|
2022-04-22 11:35:14 -07:00
|
|
|
// Should only be present for incoming messages and errors
|
2022-09-21 19:54:48 -04:00
|
|
|
readAt?: number;
|
2021-08-12 13:15:55 -05:00
|
|
|
readStatus?: ReadStatus;
|
2022-04-22 11:35:14 -07:00
|
|
|
// Used for all kinds of notifications, as well as incoming messages
|
|
|
|
seenStatus?: SeenStatus;
|
2021-08-12 13:15:55 -05:00
|
|
|
|
2021-07-19 17:44:49 -05:00
|
|
|
// Should only be present for outgoing messages
|
|
|
|
sendStateByConversationId?: SendStateByConversationId;
|
2022-03-04 11:22:31 -08:00
|
|
|
|
|
|
|
// Should only be present for messages deleted for everyone
|
|
|
|
deletedForEveryoneSendStatus?: Record<string, boolean>;
|
|
|
|
deletedForEveryoneFailed?: boolean;
|
2020-09-24 13:57:54 -07:00
|
|
|
};
|
2020-07-27 14:15:32 -04:00
|
|
|
|
2024-07-24 13:14:11 -07:00
|
|
|
export type ReadonlyMessageAttributesType = ReadonlyDeep<MessageAttributesType>;
|
|
|
|
|
2020-09-24 13:57:54 -07:00
|
|
|
export type ConversationAttributesTypeType = 'private' | 'group';
|
2020-07-27 14:15:32 -04:00
|
|
|
|
2022-03-09 12:23:21 -08:00
|
|
|
export type ConversationLastProfileType = Readonly<{
|
|
|
|
profileKey: string;
|
|
|
|
profileKeyVersion: string;
|
|
|
|
}>;
|
|
|
|
|
2022-07-12 20:37:21 -04:00
|
|
|
export type ValidateConversationType = Pick<
|
|
|
|
ConversationAttributesType,
|
2023-08-16 22:54:39 +02:00
|
|
|
'e164' | 'serviceId' | 'type' | 'groupId'
|
2022-07-12 20:37:21 -04:00
|
|
|
>;
|
|
|
|
|
2023-04-20 12:31:59 -04:00
|
|
|
export type DraftEditMessageType = {
|
|
|
|
editHistoryLength: number;
|
|
|
|
attachmentThumbnail?: string;
|
|
|
|
bodyRanges?: DraftBodyRanges;
|
|
|
|
body: string;
|
|
|
|
preview?: LinkPreviewType;
|
|
|
|
targetMessageId: string;
|
2024-11-20 11:38:45 -05:00
|
|
|
quote?: QuotedMessageForComposerType['quote'];
|
2023-04-20 12:31:59 -04:00
|
|
|
};
|
|
|
|
|
2020-09-11 12:37:01 -07:00
|
|
|
export type ConversationAttributesType = {
|
2021-04-05 15:18:19 -07:00
|
|
|
accessKey?: string | null;
|
2020-10-06 10:06:34 -07:00
|
|
|
addedBy?: string;
|
2021-11-02 18:01:13 -05:00
|
|
|
badges?: Array<
|
|
|
|
| { id: string }
|
|
|
|
| {
|
|
|
|
id: string;
|
|
|
|
expiresAt: number;
|
|
|
|
isVisible: boolean;
|
|
|
|
}
|
|
|
|
>;
|
2020-11-20 09:30:45 -08:00
|
|
|
capabilities?: CapabilitiesType;
|
2020-10-16 11:31:57 -07:00
|
|
|
color?: string;
|
2021-06-08 14:31:35 -07:00
|
|
|
conversationColor?: ConversationColorType;
|
2021-05-28 12:15:17 -04:00
|
|
|
customColor?: CustomColorType;
|
|
|
|
customColorId?: string;
|
2024-07-15 13:58:55 -07:00
|
|
|
|
|
|
|
// Set at backup import time, exported as is.
|
|
|
|
wallpaperPhotoPointerBase64?: string;
|
|
|
|
wallpaperPreset?: number;
|
2024-07-25 07:58:51 -07:00
|
|
|
dimWallpaperInDarkMode?: boolean;
|
2024-09-12 16:48:27 -07:00
|
|
|
autoBubbleColor?: boolean;
|
2024-07-15 13:58:55 -07:00
|
|
|
|
2021-02-11 13:21:20 -06:00
|
|
|
discoveredUnregisteredAt?: number;
|
2022-09-19 11:47:49 -07:00
|
|
|
firstUnregisteredAt?: number;
|
2021-08-30 14:32:56 -07:00
|
|
|
draftChanged?: boolean;
|
2023-01-05 13:58:13 -08:00
|
|
|
draftAttachments?: ReadonlyArray<AttachmentDraftType>;
|
2023-04-14 11:16:28 -07:00
|
|
|
draftBodyRanges?: DraftBodyRanges;
|
2021-04-05 15:18:19 -07:00
|
|
|
draftTimestamp?: number | null;
|
2022-03-04 16:14:52 -05:00
|
|
|
hideStory?: boolean;
|
2022-07-13 17:46:46 -07:00
|
|
|
inbox_position?: number;
|
2023-04-05 13:48:00 -07:00
|
|
|
// When contact is removed - it is initially placed into `justNotification`
|
|
|
|
// removal stage. In this stage user can still send messages (which will
|
|
|
|
// set `removalStage` to `undefined`), but if a new incoming message arrives -
|
|
|
|
// the stage will progress to `messageRequest` and composition area will be
|
|
|
|
// replaced with a message request.
|
|
|
|
removalStage?: 'justNotification' | 'messageRequest';
|
2022-07-13 17:46:46 -07:00
|
|
|
isPinned?: boolean;
|
|
|
|
lastMessageDeletedForEveryone?: boolean;
|
2023-04-10 09:31:45 -07:00
|
|
|
lastMessage?: string | null;
|
|
|
|
lastMessageBodyRanges?: ReadonlyArray<RawBodyRange>;
|
|
|
|
lastMessagePrefix?: string;
|
2022-08-25 10:16:37 -06:00
|
|
|
lastMessageAuthor?: string | null;
|
2023-04-10 09:31:45 -07:00
|
|
|
lastMessageStatus?: LastMessageStatus | null;
|
2024-03-25 12:21:14 -07:00
|
|
|
lastMessageReceivedAt?: number;
|
|
|
|
lastMessageReceivedAtMs?: number;
|
2022-07-13 17:46:46 -07:00
|
|
|
markedUnread?: boolean;
|
|
|
|
messageCount?: number;
|
2021-04-05 15:18:19 -07:00
|
|
|
messageCountBeforeMessageRequests?: number | null;
|
|
|
|
messageRequestResponseType?: number;
|
2024-12-10 13:04:00 -05:00
|
|
|
messagesDeleted?: boolean;
|
2021-04-05 15:18:19 -07:00
|
|
|
muteExpiresAt?: number;
|
2021-08-05 07:35:33 -05:00
|
|
|
dontNotifyForMentionsIfMuted?: boolean;
|
2024-02-07 13:38:43 -08:00
|
|
|
sharingPhoneNumber?: boolean;
|
2023-10-30 09:24:28 -07:00
|
|
|
profileAvatar?: ContactAvatarType | null;
|
2021-04-05 15:18:19 -07:00
|
|
|
profileKeyCredential?: string | null;
|
2022-07-08 13:46:25 -07:00
|
|
|
profileKeyCredentialExpiration?: number | null;
|
2022-03-09 12:23:21 -08:00
|
|
|
lastProfile?: ConversationLastProfileType;
|
2024-03-06 15:59:51 -08:00
|
|
|
needsTitleTransition?: boolean;
|
2021-04-05 15:18:19 -07:00
|
|
|
quotedMessageId?: string | null;
|
2024-09-06 10:52:19 -07:00
|
|
|
/**
|
|
|
|
* TODO: Rename this key to be specific to the accessKey on the conversation
|
|
|
|
* It's not used for group endorsements.
|
|
|
|
*/
|
2021-04-05 15:18:19 -07:00
|
|
|
sealedSender?: unknown;
|
2022-07-13 17:46:46 -07:00
|
|
|
sentMessageCount?: number;
|
2023-01-05 13:58:13 -08:00
|
|
|
sharedGroupNames?: ReadonlyArray<string>;
|
2022-09-15 14:10:46 -06:00
|
|
|
voiceNotePlaybackRate?: number;
|
2020-09-24 13:57:54 -07:00
|
|
|
|
2020-07-27 14:15:32 -04:00
|
|
|
id: string;
|
2020-09-24 13:57:54 -07:00
|
|
|
type: ConversationAttributesTypeType;
|
2021-04-05 15:18:19 -07:00
|
|
|
timestamp?: number | null;
|
2020-07-27 14:15:32 -04:00
|
|
|
|
2020-09-08 19:25:05 -07:00
|
|
|
// Shared fields
|
2020-07-27 14:15:32 -04:00
|
|
|
active_at?: number | null;
|
2020-09-24 13:57:54 -07:00
|
|
|
draft?: string | null;
|
2023-04-20 12:31:59 -04:00
|
|
|
draftEditMessage?: DraftEditMessageType;
|
2022-03-28 21:10:08 -04:00
|
|
|
hasPostedStory?: boolean;
|
2020-07-27 14:15:32 -04:00
|
|
|
isArchived?: boolean;
|
2024-03-12 09:29:31 -07:00
|
|
|
isReported?: boolean;
|
2020-09-08 19:25:05 -07:00
|
|
|
name?: string;
|
2022-09-27 16:07:00 -07:00
|
|
|
systemGivenName?: string;
|
|
|
|
systemFamilyName?: string;
|
2023-02-13 14:40:11 -08:00
|
|
|
systemNickname?: string;
|
2024-03-26 12:48:33 -07:00
|
|
|
nicknameGivenName?: string | null;
|
|
|
|
nicknameFamilyName?: string | null;
|
|
|
|
note?: string | null;
|
2020-09-08 20:56:23 -04:00
|
|
|
needsStorageServiceSync?: boolean;
|
2020-07-27 14:15:32 -04:00
|
|
|
needsVerification?: boolean;
|
2022-07-13 17:46:46 -07:00
|
|
|
profileSharing?: boolean;
|
2020-07-27 14:15:32 -04:00
|
|
|
storageID?: string;
|
2022-02-08 10:00:18 -08:00
|
|
|
storageVersion?: number;
|
2021-03-18 12:09:27 -05:00
|
|
|
storageUnknownFields?: string;
|
2020-07-27 14:15:32 -04:00
|
|
|
unreadCount?: number;
|
2023-05-23 17:59:07 -04:00
|
|
|
unreadMentionsCount?: number;
|
2020-07-27 14:15:32 -04:00
|
|
|
version: number;
|
2020-09-08 19:25:05 -07:00
|
|
|
|
|
|
|
// Private core info
|
2023-08-16 22:54:39 +02:00
|
|
|
serviceId?: ServiceIdString;
|
2023-08-10 18:43:33 +02:00
|
|
|
pni?: PniString;
|
2024-01-29 14:37:26 -08:00
|
|
|
pniSignatureVerified?: boolean;
|
2020-09-08 19:25:05 -07:00
|
|
|
e164?: string;
|
|
|
|
|
|
|
|
// Private other fields
|
2021-01-25 20:01:19 -05:00
|
|
|
about?: string;
|
|
|
|
aboutEmoji?: string;
|
2020-09-24 13:57:54 -07:00
|
|
|
profileFamilyName?: string;
|
|
|
|
profileKey?: string;
|
|
|
|
profileName?: string;
|
2020-09-08 19:25:05 -07:00
|
|
|
verified?: number;
|
2024-02-05 18:13:13 -08:00
|
|
|
profileLastUpdatedAt?: number;
|
2021-03-18 12:09:27 -05:00
|
|
|
profileLastFetchedAt?: number;
|
2021-06-01 13:45:43 -07:00
|
|
|
pendingUniversalTimer?: string;
|
2023-04-05 13:48:00 -07:00
|
|
|
pendingRemovedContactNotification?: string;
|
2021-11-01 12:13:35 -07:00
|
|
|
username?: string;
|
2022-08-15 14:53:33 -07:00
|
|
|
shareMyPhoneNumber?: boolean;
|
2022-12-05 14:46:54 -08:00
|
|
|
previousIdentityKey?: string;
|
2023-02-07 16:55:12 -08:00
|
|
|
reportingToken?: string;
|
2020-09-08 19:25:05 -07:00
|
|
|
|
|
|
|
// Group-only
|
|
|
|
groupId?: string;
|
2021-01-29 14:16:48 -08: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 15:18:19 -07:00
|
|
|
left?: boolean;
|
2020-09-08 19:25:05 -07:00
|
|
|
groupVersion?: number;
|
2022-10-07 17:19:02 -07:00
|
|
|
storySendMode?: StorySendMode;
|
2020-09-08 19:25:05 -07:00
|
|
|
|
|
|
|
// GroupV1 only
|
|
|
|
members?: Array<string>;
|
2020-11-20 09:30:45 -08:00
|
|
|
derivedGroupV2Id?: string;
|
2020-09-08 19:25:05 -07:00
|
|
|
|
|
|
|
// GroupV2 core info
|
|
|
|
masterKey?: string;
|
|
|
|
secretParams?: string;
|
|
|
|
publicParams?: string;
|
|
|
|
revision?: number;
|
2021-12-08 11:52:46 -08:00
|
|
|
senderKeyInfo?: SenderKeyInfoType;
|
2020-09-08 19:25:05 -07:00
|
|
|
|
|
|
|
// GroupV2 other fields
|
|
|
|
accessControl?: {
|
2020-12-01 15:45:39 -08:00
|
|
|
attributes: AccessRequiredEnum;
|
|
|
|
members: AccessRequiredEnum;
|
2020-12-18 11:27:43 -08:00
|
|
|
addFromInviteLink: AccessRequiredEnum;
|
2020-09-08 19:25:05 -07:00
|
|
|
};
|
2021-07-20 16:18:35 -04:00
|
|
|
announcementsOnly?: boolean;
|
2023-10-30 09:24:28 -07:00
|
|
|
avatar?: ContactAvatarType | null;
|
2024-04-30 06:24:21 -07:00
|
|
|
avatars?: ReadonlyArray<Readonly<AvatarDataType>>;
|
2021-06-01 17:24:28 -07:00
|
|
|
description?: string;
|
2022-11-16 12:18:02 -08:00
|
|
|
expireTimer?: DurationInSeconds;
|
2024-08-21 09:03:28 -07:00
|
|
|
expireTimerVersion: number;
|
2020-09-08 19:25:05 -07:00
|
|
|
membersV2?: Array<GroupV2MemberType>;
|
|
|
|
pendingMembersV2?: Array<GroupV2PendingMemberType>;
|
2020-12-18 11:27:43 -08:00
|
|
|
pendingAdminApprovalV2?: Array<GroupV2PendingAdminApprovalType>;
|
2022-03-23 15:34:51 -07:00
|
|
|
bannedMembersV2?: Array<GroupV2BannedMemberType>;
|
2020-12-18 11:27:43 -08:00
|
|
|
groupInviteLinkPassword?: string;
|
2020-11-20 09:30:45 -08:00
|
|
|
previousGroupV1Id?: string;
|
|
|
|
previousGroupV1Members?: Array<string>;
|
2021-06-01 18:30:25 -05:00
|
|
|
acknowledgedGroupNameCollisions?: GroupNameCollisionsWithIdsByTitle;
|
2021-01-29 14:16:48 -08:00
|
|
|
|
|
|
|
// Used only when user is waiting for approval to join via link
|
|
|
|
isTemporary?: boolean;
|
|
|
|
temporaryMemberCount?: number;
|
2021-04-30 14:40:25 -05: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).
|
2024-07-11 12:44:09 -07:00
|
|
|
unblurredAvatarUrl?: string;
|
|
|
|
|
|
|
|
// Legacy field, mapped to above in getConversation()
|
2021-04-30 14:40:25 -05:00
|
|
|
unblurredAvatarPath?: string;
|
2020-09-08 19:25:05 -07:00
|
|
|
};
|
|
|
|
|
2022-12-05 14:46:54 -08:00
|
|
|
export type ConversationRenderInfoType = Pick<
|
|
|
|
ConversationAttributesType,
|
|
|
|
| 'e164'
|
|
|
|
| 'name'
|
|
|
|
| 'profileFamilyName'
|
|
|
|
| 'profileName'
|
|
|
|
| 'systemGivenName'
|
2023-02-14 14:35:34 -08:00
|
|
|
| 'systemFamilyName'
|
|
|
|
| 'systemNickname'
|
2024-03-26 12:48:33 -07:00
|
|
|
| 'nicknameGivenName'
|
|
|
|
| 'nicknameFamilyName'
|
2022-12-05 14:46:54 -08:00
|
|
|
| 'type'
|
|
|
|
| 'username'
|
|
|
|
>;
|
|
|
|
|
2020-09-08 19:25:05 -07:00
|
|
|
export type GroupV2MemberType = {
|
2023-08-16 22:54:39 +02:00
|
|
|
aci: AciString;
|
2020-12-01 15:45:39 -08:00
|
|
|
role: MemberRoleEnum;
|
2020-09-08 19:25:05 -07:00
|
|
|
joinedAtVersion: number;
|
2020-12-18 11:27:43 -08: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-08 19:25:05 -07:00
|
|
|
};
|
2021-01-29 16:19:24 -05:00
|
|
|
|
2023-08-16 22:54:39 +02:00
|
|
|
export type LegacyMigrationPendingMemberType = {
|
|
|
|
addedByUserId?: string;
|
|
|
|
uuid: string;
|
|
|
|
timestamp: number;
|
|
|
|
role: MemberRoleEnum;
|
|
|
|
};
|
|
|
|
|
2020-09-08 19:25:05 -07:00
|
|
|
export type GroupV2PendingMemberType = {
|
2024-06-24 11:38:59 -07:00
|
|
|
addedByUserId: AciString;
|
2023-08-16 22:54:39 +02:00
|
|
|
serviceId: ServiceIdString;
|
2020-09-08 19:25:05 -07:00
|
|
|
timestamp: number;
|
2020-12-01 15:45:39 -08:00
|
|
|
role: MemberRoleEnum;
|
2020-07-27 14:15:32 -04:00
|
|
|
};
|
2021-01-29 16:19:24 -05:00
|
|
|
|
2022-03-23 15:34:51 -07:00
|
|
|
export type GroupV2BannedMemberType = {
|
2023-08-16 22:54:39 +02:00
|
|
|
serviceId: ServiceIdString;
|
2022-03-23 15:34:51 -07:00
|
|
|
timestamp: number;
|
|
|
|
};
|
|
|
|
|
2020-12-18 11:27:43 -08:00
|
|
|
export type GroupV2PendingAdminApprovalType = {
|
2023-08-16 22:54:39 +02:00
|
|
|
aci: AciString;
|
2020-12-18 11:27:43 -08:00
|
|
|
timestamp: number;
|
|
|
|
};
|
2020-07-27 14:15:32 -04:00
|
|
|
|
2021-05-05 17:09:29 -07:00
|
|
|
export type ShallowChallengeError = CustomError & {
|
|
|
|
readonly retryAfter: number;
|
|
|
|
readonly data: SendMessageChallengeData;
|
|
|
|
};
|
|
|
|
|
2021-04-26 11:38:50 -05:00
|
|
|
export declare class ConversationModelCollectionType extends Backbone.Collection<ConversationModel> {
|
2020-07-27 14:15:32 -04:00
|
|
|
resetLookups(): void;
|
|
|
|
}
|