main: only update fiat price with open wallet

This commit is contained in:
selsta 2022-04-23 07:24:20 +02:00
parent b31cc36de2
commit 37a5bdc331
No known key found for this signature in database
GPG key ID: 2EA0A99A8B07AE5E
2 changed files with 3 additions and 22 deletions

View file

@ -1156,13 +1156,10 @@ ApplicationWindow {
Timer {
id: fiatPriceTimer
interval: 1000 * 60;
running: persistentSettings.fiatPriceEnabled;
running: persistentSettings.fiatPriceEnabled && currentWallet !== undefined
repeat: true
onTriggered: {
if(persistentSettings.fiatPriceEnabled)
appWindow.fiatApiRefresh();
}
triggeredOnStart: false
onTriggered: appWindow.fiatApiRefresh()
triggeredOnStart: true
}
function fiatApiParseTicker(url, resp, currency){
@ -1301,14 +1298,6 @@ ApplicationWindow {
leftPanel.balanceFiatString = bFiat;
}
function fiatTimerStart(){
fiatPriceTimer.start();
}
function fiatTimerStop(){
fiatPriceTimer.stop();
}
function fiatApiError(msg){
console.log("fiatPriceError: " + msg);
}
@ -1364,11 +1353,6 @@ ApplicationWindow {
openWallet("wizard");
}
if(persistentSettings.fiatPriceEnabled){
appWindow.fiatApiRefresh();
appWindow.fiatTimerStart();
}
const desktopEntryEnabled = (typeof builtWithDesktopEntry != "undefined") && builtWithDesktopEntry;
if (persistentSettings.askDesktopShortcut && !persistentSettings.portable && desktopEntryEnabled) {
persistentSettings.askDesktopShortcut = false;

View file

@ -165,7 +165,6 @@ Rectangle {
if (!checked) {
console.log("Disabled price conversion");
persistentSettings.fiatPriceEnabled = false;
appWindow.fiatTimerStop();
}
}
}
@ -232,8 +231,6 @@ Rectangle {
onClicked: {
console.log("Enabled price conversion");
persistentSettings.fiatPriceEnabled = true;
appWindow.fiatApiRefresh();
appWindow.fiatTimerStart();
}
}
}