fix: build ios (#8709)

Signed-off-by: fufesou <linlong1266@gmail.com>
This commit is contained in:
fufesou 2024-07-14 15:05:56 +08:00 committed by GitHub
parent 3a0ece1447
commit e2a7e38a39
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 16 additions and 13 deletions

View File

@ -390,15 +390,15 @@ impl<T: InvokeUiSession> Remote<T> {
if self.handler.is_file_transfer() || self.handler.is_port_forward() { if self.handler.is_file_transfer() || self.handler.is_port_forward() {
return None; return None;
} }
// NOTE:
// The client server and --server both use the same sound input device.
// It's better to distinguish the server side and client side.
// But it' not necessary for now, because it's not a common case.
// And it is immediately known when the input device is changed.
crate::audio_service::set_voice_call_input_device(get_default_sound_input(), false);
// iOS does not have this server. // iOS does not have this server.
#[cfg(not(any(target_os = "ios")))] #[cfg(not(any(target_os = "ios")))]
{ {
// NOTE:
// The client server and --server both use the same sound input device.
// It's better to distinguish the server side and client side.
// But it' not necessary for now, because it's not a common case.
// And it is immediately known when the input device is changed.
crate::audio_service::set_voice_call_input_device(get_default_sound_input(), false);
// Create a channel to receive error or closed message // Create a channel to receive error or closed message
let (tx, rx) = std::sync::mpsc::channel(); let (tx, rx) = std::sync::mpsc::channel();
let (tx_audio_data, mut rx_audio_data) = let (tx_audio_data, mut rx_audio_data) =

View File

@ -1319,16 +1319,18 @@ pub fn cm_close_voice_call(id: i32) {
crate::ui_cm_interface::close_voice_call(id); crate::ui_cm_interface::close_voice_call(id);
} }
pub fn set_voice_call_input_device(is_cm: bool, device: String) { pub fn set_voice_call_input_device(_is_cm: bool, _device: String) {
if is_cm { #[cfg(not(any(target_os = "android", target_os = "ios")))]
let _ = crate::ipc::set_config("voice-call-input", device); if _is_cm {
let _ = crate::ipc::set_config("voice-call-input", _device);
} else { } else {
crate::audio_service::set_voice_call_input_device(Some(device), true); crate::audio_service::set_voice_call_input_device(Some(_device), true);
} }
} }
pub fn get_voice_call_input_device(is_cm: bool) -> String { pub fn get_voice_call_input_device(_is_cm: bool) -> String {
if is_cm { #[cfg(not(any(target_os = "android", target_os = "ios")))]
if _is_cm {
match crate::ipc::get_config("voice-call-input") { match crate::ipc::get_config("voice-call-input") {
Ok(Some(device)) => device, Ok(Some(device)) => device,
_ => "".to_owned(), _ => "".to_owned(),
@ -1336,6 +1338,8 @@ pub fn get_voice_call_input_device(is_cm: bool) -> String {
} else { } else {
crate::audio_service::get_voice_call_input_device().unwrap_or_default() crate::audio_service::get_voice_call_input_device().unwrap_or_default()
} }
#[cfg(any(target_os = "android", target_os = "ios"))]
"".to_owned()
} }
pub fn main_get_last_remote_id() -> String { pub fn main_get_last_remote_id() -> String {

View File

@ -163,7 +163,6 @@ mod cpal_impl {
} }
fn run_restart(sp: EmptyExtraFieldService, state: &mut State) -> ResultType<()> { fn run_restart(sp: EmptyExtraFieldService, state: &mut State) -> ResultType<()> {
println!("REMOVE ME ========================= run_restart");
state.reset(); state.reset();
sp.snapshot(|_sps: ServiceSwap<_>| Ok(()))?; sp.snapshot(|_sps: ServiceSwap<_>| Ok(()))?;
match &state.stream { match &state.stream {