From 91cad65d0e1d853cd37d2def78317f376fc320b6 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 20 Jan 2021 16:57:59 +0100 Subject: [PATCH] Initial state service is deprecated Signed-off-by: Joas Schilling --- lib/Controller/PageController.php | 6 +- lib/Files/TemplateLoader.php | 6 +- lib/PublicShare/TemplateLoader.php | 6 +- lib/PublicShareAuth/TemplateLoader.php | 6 +- lib/Settings/Admin/AdminSettings.php | 60 +++++++++--------- lib/TInitialState.php | 62 +++++++++---------- src/FilesSidebarTabApp.vue | 2 +- src/PublicShareAuthSidebar.vue | 2 +- src/PublicShareSidebar.vue | 2 +- .../AdminSettings/AllowedGroups.vue | 6 +- src/components/AdminSettings/Commands.vue | 2 +- .../AdminSettings/GeneralSettings.vue | 6 +- .../AdminSettings/HostedSignalingServer.vue | 8 +-- .../AdminSettings/MatterbridgeIntegration.vue | 6 +- src/components/AdminSettings/SIPBridge.vue | 6 +- .../AdminSettings/SignalingServers.vue | 6 +- src/components/AdminSettings/StunServers.vue | 4 +- src/components/AdminSettings/TurnServers.vue | 2 +- .../ConversationSettingsDialog.vue | 2 +- .../ConversationSettings/ListableSettings.vue | 2 +- src/components/LeftSidebar/LeftSidebar.vue | 4 +- .../Participants/ParticipantsTab.vue | 2 +- src/components/RightSidebar/SipSettings.vue | 2 +- src/store/fileUploadStore.js | 2 +- src/store/settingsStore.js | 2 +- src/utils/webrtc/simplewebrtc/peer.js | 2 +- .../php/Settings/Admin/AdminSettingsTest.php | 12 ++-- 27 files changed, 114 insertions(+), 114 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 ); } diff --git a/src/FilesSidebarTabApp.vue b/src/FilesSidebarTabApp.vue index ed2cdb2b0..0a53b7957 100644 --- a/src/FilesSidebarTabApp.vue +++ b/src/FilesSidebarTabApp.vue @@ -197,7 +197,7 @@ export default { // used), although that should not be a problem given that only the // "inCall" flag (which is locally updated when joining and leaving // a call) is currently used. - if (loadState('talk', 'signaling_mode') !== 'internal') { + if (loadState('spreed', 'signaling_mode') !== 'internal') { EventBus.$on('shouldRefreshConversations', OCA.Talk.fetchCurrentConversationWrapper) EventBus.$on('Signaling::participantListChanged', OCA.Talk.fetchCurrentConversationWrapper) } else { diff --git a/src/PublicShareAuthSidebar.vue b/src/PublicShareAuthSidebar.vue index f51d0882c..7a178971a 100644 --- a/src/PublicShareAuthSidebar.vue +++ b/src/PublicShareAuthSidebar.vue @@ -139,7 +139,7 @@ export default { // used), although that should not be a problem given that only the // "inCall" flag (which is locally updated when joining and leaving // a call) is currently used. - if (loadState('talk', 'signaling_mode') !== 'internal') { + if (loadState('spreed', 'signaling_mode') !== 'internal') { EventBus.$on('shouldRefreshConversations', this.fetchCurrentConversation) EventBus.$on('Signaling::participantListChanged', this.fetchCurrentConversation) } else { diff --git a/src/PublicShareSidebar.vue b/src/PublicShareSidebar.vue index 0b8a99e3f..7ec30e1cc 100644 --- a/src/PublicShareSidebar.vue +++ b/src/PublicShareSidebar.vue @@ -156,7 +156,7 @@ export default { // used), although that should not be a problem given that only the // "inCall" flag (which is locally updated when joining and leaving // a call) is currently used. - if (loadState('talk', 'signaling_mode') !== 'internal') { + if (loadState('spreed', 'signaling_mode') !== 'internal') { EventBus.$on('shouldRefreshConversations', this.fetchCurrentConversation) EventBus.$on('Signaling::participantListChanged', this.fetchCurrentConversation) } else { diff --git a/src/components/AdminSettings/AllowedGroups.vue b/src/components/AdminSettings/AllowedGroups.vue index 98d2c2494..e662819f4 100644 --- a/src/components/AdminSettings/AllowedGroups.vue +++ b/src/components/AdminSettings/AllowedGroups.vue @@ -135,13 +135,13 @@ export default { mounted() { this.loading = true - this.allowedGroups = loadState('talk', 'allowed_groups').sort(function(a, b) { + this.allowedGroups = loadState('spreed', 'allowed_groups').sort(function(a, b) { return a.displayname.localeCompare(b.displayname) }) - this.canStartConversations = loadState('talk', 'start_conversations').sort(function(a, b) { + this.canStartConversations = loadState('spreed', 'start_conversations').sort(function(a, b) { return a.displayname.localeCompare(b.displayname) }) - this.startCalls = startCallOptions[parseInt(loadState('talk', 'start_calls'))] + this.startCalls = startCallOptions[parseInt(loadState('spreed', 'start_calls'))] // Make a unique list with the groups we know from allowedGroups and canStartConversations // Unique checking is done by turning the group objects (with id and name) diff --git a/src/components/AdminSettings/Commands.vue b/src/components/AdminSettings/Commands.vue index 71df1bf6c..c3d4b22b2 100644 --- a/src/components/AdminSettings/Commands.vue +++ b/src/components/AdminSettings/Commands.vue @@ -79,7 +79,7 @@ export default { }, mounted() { - this.commands = loadState('talk', 'commands') + this.commands = loadState('spreed', 'commands') }, } diff --git a/src/components/AdminSettings/GeneralSettings.vue b/src/components/AdminSettings/GeneralSettings.vue index 55befe668..088176fdf 100644 --- a/src/components/AdminSettings/GeneralSettings.vue +++ b/src/components/AdminSettings/GeneralSettings.vue @@ -96,9 +96,9 @@ export default { mounted() { this.loading = true - this.conversationsFiles = parseInt(loadState('talk', 'conversations_files')) === 1 - this.defaultGroupNotification = defaultGroupNotificationOptions[parseInt(loadState('talk', 'default_group_notification')) - 1] - this.conversationsFilesPublicShares = parseInt(loadState('talk', 'conversations_files_public_shares')) === 1 + this.conversationsFiles = parseInt(loadState('spreed', 'conversations_files')) === 1 + this.defaultGroupNotification = defaultGroupNotificationOptions[parseInt(loadState('spreed', 'default_group_notification')) - 1] + this.conversationsFilesPublicShares = parseInt(loadState('spreed', 'conversations_files_public_shares')) === 1 this.loading = false }, diff --git a/src/components/AdminSettings/HostedSignalingServer.vue b/src/components/AdminSettings/HostedSignalingServer.vue index a43135d3f..3d9fab070 100644 --- a/src/components/AdminSettings/HostedSignalingServer.vue +++ b/src/components/AdminSettings/HostedSignalingServer.vue @@ -195,20 +195,20 @@ export default { }, beforeMount() { - const state = loadState('talk', 'hosted_signaling_server_prefill') + const state = loadState('spreed', 'hosted_signaling_server_prefill') this.hostedHPBNextcloudUrl = state.url this.hostedHPBFullName = state.fullName this.hostedHPBEmail = state.email this.hostedHPBLanguage = state.language this.hostedHPBCountry = state.country - this.trialAccount = loadState('talk', 'hosted_signaling_server_trial_data') + this.trialAccount = loadState('spreed', 'hosted_signaling_server_trial_data') - const languagesAndCountries = loadState('talk', 'hosted_signaling_server_language_data') + const languagesAndCountries = loadState('spreed', 'hosted_signaling_server_language_data') this.languages = languagesAndCountries['languages'] // two lists of {code: "es", name: "EspaƱol"} - one is in 'commonlanguages' and one in 'languages' this.countries = languagesAndCountries['countries'] // list of {code: "France", name: "France"} - const signaling = loadState('talk', 'signaling_servers') + const signaling = loadState('spreed', 'signaling_servers') this.showForm = this.trialAccount.length !== 0 || signaling.servers.length === 0 }, diff --git a/src/components/AdminSettings/MatterbridgeIntegration.vue b/src/components/AdminSettings/MatterbridgeIntegration.vue index 6d0c4b110..366471067 100644 --- a/src/components/AdminSettings/MatterbridgeIntegration.vue +++ b/src/components/AdminSettings/MatterbridgeIntegration.vue @@ -85,10 +85,10 @@ export default { data() { return { - matterbridgeEnabled: loadState('talk', 'matterbridge_enable'), - matterbridgeVersion: loadState('talk', 'matterbridge_version'), + matterbridgeEnabled: loadState('spreed', 'matterbridge_enable'), + matterbridgeVersion: loadState('spreed', 'matterbridge_version'), isInstalling: false, - error: loadState('talk', 'matterbridge_error'), + error: loadState('spreed', 'matterbridge_error'), } }, diff --git a/src/components/AdminSettings/SIPBridge.vue b/src/components/AdminSettings/SIPBridge.vue index 6559c4b0a..0873d5aee 100644 --- a/src/components/AdminSettings/SIPBridge.vue +++ b/src/components/AdminSettings/SIPBridge.vue @@ -109,12 +109,12 @@ export default { mounted() { this.loading = true - this.groups = loadState('talk', 'sip_bridge_groups').sort(function(a, b) { + this.groups = loadState('spreed', 'sip_bridge_groups').sort(function(a, b) { return a.displayname.localeCompare(b.displayname) }) this.sipGroups = this.groups - this.dialInInfo = loadState('talk', 'sip_bridge_dialin_info') - this.sharedSecret = loadState('talk', 'sip_bridge_shared_secret') + this.dialInInfo = loadState('spreed', 'sip_bridge_dialin_info') + this.sharedSecret = loadState('spreed', 'sip_bridge_shared_secret') this.searchGroup('') this.loading = false }, diff --git a/src/components/AdminSettings/SignalingServers.vue b/src/components/AdminSettings/SignalingServers.vue index 6a37da5c3..6a3d0acd0 100644 --- a/src/components/AdminSettings/SignalingServers.vue +++ b/src/components/AdminSettings/SignalingServers.vue @@ -109,8 +109,8 @@ export default { hideWarning: false, loading: false, saved: false, - isCacheConfigured: loadState('talk', 'has_cache_configured'), - isClusteredMode: loadState('talk', 'signaling_mode') === SIGNALING.MODE.CLUSTER_CONVERSATION, + isCacheConfigured: loadState('spreed', 'has_cache_configured'), + isClusteredMode: loadState('spreed', 'signaling_mode') === SIGNALING.MODE.CLUSTER_CONVERSATION, } }, @@ -121,7 +121,7 @@ export default { }, beforeMount() { - const state = loadState('talk', 'signaling_servers') + const state = loadState('spreed', 'signaling_servers') this.servers = state.servers this.secret = state.secret this.hideWarning = state.hideWarning diff --git a/src/components/AdminSettings/StunServers.vue b/src/components/AdminSettings/StunServers.vue index f865fd5d5..186d9f577 100644 --- a/src/components/AdminSettings/StunServers.vue +++ b/src/components/AdminSettings/StunServers.vue @@ -80,8 +80,8 @@ export default { }, beforeMount() { - this.servers = loadState('talk', 'stun_servers') - this.hasInternetConnection = loadState('talk', 'has_internet_connection') + this.servers = loadState('spreed', 'stun_servers') + this.hasInternetConnection = loadState('spreed', 'has_internet_connection') }, methods: { diff --git a/src/components/AdminSettings/TurnServers.vue b/src/components/AdminSettings/TurnServers.vue index 94ea89318..2fb01aaf2 100644 --- a/src/components/AdminSettings/TurnServers.vue +++ b/src/components/AdminSettings/TurnServers.vue @@ -89,7 +89,7 @@ export default { }, beforeMount() { - this.servers = loadState('talk', 'turn_servers') + this.servers = loadState('spreed', 'turn_servers') }, methods: { diff --git a/src/components/ConversationSettings/ConversationSettingsDialog.vue b/src/components/ConversationSettings/ConversationSettingsDialog.vue index 37aed0210..3c013fd47 100644 --- a/src/components/ConversationSettings/ConversationSettingsDialog.vue +++ b/src/components/ConversationSettings/ConversationSettingsDialog.vue @@ -83,7 +83,7 @@ export default { data() { return { showSettings: false, - matterbridgeEnabled: loadState('talk', 'enable_matterbridge'), + matterbridgeEnabled: loadState('spreed', 'enable_matterbridge'), } }, diff --git a/src/components/ConversationSettings/ListableSettings.vue b/src/components/ConversationSettings/ListableSettings.vue index b4785a6ea..7d513b43f 100644 --- a/src/components/ConversationSettings/ListableSettings.vue +++ b/src/components/ConversationSettings/ListableSettings.vue @@ -75,7 +75,7 @@ export default { listable: null, isListableLoading: false, lastNotification: null, - isGuestsAccountsEnabled: loadState('talk', 'guests_accounts_enabled'), + isGuestsAccountsEnabled: loadState('spreed', 'guests_accounts_enabled'), LISTABLE: CONVERSATION.LISTABLE, } }, diff --git a/src/components/LeftSidebar/LeftSidebar.vue b/src/components/LeftSidebar/LeftSidebar.vue index 9a72897ab..e4e7c1fdd 100644 --- a/src/components/LeftSidebar/LeftSidebar.vue +++ b/src/components/LeftSidebar/LeftSidebar.vue @@ -165,8 +165,8 @@ export default { searchResultsListedConversations: [], contactsLoading: false, listedConversationsLoading: false, - isCirclesEnabled: loadState('talk', 'circles_enabled'), - canStartConversations: loadState('talk', 'start_conversations'), + isCirclesEnabled: loadState('spreed', 'circles_enabled'), + canStartConversations: loadState('spreed', 'start_conversations'), initialisedConversations: false, cancelSearchPossibleConversations: () => {}, cancelSearchListedConversations: () => {}, diff --git a/src/components/RightSidebar/Participants/ParticipantsTab.vue b/src/components/RightSidebar/Participants/ParticipantsTab.vue index 15f1e67bc..32fa7c895 100644 --- a/src/components/RightSidebar/Participants/ParticipantsTab.vue +++ b/src/components/RightSidebar/Participants/ParticipantsTab.vue @@ -94,7 +94,7 @@ export default { searchResults: [], contactsLoading: false, participantsInitialised: false, - isCirclesEnabled: loadState('talk', 'circles_enabled'), + isCirclesEnabled: loadState('spreed', 'circles_enabled'), /** * Stores the cancel function for cancelableGetParticipants */ diff --git a/src/components/RightSidebar/SipSettings.vue b/src/components/RightSidebar/SipSettings.vue index 188566f00..f7178399f 100644 --- a/src/components/RightSidebar/SipSettings.vue +++ b/src/components/RightSidebar/SipSettings.vue @@ -53,7 +53,7 @@ export default { data() { return { - dialInInfo: loadState('talk', 'sip_dialin_info'), + dialInInfo: loadState('spreed', 'sip_dialin_info'), } }, diff --git a/src/store/fileUploadStore.js b/src/store/fileUploadStore.js index 861296e1d..c60b9d0dd 100644 --- a/src/store/fileUploadStore.js +++ b/src/store/fileUploadStore.js @@ -30,7 +30,7 @@ import { EventBus } from '../services/EventBus' import { shareFile } from '../services/filesSharingServices' const state = { - attachmentFolder: loadState('talk', 'attachment_folder'), + attachmentFolder: loadState('spreed', 'attachment_folder'), uploads: { }, currentUploadId: undefined, diff --git a/src/store/settingsStore.js b/src/store/settingsStore.js index a8bd04eef..40d6e8b00 100644 --- a/src/store/settingsStore.js +++ b/src/store/settingsStore.js @@ -22,7 +22,7 @@ import { loadState } from '@nextcloud/initial-state' import { setReadStatusPrivacy } from '../services/settingsService' const state = { - readStatusPrivacy: loadState('talk', 'read_status_privacy'), + readStatusPrivacy: loadState('spreed', 'read_status_privacy'), } const getters = { diff --git a/src/utils/webrtc/simplewebrtc/peer.js b/src/utils/webrtc/simplewebrtc/peer.js index 6790c279a..569657916 100644 --- a/src/utils/webrtc/simplewebrtc/peer.js +++ b/src/utils/webrtc/simplewebrtc/peer.js @@ -94,7 +94,7 @@ util.inherits(Peer, WildEmitter) function shouldPreferH264() { try { - return initialState.loadState('talk', 'prefer_h264') + return initialState.loadState('spreed', 'prefer_h264') } catch (exception) { // If the state can not be loaded an exception is thrown console.warn('Could not find initial state for H.264 preference') diff --git a/tests/php/Settings/Admin/AdminSettingsTest.php b/tests/php/Settings/Admin/AdminSettingsTest.php index 2fcdcff65..b23429a72 100644 --- a/tests/php/Settings/Admin/AdminSettingsTest.php +++ b/tests/php/Settings/Admin/AdminSettingsTest.php @@ -27,10 +27,10 @@ use OCA\Talk\Config; use OCA\Talk\MatterbridgeManager; use OCA\Talk\Service\CommandService; use OCA\Talk\Settings\Admin\AdminSettings; +use OCP\AppFramework\Services\IInitialState; use OCP\ICacheFactory; use OCP\IConfig; use OCP\IGroupManager; -use OCP\IInitialStateService; use OCP\IL10N; use OCP\IUserSession; use OCP\L10N\IFactory; @@ -44,7 +44,7 @@ class AdminSettingsTest extends \Test\TestCase { protected $serverConfig; /** @var CommandService|MockObject */ protected $commandService; - /** @var IInitialStateService|MockObject */ + /** @var IInitialState|MockObject */ protected $initialState; /** @var ICacheFactory|MockObject */ protected $cacheFactory; @@ -67,7 +67,7 @@ class AdminSettingsTest extends \Test\TestCase { $this->talkConfig = $this->createMock(Config::class); $this->serverConfig = $this->createMock(IConfig::class); $this->commandService = $this->createMock(CommandService::class); - $this->initialState = $this->createMock(IInitialStateService::class); + $this->initialState = $this->createMock(IInitialState::class); $this->cacheFactory = $this->createMock(ICacheFactory::class); $this->groupManager = $this->createMock(IGroupManager::class); $this->matterbridgeManager = $this->createMock(MatterbridgeManager::class); @@ -169,8 +169,8 @@ class AdminSettingsTest extends \Test\TestCase { $this->initialState->expects($this->exactly(2)) ->method('provideInitialState') ->withConsecutive( - ['talk', 'stun_servers', ['getStunServers']], - ['talk', 'has_internet_connection', true] + ['stun_servers', ['getStunServers']], + ['has_internet_connection', true] ); $admin = $this->getAdminSettings(); @@ -184,7 +184,7 @@ class AdminSettingsTest extends \Test\TestCase { $this->initialState->expects($this->once()) ->method('provideInitialState') - ->with('talk', 'turn_servers', ['getTurnServers']); + ->with('turn_servers', ['getTurnServers']); $admin = $this->getAdminSettings(); self::invokePrivate($admin, 'initTurnServers');