From 0ece2b1bf5d2e785bc2f08fb6284ed628d097038 Mon Sep 17 00:00:00 2001 From: dankito Date: Sun, 26 Jul 2020 19:06:25 +0200 Subject: [PATCH] Implemented showing either booking text or other party name --- .../ui/views/AccountTransactionListItem.swift | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/ui/BankingiOSApp/BankingiOSApp/ui/views/AccountTransactionListItem.swift b/ui/BankingiOSApp/BankingiOSApp/ui/views/AccountTransactionListItem.swift index 68ab3c16..a4d16a75 100644 --- a/ui/BankingiOSApp/BankingiOSApp/ui/views/AccountTransactionListItem.swift +++ b/ui/BankingiOSApp/BankingiOSApp/ui/views/AccountTransactionListItem.swift @@ -22,10 +22,8 @@ struct AccountTransactionListItem: View { var body: some View { HStack { VStack(alignment: .leading) { - Text(transaction.bookingText ?? "") - if transaction.showOtherPartyName { - Text(transaction.otherPartyName ?? "") - } + Text(getTransactionLabel(transaction)) + Text(transaction.usage) } @@ -40,6 +38,20 @@ struct AccountTransactionListItem: View { } } } + + + private func getTransactionLabel(_ transaction: AccountTransaction) -> String { + if transaction.bookingText?.localizedCaseInsensitiveCompare("Bargeldauszahlung") == ComparisonResult.orderedSame { + return transaction.bookingText ?? "" + } + + if transaction.showOtherPartyName { + return transaction.otherPartyName ?? "" + } + + return transaction.bookingText ?? "" + } + } struct AccountTransactionListItem_Previews: PreviewProvider {