summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>2020-07-06 17:22:24 +0200
committerJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>2020-08-21 09:56:08 +0200
commitac1f65a8e1ec32969db367e0d9fd2dae82c204a1 (patch)
tree0200d0121c425c1aaaa48fee48685e130aede576 /lib
parentec9b6ed4d0d139a515afe765acb7e1ff362ab35a (diff)
Recently contacted fix & sorting
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/Controller/PageController.php45
1 files changed, 25 insertions, 20 deletions
diff --git a/lib/Controller/PageController.php b/lib/Controller/PageController.php
index 60fd2e8b..95fca90b 100644
--- a/lib/Controller/PageController.php
+++ b/lib/Controller/PageController.php
@@ -24,7 +24,7 @@
namespace OCA\Contacts\Controller;
-use OCA\Contacts\Service\SocialApiService;
+use OCP\App\IAppManager;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http\TemplateResponse;
@@ -52,20 +52,24 @@ class PageController extends Controller {
/** @var SocialApiService */
private $socialApiService;
+ /** @var IAppManager */
+ private $appManager;
+
public function __construct(IRequest $request,
IConfig $config,
IInitialStateService $initialStateService,
IFactory $languageFactory,
IUserSession $userSession,
- SocialApiService $socialApiService) {
+ SocialApiService $socialApiService,
+ IAppManager $appManager) {
parent::__construct(Application::APP_ID, $request);
- $this->appName = Application::APP_ID;
$this->config = $config;
$this->initialStateService = $initialStateService;
$this->languageFactory = $languageFactory;
$this->userSession = $userSession;
$this->socialApiService = $socialApiService;
+ $this->appManager = $appManager;
}
/**
@@ -82,23 +86,24 @@ class PageController extends Controller {
}
$locales = $this->languageFactory->findAvailableLocales();
- $defaultProfile = $this->config->getAppValue($this->appName, 'defaultProfile', 'HOME');
+ $defaultProfile = $this->config->getAppValue(Application::APP_ID, 'defaultProfile', 'HOME');
$supportedNetworks = $this->socialApiService->getSupportedNetworks();
- $syncAllowedByAdmin = $this->config->getAppValue($this->appName, 'allowSocialSync', 'yes'); // allow users to retrieve avatars from social networks (default: yes)
- $bgSyncEnabledByUser = $this->config->getUserValue($userId, $this->appName, 'enableSocialSync', 'no'); // automated background syncs for social avatars (default: no)
-
- $this->initialStateService->provideInitialState($this->appName, 'locales', $locales);
- $this->initialStateService->provideInitialState($this->appName, 'defaultProfile', $defaultProfile);
- $this->initialStateService->provideInitialState($this->appName, 'supportedNetworks', $supportedNetworks);
- $this->initialStateService->provideInitialState($this->appName, 'locales', $locales);
- $this->initialStateService->provideInitialState($this->appName, 'defaultProfile', $defaultProfile);
- $this->initialStateService->provideInitialState($this->appName, 'supportedNetworks', $supportedNetworks);
- $this->initialStateService->provideInitialState($this->appName, 'allowSocialSync', $syncAllowedByAdmin);
- $this->initialStateService->provideInitialState($this->appName, 'enableSocialSync', $bgSyncEnabledByUser);
-
- Util::addScript($this->appName, 'contacts');
- Util::addStyle($this->appName, 'contacts');
-
- return new TemplateResponse($this->appName, 'main');
+ $syncAllowedByAdmin = $this->config->getAppValue(Application::APP_ID, 'allowSocialSync', 'yes'); // allow users to retrieve avatars from social networks (default: yes)
+ $bgSyncEnabledByUser = $this->config->getUserValue($userId, Application::APP_ID, 'enableSocialSync', 'no'); // automated background syncs for social avatars (default: no)
+
+ $this->initialStateService->provideInitialState(Application::APP_ID, 'locales', $locales);
+ $this->initialStateService->provideInitialState(Application::APP_ID, 'defaultProfile', $defaultProfile);
+ $this->initialStateService->provideInitialState(Application::APP_ID, 'supportedNetworks', $supportedNetworks);
+ $this->initialStateService->provideInitialState(Application::APP_ID, 'locales', $locales);
+ $this->initialStateService->provideInitialState(Application::APP_ID, 'defaultProfile', $defaultProfile);
+ $this->initialStateService->provideInitialState(Application::APP_ID, 'supportedNetworks', $supportedNetworks);
+ $this->initialStateService->provideInitialState(Application::APP_ID, 'allowSocialSync', $syncAllowedByAdmin);
+ $this->initialStateService->provideInitialState(Application::APP_ID, 'enableSocialSync', $bgSyncEnabledByUser);
+ $this->initialStateService->provideInitialState(Application::APP_ID, 'contactsinteraction', $this->appManager->isEnabledForUser('contactsinteraction') === true);
+
+ Util::addScript(Application::APP_ID, 'contacts');
+ Util::addStyle(Application::APP_ID, 'contacts');
+
+ return new TemplateResponse(Application::APP_ID, 'main');
}
}