Files
MuditaOS/module-apps/apps-common/notifications/NotificationsConfiguration.cpp
Lefucjusz 674a768364 [MOS-669] Add too hot battery notification when charging
* Added notification showing on the main
screen if the battery has reached too
high temperature to continue charging.
* Code cleanups.
2023-10-16 12:54:13 +02:00

38 lines
1.6 KiB
C++

// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
#include "NotificationsConfiguration.hpp"
#include <Utils.hpp>
#include <service-db/agents/settings/SystemSettings.hpp>
using namespace notifications;
NotificationsConfiguration::NotificationsConfiguration(std::shared_ptr<sys::phone_modes::Observer> phoneModeObserver,
std::shared_ptr<settings::Settings> settings,
const locks::PhoneLockHandler &phoneLockHandler)
: phoneModeObserver{std::move(phoneModeObserver)}, settings{std::move(settings)}, phoneLockHandler{phoneLockHandler}
{}
void NotificationsConfiguration::updateCurrentCall(CallNotificationPolicy &policy)
{
policy.updateCurrentCall(phoneModeObserver->getCurrentPhoneMode());
}
void NotificationsConfiguration::updateCurrentList(NotificationsListPolicy &policy)
{
policy.updateCurrentList(phoneModeObserver->getCurrentPhoneMode(),
phoneLockHandler.isPhoneLocked(),
getDNDNotificationsOnLockedScreen());
}
void NotificationsConfiguration::updateCurrentSMS(SMSNotificationPolicy &policy)
{
policy.updateCurrentSMS(phoneModeObserver->getCurrentPhoneMode());
}
auto NotificationsConfiguration::getDNDNotificationsOnLockedScreen() const noexcept -> bool
{
return utils::getNumericValue<bool>(
settings->getValue(settings::Offline::notificationsWhenLocked, settings::SettingsScope::Global));
}