#include "sleep/include/SleepModel.h"
#include "health/health_service/health_service.h"
#include "player/include/PlayersModelC.h"
- #include "system/include/SystemLogModelC.h"
-
- #include "bloodoxygen/include/BloodOxygenModel.h"
+#include "system/include/SystemLogModelC.h"
+
+#include "bloodoxygen/include/BloodOxygenModel.h"
#include "heartrate/include/HeartModel.h"
#include "saveele/include/SaveEleModel.h"
#include "respiratorytraining/include/RespiratoryTrainingModel.h"
static uint8_t goal_type=0;
void MsgCenterNotifystepProc(const Topic topic, Request* req)
{
- //unused(req);
+ (void)topic;
if (req->msgId == TOPIC_EVENT_STEPDATA_UPDATE)
{
return;
}
// 计步数据累加
-
OHOS::GoalModel::GetInstance().show_data_step_refresh();
OHOS::GoalModel::GetInstance().show_data_calories_refresh();
OHOS::GoalModel::GetInstance().show_data_distance_refresh();
{
GraphicService::GetInstance()->PostGraphicEvent(
std::bind(&OHOS::GoalView::GoalViewrefresh, OHOS::GoalView::GetInstance() ));
-
- // OHOS::GoalView::GetInstance()->GoalViewrefresh();
}
if(OHOS::GoalotherView::GetInstance())
{
- //OHOS::GoalotherView::GetInstance()->GoalViewrefresh();
GraphicService::GetInstance()->PostGraphicEvent(
std::bind(&OHOS::GoalotherView::GoalViewrefresh, OHOS::GoalotherView::GetInstance() ));
}
- if(OHOS::GoalModel::GetInstance().getstepvalue()>=100)
- {
+ /* 运动过程中不弹目标达成,避免打扰用户;使用 runtime 训练状态(0 未训练/结束,1 训练中) */
+ if (uapi_dev_runtime_get_train_status() != 0) {
+ return;
+ }
- goal_type=GOAL_STEP;
- if(get_Is_show_flag(goal_type))
- {
- if(OHOS::GoalModel::GetInstance().get_step_goal_show())
- {
- CustomEventPublish(TOPIC_EVENT_GOAL_SHOW_VIEW,(uint8_t *)&goal_type,1);
- }
+ /* 同时只弹一个:本轮只发布第一个达成的目标,顺序:步数 -> 距离 -> 燃脂 -> 站立 -> 卡路里 */
+ bool published = false;
+ if (!published && OHOS::GoalModel::GetInstance().getstepvalue() >= 100)
+ {
+ goal_type = GOAL_STEP;
+ if (get_Is_show_flag(goal_type) && OHOS::GoalModel::GetInstance().get_step_goal_show())
+ {
+ CustomEventPublish(TOPIC_EVENT_GOAL_SHOW_VIEW, (uint8_t *)&goal_type, 1);
+ published = true;
}
}
-
- if(OHOS::GoalModel::GetInstance().is_goal_DISTANCE_done())
+ if (!published && OHOS::GoalModel::GetInstance().is_goal_DISTANCE_done())
{
- goal_type=GOAL_DISTANCE;
- if(get_Is_show_flag(goal_type))
- {
- if(OHOS::GoalModel::GetInstance().get_other_goal_show())
- {
- CustomEventPublish(TOPIC_EVENT_GOAL_SHOW_VIEW,(uint8_t *)&goal_type,1);
- }
-
+ goal_type = GOAL_DISTANCE;
+ if (get_Is_show_flag(goal_type) && OHOS::GoalModel::GetInstance().get_other_goal_show())
+ {
+ CustomEventPublish(TOPIC_EVENT_GOAL_SHOW_VIEW, (uint8_t *)&goal_type, 1);
+ published = true;
}
}
-
- if(OHOS::GoalModel::GetInstance().is_goal_fatburning_done())
+ if (!published && OHOS::GoalModel::GetInstance().is_goal_fatburning_done())
{
- goal_type=GOAL_FAT;
- if(get_Is_show_flag(goal_type))
- {
- if(OHOS::GoalModel::GetInstance().get_other_goal_show())
- {
- CustomEventPublish(TOPIC_EVENT_GOAL_SHOW_VIEW,(uint8_t *)&goal_type,1);
- }
+ goal_type = GOAL_FAT;
+ if (get_Is_show_flag(goal_type) && OHOS::GoalModel::GetInstance().get_other_goal_show())
+ {
+ CustomEventPublish(TOPIC_EVENT_GOAL_SHOW_VIEW, (uint8_t *)&goal_type, 1);
+ published = true;
}
}
-
- if(OHOS::GoalModel::GetInstance().is_goal_stand_done())
+ if (!published && OHOS::GoalModel::GetInstance().is_goal_stand_done())
{
- goal_type=GOAL_STAND;
- if(get_Is_show_flag(goal_type))
- {
- if(OHOS::GoalModel::GetInstance().get_other_goal_show())
- {
- CustomEventPublish(TOPIC_EVENT_GOAL_SHOW_VIEW,(uint8_t *)&goal_type,1);
- }
+ goal_type = GOAL_STAND;
+ if (get_Is_show_flag(goal_type) && OHOS::GoalModel::GetInstance().get_other_goal_show())
+ {
+ CustomEventPublish(TOPIC_EVENT_GOAL_SHOW_VIEW, (uint8_t *)&goal_type, 1);
+ published = true;
}
}
-
- if(OHOS::GoalModel::GetInstance().is_goal_calories_done())
+ if (!published && OHOS::GoalModel::GetInstance().is_goal_calories_done())
{
- goal_type=GOAL_CALOREIE;
- if(get_Is_show_flag(goal_type))
- {
- if(OHOS::GoalModel::GetInstance().get_other_goal_show())
- {
- CustomEventPublish(TOPIC_EVENT_GOAL_SHOW_VIEW,(uint8_t *)&goal_type,1);
- }
+ goal_type = GOAL_CALOREIE;
+ if (get_Is_show_flag(goal_type) && OHOS::GoalModel::GetInstance().get_other_goal_show())
+ {
+ CustomEventPublish(TOPIC_EVENT_GOAL_SHOW_VIEW, (uint8_t *)&goal_type, 1);
+ published = true;
}
}
#endif
void MsgCenterNotifyGoalShowViewProc(const Topic topic, Request* req)
{
unused(req);
+ /* 同时只弹一个:若当前已在显示目标达成弹窗,则不再叠加 */
+ if (NotificationManager::GetInstance()->GetShowingNotifyId() == static_cast<uint16_t>(TOPIC_EVENT_GOAL_SHOW_VIEW))
+ {
+ return;
+ }
WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "MsgCenterNotifyGoalShowViewProc目标达成 !");
if (CheckPriority(topic))
{