feat(wallet): live progress modal for wallet switching
The "Stop the running node?" confirm modal now stays open through the entire switch — stop → wait-for-exit → start → reconnect — showing a live phase, and auto-closes the moment the new node connects. This turns the up-to-a-minute graceful-shutdown wait from an apparent freeze into visible progress. - WalletSwitchPhase (Stopping/Starting/Reconnecting/Failed) + atomic phase and dialog-open flags; the worker advances the phase, onConnected closes the modal, and a failed switch shows the accurate reason with a Close button. - Owned switches (no confirm) also show the progress modal directly. - "Continue in background" escape hatch so a long rescan / a hung startup never traps the user (the switch keeps running; a toast reports the result). - isWalletSwitchInProgress() keeps the frame loop redrawing so the phase text and spinner animate while otherwise idle. - i18n (EN + 8 languages, additive) + a modal-switch-progress sweep surface. State machine adversarially verified 6/6 (thread-safety, no stuck modal, confirm→progress transition, owned/unowned, no phase leak, redraw scoping). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
11
src/app.h
11
src/app.h
@@ -139,6 +139,9 @@ public:
|
||||
* @brief Whether we are in the shutdown phase
|
||||
*/
|
||||
bool isShuttingDown() const { return shutting_down_; }
|
||||
// True while the wallet-switch progress modal is open — keeps the frame loop redrawing so its live
|
||||
// phase/spinner update in real time even when the app is otherwise idle.
|
||||
bool isWalletSwitchInProgress() const { return wallet_switch_dialog_open_.load(); }
|
||||
wallet::WalletCapabilities walletCapabilities() const { return wallet::currentWalletCapabilities(); }
|
||||
bool isLiteBuild() const { return wallet::isLiteBuild(walletCapabilities()); }
|
||||
bool supportsEmbeddedDaemon() const { return wallet::supportsEmbeddedDaemon(walletCapabilities()); }
|
||||
@@ -768,6 +771,14 @@ private:
|
||||
// sets these and defers to renderSwitchStopDaemonDialog; confirming re-calls switchToWallet(w, true).
|
||||
bool show_switch_stop_daemon_confirm_ = false;
|
||||
std::string pending_switch_wallet_file_;
|
||||
// Live progress for the switch modal: it stays open from confirm through stop → wait-for-exit → start →
|
||||
// reconnect and auto-closes when the new node connects (onConnected). Phase is worker-updated;
|
||||
// dialog_open_ gates rendering — both atomic since onConnected/the worker may run off the main thread.
|
||||
// error_ is written only on the main thread (processWalletSwitchRevert) and read by the (main-thread) UI.
|
||||
enum class WalletSwitchPhase : int { None = 0, Stopping, Starting, Reconnecting, Failed };
|
||||
std::atomic<int> wallet_switch_phase_{0};
|
||||
std::atomic<bool> wallet_switch_dialog_open_{false};
|
||||
std::string wallet_switch_error_;
|
||||
|
||||
// Set by the deleteBlockchainData worker (item count); the main loop surfaces a completion toast
|
||||
// and resets it to -1. Atomic because the worker thread writes it and the UI thread reads/clears it.
|
||||
|
||||
Reference in New Issue
Block a user