diff --git a/UnstoppableWallet/UnstoppableWallet.xcodeproj/project.pbxproj b/UnstoppableWallet/UnstoppableWallet.xcodeproj/project.pbxproj index 826edd699a..2c30f683b9 100644 --- a/UnstoppableWallet/UnstoppableWallet.xcodeproj/project.pbxproj +++ b/UnstoppableWallet/UnstoppableWallet.xcodeproj/project.pbxproj @@ -13144,7 +13144,7 @@ repositoryURL = "https://github.com/horizontalsystems/ComponentKit.Swift"; requirement = { kind = exactVersion; - version = 2.0.13; + version = 2.0.14; }; }; D3C187D3290FCF7D00FE1900 /* XCRemoteSwiftPackageReference "HUD" */ = { diff --git a/UnstoppableWallet/UnstoppableWallet/Models/TransactionRecords/Ton/TonTransactionRecord.swift b/UnstoppableWallet/UnstoppableWallet/Models/TransactionRecords/Ton/TonTransactionRecord.swift index f52a33762d..afc4070274 100644 --- a/UnstoppableWallet/UnstoppableWallet/Models/TransactionRecords/Ton/TonTransactionRecord.swift +++ b/UnstoppableWallet/UnstoppableWallet/Models/TransactionRecords/Ton/TonTransactionRecord.swift @@ -23,7 +23,8 @@ class TonTransactionRecord: TransactionRecord { blockHeight: nil, confirmationsThreshold: nil, date: Date(timeIntervalSince1970: TimeInterval(event.timestamp)), - failed: false + failed: false, + spam: event.isScam ) } diff --git a/UnstoppableWallet/UnstoppableWallet/Models/TransactionValue.swift b/UnstoppableWallet/UnstoppableWallet/Models/TransactionValue.swift index d5da23d65b..8746873b33 100644 --- a/UnstoppableWallet/UnstoppableWallet/Models/TransactionValue.swift +++ b/UnstoppableWallet/UnstoppableWallet/Models/TransactionValue.swift @@ -32,7 +32,7 @@ enum TransactionValue { var coin: Coin? { switch self { - case let .coinValue(token, _): return token.isCustom ? nil : token.coin + case let .coinValue(token, _): return token.coin default: return nil } } diff --git a/UnstoppableWallet/UnstoppableWallet/Modules/Cex/CexWithdrawConfirm/CexWithdrawConfirmViewController.swift b/UnstoppableWallet/UnstoppableWallet/Modules/Cex/CexWithdrawConfirm/CexWithdrawConfirmViewController.swift index a689b5921a..b34c1600cb 100644 --- a/UnstoppableWallet/UnstoppableWallet/Modules/Cex/CexWithdrawConfirm/CexWithdrawConfirmViewController.swift +++ b/UnstoppableWallet/UnstoppableWallet/Modules/Cex/CexWithdrawConfirm/CexWithdrawConfirmViewController.swift @@ -123,7 +123,7 @@ extension CexWithdrawConfirmViewController: SectionsDataSource { private func row(viewItem: CexWithdrawConfirmViewModel.ViewItem, rowInfo: RowInfo) -> RowProtocol { switch viewItem { case let .amount(title, iconUrl, iconPlaceholderImageName, coinAmount, currencyAmount, type): - return CellComponent.amountRow(tableView: tableView, rowInfo: rowInfo, title: title, imageUrl: iconUrl, placeholderImageName: iconPlaceholderImageName, coinAmount: coinAmount, currencyAmount: currencyAmount, type: type) + return CellComponent.amountRow(tableView: tableView, rowInfo: rowInfo, title: title, imageUrl: iconUrl, alternativeImageUrl: nil, placeholderImageName: iconPlaceholderImageName, coinAmount: coinAmount, currencyAmount: currencyAmount, type: type) case let .address(title, value, contactAddress, statSection): var onAddToContact: (() -> Void)? = nil if let contactAddress { diff --git a/UnstoppableWallet/UnstoppableWallet/Modules/ResendBitcoin/ResendBitcoinViewController.swift b/UnstoppableWallet/UnstoppableWallet/Modules/ResendBitcoin/ResendBitcoinViewController.swift index dc197218be..060812cbb9 100644 --- a/UnstoppableWallet/UnstoppableWallet/Modules/ResendBitcoin/ResendBitcoinViewController.swift +++ b/UnstoppableWallet/UnstoppableWallet/Modules/ResendBitcoin/ResendBitcoinViewController.swift @@ -110,7 +110,7 @@ class ResendBitcoinViewController: KeyboardAwareViewController, SectionsDataSour private func row(viewItem: ResendBitcoinViewModel.ViewItem, rowInfo: RowInfo) -> RowProtocol { switch viewItem { case let .amount(title, token, coinAmount, currencyAmount, type): - return CellComponent.amountRow(tableView: tableView, rowInfo: rowInfo, title: title, subtitle: token.fullBadge, imageUrl: token.coin.imageUrl, placeholderImageName: token.placeholderImageName, coinAmount: coinAmount, currencyAmount: currencyAmount, type: type) + return CellComponent.amountRow(tableView: tableView, rowInfo: rowInfo, title: title, subtitle: token.fullBadge, imageUrl: token.coin.imageUrl, alternativeImageUrl: token.coin.image, placeholderImageName: token.placeholderImageName, coinAmount: coinAmount, currencyAmount: currencyAmount, type: type) case let .address(title, value, valueTitle, contactAddress, statSection): var onAddToContact: (() -> Void)? = nil if let contactAddress { diff --git a/UnstoppableWallet/UnstoppableWallet/Modules/Send/Confirmation/SendConfirmationViewController.swift b/UnstoppableWallet/UnstoppableWallet/Modules/Send/Confirmation/SendConfirmationViewController.swift index 050e0644ce..af60cb11e5 100644 --- a/UnstoppableWallet/UnstoppableWallet/Modules/Send/Confirmation/SendConfirmationViewController.swift +++ b/UnstoppableWallet/UnstoppableWallet/Modules/Send/Confirmation/SendConfirmationViewController.swift @@ -84,7 +84,7 @@ class SendConfirmationViewController: ThemeViewController, SectionsDataSource { private func row(viewItem: SendConfirmationViewModel.ViewItem, rowInfo: RowInfo) -> RowProtocol { switch viewItem { case let .amount(title, token, coinAmount, currencyAmount, type): - return CellComponent.amountRow(tableView: tableView, rowInfo: rowInfo, title: title, subtitle: token.fullBadge, imageUrl: token.coin.imageUrl, placeholderImageName: token.placeholderImageName, coinAmount: coinAmount, currencyAmount: currencyAmount, type: type) + return CellComponent.amountRow(tableView: tableView, rowInfo: rowInfo, title: title, subtitle: token.fullBadge, imageUrl: token.coin.imageUrl, alternativeImageUrl: token.coin.image, placeholderImageName: token.placeholderImageName, coinAmount: coinAmount, currencyAmount: currencyAmount, type: type) case let .address(title, value, valueTitle, contactAddress, statSection): var onAddToContact: (() -> Void)? = nil if let contactAddress { diff --git a/UnstoppableWallet/UnstoppableWallet/Modules/SendEvmTransaction/SendEvmTransactionViewController.swift b/UnstoppableWallet/UnstoppableWallet/Modules/SendEvmTransaction/SendEvmTransactionViewController.swift index 05d4a56f89..fc0453877b 100644 --- a/UnstoppableWallet/UnstoppableWallet/Modules/SendEvmTransaction/SendEvmTransactionViewController.swift +++ b/UnstoppableWallet/UnstoppableWallet/Modules/SendEvmTransaction/SendEvmTransactionViewController.swift @@ -153,7 +153,7 @@ class SendEvmTransactionViewController: ThemeViewController { case let .subhead(iconName, title, value): return CellComponent.actionTitleRow(tableView: tableView, rowInfo: rowInfo, iconName: iconName, iconDimmed: true, title: title, value: value) case let .amount(title, token, coinAmount, currencyAmount, type): - return CellComponent.amountRow(tableView: tableView, rowInfo: rowInfo, title: title, subtitle: token.fullBadge, imageUrl: token.coin.imageUrl, placeholderImageName: token.placeholderImageName, coinAmount: coinAmount, currencyAmount: currencyAmount, type: type) + return CellComponent.amountRow(tableView: tableView, rowInfo: rowInfo, title: title, subtitle: token.fullBadge, imageUrl: token.coin.imageUrl, alternativeImageUrl: token.coin.image, placeholderImageName: token.placeholderImageName, coinAmount: coinAmount, currencyAmount: currencyAmount, type: type) case let .nftAmount(iconUrl, iconPlaceholderImageName, nftAmount, type): return CellComponent.nftAmountRow(tableView: tableView, rowInfo: rowInfo, iconUrl: iconUrl, iconPlaceholderImageName: iconPlaceholderImageName, nftAmount: nftAmount, type: type, onTapOpenNft: nil) case let .doubleAmount(title, coinValue, currencyValue): diff --git a/UnstoppableWallet/UnstoppableWallet/Modules/SendTron/Confirmation/SendTronConfirmationViewController.swift b/UnstoppableWallet/UnstoppableWallet/Modules/SendTron/Confirmation/SendTronConfirmationViewController.swift index 3f6e21e4a3..7296f1ff05 100644 --- a/UnstoppableWallet/UnstoppableWallet/Modules/SendTron/Confirmation/SendTronConfirmationViewController.swift +++ b/UnstoppableWallet/UnstoppableWallet/Modules/SendTron/Confirmation/SendTronConfirmationViewController.swift @@ -137,7 +137,7 @@ class SendTronConfirmationViewController: ThemeViewController { private func row(viewItem: SendTronConfirmationViewModel.ViewItem, rowInfo: RowInfo) -> RowProtocol { switch viewItem { case let .amount(title, token, coinAmount, currencyAmount, type): - return CellComponent.amountRow(tableView: tableView, rowInfo: rowInfo, title: title, subtitle: token.fullBadge, imageUrl: token.coin.imageUrl, placeholderImageName: token.placeholderImageName, coinAmount: coinAmount, currencyAmount: currencyAmount, type: type) + return CellComponent.amountRow(tableView: tableView, rowInfo: rowInfo, title: title, subtitle: token.fullBadge, imageUrl: token.coin.imageUrl, alternativeImageUrl: token.coin.image, placeholderImageName: token.placeholderImageName, coinAmount: coinAmount, currencyAmount: currencyAmount, type: type) case let .address(title, value, valueTitle, contactAddress, statSection): var onAddToContact: (() -> Void)? = nil if let contactAddress { diff --git a/UnstoppableWallet/UnstoppableWallet/Modules/TransactionInfo/TransactionInfoModule.swift b/UnstoppableWallet/UnstoppableWallet/Modules/TransactionInfo/TransactionInfoModule.swift index 70deb68c23..19d72356c1 100644 --- a/UnstoppableWallet/UnstoppableWallet/Modules/TransactionInfo/TransactionInfoModule.swift +++ b/UnstoppableWallet/UnstoppableWallet/Modules/TransactionInfo/TransactionInfoModule.swift @@ -26,7 +26,7 @@ extension TransactionInfoModule { enum ViewItem { case actionTitle(iconName: String?, iconDimmed: Bool, title: String, subTitle: String?) - case amount(title: String, subtitle: String?, iconUrl: String?, iconPlaceholderImageName: String, coinAmount: String, currencyAmount: String?, type: AmountType, coin: Coin?) + case amount(title: String, subtitle: String?, iconUrl: String?, iconAlternativeUrl: String?, iconPlaceholderImageName: String, coinAmount: String, currencyAmount: String?, type: AmountType, coin: Coin?) case nftAmount(iconUrl: String?, iconPlaceholderImageName: String, nftAmount: String, type: AmountType, providerCollectionUid: String?, nftUid: NftUid?) case status(status: TransactionStatus) case option(option: Option) diff --git a/UnstoppableWallet/UnstoppableWallet/Modules/TransactionInfo/TransactionInfoViewController.swift b/UnstoppableWallet/UnstoppableWallet/Modules/TransactionInfo/TransactionInfoViewController.swift index 1416302738..a7a38e511c 100644 --- a/UnstoppableWallet/UnstoppableWallet/Modules/TransactionInfo/TransactionInfoViewController.swift +++ b/UnstoppableWallet/UnstoppableWallet/Modules/TransactionInfo/TransactionInfoViewController.swift @@ -483,7 +483,7 @@ class TransactionInfoViewController: ThemeViewController { switch viewItem { case let .actionTitle(iconName, iconDimmed, title, subTitle): return CellComponent.actionTitleRow(tableView: tableView, rowInfo: rowInfo, iconName: iconName, iconDimmed: iconDimmed, title: title, value: subTitle ?? "") - case let .amount(title, subtitle, iconUrl, iconPlaceholderImageName, coinAmount, currencyAmount, type, coin): + case let .amount(title, subtitle, iconUrl, iconAlternativeUrl, iconPlaceholderImageName, coinAmount, currencyAmount, type, coin): var action: (() -> Void)? if let coin { @@ -492,7 +492,7 @@ class TransactionInfoViewController: ThemeViewController { } } - return CellComponent.amountRow(tableView: tableView, rowInfo: rowInfo, title: title, subtitle: subtitle, imageUrl: iconUrl, placeholderImageName: iconPlaceholderImageName, coinAmount: coinAmount, currencyAmount: currencyAmount, type: type, action: action) + return CellComponent.amountRow(tableView: tableView, rowInfo: rowInfo, title: title, subtitle: subtitle, imageUrl: iconUrl, alternativeImageUrl: iconAlternativeUrl, placeholderImageName: iconPlaceholderImageName, coinAmount: coinAmount, currencyAmount: currencyAmount, type: type, action: action) case let .nftAmount(iconUrl, iconPlaceholderImageName, nftAmount, type, providerCollectionUid, nftUid): var onTapOpenNft: (() -> Void)? diff --git a/UnstoppableWallet/UnstoppableWallet/Modules/TransactionInfo/TransactionInfoViewItemFactory.swift b/UnstoppableWallet/UnstoppableWallet/Modules/TransactionInfo/TransactionInfoViewItemFactory.swift index 41322a0314..b7a35f9979 100644 --- a/UnstoppableWallet/UnstoppableWallet/Modules/TransactionInfo/TransactionInfoViewItemFactory.swift +++ b/UnstoppableWallet/UnstoppableWallet/Modules/TransactionInfo/TransactionInfoViewItemFactory.swift @@ -19,18 +19,22 @@ class TransactionInfoViewItemFactory { private func amount(source: TransactionSource, title: String, subtitle: String?, transactionValue: TransactionValue, rate: CurrencyValue?, type: AmountType, balanceHidden: Bool) -> TransactionInfoModule.ViewItem { let iconUrl = transactionValue.coin?.imageUrl + let iconAlternativeUrl = transactionValue.coin?.image let iconPlaceholderImageName = source.blockchainType.placeholderImageName(tokenProtocol: transactionValue.tokenProtocol) + let coin = transactionValue.token.flatMap { $0.isCustom ? nil : $0.coin } + if transactionValue.isMaxValue { return .amount( title: title, subtitle: subtitle, iconUrl: iconUrl, + iconAlternativeUrl: iconAlternativeUrl, iconPlaceholderImageName: iconPlaceholderImageName, coinAmount: balanceHidden ? BalanceHiddenManager.placeholder : "∞ \(transactionValue.coinCode)", currencyAmount: balanceHidden ? BalanceHiddenManager.placeholder : "transactions.value.unlimited".localized, type: type, - coin: transactionValue.coin + coin: coin ) } else { var currencyValue: CurrencyValue? @@ -43,11 +47,12 @@ class TransactionInfoViewItemFactory { title: title, subtitle: subtitle, iconUrl: iconUrl, + iconAlternativeUrl: iconAlternativeUrl, iconPlaceholderImageName: iconPlaceholderImageName, coinAmount: balanceHidden ? BalanceHiddenManager.placeholder : transactionValue.formattedFull(signType: type.signType) ?? "n/a".localized, currencyAmount: balanceHidden ? BalanceHiddenManager.placeholder : currencyValue.flatMap { ValueFormatter.instance.formatFull(currencyValue: $0) }, type: type, - coin: transactionValue.coin + coin: coin ) } } diff --git a/UnstoppableWallet/UnstoppableWallet/Modules/Transactions/BaseTransactionsViewModel.swift b/UnstoppableWallet/UnstoppableWallet/Modules/Transactions/BaseTransactionsViewModel.swift index 728d35aad7..77cb30e636 100644 --- a/UnstoppableWallet/UnstoppableWallet/Modules/Transactions/BaseTransactionsViewModel.swift +++ b/UnstoppableWallet/UnstoppableWallet/Modules/Transactions/BaseTransactionsViewModel.swift @@ -214,8 +214,8 @@ extension BaseTransactionsViewModel { } enum IconType { - case icon(imageUrl: String?, placeholderImageName: String) - case doubleIcon(frontType: TransactionImageComponent.ImageType, frontUrl: String?, frontPlaceholder: String, backType: TransactionImageComponent.ImageType, backUrl: String?, backPlaceholder: String) + case icon(url: String?, alternativeUrl: String?, placeholderImageName: String) + case doubleIcon(frontType: TransactionImageComponent.ImageType, frontUrl: String?, frontAlternativeUrl: String?, frontPlaceholder: String, backType: TransactionImageComponent.ImageType, backUrl: String?, backAlternativeUrl: String?, backPlaceholder: String) case localIcon(imageName: String?) case failedIcon } diff --git a/UnstoppableWallet/UnstoppableWallet/Modules/Transactions/TransactionsTableViewDataSource.swift b/UnstoppableWallet/UnstoppableWallet/Modules/Transactions/TransactionsTableViewDataSource.swift index 7fe23db3ea..2592baf165 100644 --- a/UnstoppableWallet/UnstoppableWallet/Modules/Transactions/TransactionsTableViewDataSource.swift +++ b/UnstoppableWallet/UnstoppableWallet/Modules/Transactions/TransactionsTableViewDataSource.swift @@ -80,20 +80,19 @@ class TransactionsTableViewDataSource: NSObject { component.set(progress: viewItem.progress) switch viewItem.iconType { - case let .icon(imageUrl, placeholderImageName): - component.setImage( - urlString: imageUrl, - placeholder: UIImage(named: placeholderImageName) - ) + case let .icon(url, alternativeUrl, placeholderImageName): + component.setImage(url: url, alternativeUrl: alternativeUrl, placeholder: UIImage(named: placeholderImageName)) case let .localIcon(imageName): component.set(image: imageName.flatMap { UIImage(named: $0)?.withTintColor(.themeLeah) }) - case let .doubleIcon(frontType, frontUrl, frontPlaceholder, backType, backUrl, backPlaceholder): + case let .doubleIcon(frontType, frontUrl, frontAlternativeUrl, frontPlaceholder, backType, backUrl, backAlternativeUrl, backPlaceholder): component.setDoubleImage( frontType: frontType, frontUrl: frontUrl, + frontAlternativeUrl: frontAlternativeUrl, frontPlaceholder: UIImage(named: frontPlaceholder), backType: backType, backUrl: backUrl, + backAlternativeUrl: backAlternativeUrl, backPlaceholder: UIImage(named: backPlaceholder) ) case .failedIcon: diff --git a/UnstoppableWallet/UnstoppableWallet/Modules/Transactions/TransactionsViewItemFactory.swift b/UnstoppableWallet/UnstoppableWallet/Modules/Transactions/TransactionsViewItemFactory.swift index 9a48cf5443..188655a693 100644 --- a/UnstoppableWallet/UnstoppableWallet/Modules/Transactions/TransactionsViewItemFactory.swift +++ b/UnstoppableWallet/UnstoppableWallet/Modules/Transactions/TransactionsViewItemFactory.swift @@ -59,12 +59,14 @@ class TransactionsViewItemFactory { switch value { case let .nftValue(nftUid, _, _, _): return .icon( - imageUrl: nftMetadata[nftUid]?.previewImageUrl, + url: nftMetadata[nftUid]?.previewImageUrl, + alternativeUrl: nil, placeholderImageName: "placeholder_nft_32" ) default: return .icon( - imageUrl: value.coin?.imageUrl, + url: value.coin?.imageUrl, + alternativeUrl: value.coin?.image, placeholderImageName: source.blockchainType.placeholderImageName(tokenProtocol: value.tokenProtocol) ) } @@ -73,9 +75,11 @@ class TransactionsViewItemFactory { private func doubleValueIconType(source: TransactionSource, primaryValue: TransactionValue?, secondaryValue: TransactionValue?, nftMetadata: [NftUid: NftAssetBriefMetadata] = [:]) -> BaseTransactionsViewModel.IconType { let frontType: TransactionImageComponent.ImageType let frontUrl: String? + var frontAlternativeUrl: String? let frontPlaceholder: String let backType: TransactionImageComponent.ImageType let backUrl: String? + var backAlternativeUrl: String? let backPlaceholder: String if let primaryValue { @@ -87,6 +91,7 @@ class TransactionsViewItemFactory { default: frontType = .circle frontUrl = primaryValue.coin?.imageUrl + frontAlternativeUrl = primaryValue.coin?.image frontPlaceholder = source.blockchainType.placeholderImageName(tokenProtocol: primaryValue.tokenProtocol) } } else { @@ -104,6 +109,7 @@ class TransactionsViewItemFactory { default: backType = .circle backUrl = secondaryValue.coin?.imageUrl + backAlternativeUrl = secondaryValue.coin?.image backPlaceholder = source.blockchainType.placeholderImageName(tokenProtocol: secondaryValue.tokenProtocol) } } else { @@ -112,7 +118,16 @@ class TransactionsViewItemFactory { backPlaceholder = "placeholder_circle_32" } - return .doubleIcon(frontType: frontType, frontUrl: frontUrl, frontPlaceholder: frontPlaceholder, backType: backType, backUrl: backUrl, backPlaceholder: backPlaceholder) + return .doubleIcon( + frontType: frontType, + frontUrl: frontUrl, + frontAlternativeUrl: frontAlternativeUrl, + frontPlaceholder: frontPlaceholder, + backType: backType, + backUrl: backUrl, + backAlternativeUrl: backAlternativeUrl, + backPlaceholder: backPlaceholder + ) } private func iconType(source: TransactionSource, incomingValues: [TransactionValue], outgoingValues: [TransactionValue], nftMetadata: [NftUid: NftAssetBriefMetadata]) -> BaseTransactionsViewModel.IconType { diff --git a/UnstoppableWallet/UnstoppableWallet/UserInterface/CellComponent.swift b/UnstoppableWallet/UnstoppableWallet/UserInterface/CellComponent.swift index a237dbaf8e..416ff79bfc 100644 --- a/UnstoppableWallet/UnstoppableWallet/UserInterface/CellComponent.swift +++ b/UnstoppableWallet/UnstoppableWallet/UserInterface/CellComponent.swift @@ -39,11 +39,12 @@ enum CellComponent { ) } - static func amountRow(tableView: SectionsTableView, rowInfo: RowInfo, title: String, subtitle: String? = nil, imageUrl: String?, placeholderImageName: String, coinAmount: String, currencyAmount: String?, type: AmountType, action: (() -> Void)? = nil) -> RowProtocol { + static func amountRow(tableView: SectionsTableView, rowInfo: RowInfo, title: String, subtitle: String? = nil, imageUrl: String?, alternativeImageUrl: String?, placeholderImageName: String, coinAmount: String, currencyAmount: String?, type: AmountType, action: (() -> Void)? = nil) -> RowProtocol { CellBuilderNew.row( rootElement: .hStack([ .image32 { (component: ImageComponent) in - component.setImage(urlString: imageUrl, placeholder: UIImage(named: placeholderImageName)) + component.imageView.setImage(url: imageUrl, alternativeUrl: alternativeImageUrl, placeholder: UIImage(named: placeholderImageName)) + component.imageView.cornerRadius = CGFloat.iconSize32 / 2 }, .vStackCentered([ .text { (component: TextComponent) in diff --git a/UnstoppableWallet/UnstoppableWallet/UserInterface/Extensions/UIImageView.swift b/UnstoppableWallet/UnstoppableWallet/UserInterface/Extensions/UIImageView.swift index ce67351262..634cd60009 100644 --- a/UnstoppableWallet/UnstoppableWallet/UserInterface/Extensions/UIImageView.swift +++ b/UnstoppableWallet/UnstoppableWallet/UserInterface/Extensions/UIImageView.swift @@ -1,37 +1,10 @@ -import Alamofire -import Kingfisher +import ComponentKit import MarketKit import UIKit extension UIImageView { func setImage(coin: Coin?, placeholder: String? = nil) { - let options: [KingfisherOptionsInfoItem] = [.scaleFactor(UIScreen.main.scale)] - let placeholder = UIImage(named: placeholder ?? "placeholder_circle_32") - - if let alternativeUrlString = coin?.image, let alternativeUrl = URL(string: alternativeUrlString) { - if ImageCache.default.isCached(forKey: alternativeUrlString) { - kf.setImage( - with: alternativeUrl, - placeholder: placeholder, - options: options - ) - } else { - kf.setImage( - with: URL(string: coin?.imageUrl ?? ""), - placeholder: placeholder, - options: options + [.alternativeSources([.network(alternativeUrl)])] - ) - } - } else { - kf.setImage( - with: URL(string: coin?.imageUrl ?? ""), - placeholder: placeholder, - options: options - ) - - return - } - + setImage(url: coin?.imageUrl, alternativeUrl: coin?.image, placeholder: UIImage(named: placeholder ?? "placeholder_circle_32")) cornerRadius = CGFloat.iconSize32 / 2 } }