Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/components/MediaSettings/MediaSettings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,12 @@ export default {
this.audioOn = !BrowserStorage.getItem('audioDisabled_' + this.token)
this.videoOn = !BrowserStorage.getItem('videoDisabled_' + this.token)
}
this.notifyCall = BrowserStorage.getItem('silentCall_' + this.token) !== 'true'
//check if this call has a silent call flag in storage, otherwise use the default setting from the settings store
const hasSilentCallFlag = BrowserStorage.getItem('silentCall_' + this.token)
console.log('hasSilentCallFlag', hasSilentCallFlag, 'defaultCallMethodIsSilent', this.settingsStore.defaultCallMethodIsSilent)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's remove that log

this.notifyCall = hasSilentCallFlag !== null
? hasSilentCallFlag !== 'true'
: !this.settingsStore.defaultCallMethodIsSilent

// Set virtual background depending on BrowserStorage's settings
if (BrowserStorage.getItem('virtualBackgroundEnabled') === 'true') {
Expand Down
12 changes: 12 additions & 0 deletions src/components/SettingsDialog/SettingsDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@
:label="t('spreed', 'Skip device preview before joining a call')"
:description="t('spreed', 'Camera will be turned off when joining. Always shown if recording consent is required.')"
@update:modelValue="setHideMediaSettings" />
<NcFormBoxSwitch
v-if="!isGuest"
:modelValue="defaultCallMethodIsSilent"
:label="t('spreed', 'Start calls silently by default')"
@update:modelValue="setDefaultCallMethodIsSilent" />
<NcFormBoxButton
:label="t('spreed', 'Microphone settings')"
@click="openAdvancedSettings">
Expand Down Expand Up @@ -249,6 +254,9 @@ export default {
hideMediaSettings() {
return !this.settingsStore.showMediaSettings
},
defaultCallMethodIsSilent() {
return this.settingsStore.defaultCallMethodIsSilent
},
},

mounted() {
Expand Down Expand Up @@ -338,6 +346,10 @@ export default {
this.settingsStore.setShowMediaSettings(!newValue)
},

setDefaultCallMethodIsSilent(newValue) {
this.settingsStore.setDefaultCallMethodIsSilent(newValue)
},

async openAdvancedSettings() {
await spawnDialog(AdvancedAudioDialog, {
container: '#devices',
Expand Down
4 changes: 2 additions & 2 deletions src/components/TopBar/CallButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ export default {
*/
silentCall: {
type: Boolean,
default: false,
default: null,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's better be set directly in TopBar.vue, where it's visible; but design-wise it wouldn't be nice to hold a call button with such long text.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is your suggestion here?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in

<CallButton v-if="!isInCall" shrinkOnMobile />
add:

<CallButton v-if="!isInCall" :silentCall="directSilentCall" shrinkOnMobile />

and below in component:

directSilentCall() {
	return !this.settingsStore.showMediaSettings // only when dialog is not shown
		&& this.settingsStore.defaultCallMethodIsSilent  // and your new setting is on
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

still not needed to change default to null, it's correctly resolved if not passed

},

isRecordingFromStart: {
Expand Down Expand Up @@ -385,7 +385,7 @@ export default {
async handleJoinCall() {
this.loading = true
await this.joinCall(this.token, {
silent: this.hasCall ? true : this.silentCall,
silent: this.hasCall ? true : this.silentCall !== null ? this.silentCall : false,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also not needed

Suggested change
silent: this.hasCall ? true : this.silentCall !== null ? this.silentCall : false,
silent: this.hasCall ? true : this.silentCall,

recordingConsent: this.recordingConsentGiven,
shouldStartRecording: this.isRecordingFromStart,
})
Expand Down
8 changes: 7 additions & 1 deletion src/components/TopBar/TopBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@
<!-- Upcoming meetings -->
<CalendarEventsDialog v-if="showCalendarEvents" :token="token" />

<CallButton v-if="!isInCall" shrinkOnMobile />
<CallButton v-if="!isInCall" :silentCall="directSilentCall" shrinkOnMobile />

<!-- TopBar menu -->
<TopBarMenu
Expand Down Expand Up @@ -167,6 +167,7 @@ import TasksCounter from './TasksCounter.vue'
import TopBarMenu from './TopBarMenu.vue'
import { useGetThreadId } from '../../composables/useGetThreadId.ts'
import { useGetToken } from '../../composables/useGetToken.ts'
import { useSettingsStore } from '../../stores/settings.ts'
import { AVATAR, CONVERSATION, PARTICIPANT } from '../../constants.ts'
import { getTalkConfig, hasTalkFeature } from '../../services/CapabilitiesManager.ts'
import { useActorStore } from '../../stores/actor.ts'
Expand Down Expand Up @@ -229,6 +230,7 @@ export default {
CONVERSATION,
threadId: useGetThreadId(),
token: useGetToken(),
settingsStore: useSettingsStore(),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be conflicting now. Please lift it three lines up to other store declarations

}
},

Expand Down Expand Up @@ -318,6 +320,10 @@ export default {
getUserId() {
return this.actorStore.userId
},
directSilentCall() {
return !this.settingsStore.showMediaSettings
&& this.settingsStore.defaultCallMethodIsSilent
},
},

watch: {
Expand Down
13 changes: 13 additions & 0 deletions src/stores/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export const useSettingsStore = defineStore('settings', () => {
const readStatusPrivacy = ref<PRIVACY_KEYS>(getTalkConfig('local', 'chat', 'read-privacy') as TALK_CONFIG_PRIVACY ?? PRIVACY.PRIVATE)
const typingStatusPrivacy = ref<PRIVACY_KEYS>(getTalkConfig('local', 'chat', 'typing-privacy') as TALK_CONFIG_PRIVACY ?? PRIVACY.PRIVATE)
const showMediaSettings = ref<boolean>(BrowserStorage.getItem('showMediaSettings') !== 'false')
const defaultCallMethodIsSilent = ref<boolean>(BrowserStorage.getItem('defaultCallMethodIsSilent') === 'true')
const noiseSuppression = ref<boolean>(BrowserStorage.getItem('noiseSuppression') !== 'false' && !isSafari)
const noiseSuppressionWithModel = ref<'none' | 'rnnoise' | (string & {})>(BrowserStorage.getItem('noiseSuppressionWithModel') ?? 'none')
const echoCancellation = ref<boolean>(BrowserStorage.getItem('echoCancellation') !== 'false')
Expand Down Expand Up @@ -111,6 +112,16 @@ export const useSettingsStore = defineStore('settings', () => {
showMediaSettings.value = value
}

/**
* Update the default for silent call
*
* @param value - new selected state
*/
function setDefaultCallMethodIsSilent(value: boolean) {
BrowserStorage.setItem('defaultCallMethodIsSilent', value.toString())
defaultCallMethodIsSilent.value = value
}

/**
* Update the noise suppression settings for the user
*
Expand Down Expand Up @@ -254,6 +265,7 @@ export const useSettingsStore = defineStore('settings', () => {
readStatusPrivacy,
typingStatusPrivacy,
showMediaSettings,
defaultCallMethodIsSilent,
noiseSuppression,
noiseSuppressionWithModel,
echoCancellation,
Expand All @@ -276,6 +288,7 @@ export const useSettingsStore = defineStore('settings', () => {
updateReadStatusPrivacy,
updateTypingStatusPrivacy,
setShowMediaSettings,
setDefaultCallMethodIsSilent,
setNoiseSuppression,
setNoiseSuppressionWithModel,
setEchoCancellation,
Expand Down