commit 043dd174e04229886b8089929ad3830bfbc91b93 parent af6ba2ec3effd3db77d6e26f5b9eb8c8e6439906 Author: Iván Ávalos <avalos@disroot.org> Date: Fri, 15 Nov 2024 19:57:38 +0100 [wallet] QC: return to selected scopeInfo from withdrawal Diffstat:
3 files changed, 15 insertions(+), 7 deletions(-)
diff --git a/wallet/src/main/java/net/taler/wallet/MainActivity.kt b/wallet/src/main/java/net/taler/wallet/MainActivity.kt @@ -116,6 +116,14 @@ class MainActivity : AppCompatActivity(), OnPreferenceStartFragmentCallback { } } + lifecycleScope.launch { + repeatOnLifecycle(Lifecycle.State.STARTED) { + model.transactionManager.selectedScope.collect { tx -> + model.saveSelectedScope(this@MainActivity, tx) + } + } + } + model.scanCodeEvent.observe(this, EventObserver { val scanOptions = ScanOptions().apply { setPrompt("") diff --git a/wallet/src/main/java/net/taler/wallet/MainFragment.kt b/wallet/src/main/java/net/taler/wallet/MainFragment.kt @@ -151,13 +151,11 @@ class MainFragment: Fragment() { ) ) { innerPadding -> LaunchedEffect(Unit) { - model.transactionManager.selectScope( - model.getSelectedScope(context).first(), - ) - } - - LaunchedEffect(selectedScope) { - model.saveSelectedScope(context, selectedScope) + if (selectedScope == null) { + model.transactionManager.selectScope( + model.getSelectedScope(context).first() + ) + } } LaunchedEffect(tab, selectedScope) { diff --git a/wallet/src/main/java/net/taler/wallet/withdraw/PromptWithdrawFragment.kt b/wallet/src/main/java/net/taler/wallet/withdraw/PromptWithdrawFragment.kt @@ -170,6 +170,7 @@ class PromptWithdrawFragment: Fragment() { findNavController().navigate(R.id.action_global_reviewExchangeTos, args) }, onConfirm = { age -> + exchange?.scopeInfo?.let { model.transactionManager.selectScope(it) } withdrawManager.acceptWithdrawal(age) }, ) @@ -205,6 +206,7 @@ class PromptWithdrawFragment: Fragment() { } else return@let if (transactionManager.selectTransaction(it)) { + status.amountInfo?.scopeInfo?.let { s -> transactionManager.selectScope(s) } if (status.status == Success) { findNavController().navigate(R.id.action_promptWithdraw_to_nav_transactions_detail_withdrawal) } else {