~aleteoryx/muditaos

77faaaec7f332fa97d7af4c0d96f60f109c07001 — Pawel Olejniczak 4 years ago def5dbc
[EGD-6024] Return to All Devices window after attempt to retry action

Execution of retry pairing/unpairing/connecting took too long
to wait for it on retry popup. Fixed minor bugs.
M image/assets/lang/English.json => image/assets/lang/English.json +4 -4
@@ 324,10 324,10 @@
  "app_settings_bluetooth_phone_name": "Phone name",
  "app_settings_bluetooth_phone_visibility": "Phone visibility",
  "app_settings_bluetooth_enter_passkey": "Enter passkey:",
  "app_settings_bluetooth_init_error_message": "<text font='gt_pressura' weight='regular' size='27'>Bluetooth initialization process \nhas failed. </text> <text font='gt_pressura' weight='bold' size='27'>TRY AGAIN.</text>",
  "app_settings_bluetooth_pairing_error_message": "<text font='gt_pressura' weight='regular' size='27'>Pairing process with</text> <text font='gt_pressura' weight='bold' size='27'>%NAME</text>\n<text font='gt_pressura' weight='regular' size='27'>has failed. Check the device\nand</text> <text font='gt_pressura' weight='bold' size='27'>TRY AGAIN.</text>",
  "app_settings_bluetooth_unpairing_error_message": "<text font='gt_pressura' weight='regular' size='27'>Unpairing process has failed.\nCheck the device and</text> <text font='gt_pressura' weight='bold' size='27'>TRY AGAIN.</text>",
  "app_settings_bluetooth_connecting_error_message": "<text font='gt_pressura' weight='regular' size='27'>Connection process has failed.\nCheck the device and</text> <text font='gt_pressura' weight='bold' size='27'>TRY AGAIN.</text>",
  "app_settings_bluetooth_init_error_message": "<text font='gt_pressura' weight='regular' size='27'>Bluetooth initialization process has failed. </text> <text font='gt_pressura' weight='bold' size='27'>TRY AGAIN.</text>",
  "app_settings_bluetooth_pairing_error_message": "<text font='gt_pressura' weight='regular' size='27'>Pairing process has failed. Check the device and</text> <text font='gt_pressura' weight='bold' size='27'>TRY AGAIN.</text>",
  "app_settings_bluetooth_unpairing_error_message": "<text font='gt_pressura' weight='regular' size='27'>Unpairing process has failed. Check the device and</text> <text font='gt_pressura' weight='bold' size='27'>TRY AGAIN.</text>",
  "app_settings_bluetooth_connecting_error_message": "<text font='gt_pressura' weight='regular' size='27'>Connection process has failed. Check the device and</text> <text font='gt_pressura' weight='bold' size='27'>TRY AGAIN.</text>",
  "app_settings_net": "Network",
  "app_settings_disp_key": "Display and keypad",
  "app_settings_display_display_light": "Display light",

M module-apps/application-settings-new/ApplicationSettings.cpp => module-apps/application-settings-new/ApplicationSettings.cpp +17 -13
@@ 185,19 185,21 @@ namespace app
                                service::name::bluetooth);
                return sys::MessageNone{};
            }
            auto addr                       = bluetoothPairResultMsg->getAddr();
            const std::string toReplace     = "%NAME";
            std::string pairingErrorMessage = utils::localize.get("app_settings_bluetooth_pairing_error_message");
            pairingErrorMessage.replace(
                pairingErrorMessage.find(toReplace), toReplace.size(), bluetoothPairResultMsg->getName());
            switchWindow(
                gui::window::name::dialog_retry,
                gui::ShowMode::GUI_SHOW_INIT,
                std::make_unique<gui::DialogMetadataMessage>(gui::DialogMetadata{
                    utils::localize.get("app_settings_bt"), "search_big", pairingErrorMessage, "", [=]() -> bool {
                        bus.sendUnicast(std::make_shared<BluetoothPairMessage>(addr), service::name::bluetooth);
                        return true;
                    }}));
            auto addr = bluetoothPairResultMsg->getAddr();
            switchWindow(gui::window::name::dialog_retry,
                         gui::ShowMode::GUI_SHOW_INIT,
                         std::make_unique<gui::DialogMetadataMessage>(
                             gui::DialogMetadata{utils::localize.get("app_settings_bt"),
                                                 "search_big",
                                                 utils::localize.get("app_settings_bluetooth_pairing_error_message"),
                                                 "",
                                                 [=]() -> bool {
                                                     bus.sendUnicast(std::make_shared<BluetoothPairMessage>(addr),
                                                                     service::name::bluetooth);

                                                     returnToPreviousWindow();
                                                     return true;
                                                 }}));

            return sys::MessageNone{};
        });


@@ 224,6 226,7 @@ namespace app
                                                 [=]() -> bool {
                                                     bus.sendUnicast(std::make_shared<message::bluetooth::Unpair>(addr),
                                                                     service::name::bluetooth);
                                                     returnToPreviousWindow();
                                                     return true;
                                                 }}));
            return sys::MessageNone{};


@@ 247,6 250,7 @@ namespace app
                             [=]() -> bool {
                                 bus.sendUnicast(std::make_shared<message::bluetooth::Connect>(addr),
                                                 service::name::bluetooth);
                                 returnToPreviousWindow();
                                 return true;
                             }}));


M module-bluetooth/Bluetooth/interface/profiles/GAP/GAP.cpp => module-bluetooth/Bluetooth/interface/profiles/GAP/GAP.cpp +2 -2
@@ 199,9 199,9 @@ namespace bluetooth
    void GAP::processDedicatedBondingCompleted(std::uint8_t *packet, bd_addr_t &addr)
    {
        auto result = packet[2];
        auto name   = std::string{reinterpret_cast<const char *>(&packet[9])};

        auto msg =
            std::make_shared<BluetoothPairResultMessage>(currentlyProcessedDeviceAddr, std::move(name), result == 0u);
            std::make_shared<BluetoothPairResultMessage>(currentlyProcessedDeviceAddr, std::string{}, result == 0u);
        currentlyProcessedDeviceAddr.clear();
        ownerService->bus.sendUnicast(std::move(msg), "ApplicationSettingsNew");
    }

M module-services/service-bluetooth/ServiceBluetooth.cpp => module-services/service-bluetooth/ServiceBluetooth.cpp +0 -2
@@ 150,8 150,6 @@ sys::ReturnCodes ServiceBluetooth::InitHandler()
        bd_addr_t addr;
        sscanf_bd_addr(addrString.c_str(), addr);
        sendWorkerCommand(bluetooth::Command(bluetooth::Command::Type::ConnectAudio, addr));
        bus.sendUnicast(std::make_shared<message::bluetooth::ConnectResult>(addrString, true),
                        service::name::bluetooth);
        return sys::MessageNone{};
    });


M module-services/service-bluetooth/service-bluetooth/messages/Connect.hpp => module-services/service-bluetooth/service-bluetooth/messages/Connect.hpp +2 -2
@@ 12,7 12,7 @@ namespace message::bluetooth
      public:
        explicit Connect(std::string addr) : addr(std::move(addr))
        {}
        [[nodiscard]] auto getAddr() const noexcept -> std::string
        [[nodiscard]] auto getAddr() const -> std::string
        {
            return addr;
        }


@@ 26,7 26,7 @@ namespace message::bluetooth
      public:
        explicit ConnectResult(std::string addr, bool succeed) : addr(std::move(addr)), succeed(succeed)
        {}
        [[nodiscard]] auto getAddr() const noexcept -> std::string
        [[nodiscard]] auto getAddr() const -> std::string
        {
            return addr;
        }

M module-services/service-bluetooth/service-bluetooth/messages/DeviceName.hpp => module-services/service-bluetooth/service-bluetooth/messages/DeviceName.hpp +1 -1
@@ 15,7 15,7 @@ namespace message::bluetooth
      public:
        explicit ResponseDeviceName(std::string name) : name(std::move(name))
        {}
        [[nodiscard]] auto getName() const noexcept -> std::string
        [[nodiscard]] auto getName() const -> std::string
        {
            return name;
        }

M module-services/service-bluetooth/service-bluetooth/messages/Passkey.hpp => module-services/service-bluetooth/service-bluetooth/messages/Passkey.hpp +1 -1
@@ 15,7 15,7 @@ namespace message::bluetooth
      public:
        explicit ResponsePasskey(std::string passkey) : passkey(std::move(passkey))
        {}
        [[nodiscard]] auto getPasskey() const noexcept -> std::string
        [[nodiscard]] auto getPasskey() const -> std::string
        {
            return passkey;
        }

M module-services/service-bluetooth/service-bluetooth/messages/SetDeviceName.hpp => module-services/service-bluetooth/service-bluetooth/messages/SetDeviceName.hpp +1 -1
@@ 13,7 13,7 @@ namespace message::bluetooth
      public:
        explicit SetDeviceName(std::string name) : name(std::move(name))
        {}
        [[nodiscard]] auto getName() const noexcept -> std::string
        [[nodiscard]] auto getName() const -> std::string
        {
            return name;
        }

M module-services/service-bluetooth/service-bluetooth/messages/Unpair.hpp => module-services/service-bluetooth/service-bluetooth/messages/Unpair.hpp +1 -1
@@ 26,7 26,7 @@ namespace message::bluetooth
      public:
        explicit UnpairResult(std::string addr, bool succeed) : addr(std::move(addr)), succeed(succeed)
        {}
        [[nodiscard]] auto getAddr() const noexcept -> std::string
        [[nodiscard]] auto getAddr() const -> std::string
        {
            return addr;
        }