Skip to content

Commit 1fa501b

Browse files
committed
fix(appstore): use proper app icon or adjust color if needed
- resolves #61244 Use the dark variant if possible first and then fallback to bright variant and adjust the icon if needed. Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
1 parent 60f4e84 commit 1fa501b

3 files changed

Lines changed: 8 additions & 17 deletions

File tree

apps/appstore/img/app-dark.svg

Lines changed: 1 addition & 1 deletion
Loading

apps/appstore/src/components/AppIcon.vue

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ watch(() => app.icon, async () => {
2424
const response = await fetch(app.icon)
2525
if (response.ok) {
2626
svgIcon.value = await response.text()
27+
svgIcon.value = svgIcon.value
28+
.replaceAll(/(?<=[";])fill:\s?(#fff(fff)?|white)(;|(?="))/gi, '')
29+
.replaceAll(/(?<=\s)fill="[^"]+"/gi, '')
30+
.replaceAll(/(?<=\s)color="[^"]+"/gi, '')
2731
}
2832
}
2933
}, { immediate: true })

lib/private/legacy/OC_App.php

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -445,22 +445,9 @@ public function listAllApps(): array {
445445
$info['level'] = self::supportedApp;
446446
}
447447

448-
try {
449-
$appPath = $appManager->getAppPath($app);
450-
} catch (AppPathNotFoundException) {
451-
$appPath = false;
452-
}
453-
if ($appPath !== false) {
454-
$appIcon = $appPath . '/img/' . $app . '.svg';
455-
if (file_exists($appIcon)) {
456-
$info['icon'] = $urlGenerator->imagePath($app, $app . '.svg');
457-
} else {
458-
$appIcon = $appPath . '/img/app.svg';
459-
if (file_exists($appIcon)) {
460-
$info['icon'] = $urlGenerator->imagePath($app, 'app.svg');
461-
}
462-
}
463-
}
448+
$info['icon'] = $appManager->getAppIcon($app, dark: true)
449+
?? $appManager->getAppIcon($app);
450+
464451
// fix documentation
465452
if (isset($info['documentation']) && is_array($info['documentation'])) {
466453
foreach ($info['documentation'] as $key => $url) {

0 commit comments

Comments
 (0)