Skip to content

Commit daa61fa

Browse files
feat. use convertFileSrc() instead
1 parent 025cbd5 commit daa61fa

File tree

1 file changed

+2
-20
lines changed

1 file changed

+2
-20
lines changed

src/sidebarApps/extensions/index.js

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -302,8 +302,6 @@ async function loadExplore() {
302302
}
303303
}
304304

305-
const iconUrls = new Map();
306-
307305
async function listInstalledPlugins() {
308306
let dirItems;
309307

@@ -332,24 +330,8 @@ async function listInstalledPlugins() {
332330
}
333331

334332
try {
335-
const iconUrl = getLocalRes(id, plugin.icon);
336-
if (iconUrls.has(iconUrl)) {
337-
URL.revokeObjectURL(iconUrls.get(iconUrl));
338-
iconUrls.delete(iconUrl);
339-
}
340-
341-
if (await internalFs.exists(iconUrl)) {
342-
const fileContent = await internalFs.readFileRaw(iconUrl);
343-
const ext = Url.extname(iconUrl);
344-
const mime = mimeType.lookup(ext);
345-
const blob = new Blob([fileContent.data], { type: mime });
346-
const url = URL.createObjectURL(blob);
347-
plugin.icon = url;
348-
iconUrls.set(iconUrl, url);
349-
} else {
350-
console.error(`File path ${iconUrl} doesnt exists`);
351-
plugin.icon = null;
352-
}
333+
const iconUrl = Capacitor.convertFileSrc(getLocalRes(id, plugin.icon));
334+
plugin.icon = iconUrl;
353335
} catch (err) {
354336
plugin.icon = null;
355337
}

0 commit comments

Comments
 (0)