mirror of
https://github.com/mudita/MuditaOS.git
synced 2026-10-24 23:48:31 -04:00
This PR provides implementation of home screen notification for `notSeen` messages received from a single number. The "single-number: `notSeen` message notification distinct from "multiple-number" notification with the following features: - displaying formatted contact name - `onActivated` it switches to respective thread window (instead of all thread window) in `ApplicationMessages` The PR also introduced some `ActiveNotificationsModel` code refactor to align the implementation with `Single Responsibility Principle`
61 lines
1.8 KiB
C++
61 lines
1.8 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 <application-desktop/models/ActiveNotificationsModel.hpp>
|
|
|
|
#include <AppWindow.hpp>
|
|
#include <gui/widgets/Label.hpp>
|
|
#include <Translator.hpp>
|
|
#include <ListView.hpp>
|
|
|
|
namespace app
|
|
{
|
|
class ApplicationDesktop;
|
|
}
|
|
|
|
namespace gui
|
|
{
|
|
class NotificationsModel;
|
|
|
|
class DesktopMainWindow : public AppWindow
|
|
{
|
|
protected:
|
|
gui::Label *time = nullptr;
|
|
gui::Label *dayText = nullptr;
|
|
|
|
gui::ListView *notificationsList = nullptr;
|
|
std::shared_ptr<gui::ActiveNotificationsModel> notificationsModel = nullptr;
|
|
|
|
// method hides or show widgets and sets bars according to provided state
|
|
void setVisibleState();
|
|
void setActiveState();
|
|
bool processLongReleaseEvent(const InputEvent &inputEvent);
|
|
bool processShortReleaseEvent(const InputEvent &inputEvent);
|
|
app::ApplicationDesktop *getAppDesktop() const;
|
|
|
|
public:
|
|
explicit DesktopMainWindow(app::Application *app);
|
|
|
|
// virtual methods gui::Window
|
|
bool onInput(const InputEvent &inputEvent) override;
|
|
void onBeforeShow(ShowMode mode, SwitchData *data) override;
|
|
// virtual methods gui::AppWindow
|
|
void rebuild() override;
|
|
void buildInterface() override;
|
|
void destroyInterface() override;
|
|
top_bar::Configuration configureTopBar(top_bar::Configuration appConfiguration) override;
|
|
|
|
bool updateTime() override;
|
|
|
|
private:
|
|
void invalidate() noexcept;
|
|
std::string osUpdateVer;
|
|
std::string osCurrentVer;
|
|
|
|
gui::KeyInputMappedTranslation translator;
|
|
};
|
|
|
|
} /* namespace gui */
|