Files
MuditaOS/module-apps/application-desktop/ApplicationDesktop.hpp
Przemyslaw Brudny bc737e93f6 [EGD-5885] Added SimLockHandler
Refactored LockWindow TitleBar handling. Added Sim pin request
block on lockedPhone. Added Sim info popup added when pin
changed. Updated assets. Removed old PinLock structures.
Cleared LockBox structures. Removed old settings sim setters.
New CellularMessage adaptation. Cleared Lock structure.
2021-05-26 20:09:33 +02:00

87 lines
3.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 "windows/Names.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:
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 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::ShowMMIResponse,
manager::actions::ShowMMIPush,
manager::actions::ShowMMIResult,
manager::actions::DisplayLowBatteryScreen,
manager::actions::SystemBrownout,
manager::actions::DisplayLogoAtExit,
manager::actions::PhoneModeChanged,
manager::actions::NotificationsChanged}};
}
};
} /* namespace app */