diff --git a/ui/BankingiOSApp/BankingiOSApp/ui/ViewExtensions.swift b/ui/BankingiOSApp/BankingiOSApp/ui/ViewExtensions.swift index f23f4a6c..63073089 100644 --- a/ui/BankingiOSApp/BankingiOSApp/ui/ViewExtensions.swift +++ b/ui/BankingiOSApp/BankingiOSApp/ui/ViewExtensions.swift @@ -37,9 +37,14 @@ extension View { .foregroundColor(Color.gray) } + func detailFont() -> some View { + return self + .font(.callout) + } + func styleAsDetail() -> some View { return self - .font(.callout) + .detailFont() .detailForegroundColor() } diff --git a/ui/BankingiOSApp/BankingiOSApp/ui/views/AccountTransactionListItem.swift b/ui/BankingiOSApp/BankingiOSApp/ui/views/AccountTransactionListItem.swift index a4d16a75..6375f05d 100644 --- a/ui/BankingiOSApp/BankingiOSApp/ui/views/AccountTransactionListItem.swift +++ b/ui/BankingiOSApp/BankingiOSApp/ui/views/AccountTransactionListItem.swift @@ -13,28 +13,43 @@ struct AccountTransactionListItem: View { }() - let transaction: AccountTransaction + private let transaction: AccountTransaction + + private let amountColor: Color @Inject private var presenter: BankingPresenterSwift + init(_ transaction: AccountTransaction) { + self.transaction = transaction + + self.amountColor = transaction.amount.decimal.doubleValue < 0.0 ? Color.red : Color.green + } + + var body: some View { HStack { VStack(alignment: .leading) { Text(getTransactionLabel(transaction)) + .font(.headline) + .padding(.bottom, 4) Text(transaction.usage) + .styleAsDetail() } Spacer() VStack(alignment: .trailing) { Text(presenter.formatAmount(amount: transaction.amount)) + .detailFont() + .foregroundColor(amountColor) Spacer() Text(Self.ValueDateFormat.string(from: transaction.valueDate.date)) + .styleAsDetail() } } } @@ -56,6 +71,6 @@ struct AccountTransactionListItem: View { struct AccountTransactionListItem_Previews: PreviewProvider { static var previews: some View { - AccountTransactionListItem(transaction: AccountTransaction(bankAccount: previewBanks[0].accounts[0], otherPartyName: "Marieke Musterfrau", unparsedUsage: "Vielen Dank für Ihre Mühen", amount: CommonBigDecimal(double: 1234.56), valueDate: CommonDate(year: 2020, month: .march, day_: 27), bookingText: "SEPA Überweisung")) + AccountTransactionListItem(AccountTransaction(bankAccount: previewBanks[0].accounts[0], otherPartyName: "Marieke Musterfrau", unparsedUsage: "Vielen Dank für Ihre Mühen", amount: CommonBigDecimal(double: 1234.56), valueDate: CommonDate(year: 2020, month: .march, day_: 27), bookingText: "SEPA Überweisung")) } } diff --git a/ui/BankingiOSApp/BankingiOSApp/ui/views/AccountTransactionsDialog.swift b/ui/BankingiOSApp/BankingiOSApp/ui/views/AccountTransactionsDialog.swift index cd83ab02..3dc615c4 100644 --- a/ui/BankingiOSApp/BankingiOSApp/ui/views/AccountTransactionsDialog.swift +++ b/ui/BankingiOSApp/BankingiOSApp/ui/views/AccountTransactionsDialog.swift @@ -14,7 +14,7 @@ struct AccountTransactionsDialog: View { var body: some View { List(transactions.sorted(by: { $0.valueDate.date > $1.valueDate.date } ), id: \.technicalId) { transaction in - AccountTransactionListItem(transaction: transaction) + AccountTransactionListItem(transaction) } .showNavigationBarTitle(LocalizedStringKey(title)) .navigationBarHidden(false)