Skip to content

Commit

Permalink
mobile: fix image preview not loading image
Browse files Browse the repository at this point in the history
  • Loading branch information
ammarahm-ed committed Sep 22, 2023
1 parent 7bac3c1 commit f10146b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
2 changes: 2 additions & 0 deletions apps/mobile/app/common/filesystem/download-attachment.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -184,6 +185,7 @@ export default async function downloadAttachment(
}
) {
await createCacheDir();

let attachment = db.attachments.attachment(hash);
if (!attachment) {
console.log("attachment not found");
Expand Down
6 changes: 1 addition & 5 deletions apps/mobile/app/common/filesystem/io.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit f10146b

Please sign in to comment.