fix: Back from Settings no longer lands on a delete wallet screen left by the gear (closes #480)
Leaving the delete wallet or lost-password screen drops its wallet selection, but the settings gear had just pushed the screen onto the Back stack, so Back from Settings showed a screen whose button could only answer "No wallet selected for deletion." Each screen's leave handler now also takes it off the top of the stack, as the private key export and recovery phrase screens do since #461. Back from Settings then stays on Settings once, as it does for the recovery phrase screen. Jest tests drive the gear and then Back on both screens, and the delete screen's own Back. Model: opus-5-5
This commit was merged in pull request #484.
This commit is contained in:
@@ -49,9 +49,9 @@ function confirmKey(name) {
|
||||
}
|
||||
|
||||
// Drop the password from the DOM and the wallet selection from the
|
||||
// closure. Registered as the view-leave handler as well as run on entry,
|
||||
// so the typed password does not sit in the hidden view after the user
|
||||
// navigates away by any route, including the Settings gear.
|
||||
// closure. Run by the view-leave handler as well as on entry, so the typed
|
||||
// password does not sit in the hidden view after the user navigates away
|
||||
// by any route, including the Settings gear.
|
||||
function clear() {
|
||||
deleteWalletIndex = null;
|
||||
$("delete-wallet-password").value = "";
|
||||
@@ -147,8 +147,25 @@ async function finishDelete(walletIdx) {
|
||||
function init(_ctx) {
|
||||
ctx = _ctx;
|
||||
|
||||
onViewLeave("delete-wallet-confirm", clear);
|
||||
onViewLeave("delete-wallet-lost-password", clearLostPassword);
|
||||
// Leaving drops the wallet selection, so each screen also comes off the
|
||||
// Back stack, where the settings gear has just put it: Back from
|
||||
// Settings must not land on a screen whose button can only answer "No
|
||||
// wallet selected for deletion." A reopened popup drops them from the
|
||||
// stack the same way (https://git.eeqj.de/sneak/AutistMask/issues/480).
|
||||
onViewLeave("delete-wallet-confirm", () => {
|
||||
clear();
|
||||
const stack = state.viewStack;
|
||||
if (stack[stack.length - 1] === "delete-wallet-confirm") {
|
||||
stack.pop();
|
||||
}
|
||||
});
|
||||
onViewLeave("delete-wallet-lost-password", () => {
|
||||
clearLostPassword();
|
||||
const stack = state.viewStack;
|
||||
if (stack[stack.length - 1] === "delete-wallet-lost-password") {
|
||||
stack.pop();
|
||||
}
|
||||
});
|
||||
|
||||
// No wipe here: goBack() routes through showView(), which runs the
|
||||
// leave hook.
|
||||
|
||||
Reference in New Issue
Block a user