From 50011dfceaaaad47d0e4c2f6fceb767156eede47 Mon Sep 17 00:00:00 2001 From: yushihang Date: Tue, 18 Jun 2024 17:28:32 +0800 Subject: [PATCH 1/4] fix issue for multi accounts display --- Example/DApp/Modules/Sign/SignView.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Example/DApp/Modules/Sign/SignView.swift b/Example/DApp/Modules/Sign/SignView.swift index 03b4003a9..b080ee2eb 100644 --- a/Example/DApp/Modules/Sign/SignView.swift +++ b/Example/DApp/Modules/Sign/SignView.swift @@ -96,7 +96,7 @@ struct SignView: View { .padding(12) } else { VStack { - ForEach(presenter.accountsDetails, id: \.chain) { account in + ForEach(presenter.accountsDetails, id: \.account) { account in Button { presenter.presentSessionAccount(sessionAccount: account) } label: { From c9aa02b41c0f32a31ffd23b540244b221fadde82 Mon Sep 17 00:00:00 2001 From: yushihang Date: Tue, 18 Jun 2024 17:34:15 +0800 Subject: [PATCH 2/4] Remove duplicates --- Example/DApp/Modules/Sign/SignPresenter.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/Example/DApp/Modules/Sign/SignPresenter.swift b/Example/DApp/Modules/Sign/SignPresenter.swift index f21cc84e2..39694de69 100644 --- a/Example/DApp/Modules/Sign/SignPresenter.swift +++ b/Example/DApp/Modules/Sign/SignPresenter.swift @@ -221,6 +221,7 @@ extension SignPresenter { self.session = session session.namespaces.values.forEach { namespace in namespace.accounts.forEach { account in + accountsDetails.removeAll() accountsDetails.append( AccountDetails( chain: account.blockchainIdentifier, From 5bb29326ee0dcdece4132b422dcd2fc08d6237e4 Mon Sep 17 00:00:00 2001 From: yushihang Date: Thu, 20 Jun 2024 19:51:35 +0800 Subject: [PATCH 3/4] add id for accountsDetails --- Example/DApp/Modules/Sign/SignView.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Example/DApp/Modules/Sign/SignView.swift b/Example/DApp/Modules/Sign/SignView.swift index b080ee2eb..e29edc24f 100644 --- a/Example/DApp/Modules/Sign/SignView.swift +++ b/Example/DApp/Modules/Sign/SignView.swift @@ -96,7 +96,7 @@ struct SignView: View { .padding(12) } else { VStack { - ForEach(presenter.accountsDetails, id: \.account) { account in + ForEach(presenter.accountsDetails, id: \.id) { account in Button { presenter.presentSessionAccount(sessionAccount: account) } label: { From 03452cb2b8017c1f5d2cf420a42f90024066683e Mon Sep 17 00:00:00 2001 From: yushihang Date: Thu, 20 Jun 2024 19:52:42 +0800 Subject: [PATCH 4/4] add id for accountsDetails --- .../Sign/SessionAccount/SessionAccountInteractor.swift | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Example/DApp/Modules/Sign/SessionAccount/SessionAccountInteractor.swift b/Example/DApp/Modules/Sign/SessionAccount/SessionAccountInteractor.swift index d861b6ceb..83af42dac 100644 --- a/Example/DApp/Modules/Sign/SessionAccount/SessionAccountInteractor.swift +++ b/Example/DApp/Modules/Sign/SessionAccount/SessionAccountInteractor.swift @@ -7,6 +7,10 @@ struct AccountDetails { let chain: String let methods: [String] let account: String + + var id: String { + return "\(account)_\(chain)" + } }