~aleteoryx/muditaos

813a92e670a827e8b2d0d1d0142c791293de30c2 — Lucjan Bryndza 4 years ago 515026f
[EGD-8013] Fix tethering popup show when no SIMCARD

Fix tethering mode popup show when no simcard
is selected. It'll works in the onBoarding and
normal mode

Signed-off-by: Lucjan Bryndza <lucjan.bryndza@mudita.com>
M module-apps/application-onboarding/ApplicationOnBoarding.cpp => module-apps/application-onboarding/ApplicationOnBoarding.cpp +0 -1
@@ 169,7 169,6 @@ namespace app
        });

        attachPopups({gui::popup::ID::Volume,
                      gui::popup::ID::Tethering,
                      gui::popup::ID::PhoneModes,
                      gui::popup::ID::PhoneLock,
                      gui::popup::ID::SimLock,

M module-sys/PhoneModes/Subject.cpp => module-sys/PhoneModes/Subject.cpp +2 -2
@@ 12,7 12,7 @@

namespace sys::phone_modes
{
    Subject::Subject(Service *owner) : owner{owner}
    Subject::Subject(Service *owner, std::function<bool()> simSelect) : owner{owner}, simSelected{simSelect}
    {
        if (owner == nullptr) {
            throw std::invalid_argument{"Subject's owner is invalid"};


@@ 80,6 80,6 @@ namespace sys::phone_modes

    bool Subject::isTetheringPossible() const noexcept
    {
        return phoneMode != PhoneMode::Offline;
        return (phoneMode != PhoneMode::Offline) && (simSelected && simSelected());
    }
} // namespace sys::phone_modes

M module-sys/PhoneModes/include/PhoneModes/Subject.hpp => module-sys/PhoneModes/include/PhoneModes/Subject.hpp +3 -1
@@ 4,6 4,7 @@
#pragma once

#include "Common.hpp"
#include <functional>

namespace sys
{


@@ 15,7 16,7 @@ namespace sys::phone_modes
    class Subject
    {
      public:
        explicit Subject(Service *owner);
        Subject(Service *owner, std::function<bool()> simSelect);

        /**
         * Sets phone and tethering modes


@@ 52,5 53,6 @@ namespace sys::phone_modes
        Service *owner;
        PhoneMode phoneMode     = PhoneMode::Connected;
        Tethering tetheringMode = Tethering::Off;
        const std::function<bool()> simSelected;
    };
} // namespace sys::phone_modes

M products/PurePhone/sys/SystemManager.cpp => products/PurePhone/sys/SystemManager.cpp +5 -1
@@ 31,7 31,11 @@ namespace sys

    void SystemManager::StartSystem(InitFunction sysInit, InitFunction appSpaceInit, DeinitFunction sysDeinit)
    {
        phoneModeSubject = std::make_unique<phone_modes::Subject>(this);
        auto simSelected = []() {
            return (Store::GSM::get()->selected == Store::GSM::SIM::SIM1 ||
                    Store::GSM::get()->selected == Store::GSM::SIM::SIM2);
        };
        phoneModeSubject = std::make_unique<phone_modes::Subject>(this, simSelected);
        SystemManagerCommon::StartSystem(std::move(sysInit), std::move(appSpaceInit), std::move(sysDeinit));
    }