From e06aef5bed67e065fd9fd5d8cfd73e355d162e08 Mon Sep 17 00:00:00 2001 From: Adam Dobrowolski Date: Thu, 5 Mar 2020 11:11:47 +0100 Subject: [PATCH] EGD-2897 Notifications on desktop on SMS and CALL works fine --- .../application-desktop/ApplicationDesktop.cpp | 11 ++++------- .../application-desktop/windows/DesktopMainWindow.cpp | 6 +++--- module-services/service-cellular/ServiceCellular.cpp | 1 - module-services/service-db/ServiceDB.cpp | 4 ++++ 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/module-apps/application-desktop/ApplicationDesktop.cpp b/module-apps/application-desktop/ApplicationDesktop.cpp index 05ac1c38b..f682bc10c 100644 --- a/module-apps/application-desktop/ApplicationDesktop.cpp +++ b/module-apps/application-desktop/ApplicationDesktop.cpp @@ -51,13 +51,10 @@ sys::Message_t ApplicationDesktop::DataReceivedHandler(sys::DataMessage* msgl,sy LOG_DEBUG("Received multicast"); if ((msg != nullptr) && ((msg->notificationType == DB::NotificationType::Updated) || (msg->notificationType == DB::NotificationType::Added))) { - if (this->getCurrentWindow() == this->windows[app::name::window::desktop_menu] || - getCurrentWindow() == this->windows[app::name::window::desktop_lockscreen]) - { - notifications.notSeenCalls = DBServiceAPI::CalllogGetCount(this, EntryState::UNREAD); - notifications.notSeenSMS = DBServiceAPI::SMSGetCount(this, EntryState::UNREAD); - this->getCurrentWindow()->rebuild(); - } + notifications.notSeenCalls = DBServiceAPI::CalllogGetCount(this, EntryState::UNREAD); + notifications.notSeenSMS = DBServiceAPI::SMSGetCount(this, EntryState::UNREAD); + this->windows[app::name::window::desktop_menu]->rebuild(); + this->windows[app::name::window::desktop_lockscreen]->rebuild(); return std::make_shared(); } } diff --git a/module-apps/application-desktop/windows/DesktopMainWindow.cpp b/module-apps/application-desktop/windows/DesktopMainWindow.cpp index 7cdfe0511..f4c65ccc2 100644 --- a/module-apps/application-desktop/windows/DesktopMainWindow.cpp +++ b/module-apps/application-desktop/windows/DesktopMainWindow.cpp @@ -50,7 +50,6 @@ namespace gui { AppWindow::buildInterface(); bottomBar->setActive(BottomBar::Side::CENTER, true); - bottomBar->setText(BottomBar::Side::CENTER, utils::localize.get("app_desktop_unlock")); topBar->setActive({{TopBar::Elements::SIGNAL, true}, {TopBar::Elements::LOCK, true}, {TopBar::Elements::BATTERY, true}}); time = new gui::Label(this, 0, style::design_time_offset, style::window_width, style::design_time_h); @@ -67,6 +66,7 @@ namespace gui { dayText->setText(ttime.day() + ", " + ttime.str("%d %b")); dayText->setAlignement(Alignment::ALIGN_HORIZONTAL_CENTER); + setVisibleState(); } void DesktopMainWindow::destroyInterface() { @@ -343,9 +343,9 @@ auto DesktopMainWindow::fillNotifications() -> bool return sapm::ApplicationManager::messageSwitchApplication(application, app::CallLogAppStr, gui::name::window::main_window, nullptr); }); } - if (app->notifications.notSeenCalls) + if (app->notifications.notSeenSMS) { - add_notification(notifications, "mail", utils::localize.get("app_desktop_unread_messages"), std::to_string(app->notifications.notSeenCalls), [this]() { + add_notification(notifications, "mail", utils::localize.get("app_desktop_unread_messages"), std::to_string(app->notifications.notSeenSMS), [this]() { return sapm::ApplicationManager::messageSwitchApplication(application, app::name_messages, gui::name::window::main_window, nullptr); }); } diff --git a/module-services/service-cellular/ServiceCellular.cpp b/module-services/service-cellular/ServiceCellular.cpp index 0522ec559..851d35cd6 100644 --- a/module-services/service-cellular/ServiceCellular.cpp +++ b/module-services/service-cellular/ServiceCellular.cpp @@ -834,7 +834,6 @@ bool ServiceCellular::receiveSMS(std::string messageNumber) { record.body = decodedMessage; record.number = receivedNumber; record.type = SMSType::INBOX; - record.isRead = true; record.date = messageDate; DBServiceAPI::SMSAdd(this, record); diff --git a/module-services/service-db/ServiceDB.cpp b/module-services/service-db/ServiceDB.cpp index 374b66d66..1d90d8b1c 100644 --- a/module-services/service-db/ServiceDB.cpp +++ b/module-services/service-db/ServiceDB.cpp @@ -411,6 +411,10 @@ sys::Message_t ServiceDB::DataReceivedHandler(sys::DataMessage *msgl, sys::Respo record->push_back(msg->record); LOG_INFO("Last ID %d", msg->record.ID); responseMsg = std::make_shared(std::move(record), ret); + + auto notificationMessage = + std::make_shared(MessageType::DBServiceNotification, DB::NotificationType::Added, DB::BaseType::CalllogDB); + sys::Bus::SendMulticast(notificationMessage, sys::BusChannels::ServiceDBNotifications, this); } break;