Skip to content

Commit 731d2c6

Browse files
committed
Address review comments
1 parent f92f990 commit 731d2c6

File tree

8 files changed

+23
-34
lines changed

8 files changed

+23
-34
lines changed

src/displayapp/DisplayApp.cpp

+6-12
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,12 @@ void DisplayApp::Refresh() {
278278
case Messages::Clock:
279279
LoadApp(Apps::Clock, DisplayApp::FullRefreshDirections::None);
280280
break;
281+
case Messages::ShowIgnoreTouchPopup:
282+
popupMessage.SetHidden(false);
283+
break;
284+
case Messages::HideIgnoreTouchPopup:
285+
popupMessage.SetHidden(true);
286+
break;
281287
}
282288
}
283289

@@ -540,15 +546,3 @@ void DisplayApp::ApplyBrightness() {
540546
}
541547
brightnessController.Set(brightness);
542548
}
543-
544-
Apps DisplayApp::GetCurrentApp() {
545-
return currentApp;
546-
}
547-
548-
void DisplayApp::HideIgnoreTouchPopup(bool hidden) {
549-
popupMessage.SetHidden(hidden);
550-
}
551-
552-
bool DisplayApp::IsIgnoreTouchPopupHidden() {
553-
return popupMessage.IsHidden();
554-
}

src/displayapp/DisplayApp.h

-5
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,6 @@ namespace Pinetime {
7474

7575
void Register(Pinetime::System::SystemTask* systemTask);
7676

77-
void HideIgnoreTouchPopup(bool hidden);
78-
bool IsIgnoreTouchPopupHidden();
79-
80-
Apps GetCurrentApp();
81-
8277
private:
8378
Pinetime::Drivers::St7789& lcd;
8479
Pinetime::Components::LittleVgl& lvgl;

src/displayapp/Messages.h

+3-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ namespace Pinetime {
2222
ShowPairingKey,
2323
AlarmTriggered,
2424
Clock,
25-
BleRadioEnableToggle
25+
BleRadioEnableToggle,
26+
ShowIgnoreTouchPopup,
27+
HideIgnoreTouchPopup
2628
};
2729
}
2830
}

src/displayapp/screens/settings/SettingWakeUp.cpp

-2
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,6 @@ SettingWakeUp::SettingWakeUp(Pinetime::Applications::DisplayApp* app, Pinetime::
8282
lv_checkbox_set_checked(cbOption[optionsTotal], true);
8383
}
8484
optionsTotal++;
85-
86-
8785
}
8886

8987
SettingWakeUp::~SettingWakeUp() {

src/displayapp/widgets/PopupMessage.cpp

+1-4
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,7 @@
33

44
using namespace Pinetime::Applications::Widgets;
55

6-
PopupMessage::PopupMessage(const char* msg)
7-
: message {msg},
8-
isHidden {true},
9-
btnPopup {nullptr} {
6+
PopupMessage::PopupMessage(const char* msg) : message {msg} {
107
}
118

129
void PopupMessage::Create() {

src/displayapp/widgets/PopupMessage.h

+3-2
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,16 @@ namespace Pinetime {
66
namespace Widgets {
77
class PopupMessage {
88
public:
9+
// The caller owns the message string, it is not copied.
910
PopupMessage(const char* msg);
1011
void Create();
1112
void SetHidden(bool hidden);
1213
bool IsHidden();
1314

1415
private:
1516
const char* message;
16-
lv_obj_t* btnPopup;
17-
bool isHidden;
17+
lv_obj_t* btnPopup = nullptr;
18+
bool isHidden = true;
1819
};
1920
}
2021
}

src/systemtask/SystemTask.cpp

+8-7
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,7 @@ SystemTask::SystemTask(Drivers::SpiMaster& spi,
102102
spiNorFlash,
103103
heartRateController,
104104
motionController,
105-
fs),
106-
wokenBy {WokenBy::Other},
107-
ignoreNextTouchEvent {false} {
105+
fs) {
108106
}
109107

110108
void SystemTask::Start() {
@@ -267,7 +265,8 @@ void SystemTask::Work() {
267265
break;
268266
}
269267
case Messages::GoToSleep:
270-
displayApp.HideIgnoreTouchPopup(true);
268+
ignoreTouchPopupHidden = true;
269+
displayApp.PushMessage(Pinetime::Applications::Display::Messages::HideIgnoreTouchPopup);
271270
if (doNotGoToSleep) {
272271
break;
273272
}
@@ -362,14 +361,16 @@ void SystemTask::Work() {
362361
// if we get to here TouchEvents is allowed and the "ButtonUnlocks" requirement can be overridden
363362
wokenBy = WokenBy::Other;
364363
} else {
365-
displayApp.HideIgnoreTouchPopup(false);
364+
ignoreTouchPopupHidden = false;
365+
displayApp.PushMessage(Pinetime::Applications::Display::Messages::ShowIgnoreTouchPopup);
366366
}
367367
break;
368368
case Messages::HandleButtonEvent: {
369369
// if the IgnoreTouchPopup is active the first button event unlocks the device
370-
if (!displayApp.IsIgnoreTouchPopupHidden()) {
370+
if (!ignoreTouchPopupHidden) {
371371
wokenBy = WokenBy::Button;
372-
displayApp.HideIgnoreTouchPopup(true);
372+
ignoreTouchPopupHidden = true;
373+
displayApp.PushMessage(Pinetime::Applications::Display::Messages::HideIgnoreTouchPopup);
373374
break;
374375
}
375376
Controllers::ButtonActions action;

src/systemtask/SystemTask.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,8 @@ namespace Pinetime {
133133
Pinetime::Controllers::NimbleController nimbleController;
134134

135135
WokenBy wokenBy;
136-
bool ignoreNextTouchEvent;
136+
bool ignoreNextTouchEvent = false;
137+
bool ignoreTouchPopupHidden = true;
137138

138139
static void Process(void* instance);
139140
void Work();

0 commit comments

Comments
 (0)