// SPDX-License-Identifier: BSD-3-Clause // Copyright (c) 2020-2021, The Monero Project. #ifndef FEATHER_WEBSOCKETNOTIFIER_H #define FEATHER_WEBSOCKETNOTIFIER_H #include #include #include "WebsocketClient.h" #include "networktype.h" #include "nodes.h" #include "prices.h" #include "widgets/RedditPost.h" #include "widgets/CCSEntry.h" #include "txfiathistory.h" class WebsocketNotifier : public QObject { Q_OBJECT public: explicit WebsocketNotifier(QObject *parent); QMap heights; WebsocketClient websocketClient; static WebsocketNotifier* instance(); void emitCache(); signals: void BlockHeightsReceived(int mainnet, int stagenet); void NodesReceived(QList &L); void CryptoRatesReceived(const QJsonArray &data); void FiatRatesReceived(const QJsonObject &fiat_rates); void RedditReceived(QList> L); void CCSReceived(QList> L); void TxFiatHistoryReceived(const QJsonObject &data); 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); private slots: void onWSMessage(const QJsonObject &msg); void onWSNodes(const QJsonArray &nodes); void onWSReddit(const QJsonArray &reddit_data); void onWSCCS(const QJsonArray &ccs_data); void onWSUpdates(const QJsonObject &updates); void onWSXMRigDownloads(const QJsonObject &downloads); private: static QPointer m_instance; QHash m_cache; }; inline WebsocketNotifier* websocketNotifier() { return WebsocketNotifier::instance(); } #endif //FEATHER_WEBSOCKETNOTIFIER_H