Browse Source

Disable price feed by default

Also prevent price fetching when disabled. As far as I can tell,
disabling the price feed never worked. The option for disabling
the price feed was only used in rendering the GUI checkbox for price
fetching, but the price feed requests would always happen.
pull/112/head
Duke 1 year ago
parent
commit
f9f88c6a66
  1. 7
      src/rpc.cpp
  2. 3
      src/settings.cpp

7
src/rpc.cpp

@ -1363,6 +1363,12 @@ void RPC::refreshPrice() {
if (conn == nullptr)
return noConnection();
auto s = Settings::getInstance();
if (s->getAllowFetchPrices() == false) {
qDebug() << "Price fetching disabled";
return;
}
QString price_feed = "https://api.coingecko.com/api/v3/simple/price?ids=hush&vs_currencies=btc%2Cusd%2Ceur%2Ceth%2Cgbp%2Ccny%2Cjpy%2Cidr%2Crub%2Ccad%2Csgd%2Cchf%2Cinr%2Caud%2Cinr%2Ckrw%2Cthb%2Cnzd%2Czar%2Cvef%2Cxau%2Cxag%2Cvnd%2Csar%2Ctwd%2Caed%2Cars%2Cbdt%2Cbhd%2Cbmd%2Cbrl%2Cclp%2Cczk%2Cdkk%2Chuf%2Cils%2Ckwd%2Clkr%2Cpkr%2Cnok%2Ctry%2Csek%2Cmxn%2Cuah%2Chkd&include_market_cap=true&include_24hr_vol=true&include_24hr_change=true";
qDebug() << "Requesting price feed data via " << price_feed;
@ -1376,7 +1382,6 @@ void RPC::refreshPrice() {
QNetworkReply *reply = conn->restclient->get(req);
qDebug() << "Created QNetworkReply";
auto s = Settings::getInstance();
QObject::connect(reply, &QNetworkReply::finished, [=] {
reply->deleteLater();

3
src/settings.cpp

@ -25,7 +25,8 @@ void Settings::setCheckForUpdates(bool allow) {
}
bool Settings::getAllowFetchPrices() {
return QSettings().value("options/allowfetchprices", true).toBool();
// now defaults to OFF, used to be ON
return QSettings().value("options/allowfetchprices", false).toBool();
}
void Settings::setAllowFetchPrices(bool allow) {

Loading…
Cancel
Save