-
Notifications
You must be signed in to change notification settings - Fork 3.1k
[FL-3897] Happy mode #3863
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
[FL-3897] Happy mode #3863
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
aa8162c
feat: happy mode
portasynthinca3 a00e4f5
feat: remove sad dolphin when powering off in happy mode
portasynthinca3 73ed540
Merge branch 'dev' into portasynthinca3/3897-happy-mode
skotopes 185d51b
style: address review comments
portasynthinca3 da2cf13
Merge branch 'dev' into portasynthinca3/3897-happy-mode
portasynthinca3 d950840
Merge branch 'dev' into portasynthinca3/3897-happy-mode
skotopes 81673e6
Dolphin: add missing furi_checks
skotopes 58f29f8
Komi: add missing region initialization on startup
skotopes File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
26 changes: 26 additions & 0 deletions
26
applications/settings/desktop_settings/desktop_settings_custom_event.h
This file contains hidden or 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,26 @@ | ||
#pragma once | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
typedef enum { | ||
// reserve 100 for button presses, submenu selections, etc. | ||
skotopes marked this conversation as resolved.
Show resolved
Hide resolved
|
||
DesktopSettingsCustomEventExit = 100, | ||
DesktopSettingsCustomEventDone, | ||
|
||
DesktopSettingsCustomEvent1stPinEntered, | ||
DesktopSettingsCustomEventPinsEqual, | ||
DesktopSettingsCustomEventPinsDifferent, | ||
|
||
DesktopSettingsCustomEventSetPin, | ||
DesktopSettingsCustomEventChangePin, | ||
DesktopSettingsCustomEventDisablePin, | ||
|
||
DesktopSettingsCustomEventSetDefault, | ||
DesktopSettingsCustomEventSetDummy, | ||
} DesktopSettingsCustomEvent; | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif |
This file contains hidden or 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
64 changes: 64 additions & 0 deletions
64
applications/settings/desktop_settings/scenes/desktop_settings_scene_happy_mode.c
This file contains hidden or 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,64 @@ | ||
#include <furi.h> | ||
#include <gui/scene_manager.h> | ||
#include <gui/view_dispatcher.h> | ||
#include <gui/modules/dialog_ex.h> | ||
#include <dolphin/dolphin.h> | ||
|
||
#include "desktop_settings_scene.h" | ||
#include "../desktop_settings_app.h" | ||
#include "../desktop_settings_custom_event.h" | ||
|
||
static void desktop_settings_scene_happy_mode_done_callback(DialogExResult result, void* context) { | ||
DesktopSettingsApp* app = context; | ||
DolphinSettings settings; | ||
Dolphin* dolphin = furi_record_open(RECORD_DOLPHIN); | ||
dolphin_get_settings(dolphin, &settings); | ||
settings.happy_mode = (result == DialogExResultRight); | ||
dolphin_set_settings(dolphin, &settings); | ||
furi_record_close(RECORD_DOLPHIN); | ||
view_dispatcher_send_custom_event(app->view_dispatcher, DesktopSettingsCustomEventExit); | ||
} | ||
|
||
void desktop_settings_scene_happy_mode_on_enter(void* context) { | ||
DesktopSettingsApp* app = context; | ||
Dolphin* dolphin = furi_record_open(RECORD_DOLPHIN); | ||
DolphinSettings settings; | ||
dolphin_get_settings(dolphin, &settings); | ||
furi_record_close(RECORD_DOLPHIN); | ||
|
||
dialog_ex_set_header(app->dialog_ex, "Happy Mode", 64, 0, AlignCenter, AlignTop); | ||
dialog_ex_set_text( | ||
app->dialog_ex, | ||
"I will never get angry at you\nfor not spending time with me\nas long as this mode is enabled", | ||
64, | ||
30, | ||
AlignCenter, | ||
AlignCenter); | ||
dialog_ex_set_left_button_text(app->dialog_ex, settings.happy_mode ? "Disable" : "Go back"); | ||
dialog_ex_set_right_button_text( | ||
app->dialog_ex, settings.happy_mode ? "Keep enabled" : "Enable"); | ||
dialog_ex_set_result_callback(app->dialog_ex, desktop_settings_scene_happy_mode_done_callback); | ||
dialog_ex_set_context(app->dialog_ex, app); | ||
view_dispatcher_switch_to_view(app->view_dispatcher, DesktopSettingsAppViewDialogEx); | ||
} | ||
|
||
bool desktop_settings_scene_happy_mode_on_event(void* context, SceneManagerEvent event) { | ||
DesktopSettingsApp* app = context; | ||
bool consumed = false; | ||
|
||
if(event.type == SceneManagerEventTypeCustom) { | ||
switch(event.event) { | ||
case DesktopSettingsCustomEventExit: | ||
scene_manager_previous_scene(app->scene_manager); | ||
consumed = true; | ||
break; | ||
default: | ||
furi_crash(); | ||
} | ||
} | ||
return consumed; | ||
} | ||
|
||
void desktop_settings_scene_happy_mode_on_exit(void* context) { | ||
UNUSED(context); | ||
} |
This file contains hidden or 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 hidden or 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 hidden or 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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.