From 3d7cbd8d836a6599829ed2aed4ebe016874e4dde Mon Sep 17 00:00:00 2001 From: DorraJaouad Date: Thu, 14 Nov 2024 17:29:29 +0100 Subject: [PATCH] fix: total renaming from blurBackground to blurVirtualBackground Signed-off-by: DorraJaouad --- lib/Capabilities.php | 4 +-- lib/Config.php | 2 +- lib/Controller/RoomController.php | 2 +- .../MediaSettings/MediaSettings.vue | 26 +++++++++---------- .../MediaSettings/VideoBackgroundEditor.vue | 2 +- .../SettingsDialog/MediaDevicesPreview.vue | 20 +++++++------- src/services/settingsService.js | 4 +-- src/stores/settings.js | 10 +++---- src/utils/webrtc/models/LocalMediaModel.js | 4 +-- 9 files changed, 37 insertions(+), 37 deletions(-) diff --git a/lib/Capabilities.php b/lib/Capabilities.php index a82afab1115..4d777717ef0 100644 --- a/lib/Capabilities.php +++ b/lib/Capabilities.php @@ -202,7 +202,7 @@ public function getCapabilities(): array { 'can-enable-sip' => false, 'start-without-media' => $this->talkConfig->getCallsStartWithoutMedia($user?->getUID()), 'max-duration' => $this->appConfig->getAppValueInt('max_call_duration'), - 'blur-virtual-background' => $this->talkConfig->getBlurBackground($user?->getUID()), + 'blur-virtual-background' => $this->talkConfig->getBlurVirtualBackground($user?->getUID()), ], 'chat' => [ 'max-length' => ChatManager::MAX_CHAT_LENGTH, @@ -252,7 +252,7 @@ public function getCapabilities(): array { $capabilities['config']['attachments']['folder'] = $this->talkConfig->getAttachmentFolder($user->getUID()); $capabilities['config']['chat']['read-privacy'] = $this->talkConfig->getUserReadPrivacy($user->getUID()); $capabilities['config']['chat']['typing-privacy'] = $this->talkConfig->getUserTypingPrivacy($user->getUID()); - $capabilities['config']['call']['blur-virtual-background'] = $this->talkConfig->getBlurBackground($user->getUID()); + $capabilities['config']['call']['blur-virtual-background'] = $this->talkConfig->getBlurVirtualBackground($user->getUID()); } $pubKey = $this->talkConfig->getSignalingTokenPublicKey(); diff --git a/lib/Config.php b/lib/Config.php index 015143fbbba..87f26c52cd5 100644 --- a/lib/Config.php +++ b/lib/Config.php @@ -687,7 +687,7 @@ public function getCallsStartWithoutMedia(?string $userId): bool { * @param ?string $userId * @return bool */ - public function getBlurBackground(?string $userId): bool { + public function getBlurVirtualBackground(?string $userId): bool { if ($userId !== null) { $userSetting = $this->config->getUserValue($userId, 'spreed', UserPreference::BLUR_VIRTUAL_BACKGROUND); return $userSetting === 'yes'; diff --git a/lib/Controller/RoomController.php b/lib/Controller/RoomController.php index 2826c5d1509..4efb1c853ff 100644 --- a/lib/Controller/RoomController.php +++ b/lib/Controller/RoomController.php @@ -2459,7 +2459,7 @@ public function getCapabilities(): DataResponse { $data['config']['call']['start-without-media'] = $this->talkConfig->getCallsStartWithoutMedia($this->userId); } if (isset($data['config']['call']['blur-virtual-background'])) { - $data['config']['call']['blur-virtual-background'] = $this->talkConfig->getBlurBackground($this->userId); + $data['config']['call']['blur-virtual-background'] = $this->talkConfig->getBlurVirtualBackground($this->userId); } if ($response->getHeaders()['X-Nextcloud-Talk-Hash']) { diff --git a/src/components/MediaSettings/MediaSettings.vue b/src/components/MediaSettings/MediaSettings.vue index 1da0a9c8dd6..716e2073321 100644 --- a/src/components/MediaSettings/MediaSettings.vue +++ b/src/components/MediaSettings/MediaSettings.vue @@ -321,7 +321,7 @@ export default { isRecordingFromStart: false, isPublicShareAuthSidebar: false, isMirrored: false, - skipBlurBackgroundEnabled: false, + skipBlurVirtualBackgroundEnabled: false, } }, @@ -353,8 +353,8 @@ export default { return this.settingsStore.getShowMediaSettings(this.token) }, - blurBackgroundEnabled() { - return this.settingsStore.blurBackgroundEnabled + blurVirtualBackgroundEnabled() { + return this.settingsStore.blurVirtualBackgroundEnabled }, showVideo() { @@ -444,7 +444,7 @@ export default { } else if (BrowserStorage.getItem('virtualBackgroundType_' + this.token) === VIRTUAL_BACKGROUND.BACKGROUND_TYPE.IMAGE) { this.setVirtualBackgroundImage(BrowserStorage.getItem('virtualBackgroundUrl_' + this.token)) } - } else if (this.blurBackgroundEnabled) { + } else if (this.blurVirtualBackgroundEnabled) { // Fall back to global blur background setting this.blurVirtualBackground() } else { @@ -477,7 +477,7 @@ export default { if (value) { const virtualBackgroundEnabled = BrowserStorage.getItem('virtualBackgroundEnabled_' + this.token) === 'true' // Apply global blur background setting - if (this.blurBackgroundEnabled && !this.skipBlurBackgroundEnabled && !virtualBackgroundEnabled) { + if (this.blurVirtualBackgroundEnabled && !this.skipBlurVirtualBackgroundEnabled && !virtualBackgroundEnabled) { this.blurBackground(true) } } @@ -573,14 +573,14 @@ export default { handleUpdateBackground(background) { // Default global blur background setting was changed by user - if (this.blurBackgroundEnabled && background !== 'blur') { - this.skipBlurBackgroundEnabled = true + if (this.blurVirtualBackgroundEnabled && background !== 'blur') { + this.skipBlurVirtualBackgroundEnabled = true } // Apply the new background if (background === 'none') { this.clearBackground() } else if (background === 'blur') { - this.blurBackground(this.blurBackgroundEnabled) + this.blurBackground(this.blurVirtualBackgroundEnabled) } else { this.setBackgroundImage(background) } @@ -629,14 +629,14 @@ export default { /** * Blurs the background of the participants in current or future call * - * @param {boolean} globalBlurBackground - Whether the global blur background setting is enabled (in Talk settings) + * @param {boolean} globalBlurVirtualBackground - Whether the global blur background setting is enabled (in Talk settings) */ - blurBackground(globalBlurBackground = false) { + blurBackground(globalBlurVirtualBackground = false) { if (this.isInCall) { localMediaModel.enableVirtualBackground() - localMediaModel.setVirtualBackgroundBlur(VIRTUAL_BACKGROUND.BLUR_STRENGTH.DEFAULT, globalBlurBackground) - } else if (!globalBlurBackground) { - this.skipBlurBackgroundEnabled = true + localMediaModel.setVirtualBackgroundBlur(VIRTUAL_BACKGROUND.BLUR_STRENGTH.DEFAULT, globalBlurVirtualBackground) + } else if (!globalBlurVirtualBackground) { + this.skipBlurVirtualBackgroundEnabled = true BrowserStorage.setItem('virtualBackgroundEnabled_' + this.token, 'true') BrowserStorage.setItem('virtualBackgroundType_' + this.token, VIRTUAL_BACKGROUND.BACKGROUND_TYPE.BLUR) BrowserStorage.setItem('virtualBackgroundBlurStrength_' + this.token, VIRTUAL_BACKGROUND.BLUR_STRENGTH.DEFAULT) diff --git a/src/components/MediaSettings/VideoBackgroundEditor.vue b/src/components/MediaSettings/VideoBackgroundEditor.vue index a24bc38d46e..0a31f47b954 100644 --- a/src/components/MediaSettings/VideoBackgroundEditor.vue +++ b/src/components/MediaSettings/VideoBackgroundEditor.vue @@ -265,7 +265,7 @@ export default { } else { this.selectedBackground = 'none' } - } else if (this.settingsStore.blurBackgroundEnabled) { + } else if (this.settingsStore.blurVirtualBackgroundEnabled) { this.selectedBackground = 'blur' } else { this.selectedBackground = 'none' diff --git a/src/components/SettingsDialog/MediaDevicesPreview.vue b/src/components/SettingsDialog/MediaDevicesPreview.vue index 0d80227fd82..f694253e3a9 100644 --- a/src/components/SettingsDialog/MediaDevicesPreview.vue +++ b/src/components/SettingsDialog/MediaDevicesPreview.vue @@ -63,10 +63,10 @@ disablePictureInPicture="true" tabindex="-1" /> - + :checked="blurVirtualBackgroundEnabled" + @update:checked="setBlurVirtualBackgroundEnabled"> {{ t('spreed', 'Enable blur background by default for all conversation') }} @@ -91,7 +91,7 @@ import { VIRTUAL_BACKGROUND } from '../../constants.js' import { getTalkConfig } from '../../services/CapabilitiesManager.ts' import { useSettingsStore } from '../../stores/settings.js' -const supportDefaultBlurBackground = getTalkConfig('local', 'call', 'blur-virtual-background') !== undefined +const supportDefaultBlurVirtualBackground = getTalkConfig('local', 'call', 'blur-virtual-background') !== undefined export default { @@ -142,7 +142,7 @@ export default { videoStreamError, settingsStore: useSettingsStore(), virtualBackground, - supportDefaultBlurBackground, + supportDefaultBlurVirtualBackground, } }, @@ -199,13 +199,13 @@ export default { return t('spreed', 'Error while accessing camera') }, - blurBackgroundEnabled() { - return this.settingsStore.blurBackgroundEnabled + blurVirtualBackgroundEnabled() { + return this.settingsStore.blurVirtualBackgroundEnabled }, }, mounted() { - if (this.blurBackgroundEnabled) { + if (this.blurVirtualBackgroundEnabled) { // wait for the virtual background to be ready this.$nextTick(() => { this.virtualBackground.setEnabled(true) @@ -230,9 +230,9 @@ export default { this.updatePreferences('videoinput') }, - async setBlurBackgroundEnabled(value) { + async setBlurVirtualBackgroundEnabled(value) { try { - await this.settingsStore.setBlurBackgroundEnabled(value) + await this.settingsStore.setBlurVirtualBackgroundEnabled(value) if (value) { this.virtualBackground.setEnabled(true) this.virtualBackground.setVirtualBackground({ diff --git a/src/services/settingsService.js b/src/services/settingsService.js index e04f3ad9c83..b0f92149f16 100644 --- a/src/services/settingsService.js +++ b/src/services/settingsService.js @@ -78,7 +78,7 @@ const setStartWithoutMedia = async function(value) { await setUserConfig('spreed', 'calls_start_without_media', value ? 'yes' : 'no') } -const setBlurBackground = async function(value) { +const setBlurVirtualBackground = async function(value) { await setUserConfig('spreed', 'blur_virtual_background', value ? 'yes' : 'no') } @@ -97,7 +97,7 @@ const setUserConfig = async function(appId, configKey, configValue) { export { setAttachmentFolder, - setBlurBackground, + setBlurVirtualBackground, setReadStatusPrivacy, setTypingStatusPrivacy, setSIPSettings, diff --git a/src/stores/settings.js b/src/stores/settings.js index 661d1f75e76..9c3e37aaf63 100644 --- a/src/stores/settings.js +++ b/src/stores/settings.js @@ -15,7 +15,7 @@ import { setReadStatusPrivacy, setTypingStatusPrivacy, setStartWithoutMedia, - setBlurBackground, + setBlurVirtualBackground, } from '../services/settingsService.js' /** @@ -41,7 +41,7 @@ export const useSettingsStore = defineStore('settings', { typingStatusPrivacy: loadState('spreed', 'typing_privacy', PRIVACY.PRIVATE), showMediaSettings: {}, startWithoutMedia: getTalkConfig('local', 'call', 'start-without-media'), - blurBackgroundEnabled: getTalkConfig('local', 'call', 'blur-virtual-background'), + blurVirtualBackgroundEnabled: getTalkConfig('local', 'call', 'blur-virtual-background'), }), getters: { @@ -105,9 +105,9 @@ export const useSettingsStore = defineStore('settings', { Vue.set(this.showMediaSettings, token, value) }, - async setBlurBackgroundEnabled(value) { - await setBlurBackground(value) - this.blurBackgroundEnabled = value + async setBlurVirtualBackgroundEnabled(value) { + await setBlurVirtualBackground(value) + this.blurVirtualBackgroundEnabled = value }, async setStartWithoutMedia(value) { diff --git a/src/utils/webrtc/models/LocalMediaModel.js b/src/utils/webrtc/models/LocalMediaModel.js index 8ab62df0f9d..00c1a756e99 100644 --- a/src/utils/webrtc/models/LocalMediaModel.js +++ b/src/utils/webrtc/models/LocalMediaModel.js @@ -387,7 +387,7 @@ LocalMediaModel.prototype = { this._webRtc.enableVirtualBackground() }, - setVirtualBackgroundBlur(blurStrength, globalBlurBackground = false) { + setVirtualBackgroundBlur(blurStrength, globalBlurVirtualBackground = false) { if (!this._webRtc) { throw new Error('WebRtc not initialized yet') } @@ -396,7 +396,7 @@ LocalMediaModel.prototype = { blurStrength = VIRTUAL_BACKGROUND.BLUR_STRENGTH.DEFAULT } - if (!globalBlurBackground) { + if (!globalBlurVirtualBackground) { BrowserStorage.setItem('virtualBackgroundType_' + this.get('token'), VIRTUAL_BACKGROUND.BACKGROUND_TYPE.BLUR) BrowserStorage.setItem('virtualBackgroundBlurStrength_' + this.get('token'), blurStrength) BrowserStorage.removeItem('virtualBackgroundUrl_' + this.get('token'))