@@ -41,7 +41,8 @@ Notifications::Notifications(DisplayApp* app,
4141 }
4242 if (mode == Modes::Preview) {
4343 wakeLock.Lock ();
44- if (notification.category == Controllers::NotificationManager::Categories::IncomingCall) {
44+ if (notification.category == Controllers::NotificationManager::Categories::IncomingCall ||
45+ notification.category == Controllers::NotificationManager::Categories::PhoneAlarm) {
4546 motorController.StartRinging ();
4647 } else {
4748 motorController.RunForDuration (35 );
@@ -262,7 +263,7 @@ Notifications::NotificationItem::NotificationItem(const char* title,
262263 uint8_t notifNb,
263264 Pinetime::Controllers::AlertNotificationService& alertNotificationService,
264265 Pinetime::Controllers::MotorController& motorController)
265- : alertNotificationService {alertNotificationService}, motorController {motorController} {
266+ : alertNotificationService {alertNotificationService}, motorController {motorController}, category {category} {
266267 container = lv_cont_create (lv_scr_act (), nullptr );
267268 lv_obj_set_size (container, LV_HOR_RES, LV_VER_RES);
268269 lv_obj_set_style_local_bg_color (container, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_BLACK);
@@ -348,6 +349,34 @@ Notifications::NotificationItem::NotificationItem(const char* title,
348349 lv_label_set_text_static (label_mute, Symbols::volumMute);
349350 lv_obj_set_style_local_bg_color (bt_mute, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Colors::lightGray);
350351 } break ;
352+ case Controllers::NotificationManager::Categories::PhoneAlarm: {
353+ lv_obj_set_height (subject_container, 108 );
354+ lv_label_set_text_static (alert_subject, " Phone Alarm" );
355+
356+ lv_obj_t * alert_label = lv_label_create (subject_container, nullptr );
357+ lv_obj_align (alert_label, alert_subject, LV_ALIGN_OUT_BOTTOM_LEFT, 0 , 0 );
358+ lv_label_set_long_mode (alert_label, LV_LABEL_LONG_BREAK);
359+ lv_obj_set_width (alert_label, LV_HOR_RES - 20 );
360+ lv_label_set_text (alert_label, msg);
361+
362+ bt_reject = lv_btn_create (container, nullptr );
363+ bt_reject->user_data = this ;
364+ lv_obj_set_event_cb (bt_reject, CallEventHandler);
365+ lv_obj_set_size (bt_reject, 115 , 76 );
366+ lv_obj_align (bt_reject, nullptr , LV_ALIGN_IN_BOTTOM_LEFT, 0 , 0 );
367+ label_reject = lv_label_create (bt_reject, nullptr );
368+ lv_label_set_text_static (label_reject, Symbols::stop);
369+ lv_obj_set_style_local_bg_color (bt_reject, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_RED);
370+
371+ bt_mute = lv_btn_create (container, nullptr );
372+ bt_mute->user_data = this ;
373+ lv_obj_set_event_cb (bt_mute, CallEventHandler);
374+ lv_obj_set_size (bt_mute, 115 , 76 );
375+ lv_obj_align (bt_mute, nullptr , LV_ALIGN_IN_BOTTOM_RIGHT, 0 , 0 );
376+ label_mute = lv_label_create (bt_mute, nullptr );
377+ lv_label_set_text_static (label_mute, " zzz" );
378+ lv_obj_set_style_local_bg_color (bt_mute, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Colors::violet);
379+ } break ;
351380 }
352381}
353382
@@ -358,12 +387,20 @@ void Notifications::NotificationItem::OnCallButtonEvent(lv_obj_t* obj, lv_event_
358387
359388 motorController.StopRinging ();
360389
361- if (obj == bt_accept) {
362- alertNotificationService.AcceptIncomingCall ();
363- } else if (obj == bt_reject) {
364- alertNotificationService.RejectIncomingCall ();
365- } else if (obj == bt_mute) {
366- alertNotificationService.MuteIncomingCall ();
390+ if (category == Controllers::NotificationManager::Categories::PhoneAlarm) {
391+ if (obj == bt_reject) {
392+ alertNotificationService.DismissPhoneAlarm ();
393+ } else if (obj == bt_mute) {
394+ alertNotificationService.SnoozePhoneAlarm ();
395+ }
396+ } else {
397+ if (obj == bt_accept) {
398+ alertNotificationService.AcceptIncomingCall ();
399+ } else if (obj == bt_reject) {
400+ alertNotificationService.RejectIncomingCall ();
401+ } else if (obj == bt_mute) {
402+ alertNotificationService.MuteIncomingCall ();
403+ }
367404 }
368405
369406 running = false ;
0 commit comments