AlphaWallet / AlphaWallet/alpha-wallet-ios

NSAttributedString Foreground Colours being overridden and not used in TransactionHeaderView

Aperta
#6,052 3 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Swift
Stelle
631
Fork
384
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

![Simulator Screen Shot - iPhone 14 Pro - 2023-01-04 at 18 19 18 copy](https://user-images.githubusercontent.com/1050309/210536785-db131ba4-71c2-40a7-85cf-9661cfdcd53c.png)

# Problem

The foreground color in `amountTextColor` (first snippet of code) is being overridden by `Configuration.Color.Semantic.defaultHeadlineText` (fourth snippet of code). The `Colors.appHighlightGreen` and `Colors.appRed` never show up.

# First code snippet

```swift
var amountTextColor: UIColor {
switch direction {
case .incoming: return Colors.appHighlightGreen
case .outgoing: return Colors.appRed
}
}
```
This code snippet colours the text for incoming and outgoing amounts.

# Second code snippet

```swift
func amountAttributedString(for value: TransactionValue) -> NSAttributedString {
let amount = NSAttributedString(string: amountWithSign(for: value.amount), attributes: [
.font: Fonts.regular(size: 24) as Any,
.foregroundColor: amountTextColor,
])

let currency = NSAttributedString(string: " " + value.symbol, attributes: [
.font: Fonts.regular(size: 16) as Any
])

return amount + currency
}
```
This code snippet uses the colours generated by `amountTextColor`.

# Third code snippet

```swift
var fullAmountAttributedString: NSAttributedString {
return amountAttributedString(for: fullValue)
}
```

# Fourth code snippet

```swift
var amount: NSAttributedString {
NSAttributedString(string: transactionViewModel.fullAmountAttributedString.string, attributes: [
.font: Fonts.semibold(size: 20) as Any,
.foregroundColor: Configuration.Color.Semantic.defaultHeadlineText,
])
}
```

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.