Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/text.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Service/ConfigService.php')
-rw-r--r--lib/Service/ConfigService.php33
1 files changed, 33 insertions, 0 deletions
diff --git a/lib/Service/ConfigService.php b/lib/Service/ConfigService.php
new file mode 100644
index 000000000..1ab6e65ae
--- /dev/null
+++ b/lib/Service/ConfigService.php
@@ -0,0 +1,33 @@
+<?php
+
+namespace OCA\Text\Service;
+
+use OCA\Text\AppInfo\Application;
+use OCP\IConfig;
+
+class ConfigService {
+ private IConfig $config;
+
+ public function __construct(IConfig $config) {
+ $this->config = $config;
+ }
+
+ public function getDefaultFileExtension(): string {
+ return $this->config->getAppValue(Application::APP_NAME, 'default_file_extension', 'md');
+ }
+
+ public function isRichEditingEnabled(): bool {
+ return ($this->config->getAppValue(Application::APP_NAME, 'rich_editing_enabled', '1') === '1');
+ }
+
+ public function isRichWorkspaceAvailable(): bool {
+ return $this->config->getAppValue(Application::APP_NAME, 'workspace_available', '1') === '1';
+ }
+
+ public function isRichWorkspaceEnabledForUser(?string $userId): bool {
+ if ($userId === null) {
+ return true;
+ }
+ return $this->config->getUserValue($userId, Application::APP_NAME, 'workspace_enabled', '1') === '1';
+ }
+}