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

Hotfix for delete account with hidden assets only #1414

Merged
merged 3 commits into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
2 changes: 1 addition & 1 deletion Aux/Config/Common.xcconfig
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// MARK: - Custom flags

/// Application version shared across all targets and flavours
APP_VERSION = 1.11.0
APP_VERSION = 1.11.1

/// App Icon base name
APP_ICON = AppIcon
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ extension AccountPortfoliosClient {

return modified
}

/// Returns if the original account (which doesn't remove the hidden resources) contains any asset
var containsAnyAsset: Bool {
originalAccount.containsAnyAsset
}
}

/// Internal state that holds all loaded portfolios.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ struct DeleteAccountConfirmation: Sendable, FeatureReducer {

@CasePathable
enum InternalAction: Sendable, Equatable {
case fetchAccountPortfolioResult(TaskResult<OnLedgerEntity.OnLedgerAccount>)
case fetchAccountPortfolioResult(TaskResult<AccountPortfoliosClient.AccountPortfolio>)
case fetchReceivingAccounts
case fetchReceivingAccountsResult(TaskResult<[State.ReceivingAccountCandidate]>)
}
Expand Down Expand Up @@ -44,7 +44,7 @@ struct DeleteAccountConfirmation: Sendable, FeatureReducer {
state.footerButtonState = .loading(.local)
return .run { [address = state.account.address] send in
let result = await TaskResult {
try await accountPortfoliosClient.fetchAccountPortfolio(address, true).account
try await accountPortfoliosClient.fetchAccountPortfolio(address, true)
}
await send(.internal(.fetchAccountPortfolioResult(result)))
}
Expand All @@ -53,9 +53,9 @@ struct DeleteAccountConfirmation: Sendable, FeatureReducer {

func reduce(into state: inout State, internalAction: InternalAction) -> Effect<Action> {
switch internalAction {
case let .fetchAccountPortfolioResult(.success(account)):
case let .fetchAccountPortfolioResult(.success(portfolio)):
state.footerButtonState = .enabled
return account.containsAnyAsset ? .send(.internal(.fetchReceivingAccounts)) : .send(.delegate(.deleteAccount))
return portfolio.containsAnyAsset ? .send(.internal(.fetchReceivingAccounts)) : .send(.delegate(.deleteAccount))

case .fetchReceivingAccounts:
return .run { send in
Expand Down
Loading