diff --git a/module-apps/notifications/NotificationsModel.cpp b/module-apps/notifications/NotificationsModel.cpp index aaa5a1a5b..83a657627 100644 --- a/module-apps/notifications/NotificationsModel.cpp +++ b/module-apps/notifications/NotificationsModel.cpp @@ -20,6 +20,15 @@ namespace item->setName(utils::translate(text), true); } } + + bool hasTetheringNotification(app::manager::actions::NotificationsChangedParams *params) + { + const auto ¬ifications = params->getNotifications(); + const auto it = std::find_if(std::begin(notifications), std::end(notifications), [](const auto ¬ification) { + return notification->getType() == notifications::NotificationType::Tethering; + }); + return it != std::end(notifications); + } } // namespace unsigned int NotificationsModel::requestRecordsCount() @@ -104,12 +113,13 @@ void NotificationsModel::updateData(app::manager::actions::NotificationsChangedP delete item; } }; + tetheringOn = hasTetheringNotification(params); for (const auto ¬ification : params->getNotifications()) { - if (typeid(*notification) == typeid(notifications::NotSeenSMSNotification)) { + if (not tetheringOn && typeid(*notification) == typeid(notifications::NotSeenSMSNotification)) { auto sms = static_cast(notification.get()); internalData.push_back(create(sms)); } - else if (typeid(*notification) == typeid(notifications::NotSeenCallNotification)) { + else if (not tetheringOn && typeid(*notification) == typeid(notifications::NotSeenCallNotification)) { auto call = static_cast(notification.get()); internalData.push_back(create(call)); } @@ -128,3 +138,8 @@ void NotificationsModel::clearAll() list->reset(); eraseInternalData(); } + +bool NotificationsModel::isTetheringOn() const noexcept +{ + return tetheringOn; +} diff --git a/module-apps/notifications/NotificationsModel.hpp b/module-apps/notifications/NotificationsModel.hpp index fbc4d1a82..d01786637 100644 --- a/module-apps/notifications/NotificationsModel.hpp +++ b/module-apps/notifications/NotificationsModel.hpp @@ -22,6 +22,7 @@ namespace gui void requestRecords(uint32_t offset, uint32_t limit) final; protected: + bool tetheringOn = false; [[nodiscard]] virtual auto create(const notifications::NotSeenSMSNotification *notification) -> NotificationListItem *; [[nodiscard]] virtual auto create(const notifications::NotSeenCallNotification *notification) @@ -32,6 +33,7 @@ namespace gui public: [[nodiscard]] bool isEmpty() const noexcept; [[nodiscard]] bool hasDismissibleNotification() const noexcept; + [[nodiscard]] bool isTetheringOn() const noexcept; void updateData(app::manager::actions::NotificationsChangedParams *params); void dismissAll(const InputEvent &event);