]> Nutra Git (v2) - gamesguru/feather.git/commitdiff
plugins: localmonero: fix ws notifier
authortobtoht <tob@featherwallet.org>
Tue, 12 Dec 2023 16:18:13 +0000 (17:18 +0100)
committertobtoht <tob@featherwallet.org>
Tue, 12 Dec 2023 16:18:13 +0000 (17:18 +0100)
src/plugins/localmonero/LocalMoneroWidget.cpp
src/utils/WebsocketNotifier.cpp
src/utils/WebsocketNotifier.h

index cc97404217cf1caec8374e87e4d4227327d083fd..2b5dad3c6dcc48c69da6b34bba195fdabaf21761 100644 (file)
@@ -42,9 +42,17 @@ LocalMoneroWidget::LocalMoneroWidget(QWidget *parent, Wallet *wallet)
     connect(m_api, &LocalMoneroApi::ApiResponse, this, &LocalMoneroWidget::onApiResponse);
     connect(ui->btn_loadMore, &QPushButton::clicked, this, &LocalMoneroWidget::onLoadMore);
 
-    connect(websocketNotifier(), &WebsocketNotifier::LocalMoneroCountriesReceived, this, &LocalMoneroWidget::onWsCountriesReceived);
-    connect(websocketNotifier(), &WebsocketNotifier::LocalMoneroCurrenciesReceived, this, &LocalMoneroWidget::onWsCurrenciesReceived);
-    connect(websocketNotifier(), &WebsocketNotifier::LocalMoneroPaymentMethodsReceived, this, &LocalMoneroWidget::onWsPaymentMethodsReceived);
+    connect(websocketNotifier(), &WebsocketNotifier::dataReceived, this, [this](const QString& type, const QJsonValue& json) {
+        if (type == "localmonero_countries") {
+            this->onWsCountriesReceived(json.toArray());
+        }
+        else if (type == "localmonero_currencies") {
+            this->onWsCurrenciesReceived(json.toArray());
+        }
+        else if (type == "localmonero_payment_methods") {
+            this->onWsPaymentMethodsReceived(json.toObject());
+        }
+    });
 
     connect(ui->combo_currency, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &LocalMoneroWidget::updatePaymentMethods);
 
index 8f18d70d8a90d1b8e605a13bfd14b4eace4037d5..c58e26b56c40e72f72fc47545811152b99a413cf 100644 (file)
@@ -109,10 +109,6 @@ void WebsocketNotifier::onWSUpdates(const QJsonObject &updates) {
     emit UpdatesReceived(updates);
 }
 
-void WebsocketNotifier::onWSXMRigDownloads(const QJsonObject &downloads) {
-    emit XMRigDownloadsReceived(downloads);
-}
-
 WebsocketNotifier* WebsocketNotifier::instance()
 {
     if (!m_instance) {
index 34c9fd90343822fbf5266e0519cd2f229949345e..5795299c383f56ad1483e24977a2ef5418f65c27 100644 (file)
@@ -34,10 +34,6 @@ signals:
     void FiatRatesReceived(const QJsonObject &fiat_rates);
     void TxFiatHistoryReceived(const QJsonObject &data);
     void UpdatesReceived(const QJsonObject &updates);
-    void XMRigDownloadsReceived(const QJsonObject &downloads);
-    void LocalMoneroCountriesReceived(const QJsonArray &countries);
-    void LocalMoneroCurrenciesReceived(const QJsonArray &currencies);
-    void LocalMoneroPaymentMethodsReceived(const QJsonObject &payment_methods);
     void dataReceived(const QString &type, const QJsonValue &json);
 
 private slots:
@@ -45,7 +41,6 @@ private slots:
 
     void onWSNodes(const QJsonArray &nodes);
     void onWSUpdates(const QJsonObject &updates);
-    void onWSXMRigDownloads(const QJsonObject &downloads);
 
 private:
     static QPointer<WebsocketNotifier> m_instance;