forked from flipperdevices/flipperzero-firmware
-
-
Notifications
You must be signed in to change notification settings - Fork 543
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1. A new feature to display statistics has been added. This includes the creation of new files `flipp_pomodoro_statistics.c` and `flipp_pomodoro_statistics.h` in the `modules` directory, and changes to `flipp_pomodoro_app.c` and `flipp_pomodoro_app.h` to incorporate the statistics functionality. 2. The `.vscode/settings.json` file has been updated with new entries. 3. The `flipp_pomodoro_app.c` file has been updated with new functions and modifications to existing ones to accommodate the new statistics feature. 4. New scenes have been added for displaying information and statistics, as seen in the `flipp_pomodoro_scene_info.c` and `flipp_pomodoro_scene_timer.c` files. 5. A new view `flipp_pomodoro_info_view.c` has been created to display the statistics and information. 6. An image file `flipp_pomodoro_learn_50x128.png` has been added to the `images` directory. 7. A new shell script `files-list.sh` has been added to the `tools` directory.
- Loading branch information
Showing
14 changed files
with
434 additions
and
25 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
#pragma once | ||
|
||
#define FURI_DEBUG 1 | ||
// #define FURI_DEBUG 1 | ||
|
||
/** | ||
* Index of dependencies for the main app | ||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,28 @@ | ||
#include "flipp_pomodoro_statistics.h" | ||
|
||
FlippPomodoroStatistics *flipp_pomodoro_statistics__new() | ||
{ | ||
FlippPomodoroStatistics *statistics = malloc(sizeof(FlippPomodoroStatistics)); | ||
|
||
statistics->focus_stages_completed = 0; | ||
|
||
return statistics; | ||
} | ||
|
||
// Return the number of completed focus stages | ||
uint8_t flipp_pomodoro_statistics__get_focus_stages_completed(FlippPomodoroStatistics *statistics) | ||
{ | ||
return statistics->focus_stages_completed; | ||
} | ||
|
||
// Increase the number of completed focus stages by one | ||
void flipp_pomodoro_statistics__increase_focus_stages_completed(FlippPomodoroStatistics *statistics) | ||
{ | ||
statistics->focus_stages_completed++; | ||
} | ||
|
||
void flipp_pomodoro_statistics__destroy(FlippPomodoroStatistics *statistics) | ||
{ | ||
furi_assert(statistics); | ||
free(statistics); | ||
}; |
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,45 @@ | ||
#pragma once | ||
#include <furi_hal.h> | ||
|
||
/** @brief FlippPomodoroStatistics structure | ||
* | ||
* This structure is used to keep track of completed focus stages. | ||
*/ | ||
typedef struct | ||
{ | ||
uint8_t focus_stages_completed; | ||
} FlippPomodoroStatistics; | ||
|
||
/** @brief Allocate and initialize a new FlippPomodoroStatistics | ||
* | ||
* This function allocates a new FlippPomodoroStatistics structure, initializes its members | ||
* and returns a pointer to it. | ||
* | ||
* @return A pointer to a new FlippPomodoroStatistics structure | ||
*/ | ||
FlippPomodoroStatistics *flipp_pomodoro_statistics__new(); | ||
|
||
/** @brief Get the number of completed focus stages | ||
* | ||
* This function retrieves the number of completed focus stages in a FlippPomodoroStatistics structure. | ||
* | ||
* @param statistics A pointer to a FlippPomodoroStatistics structure | ||
* @return The number of completed focus stages | ||
*/ | ||
uint8_t flipp_pomodoro_statistics__get_focus_stages_completed(FlippPomodoroStatistics *statistics); | ||
|
||
/** @brief Increase the number of completed focus stages | ||
* | ||
* This function increases the count of the completed focus stages by one in a FlippPomodoroStatistics structure. | ||
* | ||
* @param statistics A pointer to a FlippPomodoroStatistics structure | ||
*/ | ||
void flipp_pomodoro_statistics__increase_focus_stages_completed(FlippPomodoroStatistics *statistics); | ||
|
||
/** @brief Free a FlippPomodoroStatistics structure | ||
* | ||
* This function frees the memory used by a FlippPomodoroStatistics structure. | ||
* | ||
* @param statistics A pointer to a FlippPomodoroStatistics structure | ||
*/ | ||
void flipp_pomodoro_statistics__destroy(FlippPomodoroStatistics *state); |
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 |
---|---|---|
@@ -1 +1,2 @@ | ||
ADD_SCENE(flipp_pomodoro, info, Info) | ||
ADD_SCENE(flipp_pomodoro, timer, Timer) |
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
#pragma once | ||
#include <gui/scene_manager.h> | ||
|
||
// Generate scene id and total number | ||
|
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,67 @@ | ||
#include <furi.h> | ||
#include <gui/view_dispatcher.h> | ||
#include <gui/scene_manager.h> | ||
#include "flipp_pomodoro_scene.h" | ||
#include "../flipp_pomodoro_app.h" | ||
#include "../views/flipp_pomodoro_info_view.h" | ||
|
||
enum | ||
{ | ||
SceneEventConusmed = true, | ||
SceneEventNotConusmed = false | ||
}; | ||
|
||
void flipp_pomodoro_scene_info_on_back_to_timer(void *ctx) | ||
{ | ||
furi_assert(ctx); | ||
FlippPomodoroApp *app = ctx; | ||
|
||
view_dispatcher_send_custom_event( | ||
app->view_dispatcher, | ||
FlippPomodoroAppCustomEventResumeTimer); | ||
}; | ||
|
||
void flipp_pomodoro_scene_info_on_enter(void *ctx) | ||
{ | ||
furi_assert(ctx); | ||
FlippPomodoroApp *app = ctx; | ||
|
||
view_dispatcher_switch_to_view(app->view_dispatcher, FlippPomodoroAppViewInfo); | ||
flipp_pomodoro_info_view_set_pomodoros_completed( | ||
flipp_pomodoro_info_view_get_view(app->info_view), | ||
flipp_pomodoro_statistics__get_focus_stages_completed(app->statistics)); | ||
flipp_pomodoro_info_view_set_mode(flipp_pomodoro_info_view_get_view(app->info_view), FlippPomodoroInfoViewModeStats); | ||
flipp_pomodoro_info_view_set_resume_timer_cb(app->info_view, flipp_pomodoro_scene_info_on_back_to_timer, app); | ||
}; | ||
|
||
void flipp_pomodoro_scene_info_handle_custom_event(FlippPomodoroApp *app, FlippPomodoroAppCustomEvent custom_event) | ||
{ | ||
if (custom_event == FlippPomodoroAppCustomEventResumeTimer) | ||
{ | ||
scene_manager_next_scene(app->scene_manager, FlippPomodoroSceneTimer); | ||
} | ||
}; | ||
|
||
bool flipp_pomodoro_scene_info_on_event(void *ctx, SceneManagerEvent event) | ||
{ | ||
furi_assert(ctx); | ||
FlippPomodoroApp *app = ctx; | ||
|
||
switch (event.type) | ||
{ | ||
case SceneManagerEventTypeBack: | ||
view_dispatcher_stop(app->view_dispatcher); | ||
return SceneEventConusmed; | ||
case SceneManagerEventTypeCustom: | ||
flipp_pomodoro_scene_info_handle_custom_event(app, event.event); | ||
return SceneEventConusmed; | ||
default: | ||
break; | ||
}; | ||
return SceneEventNotConusmed; | ||
}; | ||
|
||
void flipp_pomodoro_scene_info_on_exit(void *ctx) | ||
{ | ||
UNUSED(ctx); | ||
}; |
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
Oops, something went wrong.