fix: compile

This commit is contained in:
Kingtous 2023-02-06 12:10:15 +08:00
parent 11c6008811
commit a601e3b241
2 changed files with 13 additions and 12 deletions

View File

@ -1288,6 +1288,7 @@ pub fn main_start_ipc_url_server() {
/// Send a url scheme throught the ipc. /// Send a url scheme throught the ipc.
/// ///
/// * macOS only /// * macOS only
#[allow(unused_variables)]
pub fn send_url_scheme(url: String) { pub fn send_url_scheme(url: String) {
#[cfg(target_os = "macos")] #[cfg(target_os = "macos")]
thread::spawn(move || crate::ui::macos::handle_url_scheme(url)); thread::spawn(move || crate::ui::macos::handle_url_scheme(url));

View File

@ -398,9 +398,7 @@ impl Connection {
conn.send(msg).await; conn.send(msg).await;
} }
ipc::Data::VoiceCallResponse(accepted) => { ipc::Data::VoiceCallResponse(accepted) => {
if accepted { conn.handle_voice_call(accepted).await;
conn.start_voice_call().await;
}
} }
ipc::Data::CloseVoiceCall(_reason) => { ipc::Data::CloseVoiceCall(_reason) => {
conn.close_voice_call().await; conn.close_voice_call().await;
@ -1613,10 +1611,11 @@ impl Connection {
true true
} }
pub async fn start_voice_call(&mut self) { pub async fn handle_voice_call(&mut self, accepted: bool) {
if let Some(ts) = self.voice_call_request_timestamp.take() { if let Some(ts) = self.voice_call_request_timestamp.take() {
let msg = new_voice_call_response(ts.get(), accepted); let msg = new_voice_call_response(ts.get(), accepted);
conn.send(msg).await; self.send(msg).await;
if accepted {
// Backup the default input device. // Backup the default input device.
let audio_input_device = Config::get_option("audio-input"); let audio_input_device = Config::get_option("audio-input");
self.audio_input_device_before_voice_call = Some(audio_input_device); self.audio_input_device_before_voice_call = Some(audio_input_device);
@ -1625,6 +1624,7 @@ impl Connection {
if let Some(device) = default_sound_device { if let Some(device) = default_sound_device {
set_sound_input(device); set_sound_input(device);
} }
}
} else { } else {
log::warn!("Possible a voice call attack."); log::warn!("Possible a voice call attack.");
} }