[settings] Removed auto usb reactivation

This commit is contained in:
Laury
2021-12-19 19:23:15 +01:00
parent fea588bd9d
commit 64a90422c4

View File

@@ -24,18 +24,8 @@ UsbInfoController::UsbInfoController(Responder *parentResponder):
bool UsbInfoController::handleEvent(Ion::Events::Event event) {
if ((Ion::Events::OK == event || Ion::Events::EXE == event || Ion::Events::Right == event) && selectedRow() == 0) {
if (!GlobalPreferences::sharedGlobalPreferences()->dfuUnlocked()) {
if (!GlobalPreferences::sharedGlobalPreferences()->isInExamMode()) {
Ion::LED::setColor(KDColorPurple);
Ion::LED::setBlinking(500, 0.5f);
}
GlobalPreferences::sharedGlobalPreferences()->setDfuUnlocked(true);
} else {
if (!GlobalPreferences::sharedGlobalPreferences()->isInExamMode()) {
Ion::LED::setColor(KDColorBlack);
}
GlobalPreferences::sharedGlobalPreferences()->setDfuUnlocked(false);
}
bool dfuWasUnlocked = GlobalPreferences::sharedGlobalPreferences()->dfuUnlocked();
GlobalPreferences::sharedGlobalPreferences()->setDfuUnlocked(!dfuWasUnlocked);
m_selectableTableView.reloadCellAtLocation(0, 0);
return true;
}
@@ -49,19 +39,6 @@ bool UsbInfoController::handleEvent(Ion::Events::Event event) {
return true;
}
// We cannot use things like willExitResponderChain because this view can disappear due to an USB connection,
// and in this case we must keep the DFU status.
if ((event != Ion::Events::USBPlug && event != Ion::Events::USBEnumeration) &&
GlobalPreferences::sharedGlobalPreferences()->dfuUnlocked()) {
GlobalPreferences::sharedGlobalPreferences()->setDfuUnlocked(false);
m_selectableTableView.reloadCellAtLocation(0, 0);
Container::activeApp()->displayWarning(I18n::Message::USBProtectionReactivated);
if (!GlobalPreferences::sharedGlobalPreferences()->isInExamMode()) {
Ion::LED::setColor(KDColorBlack);
}
return true;
}
return GenericSubController::handleEvent(event);
}