fix:退出后台时自动挂断
This commit is contained in:
parent
25fb142765
commit
48d4081b3e
@ -1199,6 +1199,16 @@ class StartChartManage {
|
||||
|
||||
/// 销毁资源
|
||||
void destruction() async {
|
||||
// 先挂断
|
||||
final status = talkStatus.status;
|
||||
if (status == TalkStatus.passiveCallWaitingAnswer ||
|
||||
status == TalkStatus.proactivelyCallWaitingAnswer ||
|
||||
status == TalkStatus.answeredSuccessfully ||
|
||||
status == TalkStatus.uninitialized) {
|
||||
startTalkRejectMessageTimer();
|
||||
startTalkHangupMessageTimer();
|
||||
await Future.delayed(Duration(seconds: 1));
|
||||
}
|
||||
isOnlineStarChartServer = false;
|
||||
// 停止发送心跳消息
|
||||
stopHeartbeat();
|
||||
@ -1226,7 +1236,6 @@ class StartChartManage {
|
||||
await Storage.removerStarChartRegisterNodeInfo();
|
||||
// 关闭udp服务
|
||||
closeUdpSocket();
|
||||
|
||||
}
|
||||
|
||||
/// 重置数据
|
||||
|
||||
@ -30,14 +30,13 @@ class AppLifecycleObserver extends WidgetsBindingObserver {
|
||||
// 处理应用程序进入后台的逻辑
|
||||
|
||||
final status = StartChartManage().talkStatus.status;
|
||||
|
||||
if (status == TalkStatus.passiveCallWaitingAnswer ||
|
||||
status == TalkStatus.proactivelyCallWaitingAnswer ||
|
||||
status == TalkStatus.answeredSuccessfully ||
|
||||
status == TalkStatus.uninitialized) {
|
||||
StartChartManage().destruction();
|
||||
Get.back();
|
||||
}
|
||||
StartChartManage().destruction();
|
||||
}
|
||||
|
||||
void onAppResumed() async {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user