Skip to content

Commit

Permalink
fix(settings): drop local setting for background blur filter, use pro…
Browse files Browse the repository at this point in the history
…vided by server

Signed-off-by: Maksim Sukharev <[email protected]>
  • Loading branch information
Antreesy committed Aug 22, 2024
1 parent 3d5f4d0 commit 1dc62cc
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 30 deletions.
3 changes: 3 additions & 0 deletions lib/TInitialState.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,9 @@ protected function publishInitialStateForUser(IUser $user, IRootFolder $rootFold
$this->serverConfig->getUserValue($user->getUID(), 'spreed', 'play_sounds', 'yes') === 'yes'
);

$this->initialState->provideInitialState(
'force_enable_blur_filter',
$this->serverConfig->getUserValue($user->getUID(), 'theming', 'force_enable_blur_filter', ''));

$this->initialState->provideInitialState(
'user_group_ids',
Expand Down
16 changes: 2 additions & 14 deletions src/components/CallView/CallView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
-->

<template>
<div id="call-container" :class="{ 'blurred': isBackgroundBlurred }">
<div id="call-container">
<ViewerOverlayCallView v-if="isViewerOverlay"
:token="token"
:model="promotedParticipantModel"
Expand Down Expand Up @@ -151,7 +151,6 @@ import VideoVue from './shared/VideoVue.vue'
import ViewerOverlayCallView from './shared/ViewerOverlayCallView.vue'
import { SIMULCAST } from '../../constants.js'
import BrowserStorage from '../../services/BrowserStorage.js'
import { fetchPeers } from '../../services/callsService.js'
import { EventBus } from '../../services/EventBus.js'
import { localMediaModel, localCallParticipantModel, callParticipantCollection } from '../../utils/webrtc/index.js'
Expand Down Expand Up @@ -210,7 +209,6 @@ export default {
localSharedData: {
screenVisible: true,
},
isBackgroundBlurred: true,
showPresenterOverlay: true,
debounceFetchPeers: () => {},
}
Expand Down Expand Up @@ -435,7 +433,6 @@ export default {
// Ensure that data is properly initialized before mounting the
// subviews.
this.updateDataFromCallParticipantModels(this.callParticipantModels)
this.isBackgroundBlurred = BrowserStorage.getItem('background-blurred') !== 'false'
},
mounted() {
Expand All @@ -445,7 +442,6 @@ export default {
callParticipantCollection.on('remove', this._lowerHandWhenParticipantLeaves)
subscribe('switch-screen-to-id', this._switchScreenToId)
subscribe('set-background-blurred', this.setBackgroundBlurred)
},
beforeDestroy() {
Expand All @@ -455,7 +451,6 @@ export default {
callParticipantCollection.off('remove', this._lowerHandWhenParticipantLeaves)
unsubscribe('switch-screen-to-id', this._switchScreenToId)
unsubscribe('set-background-blurred', this.setBackgroundBlurred)
},
methods: {
Expand Down Expand Up @@ -719,10 +714,6 @@ export default {
}
},
setBackgroundBlurred(value) {
this.isBackgroundBlurred = value
},
isModelWithVideo(callParticipantModel) {
return callParticipantModel.attributes.videoAvailable
&& this.sharedDatas[callParticipantModel.attributes.peerId].remoteVideoBlocker.isVideoEnabled()
Expand Down Expand Up @@ -755,10 +746,7 @@ export default {
width: 100%;
height: 100%;
background-color: $color-call-background;
&.blurred {
backdrop-filter: blur(25px);
}
backdrop-filter: var(--filter-background-blur);
}
#videos {
Expand Down
41 changes: 25 additions & 16 deletions src/components/SettingsDialog/SettingsDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,19 @@
:name="t('spreed', 'Performance')"
class="app-settings-section">
<NcCheckboxRadioSwitch id="blur-call-background"
:checked="isBackgroundBlurred"
type="switch"
:checked="isBackgroundBlurred === 'yes'"
:indeterminate="isBackgroundBlurred === ''"
type="checkbox"
class="checkbox"
@update:checked="toggleBackgroundBlurred">
disabled>
{{ t('spreed', 'Blur background image in the call (may increase GPU load)') }}
</NcCheckboxRadioSwitch>
<a :href="themingUrl"
target="_blank"
rel="noreferrer nofollow"
class="external">
{{ t('spreed', 'Background blur for Nextcloud instance can be adjusted in the theming settings.') }} ↗
</a>
</NcAppSettingsSection>
<NcAppSettingsSection v-if="!disableKeyboardShortcuts"
id="shortcuts"
Expand Down Expand Up @@ -179,11 +186,13 @@
</template>

<script>
import axios from '@nextcloud/axios'
import { getCapabilities } from '@nextcloud/capabilities'
import { showError, showSuccess } from '@nextcloud/dialogs'
import { FilePickerVue } from '@nextcloud/dialogs/filepicker.js'
import { emit, subscribe, unsubscribe } from '@nextcloud/event-bus'
import { generateUrl } from '@nextcloud/router'
import { subscribe, unsubscribe } from '@nextcloud/event-bus'
import { loadState } from '@nextcloud/initial-state'
import { generateOcsUrl, generateUrl } from '@nextcloud/router'
import NcAppSettingsDialog from '@nextcloud/vue/dist/Components/NcAppSettingsDialog.js'
import NcAppSettingsSection from '@nextcloud/vue/dist/Components/NcAppSettingsSection.js'
Expand All @@ -197,6 +206,7 @@ import BrowserStorage from '../../services/BrowserStorage.js'
import { useSettingsStore } from '../../stores/settings.js'
const supportTypingStatus = getCapabilities()?.spreed?.config?.chat?.['typing-privacy'] !== undefined
const isBackgroundBlurred = loadState('spreed', 'force_enable_blur_filter', '')
export default {
name: 'SettingsDialog',
Expand All @@ -216,6 +226,7 @@ export default {
return {
settingsStore,
supportTypingStatus,
isBackgroundBlurred,
}
},
Expand All @@ -226,7 +237,6 @@ export default {
attachmentFolderLoading: true,
privacyLoading: false,
playSoundsLoading: false,
isBackgroundBlurred: true,
}
},
Expand Down Expand Up @@ -263,6 +273,10 @@ export default {
return generateUrl('/settings/user/notifications')
},
themingUrl() {
return generateUrl('/settings/user/theming')
},
disableKeyboardShortcuts() {
return OCP.Accessibility.disableKeyboardShortcuts()
},
Expand All @@ -278,11 +292,12 @@ export default {
created() {
const blurred = BrowserStorage.getItem('background-blurred')
if (blurred === null) {
BrowserStorage.setItem('background-blurred', 'true')
if (blurred === 'false' && isBackgroundBlurred === '') {
console.debug('Blur was disabled intentionally, propagating last choice to server')
axios.post(generateOcsUrl('apps/provisioning_api/api/v1/config/users/theming/force_enable_blur_filter'),
{ configValue: 'no' })
}
this.isBackgroundBlurred = blurred !== 'false'
BrowserStorage.removeItem('background-blurred')
},
mounted() {
Expand Down Expand Up @@ -337,12 +352,6 @@ export default {
this.privacyLoading = false
},
toggleBackgroundBlurred(value) {
this.isBackgroundBlurred = value
BrowserStorage.setItem('background-blurred', value)
emit('set-background-blurred', value)
},
async togglePlaySounds() {
this.playSoundsLoading = true
try {
Expand Down

0 comments on commit 1dc62cc

Please sign in to comment.