mirror of
https://github.com/feather-wallet/feather.git
synced 2025-01-03 17:39:49 +00:00
plugins: localmonero: fix ws notifier
This commit is contained in:
parent
650bdd2370
commit
de5642011e
3 changed files with 11 additions and 12 deletions
|
@ -42,9 +42,17 @@ LocalMoneroWidget::LocalMoneroWidget(QWidget *parent, Wallet *wallet)
|
||||||
connect(m_api, &LocalMoneroApi::ApiResponse, this, &LocalMoneroWidget::onApiResponse);
|
connect(m_api, &LocalMoneroApi::ApiResponse, this, &LocalMoneroWidget::onApiResponse);
|
||||||
connect(ui->btn_loadMore, &QPushButton::clicked, this, &LocalMoneroWidget::onLoadMore);
|
connect(ui->btn_loadMore, &QPushButton::clicked, this, &LocalMoneroWidget::onLoadMore);
|
||||||
|
|
||||||
connect(websocketNotifier(), &WebsocketNotifier::LocalMoneroCountriesReceived, this, &LocalMoneroWidget::onWsCountriesReceived);
|
connect(websocketNotifier(), &WebsocketNotifier::dataReceived, this, [this](const QString& type, const QJsonValue& json) {
|
||||||
connect(websocketNotifier(), &WebsocketNotifier::LocalMoneroCurrenciesReceived, this, &LocalMoneroWidget::onWsCurrenciesReceived);
|
if (type == "localmonero_countries") {
|
||||||
connect(websocketNotifier(), &WebsocketNotifier::LocalMoneroPaymentMethodsReceived, this, &LocalMoneroWidget::onWsPaymentMethodsReceived);
|
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);
|
connect(ui->combo_currency, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &LocalMoneroWidget::updatePaymentMethods);
|
||||||
|
|
||||||
|
|
|
@ -109,10 +109,6 @@ void WebsocketNotifier::onWSUpdates(const QJsonObject &updates) {
|
||||||
emit UpdatesReceived(updates);
|
emit UpdatesReceived(updates);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebsocketNotifier::onWSXMRigDownloads(const QJsonObject &downloads) {
|
|
||||||
emit XMRigDownloadsReceived(downloads);
|
|
||||||
}
|
|
||||||
|
|
||||||
WebsocketNotifier* WebsocketNotifier::instance()
|
WebsocketNotifier* WebsocketNotifier::instance()
|
||||||
{
|
{
|
||||||
if (!m_instance) {
|
if (!m_instance) {
|
||||||
|
|
|
@ -34,10 +34,6 @@ signals:
|
||||||
void FiatRatesReceived(const QJsonObject &fiat_rates);
|
void FiatRatesReceived(const QJsonObject &fiat_rates);
|
||||||
void TxFiatHistoryReceived(const QJsonObject &data);
|
void TxFiatHistoryReceived(const QJsonObject &data);
|
||||||
void UpdatesReceived(const QJsonObject &updates);
|
void UpdatesReceived(const QJsonObject &updates);
|
||||||
void XMRigDownloadsReceived(const QJsonObject &downloads);
|
|
||||||
void LocalMoneroCountriesReceived(const QJsonArray &countries);
|
|
||||||
void LocalMoneroCurrenciesReceived(const QJsonArray ¤cies);
|
|
||||||
void LocalMoneroPaymentMethodsReceived(const QJsonObject &payment_methods);
|
|
||||||
void dataReceived(const QString &type, const QJsonValue &json);
|
void dataReceived(const QString &type, const QJsonValue &json);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
@ -45,7 +41,6 @@ private slots:
|
||||||
|
|
||||||
void onWSNodes(const QJsonArray &nodes);
|
void onWSNodes(const QJsonArray &nodes);
|
||||||
void onWSUpdates(const QJsonObject &updates);
|
void onWSUpdates(const QJsonObject &updates);
|
||||||
void onWSXMRigDownloads(const QJsonObject &downloads);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static QPointer<WebsocketNotifier> m_instance;
|
static QPointer<WebsocketNotifier> m_instance;
|
||||||
|
|
Loading…
Reference in a new issue