~aleteoryx/muditaos

1fb38b3c3337fdf0ef882592df207419cdb99315 — Pawel Olejniczak 5 years ago 84c9902
[EGD-6144] Fix bluetooth settings window after changing phone visibility

Bluetooth settings window was displayed incorrectly after
changing phone visibility.
M module-apps/application-settings-new/ApplicationSettings.cpp => module-apps/application-settings-new/ApplicationSettings.cpp +0 -21
@@ 325,27 325,6 @@ namespace app
            ::settings::SystemProperties::lockPassHash,
            [this](const std::string &value) { lockPassHash = utils::getNumericValue<unsigned int>(value); },
            ::settings::SettingsScope::Global);
        settings->registerValueChange(
            ::settings::Bluetooth::state,
            [this](const std::string &value) {
                if (gui::window::name::bluetooth == getCurrentWindow()->getName()) {
                    const auto isBtOn = utils::getNumericValue<bool>(value);
                    auto btStatusData = std::make_unique<gui::BluetoothStatusData>(
                        isBtOn ? BluetoothStatus::State::On : BluetoothStatus::State::Off);
                    switchWindow(gui::window::name::bluetooth, std::move(btStatusData));
                }
            },
            ::settings::SettingsScope::Global);
        settings->registerValueChange(
            ::settings::Bluetooth::deviceVisibility,
            [this](const std::string &value) {
                if (gui::window::name::bluetooth == getCurrentWindow()->getName()) {
                    const auto isVisible = utils::getNumericValue<bool>(value);
                    auto btStatusData    = std::make_unique<gui::BluetoothStatusData>(isVisible);
                    switchWindow(gui::window::name::bluetooth, std::move(btStatusData));
                }
            },
            ::settings::SettingsScope::Global);

        /*
        settings->registerValueChange(

M module-apps/application-settings-new/models/BluetoothSettingsModel.cpp => module-apps/application-settings-new/models/BluetoothSettingsModel.cpp +8 -10
@@ 60,27 60,25 @@ void BluetoothSettingsModel::stopScan()
                                 service::name::bluetooth);
}

void BluetoothSettingsModel::requestDevicePair(std::string addr)
void BluetoothSettingsModel::requestDevicePair(const std::string &addr)
{
    application->bus.sendUnicast(std::make_shared<BluetoothPairMessage>(std::move(addr)), service::name::bluetooth);
    application->bus.sendUnicast(std::make_shared<BluetoothPairMessage>(addr), service::name::bluetooth);
}

void BluetoothSettingsModel::requestDeviceUnpair(std::string addr)
void BluetoothSettingsModel::requestDeviceUnpair(const std::string &addr)
{
    application->bus.sendUnicast(std::make_shared<message::bluetooth::Unpair>(std::move(addr)),
                                 service::name::bluetooth);
    application->bus.sendUnicast(std::make_shared<message::bluetooth::Unpair>(addr), service::name::bluetooth);
}

void BluetoothSettingsModel::responsePasskey(std::string passkey)
void BluetoothSettingsModel::responsePasskey(const std::string &passkey)
{
    application->bus.sendUnicast(std::make_shared<message::bluetooth::ResponsePasskey>(std::move(passkey)),
    application->bus.sendUnicast(std::make_shared<message::bluetooth::ResponsePasskey>(passkey),
                                 service::name::bluetooth);
}

void BluetoothSettingsModel::requestConnection(std::string addr)
void BluetoothSettingsModel::requestConnection(const std::string &addr)
{
    application->bus.sendUnicast(std::make_shared<message::bluetooth::Connect>(std::move(addr)),
                                 service::name::bluetooth);
    application->bus.sendUnicast(std::make_shared<message::bluetooth::Connect>(addr), service::name::bluetooth);
}

void BluetoothSettingsModel::requestDisconnection()

M module-apps/application-settings-new/models/BluetoothSettingsModel.hpp => module-apps/application-settings-new/models/BluetoothSettingsModel.hpp +4 -4
@@ 22,10 22,10 @@ class BluetoothSettingsModel
    void requestBondedDevices();
    void requestScan();
    void stopScan();
    void requestDevicePair(std::string addr);
    void requestDeviceUnpair(std::string addr);
    void responsePasskey(std::string passkey);
    void requestConnection(std::string addr);
    void requestDevicePair(const std::string &addr);
    void requestDeviceUnpair(const std::string &addr);
    void responsePasskey(const std::string &passkey);
    void requestConnection(const std::string &addr);
    void requestDisconnection();

  private: