Implemented AccountTransactionDetailsDialog
This commit is contained in:
parent
c83f0992ed
commit
3ca9017bde
|
@ -34,7 +34,6 @@ import net.dankito.banking.util.extraction.NoOpTextExtractorRegistry
|
|||
import net.dankito.utils.multiplatform.*
|
||||
import net.dankito.utils.multiplatform.log.LoggerFactory
|
||||
import kotlin.collections.ArrayList
|
||||
import kotlin.jvm.JvmOverloads
|
||||
|
||||
|
||||
open class BankingPresenter(
|
||||
|
@ -422,7 +421,10 @@ open class BankingPresenter(
|
|||
}
|
||||
|
||||
|
||||
@JvmOverloads
|
||||
open fun formatAmount(amount: BigDecimal): String { // for languages not supporting default parameters
|
||||
return formatAmount(amount, null)
|
||||
}
|
||||
|
||||
open fun formatAmount(amount: BigDecimal, currencyIsoCode: String? = null): String {
|
||||
val isoCode = currencyIsoCode ?: currencyIsoCodeOfSelectedAccounts
|
||||
|
||||
|
|
|
@ -35,6 +35,11 @@
|
|||
366FA4E024C4924A0094F009 /* RecipientListItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 366FA4DF24C4924A0094F009 /* RecipientListItem.swift */; };
|
||||
366FA4E224C4ED6C0094F009 /* EnterTanDialog.swift in Sources */ = {isa = PBXBuildFile; fileRef = 366FA4E124C4ED6C0094F009 /* EnterTanDialog.swift */; };
|
||||
366FA4E624C6EBF40094F009 /* EnterTanState.swift in Sources */ = {isa = PBXBuildFile; fileRef = 366FA4E524C6EBF40094F009 /* EnterTanState.swift */; };
|
||||
3675052C251FFE98006B13A0 /* AccountTransactionDetailsDialog.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3675052B251FFE98006B13A0 /* AccountTransactionDetailsDialog.swift */; };
|
||||
36750532252006C9006B13A0 /* TextWithScrollView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 36750531252006C9006B13A0 /* TextWithScrollView.swift */; };
|
||||
3675053825201B08006B13A0 /* LabelledAmount.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3675053725201B08006B13A0 /* LabelledAmount.swift */; };
|
||||
3675053E25201D8E006B13A0 /* LabelledObject.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3675053D25201D8E006B13A0 /* LabelledObject.swift */; };
|
||||
3675054225201F0C006B13A0 /* VerticalLabelledValue.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3675054125201F0C006B13A0 /* VerticalLabelledValue.swift */; };
|
||||
3684EB8B2508F6F00001139E /* SearchBarWithLabel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3684EB8A2508F6F00001139E /* SearchBarWithLabel.swift */; };
|
||||
3684EB8F250B7F3C0001139E /* BankingUiCommon.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3684EB8E250B7F3C0001139E /* BankingUiCommon.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
|
||||
3684EB90250B7F560001139E /* BankingUiCommon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3684EB8E250B7F3C0001139E /* BankingUiCommon.framework */; };
|
||||
|
@ -182,6 +187,11 @@
|
|||
366FA4DF24C4924A0094F009 /* RecipientListItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RecipientListItem.swift; sourceTree = "<group>"; };
|
||||
366FA4E124C4ED6C0094F009 /* EnterTanDialog.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EnterTanDialog.swift; sourceTree = "<group>"; };
|
||||
366FA4E524C6EBF40094F009 /* EnterTanState.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EnterTanState.swift; sourceTree = "<group>"; };
|
||||
3675052B251FFE98006B13A0 /* AccountTransactionDetailsDialog.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountTransactionDetailsDialog.swift; sourceTree = "<group>"; };
|
||||
36750531252006C9006B13A0 /* TextWithScrollView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TextWithScrollView.swift; sourceTree = "<group>"; };
|
||||
3675053725201B08006B13A0 /* LabelledAmount.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LabelledAmount.swift; sourceTree = "<group>"; };
|
||||
3675053D25201D8E006B13A0 /* LabelledObject.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LabelledObject.swift; sourceTree = "<group>"; };
|
||||
3675054125201F0C006B13A0 /* VerticalLabelledValue.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VerticalLabelledValue.swift; sourceTree = "<group>"; };
|
||||
3684EB8A2508F6F00001139E /* SearchBarWithLabel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SearchBarWithLabel.swift; sourceTree = "<group>"; };
|
||||
3684EB8C250B7F2B0001139E /* BankingUiCommon.framework.dSYM */ = {isa = PBXFileReference; lastKnownFileType = wrapper.dsym; name = BankingUiCommon.framework.dSYM; path = "../BankingUiCommon/build/xcode-frameworks/BankingUiCommon.framework.dSYM"; sourceTree = "<group>"; };
|
||||
3684EB8E250B7F3C0001139E /* BankingUiCommon.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = BankingUiCommon.framework; path = "../BankingUiCommon/build/xcode-frameworks/BankingUiCommon.framework"; sourceTree = "<group>"; };
|
||||
|
@ -322,6 +332,7 @@
|
|||
36BE065A24CA4B3500CBBB68 /* SelectBankDialog.swift */,
|
||||
36FC92DB24B3A4A0002B12E9 /* AccountsDialog.swift */,
|
||||
36BCF88A24C0BD2D005BEC29 /* AccountTransactionsDialog.swift */,
|
||||
3675052B251FFE98006B13A0 /* AccountTransactionDetailsDialog.swift */,
|
||||
36BCF88C24C1C1EA005BEC29 /* TransferMoneyDialog.swift */,
|
||||
366FA4E124C4ED6C0094F009 /* EnterTanDialog.swift */,
|
||||
36E21ED024DC540400649DC8 /* SettingsDialog.swift */,
|
||||
|
@ -561,7 +572,11 @@
|
|||
361116A7250562BE00315620 /* FaceIDButton.swift */,
|
||||
361116A9250562CF00315620 /* TouchIDButton.swift */,
|
||||
3684EB8A2508F6F00001139E /* SearchBarWithLabel.swift */,
|
||||
3675053D25201D8E006B13A0 /* LabelledObject.swift */,
|
||||
3684EB91250FD4AF0001139E /* LabelledValue.swift */,
|
||||
3675053725201B08006B13A0 /* LabelledAmount.swift */,
|
||||
3675054125201F0C006B13A0 /* VerticalLabelledValue.swift */,
|
||||
36750531252006C9006B13A0 /* TextWithScrollView.swift */,
|
||||
36428CFE251BEC4C009DE1AE /* SectionWithoutBackground.swift */,
|
||||
);
|
||||
path = views;
|
||||
|
@ -739,6 +754,7 @@
|
|||
3642F00C25010021005186FE /* UIKitActivityIndicator.swift in Sources */,
|
||||
36E21ECB24D88DF000649DC8 /* UIKitExtensions.swift in Sources */,
|
||||
36428CFF251BEC4C009DE1AE /* SectionWithoutBackground.swift in Sources */,
|
||||
3675053E25201D8E006B13A0 /* LabelledObject.swift in Sources */,
|
||||
360782C524E541970098FEFE /* ScaleImageView.swift in Sources */,
|
||||
366FA4E224C4ED6C0094F009 /* EnterTanDialog.swift in Sources */,
|
||||
361116AA250562CF00315620 /* TouchIDButton.swift in Sources */,
|
||||
|
@ -785,6 +801,7 @@
|
|||
36B8A4512503DE1800C15359 /* LoginDialog.swift in Sources */,
|
||||
36FC929C24B39A05002B12E9 /* AppDelegate.swift in Sources */,
|
||||
36BCF88B24C0BD2D005BEC29 /* AccountTransactionsDialog.swift in Sources */,
|
||||
3675054225201F0C006B13A0 /* VerticalLabelledValue.swift in Sources */,
|
||||
36BCF87624BF114F005BEC29 /* UrlSessionWebClient.swift in Sources */,
|
||||
36BE06C424D0801A00CBBB68 /* Size.swift in Sources */,
|
||||
366FA4E624C6EBF40094F009 /* EnterTanState.swift in Sources */,
|
||||
|
@ -804,11 +821,14 @@
|
|||
36E21ED124DC540400649DC8 /* SettingsDialog.swift in Sources */,
|
||||
3684EB8B2508F6F00001139E /* SearchBarWithLabel.swift in Sources */,
|
||||
366FA4DC24C479120094F009 /* BankInfoListItem.swift in Sources */,
|
||||
3675052C251FFE98006B13A0 /* AccountTransactionDetailsDialog.swift in Sources */,
|
||||
36B8A44B2503D1E800C15359 /* BiometricAuthenticationService.swift in Sources */,
|
||||
36FC929E24B39A05002B12E9 /* SceneDelegate.swift in Sources */,
|
||||
3607829924E148D40098FEFE /* AdaptsToKeyboard.swift in Sources */,
|
||||
36750532252006C9006B13A0 /* TextWithScrollView.swift in Sources */,
|
||||
36E21ECF24DA0EEE00649DC8 /* IconView.swift in Sources */,
|
||||
3642F0182502723A005186FE /* UIKitButton.swift in Sources */,
|
||||
3675053825201B08006B13A0 /* LabelledAmount.swift in Sources */,
|
||||
36B8A4562503E9B200C15359 /* UIAlertBase.swift in Sources */,
|
||||
3642F01425018BA9005186FE /* TabBarController.swift in Sources */,
|
||||
36BCF88524C098C8005BEC29 /* BankAccountListItem.swift in Sources */,
|
||||
|
|
|
@ -26,6 +26,9 @@
|
|||
"BIC" = "BIC";
|
||||
"Bank Code" = "Bank Code";
|
||||
|
||||
"Amount" = "Amount";
|
||||
"Reference" = "Reference";
|
||||
|
||||
"Settings" = "Settings";
|
||||
|
||||
|
||||
|
@ -93,6 +96,21 @@
|
|||
"Could not fetch transactions for %@. Error message from your bank: %@." = "Could not fetch transactions for %@.\nError message from your bank:\n%@.";
|
||||
|
||||
|
||||
/* AccountTransactionDetailsDialog */
|
||||
|
||||
"Account Transaction Details Dialog Title" = "Transaction details";
|
||||
|
||||
"Sender" = "Sender";
|
||||
"Recipient" = "Recipient";
|
||||
"Name" = "Name";
|
||||
|
||||
"Booking text" = "Booking text";
|
||||
"Booking date" = "Booking date";
|
||||
"Value date" = "Value date";
|
||||
"Account day opening balance" = "Day opening balance";
|
||||
"Account day closing balance" = "Day closing balance";
|
||||
|
||||
|
||||
/* New action sheet */
|
||||
|
||||
"Show transfer money dialog" = "Transfer money";
|
||||
|
@ -105,8 +123,6 @@
|
|||
"Recipient IBAN" = "IBAN";
|
||||
"BIC: %@, %@" = "BIC: %@, %@";
|
||||
"No BIC found for bank code %@" = "No BIC found for bank code %@";
|
||||
"Amount" = "Amount";
|
||||
"Reference" = "Reference";
|
||||
"Enter reference" = "Optionally enter reference";
|
||||
|
||||
"Real-time transfer" = "Real-time transfer";
|
||||
|
|
|
@ -26,6 +26,9 @@
|
|||
"BIC" = "BIC";
|
||||
"Bank Code" = "Bankleitzahl";
|
||||
|
||||
"Amount" = "Betrag";
|
||||
"Reference" = "Verwendungszweck";
|
||||
|
||||
"Settings" = "Einstellungen";
|
||||
|
||||
|
||||
|
@ -93,6 +96,22 @@
|
|||
"Could not fetch transactions for %@. Error message from your bank: %@." = "Umsätze für %@ konnten nicht abgerufen werden.\nFehlermeldung Ihrer Bank:\n%@.";
|
||||
|
||||
|
||||
/* AccountTransactionDetailsDialog */
|
||||
|
||||
"Account Transaction Details Dialog Title" = "Umsatzdetails";
|
||||
|
||||
"Sender" = "Zahlender"; // TODO: Sender?
|
||||
"Recipient" = "Empfänger";
|
||||
"Name" = "Name";
|
||||
|
||||
"Booking text" = "Buchungstext";
|
||||
"Booking date" = "Buchungsdatum";
|
||||
"Value date" = "Wertstellungsdatum";
|
||||
"Account day opening balance" = "Taganfangssaldo";
|
||||
"Account day closing balance" = "Tagschlusssaldo";
|
||||
|
||||
|
||||
|
||||
/* New action sheet */
|
||||
|
||||
"Show transfer money dialog" = "Überweisung";
|
||||
|
@ -105,8 +124,6 @@
|
|||
"Recipient IBAN" = "IBAN";
|
||||
"BIC: %@, %@" = "BIC: %@, %@";
|
||||
"No BIC found for bank code %@" = "Keine BIC gefunden für BLZ %@";
|
||||
"Amount" = "Betrag";
|
||||
"Reference" = "Verwendungszweck";
|
||||
"Enter reference" = "Optional einen Verwendungszweck eingeben";
|
||||
|
||||
"Real-time transfer" = "Echtzeitüberweisung";
|
||||
|
|
|
@ -0,0 +1,68 @@
|
|||
import SwiftUI
|
||||
import BankingUiSwift
|
||||
|
||||
|
||||
struct AccountTransactionDetailsDialog: View {
|
||||
|
||||
private let transaction: IAccountTransaction
|
||||
|
||||
|
||||
@Inject private var presenter: BankingPresenterSwift
|
||||
|
||||
|
||||
init(_ transaction: IAccountTransaction) {
|
||||
self.transaction = transaction
|
||||
}
|
||||
|
||||
|
||||
var body: some View {
|
||||
Form {
|
||||
if transaction.otherPartyName != nil || transaction.otherPartyAccountId != nil {
|
||||
Section(header: Text(transaction.amount.isPositive ? "Sender" : "Recipient")) {
|
||||
LabelledValue("Name", transaction.otherPartyName)
|
||||
|
||||
LabelledValue("IBAN", transaction.otherPartyAccountId) // TODO: check if it's really an IBAN
|
||||
|
||||
LabelledValue("BIC", transaction.otherPartyBankCode) // TODO: check if it's really a BIC
|
||||
}
|
||||
}
|
||||
|
||||
Section {
|
||||
LabelledAmount("Amount", transaction.amount, transaction.currency)
|
||||
|
||||
VerticalLabelledValue("Reference", transaction.reference)
|
||||
}
|
||||
|
||||
Section {
|
||||
LabelledValue("Booking text", transaction.bookingText ?? "")
|
||||
|
||||
LabelledValue("Booking date", presenter.formatToMediumDate(date: transaction.bookingDate))
|
||||
|
||||
LabelledValue("Value date", presenter.formatToMediumDate(date: transaction.valueDate))
|
||||
|
||||
LabelledObject("Account") {
|
||||
IconedTitleView(transaction.account)
|
||||
}
|
||||
|
||||
if let openingBalance = transaction.openingBalance {
|
||||
LabelledAmount("Account day opening balance", openingBalance, transaction.currency)
|
||||
}
|
||||
|
||||
if let closingBalance = transaction.closingBalance {
|
||||
LabelledAmount("Account day closing balance", closingBalance, transaction.currency)
|
||||
}
|
||||
}
|
||||
}
|
||||
.showNavigationBarTitle("Account Transaction Details Dialog Title")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
struct AccountTransactionDetailsDialog_Previews: PreviewProvider {
|
||||
|
||||
static var previews: some View {
|
||||
AccountTransactionDetailsDialog(AccountTransaction(account: previewBanks[0].accounts[0] as! BankAccount, otherPartyName: "Other party name", unparsedReference: "Reference", amount: CommonBigDecimal(decimal: "84.23"), valueDate: CommonDate(year: 2020, month: 10, day: 21), bookingText: "Booking text"))
|
||||
}
|
||||
|
||||
}
|
|
@ -110,6 +110,9 @@ struct AccountTransactionsDialog: View {
|
|||
Section {
|
||||
ForEach(filteredTransactions, id: \.technicalId) { transaction in
|
||||
AccountTransactionListItem(transaction, self.showBankIcons)
|
||||
.onTapGesture {
|
||||
SceneDelegate.navigateToView(AccountTransactionDetailsDialog(transaction))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
import SwiftUI
|
||||
import BankingUiSwift
|
||||
|
||||
|
||||
struct LabelledAmount: View {
|
||||
|
||||
private let label: LocalizedStringKey
|
||||
|
||||
private let amount: CommonBigDecimal
|
||||
|
||||
private let currencyIsoCode: String?
|
||||
|
||||
|
||||
init(_ label: LocalizedStringKey, _ amount: CommonBigDecimal, _ currencyIsoCode: String? = nil) {
|
||||
self.label = label
|
||||
self.amount = amount
|
||||
self.currencyIsoCode = currencyIsoCode
|
||||
}
|
||||
|
||||
init(_ label: String, _ amount: CommonBigDecimal, _ currencyIsoCode: String? = nil) {
|
||||
self.init(LocalizedStringKey(label), amount, currencyIsoCode)
|
||||
}
|
||||
|
||||
|
||||
var body: some View {
|
||||
LabelledObject(label) {
|
||||
AmountLabel(amount, currencyIsoCode)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
struct LabelledDate_Previews: PreviewProvider {
|
||||
|
||||
static var previews: some View {
|
||||
LabelledAmount("Amount", CommonBigDecimal(double: 84.25), "EUR")
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
import SwiftUI
|
||||
|
||||
|
||||
struct LabelledObject<Content: View>: View {
|
||||
|
||||
private let label: LocalizedStringKey
|
||||
|
||||
private let objectView: () -> Content
|
||||
|
||||
|
||||
init(_ label: LocalizedStringKey, @ViewBuilder _ objectView: @escaping () -> Content) {
|
||||
self.label = label
|
||||
self.objectView = objectView
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
HStack {
|
||||
Text(label)
|
||||
|
||||
Spacer()
|
||||
|
||||
objectView()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
struct LabelledObject_Previews: PreviewProvider {
|
||||
|
||||
static var previews: some View {
|
||||
LabelledObject("Label") {
|
||||
Text("Value")
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -7,8 +7,6 @@ struct LabelledValue: View {
|
|||
|
||||
private let value: LocalizedStringKey
|
||||
|
||||
@State private var textFitsIntoAvailableSpace = true
|
||||
|
||||
|
||||
init(_ label: LocalizedStringKey, _ value: LocalizedStringKey) {
|
||||
self.label = label
|
||||
|
@ -21,11 +19,7 @@ struct LabelledValue: View {
|
|||
|
||||
|
||||
var body: some View {
|
||||
HStack {
|
||||
Text(label)
|
||||
|
||||
Spacer()
|
||||
|
||||
LabelledObject(label) {
|
||||
TextWithScrollView(value)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
import SwiftUI
|
||||
|
||||
|
||||
struct VerticalLabelledValue: View {
|
||||
|
||||
private let label: LocalizedStringKey
|
||||
|
||||
private let value: LocalizedStringKey
|
||||
|
||||
|
||||
init(_ label: LocalizedStringKey, _ value: LocalizedStringKey) {
|
||||
self.label = label
|
||||
self.value = value
|
||||
}
|
||||
|
||||
init(_ label: LocalizedStringKey, _ value: String) {
|
||||
self.init(label, LocalizedStringKey(value))
|
||||
}
|
||||
|
||||
|
||||
var body: some View {
|
||||
VStack(alignment: .leading) {
|
||||
HStack {
|
||||
Text(label)
|
||||
|
||||
Spacer()
|
||||
}
|
||||
|
||||
Spacer()
|
||||
|
||||
Text(value)
|
||||
.detailForegroundColor()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
struct VerticalLabelledValue_Previews: PreviewProvider {
|
||||
|
||||
static var previews: some View {
|
||||
VerticalLabelledValue("Label", "Value")
|
||||
}
|
||||
|
||||
}
|
|
@ -11,14 +11,9 @@ struct BankAccountListItem : View {
|
|||
|
||||
var body: some View {
|
||||
NavigationLink(destination: LazyView(AccountTransactionsDialog(account: self.account)), isActive: $navigateToAccountTransactionsDialog) {
|
||||
HStack {
|
||||
Text(account.displayName)
|
||||
|
||||
Spacer()
|
||||
|
||||
AmountLabel(account.balance, account.currency)
|
||||
}.frame(height: 35)
|
||||
.background(Color.systemBackground) // make background tapable
|
||||
LabelledAmount(account.displayName, account.balance, account.currency)
|
||||
.frame(height: 35)
|
||||
.background(Color.systemBackground) // make background tapable
|
||||
}
|
||||
.disabled( !account.isAccountTypeSupportedByApplication)
|
||||
.contextMenu {
|
||||
|
|
Loading…
Reference in New Issue