diff options
author | Joas Schilling <coding@schilljs.com> | 2021-01-20 18:57:59 +0300 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2021-01-21 13:47:31 +0300 |
commit | 91cad65d0e1d853cd37d2def78317f376fc320b6 (patch) | |
tree | 7abfbdd90eea309bf5324c4d579eb7e828cf0337 /lib | |
parent | 2284b0797eec8ed95e5173c2d4db14201c7629a3 (diff) |
Initial state service is deprecated
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Controller/PageController.php | 6 | ||||
-rw-r--r-- | lib/Files/TemplateLoader.php | 6 | ||||
-rw-r--r-- | lib/PublicShare/TemplateLoader.php | 6 | ||||
-rw-r--r-- | lib/PublicShareAuth/TemplateLoader.php | 6 | ||||
-rw-r--r-- | lib/Settings/Admin/AdminSettings.php | 60 | ||||
-rw-r--r-- | lib/TInitialState.php | 62 |
6 files changed, 73 insertions, 73 deletions
diff --git a/lib/Controller/PageController.php b/lib/Controller/PageController.php index 79b8fe53c..b3ab04cf3 100644 --- a/lib/Controller/PageController.php +++ b/lib/Controller/PageController.php @@ -43,11 +43,11 @@ use OCP\AppFramework\Http\RedirectResponse; use OCP\AppFramework\Http\Response; use OCP\AppFramework\Http\TemplateResponse; use OCP\AppFramework\Http\Template\PublicTemplateResponse; +use OCP\AppFramework\Services\IInitialState; use OCP\EventDispatcher\IEventDispatcher; use OCP\Files\IRootFolder; use OCP\ICacheFactory; use OCP\IConfig; -use OCP\IInitialStateService; use OCP\IRequest; use OCP\IURLGenerator; use OCP\IUser; @@ -93,7 +93,7 @@ class PageController extends Controller { IURLGenerator $url, INotificationManager $notificationManager, IAppManager $appManager, - IInitialStateService $initialStateService, + IInitialState $initialState, ICacheFactory $memcacheFactory, IRootFolder $rootFolder, Config $talkConfig, @@ -109,7 +109,7 @@ class PageController extends Controller { $this->url = $url; $this->notificationManager = $notificationManager; $this->appManager = $appManager; - $this->initialStateService = $initialStateService; + $this->initialState = $initialState; $this->memcacheFactory = $memcacheFactory; $this->rootFolder = $rootFolder; $this->talkConfig = $talkConfig; diff --git a/lib/Files/TemplateLoader.php b/lib/Files/TemplateLoader.php index 9b23f7832..f3fc1b6f5 100644 --- a/lib/Files/TemplateLoader.php +++ b/lib/Files/TemplateLoader.php @@ -29,13 +29,13 @@ use OCA\Talk\AppInfo\Application; use OCA\Talk\Config; use OCA\Talk\TInitialState; use OCP\App\IAppManager; +use OCP\AppFramework\Services\IInitialState; use OCP\EventDispatcher\Event; use OCP\EventDispatcher\IEventDispatcher; use OCP\EventDispatcher\IEventListener; use OCP\Files\IRootFolder; use OCP\ICacheFactory; use OCP\IConfig; -use OCP\IInitialStateService; use OCP\IUser; use OCP\IUserSession; use OCP\Util; @@ -53,14 +53,14 @@ class TemplateLoader implements IEventListener { /** @var IUserSession */ private $userSession; - public function __construct(IInitialStateService $initialStateService, + public function __construct(IInitialState $initialState, ICacheFactory $memcacheFactory, Config $talkConfig, IConfig $serverConfig, IAppManager $appManager, IRootFolder $rootFolder, IUserSession $userSession) { - $this->initialStateService = $initialStateService; + $this->initialState = $initialState; $this->memcacheFactory = $memcacheFactory; $this->talkConfig = $talkConfig; $this->serverConfig = $serverConfig; diff --git a/lib/PublicShare/TemplateLoader.php b/lib/PublicShare/TemplateLoader.php index f5e1bccc8..a250c6ba5 100644 --- a/lib/PublicShare/TemplateLoader.php +++ b/lib/PublicShare/TemplateLoader.php @@ -28,12 +28,12 @@ namespace OCA\Talk\PublicShare; use OCA\Files_Sharing\Event\BeforeTemplateRenderedEvent; use OCA\Talk\Config; use OCA\Talk\TInitialState; +use OCP\AppFramework\Services\IInitialState; use OCP\EventDispatcher\Event; use OCP\EventDispatcher\IEventListener; use OCP\Files\FileInfo; use OCP\ICacheFactory; use OCP\IConfig; -use OCP\IInitialStateService; use OCP\Util; /** @@ -44,11 +44,11 @@ use OCP\Util; class TemplateLoader implements IEventListener { use TInitialState; - public function __construct(IInitialStateService $initialStateService, + public function __construct(IInitialState $initialState, ICacheFactory $memcacheFactory, Config $talkConfig, IConfig $serverConfig) { - $this->initialStateService = $initialStateService; + $this->initialState = $initialState; $this->talkConfig = $talkConfig; $this->memcacheFactory = $memcacheFactory; $this->serverConfig = $serverConfig; diff --git a/lib/PublicShareAuth/TemplateLoader.php b/lib/PublicShareAuth/TemplateLoader.php index 3a4f32c80..66e6496b6 100644 --- a/lib/PublicShareAuth/TemplateLoader.php +++ b/lib/PublicShareAuth/TemplateLoader.php @@ -28,11 +28,11 @@ namespace OCA\Talk\PublicShareAuth; use OCA\Files_Sharing\Event\BeforeTemplateRenderedEvent; use OCA\Talk\Config; use OCA\Talk\TInitialState; +use OCP\AppFramework\Services\IInitialState; use OCP\EventDispatcher\Event; use OCP\EventDispatcher\IEventListener; use OCP\ICacheFactory; use OCP\IConfig; -use OCP\IInitialStateService; use OCP\Util; /** @@ -43,11 +43,11 @@ use OCP\Util; class TemplateLoader implements IEventListener { use TInitialState; - public function __construct(IInitialStateService $initialStateService, + public function __construct(IInitialState $initialState, ICacheFactory $memcacheFactory, Config $talkConfig, IConfig $serverConfig) { - $this->initialStateService = $initialStateService; + $this->initialState = $initialState; $this->talkConfig = $talkConfig; $this->memcacheFactory = $memcacheFactory; $this->serverConfig = $serverConfig; diff --git a/lib/Settings/Admin/AdminSettings.php b/lib/Settings/Admin/AdminSettings.php index 1ff97a452..28ded4075 100644 --- a/lib/Settings/Admin/AdminSettings.php +++ b/lib/Settings/Admin/AdminSettings.php @@ -31,11 +31,11 @@ use OCA\Talk\Room; use OCA\Talk\Service\CommandService; use OCA\Talk\Exceptions\WrongPermissionsException; use OCP\AppFramework\Http\TemplateResponse; +use OCP\AppFramework\Services\IInitialState; use OCP\ICacheFactory; use OCP\IConfig; use OCP\IGroup; use OCP\IGroupManager; -use OCP\IInitialStateService; use OCP\IL10N; use OCP\IUser; use OCP\IUserSession; @@ -50,8 +50,8 @@ class AdminSettings implements ISettings { private $serverConfig; /** @var CommandService */ private $commandService; - /** @var IInitialStateService */ - private $initialStateService; + /** @var IInitialState */ + private $initialState; /** @var ICacheFactory */ private $memcacheFactory; /** @var IGroupManager */ @@ -68,7 +68,7 @@ class AdminSettings implements ISettings { public function __construct(Config $talkConfig, IConfig $serverConfig, CommandService $commandService, - IInitialStateService $initialStateService, + IInitialState $initialState, ICacheFactory $memcacheFactory, IGroupManager $groupManager, MatterbridgeManager $bridgeManager, @@ -78,7 +78,7 @@ class AdminSettings implements ISettings { $this->talkConfig = $talkConfig; $this->serverConfig = $serverConfig; $this->commandService = $commandService; - $this->initialStateService = $initialStateService; + $this->initialState = $initialState; $this->memcacheFactory = $memcacheFactory; $this->groupManager = $groupManager; $this->bridgeManager = $bridgeManager; @@ -105,19 +105,19 @@ class AdminSettings implements ISettings { } protected function initGeneralSettings(): void { - $this->initialStateService->provideInitialState('talk', 'default_group_notification', (int) $this->serverConfig->getAppValue('spreed', 'default_group_notification', Participant::NOTIFY_MENTION)); - $this->initialStateService->provideInitialState('talk', 'conversations_files', (int) $this->serverConfig->getAppValue('spreed', 'conversations_files', '1')); - $this->initialStateService->provideInitialState('talk', 'conversations_files_public_shares', (int) $this->serverConfig->getAppValue('spreed', 'conversations_files_public_shares', '1')); + $this->initialState->provideInitialState('default_group_notification', (int) $this->serverConfig->getAppValue('spreed', 'default_group_notification', Participant::NOTIFY_MENTION)); + $this->initialState->provideInitialState('conversations_files', (int) $this->serverConfig->getAppValue('spreed', 'conversations_files', '1')); + $this->initialState->provideInitialState('conversations_files_public_shares', (int) $this->serverConfig->getAppValue('spreed', 'conversations_files_public_shares', '1')); } protected function initAllowedGroups(): void { - $this->initialStateService->provideInitialState('talk', 'start_calls', (int) $this->serverConfig->getAppValue('spreed', 'start_calls', Room::START_CALL_EVERYONE)); + $this->initialState->provideInitialState('start_calls', (int) $this->serverConfig->getAppValue('spreed', 'start_calls', Room::START_CALL_EVERYONE)); $groups = $this->getGroupDetailsArray($this->talkConfig->getAllowedConversationsGroupIds()); - $this->initialStateService->provideInitialState('talk', 'start_conversations', $groups); + $this->initialState->provideInitialState('start_conversations', $groups); $groups = $this->getGroupDetailsArray($this->talkConfig->getAllowedTalkGroupIds()); - $this->initialStateService->provideInitialState('talk', 'allowed_groups', $groups); + $this->initialState->provideInitialState('allowed_groups', $groups); } protected function initCommands(): void { @@ -127,7 +127,7 @@ class AdminSettings implements ISettings { return $command->asArray(); }, $commands); - $this->initialStateService->provideInitialState('talk', 'commands', $result); + $this->initialState->provideInitialState('commands', $result); } protected function initMatterbridge(): void { @@ -141,32 +141,32 @@ class AdminSettings implements ISettings { $version = ''; $error = 'binary_permissions'; } - $this->initialStateService->provideInitialState( - 'talk', 'matterbridge_error', $error + $this->initialState->provideInitialState( + 'matterbridge_error', $error ); - $this->initialStateService->provideInitialState( - 'talk', 'matterbridge_version', $version + $this->initialState->provideInitialState( + 'matterbridge_version', $version ); - $this->initialStateService->provideInitialState( - 'talk', 'matterbridge_enable', + $this->initialState->provideInitialState( + 'matterbridge_enable', $this->serverConfig->getAppValue('spreed', 'enable_matterbridge', '0') === '1' ); } protected function initStunServers(): void { - $this->initialStateService->provideInitialState('talk', 'stun_servers', $this->talkConfig->getStunServers()); - $this->initialStateService->provideInitialState('talk', 'has_internet_connection', $this->serverConfig->getSystemValueBool('has_internet_connection', true)); + $this->initialState->provideInitialState('stun_servers', $this->talkConfig->getStunServers()); + $this->initialState->provideInitialState('has_internet_connection', $this->serverConfig->getSystemValueBool('has_internet_connection', true)); } protected function initTurnServers(): void { - $this->initialStateService->provideInitialState('talk', 'turn_servers', $this->talkConfig->getTurnServers()); + $this->initialState->provideInitialState('turn_servers', $this->talkConfig->getTurnServers()); } protected function initSignalingServers(): void { - $this->initialStateService->provideInitialState('talk', 'has_cache_configured', $this->memcacheFactory->isAvailable()); - $this->initialStateService->provideInitialState('talk', 'signaling_mode', $this->talkConfig->getSignalingMode(false)); - $this->initialStateService->provideInitialState('talk', 'signaling_servers', [ + $this->initialState->provideInitialState('has_cache_configured', $this->memcacheFactory->isAvailable()); + $this->initialState->provideInitialState('signaling_mode', $this->talkConfig->getSignalingMode(false)); + $this->initialState->provideInitialState('signaling_servers', [ 'servers' => $this->talkConfig->getSignalingServers(), 'secret' => $this->talkConfig->getSignalingSecret(), 'hideWarning' => $this->talkConfig->getHideSignalingWarning(), @@ -446,14 +446,14 @@ class AdminSettings implements ISettings { } } - $this->initialStateService->provideInitialState('talk', 'hosted_signaling_server_prefill', [ + $this->initialState->provideInitialState('hosted_signaling_server_prefill', [ 'url' => $this->serverConfig->getSystemValueString('overwrite.cli.url'), 'fullName' => $this->currentUser->getDisplayName(), 'email' => $this->currentUser->getEMailAddress() ?: '', 'language' => $userLanguage, 'country' => $guessCountry, ]); - $this->initialStateService->provideInitialState('talk', 'hosted_signaling_server_trial_data', + $this->initialState->provideInitialState('hosted_signaling_server_trial_data', json_decode($this->serverConfig->getAppValue('spreed', 'hosted-signaling-server-account', "[]"), true) ?? [] ); $languages = $this->l10nFactory->getLanguages(); @@ -472,7 +472,7 @@ class AdminSettings implements ISettings { usort($countries, function ($a, $b) { return strcmp($a['name'], $b['name']); }); - $this->initialStateService->provideInitialState('talk', 'hosted_signaling_server_language_data', [ + $this->initialState->provideInitialState('hosted_signaling_server_language_data', [ 'languages' => $languages, 'countries' => $countries, ]); @@ -481,9 +481,9 @@ class AdminSettings implements ISettings { protected function initSIPBridge(): void { $groups = $this->getGroupDetailsArray($this->talkConfig->getSIPGroups()); - $this->initialStateService->provideInitialState('talk', 'sip_bridge_groups', $groups); - $this->initialStateService->provideInitialState('talk', 'sip_bridge_shared_secret', $this->talkConfig->getSIPSharedSecret()); - $this->initialStateService->provideInitialState('talk', 'sip_bridge_dialin_info', $this->talkConfig->getDialInInfo()); + $this->initialState->provideInitialState('sip_bridge_groups', $groups); + $this->initialState->provideInitialState('sip_bridge_shared_secret', $this->talkConfig->getSIPSharedSecret()); + $this->initialState->provideInitialState('sip_bridge_dialin_info', $this->talkConfig->getDialInInfo()); } protected function getGroupDetailsArray(array $gids): array { diff --git a/lib/TInitialState.php b/lib/TInitialState.php index d9b2a1619..802deb6a6 100644 --- a/lib/TInitialState.php +++ b/lib/TInitialState.php @@ -26,11 +26,11 @@ namespace OCA\Talk; use OC\HintException; use OC\User\NoUserException; use OCP\App\IAppManager; +use OCP\AppFramework\Services\IInitialState; use OCP\Files\IRootFolder; use OCP\Files\NotPermittedException; use OCP\ICacheFactory; use OCP\IConfig; -use OCP\IInitialStateService; use OCP\IUser; use OCP\Util; @@ -40,8 +40,8 @@ trait TInitialState { protected $talkConfig; /** @var IConfig */ protected $serverConfig; - /** @var IInitialStateService */ - protected $initialStateService; + /** @var IInitialState */ + protected $initialState; /** @var ICacheFactory */ protected $memcacheFactory; @@ -49,8 +49,8 @@ trait TInitialState { // Needed to enable the screensharing extension in Chromium < 72. Util::addHeader('meta', ['id' => 'app', 'class' => 'nc-enable-screensharing-extension']); - $this->initialStateService->provideInitialState( - 'talk', 'prefer_h264', + $this->initialState->provideInitialState( + 'prefer_h264', $this->serverConfig->getAppValue('spreed', 'prefer_h264', 'no') === 'yes' ); @@ -63,13 +63,13 @@ trait TInitialState { ); } - $this->initialStateService->provideInitialState( - 'talk', 'signaling_mode', + $this->initialState->provideInitialState( + 'signaling_mode', $this->talkConfig->getSignalingMode() ); - $this->initialStateService->provideInitialState( - 'talk', 'sip_dialin_info', + $this->initialState->provideInitialState( + 'sip_dialin_info', $this->talkConfig->getDialInInfo() ); } @@ -77,23 +77,23 @@ trait TInitialState { protected function publishInitialStateForUser(IUser $user, IRootFolder $rootFolder, IAppManager $appManager): void { $this->publishInitialStateShared(); - $this->initialStateService->provideInitialState( - 'talk', 'start_conversations', + $this->initialState->provideInitialState( + 'start_conversations', !$this->talkConfig->isNotAllowedToCreateConversations($user) ); - $this->initialStateService->provideInitialState( - 'talk', 'circles_enabled', + $this->initialState->provideInitialState( + 'circles_enabled', $appManager->isEnabledForUser('circles', $user) ); - $this->initialStateService->provideInitialState( - 'talk', 'guests_accounts_enabled', + $this->initialState->provideInitialState( + 'guests_accounts_enabled', $appManager->isEnabledForUser('guests', $user) ); - $this->initialStateService->provideInitialState( - 'talk', 'read_status_privacy', + $this->initialState->provideInitialState( + 'read_status_privacy', $this->talkConfig->getUserReadPrivacy($user->getUID()) ); @@ -113,13 +113,13 @@ trait TInitialState { } } - $this->initialStateService->provideInitialState( - 'talk', 'attachment_folder', + $this->initialState->provideInitialState( + 'attachment_folder', $attachmentFolder ); - $this->initialStateService->provideInitialState( - 'talk', 'enable_matterbridge', + $this->initialState->provideInitialState( + 'enable_matterbridge', $this->serverConfig->getAppValue('spreed', 'enable_matterbridge', '0') === '1' ); } @@ -127,28 +127,28 @@ trait TInitialState { protected function publishInitialStateForGuest(): void { $this->publishInitialStateShared(); - $this->initialStateService->provideInitialState( - 'talk', 'start_conversations', + $this->initialState->provideInitialState( + 'start_conversations', false ); - $this->initialStateService->provideInitialState( - 'talk', 'circles_enabled', + $this->initialState->provideInitialState( + 'circles_enabled', false ); - $this->initialStateService->provideInitialState( - 'talk', 'read_status_privacy', + $this->initialState->provideInitialState( + 'read_status_privacy', Participant::PRIVACY_PUBLIC ); - $this->initialStateService->provideInitialState( - 'talk', 'attachment_folder', + $this->initialState->provideInitialState( + 'attachment_folder', '' ); - $this->initialStateService->provideInitialState( - 'talk', 'enable_matterbridge', + $this->initialState->provideInitialState( + 'enable_matterbridge', false ); } |