Rpc: add desktop service. Desktop: refactor locking routine. (#2665)

* Rpc: add desktop service
* Protobuf: sync to latest release. Desktop: rewrite PIN locking, finalize locking API
* Desktop: cleanup code a little bit
This commit is contained in:
あく
2023-05-11 18:50:17 +09:00
committed by GitHub
parent 9862876f06
commit aa8a369e2a
22 changed files with 222 additions and 308 deletions

View File

@@ -12,7 +12,7 @@
#include "../animations/animation_manager.h"
#include "../views/desktop_events.h"
#include "../views/desktop_view_pin_input.h"
#include "../helpers/pin_lock.h"
#include "../helpers/pin.h"
#include "desktop_scene.h"
#include "desktop_scene_i.h"
@@ -54,9 +54,12 @@ static void desktop_scene_pin_input_back_callback(void* context) {
static void desktop_scene_pin_input_done_callback(const PinCode* pin_code, void* context) {
Desktop* desktop = (Desktop*)context;
if(desktop_pin_lock_verify(&desktop->settings.pin_code, pin_code)) {
if(desktop_pin_compare(&desktop->settings.pin_code, pin_code)) {
furi_hal_rtc_set_pin_fails(0);
view_dispatcher_send_custom_event(desktop->view_dispatcher, DesktopPinInputEventUnlocked);
} else {
uint32_t pin_fails = furi_hal_rtc_get_pin_fails();
furi_hal_rtc_set_pin_fails(pin_fails + 1);
view_dispatcher_send_custom_event(
desktop->view_dispatcher, DesktopPinInputEventUnlockFailed);
}
@@ -126,7 +129,6 @@ bool desktop_scene_pin_input_on_event(void* context, SceneManagerEvent event) {
consumed = true;
break;
case DesktopPinInputEventUnlocked:
desktop_pin_unlock(&desktop->settings);
desktop_unlock(desktop);
consumed = true;
break;