Revert "Refactor outbound delivery state"

This reverts commit 9c48a95eb5.
This commit is contained in:
Fedor Indutny 2021-07-12 16:51:45 -07:00 committed by GitHub
parent 77668c3247
commit ad217c808d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
29 changed files with 694 additions and 3197 deletions

View file

@ -15,11 +15,8 @@ import type { ConversationModel } from '../models/conversations';
import type { StoredJob } from '../jobs/types';
import type { ReactionType } from '../types/Reactions';
import type { ConversationColorType, CustomColorType } from '../types/Colors';
import type { BodyRangesType } from '../types/Util';
import { StorageAccessType } from '../types/Storage.d';
import type { AttachmentType } from '../types/Attachment';
import type { SendState } from '../messages/MessageSendState';
import type { MessageRowWithJoinedSends } from './rowToMessage';
export type AttachmentDownloadJobTypeType =
| 'long-message'
@ -72,17 +69,21 @@ export type ItemType<K extends ItemKeyType> = {
value: StorageAccessType[K];
};
export type MessageType = MessageAttributesType;
export type MessageTypeUnhydrated = {
json: string;
};
export type PreKeyType = {
id: number;
privateKey: ArrayBuffer;
publicKey: ArrayBuffer;
};
export type SearchResultMessageType = MessageRowWithJoinedSends & {
export type SearchResultMessageType = {
json: string;
snippet: string;
};
export type ClientSearchResultMessageType = MessageType & {
json: string;
bodyRanges: BodyRangesType;
bodyRanges: [];
snippet: string;
};
export type SenderKeyType = {
@ -254,15 +255,6 @@ export type DataInterface = {
) => Promise<void>;
getNextTapToViewMessageTimestampToAgeOut: () => Promise<undefined | number>;
updateMessageSendState(
params: Readonly<
{
messageId: string;
destinationConversationId: string;
} & SendState
>
): Promise<void>;
getUnprocessedCount: () => Promise<number>;
getAllUnprocessed: () => Promise<Array<UnprocessedType>>;
updateUnprocessedAttempts: (id: string, attempts: number) => Promise<void>;
@ -353,20 +345,6 @@ export type DataInterface = {
value: CustomColorType;
}
) => Promise<void>;
// For testing only
_getSendStates: (
options: Readonly<{
messageId: string;
destinationConversationId: string;
}>
) => Promise<
Array<{
updatedAt: number;
status: string;
}>
>;
};
// The reason for client/server divergence is the need to inject Backbone models and
@ -399,11 +377,11 @@ export type ServerInterface = DataInterface & {
sentAt?: number;
messageId?: string;
}
) => Promise<Array<MessageRowWithJoinedSends>>;
) => Promise<Array<MessageTypeUnhydrated>>;
getNewerMessagesByConversation: (
conversationId: string,
options?: { limit?: number; receivedAt?: number; sentAt?: number }
) => Promise<Array<MessageRowWithJoinedSends>>;
) => Promise<Array<MessageTypeUnhydrated>>;
getLastConversationActivity: (options: {
conversationId: string;
ourConversationId: string;