Skip to content

Commit

Permalink
Address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
tgc-dk committed Nov 7, 2022
1 parent f92f990 commit 731d2c6
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 34 deletions.
18 changes: 6 additions & 12 deletions src/displayapp/DisplayApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,12 @@ void DisplayApp::Refresh() {
case Messages::Clock:
LoadApp(Apps::Clock, DisplayApp::FullRefreshDirections::None);
break;
case Messages::ShowIgnoreTouchPopup:
popupMessage.SetHidden(false);
break;
case Messages::HideIgnoreTouchPopup:
popupMessage.SetHidden(true);
break;
}
}

Expand Down Expand Up @@ -540,15 +546,3 @@ void DisplayApp::ApplyBrightness() {
}
brightnessController.Set(brightness);
}

Apps DisplayApp::GetCurrentApp() {
return currentApp;
}

void DisplayApp::HideIgnoreTouchPopup(bool hidden) {
popupMessage.SetHidden(hidden);
}

bool DisplayApp::IsIgnoreTouchPopupHidden() {
return popupMessage.IsHidden();
}
5 changes: 0 additions & 5 deletions src/displayapp/DisplayApp.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,6 @@ namespace Pinetime {

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

void HideIgnoreTouchPopup(bool hidden);
bool IsIgnoreTouchPopupHidden();

Apps GetCurrentApp();

private:
Pinetime::Drivers::St7789& lcd;
Pinetime::Components::LittleVgl& lvgl;
Expand Down
4 changes: 3 additions & 1 deletion src/displayapp/Messages.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ namespace Pinetime {
ShowPairingKey,
AlarmTriggered,
Clock,
BleRadioEnableToggle
BleRadioEnableToggle,
ShowIgnoreTouchPopup,
HideIgnoreTouchPopup
};
}
}
Expand Down
2 changes: 0 additions & 2 deletions src/displayapp/screens/settings/SettingWakeUp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,6 @@ SettingWakeUp::SettingWakeUp(Pinetime::Applications::DisplayApp* app, Pinetime::
lv_checkbox_set_checked(cbOption[optionsTotal], true);
}
optionsTotal++;


}

SettingWakeUp::~SettingWakeUp() {
Expand Down
5 changes: 1 addition & 4 deletions src/displayapp/widgets/PopupMessage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@

using namespace Pinetime::Applications::Widgets;

PopupMessage::PopupMessage(const char* msg)
: message {msg},
isHidden {true},
btnPopup {nullptr} {
PopupMessage::PopupMessage(const char* msg) : message {msg} {
}

void PopupMessage::Create() {
Expand Down
5 changes: 3 additions & 2 deletions src/displayapp/widgets/PopupMessage.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,16 @@ namespace Pinetime {
namespace Widgets {
class PopupMessage {
public:
// The caller owns the message string, it is not copied.
PopupMessage(const char* msg);
void Create();
void SetHidden(bool hidden);
bool IsHidden();

private:
const char* message;
lv_obj_t* btnPopup;
bool isHidden;
lv_obj_t* btnPopup = nullptr;
bool isHidden = true;
};
}
}
Expand Down
15 changes: 8 additions & 7 deletions src/systemtask/SystemTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,7 @@ SystemTask::SystemTask(Drivers::SpiMaster& spi,
spiNorFlash,
heartRateController,
motionController,
fs),
wokenBy {WokenBy::Other},
ignoreNextTouchEvent {false} {
fs) {
}

void SystemTask::Start() {
Expand Down Expand Up @@ -267,7 +265,8 @@ void SystemTask::Work() {
break;
}
case Messages::GoToSleep:
displayApp.HideIgnoreTouchPopup(true);
ignoreTouchPopupHidden = true;
displayApp.PushMessage(Pinetime::Applications::Display::Messages::HideIgnoreTouchPopup);
if (doNotGoToSleep) {
break;
}
Expand Down Expand Up @@ -362,14 +361,16 @@ void SystemTask::Work() {
// if we get to here TouchEvents is allowed and the "ButtonUnlocks" requirement can be overridden
wokenBy = WokenBy::Other;
} else {
displayApp.HideIgnoreTouchPopup(false);
ignoreTouchPopupHidden = false;
displayApp.PushMessage(Pinetime::Applications::Display::Messages::ShowIgnoreTouchPopup);
}
break;
case Messages::HandleButtonEvent: {
// if the IgnoreTouchPopup is active the first button event unlocks the device
if (!displayApp.IsIgnoreTouchPopupHidden()) {
if (!ignoreTouchPopupHidden) {
wokenBy = WokenBy::Button;
displayApp.HideIgnoreTouchPopup(true);
ignoreTouchPopupHidden = true;
displayApp.PushMessage(Pinetime::Applications::Display::Messages::HideIgnoreTouchPopup);
break;
}
Controllers::ButtonActions action;
Expand Down
3 changes: 2 additions & 1 deletion src/systemtask/SystemTask.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,8 @@ namespace Pinetime {
Pinetime::Controllers::NimbleController nimbleController;

WokenBy wokenBy;
bool ignoreNextTouchEvent;
bool ignoreNextTouchEvent = false;
bool ignoreTouchPopupHidden = true;

static void Process(void* instance);
void Work();
Expand Down

0 comments on commit 731d2c6

Please sign in to comment.