2020-07-27 18:15:32 +00:00
|
|
|
import * as Backbone from 'backbone';
|
2020-07-10 18:28:49 +00:00
|
|
|
|
2020-08-13 20:53:45 +00:00
|
|
|
import { LocalizerType } from './types/Util';
|
|
|
|
import { ColorType } from './types/Colors';
|
2020-07-27 18:15:32 +00:00
|
|
|
import { ConversationType } from './state/ducks/conversations';
|
2020-07-10 18:28:49 +00:00
|
|
|
import { CallingClass, CallHistoryDetailsType } from './services/calling';
|
|
|
|
import { SendOptionsType } from './textsecure/SendMessage';
|
2020-07-27 18:15:32 +00:00
|
|
|
import { SyncMessageClass } from './textsecure.d';
|
|
|
|
|
|
|
|
interface ModelAttributesInterface {
|
|
|
|
[key: string]: any;
|
|
|
|
}
|
|
|
|
|
|
|
|
type DeletesAttributesType = {
|
|
|
|
fromId: string;
|
|
|
|
serverTimestamp: number;
|
|
|
|
targetSentTimestamp: number;
|
|
|
|
};
|
|
|
|
|
|
|
|
declare class DeletesModelType extends Backbone.Model<DeletesAttributesType> {
|
|
|
|
forMessage(message: MessageModelType): Array<DeletesModelType>;
|
|
|
|
onDelete(doe: DeletesAttributesType): Promise<void>;
|
|
|
|
}
|
|
|
|
|
|
|
|
type TaskResultType = any;
|
|
|
|
|
|
|
|
type MessageAttributesType = {
|
|
|
|
id: string;
|
|
|
|
serverTimestamp: number;
|
|
|
|
};
|
|
|
|
|
|
|
|
declare class MessageModelType extends Backbone.Model<MessageAttributesType> {
|
|
|
|
id: string;
|
|
|
|
|
|
|
|
static updateTimers(): void;
|
|
|
|
|
|
|
|
getContact(): ConversationModelType | undefined | null;
|
|
|
|
getConversation(): ConversationModelType | undefined | null;
|
|
|
|
getPropsForSearchResult(): any;
|
|
|
|
getPropsForBubble(): any;
|
|
|
|
cleanup(): Promise<void>;
|
|
|
|
handleDeleteForEveryone(
|
|
|
|
doe: DeletesModelType,
|
|
|
|
shouldPersist: boolean
|
|
|
|
): Promise<void>;
|
|
|
|
}
|
|
|
|
|
|
|
|
type ConversationTypeType = 'private' | 'group';
|
|
|
|
|
|
|
|
type ConversationAttributesType = {
|
|
|
|
id: string;
|
|
|
|
uuid?: string;
|
|
|
|
e164?: string;
|
|
|
|
|
|
|
|
active_at?: number | null;
|
|
|
|
draft?: string;
|
|
|
|
groupId?: string;
|
|
|
|
isArchived?: boolean;
|
|
|
|
lastMessage?: string;
|
|
|
|
members?: Array<string>;
|
|
|
|
needsVerification?: boolean;
|
|
|
|
profileFamilyName?: string | null;
|
|
|
|
profileKey?: string | null;
|
|
|
|
profileName?: string | null;
|
|
|
|
profileSharing: boolean;
|
|
|
|
storageID?: string;
|
|
|
|
type: ConversationTypeType;
|
|
|
|
unreadCount?: number;
|
|
|
|
verified?: number;
|
|
|
|
version: number;
|
|
|
|
};
|
|
|
|
|
|
|
|
declare class ConversationModelType extends Backbone.Model<
|
|
|
|
ConversationAttributesType
|
|
|
|
> {
|
|
|
|
id: string;
|
|
|
|
cachedProps: ConversationType;
|
|
|
|
initialPromise: Promise<any>;
|
2020-07-22 16:47:59 +00:00
|
|
|
messageRequestEnum: typeof SyncMessageClass.MessageRequestResponse.Type;
|
2020-07-27 18:15:32 +00:00
|
|
|
|
2020-07-10 18:28:49 +00:00
|
|
|
addCallHistory(details: CallHistoryDetailsType): void;
|
2020-07-27 18:15:32 +00:00
|
|
|
applyMessageRequestResponse(
|
|
|
|
response: number,
|
|
|
|
options?: { fromSync: boolean }
|
|
|
|
): void;
|
|
|
|
cleanup(): Promise<void>;
|
|
|
|
disableProfileSharing(): void;
|
2020-08-05 01:13:19 +00:00
|
|
|
dropProfileKey(): Promise<void>;
|
2020-08-11 23:15:06 +00:00
|
|
|
generateProps(): void;
|
2020-07-27 18:15:32 +00:00
|
|
|
getAccepted(): boolean;
|
|
|
|
getAvatarPath(): string | undefined;
|
|
|
|
getColor(): ColorType | undefined;
|
|
|
|
getName(): string | undefined;
|
|
|
|
getNumber(): string;
|
|
|
|
getProfileName(): string | undefined;
|
|
|
|
getProfiles(): Promise<Array<Promise<void>>>;
|
|
|
|
getRecipients: () => Array<string>;
|
|
|
|
getSendOptions(options?: any): SendOptionsType | undefined;
|
|
|
|
getTitle(): string;
|
|
|
|
idForLogging(): string;
|
2020-07-29 16:29:57 +00:00
|
|
|
isFromOrAddedByTrustedContact(): boolean;
|
2020-07-27 18:15:32 +00:00
|
|
|
isVerified(): boolean;
|
|
|
|
safeGetVerified(): Promise<number>;
|
|
|
|
setProfileKey(profileKey?: string | null): Promise<void>;
|
|
|
|
toggleVerified(): Promise<TaskResultType>;
|
|
|
|
unblock(): boolean | undefined;
|
|
|
|
updateE164: (e164?: string) => void;
|
|
|
|
updateLastMessage: () => Promise<void>;
|
|
|
|
updateUuid: (uuid?: string) => void;
|
|
|
|
wrapSend: (sendPromise: Promise<any>) => Promise<any>;
|
|
|
|
}
|
|
|
|
|
|
|
|
declare class ConversationModelCollectionType extends Backbone.Collection<
|
|
|
|
ConversationModelType
|
|
|
|
> {
|
|
|
|
resetLookups(): void;
|
|
|
|
}
|
|
|
|
|
|
|
|
declare class MessageModelCollectionType extends Backbone.Collection<
|
|
|
|
MessageModelType
|
|
|
|
> {}
|