[#1379] Improve the logic for displaying the shield icon in the Transaction History

- A shield icon is no longer presented for received transactions to a transparent pool.
This commit is contained in:
Lukas Korba 2024-10-19 13:01:32 +02:00
parent 1b53396a4a
commit 10bbab6661
4 changed files with 21 additions and 3 deletions

View File

@ -14,6 +14,7 @@ directly impact users rather than highlighting other crucial architectural updat
- Splash screen animation is blocked by the main thread on iOS 16 and older.
- Inactive hide balances button on iOS 16 and older.
- Inactive close button in the exchange rate hint bubble on iOS 16 and older.
- A shield icon is no longer presented for received transactions to a transparent pool.
## 1.2 build 9 (2024-09-17)

View File

@ -67,9 +67,19 @@ extension SDKSynchronizerClient: DependencyKey {
let latestBlockHeight = try await SDKSynchronizerClient.latestBlockHeight(synchronizer: synchronizer)
for clearedTransaction in clearedTransactions {
var hasTransparentOutputs = false
let outputs = await synchronizer.getTransactionOutputs(for: clearedTransaction)
for output in outputs {
if case .transaparent = output.pool {
hasTransparentOutputs = true
break
}
}
var transaction = TransactionState.init(
transaction: clearedTransaction,
memos: nil,
hasTransparentOutputs: hasTransparentOutputs,
latestBlockHeight: latestBlockHeight
)

View File

@ -119,7 +119,7 @@ struct TransactionHeaderView: View {
}
@ViewBuilder private func addressArea() -> some View {
if transaction.zAddress == nil {
if transaction.zAddress == nil && !transaction.hasTransparentOutputs {
Asset.Assets.surroundedShield.image
.zImage(width: 17, height: 13, color: Asset.Colors.primary.color)
} else if !transaction.isAddressExpanded {

View File

@ -44,7 +44,8 @@ public struct TransactionState: Equatable, Identifiable {
public var isIdExpanded: Bool
public var isMarkedAsRead = false
public var isInAddressBook = false
public var hasTransparentOutputs = false
public var rawID: Data? = nil
// UI Colors
@ -249,7 +250,12 @@ public struct TransactionState: Equatable, Identifiable {
}
extension TransactionState {
public init(transaction: ZcashTransaction.Overview, memos: [Memo]? = nil, latestBlockHeight: BlockHeight) {
public init(
transaction: ZcashTransaction.Overview,
memos: [Memo]? = nil,
hasTransparentOutputs: Bool = false,
latestBlockHeight: BlockHeight
) {
expiryHeight = transaction.expiryHeight
minedHeight = transaction.minedHeight
fee = transaction.fee
@ -262,6 +268,7 @@ extension TransactionState {
isAddressExpanded = false
isExpanded = false
isIdExpanded = false
self.hasTransparentOutputs = hasTransparentOutputs
memoCount = transaction.memoCount
self.memos = memos