From 51add455c315180bec7668c88da1e479b7470607 Mon Sep 17 00:00:00 2001 From: Christopher Ng Date: Wed, 20 Mar 2024 13:13:21 -0700 Subject: [PATCH] feat: Add icon svg inline for New text file Signed-off-by: Christopher Ng --- img/article.svg | 5 +++++ lib/AppInfo/Application.php | 7 ++++--- 2 files changed, 9 insertions(+), 3 deletions(-) create mode 100644 img/article.svg diff --git a/img/article.svg b/img/article.svg new file mode 100644 index 00000000000..1b2345a3b55 --- /dev/null +++ b/img/article.svg @@ -0,0 +1,5 @@ + + + + diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php index 07e37032863..e8e7c83e2f8 100644 --- a/lib/AppInfo/Application.php +++ b/lib/AppInfo/Application.php @@ -44,6 +44,7 @@ use OCA\Text\Service\ConfigService; use OCA\TpAssistant\Event\BeforeAssistantNotificationEvent; use OCA\Viewer\Event\LoadViewer; +use OCP\App\IAppManager; use OCP\AppFramework\App; use OCP\AppFramework\Bootstrap\IBootContext; use OCP\AppFramework\Bootstrap\IBootstrap; @@ -84,12 +85,12 @@ public function register(IRegistrationContext $context): void { } public function boot(IBootContext $context): void { - $context->injectFn(function (ITemplateManager $templateManager, IL10N $l, ConfigService $configService) { - $templateManager->registerTemplateFileCreator(function () use ($l, $configService) { + $context->injectFn(function (ITemplateManager $templateManager, IL10N $l, ConfigService $configService, IAppManager $appManager) { + $templateManager->registerTemplateFileCreator(function () use ($l, $configService, $appManager) { $markdownFile = new TemplateFileCreator(Application::APP_NAME, $l->t('New text file'), '.' . $configService->getDefaultFileExtension()); $markdownFile->addMimetype('text/markdown'); $markdownFile->addMimetype('text/plain'); - $markdownFile->setIconClass('icon-filetype-text'); + $markdownFile->setIconSvgInline(file_get_contents($appManager->getAppPath('text') . '/img/article.svg')); $markdownFile->setRatio(1); $markdownFile->setOrder(10); $markdownFile->setActionLabel($l->t('Create new text file'));