BlueWallet/ios/BlueWalletWatch Extension/Objects/TransactionTableRow.swift

67 lines
1.6 KiB
Swift
Raw Normal View History

2019-05-02 16:33:03 -04:00
//
// TransactionTableRow.swift
// BlueWalletWatch Extension
//
// Created by Marcos Rodriguez on 3/10/19.
2024-01-25 00:39:01 -04:00
2019-05-02 16:33:03 -04:00
//
import WatchKit
class TransactionTableRow: NSObject {
@IBOutlet private weak var transactionAmountLabel: WKInterfaceLabel!
@IBOutlet private weak var transactionMemoLabel: WKInterfaceLabel!
@IBOutlet private weak var transactionTimeLabel: WKInterfaceLabel!
@IBOutlet private weak var transactionTypeImage: WKInterfaceImage!
static let identifier: String = "TransactionTableRow"
var amount: String = "" {
willSet {
transactionAmountLabel.setText(newValue)
}
}
var memo: String = "" {
willSet {
transactionMemoLabel.setText(newValue)
}
}
var time: String = "" {
willSet {
if type == "pendingConfirmation" {
transactionTimeLabel.setText("Pending...")
} else {
transactionTimeLabel.setText(newValue)
}
2019-05-02 16:33:03 -04:00
}
}
var type: String = "" {
willSet {
if (newValue == "pendingConfirmation") {
transactionTypeImage.setImage(UIImage(named: "pendingConfirmation"))
} else if (newValue == "received") {
transactionTypeImage.setImage(UIImage(named: "receivedArrow"))
} else if (newValue == "sent") {
transactionTypeImage.setImage(UIImage(named: "sentArrow"))
} else {
transactionTypeImage.setImage(nil)
}
}
}
}
2024-01-25 00:39:01 -04:00
// TransactionTableRow extension for configuration
extension TransactionTableRow {
func configure(with transaction: Transaction) {
amount = transaction.amount
type = transaction.type
memo = transaction.memo
time = transaction.time
}
}