@@ -109,35 +109,6 @@ static const char *prv_get_dnd_mask_subtitle(void *i18n_key) {
109109 return title ;
110110}
111111
112- static const DndNotificationMode s_dnd_notification_mode_cycle [] = {
113- DndNotificationModeShow ,
114- DndNotificationModeHide ,
115- };
116-
117- static DndNotificationMode prv_cycle_dnd_notification_mode (void ) {
118- DndNotificationMode mode = alerts_preferences_dnd_get_show_notifications ();
119- int index = 0 ;
120- for (size_t i = 0 ; i < ARRAY_LENGTH (s_dnd_notification_mode_cycle ); i ++ ) {
121- if (s_dnd_notification_mode_cycle [i ] == mode ) {
122- index = i ;
123- break ;
124- }
125- }
126- mode = s_dnd_notification_mode_cycle [(index + 1 ) % ARRAY_LENGTH (s_dnd_notification_mode_cycle )];
127- alerts_preferences_dnd_set_show_notifications (mode );
128- return mode ;
129- }
130-
131- static const char * prv_get_dnd_notifications_enable (void * i18n_key ) {
132- switch (alerts_preferences_dnd_get_show_notifications ()) {
133- case DndNotificationModeShow :
134- return i18n_get ("Show" , i18n_key );
135- case DndNotificationModeHide :
136- return i18n_get ("Hide" , i18n_key );
137- default :
138- return "???" ;
139- }
140- }
141112
142113static void prv_get_dnd_time (DoNotDisturbScheduleType type , char * time_string , const uint8_t len ) {
143114 DoNotDisturbSchedule schedule ;
@@ -357,6 +328,28 @@ static void prv_schedule_submenu_push(void) {
357328 app_window_stack_push (window , true /* animated */ );
358329}
359330
331+ static const char * prv_get_dnd_notifications_subtitle (void * i18n_key ) {
332+ if (alerts_preferences_dnd_get_show_notifications () == DndNotificationModeHide ) {
333+ return i18n_get ("Off" , i18n_key );
334+ }
335+ if (alerts_preferences_dnd_get_auto_dismiss ()) {
336+ return i18n_get ("On - Auto Dismiss" , i18n_key );
337+ }
338+ return i18n_get ("On - Persistent" , i18n_key );
339+ }
340+
341+ static void prv_cycle_dnd_notifications (void ) {
342+ if (alerts_preferences_dnd_get_show_notifications () == DndNotificationModeHide ) {
343+ alerts_preferences_dnd_set_show_notifications (DndNotificationModeShow );
344+ alerts_preferences_dnd_set_auto_dismiss (false);
345+ } else if (!alerts_preferences_dnd_get_auto_dismiss ()) {
346+ alerts_preferences_dnd_set_auto_dismiss (true);
347+ } else {
348+ alerts_preferences_dnd_set_show_notifications (DndNotificationModeHide );
349+ alerts_preferences_dnd_set_auto_dismiss (false);
350+ }
351+ }
352+
360353///////////////////////////////
361354// Backlight sub-menu (touch boards)
362355///////////////////////////////
@@ -453,7 +446,7 @@ static void prv_draw_row_cb(SettingsCallbacks *context, GContext *ctx,
453446 break ;
454447 case QuietTimeItemNotifications :
455448 title = i18n_get ("Notifications" , data );
456- subtitle = prv_get_dnd_notifications_enable (data );
449+ subtitle = prv_get_dnd_notifications_subtitle (data );
457450 break ;
458451#ifdef CONFIG_TOUCH
459452 case QuietTimeItemBacklight :
@@ -491,7 +484,7 @@ static void prv_select_click_cb(SettingsCallbacks *context, uint16_t row) {
491484 prv_cycle_dnd_mask ();
492485 break ;
493486 case QuietTimeItemNotifications :
494- prv_cycle_dnd_notification_mode ();
487+ prv_cycle_dnd_notifications ();
495488 break ;
496489#ifdef CONFIG_TOUCH
497490 case QuietTimeItemBacklight :
0 commit comments