[apps/shared] Add discard confirmation on table intervals

Change-Id: Id152577c570febf06b4d829fd2723c2a30c3ccd9
This commit is contained in:
Hugo Saint-Vignes
2020-10-09 15:58:46 +02:00
committed by Émilie Feral
parent bd23135198
commit 150a5bfa5a
4 changed files with 18 additions and 1 deletions

View File

@@ -13,7 +13,12 @@ IntervalParameterController::IntervalParameterController(Responder * parentRespo
m_intervalCells{},
m_title(I18n::Message::IntervalSet),
m_startMessage(I18n::Message::XStart),
m_endMessage(I18n::Message::XEnd)
m_endMessage(I18n::Message::XEnd),
m_confirmPopUpController(Invocation([](void * context, void * sender) {
Container::activeApp()->dismissModalViewController();
((IntervalParameterController *)context)->stackController()->pop();
return true;
}, this))
{
for (int i = 0; i < k_totalNumberOfCell; i++) {
m_intervalCells[i].setParentResponder(&m_selectableTableView);
@@ -87,6 +92,11 @@ bool IntervalParameterController::handleEvent(Ion::Events::Event event) {
stackController()->pop();
return true;
}
if (event == Ion::Events::Back && !m_interval->hasSameParameters(*SharedTempIntervalParameters())) {
// Open pop-up to confirm discarding values
Container::activeApp()->displayModalViewController(&m_confirmPopUpController, 0.f, 0.f, Metric::ExamPopUpTopMargin, Metric::PopUpRightMargin, Metric::ExamPopUpBottomMargin, Metric::PopUpLeftMargin);
return true;
}
return false;
}