refact: android audio input, voice call (#8037)

Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
fufesou
2024-05-14 09:20:27 +08:00
committed by GitHub
parent d70b0cdd4f
commit 0500bf070e
51 changed files with 610 additions and 148 deletions

View File

@@ -221,7 +221,7 @@ impl<T: InvokeUiCM> ConnectionManager<T> {
self.ui_handler.show_elevation(show);
}
#[cfg(not(any(target_os = "android", target_os = "ios")))]
#[cfg(not(target_os = "ios"))]
fn voice_call_started(&self, id: i32) {
if let Some(client) = CLIENTS.write().unwrap().get_mut(&id) {
client.incoming_voice_call = false;
@@ -230,7 +230,7 @@ impl<T: InvokeUiCM> ConnectionManager<T> {
}
}
#[cfg(not(any(target_os = "android", target_os = "ios")))]
#[cfg(not(target_os = "ios"))]
fn voice_call_incoming(&self, id: i32) {
if let Some(client) = CLIENTS.write().unwrap().get_mut(&id) {
client.incoming_voice_call = true;
@@ -239,7 +239,7 @@ impl<T: InvokeUiCM> ConnectionManager<T> {
}
}
#[cfg(not(any(target_os = "android", target_os = "ios")))]
#[cfg(not(target_os = "ios"))]
fn voice_call_closed(&self, id: i32, _reason: &str) {
if let Some(client) = CLIENTS.write().unwrap().get_mut(&id) {
client.incoming_voice_call = false;
@@ -656,6 +656,15 @@ pub async fn start_listen<T: InvokeUiCM>(
Some(Data::Close) => {
break;
}
Some(Data::StartVoiceCall) => {
cm.voice_call_started(current_id);
}
Some(Data::VoiceCallIncoming) => {
cm.voice_call_incoming(current_id);
}
Some(Data::CloseVoiceCall(reason)) => {
cm.voice_call_closed(current_id, reason.as_str());
}
None => {
break;
}