Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unused events #2123

Merged
merged 2 commits into from
Nov 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 0 additions & 64 deletions atomic_defi_design/Dex/Dashboard/NotificationsModal.qml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +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 batchFailedNotification: "onBatchFailed"

readonly property string check_internet_connection_text: qsTr("Please check your internet connection (e.g. VPN service or firewall might block it).")

Expand Down Expand Up @@ -182,10 +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)
case batchFailedNotification:
return qsTr("Batch %1 failed. Reason: %2").arg(notification.params.from).arg(notification.params.reason)
}
}

Expand All @@ -205,10 +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)
case batchFailedNotification:
return notification.params.reason
}
}

Expand Down Expand Up @@ -301,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(
Expand Down Expand Up @@ -361,37 +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)
}

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)
Expand All @@ -400,8 +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)
API.app.notification_mgr.batchFailed.connect(onBatchFailed)
}

Component.onDestruction:
Expand All @@ -412,8 +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)
API.app.notification_mgr.batchFailed.disconnect(onBatchFailed)
}

SystemTrayIcon
Expand Down Expand Up @@ -622,9 +567,6 @@ DexPopup
case enablingCoinFailedStatusNotification:
name = "repeat"
break
case mismatchCustomCoinConfigurationNotification:
name = "restart-alert"
break
default:
name = "check"
break
Expand Down Expand Up @@ -653,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
Expand Down
11 changes: 0 additions & 11 deletions src/core/atomicdex/events/events.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,17 +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;
};

struct endpoint_nonreacheable
{
std::string base_uri;
Expand Down
21 changes: 0 additions & 21 deletions src/core/atomicdex/managers/notification.manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,28 +37,24 @@ namespace atomic_dex
void
notification_manager::connect_signals()
{
m_dispatcher.sink<batch_failed>().connect<&notification_manager::on_batch_failed>(*this);
m_dispatcher.sink<swap_status_notification>().connect<&notification_manager::on_swap_status_notification>(*this);
m_dispatcher.sink<balance_update_notification>().connect<&notification_manager::on_balance_update_notification>(*this);
m_dispatcher.sink<enabling_z_coin_status>().connect<&notification_manager::on_enabling_z_coin_status>(*this);
m_dispatcher.sink<enabling_coin_failed>().connect<&notification_manager::on_enabling_coin_failed>(*this);
m_dispatcher.sink<disabling_coin_failed>().connect<&notification_manager::on_disabling_coin_failed>(*this);
m_dispatcher.sink<endpoint_nonreacheable>().connect<&notification_manager::on_endpoint_nonreacheable>(*this);
m_dispatcher.sink<mismatch_configuration_custom_coin>().connect<&notification_manager::on_mismatch_custom_coins_configuration>(*this);
m_dispatcher.sink<fatal_notification>().connect<&notification_manager::on_fatal_notification>(*this);
}

void
notification_manager::disconnect_signals()
{
m_dispatcher.sink<batch_failed>().disconnect<&notification_manager::on_batch_failed>(*this);
m_dispatcher.sink<swap_status_notification>().disconnect<&notification_manager::on_swap_status_notification>(*this);
m_dispatcher.sink<balance_update_notification>().disconnect<&notification_manager::on_balance_update_notification>(*this);
m_dispatcher.sink<enabling_coin_failed>().disconnect<&notification_manager::on_enabling_coin_failed>(*this);
m_dispatcher.sink<disabling_coin_failed>().disconnect<&notification_manager::on_disabling_coin_failed>(*this);
m_dispatcher.sink<enabling_z_coin_status>().disconnect<&notification_manager::on_enabling_z_coin_status>(*this);
m_dispatcher.sink<endpoint_nonreacheable>().disconnect<&notification_manager::on_endpoint_nonreacheable>(*this);
m_dispatcher.sink<mismatch_configuration_custom_coin>().disconnect<&notification_manager::on_mismatch_custom_coins_configuration>(*this);
m_dispatcher.sink<fatal_notification>().disconnect<&notification_manager::on_fatal_notification>(*this);
}

Expand Down Expand Up @@ -106,27 +102,10 @@ namespace atomic_dex
QString human_date = QString::fromStdString(utils::to_human_date<std::chrono::seconds>(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<seconds>(system_clock::now().time_since_epoch()).count();
QString human_date = QString::fromStdString(utils::to_human_date<std::chrono::seconds>(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)
{
emit fatalNotification(QString::fromStdString(evt.message));
}

void
notification_manager::on_batch_failed(const batch_failed& evt)
{
using namespace std::chrono;
qint64 timestamp = duration_cast<seconds>(system_clock::now().time_since_epoch()).count();
QString human_date = QString::fromStdString(utils::to_human_date<std::chrono::seconds>(timestamp, "%e %b %Y, %H:%M"));
emit batchFailed(QString::fromStdString(evt.reason), QString::fromStdString(evt.from), human_date, timestamp);
}
} // namespace atomic_dex
2 changes: 0 additions & 2 deletions src/core/atomicdex/managers/notification.manager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,12 @@ 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);
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:
Expand Down