forked from flipperdevices/flipperzero-firmware
-
-
Notifications
You must be signed in to change notification settings - Fork 546
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
12 changed files
with
155 additions
and
53 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
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
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,37 @@ | ||
#include "reset.h" | ||
|
||
#include <stdlib.h> | ||
#include <furi/furi.h> | ||
#include "../../cli_helpers.h" | ||
#include "../../../services/config/config.h" | ||
|
||
#define TOTP_CLI_RESET_CONFIRMATION_KEYWORD "YES" | ||
|
||
void totp_cli_command_reset_docopt_commands() { | ||
TOTP_CLI_PRINTF(" " TOTP_CLI_COMMAND_RESET | ||
" Reset application to default settings\r\n"); | ||
} | ||
|
||
void totp_cli_command_reset_docopt_usage() { | ||
TOTP_CLI_PRINTF(" " TOTP_CLI_COMMAND_NAME " " TOTP_CLI_COMMAND_RESET "\r\n"); | ||
} | ||
|
||
void totp_cli_command_reset_handle(Cli* cli, FuriMessageQueue* event_queue) { | ||
TOTP_CLI_PRINTF( | ||
"As a result of reset all the settings and tokens will be permanently lost.\r\n"); | ||
TOTP_CLI_PRINTF("Do you really want to reset application?\r\n"); | ||
TOTP_CLI_PRINTF("Type \"" TOTP_CLI_RESET_CONFIRMATION_KEYWORD | ||
"\" and hit <ENTER> to confirm:\r\n"); | ||
FuriString* temp_str = furi_string_alloc(); | ||
bool is_confirmed = totp_cli_read_line(cli, temp_str, false) && | ||
furi_string_cmpi_str(temp_str, TOTP_CLI_RESET_CONFIRMATION_KEYWORD) == 0; | ||
furi_string_free(temp_str); | ||
if(is_confirmed) { | ||
totp_config_file_reset(); | ||
TOTP_CLI_PRINTF("Application has been successfully reset to default.\r\n"); | ||
TOTP_CLI_PRINTF("Now application will be closed to apply all the changes.\r\n"); | ||
totp_cli_force_close_app(event_queue); | ||
} else { | ||
TOTP_CLI_PRINTF("Action was not confirmed by user\r\n"); | ||
} | ||
} |
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,10 @@ | ||
#pragma once | ||
|
||
#include <cli/cli.h> | ||
#include "../../../types/plugin_state.h" | ||
|
||
#define TOTP_CLI_COMMAND_RESET "reset" | ||
|
||
void totp_cli_command_reset_handle(Cli* cli, FuriMessageQueue* event_queue); | ||
void totp_cli_command_reset_docopt_commands(); | ||
void totp_cli_command_reset_docopt_usage(); |
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