From 8068517808845a6a33facd2942e15d1591d98fa7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=CA=8E=CA=9Es=CA=8Co=CA=9E=E1=B4=89=C9=90=C9=A5=C9=94?= =?UTF-8?q?=EA=93=95=20=C9=B9=CA=87o=CA=8E=EA=93=92?= Date: Tue, 30 Jan 2024 13:58:40 +0800 Subject: [PATCH] add warn when enable stealth mode & add nav valid check (#1823) * add warn when enable stealth * change FLASH ERROR to FLASH ERR cuz previous one were overlapped with date * check if nav is valid --- firmware/application/ui_navigation.cpp | 15 +++++++++++++-- firmware/application/ui_navigation.hpp | 1 + 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/firmware/application/ui_navigation.cpp b/firmware/application/ui_navigation.cpp index d3ebe0e9..f6670674 100644 --- a/firmware/application/ui_navigation.cpp +++ b/firmware/application/ui_navigation.cpp @@ -315,8 +315,15 @@ SystemStatusView::SystemStatusView( refresh(); }; - toggle_stealth.on_change = [this](bool v) { + toggle_stealth.on_change = [this, &nav](bool v) { pmem::set_stealth_mode(v); + if (nav.is_valid() && v) { + nav.display_modal( + "Stealth", + "You just enabled stealth mode.\n" + "When you transmit,\n" + "screen will turn off;\n"); + } refresh(); }; @@ -553,7 +560,7 @@ InformationView::InformationView( #endif if (firmware_checksum_error()) { - version.set("FLASH ERROR"); + version.set("FLASH ERR"); version.set_style(&Styles::red); } @@ -585,6 +592,10 @@ bool NavigationView::is_top() const { return view_stack.size() == 1; } +bool NavigationView::is_valid() const { + return view_stack.size() != 0; // work around to check if nav is valid, not elegant i know. so TODO +} + View* NavigationView::push_view(std::unique_ptr new_view) { free_view(); diff --git a/firmware/application/ui_navigation.hpp b/firmware/application/ui_navigation.hpp index 4b20cc82..43c219c5 100644 --- a/firmware/application/ui_navigation.hpp +++ b/firmware/application/ui_navigation.hpp @@ -94,6 +94,7 @@ class NavigationView : public View { NavigationView& operator=(NavigationView&&) = delete; bool is_top() const; + bool is_valid() const; template T* push(Args&&... args) {