Change back button exit to short press (or stop transmission if one active. Brings behaviour into lie with other apps.

This commit is contained in:
Leeroy
2023-10-24 10:08:08 +11:00
parent 73baec5230
commit 1562e031c3

View File

@@ -201,21 +201,30 @@ bool subrem_view_remote_input(InputEvent* event, void* context) {
furi_assert(context); furi_assert(context);
SubRemViewRemote* subrem_view_remote = context; SubRemViewRemote* subrem_view_remote = context;
if(event->key == InputKeyBack && event->type == InputTypeLong) { if(event->key == InputKeyBack && event->type == InputTypePress) {
subrem_view_remote->callback(SubRemCustomEventViewRemoteBack, subrem_view_remote->context); bool is_stopping = false;
return true;
} else if(event->key == InputKeyBack && event->type == InputTypeShort) {
with_view_model( with_view_model(
subrem_view_remote->view, subrem_view_remote->view,
SubRemViewRemoteModel * model, SubRemViewRemoteModel * model,
{ model->pressed_btn = 0; }, {
if(model->state == SubRemViewRemoteStateSending) {
is_stopping = true;
model->pressed_btn = 0;
}
},
true); true);
subrem_view_remote->callback(
SubRemCustomEventViewRemoteForcedStop, subrem_view_remote->context); //Cant send exit the app inside that with_model,locks the model and the app will hang and not unload!
return true; if(is_stopping)
} else if(event->key == InputKeyBack) { subrem_view_remote->callback(
SubRemCustomEventViewRemoteForcedStop, subrem_view_remote->context);
else
subrem_view_remote->callback(
SubRemCustomEventViewRemoteBack, subrem_view_remote->context);
return true; return true;
} }
// BACK button processing end // BACK button processing end
if(event->key == InputKeyUp && event->type == InputTypePress) { if(event->key == InputKeyUp && event->type == InputTypePress) {