Add avatar uploading to attachment utils

pull/1198/head
Mikunj 5 years ago
parent be4e540c62
commit 347a1e5582

@ -914,11 +914,13 @@
profileKey
);
const avatarPointer = await textsecure.messaging.uploadAvatar({
const avatarPointer = await libsession.Utils.AttachmentUtils.uploadAvatar(
{
...data,
data: encryptedData,
size: encryptedData.byteLength,
});
}
);
({ url } = avatarPointer);

@ -104,6 +104,22 @@ export class AttachmentUtils {
return pointer;
}
public static async uploadAvatar(
attachment?: Attachment
): Promise<AttachmentPointer | undefined> {
if (!attachment) {
return undefined;
}
// isRaw is true since the data is already encrypted
// and doesn't need to be encrypted again
return this.upload({
attachment,
isAvatar: true,
isRaw: true,
});
}
public static async uploadAttachments(
attachments: Array<Attachment>,
openGroup?: OpenGroup

Loading…
Cancel
Save