Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat: use getAppIcon
Signed-off-by: Sebastien Marinier <[email protected]>
  • Loading branch information
smarinier committed Nov 12, 2024
commit 6d862931a2405631d6024cb247d5fa46b8665a49
2 changes: 1 addition & 1 deletion appinfo/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<repository>https://github.com/nextcloud/ocs_api_viewer.git</repository>
<screenshot>https://raw.githubusercontent.com/nextcloud/ocs_api_viewer/main/docs/screenshot.png</screenshot>
<dependencies>
<nextcloud min-version="26" max-version="30"/>
<nextcloud min-version="29" max-version="30"/>
</dependencies>
<navigations>
<navigation>
Expand Down
19 changes: 3 additions & 16 deletions lib/Service/AppsService.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ public function findSupported(): array {
'version' => $appInfo['version'],
'always_enabled' => in_array($app, $always),
];
$preview = $this->getPreview($app, $baseDir);
if ($preview !== null) {
$apiInfo['icon_url'] = $preview;
$iconUrl = $this->appManager->getAppIcon($app);
if ($iconUrl !== null) {
$apiInfo['icon_url'] = $iconUrl;
}
$apis[] = $apiInfo;
}
Expand Down Expand Up @@ -129,17 +129,4 @@ public function getSpec(string $app): string {

return json_encode($data);
}

private function getPreview(string $app, string $appPath) : ?string {
$appIcon = $appPath . '/img/' . $app . '.svg';
if (file_exists($appIcon)) {
return $this->url->imagePath($app, $app . '.svg');
} else {
$appIcon = $appPath . '/img/app.svg';
if (file_exists($appIcon)) {
return $this->url->imagePath($app, 'app.svg');
}
}
return null;
}
}