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:
Scott Nonnenberg 2019-03-13 13:38:28 -07:00
parent 0e5f405b53
commit 8c4d90df07
20 changed files with 303 additions and 140 deletions

View file

@ -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) {