Files
MuditaOS/module-apps/application-desktop/widgets/DBNotificationsHandler.hpp
Michał Kamoń 0bad6d643b [EGD-6657] ApplicationDesktop clean-up
This PR cleans-up `ApplicationDesktop` after recent changes in
home screen notifications handling.
2021-05-07 15:41:14 +02:00

49 lines
1.1 KiB
C++

// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
#pragma once
#include <map>
namespace db
{
class NotificationMessage;
class QueryResult;
} // namespace db
namespace app
{
class Application;
class DBNotificationsBaseHandler
{
public:
enum class Type
{
notReadSMS,
notReadCall
};
[[nodiscard]] virtual bool hasNotification(Type type) const = 0;
virtual ~DBNotificationsBaseHandler() = default;
};
class DBNotificationsHandler : public DBNotificationsBaseHandler
{
Application *ownerApp = nullptr;
std::map<Type, int> notifications;
void setNotification(Type type, int value);
public:
explicit DBNotificationsHandler(Application *ownerApp);
void initHandler();
bool handle(db::NotificationMessage *msg);
bool handle(db::QueryResult *msg);
[[nodiscard]] bool hasNotification(Type type) const override;
};
} // namespace app