opt: notify cm
This commit is contained in:
parent
cd6cdbff8f
commit
66aaf243cf
@ -524,7 +524,7 @@ class _CmControlPanel extends StatelessWidget {
|
|||||||
Offstage(
|
Offstage(
|
||||||
offstage: !client.inVoiceCall,
|
offstage: !client.inVoiceCall,
|
||||||
child: buildButton(context,
|
child: buildButton(context,
|
||||||
color: Colors.purple,
|
color: Colors.red,
|
||||||
onClick: () => closeVoiceCall(),
|
onClick: () => closeVoiceCall(),
|
||||||
icon: Icon(Icons.reply, color: Colors.white),
|
icon: Icon(Icons.reply, color: Colors.white),
|
||||||
text: "Stop voice call",
|
text: "Stop voice call",
|
||||||
@ -538,7 +538,7 @@ class _CmControlPanel extends StatelessWidget {
|
|||||||
child: buildButton(context,
|
child: buildButton(context,
|
||||||
color: MyTheme.accent,
|
color: MyTheme.accent,
|
||||||
onClick: () => handleVoiceCall(true),
|
onClick: () => handleVoiceCall(true),
|
||||||
icon: Icon(Icons.phone, color: Colors.white),
|
icon: Icon(Icons.phone_enabled, color: Colors.white),
|
||||||
text: "Accept",
|
text: "Accept",
|
||||||
textColor: Colors.white),
|
textColor: Colors.white),
|
||||||
),
|
),
|
||||||
@ -546,7 +546,8 @@ class _CmControlPanel extends StatelessWidget {
|
|||||||
child: buildButton(context,
|
child: buildButton(context,
|
||||||
color: Colors.red,
|
color: Colors.red,
|
||||||
onClick: () => handleVoiceCall(false),
|
onClick: () => handleVoiceCall(false),
|
||||||
icon: Icon(Icons.phone, color: Colors.white),
|
icon:
|
||||||
|
Icon(Icons.phone_disabled_rounded, color: Colors.white),
|
||||||
text: "Deny",
|
text: "Deny",
|
||||||
textColor: Colors.white),
|
textColor: Colors.white),
|
||||||
)
|
)
|
||||||
|
@ -587,6 +587,12 @@ class ServerModel with ChangeNotifier {
|
|||||||
if (index != -1) {
|
if (index != -1) {
|
||||||
_clients[index].inVoiceCall = client.inVoiceCall;
|
_clients[index].inVoiceCall = client.inVoiceCall;
|
||||||
_clients[index].incomingVoiceCall = client.incomingVoiceCall;
|
_clients[index].incomingVoiceCall = client.incomingVoiceCall;
|
||||||
|
if (client.incomingVoiceCall) {
|
||||||
|
// Has incoming phone call, let's set the window on top.
|
||||||
|
Future.delayed(Duration.zero, () {
|
||||||
|
window_on_top(null);
|
||||||
|
});
|
||||||
|
}
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
@ -1259,7 +1259,7 @@ impl<T: InvokeUiSession> Remote<T> {
|
|||||||
log::debug!("Possible encountering a voice call attack.");
|
log::debug!("Possible encountering a voice call attack.");
|
||||||
} else {
|
} else {
|
||||||
if response.accepted {
|
if response.accepted {
|
||||||
// The peer accepts the voice call.
|
// The peer accepted the voice call.
|
||||||
self.handler.on_voice_call_started();
|
self.handler.on_voice_call_started();
|
||||||
self.stop_voice_call_sender = self.start_voice_call();
|
self.stop_voice_call_sender = self.start_voice_call();
|
||||||
} else {
|
} else {
|
||||||
|
@ -1596,9 +1596,11 @@ impl Connection {
|
|||||||
NonZeroI64::new(request.req_timestamp)
|
NonZeroI64::new(request.req_timestamp)
|
||||||
.unwrap_or(NonZeroI64::new(get_time()).unwrap()),
|
.unwrap_or(NonZeroI64::new(get_time()).unwrap()),
|
||||||
);
|
);
|
||||||
// Call cm.
|
// Notify the connection manager.
|
||||||
self.send_to_cm(Data::VoiceCallIncoming);
|
self.send_to_cm(Data::VoiceCallIncoming);
|
||||||
} else {
|
} else {
|
||||||
|
// Notify the connection manager.
|
||||||
|
self.send_to_cm(Data::CloseVoiceCall("".to_owned()));
|
||||||
self.close_voice_call().await;
|
self.close_voice_call().await;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1617,6 +1619,7 @@ impl Connection {
|
|||||||
if accepted {
|
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");
|
||||||
|
log::debug!("Backup the sound input device {}", audio_input_device);
|
||||||
self.audio_input_device_before_voice_call = Some(audio_input_device);
|
self.audio_input_device_before_voice_call = Some(audio_input_device);
|
||||||
// Switch to default input device
|
// Switch to default input device
|
||||||
let default_sound_device = get_default_sound_input();
|
let default_sound_device = get_default_sound_input();
|
||||||
@ -1637,8 +1640,6 @@ impl Connection {
|
|||||||
// Restore to the prior audio device.
|
// Restore to the prior audio device.
|
||||||
if let Some(sound_input) = std::mem::replace(&mut self.audio_input_device_before_voice_call, None) {
|
if let Some(sound_input) = std::mem::replace(&mut self.audio_input_device_before_voice_call, None) {
|
||||||
set_sound_input(sound_input);
|
set_sound_input(sound_input);
|
||||||
// Notify the connection manager.
|
|
||||||
self.send_to_cm(Data::CloseVoiceCall("".to_owned()));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user