Skip to content

Commit 6d86293

Browse files
committed
feat: use getAppIcon
Signed-off-by: Sebastien Marinier <seb@smarinier.net>
1 parent 34f5acd commit 6d86293

File tree

2 files changed

+4
-17
lines changed

2 files changed

+4
-17
lines changed

appinfo/info.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<repository>https://github.com/nextcloud/ocs_api_viewer.git</repository>
2020
<screenshot>https://raw.githubusercontent.com/nextcloud/ocs_api_viewer/main/docs/screenshot.png</screenshot>
2121
<dependencies>
22-
<nextcloud min-version="26" max-version="30"/>
22+
<nextcloud min-version="29" max-version="30"/>
2323
</dependencies>
2424
<navigations>
2525
<navigation>

lib/Service/AppsService.php

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@ public function findSupported(): array {
5151
'version' => $appInfo['version'],
5252
'always_enabled' => in_array($app, $always),
5353
];
54-
$preview = $this->getPreview($app, $baseDir);
55-
if ($preview !== null) {
56-
$apiInfo['icon_url'] = $preview;
54+
$iconUrl = $this->appManager->getAppIcon($app);
55+
if ($iconUrl !== null) {
56+
$apiInfo['icon_url'] = $iconUrl;
5757
}
5858
$apis[] = $apiInfo;
5959
}
@@ -129,17 +129,4 @@ public function getSpec(string $app): string {
129129

130130
return json_encode($data);
131131
}
132-
133-
private function getPreview(string $app, string $appPath) : ?string {
134-
$appIcon = $appPath . '/img/' . $app . '.svg';
135-
if (file_exists($appIcon)) {
136-
return $this->url->imagePath($app, $app . '.svg');
137-
} else {
138-
$appIcon = $appPath . '/img/app.svg';
139-
if (file_exists($appIcon)) {
140-
return $this->url->imagePath($app, 'app.svg');
141-
}
142-
}
143-
return null;
144-
}
145132
}

0 commit comments

Comments
 (0)