From: xue <2144439972@qq.com> Date: Tue, 23 Jun 2026 10:01:55 +0000 (+0800) Subject: 修复未同意可以直接测量的bug X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=bf163936bfa2d65bcec83f8ed7d8e723a133c253;p=mirrors%2FFD230.git 修复未同意可以直接测量的bug --- diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/bloodpressure/include/BPHistoryView.h b/code/sdk/application/wearable/n9/nativeapp/nativeui/bloodpressure/include/BPHistoryView.h index b934ec2ed..09efc1c8b 100644 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/bloodpressure/include/BPHistoryView.h +++ b/code/sdk/application/wearable/n9/nativeapp/nativeui/bloodpressure/include/BPHistoryView.h @@ -27,6 +27,7 @@ public: void HideArrowWhileDragging(); void StartArrowAnimation(); void StopArrowAnimation(); + bool IsShowingHistoryScroll() const; private: UIViewGroup *CreateRecordPage(const struct BPRecord &record, size_t index); diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/bloodpressure/src/BPHistoryView.cpp b/code/sdk/application/wearable/n9/nativeapp/nativeui/bloodpressure/src/BPHistoryView.cpp index d30b66174..c84f860db 100644 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/bloodpressure/src/BPHistoryView.cpp +++ b/code/sdk/application/wearable/n9/nativeapp/nativeui/bloodpressure/src/BPHistoryView.cpp @@ -569,6 +569,8 @@ void BPHistoryView::ShowRecentPage() { } } +bool BPHistoryView::IsShowingHistoryScroll() const { return showingHistoryScroll_; } + void BPHistoryView::ShowHistoryScroll() { showingHistoryScroll_ = true; RebuildRecordPages(); diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/bloodpressure/src/BPMainPresenter.cpp b/code/sdk/application/wearable/n9/nativeapp/nativeui/bloodpressure/src/BPMainPresenter.cpp index 631a1ebb7..772bf2a60 100644 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/bloodpressure/src/BPMainPresenter.cpp +++ b/code/sdk/application/wearable/n9/nativeapp/nativeui/bloodpressure/src/BPMainPresenter.cpp @@ -32,6 +32,17 @@ namespace OHOS { static BPMainPresenter *g_pBPMainPresenter = nullptr; +static bool IsDisclaimerPending() { return BPModel::GetInstance()->IsFirstUse(); } + +static bool IsOnDisclaimerScreen(BPMainView *mainView) { + return mainView != nullptr && IsDisclaimerPending() && + mainView->GetCurrentViewId() == BP_ABNORMAL_VIEW; +} + +static void ShowDisclaimerScreen(BPMainView *mainView, int16_t hideView) { + mainView->ChangeView(hideView, BP_ABNORMAL_VIEW, BP_ABNORMAL_TYPE_DISCLAIMER); +} + REGIST_MENU_PRO(VIEW_BLOOD_PRESSURE, BPMainView, BPMainPresenter, PNG_APPLIST_BP_MESSURE_IMAGE_BIG, PNG_APPLIST_BP_MESSURE_IMAGE, PNG_APPLIST_BP_MESSURE_IMAGE, "血压", STR_BP_CHECK); @@ -107,6 +118,16 @@ bool BPMainPresenter::HandleSwipeBack() { if (current == BP_CALIB_STOP_VIEW) { return true; } + if (IsOnDisclaimerScreen(mainView)) { + NavigateBack(); + return true; + } + if (IsDisclaimerPending()) { + if (current == BP_ENTRY_VIEW || current == BP_HISTORY_VIEW) { + ShowDisclaimerScreen(mainView, current); + return true; + } + } if (current == BP_ENTRY_VIEW) { NavigateBack(); } else if (IsFlowSubPage(current)) { @@ -455,9 +476,11 @@ bool BPMainPresenter::OnDragEnd(UIView &view, const DragEvent &event) { HandleSwipeBack(); return true; } - if (current == BP_ENTRY_VIEW && direction == DragEvent::DIRECTION_RIGHT_TO_LEFT) { - mainView->ChangeView(BP_ENTRY_VIEW, BP_HISTORY_VIEW); - return true; + if (direction == DragEvent::DIRECTION_RIGHT_TO_LEFT) { + if (current == BP_ENTRY_VIEW && !IsDisclaimerPending()) { + mainView->ChangeView(BP_ENTRY_VIEW, BP_HISTORY_VIEW); + return true; + } } return false; } @@ -484,6 +507,9 @@ bool BPMainPresenter::BlockIfBatteryTooLow() { } void BPMainPresenter::StartMeasureFlow(BPMainView *mainView) { + if (IsDisclaimerPending()) { + return; + } if (BlockIfBatteryTooLow()) { return; } @@ -494,6 +520,9 @@ void BPMainPresenter::StartMeasureFlow(BPMainView *mainView) { /** 开始校准流程 */ void BPMainPresenter::StartCalibrationFlow(BPMainView *mainView, uint8_t round) { + if (IsDisclaimerPending()) { + return; + } if (BlockIfBatteryTooLow()) { return; } @@ -521,17 +550,25 @@ bool BPMainPresenter::OnClick(UIView &view, const ClickEvent &event) { return true; } if (viewId == BP_CLICK_HISTORY) { - mainView->ChangeView(BP_ENTRY_VIEW, BP_HISTORY_VIEW); + if (!IsDisclaimerPending()) { + mainView->ChangeView(BP_ENTRY_VIEW, BP_HISTORY_VIEW); + } return true; } if (viewId == BP_CLICK_HISTORY_BACK) { - mainView->ChangeView(BP_HISTORY_VIEW, BP_ENTRY_VIEW); + if (IsDisclaimerPending()) { + ShowDisclaimerScreen(mainView, BP_HISTORY_VIEW); + } else { + mainView->ChangeView(BP_HISTORY_VIEW, BP_ENTRY_VIEW); + } return true; } if (viewId == BP_CLICK_VIEW_HISTORY) { - BPHistoryView *historyView = BPHistoryView::GetInstance(); - if (historyView != nullptr) { - historyView->ShowHistoryScroll(); + if (!IsDisclaimerPending()) { + BPHistoryView *historyView = BPHistoryView::GetInstance(); + if (historyView != nullptr) { + historyView->ShowHistoryScroll(); + } } return true; } @@ -663,6 +700,9 @@ bool BPMainPresenter::OnClick(UIView &view, const ClickEvent &event) { } if (viewId == BP_CLICK_MEASURE) { + if (IsDisclaimerPending()) { + return true; + } if (current == BP_INSTRUCTION_VIEW) { auto instructionType = static_cast(mainView->GetInstructionSubType()); diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/ecg/src/ECGMainPresenter.cpp b/code/sdk/application/wearable/n9/nativeapp/nativeui/ecg/src/ECGMainPresenter.cpp index dadb16495..730467381 100644 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/ecg/src/ECGMainPresenter.cpp +++ b/code/sdk/application/wearable/n9/nativeapp/nativeui/ecg/src/ECGMainPresenter.cpp @@ -26,6 +26,18 @@ static ECGMainPresenter *g_pECGMainPresenter = nullptr; static osTimerId_t g_ecgMeasureTimer = nullptr; static osTimerId_t g_ecgContactGoodTimer = nullptr; +static bool IsDisclaimerPending() { return ECGModel::GetInstance()->IsFirstUse(); } + +static bool IsOnDisclaimerScreen(ECGMainView *mainView) { + return mainView != nullptr && IsDisclaimerPending() && + mainView->GetCurrentViewId() == ECG_INSTRUCTION_VIEW && + mainView->GetInstructionSubType() == ECG_INSTRUCTION_TYPE_DISCLAIMER; +} + +static void ShowDisclaimerScreen(ECGMainView *mainView, int16_t hideView) { + mainView->ChangeView(hideView, ECG_INSTRUCTION_VIEW, ECG_INSTRUCTION_TYPE_DISCLAIMER); +} + REGIST_MENU_PRO(VIEW_ECG, ECGMainView, ECGMainPresenter, PNG_APPLIST_ECG_IMAGE_BIG, PNG_APPLIST_ECG_IMAGE, PNG_APPLIST_ECG_IMAGE, "心电", STR_ECG); @@ -147,6 +159,16 @@ bool ECGMainPresenter::HandleSwipeBack() { (current == ECG_MEASURING_VIEW || current == ECG_INSTRUCTION_VIEW)) { StopMeasureTimer(); } + if (IsOnDisclaimerScreen(mainView)) { + NavigateBack(); + return true; + } + if (IsDisclaimerPending()) { + if (current == ECG_ENTRY_VIEW || current == ECG_HISTORY_VIEW) { + ShowDisclaimerScreen(mainView, current); + return true; + } + } if (current == ECG_ENTRY_VIEW) { NavigateBack(); } else if (current == ECG_HISTORY_VIEW) { @@ -345,6 +367,9 @@ void ECGMainPresenter::OnMeasureTimerTick() { //开始测量流程 void ECGMainPresenter::StartMeasureFlow(ECGMainView *mainView) { + if (IsDisclaimerPending()) { + return; + } if (BlockIfBatteryTooLow()) { return; } @@ -430,9 +455,11 @@ bool ECGMainPresenter::OnDragEnd(UIView &view, const DragEvent &event) { HandleSwipeBack(); return true; } - if (current == ECG_ENTRY_VIEW && direction == DragEvent::DIRECTION_RIGHT_TO_LEFT) { - mainView->ChangeView(ECG_ENTRY_VIEW, ECG_HISTORY_VIEW); - return true; + if (direction == DragEvent::DIRECTION_RIGHT_TO_LEFT) { + if (current == ECG_ENTRY_VIEW && !IsDisclaimerPending()) { + mainView->ChangeView(ECG_ENTRY_VIEW, ECG_HISTORY_VIEW); + return true; + } } return false; } @@ -449,17 +476,25 @@ bool ECGMainPresenter::OnClick(UIView &view, const ClickEvent &event) { int16_t current = mainView->GetCurrentViewId(); if (viewId == ECG_CLICK_HISTORY) { - mainView->ChangeView(ECG_ENTRY_VIEW, ECG_HISTORY_VIEW); + if (!IsDisclaimerPending()) { + mainView->ChangeView(ECG_ENTRY_VIEW, ECG_HISTORY_VIEW); + } return true; } if (viewId == ECG_CLICK_HISTORY_BACK) { - mainView->ChangeView(ECG_HISTORY_VIEW, ECG_ENTRY_VIEW); + if (IsDisclaimerPending()) { + ShowDisclaimerScreen(mainView, ECG_HISTORY_VIEW); + } else { + mainView->ChangeView(ECG_HISTORY_VIEW, ECG_ENTRY_VIEW); + } return true; } if (viewId == ECG_CLICK_VIEW_ALL) { - ECGHistoryView *historyView = ECGHistoryView::GetInstance(); - if (historyView != nullptr) { - historyView->ShowListPage(); + if (!IsDisclaimerPending()) { + ECGHistoryView *historyView = ECGHistoryView::GetInstance(); + if (historyView != nullptr) { + historyView->ShowListPage(); + } } return true; }