1
1
#include "flipp_pomodoro_app_i.h"
2
2
3
+ #define TAG "FlippPomodoro"
4
+
3
5
enum {
4
6
CustomEventConsumed = true,
5
7
CustomEventNotConsumed = false,
@@ -32,6 +34,9 @@ static bool flipp_pomodoro_app_custom_event_callback(void* ctx, uint32_t event)
32
34
if (flipp_pomodoro__get_stage (app -> state ) == FlippPomodoroStageFocus ) {
33
35
// REGISTER a deed on work stage complete to get an acheivement
34
36
dolphin_deed (DolphinDeedPluginGameWin );
37
+ FURI_LOG_I (TAG , "Focus stage reward added" );
38
+
39
+ flipp_pomodoro_statistics__increase_focus_stages_completed (app -> statistics );
35
40
};
36
41
37
42
flipp_pomodoro__toggle_stage (app -> state );
@@ -56,6 +61,8 @@ FlippPomodoroApp* flipp_pomodoro_app_alloc() {
56
61
app -> notification_app = furi_record_open (RECORD_NOTIFICATION );
57
62
58
63
app -> view_dispatcher = view_dispatcher_alloc ();
64
+ app -> statistics = flipp_pomodoro_statistics__new ();
65
+
59
66
view_dispatcher_enable_queue (app -> view_dispatcher );
60
67
view_dispatcher_set_event_callback_context (app -> view_dispatcher , app );
61
68
view_dispatcher_set_custom_event_callback (
@@ -67,31 +74,45 @@ FlippPomodoroApp* flipp_pomodoro_app_alloc() {
67
74
app -> view_dispatcher , flipp_pomodoro_app_back_event_callback );
68
75
69
76
app -> timer_view = flipp_pomodoro_view_timer_alloc ();
77
+ app -> info_view = flipp_pomodoro_info_view_alloc ();
70
78
71
79
view_dispatcher_add_view (
72
80
app -> view_dispatcher ,
73
81
FlippPomodoroAppViewTimer ,
74
82
flipp_pomodoro_view_timer_get_view (app -> timer_view ));
75
83
76
- scene_manager_next_scene (app -> scene_manager , FlippPomodoroSceneTimer );
84
+ view_dispatcher_add_view (
85
+ app -> view_dispatcher ,
86
+ FlippPomodoroAppViewInfo ,
87
+ flipp_pomodoro_info_view_get_view (app -> info_view ));
77
88
89
+ scene_manager_next_scene (app -> scene_manager , FlippPomodoroSceneTimer );
90
+ FURI_LOG_I (TAG , "Alloc complete" );
78
91
return app ;
79
92
};
80
93
81
94
void flipp_pomodoro_app_free (FlippPomodoroApp * app ) {
82
95
view_dispatcher_remove_view (app -> view_dispatcher , FlippPomodoroAppViewTimer );
96
+ view_dispatcher_remove_view (app -> view_dispatcher , FlippPomodoroAppViewInfo );
83
97
view_dispatcher_free (app -> view_dispatcher );
84
98
scene_manager_free (app -> scene_manager );
85
99
flipp_pomodoro_view_timer_free (app -> timer_view );
100
+ flipp_pomodoro_info_view_free (app -> info_view );
101
+ flipp_pomodoro_statistics__destroy (app -> statistics );
102
+ flipp_pomodoro__destroy (app -> state );
86
103
free (app );
87
104
furi_record_close (RECORD_GUI );
88
105
furi_record_close (RECORD_NOTIFICATION );
89
106
};
90
107
91
108
int32_t flipp_pomodoro_app (void * p ) {
92
109
UNUSED (p );
110
+ FURI_LOG_I (TAG , "Initial" );
93
111
FlippPomodoroApp * app = flipp_pomodoro_app_alloc ();
94
112
113
+ FURI_LOG_I (TAG , "Run deed added" );
114
+ dolphin_deed (DolphinDeedPluginGameStart );
115
+
95
116
view_dispatcher_run (app -> view_dispatcher );
96
117
97
118
flipp_pomodoro_app_free (app );
0 commit comments