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);
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)) {
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;
}
}
void BPMainPresenter::StartMeasureFlow(BPMainView *mainView) {
+ if (IsDisclaimerPending()) {
+ return;
+ }
if (BlockIfBatteryTooLow()) {
return;
}
/** 开始校准流程 */
void BPMainPresenter::StartCalibrationFlow(BPMainView *mainView, uint8_t round) {
+ if (IsDisclaimerPending()) {
+ return;
+ }
if (BlockIfBatteryTooLow()) {
return;
}
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;
}
}
if (viewId == BP_CLICK_MEASURE) {
+ if (IsDisclaimerPending()) {
+ return true;
+ }
if (current == BP_INSTRUCTION_VIEW) {
auto instructionType =
static_cast<BPInstructionType>(mainView->GetInstructionSubType());
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);
(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) {
//开始测量流程
void ECGMainPresenter::StartMeasureFlow(ECGMainView *mainView) {
+ if (IsDisclaimerPending()) {
+ return;
+ }
if (BlockIfBatteryTooLow()) {
return;
}
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;
}
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;
}