call_settings.rs

 1use anyhow::Result;
 2use gpui::AppContext;
 3use schemars::JsonSchema;
 4use serde_derive::{Deserialize, Serialize};
 5use settings::Settings;
 6
 7#[derive(Deserialize, Debug)]
 8pub struct CallSettings {
 9    pub mute_on_join: bool,
10}
11
12#[derive(Clone, Default, Serialize, Deserialize, JsonSchema, Debug)]
13pub struct CallSettingsContent {
14    /// Whether the microphone should be muted when joining a channel or a call.
15    pub mute_on_join: Option<bool>,
16}
17
18impl Settings for CallSettings {
19    const KEY: Option<&'static str> = Some("calls");
20
21    type FileContent = CallSettingsContent;
22
23    fn load(
24        default_value: &Self::FileContent,
25        user_values: &[&Self::FileContent],
26        _cx: &mut AppContext,
27    ) -> Result<Self>
28    where
29        Self: Sized,
30    {
31        Self::load_via_json_merge(default_value, user_values)
32    }
33}