From 27fa6bba08766831fe143fe5ca13767bedcd9072 Mon Sep 17 00:00:00 2001 From: Michele Bini Date: Wed, 13 Apr 2022 20:53:14 +0200 Subject: Revert "Leftover modifications from previous commit!" This reverts commit a13d55356ef069e33e3afdaffe5f67c7e9e55027. diff --git a/src/components/ble/NimbleController.cpp b/src/components/ble/NimbleController.cpp index 4b08e9a..5236619 100644 --- a/src/components/ble/NimbleController.cpp +++ b/src/components/ble/NimbleController.cpp @@ -37,6 +37,7 @@ NimbleController::NimbleController(Pinetime::System::SystemTask& systemTask, dfuService {systemTask, bleController, spiNorFlash}, currentTimeClient {dateTimeController}, + anService {systemTask, notificationManager}, currentTimeService {dateTimeController}, batteryInformationService {batteryController}, serviceDiscovery({¤tTimeClient}) { @@ -77,6 +78,7 @@ void NimbleController::Init() { deviceInformationService.Init(); currentTimeClient.Init(); currentTimeService.Init(); + anService.Init(); dfuService.Init(); batteryInformationService.Init(); diff --git a/src/displayapp/screens/WatchFaceDigital.cpp b/src/displayapp/screens/WatchFaceDigital.cpp index 4c0ae84..6d80742 100644 --- a/src/displayapp/screens/WatchFaceDigital.cpp +++ b/src/displayapp/screens/WatchFaceDigital.cpp @@ -5,6 +5,7 @@ #include #include "displayapp/screens/BatteryIcon.h" #include "displayapp/screens/BleIcon.h" +#include "displayapp/screens/NotificationIcon.h" #include "displayapp/screens/Symbols.h" #include "components/battery/BatteryController.h" #include "components/ble/BleController.h" @@ -43,6 +44,11 @@ WatchFaceDigital::WatchFaceDigital(DisplayApp* app, lv_label_set_text_static(bleIcon, Symbols::bluetooth); lv_obj_align(bleIcon, batteryPlug, LV_ALIGN_OUT_LEFT_MID, -5, 0); + notificationIcon = lv_label_create(lv_scr_act(), nullptr); + lv_obj_set_style_local_text_color(notificationIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x00FF00)); + lv_label_set_text_static(notificationIcon, NotificationIcon::GetIcon(false)); + lv_obj_align(notificationIcon, nullptr, LV_ALIGN_IN_TOP_LEFT, 0, 0); + label_date = lv_label_create(lv_scr_act(), nullptr); lv_obj_align(label_date, nullptr, LV_ALIGN_CENTER, 0, 60); lv_obj_set_auto_realign(label_date, true); @@ -100,6 +106,11 @@ void WatchFaceDigital::Refresh() { lv_obj_realign(batteryPlug); lv_obj_realign(bleIcon); + notificationState = notificatioManager.AreNewNotificationsAvailable(); + if (notificationState.IsUpdated()) { + lv_label_set_text_static(notificationIcon, NotificationIcon::GetIcon(notificationState.Get())); + } + currentDateTime = dateTimeController.CurrentDateTime(); if (currentDateTime.IsUpdated()) { diff --git a/src/displayapp/screens/WatchFaceDigital.h b/src/displayapp/screens/WatchFaceDigital.h index b44e517..eb95e6f 100644 --- a/src/displayapp/screens/WatchFaceDigital.h +++ b/src/displayapp/screens/WatchFaceDigital.h @@ -50,6 +50,7 @@ namespace Pinetime { DirtyValue> currentDateTime {}; DirtyValue motionSensorOk {}; DirtyValue stepCount {}; + DirtyValue notificationState {}; lv_obj_t* label_time; lv_obj_t* label_time_pm; @@ -60,6 +61,7 @@ namespace Pinetime { lv_obj_t* batteryPlug; lv_obj_t* stepIcon; lv_obj_t* stepValue; + lv_obj_t* notificationIcon; Controllers::DateTime& dateTimeController; Controllers::Battery& batteryController; -- cgit v0.10.2