Skip to content

Commit

Permalink
Show transfer direction based on the transaction and operation
Browse files Browse the repository at this point in the history
  • Loading branch information
vikmeup committed Feb 17, 2018
1 parent 72c6b61 commit 688778d
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions Trust/Transactions/ViewModels/TransactionViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,16 @@ struct TransactionViewModel {
self.currentWallet = currentWallet
}

var transactionTo: String {
guard let operation = transaction.operation else { return transaction.to }
return operation.to
}

var direction: TransactionDirection {
if currentWallet.address.description == transaction.from ||
currentWallet.address.description.lowercased() == transaction.from.lowercased() {
return .outgoing
if currentWallet.address.description == transactionTo || currentWallet.address.description.lowercased() == transactionTo.lowercased() {
return .incoming
}
return .incoming
return .outgoing
}

var confirmations: Int? {
Expand Down

0 comments on commit 688778d

Please sign in to comment.