Convert signal.js and preload.js to Typescript
This commit is contained in:
parent
e18510e41c
commit
2464e0a9c1
94 changed files with 2113 additions and 1848 deletions
|
@ -12,6 +12,11 @@ export async function downloadAttachment(
|
|||
): Promise<DownloadedAttachmentType | null> {
|
||||
let migratedAttachment: AttachmentType;
|
||||
|
||||
const { server } = window.textsecure;
|
||||
if (!server) {
|
||||
throw new Error('window.textsecure.server is not available!');
|
||||
}
|
||||
|
||||
const { id: legacyId } = attachmentData;
|
||||
if (legacyId === undefined) {
|
||||
migratedAttachment = attachmentData;
|
||||
|
@ -24,10 +29,7 @@ export async function downloadAttachment(
|
|||
|
||||
let downloaded;
|
||||
try {
|
||||
downloaded = await doDownloadAttachment(
|
||||
window.textsecure.server,
|
||||
migratedAttachment
|
||||
);
|
||||
downloaded = await doDownloadAttachment(server, migratedAttachment);
|
||||
} catch (error) {
|
||||
// Attachments on the server expire after 30 days, then start returning 404
|
||||
if (error && error.code === 404) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue