Skip to content

Commit 54fe1db

Browse files
authored
Implemented #203 (#204)
* 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>
1 parent e8c5187 commit 54fe1db

File tree

3 files changed

+42
-60
lines changed

3 files changed

+42
-60
lines changed

application.fam

+18-36
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,7 @@ App(
44
apptype=FlipperAppType.EXTERNAL,
55
entry_point="totp_app",
66
cdefines=["APP_TOTP"],
7-
requires=[
8-
"gui",
9-
"cli",
10-
"dialogs",
11-
"storage",
12-
"input",
13-
"notification",
14-
"bt"
15-
],
7+
requires=["gui", "cli", "dialogs", "storage", "input", "notification", "bt"],
168
stack_size=2 * 1024,
179
order=20,
1810
fap_version="5.00",
@@ -47,11 +39,11 @@ App(
4739
"wolfcrypt/src/hash.c",
4840
"wolfcrypt/src/sha.c",
4941
"wolfcrypt/src/sha256.c",
50-
"wolfcrypt/src/sha512.c"
42+
"wolfcrypt/src/sha512.c",
5143
],
5244
cflags=["-Wno-error"],
5345
cdefines=["HAVE_CONFIG_H"],
54-
cincludes=["config/wolfssl"]
46+
cincludes=["config/wolfssl"],
5547
),
5648
],
5749
)
@@ -61,9 +53,7 @@ App(
6153
apptype=FlipperAppType.PLUGIN,
6254
entry_point="totp_cli_timezone_plugin_ep",
6355
requires=["totp"],
64-
sources=[
65-
"cli/plugins/timezone/timezone.c",
66-
"cli/cli_shared_methods.c"],
56+
sources=["cli/plugins/timezone/timezone.c", "cli/cli_shared_methods.c"],
6757
)
6858

6959
App(
@@ -91,7 +81,8 @@ App(
9181
"cli/plugins/list/list.c",
9282
"cli/cli_shared_methods.c",
9383
"cli/plugins/list/formatters/table/list_output_formatter_table.c",
94-
"cli/plugins/list/formatters/tsv/list_output_formatter_tsv.c"],
84+
"cli/plugins/list/formatters/tsv/list_output_formatter_tsv.c",
85+
],
9586
)
9687

9788
App(
@@ -103,7 +94,8 @@ App(
10394
"cli/plugins/details/details.c",
10495
"cli/cli_shared_methods.c",
10596
"cli/plugins/details/formatters/table/details_output_formatter_table.c",
106-
"cli/plugins/details/formatters/tsv/details_output_formatter_tsv.c"],
97+
"cli/plugins/details/formatters/tsv/details_output_formatter_tsv.c",
98+
],
10799
)
108100

109101
App(
@@ -114,7 +106,8 @@ App(
114106
sources=[
115107
"cli/plugins/modify/add/add.c",
116108
"cli/plugins/modify/common.c",
117-
"cli/cli_shared_methods.c"],
109+
"cli/cli_shared_methods.c",
110+
],
118111
)
119112

120113
App(
@@ -125,65 +118,54 @@ App(
125118
sources=[
126119
"cli/plugins/modify/update/update.c",
127120
"cli/plugins/modify/common.c",
128-
"cli/cli_shared_methods.c"],
121+
"cli/cli_shared_methods.c",
122+
],
129123
)
130124

131125
App(
132126
appid="totp_cli_delete_plugin",
133127
apptype=FlipperAppType.PLUGIN,
134128
entry_point="totp_cli_delete_plugin_ep",
135129
requires=["totp"],
136-
sources=[
137-
"cli/plugins/delete/delete.c",
138-
"cli/cli_shared_methods.c"],
130+
sources=["cli/plugins/delete/delete.c", "cli/cli_shared_methods.c"],
139131
)
140132

141133
App(
142134
appid="totp_cli_move_plugin",
143135
apptype=FlipperAppType.PLUGIN,
144136
entry_point="totp_cli_move_plugin_ep",
145137
requires=["totp"],
146-
sources=[
147-
"cli/plugins/move/move.c",
148-
"cli/cli_shared_methods.c"],
138+
sources=["cli/plugins/move/move.c", "cli/cli_shared_methods.c"],
149139
)
150140

151141
App(
152142
appid="totp_cli_reset_plugin",
153143
apptype=FlipperAppType.PLUGIN,
154144
entry_point="totp_cli_reset_plugin_ep",
155145
requires=["totp"],
156-
sources=[
157-
"cli/plugins/reset/reset.c",
158-
"cli/cli_shared_methods.c"],
146+
sources=["cli/plugins/reset/reset.c", "cli/cli_shared_methods.c"],
159147
)
160148

161149
App(
162150
appid="totp_cli_pin_plugin",
163151
apptype=FlipperAppType.PLUGIN,
164152
entry_point="totp_cli_pin_plugin_ep",
165153
requires=["totp"],
166-
sources=[
167-
"cli/plugins/pin/pin.c",
168-
"cli/cli_shared_methods.c"],
154+
sources=["cli/plugins/pin/pin.c", "cli/cli_shared_methods.c"],
169155
)
170156

171157
App(
172158
appid="totp_cli_automation_plugin",
173159
apptype=FlipperAppType.PLUGIN,
174160
entry_point="totp_cli_automation_plugin_ep",
175161
requires=["totp"],
176-
sources=[
177-
"cli/plugins/automation/automation.c",
178-
"cli/cli_shared_methods.c"],
162+
sources=["cli/plugins/automation/automation.c", "cli/cli_shared_methods.c"],
179163
)
180164

181165
App(
182166
appid="totp_cli_notification_plugin",
183167
apptype=FlipperAppType.PLUGIN,
184168
entry_point="totp_cli_notification_plugin_ep",
185169
requires=["totp"],
186-
sources=[
187-
"cli/plugins/notification/notification.c",
188-
"cli/cli_shared_methods.c"],
170+
sources=["cli/plugins/notification/notification.c", "cli/cli_shared_methods.c"],
189171
)

config/app/config.h

+22-22
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,25 @@
1+
// List of compatible firmwares
2+
#define TOTP_FIRMWARE_OFFICIAL_STABLE (1)
3+
#define TOTP_FIRMWARE_OFFICIAL_DEV (2)
4+
#define TOTP_FIRMWARE_XTREME_UL (3)
5+
// End of list
6+
7+
#if __has_include("ufbt_def.h")
8+
#include "ufbt_def.h"
9+
#endif
10+
11+
#ifndef TOTP_TARGET_FIRMWARE
12+
#if defined(TARGET_FIRMWARE_OFFICIAL) || defined(FW_ORIGIN_Official)
13+
#define TOTP_TARGET_FIRMWARE TOTP_FIRMWARE_OFFICIAL_STABLE
14+
#elif defined(TARGET_FIRMWARE_UNLEASHED) || defined(FW_ORIGIN_Unleashed)
15+
#define TOTP_TARGET_FIRMWARE TOTP_FIRMWARE_XTREME_UL
16+
#elif defined(TARGET_FIRMWARE_XTREME) || defined(FW_ORIGIN_Xtreme)
17+
#define TOTP_TARGET_FIRMWARE TOTP_FIRMWARE_XTREME_UL
18+
#else
19+
#define TOTP_TARGET_FIRMWARE TOTP_FIRMWARE_OFFICIAL_STABLE
20+
#endif
21+
#endif
22+
123
// Application automatic lock timeout if user IDLE. (ticks)
224
#ifndef TOTP_AUTO_LOCK_IDLE_TIMEOUT_SEC
325
#define TOTP_AUTO_LOCK_IDLE_TIMEOUT_SEC (60)
@@ -21,25 +43,3 @@
2143
#ifndef TOTP_UI_NO_ADD_NEW_TOKEN
2244
#define TOTP_UI_ADD_NEW_TOKEN_ENABLED
2345
#endif
24-
25-
// List of compatible firmwares
26-
#define TOTP_FIRMWARE_OFFICIAL_STABLE (1)
27-
#define TOTP_FIRMWARE_OFFICIAL_DEV (2)
28-
#define TOTP_FIRMWARE_XTREME_UL (3)
29-
// End of list
30-
31-
// Checking FlipC.org definitions (https://github.com/playmean/fap-list/issues/9)
32-
#if defined(TARGET_FIRMWARE_OFFICIAL)
33-
#define TOTP_TARGET_FIRMWARE TOTP_FIRMWARE_OFFICIAL_STABLE
34-
#elif defined(TARGET_FIRMWARE_UNLEASHED)
35-
#define TOTP_TARGET_FIRMWARE TOTP_FIRMWARE_XTREME_UL
36-
#elif defined(TARGET_FIRMWARE_XTREME)
37-
#define TOTP_TARGET_FIRMWARE TOTP_FIRMWARE_XTREME_UL
38-
#endif
39-
// End of FlipC.org definition checks
40-
41-
// 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:.
42-
// I'm still using Xtreme firmware, it is still the best one and I highly recommend it to everybody.
43-
#ifndef TOTP_TARGET_FIRMWARE
44-
#define TOTP_TARGET_FIRMWARE TOTP_FIRMWARE_OFFICIAL_STABLE
45-
#endif

totp_app.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -230,14 +230,14 @@ int32_t totp_app() {
230230
return 254;
231231
}
232232

233-
TotpCliContext* cli_context = totp_cli_register_command_handler(plugin_state);
234-
235233
if(!totp_activate_initial_scene(plugin_state)) {
236234
FURI_LOG_E(LOGGING_TAG, "An error ocurred during activating initial scene\r\n");
237235
totp_plugin_state_free(plugin_state);
238236
return 253;
239237
}
240238

239+
TotpCliContext* cli_context = totp_cli_register_command_handler(plugin_state);
240+
241241
// Affecting dolphin level
242242
dolphin_deed(DolphinDeedPluginStart);
243243

0 commit comments

Comments
 (0)