fix: Back from Settings never lands on Settings itself (closes #481)
The recovery phrase and delete wallet screens take themselves off the Back stack when left, so Settings, one of those screens, then the settings gear leaves Settings under the Settings now showing. A reopened popup restores the same stack, cut at the screen the gear left. Back then showed Settings again and seemed to do nothing. goBack() now skips any entry for the screen already showing before it pops its target. Jest tests drive the gear and then Back for the recovery phrase screen, once and twice over, for both delete screens, and after a reopen. Model: opus-5-5
This commit is contained in:
@@ -216,10 +216,21 @@ function pushCurrentView() {
|
||||
|
||||
// Pop the navigation stack and show the previous view. If the stack
|
||||
// is empty, fall back to the main (home) view.
|
||||
//
|
||||
// An entry for the view already showing is skipped: landing on it would
|
||||
// make Back seem to do nothing. Settings, the recovery phrase or delete
|
||||
// wallet screen, then the gear leaves Settings under Settings, because that
|
||||
// screen takes itself off the stack when left, and a reopened popup cuts it
|
||||
// off the restored stack the same way
|
||||
// (https://git.eeqj.de/sneak/AutistMask/issues/481).
|
||||
function goBack() {
|
||||
const stack = state.viewStack;
|
||||
while (stack.length > 0 && stack[stack.length - 1] === state.currentView) {
|
||||
stack.pop();
|
||||
}
|
||||
let target;
|
||||
if (state.viewStack.length > 0) {
|
||||
target = state.viewStack.pop();
|
||||
if (stack.length > 0) {
|
||||
target = stack.pop();
|
||||
} else {
|
||||
target = "main";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user