diff --git a/apps/coin_info/README.md b/apps/coin_info/README.md index b16754da8..2d00a8030 100644 --- a/apps/coin_info/README.md +++ b/apps/coin_info/README.md @@ -1,6 +1,6 @@ # Crypto-Coin Info -Crypto-Coins Infos with the help of the Coinmarketcap API +Crypto-Coins Infos with the help of the Binance API ## Creator diff --git a/apps/coin_info/clkinfo.js b/apps/coin_info/clkinfo.js index fb95c89a9..43c51daa9 100644 --- a/apps/coin_info/clkinfo.js +++ b/apps/coin_info/clkinfo.js @@ -1,5 +1,7 @@ (function() { const LOAD_ICON_24 = atob("GBiBAAAAAAAeAAGfwAGB4AAAcBgAOBgYHAAYDAAYDGAYBmAYBgAYBgAYBmDbBmB+BgA8DAAYDBgAHBgAOAAAcAGB4AGfwAAeAAAAAA=="); + const DECR_ICON_24 = atob("GBiBAAAAAAAAAAAAAAAAAAAAABgAADwAAH4cAD8+AB//AA//gAf/wAPz7AHh/ADA/AAAfAAA/gAA/gAAHgAAAAAAAAAAAAAAAAAAAA=="); + const INCR_ICON_24 = atob("GBiBAAAAAAAAAAAAAAAAAAAAAAAAHgAA/gAA/gAAfADA/AHh/APz7Af/wA//gB//AD8+AH4cADwAABgAAAAAAAAAAAAAAAAAAAAAAA=="); const settings = require("Storage").readJSON("coin_info.settings.json", 1) || {}; const db = require("Storage").readJSON("coin_info.cmc_key.json", 1) || {}; @@ -35,14 +37,18 @@ Bangle.http(url, { method: 'GET' }) .then(cmcResult => { - logFile.write("HTTP resp:" + JSON.stringify(cmcResult)); + // logFile.write("HTTP resp:" + JSON.stringify(cmcResult)); const apiData = JSON.parse(cmcResult.resp); - logFile.write("data:" + JSON.stringify(apiData)); - + // logFile.write("data:" + JSON.stringify(apiData)); let priceString = ciLib.formatPriceString(apiData.lastPrice); + + let changeIcon = INCR_ICON_24; + if (apiData.priceChange.startsWith("-")) + changeIcon = DECR_ICON_24; // Update cache with fetched data cache[token] = { text: `${token}\n${priceString}`, + img: changeIcon }; callback(); diff --git a/apps/coin_info/icons/icons8-decrease-24.png b/apps/coin_info/icons/icons8-decrease-24.png new file mode 100644 index 000000000..323dfea2a Binary files /dev/null and b/apps/coin_info/icons/icons8-decrease-24.png differ diff --git a/apps/coin_info/icons/icons8-increase-24.png b/apps/coin_info/icons/icons8-increase-24.png new file mode 100644 index 000000000..dc1132f56 Binary files /dev/null and b/apps/coin_info/icons/icons8-increase-24.png differ diff --git a/apps/coin_info/metadata.json b/apps/coin_info/metadata.json index 8b03a8783..a4cd3884d 100644 --- a/apps/coin_info/metadata.json +++ b/apps/coin_info/metadata.json @@ -1,7 +1,7 @@ { "id": "coin_info", "name": "Crypto-Coins Info", "shortName":"Coins Info", - "version": "0.05.03", + "version": "0.05.04", "description": "Crypto-Coins Infos with the help of the Binance API", "icon": "app.png", "tags": "clkinfo",