[FL-1543] Scene manager search scene API (#611)

* scene_manager: search -> search_and_switch_to previous_scene
* scene_manager: add search and switch to another scene API
* scene_manager: Navigation -> Back event
This commit is contained in:
gornekich
2021-07-28 17:52:00 +03:00
committed by GitHub
parent 1c58de24f5
commit 91c1eaf5a8
14 changed files with 116 additions and 37 deletions

View File

@@ -40,12 +40,13 @@ bool storage_settings_scene_unmounted_on_event(void* context, SceneManagerEvent
if(event.type == SceneManagerEventTypeCustom) {
switch(event.event) {
case DialogExResultLeft:
consumed =
scene_manager_search_previous_scene(app->scene_manager, StorageSettingsStart);
consumed = scene_manager_search_and_switch_to_previous_scene(
app->scene_manager, StorageSettingsStart);
break;
}
} else if(event.type == SceneManagerEventTypeNavigation) {
consumed = scene_manager_search_previous_scene(app->scene_manager, StorageSettingsStart);
} else if(event.type == SceneManagerEventTypeBack) {
consumed = scene_manager_search_and_switch_to_previous_scene(
app->scene_manager, StorageSettingsStart);
}
return consumed;

View File

@@ -60,12 +60,13 @@ bool storage_settings_scene_formatting_on_event(void* context, SceneManagerEvent
if(event.type == SceneManagerEventTypeCustom) {
switch(event.event) {
case DialogExResultLeft:
consumed =
scene_manager_search_previous_scene(app->scene_manager, StorageSettingsStart);
consumed = scene_manager_search_and_switch_to_previous_scene(
app->scene_manager, StorageSettingsStart);
break;
}
} else if(event.type == SceneManagerEventTypeNavigation) {
consumed = scene_manager_search_previous_scene(app->scene_manager, StorageSettingsStart);
} else if(event.type == SceneManagerEventTypeBack) {
consumed = scene_manager_search_and_switch_to_previous_scene(
app->scene_manager, StorageSettingsStart);
}
return consumed;

View File

@@ -6,10 +6,10 @@ static bool storage_settings_custom_event_callback(void* context, uint32_t event
return scene_manager_handle_custom_event(app->scene_manager, event);
}
static bool storage_settings_navigation_event_callback(void* context) {
static bool storage_settings_back_event_callback(void* context) {
furi_assert(context);
StorageSettings* app = context;
return scene_manager_handle_navigation_event(app->scene_manager);
return scene_manager_handle_back_event(app->scene_manager);
}
static StorageSettings* storage_settings_alloc() {
@@ -29,7 +29,7 @@ static StorageSettings* storage_settings_alloc() {
view_dispatcher_set_custom_event_callback(
app->view_dispatcher, storage_settings_custom_event_callback);
view_dispatcher_set_navigation_event_callback(
app->view_dispatcher, storage_settings_navigation_event_callback);
app->view_dispatcher, storage_settings_back_event_callback);
view_dispatcher_attach_to_gui(app->view_dispatcher, app->gui, ViewDispatcherTypeFullscreen);