Support voice memo backups
This commit is contained in:
parent
348503c7f9
commit
9cbbbe0ef0
4 changed files with 82 additions and 19 deletions
|
@ -13,10 +13,11 @@ import { ReadStatus } from '../../messages/MessageReadStatus';
|
|||
import { SeenStatus } from '../../MessageSeenStatus';
|
||||
import { loadCallsHistory } from '../../services/callHistoryLoader';
|
||||
import { setupBasics, asymmetricRoundtripHarness } from './helpers';
|
||||
import { IMAGE_JPEG } from '../../types/MIME';
|
||||
import { AUDIO_MP3, IMAGE_JPEG } from '../../types/MIME';
|
||||
import type { MessageAttributesType } from '../../model-types';
|
||||
import type { AttachmentType } from '../../types/Attachment';
|
||||
import { isVoiceMessage, type AttachmentType } from '../../types/Attachment';
|
||||
import { strictAssert } from '../../util/assert';
|
||||
import { SignalService } from '../../protobuf';
|
||||
|
||||
const CONTACT_A = generateAci();
|
||||
|
||||
|
@ -129,6 +130,33 @@ describe('backup/attachments', () => {
|
|||
BackupLevel.Media
|
||||
);
|
||||
});
|
||||
it('roundtrips voice message attachments', async () => {
|
||||
const attachment = composeAttachment(1);
|
||||
attachment.contentType = AUDIO_MP3;
|
||||
attachment.flags = SignalService.AttachmentPointer.Flags.VOICE_MESSAGE;
|
||||
|
||||
strictAssert(isVoiceMessage(attachment), 'it is a voice attachment');
|
||||
strictAssert(attachment.digest, 'digest exists');
|
||||
|
||||
await asymmetricRoundtripHarness(
|
||||
[
|
||||
composeMessage(1, {
|
||||
attachments: [attachment],
|
||||
}),
|
||||
],
|
||||
[
|
||||
composeMessage(1, {
|
||||
attachments: [
|
||||
{
|
||||
...omit(attachment, ['path', 'iv', 'uploadTimestamp']),
|
||||
backupLocator: { mediaName: attachment.digest },
|
||||
},
|
||||
],
|
||||
}),
|
||||
],
|
||||
BackupLevel.Media
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe('Preview attachments', () => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue