From 217580651117acaacd77c42635eed2aa995bd87d Mon Sep 17 00:00:00 2001 From: Chris kerr Date: Wed, 12 Jun 2024 11:56:24 -0400 Subject: [PATCH] saved prefs working --- app/src/main/assets/js/main.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/app/src/main/assets/js/main.js b/app/src/main/assets/js/main.js index 700406b..ef4ecf5 100644 --- a/app/src/main/assets/js/main.js +++ b/app/src/main/assets/js/main.js @@ -78,6 +78,23 @@ function updateFiatToSatsConversion(selectedCurrency) { } document.addEventListener('DOMContentLoaded', () => { + const satsInputElement = document.getElementById('sats-input'); + const currencySelect = document.getElementById('currency-select'); + const selectedCurrency = currencySelect.value; + // Initially fetch Bitcoin price in USD + updateBitcoinPrice(selectedCurrency); + updateFiatToSatsConversion(selectedCurrency) + + satsInputElement.addEventListener('input', updateSatsToDollarsConversion); + + currencySelect.addEventListener('change', () => { + const selectedCurrency = currencySelect.value; + updateBitcoinPrice(selectedCurrency); + updateFiatToSatsConversion(selectedCurrency); + updateSatsToDollarsConversion(selectedCurrency); + updateFiatToSatsConversion(selectedCurrency) + }); + const savedTheme = (typeof Android !== 'undefined' && Android !== null) ? Android.getPreference("theme") : null; if (savedTheme) { document.getElementById("theme-select").value = savedTheme;