Skip to content

Commit

Permalink
Implemented #203 (#204)
Browse files Browse the repository at this point in the history
* Initial changes on #203

* Fixiing builds

* Dropped auto-gen file

* Fixing build

* Cleaning up sonar build

* Few more

* Trying another approach

* Fixing ufbt-fm

* Few more

* One more

* Dropped useless stuff

* Removed unpublished `fal_embedded=True` as it is not yet available

* CLang format changes

* Updated .editorconfig for .json files

---------

Co-authored-by: akopachov <akopachov@users.noreply.github.com>
  • Loading branch information
akopachov and akopachov committed Sep 20, 2023
1 parent e8c5187 commit 54fe1db
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 60 deletions.
54 changes: 18 additions & 36 deletions application.fam
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,7 @@ App(
apptype=FlipperAppType.EXTERNAL,
entry_point="totp_app",
cdefines=["APP_TOTP"],
requires=[
"gui",
"cli",
"dialogs",
"storage",
"input",
"notification",
"bt"
],
requires=["gui", "cli", "dialogs", "storage", "input", "notification", "bt"],
stack_size=2 * 1024,
order=20,
fap_version="5.00",
Expand Down Expand Up @@ -47,11 +39,11 @@ App(
"wolfcrypt/src/hash.c",
"wolfcrypt/src/sha.c",
"wolfcrypt/src/sha256.c",
"wolfcrypt/src/sha512.c"
"wolfcrypt/src/sha512.c",
],
cflags=["-Wno-error"],
cdefines=["HAVE_CONFIG_H"],
cincludes=["config/wolfssl"]
cincludes=["config/wolfssl"],
),
],
)
Expand All @@ -61,9 +53,7 @@ App(
apptype=FlipperAppType.PLUGIN,
entry_point="totp_cli_timezone_plugin_ep",
requires=["totp"],
sources=[
"cli/plugins/timezone/timezone.c",
"cli/cli_shared_methods.c"],
sources=["cli/plugins/timezone/timezone.c", "cli/cli_shared_methods.c"],
)

App(
Expand Down Expand Up @@ -91,7 +81,8 @@ App(
"cli/plugins/list/list.c",
"cli/cli_shared_methods.c",
"cli/plugins/list/formatters/table/list_output_formatter_table.c",
"cli/plugins/list/formatters/tsv/list_output_formatter_tsv.c"],
"cli/plugins/list/formatters/tsv/list_output_formatter_tsv.c",
],
)

App(
Expand All @@ -103,7 +94,8 @@ App(
"cli/plugins/details/details.c",
"cli/cli_shared_methods.c",
"cli/plugins/details/formatters/table/details_output_formatter_table.c",
"cli/plugins/details/formatters/tsv/details_output_formatter_tsv.c"],
"cli/plugins/details/formatters/tsv/details_output_formatter_tsv.c",
],
)

App(
Expand All @@ -114,7 +106,8 @@ App(
sources=[
"cli/plugins/modify/add/add.c",
"cli/plugins/modify/common.c",
"cli/cli_shared_methods.c"],
"cli/cli_shared_methods.c",
],
)

App(
Expand All @@ -125,65 +118,54 @@ App(
sources=[
"cli/plugins/modify/update/update.c",
"cli/plugins/modify/common.c",
"cli/cli_shared_methods.c"],
"cli/cli_shared_methods.c",
],
)

App(
appid="totp_cli_delete_plugin",
apptype=FlipperAppType.PLUGIN,
entry_point="totp_cli_delete_plugin_ep",
requires=["totp"],
sources=[
"cli/plugins/delete/delete.c",
"cli/cli_shared_methods.c"],
sources=["cli/plugins/delete/delete.c", "cli/cli_shared_methods.c"],
)

App(
appid="totp_cli_move_plugin",
apptype=FlipperAppType.PLUGIN,
entry_point="totp_cli_move_plugin_ep",
requires=["totp"],
sources=[
"cli/plugins/move/move.c",
"cli/cli_shared_methods.c"],
sources=["cli/plugins/move/move.c", "cli/cli_shared_methods.c"],
)

App(
appid="totp_cli_reset_plugin",
apptype=FlipperAppType.PLUGIN,
entry_point="totp_cli_reset_plugin_ep",
requires=["totp"],
sources=[
"cli/plugins/reset/reset.c",
"cli/cli_shared_methods.c"],
sources=["cli/plugins/reset/reset.c", "cli/cli_shared_methods.c"],
)

App(
appid="totp_cli_pin_plugin",
apptype=FlipperAppType.PLUGIN,
entry_point="totp_cli_pin_plugin_ep",
requires=["totp"],
sources=[
"cli/plugins/pin/pin.c",
"cli/cli_shared_methods.c"],
sources=["cli/plugins/pin/pin.c", "cli/cli_shared_methods.c"],
)

App(
appid="totp_cli_automation_plugin",
apptype=FlipperAppType.PLUGIN,
entry_point="totp_cli_automation_plugin_ep",
requires=["totp"],
sources=[
"cli/plugins/automation/automation.c",
"cli/cli_shared_methods.c"],
sources=["cli/plugins/automation/automation.c", "cli/cli_shared_methods.c"],
)

App(
appid="totp_cli_notification_plugin",
apptype=FlipperAppType.PLUGIN,
entry_point="totp_cli_notification_plugin_ep",
requires=["totp"],
sources=[
"cli/plugins/notification/notification.c",
"cli/cli_shared_methods.c"],
sources=["cli/plugins/notification/notification.c", "cli/cli_shared_methods.c"],
)
44 changes: 22 additions & 22 deletions config/app/config.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,25 @@
// List of compatible firmwares
#define TOTP_FIRMWARE_OFFICIAL_STABLE (1)
#define TOTP_FIRMWARE_OFFICIAL_DEV (2)
#define TOTP_FIRMWARE_XTREME_UL (3)
// End of list

#if __has_include("ufbt_def.h")
#include "ufbt_def.h"
#endif

#ifndef TOTP_TARGET_FIRMWARE
#if defined(TARGET_FIRMWARE_OFFICIAL) || defined(FW_ORIGIN_Official)
#define TOTP_TARGET_FIRMWARE TOTP_FIRMWARE_OFFICIAL_STABLE
#elif defined(TARGET_FIRMWARE_UNLEASHED) || defined(FW_ORIGIN_Unleashed)
#define TOTP_TARGET_FIRMWARE TOTP_FIRMWARE_XTREME_UL
#elif defined(TARGET_FIRMWARE_XTREME) || defined(FW_ORIGIN_Xtreme)
#define TOTP_TARGET_FIRMWARE TOTP_FIRMWARE_XTREME_UL
#else
#define TOTP_TARGET_FIRMWARE TOTP_FIRMWARE_OFFICIAL_STABLE
#endif
#endif

// Application automatic lock timeout if user IDLE. (ticks)
#ifndef TOTP_AUTO_LOCK_IDLE_TIMEOUT_SEC
#define TOTP_AUTO_LOCK_IDLE_TIMEOUT_SEC (60)
Expand All @@ -21,25 +43,3 @@
#ifndef TOTP_UI_NO_ADD_NEW_TOKEN
#define TOTP_UI_ADD_NEW_TOKEN_ENABLED
#endif

// List of compatible firmwares
#define TOTP_FIRMWARE_OFFICIAL_STABLE (1)
#define TOTP_FIRMWARE_OFFICIAL_DEV (2)
#define TOTP_FIRMWARE_XTREME_UL (3)
// End of list

// Checking FlipC.org definitions (https://github.com/playmean/fap-list/issues/9)
#if defined(TARGET_FIRMWARE_OFFICIAL)
#define TOTP_TARGET_FIRMWARE TOTP_FIRMWARE_OFFICIAL_STABLE
#elif defined(TARGET_FIRMWARE_UNLEASHED)
#define TOTP_TARGET_FIRMWARE TOTP_FIRMWARE_XTREME_UL
#elif defined(TARGET_FIRMWARE_XTREME)
#define TOTP_TARGET_FIRMWARE TOTP_FIRMWARE_XTREME_UL
#endif
// End of FlipC.org definition checks

// If target firmware is not yet set, default it to OFW because there is no chance to force Flipper Devices to update their build pipelines :angry:.
// I'm still using Xtreme firmware, it is still the best one and I highly recommend it to everybody.
#ifndef TOTP_TARGET_FIRMWARE
#define TOTP_TARGET_FIRMWARE TOTP_FIRMWARE_OFFICIAL_STABLE
#endif
4 changes: 2 additions & 2 deletions totp_app.c
Original file line number Diff line number Diff line change
Expand Up @@ -230,14 +230,14 @@ int32_t totp_app() {
return 254;
}

TotpCliContext* cli_context = totp_cli_register_command_handler(plugin_state);

if(!totp_activate_initial_scene(plugin_state)) {
FURI_LOG_E(LOGGING_TAG, "An error ocurred during activating initial scene\r\n");
totp_plugin_state_free(plugin_state);
return 253;
}

TotpCliContext* cli_context = totp_cli_register_command_handler(plugin_state);

// Affecting dolphin level
dolphin_deed(DolphinDeedPluginStart);

Expand Down

0 comments on commit 54fe1db

Please sign in to comment.