From 64a90422c40173476386e6a570a8aab7e94da7f9 Mon Sep 17 00:00:00 2001 From: Laury Date: Sun, 19 Dec 2021 19:23:15 +0100 Subject: [PATCH] [settings] Removed auto usb reactivation --- .../sub_menu/usb_protection_controller.cpp | 27 ++----------------- 1 file changed, 2 insertions(+), 25 deletions(-) diff --git a/apps/settings/sub_menu/usb_protection_controller.cpp b/apps/settings/sub_menu/usb_protection_controller.cpp index 07eddc743..734cf95fa 100644 --- a/apps/settings/sub_menu/usb_protection_controller.cpp +++ b/apps/settings/sub_menu/usb_protection_controller.cpp @@ -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); }