fix(aegis): 0.25.1 — the wallet list follows the network switch
Switching network on the new header chips moved the selected wallet but left the list below it alone. In the addresses drilldown stripView.groupKey pins "<chain>:<network>", so the header read chipnet while the rows underneath were still mainnet addresses. The chip now retargets that groupKey when the drilldown belongs to the chain being switched, and leaves a drilldown on any other chain alone. The coins view already keyed off activeNetworkByChain and needed nothing. Switching also lands on whichever wallet that network was last left on instead of the first in list order, which means row clicks have to record that — otherwise picking a wallet, leaving the network and coming back returned somewhere else.
This commit is contained in:
parent
a04eb5406a
commit
b56c63a365
2 changed files with 19 additions and 2 deletions
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"id": "aegis",
|
"id": "aegis",
|
||||||
"name": "Aegis Wallet",
|
"name": "Aegis Wallet",
|
||||||
"version": "0.25.0",
|
"version": "0.25.1",
|
||||||
"category": "plugin",
|
"category": "plugin",
|
||||||
"description": "Multi-chain wallet (BCH, BTC, TRX, ETH, SOL, SC, DGB) derived from your Theseus vault. Dapps get window.bitcoincash on .x sites; window.tronWeb / window.tronLink / window.ethereum / window.solana on any https page.",
|
"description": "Multi-chain wallet (BCH, BTC, TRX, ETH, SOL, SC, DGB) derived from your Theseus vault. Dapps get window.bitcoincash on .x sites; window.tronWeb / window.tronLink / window.ethereum / window.solana on any https page.",
|
||||||
"author": "Silent Mode",
|
"author": "Silent Mode",
|
||||||
|
|
|
||||||
|
|
@ -512,8 +512,20 @@ function paintNetSelector(s) {
|
||||||
// views never disagree about which network this chain is showing.
|
// views never disagree about which network this chain is showing.
|
||||||
activeNetworkByChain.set(chain, net);
|
activeNetworkByChain.set(chain, net);
|
||||||
persistActiveNetworks();
|
persistActiveNetworks();
|
||||||
|
// The wallet list has to come along. In the addresses drilldown its
|
||||||
|
// groupKey pins "<chain>:<network>", so without this the header says
|
||||||
|
// chipnet while the list below keeps showing mainnet addresses.
|
||||||
|
const subKey = `${chain}:${net}`;
|
||||||
|
if (stripView.mode === "addresses" && String(stripView.groupKey || "").split(":")[0] === chain) {
|
||||||
|
stripView = { mode: "addresses", groupKey: subKey };
|
||||||
|
}
|
||||||
|
// Land on whichever wallet this network was last left on, so the header
|
||||||
|
// switch and the row the strip highlights are the same wallet.
|
||||||
|
const remembered = activeWalletBySubgroup.get(subKey);
|
||||||
|
const target = peers.find((w) => w.id === remembered) || peers[0];
|
||||||
|
activeWalletBySubgroup.set(subKey, target.id);
|
||||||
try {
|
try {
|
||||||
state = await S.invoke("selectWallet", { id: peers[0].id });
|
state = await S.invoke("selectWallet", { id: target.id });
|
||||||
settingsFilled = false;
|
settingsFilled = false;
|
||||||
render();
|
render();
|
||||||
} catch (err) { aegisAlert("Could not switch network: " + cleanErr(err)); }
|
} catch (err) { aegisAlert("Could not switch network: " + cleanErr(err)); }
|
||||||
|
|
@ -3148,6 +3160,11 @@ function renderInlineCoinList(el, groupKey, group) {
|
||||||
if (e.target.closest(".wact")) return;
|
if (e.target.closest(".wact")) return;
|
||||||
if (e.target.closest(".wacopy")) return;
|
if (e.target.closest(".wacopy")) return;
|
||||||
const id = row.dataset.listpick;
|
const id = row.dataset.listpick;
|
||||||
|
// Record it as this network's current wallet, so switching away on the
|
||||||
|
// header's network chips and back returns here rather than to whichever
|
||||||
|
// wallet happens to be first.
|
||||||
|
const picked = (state?.wallets || []).find((w) => w.id === id);
|
||||||
|
if (picked) activeWalletBySubgroup.set(`${picked.chain}:${picked.network}`, id);
|
||||||
try { state = await S.invoke("selectWallet", { id }); settingsFilled = false; render(); }
|
try { state = await S.invoke("selectWallet", { id }); settingsFilled = false; render(); }
|
||||||
catch (er) { showErr(cleanErr(er)); }
|
catch (er) { showErr(cleanErr(er)); }
|
||||||
}));
|
}));
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue