Skip to content

Commit

Permalink
IOS-8131 Recalculate fiat (#3976)
Browse files Browse the repository at this point in the history
  • Loading branch information
tureck1y authored Sep 30, 2024
1 parent fe91927 commit dc068ae
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ extension CommonExpressModulesFactory: ExpressModulesFactory {
initialWallet: initialWalletModel,
userWalletModel: userWalletModel,
feeFormatter: feeFormatter,
balanceConverter: balanceConverter,
balanceFormatter: balanceFormatter,
expressProviderFormatter: expressProviderFormatter,
notificationManager: notificationManager,
Expand Down
9 changes: 5 additions & 4 deletions Tangem/Modules/ExpressView/ExpressViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ final class ExpressViewModel: ObservableObject {
private let initialWallet: WalletModel
private let userWalletModel: UserWalletModel
private let feeFormatter: FeeFormatter
private let balanceConverter: BalanceConverter
private let balanceFormatter: BalanceFormatter
private let expressProviderFormatter: ExpressProviderFormatter
private let notificationManager: NotificationManager
Expand All @@ -62,7 +61,6 @@ final class ExpressViewModel: ObservableObject {
initialWallet: WalletModel,
userWalletModel: UserWalletModel,
feeFormatter: FeeFormatter,
balanceConverter: BalanceConverter,
balanceFormatter: BalanceFormatter,
expressProviderFormatter: ExpressProviderFormatter,
notificationManager: NotificationManager,
Expand All @@ -73,7 +71,6 @@ final class ExpressViewModel: ObservableObject {
self.initialWallet = initialWallet
self.userWalletModel = userWalletModel
self.feeFormatter = feeFormatter
self.balanceConverter = balanceConverter
self.balanceFormatter = balanceFormatter
self.expressProviderFormatter = expressProviderFormatter
self.notificationManager = notificationManager
Expand Down Expand Up @@ -336,7 +333,11 @@ private extension ExpressViewModel {
let roundedAmount = amount.rounded(scale: wallet.decimalCount, roundingMode: .down)

// Exclude unnecessary update
guard roundedAmount != amount else { return }
guard roundedAmount != amount else {
// update only fiat in case of another walletModel selection with another quote
updateSendFiatValue(amount: amount)
return
}

updateSendDecimalValue(to: roundedAmount)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ class ExpressModulesFactoryMock: ExpressModulesFactory {
initialWallet: initialWalletModel,
userWalletModel: userWalletModel,
feeFormatter: feeFormatter,
balanceConverter: balanceConverter,
balanceFormatter: balanceFormatter,
expressProviderFormatter: expressProviderFormatter,
notificationManager: notificationManager,
Expand Down

0 comments on commit dc068ae

Please sign in to comment.