Process text story messages

This commit is contained in:
Josh Perez 2022-04-05 21:18:07 -04:00 committed by GitHub
parent 11d54f6769
commit fc9bdf9398
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 955 additions and 6 deletions

View file

@ -110,7 +110,9 @@ import {
} from './messageReceiverEvents';
import * as log from '../logging/log';
import * as durations from '../util/durations';
import { IMAGE_JPEG } from '../types/MIME';
import { areArraysMatchingSets } from '../util/areArraysMatchingSets';
import { generateBlurHash } from '../util/generateBlurHash';
const GROUPV1_ID_LENGTH = 16;
const GROUPV2_ID_LENGTH = 32;
@ -1800,11 +1802,16 @@ export default class MessageReceiver
}
if (msg.textAttachment) {
log.error(
'MessageReceiver.handleStoryMessage: Got a textAttachment, cannot handle it',
logId
);
return;
attachments.push({
contentType: IMAGE_JPEG,
size: 0,
textAttachment: msg.textAttachment,
blurHash: generateBlurHash(
(msg.textAttachment.color ||
msg.textAttachment.gradient?.startColor) ??
undefined
),
});
}
const expireTimer = Math.min(

View file

@ -4,6 +4,7 @@
import type { SignalService as Proto } from '../protobuf';
import type { IncomingWebSocketRequest } from './WebsocketResources';
import type { UUID } from '../types/UUID';
import type { TextAttachmentType } from '../types/Attachment';
export {
IdentityKeyType,
@ -105,6 +106,7 @@ export type ProcessedAttachment = {
caption?: string;
blurHash?: string;
cdnNumber?: number;
textAttachment?: TextAttachmentType;
};
export type ProcessedGroupContext = {