mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-18 21:30:38 +01:00
[apps] Handle Ion::Events::USBPlug in processEvent
This gives apps a chance to catch this event. This is used in the hardware test.
This commit is contained in:
@@ -86,19 +86,7 @@ bool AppsContainer::dispatchEvent(Ion::Events::Event event) {
|
||||
|
||||
bool didProcessEvent = false;
|
||||
|
||||
if (event == Ion::Events::USBPlug) {
|
||||
if (Ion::USB::isPlugged()) {
|
||||
if (GlobalPreferences::sharedGlobalPreferences()->examMode() == GlobalPreferences::ExamMode::Activate) {
|
||||
displayExamModePopUp(false);
|
||||
} else {
|
||||
Ion::USB::enable();
|
||||
}
|
||||
Ion::Backlight::setBrightness(Ion::Backlight::MaxBrightness);
|
||||
} else {
|
||||
Ion::USB::disable();
|
||||
}
|
||||
didProcessEvent = true;
|
||||
} else if (event == Ion::Events::USBEnumeration) {
|
||||
if (event == Ion::Events::USBEnumeration) {
|
||||
if (Ion::USB::isPlugged()) {
|
||||
App::Snapshot * activeSnapshot = (activeApp() == nullptr ? appSnapshotAtIndex(0) : activeApp()->snapshot());
|
||||
switchTo(usbConnectedAppSnapshot());
|
||||
@@ -132,6 +120,19 @@ bool AppsContainer::dispatchEvent(Ion::Events::Event event) {
|
||||
}
|
||||
|
||||
bool AppsContainer::processEvent(Ion::Events::Event event) {
|
||||
if (event == Ion::Events::USBPlug) {
|
||||
if (Ion::USB::isPlugged()) {
|
||||
if (GlobalPreferences::sharedGlobalPreferences()->examMode() == GlobalPreferences::ExamMode::Activate) {
|
||||
displayExamModePopUp(false);
|
||||
} else {
|
||||
Ion::USB::enable();
|
||||
}
|
||||
Ion::Backlight::setBrightness(Ion::Backlight::MaxBrightness);
|
||||
} else {
|
||||
Ion::USB::disable();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (event == Ion::Events::Home || event == Ion::Events::Back) {
|
||||
switchTo(appSnapshotAtIndex(0));
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user