Skip to content

Android: work in progress survives rotation and theme changes - #1675

Merged
gemdev111 merged 6 commits into
fix/android-input-survives-recreationfrom
fix/android-screen-recreation
Oct 27, 2026
Merged

gemdev111 merged 6 commits into
fix/android-input-survives-recreationfrom
fix/android-screen-recreation

Conversation

@gemdev111

Copy link
Copy Markdown
Collaborator

Rotating the phone or switching the theme while something was in progress lost it. Now:

  • A send, an amount Next or a Swap that finishes after the rotation still opens the next screen.
  • Importing, creating, picking or deleting a wallet still finishes.
  • A saved price alert, an added token, node, contact address or currency, and a WalletConnect disconnect still close their screen.
  • A fingerprint or passcode confirmed after the rotation is not lost, including showing the Secret Phrase.
  • Open sheets and dialogs stay open.
  • After the first wallet, the system closing the app in the background no longer drops the screen history.

The dismissed transfer error that came back was already fixed on main by e31e2bd.

Stacked on #1673; #1672 keeps the flows themselves open.

Fixes #1470

A send, an amount Next or a Swap that finished after the phone rotated did nothing: the view model called back into the screen that had been destroyed, so the result went to a back stack nobody showed. Confirm kept loading, and Amount and Swap stayed put with the button enabled again.

The view model now keeps the result as state (the sent hash, the confirm input, the swap error and the price impact warning) and the current screen acts on it, so the result reaches whichever screen is showing. Swap releases its loading state only after the screen has opened Confirm, as before.
…ter the screen is recreated

Rotating the phone while a wallet was being imported or created left the user on onboarding, and a pick or a delete from the wallet list or the wallet details did nothing: the view model called back into the destroyed screen. The view model now keeps the outcome (imported, created, selected, or what Core reports after a delete) and the current screen acts on it.
…lletConnect finish after the screen is recreated

The same stale callback hit every other screen whose view model called back after waiting on Core or the network: a saved price alert, an address added to a contact, an auto alert toast, a picked currency, an added token, an added node, a disconnected WalletConnect session and a failed WalletConnect pairing. Each view model now keeps that outcome as state for the current screen. Callbacks that run at once, or that reach a view model which outlives the screen (the WalletConnect request results and errors), are left as they are.
…eated is not lost

Rotating the phone while the system asked for a fingerprint or the passcode lost the confirmation: the pending requests lived in the authenticator of the destroyed activity, so the prompt came back and a successful check did nothing. Turning on the app passcode, a send, a WalletConnect approval, deleting a wallet, an import or a new wallet then needed a second confirmation, and showing the Secret Phrase or enabling authentication during onboarding never moved on.

The queue of pending requests now lives in MainViewModel, which outlives the activity. Where the confirmed action navigates (showing the Secret Phrase and enabling authentication in onboarding), rememberAuthorizedAction keeps the confirmation in a view model of that screen and the current screen acts on it.
Rotating the phone or switching the theme closed whatever sheet or dialog was open: Swap and fee details, network and validator pickers, the scanners, the WalletConnect wallet pickers, the info sheets, the delete wallet and delete node confirmations, and the rest. Their visibility now survives recreation with rememberSaveable; the delete confirmations keep the id of the wallet or node and find the row again.
… the first wallet

After the first wallet was created or imported, a restore after Android closed the app in the background opened the root of the tab instead of the screen the user left. The back stack was saved under a key built from the start destination, which is onboarding in the process that created the wallet and the wallet root in the process that restores it, so the saved stack was never found. The start destination is read once per process, so the key reset nothing; it is gone, and the stack is found again.
@gemdev111 gemdev111 self-assigned this Oct 27, 2026
@gemdev111
gemdev111 merged commit 530abcc into fix/android-input-survives-recreation Oct 27, 2026
@gemdev111
gemdev111 deleted the fix/android-screen-recreation branch October 27, 2026 13:51
@gemdev111

Copy link
Copy Markdown
Collaborator Author

Folded into #1673: GitHub marked this merged because its commits now sit on the #1673 branch. Nothing reached main; #1673 is the PR to review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant