mobile: fix image preview not loading image

This commit is contained in:
Ammar Ahmed
2023-09-22 17:17:25 +05:00
parent 7bac3c1326
commit f10146be03
2 changed files with 3 additions and 5 deletions

View File

@@ -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");

View File

@@ -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);