From: xue <2144439972@qq.com> Date: Tue, 2 Dec 2025 06:03:04 +0000 (+0800) Subject: 修改哄睡逻辑 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=003530e0f2891060b0ba70b668f3a3e5522a8bf5;p=mirrors%2FFD230.git 修改哄睡逻辑 --- diff --git a/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/include/ThunderBirdModel.h b/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/include/ThunderBirdModel.h index aee37aceb..82c020ce5 100644 --- a/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/include/ThunderBirdModel.h +++ b/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/include/ThunderBirdModel.h @@ -308,6 +308,9 @@ namespace OHOS // 睡眠模式激活标志位 bool g_sleep_mode_active = false; + + // 哄睡界面相关标志 + bool m_lullabyView3InquiryStarted = false; // THUNDERBIRD_LULLABYVIEW_3界面,角色是否已经开始询问 private: ThunderBirdModel(); @@ -395,6 +398,7 @@ namespace OHOS // 对话模式相关标志 bool m_dialogueModeFinished = false; // 对话模式是否已finished(收到finished=true) + }; } diff --git a/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdModel.cpp b/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdModel.cpp index db36ad423..22d22ca1e 100644 --- a/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdModel.cpp +++ b/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdModel.cpp @@ -2986,6 +2986,16 @@ extern "C" { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ThunderBirdModel::HandleAudioPlaybackStart"); // 音频开始播放时,从队列中取出对应的文本并推送 DequeueAndPushAudioText(); + + // 检查是否在THUNDERBIRD_LULLABYVIEW_3界面,如果是,标记角色开始询问 + int currentView = ThunderBirdMainView::GetInstance()->GetCurrentView(); + int currentSubView = ThunderBirdMainView::GetInstance()->GetCurrentSubView(); + if (currentView == THUNDERBIRD_LULLABYVIEW && + currentSubView == ThunderBirdLullabyView::THUNDERBIRD_LULLABYVIEW_3) + { + m_lullabyView3InquiryStarted = true; + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ThunderBirdModel::HandleAudioPlaybackStart: THUNDERBIRD_LULLABYVIEW_3界面,角色开始询问"); + } } void ThunderBirdModel::HandleAudioPlaybackEnd() @@ -3010,6 +3020,22 @@ extern "C" { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ThunderBirdModel::HandleAudioPlaybackEnd: 启动10秒定时器,时间到就退出对话"); return; } + // 检查是否在THUNDERBIRD_LULLABYVIEW_3界面,且角色已经开始询问并询问完毕 + if (currentView == THUNDERBIRD_LULLABYVIEW && + currentSubView == ThunderBirdLullabyView::THUNDERBIRD_LULLABYVIEW_3 && + m_lullabyView3InquiryStarted) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ThunderBirdModel::HandleAudioPlaybackEnd: THUNDERBIRD_LULLABYVIEW_3界面,角色询问完毕,重新启动音频聊天"); + // 重置标志 + m_lullabyView3InquiryStarted = false; + int ret = ln_ws_start_audio_chat(LN_AUDIO_CHAT_CHOOSE_STORY_REQUEST); + if (ret == 0) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "THUNDERBIRD_LULLABYVIEW_3: 音频聊天已重新启动"); + } else { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "THUNDERBIRD_LULLABYVIEW_3: 启动音频聊天失败: %d", ret); + } + return; + } // 检查是否是故事模式且已finished // 注意:m_storyModeFinished在HandleStoryResponseFinished中已经通过了文本检查(不是"正在准备故事..."), @@ -3052,9 +3078,11 @@ extern "C" { // THUNDERBIRD_LULLABYVIEW_3: 故事选择界面(VAD已关闭) // THUNDERBIRD_LULLABYVIEW_4: 故事模式(VAD已关闭) if(currentView == THUNDERBIRD_LULLABYVIEW && - (currentSubView == ThunderBirdLullabyView::THUNDERBIRD_LULLABYVIEW_3 || - currentSubView == ThunderBirdLullabyView::THUNDERBIRD_LULLABYVIEW_4)) + currentSubView == ThunderBirdLullabyView::THUNDERBIRD_LULLABYVIEW_3) { + // isLullabyRecording = true; + ThunderBirdLullabyView::GetInstance()->listenAnimator->Start(); + ThunderBirdDialogueView::GetInstance()->listenIcon->SetVisible(true); WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ThunderBirdModel::HandleAudioRecordingStart: 在哄睡界面(故事模式),忽略录音开始事件"); return; } @@ -3098,10 +3126,11 @@ extern "C" { ThunderBirdDialogueView::GetInstance()->listenIcon->SetVisible(false); } else if (currentView == THUNDERBIRD_LULLABYVIEW && - currentSubView == ThunderBirdLullabyView::THUNDERBIRD_LULLABYVIEW_3 || - currentSubView == ThunderBirdLullabyView::THUNDERBIRD_LULLABYVIEW_4) { - // WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "录音结束,跳转到故事选择界面"); - // view->ChangeView(currentView, THUNDERBIRD_LULLABYVIEW, ThunderBirdLullabyView::THUNDERBIRD_LULLABYVIEW_4); + currentSubView == ThunderBirdLullabyView::THUNDERBIRD_LULLABYVIEW_3 ) { + ThunderBirdLullabyView::GetInstance()->listenAnimator->Stop(); + ThunderBirdDialogueView::GetInstance()->listenIcon->SetVisible(false); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "录音结束,跳转到故事界面"); + view->ChangeView(currentView, THUNDERBIRD_LULLABYVIEW, ThunderBirdLullabyView::THUNDERBIRD_LULLABYVIEW_4); return; } else{ 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 62fa00031..7121d9638 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 @@ -393,7 +393,7 @@ namespace OHOS if(currentView == THUNDERBIRD_LULLABYVIEW && currentSubView == ThunderBirdLullabyView::THUNDERBIRD_LULLABYVIEW_3) { - HandleLullabyFunction(currentView, currentSubView); + // HandleLullabyFunction(currentView, currentSubView); // ln_ws_start_audio_chat(LN_AUDIO_CHAT_CHOOSE_STORY_REQUEST); // ThunderBirdLullabyView::GetInstance()->listenAnimator->Start(); }