~aleteoryx/muditaos

ref: f94d7f63679e4fb1702495eb136b7596b3cbfc36 muditaos/module-apps/application-desktop/include/application-desktop/ApplicationDesktop.hpp -rw-r--r-- 2.9 KiB
f94d7f63 — Kuba Kleczkowski [MOS-636] Added MMI/USSD confirmation 2 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#pragma once

#include "Constants.hpp"
#include "DBNotificationsHandler.hpp"
#include "Names.hpp"

#include <Application.hpp>
#include <service-desktop/DesktopMessages.hpp>
#include <Service/Message.hpp>

namespace gui
{
    class NotificationsModel;
}

namespace app
{
    class ApplicationDesktop : public Application, public AsyncCallbackReceiver
    {
      public:
        explicit ApplicationDesktop(std::string name                    = name_desktop,
                                    std::string parent                  = {},
                                    StatusIndicators statusIndicators   = StatusIndicators{},
                                    StartInBackground startInBackground = {false});

        sys::MessagePointer DataReceivedHandler(sys::DataMessage *msgl, sys::ResponseMessage *resp) override;
        sys::ReturnCodes InitHandler() 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
        void handleNotificationsChanged(std::unique_ptr<gui::SwitchData> notificationsParams) override;

        void setOsUpdateVersion(const std::string &value);

      private:
        bool refreshMenuWindow();
        void handleLowBatteryNotification(manager::actions::ActionParamsPtr &&data);
        DBNotificationsHandler dbNotificationHandler;
        sys::MessagePointer handleAsyncResponse(sys::ResponseMessage *resp) override;
        bool blockAllPopups = false;
    };

    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::ShowMMIConfirmation,
                     manager::actions::DisplayLowBatteryScreen,
                     manager::actions::SystemBrownout,
                     manager::actions::DisplayLogoAtExit,
                     manager::actions::DisplayChargeAtExit,
                     manager::actions::PhoneModeChanged,
                     manager::actions::BluetoothModeChanged,
                     manager::actions::NotificationsChanged,
                     manager::actions::AlarmClockStatusChanged,
                     manager::actions::TetheringStateChanged}};
        }
    };

} /* namespace app */