mirror of
https://github.com/mudita/MuditaOS.git
synced 2026-10-24 15:38:30 -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`
101 lines
3.7 KiB
C++
101 lines
3.7 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 "windows/Names.hpp"
|
|
#include "locks/handlers/PinLockHandler.hpp"
|
|
#include "widgets/DBNotificationsHandler.hpp"
|
|
#include "Constants.hpp"
|
|
#include <Application.hpp>
|
|
#include <Service/Message.hpp>
|
|
#include <service-desktop/DesktopMessages.hpp>
|
|
|
|
namespace cellular
|
|
{
|
|
class StateChange;
|
|
}
|
|
|
|
namespace gui
|
|
{
|
|
class NotificationsModel;
|
|
}
|
|
|
|
namespace app
|
|
{
|
|
class ApplicationDesktop : public Application, public AsyncCallbackReceiver
|
|
{
|
|
public:
|
|
bool need_sim_select = false;
|
|
|
|
gui::PinLockHandler lockHandler;
|
|
|
|
explicit ApplicationDesktop(std::string name = name_desktop,
|
|
std::string parent = {},
|
|
sys::phone_modes::PhoneMode mode = sys::phone_modes::PhoneMode::Connected,
|
|
StartInBackground startInBackground = {false});
|
|
|
|
sys::MessagePointer DataReceivedHandler(sys::DataMessage *msgl, sys::ResponseMessage *resp) override;
|
|
sys::ReturnCodes InitHandler() override;
|
|
sys::ReturnCodes DeinitHandler() override;
|
|
|
|
sys::ReturnCodes SwitchPowerModeHandler(const sys::ServicePowerMode mode) override final
|
|
{
|
|
return sys::ReturnCodes::Success;
|
|
}
|
|
void createUserInterface() override;
|
|
void destroyUserInterface() override;
|
|
// if there is modem notification and there is no default SIM selected, then we need to select if when unlock is
|
|
// done
|
|
bool handle(cellular::StateChange *msg);
|
|
auto handle(sdesktop::UpdateOsMessage *msg) -> bool;
|
|
void handleNotificationsChanged(std::unique_ptr<gui::SwitchData> notificationsParams) override;
|
|
|
|
std::string getOsUpdateVersion() const
|
|
{
|
|
return osUpdateVersion;
|
|
}
|
|
std::string getOsCurrentVersion() const
|
|
{
|
|
return osCurrentVersion;
|
|
}
|
|
void setOsUpdateVersion(const std::string &value);
|
|
|
|
private:
|
|
bool refreshMenuWindow();
|
|
void activeSimChanged(std::string value);
|
|
void handleLowBatteryNotification(manager::actions::ActionParamsPtr &&data);
|
|
void osUpdateVersionChanged(const std::string &value);
|
|
void osCurrentVersionChanged(const std::string &value);
|
|
std::string osUpdateVersion{updateos::initSysVer};
|
|
std::string osCurrentVersion{updateos::initSysVer};
|
|
DBNotificationsHandler dbNotificationHandler;
|
|
};
|
|
|
|
template <> struct ManifestTraits<ApplicationDesktop>
|
|
{
|
|
static auto GetManifest() -> manager::ApplicationManifest
|
|
{
|
|
return {{manager::actions::Launch,
|
|
manager::actions::AutoLock,
|
|
manager::actions::RequestPin,
|
|
manager::actions::RequestPuk,
|
|
manager::actions::RequestPinChange,
|
|
manager::actions::RequestPinDisable,
|
|
manager::actions::RequestPinEnable,
|
|
manager::actions::UnlockSim,
|
|
manager::actions::BlockSim,
|
|
manager::actions::ShowMMIResponse,
|
|
manager::actions::ShowMMIPush,
|
|
manager::actions::ShowMMIResult,
|
|
manager::actions::DisplayCMEError,
|
|
manager::actions::DisplayLowBatteryScreen,
|
|
manager::actions::SystemBrownout,
|
|
manager::actions::DisplayLogoAtExit,
|
|
manager::actions::PhoneModeChanged,
|
|
manager::actions::NotificationsChanged}};
|
|
}
|
|
};
|
|
|
|
} /* namespace app */
|