Skip to content

Commit

Permalink
fix: total renaming from blurBackground to blurVirtualBackground
Browse files Browse the repository at this point in the history
Signed-off-by: DorraJaouad <[email protected]>
  • Loading branch information
DorraJaouad committed Nov 15, 2024
1 parent 0c8a6ad commit 3d7cbd8
Show file tree
Hide file tree
Showing 9 changed files with 37 additions and 37 deletions.
4 changes: 2 additions & 2 deletions lib/Capabilities.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion lib/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
2 changes: 1 addition & 1 deletion lib/Controller/RoomController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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']) {
Expand Down
26 changes: 13 additions & 13 deletions src/components/MediaSettings/MediaSettings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ export default {
isRecordingFromStart: false,
isPublicShareAuthSidebar: false,
isMirrored: false,
skipBlurBackgroundEnabled: false,
skipBlurVirtualBackgroundEnabled: false,
}
},
Expand Down Expand Up @@ -353,8 +353,8 @@ export default {
return this.settingsStore.getShowMediaSettings(this.token)
},
blurBackgroundEnabled() {
return this.settingsStore.blurBackgroundEnabled
blurVirtualBackgroundEnabled() {
return this.settingsStore.blurVirtualBackgroundEnabled
},
showVideo() {
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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)
}
}
Expand Down Expand Up @@ -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)
}
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/components/MediaSettings/VideoBackgroundEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
20 changes: 10 additions & 10 deletions src/components/SettingsDialog/MediaDevicesPreview.vue
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@
disablePictureInPicture="true"
tabindex="-1" />
</div>
<NcCheckboxRadioSwitch v-if="supportDefaultBlurBackground"
<NcCheckboxRadioSwitch v-if="supportDefaultBlurVirtualBackground"
type="switch"
:checked="blurBackgroundEnabled"
@update:checked="setBlurBackgroundEnabled">
:checked="blurVirtualBackgroundEnabled"
@update:checked="setBlurVirtualBackgroundEnabled">
{{ t('spreed', 'Enable blur background by default for all conversation') }}
</NcCheckboxRadioSwitch>
</div>
Expand All @@ -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 {
Expand Down Expand Up @@ -142,7 +142,7 @@ export default {
videoStreamError,
settingsStore: useSettingsStore(),
virtualBackground,
supportDefaultBlurBackground,
supportDefaultBlurVirtualBackground,
}
},
Expand Down Expand Up @@ -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)
Expand All @@ -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({
Expand Down
4 changes: 2 additions & 2 deletions src/services/settingsService.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')
}

Expand All @@ -97,7 +97,7 @@ const setUserConfig = async function(appId, configKey, configValue) {

export {
setAttachmentFolder,
setBlurBackground,
setBlurVirtualBackground,
setReadStatusPrivacy,
setTypingStatusPrivacy,
setSIPSettings,
Expand Down
10 changes: 5 additions & 5 deletions src/stores/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
setReadStatusPrivacy,
setTypingStatusPrivacy,
setStartWithoutMedia,
setBlurBackground,
setBlurVirtualBackground,
} from '../services/settingsService.js'

/**
Expand All @@ -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: {
Expand Down Expand Up @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions src/utils/webrtc/models/LocalMediaModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')
}
Expand All @@ -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'))
Expand Down

0 comments on commit 3d7cbd8

Please sign in to comment.