~aleteoryx/muditaos

1c96ab62e177f00be6c0f01f19f79e9e36131847 — Marcin Zieliński 3 years ago bc6eda4
[MOS-821] Adjust VoLTE GUI basing on operator

When VoLTE isn't permitted for the current SIM
card's operator, display information only.
Otherwise, display a switch.
M image/assets/lang/Deutsch.json => image/assets/lang/Deutsch.json +1 -0
@@ 469,6 469,7 @@
  "app_settings_about": "Über Mudita Pure",
  "app_settings_title_languages": "Sprachauswahl",
  "app_settings_network_sim_cards": "SIM-Karten",
  "app_settings_network_volte_not_available": "not available",
  "app_settings_network_active_card": "Aktiver Slot",
  "app_settings_network_unblock_card": "Entsperren Karte",
  "app_settings_network_not_connected": "keine Karte",

M image/assets/lang/English.json => image/assets/lang/English.json +1 -0
@@ 426,6 426,7 @@
  "app_settings_about": "About Mudita Pure",
  "app_settings_title_languages": "Language selection",
  "app_settings_network_sim_cards": "SIM cards",
  "app_settings_network_volte_not_available": "not available",
  "app_settings_network_active_card": "Active slot",
  "app_settings_network_unblock_card": "Unblock card",
  "app_settings_network_not_connected": "no card",

M image/assets/lang/Espanol.json => image/assets/lang/Espanol.json +1 -0
@@ 469,6 469,7 @@
  "app_settings_about": "Sobre Mudita Pure",
  "app_settings_title_languages": "Selección de idioma",
  "app_settings_network_sim_cards": "Tarjetas SIM",
  "app_settings_network_volte_not_available": "not available",
  "app_settings_network_active_card": "Toma activa",
  "app_settings_network_unblock_card": "Desbloquear la tarjeta",
  "app_settings_network_not_connected": "sin tarjeta",

M image/assets/lang/Francais.json => image/assets/lang/Francais.json +1 -0
@@ 437,6 437,7 @@
  "app_settings_about": "À propos de Mudita Pure",
  "app_settings_title_languages": "Sélection de langue",
  "app_settings_network_sim_cards": "Cartes SIM",
  "app_settings_network_volte_not_available": "not available",
  "app_settings_network_active_card": "Fente active",
  "app_settings_network_unblock_card": "Débloquer la carte",
  "app_settings_network_not_connected": "pas de carte",

M image/assets/lang/Polski.json => image/assets/lang/Polski.json +1 -0
@@ 480,6 480,7 @@
  "app_settings_about": "O Mudita Pure",
  "app_settings_title_languages": "Wybór języka",
  "app_settings_network_sim_cards": "Karty SIM",
  "app_settings_network_volte_not_available": "niedostępne",
  "app_settings_network_active_card": "Aktywny slot",
  "app_settings_network_unblock_card": "Odblokuj kartę",
  "app_settings_network_not_connected": "brak karty",

M image/assets/lang/Svenska.json => image/assets/lang/Svenska.json +1 -0
@@ 377,6 377,7 @@
  "app_settings_about": "Om Mudita Pure",
  "app_settings_title_languages": "Språkval",
  "app_settings_network_sim_cards": "SIM-kort",
  "app_settings_network_volte_not_available": "not available",
  "app_settings_network_active_card": "Aktivt slot",
  "app_settings_network_unblock_card": "Avblockera kort",
  "app_settings_network_not_connected": "inget kort",

M module-apps/application-settings/include/application-settings/ApplicationSettings.hpp => module-apps/application-settings/include/application-settings/ApplicationSettings.hpp +1 -1
@@ 205,7 205,7 @@ namespace app
        bool callsFromFavorites                                        = false;
        int connectionFrequency                                        = 0;
        bool flightModeOn                                              = true;
        cellular::VolteState volteState{cellular::VolteState::Undefined};
        cellular::VolteState volteState;
        std::shared_ptr<BluetoothSettingsModel> bluetoothSettingsModel = nullptr;
    };


M module-apps/application-settings/windows/network/NetworkWindow.cpp => module-apps/application-settings/windows/network/NetworkWindow.cpp +44 -12
@@ 8,6 8,15 @@
#include <OptionSetting.hpp>
#include <widgets/ButtonTriState.hpp>

namespace
{
    cellular::VolteState getVolteStateFromSettingsApp(app::ApplicationCommon *application)
    {
        auto const *settingsApp = static_cast<app::ApplicationSettings *>(application);
        return settingsApp->getVolteState();
    }
} // namespace

namespace gui
{
    NetworkWindow::NetworkWindow(app::ApplicationCommon *app,


@@ 24,6 33,8 @@ namespace gui

    auto NetworkWindow::buildOptionsList() -> std::list<gui::Option>
    {
        using namespace cellular;

        std::list<gui::Option> optList;

        optList.emplace_back(std::make_unique<gui::option::OptionSettings>(


@@ 38,14 49,29 @@ namespace gui
            false));

        optList.emplace_back(std::make_unique<gui::option::OptionSettings>(
            utils::translate("app_settings_network_voice_over_lte"),
            [&](gui::Item &item) {
            [this]() {
                auto ret              = utils::translate("app_settings_network_voice_over_lte");
                const auto volteState = getVolteStateFromSettingsApp(application);
                if (!volteState.permitted) {
                    if (volteState.enablement == VolteState::Enablement::On) {
                        LOG_ERROR("[VoLTE] still enabled in modem despite not permitted by operator");
                    }
                    ret += ": ";
                    ret += utils::translate("app_settings_network_volte_not_available");
                }
                return ret;
            }(),
            [this](gui::Item &item) {
                const auto volteState = getVolteStateFromSettingsApp(application);
                if (!volteState.permitted) {
                    return true;
                }
                auto *settingsApp = static_cast<app::ApplicationSettings *>(application);
                switch (settingsApp->getVolteState()) {
                case cellular::VolteState::Off:
                switch (volteState.enablement) {
                case VolteState::Enablement::Off:
                    settingsApp->sendVolteChangeRequest(true);
                    break;
                case cellular::VolteState::On:
                case VolteState::Enablement::On:
                    settingsApp->sendVolteChangeRequest(false);
                    break;
                default:


@@ 55,18 81,24 @@ namespace gui
                return true;
            },
            [&](Item &item) {
                auto navBarCaption =
                    (item.focus) ? utils::translate("common_switch") : utils::translate("common_select");
                navBar->setText(nav_bar::Side::Center, navBarCaption);
                navBar->setText(nav_bar::Side::Center, [&]() {
                    if (!item.focus) {
                        return utils::translate("common_select");
                    }
                    return getVolteStateFromSettingsApp(application).permitted ? utils::translate("common_switch") : "";
                }());
                return true;
            },
            nullptr,
            [&]() {
                auto const *settingsApp = static_cast<app::ApplicationSettings *>(application);
                switch (settingsApp->getVolteState()) {
                case cellular::VolteState::Off:
                const auto volteState = getVolteStateFromSettingsApp(application);
                if (!volteState.permitted) {
                    return option::SettingRightItem::Disabled;
                }
                switch (volteState.enablement) {
                case VolteState::Enablement::Off:
                    return option::SettingRightItem::Off;
                case cellular::VolteState::On:
                case VolteState::Enablement::On:
                    return option::SettingRightItem::On;
                default:
                    return option::SettingRightItem::Transiting;

M module-services/service-cellular/service-cellular/VolteState.hpp => module-services/service-cellular/service-cellular/VolteState.hpp +10 -6
@@ 5,12 5,16 @@

namespace cellular
{
    enum class VolteState
    struct VolteState
    {
        On,
        Off,
        SwitchingToOff,
        SwitchingToOn,
        Undefined
        enum class Enablement
        {
            On,
            Off,
            SwitchingToOff,
            SwitchingToOn,
            Undefined
        } enablement   = Enablement::Undefined;
        bool permitted = true;
    };
}

M module-services/service-cellular/src/VolteHandler.hpp => module-services/service-cellular/src/VolteHandler.hpp +7 -5
@@ 90,15 90,17 @@ namespace cellular::service
                                             " IMS");
                }

                volteState = enable ? cellular::VolteState::SwitchingToOn : cellular::VolteState::SwitchingToOff;
                volteState.enablement = enable ? cellular::VolteState::Enablement::SwitchingToOn
                                               : cellular::VolteState::Enablement::SwitchingToOff;
                isFirstRunAfterSwitch = false;
            }
            else {
                if (volteState == cellular::VolteState::SwitchingToOn ||
                    volteState == cellular::VolteState::SwitchingToOff) {
                if (volteState.enablement == cellular::VolteState::Enablement::SwitchingToOn ||
                    volteState.enablement == cellular::VolteState::Enablement::SwitchingToOff) {
                    isFirstRunAfterSwitch = true;
                }
                volteState = enable ? cellular::VolteState::On : cellular::VolteState::Off;
                volteState.enablement =
                    enable ? cellular::VolteState::Enablement::On : cellular::VolteState::Enablement::Off;
            }

            return alreadyConfigured;


@@ 161,7 163,7 @@ namespace cellular::service
            return std::to_string(magic_enum::enum_integer(imsState));
        }

        cellular::VolteState volteState = cellular::VolteState::Undefined;
        cellular::VolteState volteState;
        bool isFirstRunAfterSwitch      = false;
    };
} // namespace cellular::service