diff options
author | Greta Doci <gretadoci@gmail.com> | 2019-10-17 12:36:41 +0200 |
---|---|---|
committer | Greta Doci <gretadoci@gmail.com> | 2019-10-17 12:36:41 +0200 |
commit | 3f764203061221a838e0890a8cf4a36034158932 (patch) | |
tree | 0506014d8612ead8ad72bb6b65258af082befe33 /lib | |
parent | 40ad45acd70764b0395557dc6f0f0b58cc3fa781 (diff) |
Make the work profile the default one when adding Contacts
Signed-off-by: Greta Doci <gretadoci@gmail.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Controller/PageController.php | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/Controller/PageController.php b/lib/Controller/PageController.php index eebfccf8..add97dfb 100644 --- a/lib/Controller/PageController.php +++ b/lib/Controller/PageController.php @@ -26,6 +26,7 @@ namespace OCA\Contacts\Controller; use OCP\AppFramework\Controller; use OCP\AppFramework\Http\TemplateResponse; // use OCP\IInitialStateService; +use OCP\IConfig; use OCP\L10N\IFactory; use OCP\IRequest; @@ -38,16 +39,20 @@ class PageController extends Controller { /** @var IFactory */ private $languageFactory; + /** @var IConfig */ + private $config; public function __construct(string $AppName, IRequest $request, + IConfig $config, // IInitialStateService $initialStateService, IFactory $languageFactory) { parent::__construct($AppName, $request); - + $this->appName = $AppName; // $this->initialStateService = $initialStateService; $this->languageFactory = $languageFactory; + $this->config = $config; } /** @@ -58,8 +63,13 @@ class PageController extends Controller { */ public function index(): TemplateResponse { $locales = $this->languageFactory->findAvailableLocales(); + $defaultProfile = $this->config->getAppValue($this->appName, 'defaultProfile', 'HOME'); // TODO: use initialStateService once min-version is 16! // $this->initialStateService->provideInitialState($this->appName, 'locales', $locales); - return new TemplateResponse('contacts', 'main', ['locales' => json_encode($locales)]); // templates/main.php + // $this->initialStateService->provideInitialState($this->appName, 'defaultProfile', $defaultProfile); + return new TemplateResponse( + 'contacts', + 'main', + ['locales' => json_encode($locales), 'defaultProfile'=> json_encode($defaultProfile)]); // templates/main.php } } |