mirror of
https://github.com/mudita/MuditaOS.git
synced 2026-04-21 23:50:31 -04:00
[EGD-6855] Add no modem notification on tethering
This commit provides the implementation of functionality that blocks sms/calls notifications on home screen when tethering is active. Previously, the notifications could be visible if the notifications were visible prior to tethering activation. By the design, the functionality should not clear the notifications, just temporary hide them. That is achieved by implementation ot the functionality in NotificationModel which is an UI presenter.
This commit is contained in:
committed by
Michał Kamoń
parent
325f8696b8
commit
8078dd240b
@@ -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<const notifications::NotSeenSMSNotification *>(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<const notifications::NotSeenCallNotification *>(notification.get());
|
||||
internalData.push_back(create(call));
|
||||
}
|
||||
@@ -128,3 +138,8 @@ void NotificationsModel::clearAll()
|
||||
list->reset();
|
||||
eraseInternalData();
|
||||
}
|
||||
|
||||
bool NotificationsModel::isTetheringOn() const noexcept
|
||||
{
|
||||
return tetheringOn;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user