From f10146be03e313a9073910df49cd8ae628fe0b15 Mon Sep 17 00:00:00 2001 From: Ammar Ahmed Date: Fri, 22 Sep 2023 17:17:25 +0500 Subject: [PATCH] mobile: fix image preview not loading image --- apps/mobile/app/common/filesystem/download-attachment.js | 2 ++ apps/mobile/app/common/filesystem/io.js | 6 +----- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/apps/mobile/app/common/filesystem/download-attachment.js b/apps/mobile/app/common/filesystem/download-attachment.js index aa0d9959a..41486b6b5 100644 --- a/apps/mobile/app/common/filesystem/download-attachment.js +++ b/apps/mobile/app/common/filesystem/download-attachment.js @@ -34,6 +34,7 @@ import { useAttachmentStore } from "../../stores/use-attachment-store"; import { db } from "../database"; import Storage from "../database/storage"; import { cacheDir, copyFileAsync, releasePermissions } from "./utils"; +import { createCacheDir } from "./io"; export const FileDownloadStatus = { Success: 1, @@ -184,6 +185,7 @@ export default async function downloadAttachment( } ) { await createCacheDir(); + let attachment = db.attachments.attachment(hash); if (!attachment) { console.log("attachment not found"); diff --git a/apps/mobile/app/common/filesystem/io.js b/apps/mobile/app/common/filesystem/io.js index de2086a2c..c48e8b231 100644 --- a/apps/mobile/app/common/filesystem/io.js +++ b/apps/mobile/app/common/filesystem/io.js @@ -27,16 +27,12 @@ import { IOS_APPGROUPID } from "../../utils/constants"; export async function readEncrypted(filename, key, cipherData) { await migrateFilesFromCache(); - console.log("read encrypted file..."); + console.log("Read encrypted file..."); let path = `${cacheDir}/${filename}`; try { if (!(await exists(filename))) { return false; - } else { - RNFetchBlob.fs.stat(path).then((r) => { - console.log(r); - }); } const attachment = db.attachments.attachment(filename);