From c5d7402692d71c8501e65b0fd87bf0b8fda71ec9 Mon Sep 17 00:00:00 2001 From: syl Date: Sat, 26 Nov 2022 10:05:35 +0100 Subject: [PATCH 1/2] Remove batch failed event references It is never triggered --- .../Dex/Dashboard/NotificationsModal.qml | 23 ------------------- src/core/atomicdex/events/events.hpp | 6 ----- .../managers/notification.manager.cpp | 11 --------- .../managers/notification.manager.hpp | 1 - 4 files changed, 41 deletions(-) diff --git a/atomic_defi_design/Dex/Dashboard/NotificationsModal.qml b/atomic_defi_design/Dex/Dashboard/NotificationsModal.qml index 0ab0902d52..69f8f60482 100644 --- a/atomic_defi_design/Dex/Dashboard/NotificationsModal.qml +++ b/atomic_defi_design/Dex/Dashboard/NotificationsModal.qml @@ -30,7 +30,6 @@ DexPopup readonly property string disablingCoinFailedStatus: "onDisablingCoinFailedStatus" readonly property string endpointNonReacheableStatus: "onEndpointNonReacheableStatus" readonly property string mismatchCustomCoinConfigurationNotification: "onMismatchCustomCoinConfiguration" - readonly property string batchFailedNotification: "onBatchFailed" readonly property string check_internet_connection_text: qsTr("Please check your internet connection (e.g. VPN service or firewall might block it).") @@ -184,8 +183,6 @@ DexPopup return qsTr("Endpoint not reachable") case mismatchCustomCoinConfigurationNotification: return qsTr("Mismatch at %1 custom asset configuration", "TICKER").arg(notification.params.asset) - case batchFailedNotification: - return qsTr("Batch %1 failed. Reason: %2").arg(notification.params.from).arg(notification.params.reason) } } @@ -207,8 +204,6 @@ DexPopup return notification.params.base_uri case mismatchCustomCoinConfigurationNotification: return qsTr("Application needs to be restarted for %1 custom asset.", "TICKER").arg(notification.params.asset) - case batchFailedNotification: - return notification.params.reason } } @@ -376,22 +371,6 @@ DexPopup toast.show(title, General.time_toast_important_error, "", true, true) } - function onBatchFailed(reason, from, human_date, timestamp) - { - newNotification( - batchFailedNotification, - { - human_date, - timestamp, - reason, - from - }, - timestamp, - human_date) - - toast.show(title, General.time_toast_important_error, reason) - } - Component.onCompleted: { API.app.notification_mgr.updateSwapStatus.connect(onUpdateSwapStatus) @@ -401,7 +380,6 @@ DexPopup API.app.notification_mgr.disablingCoinFailedStatus.connect(onDisablingCoinFailedStatus) API.app.notification_mgr.endpointNonReacheableStatus.connect(onEndpointNonReacheableStatus) API.app.notification_mgr.mismatchCustomCoinConfiguration.connect(onMismatchCustomCoinConfiguration) - API.app.notification_mgr.batchFailed.connect(onBatchFailed) } Component.onDestruction: @@ -413,7 +391,6 @@ DexPopup API.app.notification_mgr.disablingCoinFailedStatus.disconnect(onDisablingCoinFailedStatus) API.app.notification_mgr.endpointNonReacheableStatus.disconnect(onEndpointNonReacheableStatus) API.app.notification_mgr.mismatchCustomCoinConfiguration.disconnect(onMismatchCustomCoinConfiguration) - API.app.notification_mgr.batchFailed.disconnect(onBatchFailed) } SystemTrayIcon diff --git a/src/core/atomicdex/events/events.hpp b/src/core/atomicdex/events/events.hpp index 9f19cd0f7f..a2ab517a0c 100644 --- a/src/core/atomicdex/events/events.hpp +++ b/src/core/atomicdex/events/events.hpp @@ -68,12 +68,6 @@ namespace atomic_dex std::string reason; }; - struct batch_failed - { - std::string from; - std::string reason; - }; - struct mismatch_configuration_custom_coin { std::string coin; diff --git a/src/core/atomicdex/managers/notification.manager.cpp b/src/core/atomicdex/managers/notification.manager.cpp index b39c71c857..0f9a209192 100644 --- a/src/core/atomicdex/managers/notification.manager.cpp +++ b/src/core/atomicdex/managers/notification.manager.cpp @@ -37,7 +37,6 @@ namespace atomic_dex void notification_manager::connect_signals() { - m_dispatcher.sink().connect<¬ification_manager::on_batch_failed>(*this); m_dispatcher.sink().connect<¬ification_manager::on_swap_status_notification>(*this); m_dispatcher.sink().connect<¬ification_manager::on_balance_update_notification>(*this); m_dispatcher.sink().connect<¬ification_manager::on_enabling_z_coin_status>(*this); @@ -51,7 +50,6 @@ namespace atomic_dex void notification_manager::disconnect_signals() { - m_dispatcher.sink().disconnect<¬ification_manager::on_batch_failed>(*this); m_dispatcher.sink().disconnect<¬ification_manager::on_swap_status_notification>(*this); m_dispatcher.sink().disconnect<¬ification_manager::on_balance_update_notification>(*this); m_dispatcher.sink().disconnect<¬ification_manager::on_enabling_coin_failed>(*this); @@ -120,13 +118,4 @@ namespace atomic_dex { emit fatalNotification(QString::fromStdString(evt.message)); } - - void - notification_manager::on_batch_failed(const batch_failed& evt) - { - using namespace std::chrono; - qint64 timestamp = duration_cast(system_clock::now().time_since_epoch()).count(); - QString human_date = QString::fromStdString(utils::to_human_date(timestamp, "%e %b %Y, %H:%M")); - emit batchFailed(QString::fromStdString(evt.reason), QString::fromStdString(evt.from), human_date, timestamp); - } } // namespace atomic_dex diff --git a/src/core/atomicdex/managers/notification.manager.hpp b/src/core/atomicdex/managers/notification.manager.hpp index a9c01ecd87..657e642139 100644 --- a/src/core/atomicdex/managers/notification.manager.hpp +++ b/src/core/atomicdex/managers/notification.manager.hpp @@ -40,7 +40,6 @@ namespace atomic_dex void disconnect_signals() ; //! Callbacks - void on_batch_failed(const batch_failed& evt);; void on_swap_status_notification(const swap_status_notification& evt); void on_enabling_z_coin_status(const enabling_z_coin_status& evt); void on_enabling_coin_failed(const enabling_coin_failed& evt); From a84ec965b3635a1cc0a60ded9b8020ace9fa26c9 Mon Sep 17 00:00:00 2001 From: syl Date: Sat, 26 Nov 2022 10:08:00 +0100 Subject: [PATCH 2/2] Remove mismatch custom coin config event It's never triggered --- .../Dex/Dashboard/NotificationsModal.qml | 41 ------------------- src/core/atomicdex/events/events.hpp | 5 --- .../managers/notification.manager.cpp | 10 ----- .../managers/notification.manager.hpp | 1 - 4 files changed, 57 deletions(-) diff --git a/atomic_defi_design/Dex/Dashboard/NotificationsModal.qml b/atomic_defi_design/Dex/Dashboard/NotificationsModal.qml index 69f8f60482..c6d8fa9e79 100644 --- a/atomic_defi_design/Dex/Dashboard/NotificationsModal.qml +++ b/atomic_defi_design/Dex/Dashboard/NotificationsModal.qml @@ -29,7 +29,6 @@ DexPopup readonly property string enablingCoinFailedStatusNotification: "onEnablingCoinFailedStatus" readonly property string disablingCoinFailedStatus: "onDisablingCoinFailedStatus" readonly property string endpointNonReacheableStatus: "onEndpointNonReacheableStatus" - readonly property string mismatchCustomCoinConfigurationNotification: "onMismatchCustomCoinConfiguration" readonly property string check_internet_connection_text: qsTr("Please check your internet connection (e.g. VPN service or firewall might block it).") @@ -181,8 +180,6 @@ DexPopup return qsTr("Failed to disable %1", "TICKER").arg(notification.params.coin) case endpointNonReacheableStatus: return qsTr("Endpoint not reachable") - case mismatchCustomCoinConfigurationNotification: - return qsTr("Mismatch at %1 custom asset configuration", "TICKER").arg(notification.params.asset) } } @@ -202,8 +199,6 @@ DexPopup return "" case endpointNonReacheableStatus: return notification.params.base_uri - case mismatchCustomCoinConfigurationNotification: - return qsTr("Application needs to be restarted for %1 custom asset.", "TICKER").arg(notification.params.asset) } } @@ -296,16 +291,6 @@ DexPopup return } - // Check if there is mismatch error, ignore this one - for (let n of notifications_list) - { - if (n.event_name === mismatchCustomCoinConfigurationNotification && n.params.asset === coin) - { - console.trace() - return - } - } - error = check_internet_connection_text + "\n\n" + error newNotification( @@ -356,21 +341,6 @@ DexPopup toast.show(qsTr("Endpoint not reachable"), General.time_toast_important_error, error) } - function onMismatchCustomCoinConfiguration(asset, human_date, timestamp) - { - newNotification( - mismatchCustomCoinConfigurationNotification, - { - asset, - human_date, - timestamp - }, - timestamp, - human_date) - - toast.show(title, General.time_toast_important_error, "", true, true) - } - Component.onCompleted: { API.app.notification_mgr.updateSwapStatus.connect(onUpdateSwapStatus) @@ -379,7 +349,6 @@ DexPopup API.app.notification_mgr.enablingCoinFailedStatus.connect(onEnablingCoinFailedStatus) API.app.notification_mgr.disablingCoinFailedStatus.connect(onDisablingCoinFailedStatus) API.app.notification_mgr.endpointNonReacheableStatus.connect(onEndpointNonReacheableStatus) - API.app.notification_mgr.mismatchCustomCoinConfiguration.connect(onMismatchCustomCoinConfiguration) } Component.onDestruction: @@ -390,7 +359,6 @@ DexPopup API.app.notification_mgr.enablingCoinFailedStatus.disconnect(onEnablingCoinFailedStatus) API.app.notification_mgr.disablingCoinFailedStatus.disconnect(onDisablingCoinFailedStatus) API.app.notification_mgr.endpointNonReacheableStatus.disconnect(onEndpointNonReacheableStatus) - API.app.notification_mgr.mismatchCustomCoinConfiguration.disconnect(onMismatchCustomCoinConfiguration) } SystemTrayIcon @@ -599,9 +567,6 @@ DexPopup case enablingCoinFailedStatusNotification: name = "repeat" break - case mismatchCustomCoinConfigurationNotification: - name = "restart-alert" - break default: name = "check" break @@ -630,12 +595,6 @@ DexPopup API.app.enable_coins([event_before_removal.params.coin]) break - case mismatchCustomCoinConfigurationNotification: - console.log("Restarting for", event_before_removal.params.asset, "custom asset configuration mismatch...") - root.close() - restart_modal.open() - break - default: removeNotification() break diff --git a/src/core/atomicdex/events/events.hpp b/src/core/atomicdex/events/events.hpp index a2ab517a0c..084e39b9f5 100644 --- a/src/core/atomicdex/events/events.hpp +++ b/src/core/atomicdex/events/events.hpp @@ -68,11 +68,6 @@ namespace atomic_dex std::string reason; }; - struct mismatch_configuration_custom_coin - { - std::string coin; - }; - struct endpoint_nonreacheable { std::string base_uri; diff --git a/src/core/atomicdex/managers/notification.manager.cpp b/src/core/atomicdex/managers/notification.manager.cpp index 0f9a209192..e57fb22971 100644 --- a/src/core/atomicdex/managers/notification.manager.cpp +++ b/src/core/atomicdex/managers/notification.manager.cpp @@ -43,7 +43,6 @@ namespace atomic_dex m_dispatcher.sink().connect<¬ification_manager::on_enabling_coin_failed>(*this); m_dispatcher.sink().connect<¬ification_manager::on_disabling_coin_failed>(*this); m_dispatcher.sink().connect<¬ification_manager::on_endpoint_nonreacheable>(*this); - m_dispatcher.sink().connect<¬ification_manager::on_mismatch_custom_coins_configuration>(*this); m_dispatcher.sink().connect<¬ification_manager::on_fatal_notification>(*this); } @@ -56,7 +55,6 @@ namespace atomic_dex m_dispatcher.sink().disconnect<¬ification_manager::on_disabling_coin_failed>(*this); m_dispatcher.sink().disconnect<¬ification_manager::on_enabling_z_coin_status>(*this); m_dispatcher.sink().disconnect<¬ification_manager::on_endpoint_nonreacheable>(*this); - m_dispatcher.sink().disconnect<¬ification_manager::on_mismatch_custom_coins_configuration>(*this); m_dispatcher.sink().disconnect<¬ification_manager::on_fatal_notification>(*this); } @@ -104,14 +102,6 @@ namespace atomic_dex QString human_date = QString::fromStdString(utils::to_human_date(timestamp, "%e %b %Y, %H:%M")); emit endpointNonReacheableStatus(QString::fromStdString(evt.base_uri), human_date, timestamp); } - void - notification_manager::on_mismatch_custom_coins_configuration(const mismatch_configuration_custom_coin& evt) - { - using namespace std::chrono; - qint64 timestamp = duration_cast(system_clock::now().time_since_epoch()).count(); - QString human_date = QString::fromStdString(utils::to_human_date(timestamp, "%e %b %Y, %H:%M")); - emit mismatchCustomCoinConfiguration(QString::fromStdString(evt.coin), human_date, timestamp); - } void notification_manager::on_fatal_notification(const fatal_notification& evt) diff --git a/src/core/atomicdex/managers/notification.manager.hpp b/src/core/atomicdex/managers/notification.manager.hpp index 657e642139..a6c201cf4f 100644 --- a/src/core/atomicdex/managers/notification.manager.hpp +++ b/src/core/atomicdex/managers/notification.manager.hpp @@ -46,7 +46,6 @@ namespace atomic_dex void on_disabling_coin_failed(const disabling_coin_failed& evt); void on_balance_update_notification(const balance_update_notification& evt); void on_endpoint_nonreacheable(const endpoint_nonreacheable& evt); - void on_mismatch_custom_coins_configuration(const mismatch_configuration_custom_coin& evt); void on_fatal_notification(const fatal_notification& evt); signals: