Contact sharing: protos and data pipeline
As of this commit: 82b76ccf37
This commit is contained in:
parent
b6a585a646
commit
3ea3e4e256
7 changed files with 868 additions and 27 deletions
|
@ -283,6 +283,7 @@ describe('Backup', () => {
|
|||
|
||||
const OUR_NUMBER = '+12025550000';
|
||||
const CONTACT_ONE_NUMBER = '+12025550001';
|
||||
const CONTACT_TWO_NUMBER = '+12025550002';
|
||||
|
||||
async function wrappedLoadAttachment(attachment) {
|
||||
return _.omit(await loadAttachmentData(attachment), ['path']);
|
||||
|
@ -356,18 +357,31 @@ describe('Backup', () => {
|
|||
return wrappedLoadAttachment(thumbnail);
|
||||
});
|
||||
|
||||
const promises = (message.attachments || []).map(attachment =>
|
||||
wrappedLoadAttachment(attachment)
|
||||
);
|
||||
|
||||
return Object.assign({}, await loadThumbnails(message), {
|
||||
attachments: await Promise.all(promises),
|
||||
contact: await Promise.all(
|
||||
(message.contact || []).map(async contact => {
|
||||
return contact && contact.avatar && contact.avatar.avatar
|
||||
? Object.assign({}, contact, {
|
||||
avatar: Object.assign({}, contact.avatar, {
|
||||
avatar: await wrappedLoadAttachment(
|
||||
contact.avatar.avatar
|
||||
),
|
||||
}),
|
||||
})
|
||||
: contact;
|
||||
})
|
||||
),
|
||||
attachments: await Promise.all(
|
||||
(message.attachments || []).map(attachment =>
|
||||
wrappedLoadAttachment(attachment)
|
||||
)
|
||||
),
|
||||
});
|
||||
}
|
||||
|
||||
let backupDir;
|
||||
try {
|
||||
const ATTACHMENT_COUNT = 2;
|
||||
const ATTACHMENT_COUNT = 3;
|
||||
const MESSAGE_COUNT = 1;
|
||||
const CONVERSATION_COUNT = 1;
|
||||
|
||||
|
@ -473,6 +487,59 @@ describe('Backup', () => {
|
|||
},
|
||||
],
|
||||
},
|
||||
contact: [
|
||||
{
|
||||
name: {
|
||||
displayName: 'Someone Somewhere',
|
||||
},
|
||||
number: [
|
||||
{
|
||||
value: CONTACT_TWO_NUMBER,
|
||||
type: 1,
|
||||
},
|
||||
],
|
||||
avatar: {
|
||||
isProfile: false,
|
||||
avatar: {
|
||||
contentType: 'image/png',
|
||||
data: new Uint8Array([
|
||||
3,
|
||||
2,
|
||||
3,
|
||||
4,
|
||||
5,
|
||||
6,
|
||||
7,
|
||||
8,
|
||||
1,
|
||||
2,
|
||||
3,
|
||||
4,
|
||||
5,
|
||||
6,
|
||||
7,
|
||||
8,
|
||||
1,
|
||||
2,
|
||||
3,
|
||||
4,
|
||||
5,
|
||||
6,
|
||||
7,
|
||||
8,
|
||||
1,
|
||||
2,
|
||||
3,
|
||||
4,
|
||||
5,
|
||||
6,
|
||||
7,
|
||||
8,
|
||||
]).buffer,
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
console.log('Backup test: Clear all data');
|
||||
|
@ -494,7 +561,7 @@ describe('Backup', () => {
|
|||
profileAvatar: {
|
||||
contentType: 'image/jpeg',
|
||||
data: new Uint8Array([
|
||||
3,
|
||||
4,
|
||||
2,
|
||||
3,
|
||||
4,
|
||||
|
@ -530,7 +597,7 @@ describe('Backup', () => {
|
|||
size: 64,
|
||||
},
|
||||
profileKey: new Uint8Array([
|
||||
4,
|
||||
5,
|
||||
2,
|
||||
3,
|
||||
4,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue