From 98145c3d8099d34a32cc6a664985f4e4c502fb12 Mon Sep 17 00:00:00 2001 From: ant013 Date: Tue, 26 Sep 2023 11:00:40 +0400 Subject: [PATCH] Revert "Disable swap function" This reverts commit 6eaae15abac5480ded1405e8336b7810c5104a30. --- .../WalletTokenBalanceViewItemFactory.swift | 6 +++++- .../Modules/Wallet/WalletViewItemFactory.swift | 3 ++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/UnstoppableWallet/UnstoppableWallet/Modules/Wallet/Token/DataSources/WalletTokenBalance/WalletTokenBalanceViewItemFactory.swift b/UnstoppableWallet/UnstoppableWallet/Modules/Wallet/Token/DataSources/WalletTokenBalance/WalletTokenBalanceViewItemFactory.swift index 399158f2d1..7776682656 100644 --- a/UnstoppableWallet/UnstoppableWallet/Modules/Wallet/Token/DataSources/WalletTokenBalance/WalletTokenBalanceViewItemFactory.swift +++ b/UnstoppableWallet/UnstoppableWallet/Modules/Wallet/Token/DataSources/WalletTokenBalance/WalletTokenBalanceViewItemFactory.swift @@ -14,7 +14,7 @@ class WalletTokenBalanceViewItemFactory { var buttons = [WalletModule.Button: ButtonState]() switch item.element { - case .wallet: + case .wallet(let wallet): if item.watchAccount { buttons[.address] = .enabled } else { @@ -22,6 +22,10 @@ class WalletTokenBalanceViewItemFactory { buttons[.send] = sendButtonState buttons[.receive] = .enabled + + if wallet.token.swappable { + buttons[.swap] = sendButtonState + } } case .cexAsset(let cexAsset): buttons[.withdraw] = cexAsset.withdrawEnabled ? .enabled : .disabled diff --git a/UnstoppableWallet/UnstoppableWallet/Modules/Wallet/WalletViewItemFactory.swift b/UnstoppableWallet/UnstoppableWallet/Modules/Wallet/WalletViewItemFactory.swift index cd654bdb2c..da6e27e4a6 100644 --- a/UnstoppableWallet/UnstoppableWallet/Modules/Wallet/WalletViewItemFactory.swift +++ b/UnstoppableWallet/UnstoppableWallet/Modules/Wallet/WalletViewItemFactory.swift @@ -143,7 +143,8 @@ class WalletViewItemFactory { case .evmPrivateKey, .hdExtendedKey, .mnemonic: return [ .send: .enabled, - .receive: .enabled + .receive: .enabled, + .swap: .enabled ] case .evmAddress, .tronAddress: return [:] }