mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2025-10-21 08:49:29 +00:00
Centralize handling of modal error display.
This commit is contained in:
@@ -117,6 +117,10 @@ View* NavigationView::push_view(std::unique_ptr<View> new_view) {
|
||||
}
|
||||
|
||||
void NavigationView::pop() {
|
||||
if( view() == modal_view ) {
|
||||
modal_view = nullptr;
|
||||
}
|
||||
|
||||
// Can't pop last item from stack.
|
||||
if( view_stack.size() > 1 ) {
|
||||
free_view();
|
||||
@@ -127,6 +131,13 @@ void NavigationView::pop() {
|
||||
}
|
||||
}
|
||||
|
||||
void NavigationView::display_error(const std::string& message) {
|
||||
/* If a modal view is already visible, don't display another */
|
||||
if( !modal_view ) {
|
||||
modal_view = push<ModalMessageView>(message);
|
||||
}
|
||||
}
|
||||
|
||||
void NavigationView::free_view() {
|
||||
remove_child(view());
|
||||
}
|
||||
|
Reference in New Issue
Block a user