-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
621 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
name: "FAP: Build for multiple SDK sources" | ||
# This will build your app for dev and release channels on GitHub. | ||
# It will also build your app every day to make sure it's up to date with the latest SDK changes. | ||
# See https://github.com/marketplace/actions/build-flipper-application-package-fap for more information | ||
|
||
on: | ||
push: | ||
## put your main branch name under "branches" | ||
#branches: | ||
# - master | ||
pull_request: | ||
schedule: | ||
# do a build every day | ||
- cron: "1 1 * * *" | ||
|
||
jobs: | ||
ufbt-build: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
include: | ||
- name: dev channel | ||
sdk-channel: dev | ||
- name: release channel | ||
sdk-channel: release | ||
# You can add unofficial channels here. See ufbt action docs for more info. | ||
name: 'ufbt: Build for ${{ matrix.name }}' | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Build with ufbt | ||
uses: flipperdevices/flipperzero-ufbt-action@v0.1 | ||
id: build-app | ||
with: | ||
sdk-channel: ${{ matrix.sdk-channel }} | ||
- name: Upload app artifacts | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
# See ufbt action docs for other output variables | ||
name: ${{ github.event.repository.name }}-${{ steps.build-app.outputs.suffix }} | ||
path: ${{ steps.build-app.outputs.fap-artifacts }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
dist/* | ||
.vscode | ||
.clang-format | ||
.editorconfig | ||
.env | ||
.ufbt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
#pragma once | ||
|
||
#define EMPTY_ACTION_INDEX -1 | ||
|
||
struct Item; | ||
|
||
void action_tx(void* context, Item* item, FuriString* error); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
dist/* | ||
.vscode | ||
.clang-format | ||
.editorconfig | ||
.env | ||
.ufbt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
#include <furi.h> | ||
|
||
#include <gui/view_dispatcher.h> | ||
#include <gui/scene_manager.h> | ||
#include <gui/modules/text_input.h> | ||
|
||
#include "quac.h" | ||
#include "scenes.h" | ||
#include "scene_action_create_group.h" | ||
#include "../actions/action.h" | ||
|
||
#include <lib/toolbox/path.h> | ||
|
||
enum { | ||
SceneActionCreateGroupEvent, | ||
}; | ||
|
||
void scene_action_create_group_callback(void* context) { | ||
App* app = context; | ||
view_dispatcher_send_custom_event(app->view_dispatcher, SceneActionCreateGroupEvent); | ||
} | ||
|
||
void scene_action_create_group_on_enter(void* context) { | ||
App* app = context; | ||
TextInput* text = app->text_input; | ||
|
||
text_input_set_header_text(text, "Enter new group name:"); | ||
|
||
app->temp_cstr[0] = 0; | ||
text_input_set_result_callback( | ||
text, scene_action_create_group_callback, app, app->temp_cstr, MAX_NAME_LEN, false); | ||
|
||
// TextInputValidatorCallback | ||
// text_input_set_validator(text, validator_callback, context) | ||
|
||
view_dispatcher_switch_to_view(app->view_dispatcher, QView_ActionTextInput); | ||
} | ||
|
||
bool scene_action_create_group_on_event(void* context, SceneManagerEvent event) { | ||
App* app = context; | ||
bool consumed = false; | ||
if(event.type == SceneManagerEventTypeCustom) { | ||
if(event.event == SceneActionCreateGroupEvent) { | ||
// FURI_LOG_I(TAG, "Attempting to create group %s", app->temp_cstr); | ||
if(!strcmp(app->temp_cstr, "")) { | ||
return false; | ||
} | ||
Item* item = ItemArray_get(app->items_view->items, app->selected_item); | ||
FuriString* current_path = furi_string_alloc(); | ||
path_extract_dirname(furi_string_get_cstr(item->path), current_path); | ||
|
||
FuriString* new_group_path = furi_string_alloc(); | ||
furi_string_printf( | ||
new_group_path, "%s/%s", furi_string_get_cstr(current_path), app->temp_cstr); | ||
// FURI_LOG_I(TAG, "Full new path: %s", furi_string_get_cstr(new_group_path)); | ||
|
||
FS_Error fs_result = | ||
storage_common_mkdir(app->storage, furi_string_get_cstr(new_group_path)); | ||
if(fs_result == FSE_OK) { | ||
ItemsView* new_items = item_get_items_view_from_path(app, current_path); | ||
item_items_view_free(app->items_view); | ||
app->items_view = new_items; | ||
} else { | ||
FURI_LOG_E( | ||
TAG, "Create Group failed! %s", filesystem_api_error_get_desc(fs_result)); | ||
FuriString* error_msg = furi_string_alloc_printf( | ||
"Create Group failed!\nError: %s", filesystem_api_error_get_desc(fs_result)); | ||
dialog_message_show_storage_error(app->dialog, furi_string_get_cstr(error_msg)); | ||
furi_string_free(error_msg); | ||
} | ||
|
||
furi_string_free(current_path); | ||
furi_string_free(new_group_path); | ||
|
||
scene_manager_search_and_switch_to_previous_scene(app->scene_manager, QScene_Items); | ||
consumed = true; | ||
} | ||
} | ||
|
||
return consumed; | ||
} | ||
|
||
void scene_action_create_group_on_exit(void* context) { | ||
App* app = context; | ||
text_input_reset(app->text_input); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#pragma once | ||
|
||
#include <gui/scene_manager.h> | ||
|
||
// For each scene, implement handler callbacks | ||
void scene_action_create_group_on_enter(void* context); | ||
bool scene_action_create_group_on_event(void* context, SceneManagerEvent event); | ||
void scene_action_create_group_on_exit(void* context); |
Oops, something went wrong.