// 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 #include #include #include #include #include "Constants.hpp" namespace gui { // fw declarations class OptionWindow; class Text; } // namespace gui namespace app { class ApplicationMessages : public app::Application, public app::AsyncCallbackReceiver { public: explicit ApplicationMessages(std::string name = name_messages, 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 SwitchPowerModeHandler(const sys::ServicePowerMode mode) override final { return sys::ReturnCodes::Success; } void createUserInterface() override; void destroyUserInterface() override; bool removeSms(const SMSRecord &record); bool removeSmsThread(const ThreadRecord *record); bool markSmsThreadAsRead(const uint32_t id); bool markSmsThreadAsUnread(const uint32_t id); /// show dialog with big search icon and text which was used for query bool searchEmpty(const std::string &query = ""); bool showSearchResults(const UTF8 &title, const UTF8 &search_text); bool sendSms(const utils::PhoneNumber::View &number, const UTF8 &body); bool resendSms(const SMSRecord &record); bool newMessageOptions(const std::string &requestingWindow, gui::Text *text); bool showNotification(std::function action, const std::string ¬ification, bool ignoreCurrentWindowOnStack = false); bool handleSendSmsFromThread(const utils::PhoneNumber::View &number, const UTF8 &body); std::pair createDraft(const utils::PhoneNumber::View &number, const UTF8 &body); bool updateDraft(SMSRecord &record, const UTF8 &body); bool removeDraft(const SMSRecord &record); bool onRemoveSmsThreadConfirmed(const ThreadRecord &record); bool onRemoveSmsConfirmed(const SMSRecord &record); // used by sms template items std::function templ)> templatesCallback; }; template <> struct ManifestTraits { static auto GetManifest() -> manager::ApplicationManifest { return {{manager::actions::Launch, manager::actions::CreateSms, manager::actions::ShowSmsTemplates, manager::actions::SmsRejectNoSim, manager::actions::SMSRejectedByOfflineNotification, manager::actions::PhoneModeChanged}}; } }; } /* namespace app */