(file: AFile, refresh: boolean)
| 52 | } |
| 53 | public loadFile: (file: AFile) => Promise<void>; |
| 54 | public async parseCache (file: AFile, refresh: boolean) { |
| 55 | |
| 56 | |
| 57 | if (!file) return; |
| 58 | const thumbnailPath = `${this.cacheDirectory}/${hashCode(file.path)}.${file.extension}`; |
| 59 | let thumbnail = file.path |
| 60 | if (this.plugin.superstate.settings.imageThumbnails) { |
| 61 | if (!(await this.middleware.fileExists(thumbnailPath))) |
| 62 | { |
| 63 | if (!Platform.isMobile) { |
| 64 | const thumbnailResult = await this.generateThumbnail(file, thumbnailPath); |
| 65 | if (thumbnailResult) { |
| 66 | thumbnail = thumbnailPath |
| 67 | } |
| 68 | } |
| 69 | } else { |
| 70 | thumbnail = thumbnailPath |
| 71 | } |
| 72 | } |
| 73 | const label = this.middleware.getFileCache(file.path)?.label |
| 74 | const updatedCache = { |
| 75 | subtype: "image", |
| 76 | label: { |
| 77 | name: file.name, |
| 78 | sticker: label?.sticker.length > 0 ? label.sticker : "ui//mk-make-image", |
| 79 | color: label?.color, |
| 80 | thumbnail: thumbnail, |
| 81 | cover: thumbnail, |
| 82 | }, |
| 83 | preview: { |
| 84 | thumbnail: thumbnail, |
| 85 | } |
| 86 | } |
| 87 | this.cache.set(file.path, updatedCache); |
| 88 | this.middleware.updateFileCache(file.path, this.cache.get(file.path), refresh); |
| 89 | } |
| 90 | |
| 91 | public cacheTypes (file: AFile) { return [] as Array<keyof ImageTypeCache>} |
| 92 | public contentTypes (file: AFile) { return [] as Array<keyof ImageTypeContent>} |
nothing calls this directly
no test coverage detected