feat: cm interface

This commit is contained in:
Kingtous
2023-02-06 12:53:57 +08:00
parent 850c4bcbbf
commit 040396b3f8
5 changed files with 53 additions and 0 deletions

View File

@@ -88,6 +88,12 @@ pub trait InvokeUiCM: Send + Clone + 'static + Sized {
fn change_language(&self);
fn show_elevation(&self, show: bool);
fn voice_call_started(&self, id: i32);
fn voice_call_incoming(&self, id: i32);
fn voice_call_closed(&self, id: i32, reason: &str);
}
impl<T: InvokeUiCM> Deref for ConnectionManager<T> {
@@ -180,6 +186,18 @@ impl<T: InvokeUiCM> ConnectionManager<T> {
fn show_elevation(&self, show: bool) {
self.ui_handler.show_elevation(show);
}
fn voice_call_started(&self, id: i32) {
self.ui_handler.voice_call_started(id);
}
fn voice_call_incoming(&self, id: i32) {
self.ui_handler.voice_call_incoming(id);
}
fn voice_call_closed(&self, id: i32, reason: &str) {
self.ui_handler.voice_call_closed(id, reason);
}
}
#[inline]
@@ -389,6 +407,15 @@ impl<T: InvokeUiCM> IpcTaskRunner<T> {
Data::DataPortableService(ipc::DataPortableService::CmShowElevation(show)) => {
self.cm.show_elevation(show);
}
Data::StartVoiceCall => {
self.cm.voice_call_started(self.conn_id);
}
Data::VoiceCallIncoming => {
self.cm.voice_call_incoming(self.conn_id);
}
Data::CloseVoiceCall(reason) => {
self.cm.voice_call_closed(self.conn_id, reason.as_str());
}
_ => {
}