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