From b8fe916252c0bdcadfcf75142b56038aa6e15e80 Mon Sep 17 00:00:00 2001 From: xue <2144439972@qq.com> Date: Tue, 30 Dec 2025 15:06:08 +0800 Subject: [PATCH] =?utf8?q?=E5=A2=9E=E5=8A=A0=E9=80=80=E5=87=BA=E5=AF=B9?= =?utf8?q?=E8=AF=9D=E7=BD=91=E7=BB=9C=E6=A3=80=E6=B5=8B=EF=BC=8C=E9=81=BF?= =?utf8?q?=E5=85=8D=E6=AD=BB=E6=9C=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../include/ThunderBirdPresenter.h | 2 ++ .../thunderbird/src/ThunderBirdPresenter.cpp | 21 ++++++++++++++----- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/include/ThunderBirdPresenter.h b/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/include/ThunderBirdPresenter.h index 99fea8bb9..7b9e1bd19 100644 --- a/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/include/ThunderBirdPresenter.h +++ b/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/include/ThunderBirdPresenter.h @@ -59,6 +59,8 @@ namespace OHOS bool isLullabyRecording{false}; + bool isDialogueExitFinished{true};//退出对话是否完成标志位 + //记录联网次数 int networkCount{0}; //记录vad认证次数 diff --git a/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdPresenter.cpp b/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdPresenter.cpp index 2e7b28e40..f52bc3291 100644 --- a/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdPresenter.cpp +++ b/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdPresenter.cpp @@ -1255,6 +1255,11 @@ namespace OHOS } else if(currentView == THUNDERBIRD_DIALOGUEVIEW) { + if(isDialogueExitFinished == false) + { + return; + } + isDialogueExitFinished = false; WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "退出对话模式,当前子状态: %d", currentSubView); ScreenAlwaysOnCtr(CANCEL_SCREEN_ALWAYS_ON); @@ -1271,8 +1276,14 @@ namespace OHOS // 停止实际的音频播放 // ai_media_play_stop(); // 退出对话模式时恢复表情 + //如果ws未连接,则不发送打断请求 + int wsState = ln_ws_get_connection_state(); + bool wsConnected = (wsState == 2); // WS_STATE_CONNECTED = 2 + if(wsConnected) + { AI_ForceInterrupt(); ln_ws_send_voice_chat_interrupt("退出对话"); + } do_custom_cmd_service_check_msg(CUSTOM_CMD_MSG_AUDIO_DEINIT, NULL, 0); // 退出对话模式,执行清理 @@ -1281,10 +1292,10 @@ namespace OHOS // 先设置退出标志,防止录音结束回调误判为正常录音结束 isDialogueing = false; // 等待视频切换完成,避免在视频切换过程中退出导致资源冲突 - if (ThunderBirdMainView::GetInstance() && ThunderBirdMainView::IsSwitchingVideo()) { - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ThunderBirdPresenter::HandleFuncKeyLongPress: 等待视频切换完成"); - ThunderBirdMainView::WaitForVideoSwitchComplete(2000); - } + // if (ThunderBirdMainView::GetInstance() && ThunderBirdMainView::IsSwitchingVideo()) { + // WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ThunderBirdPresenter::HandleFuncKeyLongPress: 等待视频切换完成"); + // ThunderBirdMainView::WaitForVideoSwitchComplete(2000); + // } // 检查绑定状态,如果未绑定则跳转到 THUNDERBIRD_GUIDEVIEW_5 if (!ThunderBirdModel::GetInstance()->getbind_status()) { @@ -1302,7 +1313,7 @@ namespace OHOS { ThunderBirdReminderView::GetInstance()->HideAll(); } - + isDialogueExitFinished = true; } //当为故事模式 else if(currentView == THUNDERBIRD_LULLABYVIEW && currentSubView == ThunderBirdLullabyView::THUNDERBIRD_LULLABYVIEW_4) -- 2.17.1