From ab0a7356d2bf7e61fb5bb12177c6177ad03e0fab Mon Sep 17 00:00:00 2001 From: Taegus Date: Mon, 31 Dec 2018 09:51:43 +0100 Subject: [PATCH] + indicators for future use ! check for error in syncing - consoloe.log line --- assets/styles/indicators.css | 35 +++++++++++++++++++++++++++ index.html | 1 + renderer/maingui.js | 1 - renderer/syncing.js | 46 +++++++++++++++++++----------------- 4 files changed, 60 insertions(+), 23 deletions(-) create mode 100644 assets/styles/indicators.css diff --git a/assets/styles/indicators.css b/assets/styles/indicators.css new file mode 100644 index 0000000..4173ccb --- /dev/null +++ b/assets/styles/indicators.css @@ -0,0 +1,35 @@ +.led-red { + margin: 20px auto; + width: 12px; + height: 12px; + background-color: #940; + border-radius: 50%; + box-shadow: #000 0 -1px 7px 1px, inset #600 0 -1px 9px, #F00 0 2px 12px; +} + +.led-yellow { + margin: 20px auto; + width: 12px; + height: 12px; + background-color: #A90; + border-radius: 50%; + box-shadow: #000 0 -1px 7px 1px, inset #660 0 -1px 9px, #DD0 0 2px 12px; +} + +.led-green { + margin: 20px auto; + width: 12px; + height: 12px; + background-color: #690; + border-radius: 50%; + box-shadow: #000 0 -1px 7px 1px, inset #460 0 -1px 9px, #7D0 0 2px 12px; +} + +.led-blue { + margin: 20px auto; + width: 12px; + height: 12px; + background-color: #4AB; + border-radius: 50%; + box-shadow: #000 0 -1px 7px 1px, inset #006 0 -1px 9px, #06F 0 2px 14px; +} \ No newline at end of file diff --git a/index.html b/index.html index e94f26a..98fb80f 100644 --- a/index.html +++ b/index.html @@ -10,6 +10,7 @@ + diff --git a/renderer/maingui.js b/renderer/maingui.js index 26b667c..765d9b5 100644 --- a/renderer/maingui.js +++ b/renderer/maingui.js @@ -55,7 +55,6 @@ class MainGUI { $("#btnGeneralConfirmYes").click(function() { $('#dlgGeneralConfirm').iziModal('close'); - console.log(true); callback(true); }); diff --git a/renderer/syncing.js b/renderer/syncing.js index 3902a70..9b8fe67 100644 --- a/renderer/syncing.js +++ b/renderer/syncing.js @@ -50,29 +50,31 @@ function StartSyncProcess() { } nodeSyncInterval = setInterval(function() - { + { web3Local.eth.getBlock("latest", function(error, localBlock) { - if (localBlock.number > 0) { - if (!EthoTransactions.getIsSyncing()) { - SyncProgress.animate(1); - SyncProgress.setText(vsprintf('%d/%d (100%%)', [localBlock.number, localBlock.number])); - } - - if (alreadyCatchedUp == false) - { - // clear the repeat interval and render wallets - $(document).trigger("onNewAccountTransaction"); - alreadyCatchedUp = true; - isFullySynced = true; - - // enable the keep in sync feature - EthoTransactions.enableKeepInSync(); - // sync all the transactions to the current block - EthoTransactions.syncTransactionsForAllAddresses(localBlock.number); - - // signal that the sync is complete - $(document).trigger("onSyncComplete"); - } + if (!error) { + if (localBlock.number > 0) { + if (!EthoTransactions.getIsSyncing()) { + SyncProgress.animate(1); + SyncProgress.setText(vsprintf('%d/%d (100%%)', [localBlock.number, localBlock.number])); + } + + if (alreadyCatchedUp == false) + { + // clear the repeat interval and render wallets + $(document).trigger("onNewAccountTransaction"); + alreadyCatchedUp = true; + isFullySynced = true; + + // enable the keep in sync feature + EthoTransactions.enableKeepInSync(); + // sync all the transactions to the current block + EthoTransactions.syncTransactionsForAllAddresses(localBlock.number); + + // signal that the sync is complete + $(document).trigger("onSyncComplete"); + } + } } }); }, 10000);