Send long text as an attachment instead of inline
Remove Android length warning Handle incoming long message attachments Show long download pending status in message bubble Fix the width of the smallest spinner Remove Android length warning from HTML templates
This commit is contained in:
parent
0e5f405b53
commit
8c4d90df07
20 changed files with 303 additions and 140 deletions
|
@ -11,6 +11,7 @@ const {
|
|||
saveMessage,
|
||||
setAttachmentDownloadJobPending,
|
||||
} = require('./data');
|
||||
const { stringFromBytes } = require('./crypto');
|
||||
|
||||
module.exports = {
|
||||
start,
|
||||
|
@ -312,6 +313,19 @@ async function _addAttachmentToMessage(message, attachment, { type, index }) {
|
|||
|
||||
const logPrefix = `${message.idForLogging()} (type: ${type}, index: ${index})`;
|
||||
|
||||
if (type === 'long-message') {
|
||||
try {
|
||||
const { data } = await Signal.Migrations.loadAttachmentData(attachment);
|
||||
message.set({
|
||||
body: attachment.isError ? message.get('body') : stringFromBytes(data),
|
||||
bodyPending: false,
|
||||
});
|
||||
} finally {
|
||||
Signal.Migrations.deleteAttachmentData(attachment.path);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (type === 'attachment') {
|
||||
const attachments = message.get('attachments');
|
||||
if (!attachments || attachments.length <= index) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue