~aleteoryx/muditaos

d403db410172588d80e7f926cb63d29afc97b966 — Lefucjusz 2 years ago 06d1639
[MOS-1027] Fix lack of tethering icon on 'Tethering is on' popup

Fix of the issue that pressing menu button while
in tethering resulted in LTE and no signal icons
appear on status bar instead of tethering icon.
M module-apps/application-desktop/ApplicationDesktop.cpp => module-apps/application-desktop/ApplicationDesktop.cpp +5 -3
@@ 15,6 15,7 @@
#include <apps-common/messages/AppMessage.hpp>
#include <module-gui/gui/widgets/status-bar/SIM.hpp>
#include <popups/TetheringOffPopup.hpp>
#include <popups/TetheringMenuPopup.hpp>
#include <service-appmgr/Controller.hpp>
#include <service-db/DBNotificationMessage.hpp>
#include <system/messages/SystemManagerMessage.hpp>


@@ 166,9 167,10 @@ namespace app
        windowsFactory.attach(desktop_mmi_internal, [](ApplicationCommon *app, const std::string newname) {
            return std::make_unique<gui::MmiInternalMsgWindow>(app, desktop_mmi_internal);
        });
        windowsFactory.attach(gui::window::name::dialog_confirm, [](ApplicationCommon *app, const std::string &name) {
            return std::make_unique<gui::DialogConfirm>(app, name);
        });
        windowsFactory.attach(gui::popup::window::tethering_menu_window,
                              [](ApplicationCommon *app, const std::string &name) {
                                  return std::make_unique<gui::TetheringMenuPopup>(app, name);
                              });
        windowsFactory.attach(
            gui::popup::window::tethering_off_window, [](ApplicationCommon *app, const std::string &name) {
                return std::make_unique<gui::TetheringOffPopup>(app, gui::popup::window::tethering_off_window);

M module-apps/application-desktop/CMakeLists.txt => module-apps/application-desktop/CMakeLists.txt +0 -1
@@ 19,7 19,6 @@ target_include_directories(application-desktop
target_sources(application-desktop
	PRIVATE
		ApplicationDesktop.cpp
		data/DesktopData.hpp
		data/Mmi.hpp
		models/ActiveNotificationsListPresenter.cpp
		models/ActiveNotificationsListPresenter.hpp

D module-apps/application-desktop/data/DesktopData.hpp => module-apps/application-desktop/data/DesktopData.hpp +0 -30
@@ 1,30 0,0 @@
// 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 <gui/SwitchData.hpp>
#include <service-desktop/DesktopMessages.hpp>

#include <filesystem>
#include <utility>

namespace gui
{
    class CurrentOsVersion : public gui::SwitchData
    {
        std::string osVersion;

      public:
        [[nodiscard]] std::string getCurrentOsVersion() const
        {
            return osVersion;
        }

        void setData(std::string version)
        {
            osVersion = std::move(version);
        }
    };

} // namespace gui

M module-apps/application-desktop/windows/DesktopMainWindow.cpp => module-apps/application-desktop/windows/DesktopMainWindow.cpp +3 -23
@@ 2,7 2,6 @@
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#include "ApplicationDesktop.hpp"
#include "DesktopData.hpp"
#include "DesktopMainWindow.hpp"

#include <application-call/data/CallSwitchData.hpp>


@@ 10,7 9,6 @@
#include <messages/DialogMetadataMessage.hpp>
#include <notifications/NotificationsModel.hpp>
#include <service-appmgr/Controller.hpp>
#include <service-time/ServiceTime.hpp>
#include <service-time/TimeMessage.hpp>
#include <time/time_conversion_factory.hpp>
#include <windows/Dialog.hpp>


@@ 31,12 29,7 @@ namespace gui

        activatedCallback = [this]([[maybe_unused]] Item &item) {
            if (notificationsModel->isTetheringOn()) {
                showInformationPopup(
                    [this]() {
                        app::manager::Controller::sendAction(application, app::manager::actions::Home);
                        return true;
                    },
                    utils::translate("tethering_menu_access_decline"));
                application->switchWindow(popup::window::tethering_menu_window);
            }
            else {
                application->switchWindow(app::window::name::desktop_menu);


@@ 219,26 212,13 @@ namespace gui
        return RefreshModes::GUI_REFRESH_FAST;
    }

    bool DesktopMainWindow::showInformationPopup(std::function<bool()> action, const std::string &notification)
    {
        DialogMetadata meta;
        meta.icon       = "info_128px_W_G";
        meta.text       = notification;
        meta.action     = std::move(action);
        auto switchData = std::make_unique<DialogMetadataMessage>(std::move(meta));
        application->switchWindow(window::name::dialog_confirm, std::move(switchData));
        return true;
    }

    bool DesktopMainWindow::resolveDialAction(const std::string &number)
    {
        if (notificationsModel->isTetheringOn()) {
            return false;
        }
        else {
            return app::manager::Controller::sendAction(
                application, app::manager::actions::Dial, std::make_unique<app::EnterNumberData>(number));
        }
        return app::manager::Controller::sendAction(
            application, app::manager::actions::Dial, std::make_unique<app::EnterNumberData>(number));
    }

} /* namespace gui */

M module-apps/application-desktop/windows/DesktopMainWindow.hpp => module-apps/application-desktop/windows/DesktopMainWindow.hpp +1 -2
@@ 1,4 1,4 @@
// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#pragma once


@@ 50,7 50,6 @@ namespace gui

      private:
        bool resolveDialAction(const std::string &number);
        bool showInformationPopup(std::function<bool()> action, const std::string &notification);

        gui::KeyInputMappedTranslation translator;
    };

M module-apps/apps-common/popups/CMakeLists.txt => module-apps/apps-common/popups/CMakeLists.txt +2 -2
@@ 5,7 5,6 @@ target_include_directories(apps-common
)

target_sources(apps-common

	PRIVATE
		HomeModesWindow.cpp
		Popups.cpp


@@ 15,6 14,7 @@ target_sources(apps-common
		TetheringNotificationPopup.cpp
		TetheringPhoneModePopup.cpp
		TetheringOffPopup.cpp
		TetheringMenuPopup.cpp
		BluetoothAuthenticatePopup.cpp
		BluetoothInfoPopup.cpp
		VolumeWindow.cpp


@@ 44,6 44,7 @@ target_sources(apps-common
		TetheringConfirmationPopup.hpp
		TetheringNotificationPopup.hpp
		TetheringPhoneModePopup.hpp
		TetheringMenuPopup.hpp
		BluetoothAuthenticatePopup.hpp
		BluetoothInfoPopup.hpp
		VolumeWindow.hpp


@@ 65,5 66,4 @@ target_sources(apps-common
		presenter/PowerOffPresenter.hpp
		presenter/QuotesPresenter.hpp
		presenter/WallpaperPresenter.hpp

)

M module-apps/apps-common/popups/Popups.hpp => module-apps/apps-common/popups/Popups.hpp +1 -0
@@ 44,6 44,7 @@ namespace gui
            inline constexpr auto tethering_confirmation_window     = "TetheringConfirmationPopup";
            inline constexpr auto tethering_phonemode_change_window = "TetheringPhoneModeChangeProhibitedPopup";
            inline constexpr auto tethering_off_window              = "TetheringOffPopup";
            inline constexpr auto tethering_menu_window             = "TetheringMenuPopup";
            inline constexpr auto bluetooth_authenticate            = "BluetoothAuthenticatePopup";
            inline constexpr auto bluetooth_info                    = "BluetoothInfoPopup";
            inline constexpr auto phone_lock_window                 = "PhoneLockPopup";

A module-apps/apps-common/popups/TetheringMenuPopup.cpp => module-apps/apps-common/popups/TetheringMenuPopup.cpp +27 -0
@@ 0,0 1,27 @@
// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#include "TetheringMenuPopup.hpp"
#include "DialogMetadataMessage.hpp"
#include "ApplicationCommon.hpp"

namespace gui
{
    TetheringMenuPopup::TetheringMenuPopup(app::ApplicationCommon *app, const std::string &name)
        : TetheringNotificationPopup{app, name}
    {}

    void TetheringMenuPopup::onBeforeShow(ShowMode mode, [[maybe_unused]] SwitchData *data)
    {
        DialogMetadata metadata = {.title  = "",
                                   .icon   = "info_128px_W_G",
                                   .text   = utils::translate("tethering_menu_access_decline"),
                                   .action = [this]() {
                                       application->returnToPreviousWindow();
                                       return true;
                                   }};

        const auto msg = std::make_unique<DialogMetadataMessage>(std::move(metadata));
        DialogConfirm::onBeforeShow(mode, msg.get());
    }
} // namespace gui

A module-apps/apps-common/popups/TetheringMenuPopup.hpp => module-apps/apps-common/popups/TetheringMenuPopup.hpp +18 -0
@@ 0,0 1,18 @@
// 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 <string>
#include "TetheringNotificationPopup.hpp"

namespace gui
{
    class TetheringMenuPopup : public TetheringNotificationPopup
    {
      public:
        TetheringMenuPopup(app::ApplicationCommon *app, const std::string &name);

        void onBeforeShow(ShowMode mode, SwitchData *data) override;
    };
} // namespace gui

M module-apps/apps-common/popups/TetheringOffPopup.cpp => module-apps/apps-common/popups/TetheringOffPopup.cpp +2 -5
@@ 3,11 3,9 @@

#include "TetheringOffPopup.hpp"

#include <log/log.hpp>
#include <messages/DialogMetadataMessage.hpp>
#include <apps-common/ApplicationCommon.hpp>
#include <system/messages/TetheringStateRequest.hpp>
#include <service-appmgr/Controller.hpp>

namespace gui
{


@@ 28,7 26,7 @@ namespace gui
        return appConfiguration;
    }

    void TetheringOffPopup::onBeforeShow(ShowMode mode, SwitchData *data)
    void TetheringOffPopup::onBeforeShow(ShowMode mode, [[maybe_unused]] SwitchData *data)
    {
        DialogMetadata metadata;
        metadata.action = [this]() {


@@ 40,8 38,7 @@ namespace gui
        metadata.title = utils::translate("tethering");
        metadata.text  = utils::translate("tethering_turn_off_question");
        metadata.icon  = "tethering_128px_W_G";
        auto msg       = std::make_unique<DialogMetadataMessage>(std::move(metadata));
        const auto msg = std::make_unique<DialogMetadataMessage>(std::move(metadata));
        DialogYesNo::onBeforeShow(mode, msg.get());
    }

} /* namespace gui */

M module-apps/apps-common/popups/TetheringPhoneModePopup.hpp => module-apps/apps-common/popups/TetheringPhoneModePopup.hpp +2 -2
@@ 1,4 1,4 @@
// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#pragma once


@@ 16,4 16,4 @@ namespace gui

        void onBeforeShow(ShowMode mode, SwitchData *data) override;
    };
}; // namespace gui
} // namespace gui

M module-apps/apps-common/windows/Dialog.cpp => module-apps/apps-common/windows/Dialog.cpp +5 -8
@@ 1,4 1,4 @@
// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#include "Dialog.hpp"


@@ 31,8 31,8 @@ void Dialog::onBeforeShow(ShowMode mode, SwitchData *data)
{
    if (auto metadata = dynamic_cast<DialogMetadataMessage *>(data); metadata != nullptr) {
        auto title = metadata->get().title;
        if (size_t crLfPos = title.find_first_of("\r\n"); crLfPos != title.npos) {
            auto lengthToReplace = title.size() - crLfPos;
        if (const auto crLfPos = title.find_first_of("\r\n"); crLfPos != title.npos) {
            const auto lengthToReplace = title.size() - crLfPos;
            title.replace(crLfPos, lengthToReplace, "...");
        }
        setTitle(title);


@@ 48,10 48,7 @@ DialogConfirm::DialogConfirm(app::ApplicationCommon *app, const std::string &nam
    navBar->setText(nav_bar::Side::Center, utils::translate(style::strings::common::ok));
    setFocusItem(icon);
    icon->inputCallback = [=](Item &, const InputEvent &inputEvent) -> bool {
        if (inputEvent.isShortRelease(gui::KeyCode::KEY_RF)) {
            return true;
        }
        return false;
        return inputEvent.isShortRelease(gui::KeyCode::KEY_RF);
    };
    setTitle("");
}


@@ 60,7 57,7 @@ void DialogConfirm::onBeforeShow(ShowMode mode, SwitchData *data)
{
    if (auto metadata = dynamic_cast<DialogMetadataMessage *>(data); metadata != nullptr) {
        Dialog::onBeforeShow(mode, metadata);
        auto foo                = metadata->get().action;
        const auto foo          = metadata->get().action;
        icon->activatedCallback = [foo](Item &) -> bool { return foo(); };
    }
}

M module-gui/gui/widgets/StatusBar.hpp => module-gui/gui/widgets/StatusBar.hpp +2 -2
@@ 1,4 1,4 @@
// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#pragma once


@@ 207,7 207,7 @@ namespace gui::status_bar
        bool updateNetworkAccessTechnology();

        /// Update tethering widget state depending on the current configuration
        bool updateTetheringState(const sys::phone_modes::Tethering state);
        bool updateTetheringState(sys::phone_modes::Tethering state);

        /// Accepts GuiVisitor to update the status bar
        void accept(GuiVisitor &visitor) override;

M pure_changelog.md => pure_changelog.md +1 -0
@@ 35,6 35,7 @@
* Fixed issue with bypassing phone lock window after unplugging USB cable on tethering popup
* Fixed Alarm disappearance during end of call window
* Fixed passcode behavior when blocked from Mudita Center
* Fixed missing tethering icon on "Tethering is on" window

## [1.7.2 2023-07-28]