Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG FIX: Display ledger account tag even for accounts with 0 balance #519

Merged
merged 1 commit into from
May 25, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,25 @@ extension AccountList {
case .task:
let accountAddress = state.account.address
state.portfolio = .loading
return .run { send in
return .run { [account = state.account] send in

for try await accountPortfolio in await accountPortfoliosClient.portfolioForAccount(accountAddress) {
guard !Task.isCancelled else {
return
}
await send(.internal(.accountPortfolioUpdate(accountPortfolio)))

switch account.securityState {
case let .unsecured(unsecuredEntityControl):
if
let factorSource = try? await factorSourcesClient.getFactorSource(
of: unsecuredEntityControl.transactionSigning.factorInstance
),
factorSource.kind == .ledgerHQHardwareWallet
{
await send(.internal(.isLedgerAccount))
}
}
}
}
case .securityPromptTapped:
Expand Down Expand Up @@ -107,10 +120,7 @@ extension AccountList {
return
}
guard factorSource.kind == .device else {
// probably ledger account
if factorSource.kind == .ledgerHQHardwareWallet {
await send(.internal(.isLedgerAccount))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this function checkIfDeviceFactorSourceControls never gets called if balance is 0, see line 100 where we return before calling checkIfDeviceFactorSourceControls.

The fix is simple, perform the check part of task.

}
// probably ledger
return
}
await send(.internal(.displaySecurityPrompting))
Expand Down