From 8f61d5102250d22564f88c33609d4a77ee67c502 Mon Sep 17 00:00:00 2001 From: danvleju-rdx <163979791+danvleju-rdx@users.noreply.github.com> Date: Wed, 17 Jul 2024 17:05:52 +0300 Subject: [PATCH] wip --- .../Features/ChooseAccounts/ChooseAccounts+View.swift | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/RadixWallet/Features/ChooseAccounts/ChooseAccounts+View.swift b/RadixWallet/Features/ChooseAccounts/ChooseAccounts+View.swift index a762996b7f..793ccd6180 100644 --- a/RadixWallet/Features/ChooseAccounts/ChooseAccounts+View.swift +++ b/RadixWallet/Features/ChooseAccounts/ChooseAccounts+View.swift @@ -19,8 +19,17 @@ extension ChooseAccounts { ) } self.selectionRequirement = selectionRequirement - self.selectedAccounts = state.selectedAccounts self.canCreateNewAccount = state.canCreateNewAccount + + // If the dApp is asking for exactly(1) account and user has only one account, pre-select it + if let account = availableAccounts.first, + availableAccounts.count == 1, + selectionRequirement == .exactly(1) + { + self.selectedAccounts = [account] + } else { + self.selectedAccounts = state.selectedAccounts + } } }