try to implent icon for 24h change

master
Martin Zwigl 2025-03-08 15:46:20 +01:00
parent a1d361face
commit a5a38fa055
5 changed files with 11 additions and 5 deletions

View File

@ -1,6 +1,6 @@
# Crypto-Coin Info # Crypto-Coin Info
Crypto-Coins Infos with the help of the Coinmarketcap API Crypto-Coins Infos with the help of the Binance API
## Creator ## Creator

View File

@ -1,5 +1,7 @@
(function() { (function() {
const LOAD_ICON_24 = atob("GBiBAAAAAAAeAAGfwAGB4AAAcBgAOBgYHAAYDAAYDGAYBmAYBgAYBgAYBmDbBmB+BgA8DAAYDBgAHBgAOAAAcAGB4AGfwAAeAAAAAA=="); 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 settings = require("Storage").readJSON("coin_info.settings.json", 1) || {};
const db = require("Storage").readJSON("coin_info.cmc_key.json", 1) || {}; const db = require("Storage").readJSON("coin_info.cmc_key.json", 1) || {};
@ -35,14 +37,18 @@
Bangle.http(url, { method: 'GET' }) Bangle.http(url, { method: 'GET' })
.then(cmcResult => { .then(cmcResult => {
logFile.write("HTTP resp:" + JSON.stringify(cmcResult)); // logFile.write("HTTP resp:" + JSON.stringify(cmcResult));
const apiData = JSON.parse(cmcResult.resp); 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 priceString = ciLib.formatPriceString(apiData.lastPrice);
let changeIcon = INCR_ICON_24;
if (apiData.priceChange.startsWith("-"))
changeIcon = DECR_ICON_24;
// Update cache with fetched data // Update cache with fetched data
cache[token] = { cache[token] = {
text: `${token}\n${priceString}`, text: `${token}\n${priceString}`,
img: changeIcon
}; };
callback(); callback();

Binary file not shown.

After

Width:  |  Height:  |  Size: 306 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 303 B

View File

@ -1,7 +1,7 @@
{ "id": "coin_info", { "id": "coin_info",
"name": "Crypto-Coins Info", "name": "Crypto-Coins Info",
"shortName":"Coins Info", "shortName":"Coins Info",
"version": "0.05.03", "version": "0.05.04",
"description": "Crypto-Coins Infos with the help of the Binance API", "description": "Crypto-Coins Infos with the help of the Binance API",
"icon": "app.png", "icon": "app.png",
"tags": "clkinfo", "tags": "clkinfo",