~aleteoryx/muditaos

8e056fda939ce0c64826a30275e0b19127a6fb67 — Piotr Tański 4 years ago 30eeb36
[EGD-7205] Tethering can not be enabled in offline mode

The tethering should not be enabled in offline mode.
M module-sys/PhoneModes/Subject.cpp => module-sys/PhoneModes/Subject.cpp +5 -0
@@ 77,4 77,9 @@ namespace sys::phone_modes
    {
        return tetheringMode == Tethering::On;
    }

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

M module-sys/PhoneModes/include/PhoneModes/Subject.hpp => module-sys/PhoneModes/include/PhoneModes/Subject.hpp +2 -0
@@ 41,6 41,8 @@ namespace sys::phone_modes

        bool isTetheringEnabled() const noexcept;

        bool isTetheringPossible() const noexcept;

      private:
        bool changePhoneMode(PhoneMode mode) noexcept;
        void notifyPhoneModeChange();

M products/PurePhone/sys/SystemManager.cpp => products/PurePhone/sys/SystemManager.cpp +3 -1
@@ 106,7 106,9 @@ namespace sys
        }

        if (const auto requestedState = request->getTetheringState(); requestedState == phone_modes::Tethering::On) {
            bus.sendUnicast(std::make_shared<TetheringQuestionRequest>(), service::name::appmgr);
            if (phoneModeSubject->isTetheringPossible()) {
                bus.sendUnicast(std::make_shared<TetheringQuestionRequest>(), service::name::appmgr);
            }
        }
        else {
            if (const auto tetheringChanged = phoneModeSubject->setTetheringMode(phone_modes::Tethering::Off);