mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-05-14 05:48:35 -07:00
Add run_with_default_app(), run files in right app
This commit is contained in:
@@ -19,6 +19,8 @@ void favorite_timeout_callback(void* _ctx);
|
|||||||
|
|
||||||
void favorite_timeout_run(ViewDispatcher* view_dispatcher, SceneManager* scene_manager);
|
void favorite_timeout_run(ViewDispatcher* view_dispatcher, SceneManager* scene_manager);
|
||||||
|
|
||||||
|
void run_with_default_app(const char* path);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
#include "../helpers/archive_apps.h"
|
#include "../helpers/archive_apps.h"
|
||||||
#include "../helpers/archive_favorites.h"
|
#include "../helpers/archive_favorites.h"
|
||||||
#include "../helpers/archive_browser.h"
|
#include "../helpers/archive_browser.h"
|
||||||
|
#include "../helpers/archive_helpers_ext.h"
|
||||||
#include "../views/archive_browser_view.h"
|
#include "../views/archive_browser_view.h"
|
||||||
#include "archive/scenes/archive_scene.h"
|
#include "archive/scenes/archive_scene.h"
|
||||||
|
|
||||||
@@ -116,6 +117,26 @@ static void
|
|||||||
furi_record_close(RECORD_LOADER);
|
furi_record_close(RECORD_LOADER);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Hijack existing archive code for default app choosing without needing archive running
|
||||||
|
void run_with_default_app(const char* path) {
|
||||||
|
// Kostily
|
||||||
|
FileInfo info;
|
||||||
|
Storage* storage = furi_record_open(RECORD_STORAGE);
|
||||||
|
bool is_dir = storage_common_stat(storage, path, &info) == FSE_OK &&
|
||||||
|
info.flags & FSF_DIRECTORY;
|
||||||
|
furi_record_close(RECORD_STORAGE);
|
||||||
|
|
||||||
|
// Velosipedy
|
||||||
|
ArchiveFile_t item;
|
||||||
|
ArchiveFile_t_init(&item);
|
||||||
|
furi_string_set(item.path, path);
|
||||||
|
archive_set_file_type(&item, path, is_dir, false);
|
||||||
|
|
||||||
|
// Bydlo kod go brrr
|
||||||
|
archive_run_in_app(NULL, &item, false);
|
||||||
|
ArchiveFile_t_clear(&item);
|
||||||
|
}
|
||||||
|
|
||||||
void archive_scene_browser_callback(ArchiveBrowserEvent event, void* context) {
|
void archive_scene_browser_callback(ArchiveBrowserEvent event, void* context) {
|
||||||
ArchiveApp* archive = (ArchiveApp*)context;
|
ArchiveApp* archive = (ArchiveApp*)context;
|
||||||
view_dispatcher_send_custom_event(archive->view_dispatcher, event);
|
view_dispatcher_send_custom_event(archive->view_dispatcher, event);
|
||||||
|
|||||||
@@ -2578,6 +2578,7 @@ Function,+,rpc_system_app_set_data_exchange_callback,void,"RpcAppSystem*, RpcApp
|
|||||||
Function,+,rpc_system_app_set_error_code,void,"RpcAppSystem*, uint32_t"
|
Function,+,rpc_system_app_set_error_code,void,"RpcAppSystem*, uint32_t"
|
||||||
Function,+,rpc_system_app_set_error_text,void,"RpcAppSystem*, const char*"
|
Function,+,rpc_system_app_set_error_text,void,"RpcAppSystem*, const char*"
|
||||||
Function,-,rpmatch,int,const char*
|
Function,-,rpmatch,int,const char*
|
||||||
|
Function,-,run_with_default_app,void,const char*
|
||||||
Function,+,saved_struct_get_payload_size,_Bool,"const char*, uint8_t, uint8_t, size_t*"
|
Function,+,saved_struct_get_payload_size,_Bool,"const char*, uint8_t, uint8_t, size_t*"
|
||||||
Function,+,saved_struct_load,_Bool,"const char*, void*, size_t, uint8_t, uint8_t"
|
Function,+,saved_struct_load,_Bool,"const char*, void*, size_t, uint8_t, uint8_t"
|
||||||
Function,+,saved_struct_save,_Bool,"const char*, void*, size_t, uint8_t, uint8_t"
|
Function,+,saved_struct_save,_Bool,"const char*, void*, size_t, uint8_t, uint8_t"
|
||||||
|
|||||||
|
Reference in New Issue
Block a user