// The first screen, shown while there is no wallet. It offers "Use Blockscout" // and "Check recipients on Etherscan", which Settings offers too. Both are off // until the user ticks them. const { $, showView } = require("./helpers"); const { state, saveState } = require("../../shared/state"); function show() { $("welcome-use-blockscout").checked = state.useBlockscout; $("welcome-check-recipients-on-etherscan").checked = state.checkRecipientsOnEtherscan; showView("welcome"); } // Each change is made inside the save, holding the lock, as Settings makes it. function init(ctx) { $("btn-welcome-add").addEventListener("click", ctx.showAddWalletView); $("welcome-use-blockscout").addEventListener("change", async () => { const on = $("welcome-use-blockscout").checked; await saveState(() => { state.useBlockscout = on; }); }); $("welcome-check-recipients-on-etherscan").addEventListener( "change", async () => { const on = $("welcome-check-recipients-on-etherscan").checked; await saveState(() => { state.checkRecipientsOnEtherscan = on; }); }, ); } module.exports = { init, show };