From fe7a0562d42ecafe79a0673ec24b7b679445652a Mon Sep 17 00:00:00 2001 From: Ermat Date: Tue, 10 Jan 2023 18:16:16 +0600 Subject: [PATCH] Hotfix: update spam filter to filter out 0 value external call transactions and show full address in tx info page --- .../project.pbxproj | 6 +- ...xternalContractCallTransactionRecord.swift | 6 +- .../UserInterface/CellComponent.swift | 55 +++++++++++++------ 3 files changed, 46 insertions(+), 21 deletions(-) diff --git a/UnstoppableWallet/UnstoppableWallet.xcodeproj/project.pbxproj b/UnstoppableWallet/UnstoppableWallet.xcodeproj/project.pbxproj index 1c7ebb5dfd..f723da5129 100644 --- a/UnstoppableWallet/UnstoppableWallet.xcodeproj/project.pbxproj +++ b/UnstoppableWallet/UnstoppableWallet.xcodeproj/project.pbxproj @@ -10911,7 +10911,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 0.29; + MARKETING_VERSION = 0.29.1; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; OfficeMode = ""; @@ -10985,7 +10985,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 0.29; + MARKETING_VERSION = 0.29.1; MTL_ENABLE_DEBUG_INFO = NO; OfficeMode = ""; Production = YES; @@ -11265,7 +11265,7 @@ repositoryURL = "https://github.com/horizontalsystems/MarketKit.Swift"; requirement = { kind = exactVersion; - version = 1.0.3; + version = 1.0.4; }; }; D3604E7128F03B0A0066C366 /* XCRemoteSwiftPackageReference "ScanQrKit" */ = { diff --git a/UnstoppableWallet/UnstoppableWallet/Models/TransactionRecords/Evm/ExternalContractCallTransactionRecord.swift b/UnstoppableWallet/UnstoppableWallet/Models/TransactionRecords/Evm/ExternalContractCallTransactionRecord.swift index 40381a0591..72eda7c86c 100644 --- a/UnstoppableWallet/UnstoppableWallet/Models/TransactionRecords/Evm/ExternalContractCallTransactionRecord.swift +++ b/UnstoppableWallet/UnstoppableWallet/Models/TransactionRecords/Evm/ExternalContractCallTransactionRecord.swift @@ -14,8 +14,10 @@ class ExternalContractCallTransactionRecord: EvmTransactionRecord { for event in incomingEvents + outgoingEvents { switch event.value { - case .coinValue, .nftValue: - spam = false + case .coinValue(_, let value), .nftValue(_, let value, _, _): + if value > 0 { + spam = false + } break default: () } diff --git a/UnstoppableWallet/UnstoppableWallet/UserInterface/CellComponent.swift b/UnstoppableWallet/UnstoppableWallet/UserInterface/CellComponent.swift index b4807e585f..fb03038d73 100644 --- a/UnstoppableWallet/UnstoppableWallet/UserInterface/CellComponent.swift +++ b/UnstoppableWallet/UnstoppableWallet/UserInterface/CellComponent.swift @@ -137,29 +137,52 @@ struct CellComponent { } static func fromToRow(tableView: UITableView, rowInfo: RowInfo, title: String, value: String, valueTitle: String?) -> RowProtocol { - CellBuilder.row( - elements: [.text, .secondaryButton], - tableView: tableView, - id: "from-to-\(rowInfo.index)", - hash: value, - height: .heightCell48, - bind: { cell in - cell.set(backgroundStyle: .lawrence, isFirst: rowInfo.isFirst, isLast: rowInfo.isLast) + let backgroundStyle: BaseThemeCell.BackgroundStyle = .lawrence + let titleFont: UIFont = .subhead2 + let valueFont: UIFont = .subhead1 - cell.bind(index: 0) { (component: TextComponent) in - component.font = .subhead2 + return CellBuilderNew.row( + rootElement: .hStack([ + .text { component in + component.font = titleFont component.textColor = .themeGray component.text = title - } - - cell.bind(index: 1) { (component: SecondaryButtonComponent) in - component.button.set(style: .default) - component.button.setTitle(valueTitle ?? value.shortened, for: .normal) - component.button.setContentCompressionResistancePriority(.defaultLow, for: .horizontal) + component.setContentCompressionResistancePriority(.required, for: .horizontal) + }, + .text { component in + component.font = valueFont + component.textColor = .themeLeah + component.text = value + component.textAlignment = .right + component.numberOfLines = 0 + }, + .margin8, + .secondaryCircleButton { component in + component.button.set(image: UIImage(named: "copy_20")) component.onTap = { CopyHelper.copyAndNotify(value: value) } } + ]), + tableView: tableView, + id: "from-to-\(rowInfo.index)", + hash: value, + dynamicHeight: { containerWidth in + CellBuilderNew.height( + containerWidth: containerWidth, + backgroundStyle: backgroundStyle, + text: value, + font: valueFont, + elements: [ + .fixed(width: TextComponent.width(font: titleFont, text: title)), + .multiline, + .margin8, + .fixed(width: SecondaryCircleButton.size) + ] + ) + }, + bind: { cell in + cell.set(backgroundStyle: .lawrence, isFirst: rowInfo.isFirst, isLast: rowInfo.isLast) } ) }