~aleteoryx/muditaos

fe61ede5ede43c50aafd6e9c64679e3a23e9b99f — Maciej-Mudita 3 years ago f6342a8
[MOS-836] Fix for selecting SIM during onboarding

After inserting the SIM tray at the onboarding stage
before selecting the slot - it is not possible to select
the slot and activate the desired SIM card if it does not
have a PIN enabled.
M module-apps/application-settings/windows/network/SimCardsWindow.cpp => module-apps/application-settings/windows/network/SimCardsWindow.cpp +37 -15
@@ 41,21 41,26 @@ namespace gui
            break;
        }

        switch (simState) {
        case Store::GSM::SIM::SIM1:
        case Store::GSM::SIM::SIM2:
            optList = createListWithActiveSim(selectedSim, simStr, phoneNumber);
            break;
        case Store::GSM::SIM::SIM_NEED_PIN:
        case Store::GSM::SIM::SIM_NEED_PUK:
        case Store::GSM::SIM::SIM_LOCKED:
            optList = createListWithBlockedSim(selectedSim, simStr);
            break;
        case Store::GSM::SIM::NONE:
        case Store::GSM::SIM::SIM_FAIL:
        case Store::GSM::SIM::SIM_UNKNOWN:
            optList = createListWithNoConnectedSim(selectedSim, simStr);
            break;
        if (selectedSim == Store::GSM::SelectedSIM::NONE) {
            optList = createListWithNoSelectedSim(selectedSim, simStr);
        }
        else {
            switch (simState) {
            case Store::GSM::SIM::SIM1:
            case Store::GSM::SIM::SIM2:
                optList = createListWithActiveSim(selectedSim, simStr, phoneNumber);
                break;
            case Store::GSM::SIM::SIM_NEED_PIN:
            case Store::GSM::SIM::SIM_NEED_PUK:
            case Store::GSM::SIM::SIM_LOCKED:
                optList = createListWithBlockedSim(selectedSim, simStr);
                break;
            case Store::GSM::SIM::NONE:
            case Store::GSM::SIM::SIM_FAIL:
            case Store::GSM::SIM::SIM_UNKNOWN:
                optList = createListWithNoConnectedSim(selectedSim, simStr);
                break;
            }
        }

        navBar->setText(nav_bar::Side::Center, utils::translate(style::strings::common::select));


@@ 148,6 153,23 @@ namespace gui
        return optList;
    }

    std::list<gui::Option> SimCardsWindow::createListWithNoSelectedSim(const Store::GSM::SelectedSIM sim,
                                                                       const std::string &simStr)
    {
        std::list<gui::Option> optList;
        optList.emplace_back(std::make_unique<gui::option::OptionSettings>(
            utils::translate("app_settings_network_active_card"),
            [=](gui::Item &item) { return createSwitchSimAction(sim); },
            [=](gui::Item &item) { return createNavBarText(item); },
            this,
            gui::option::SettingRightItem::Text,
            false,
            simStr,
            true));

        return optList;
    }

    bool SimCardsWindow::createSwitchSimAction(const Store::GSM::SelectedSIM selectedSim) const
    {
        selectedSim == Store::GSM::SelectedSIM::SIM1 ? simParams->setSelectedSim(Store::GSM::SelectedSIM::SIM2)

M module-apps/application-settings/windows/network/SimCardsWindow.hpp => module-apps/application-settings/windows/network/SimCardsWindow.hpp +2 -0
@@ 21,6 21,8 @@ namespace gui

        std::list<gui::Option> createListWithNoConnectedSim(const Store::GSM::SelectedSIM sim,
                                                            const std::string &simStr);
        std::list<gui::Option> createListWithNoSelectedSim(const Store::GSM::SelectedSIM sim,
                                                           const std::string &simStr);
        std::list<gui::Option> createListWithBlockedSim(const Store::GSM::SelectedSIM sim, const std::string &simStr);
        std::list<gui::Option> createListWithActiveSim(const Store::GSM::SelectedSIM sim,
                                                       const std::string &simStr,

M module-apps/apps-common/locks/handlers/SimLockHandler.cpp => module-apps/apps-common/locks/handlers/SimLockHandler.cpp +7 -4
@@ 40,10 40,13 @@ namespace locks

    void SimLockHandler::simInputRequiredAction()
    {
        app::manager::Controller::sendAction(
            owner,
            app::manager::actions::ShowPopup,
            std::make_unique<gui::SimUnlockInputRequestParams>(gui::popup::ID::SimLock, lock, simInputTypeAction));
        // If the SIM card is not selected yet, we do not show the pop-up
        if (Store::GSM::get()->selected != Store::GSM::SelectedSIM::NONE) {
            app::manager::Controller::sendAction(
                owner,
                app::manager::actions::ShowPopup,
                std::make_unique<gui::SimUnlockInputRequestParams>(gui::popup::ID::SimLock, lock, simInputTypeAction));
        }
    }

    void SimLockHandler::simErrorAction(unsigned int errorCode)

M pure_changelog.md => pure_changelog.md +1 -0
@@ 44,6 44,7 @@
* Fixed screen lock during onboarding
* Fixed displayed device name when connected to Windows
* Fixed redundant modem polling for call states
* Fixed selecting SIM during onboarding

### Added
* Added a popup for changing the SIM card