diff options
Diffstat (limited to 'lib/private/App/AppManager.php')
-rw-r--r-- | lib/private/App/AppManager.php | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/private/App/AppManager.php b/lib/private/App/AppManager.php index 5eeb7ef1fbd..5dec4e7ccde 100644 --- a/lib/private/App/AppManager.php +++ b/lib/private/App/AppManager.php @@ -56,6 +56,7 @@ use OCP\ICacheFactory; use OCP\IConfig; use OCP\IGroup; use OCP\IGroupManager; +use OCP\IURLGenerator; use OCP\IUser; use OCP\IUserSession; use OCP\Settings\IManager as ISettingsManager; @@ -104,9 +105,24 @@ class AppManager implements IAppManager { private ICacheFactory $memCacheFactory, private IEventDispatcher $dispatcher, private LoggerInterface $logger, + private IURLGenerator $urlGenerator, ) { } + public function getAppIcon(string $appId): ?string { + $possibleIcons = [$appId . '.svg', 'app.svg', $appId . '-dark.svg', 'app-dark.svg']; + $icon = null; + foreach ($possibleIcons as $iconName) { + try { + $icon = $this->urlGenerator->imagePath($appId, $iconName); + break; + } catch (\RuntimeException $e) { + // ignore + } + } + return $icon; + } + /** * @return string[] $appId => $enabled */ |