Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Archive: Favorite .mag files #110

Merged
merged 5 commits into from
Apr 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions applications/main/archive/helpers/archive_browser.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ static const char* tab_default_paths[] = {
};

static const char* known_ext[] = {
// clang-format off
[ArchiveFileTypeIButton] = ".ibtn",
[ArchiveFileTypeNFC] = ".nfc",
[ArchiveFileTypeSubGhz] = ".sub",
Expand All @@ -34,6 +35,7 @@ static const char* known_ext[] = {
[ArchiveFileTypeInfraredRemote] = ".txt",
[ArchiveFileTypeBadKb] = ".txt",
[ArchiveFileTypeWAV] = ".wav",
[ArchiveFileTypeMag] = ".mag",
[ArchiveFileTypeU2f] = "?",
[ArchiveFileTypeApplication] = ".fap",
[ArchiveFileTypeJS] = ".js",
Expand All @@ -43,6 +45,7 @@ static const char* known_ext[] = {
[ArchiveFileTypeFolder] = "?",
[ArchiveFileTypeUnknown] = "*",
[ArchiveFileTypeAppOrJs] = ".fap|.js",
// clang-format on
};

static const ArchiveFileTypeEnum known_type[] = {
Expand Down
1 change: 1 addition & 0 deletions applications/main/archive/helpers/archive_files.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ typedef enum {
ArchiveFileTypeInfraredRemote,
ArchiveFileTypeBadKb,
ArchiveFileTypeWAV,
ArchiveFileTypeMag,
ArchiveFileTypeU2f,
ArchiveFileTypeApplication,
ArchiveFileTypeJS,
Expand Down
2 changes: 2 additions & 0 deletions applications/main/archive/scenes/archive_scene_browser.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ const char* archive_get_flipper_app_name(ArchiveFileTypeEnum file_type) {
return "Bad KB";
case ArchiveFileTypeWAV:
return EXT_PATH("apps/Media/wav_player.fap");
case ArchiveFileTypeMag:
return EXT_PATH("apps/GPIO/magspoof.fap");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also reminds me about the wav player, for the previous files we added support for, we moved the applications to the firmware repository. The idea was that if one day we were to make a build without apps included, these that have file associations would be included anyway. But now I'm not so sure, on both of these things. I'm not sure if we'd actually ever have a build without apps, sounds like unnecessary complexity and confusion, and would need some rework of the webupdater. And even if we do decide to do that, I'm not sure that including the apps regardless just because they have file associations, would make sense. Could just be that if you did install one without apps, then it would give an error for the app missing...

Nothing to change here, just a discussion we'll have to go over with the team

Copy link
Contributor Author

@zacharyweiss zacharyweiss Apr 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, I wonder if we could do something clever like implement an optional ArchiveSupportedFaps interface, like NFC does with NfcSupportedCardsPlugin, where one can populate the relevant stuct fields (just file icon and fap path?) and then the list gets auto-built onload of the archive. Probably out of scope, but would eliminate maintenance edits like this, and handle the above edge case you're mentioning nicely. Would leave it up to FAP authors to implement or not, and I don't think it'd cause conflicts across FWs (or if so, easy enough to just wrap in an ifdef like the other FW-specific features)

case ArchiveFileTypeU2f:
return "U2F";
case ArchiveFileTypeUpdateManifest:
Expand Down
1 change: 1 addition & 0 deletions applications/main/archive/views/archive_browser_view.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ static const Icon* ArchiveItemIcons[] = {
[ArchiveFileTypeInfraredRemote] = &I_ir_scope_10px,
[ArchiveFileTypeBadKb] = &I_badkb_10px,
[ArchiveFileTypeWAV] = &I_music_10px,
[ArchiveFileTypeMag] = &I_mag_card_10px,
[ArchiveFileTypeU2f] = &I_u2f_10px,
[ArchiveFileTypeApplication] = &I_Apps_10px,
[ArchiveFileTypeJS] = &I_js_script_10px,
Expand Down
Binary file added assets/icons/Archive/mag_card_10px.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions targets/f7/api_symbols.csv
Original file line number Diff line number Diff line change
Expand Up @@ -3940,6 +3940,7 @@ Variable,+,I_ir_scope_10px,Icon,
Variable,+,I_js_script_10px,Icon,
Variable,+,I_keyboard_10px,Icon,
Variable,+,I_loading_10px,Icon,
Variable,+,I_mag_card_10px,Icon,
Variable,+,I_max_24x23,Icon,
Variable,+,I_max_hover_24x23,Icon,
Variable,+,I_menu_text_20x5,Icon,
Expand Down
Loading