From fbeec099166d19082c80fd8effe31f3682e147ee Mon Sep 17 00:00:00 2001 From: dankito Date: Thu, 23 Jul 2020 16:24:51 +0200 Subject: [PATCH] Implemented exporting dependent libraries so that classes get exported without prefixes like 'BUC' and that imported classes and interface like IBankFinder are for Swift the same in BankFinder and BankingUiCommon --- ui/BankingUiNativeIntegration/build.gradle | 13 +++++++++++-- .../Preview Content/PreviewData.swift | 12 ++++++------ .../fints4k/DispatchQueueAsyncRunner.swift | 2 +- .../BankingiOSApp/persistence/AppData.swift | 2 +- .../CoreDataBankingPersistence.swift | 4 ++-- .../BankingiOSApp/ui/SwiftUiRouter.swift | 18 +++++++++--------- .../ui/views/AccountTransactionsDialog.swift | 6 +++--- .../ui/views/AddAccountDialog.swift | 2 +- .../ui/views/BankAccountListItem.swift | 4 ++-- .../BankingiOSApp/ui/views/BankListItem.swift | 2 +- .../ui/views/TransferMoneyDialog.swift | 8 ++++---- 11 files changed, 41 insertions(+), 32 deletions(-) diff --git a/ui/BankingUiNativeIntegration/build.gradle b/ui/BankingUiNativeIntegration/build.gradle index 8c6b5d2f..b846ff2e 100644 --- a/ui/BankingUiNativeIntegration/build.gradle +++ b/ui/BankingUiNativeIntegration/build.gradle @@ -18,6 +18,15 @@ kotlin { binaries { framework { baseName = "BankingUiSwift" + +// transitiveExport = true + export(project(":BankingUiCommon")) + export(project(":fints4kBankingClient")) + export(project(":BankFinder")) + // do not add fints4k to exports, would lead to a lot of naming conflicts. In this way fints4k classes get prefixed with 'Fints4k' which is Ok +// export(project(":fints4k")) + // exporting common would lead to naming conflicts with Foundation classes like Date, UUID, Thread, ... +// export(project(":common")) } } } @@ -27,8 +36,8 @@ kotlin { sourceSets { commonMain { dependencies { - implementation project(":BankingUiCommon") - implementation project(":fints4kBankingClient") + api project(":BankingUiCommon") + api project(":fints4kBankingClient") } } diff --git a/ui/BankingiOSApp/BankingiOSApp/Preview Content/PreviewData.swift b/ui/BankingiOSApp/BankingiOSApp/Preview Content/PreviewData.swift index f43d8ef6..d76a3557 100644 --- a/ui/BankingiOSApp/BankingiOSApp/Preview Content/PreviewData.swift +++ b/ui/BankingiOSApp/BankingiOSApp/Preview Content/PreviewData.swift @@ -4,20 +4,20 @@ import BankingUiSwift let previewBanks = createPreviewBanks() -func createPreviewBanks() -> [BUCCustomer] { - let bank1 = BUCCustomer(bankCode: "", customerId: "", password: "", finTsServerAddress: "", bankName: "Abzockbank", bic: "", customerName: "Marieke Musterfrau", userId: "", iconUrl: "", accounts: []) +func createPreviewBanks() -> [Customer] { + let bank1 = Customer(bankCode: "", customerId: "", password: "", finTsServerAddress: "", bankName: "Abzockbank", bic: "", customerName: "Marieke Musterfrau", userId: "", iconUrl: "", accounts: []) bank1.accounts = [ - BUCBankAccount(customer: bank1, productName: "Girokonto", identifier: "1234567890"), + BankAccount(customer: bank1, productName: "Girokonto", identifier: "1234567890"), - BUCBankAccount(customer: bank1, productName: "Tagesgeld Minus", identifier: "0987654321") + BankAccount(customer: bank1, productName: "Tagesgeld Minus", identifier: "0987654321") ] - let bank2 = BUCCustomer(bankCode: "", customerId: "", password: "", finTsServerAddress: "", bankName: "Kundenverarschebank", bic: "", customerName: "Marieke Musterfrau", userId: "", iconUrl: "", accounts: []) + let bank2 = Customer(bankCode: "", customerId: "", password: "", finTsServerAddress: "", bankName: "Kundenverarschebank", bic: "", customerName: "Marieke Musterfrau", userId: "", iconUrl: "", accounts: []) bank2.accounts = [ - BUCBankAccount(customer: bank2, productName: "Girokonto", identifier: "1234567890") + BankAccount(customer: bank2, productName: "Girokonto", identifier: "1234567890") ] return [ bank1, bank2 ] diff --git a/ui/BankingiOSApp/BankingiOSApp/fints4k/DispatchQueueAsyncRunner.swift b/ui/BankingiOSApp/BankingiOSApp/fints4k/DispatchQueueAsyncRunner.swift index 9d1f7bbe..ee23ccdd 100644 --- a/ui/BankingiOSApp/BankingiOSApp/fints4k/DispatchQueueAsyncRunner.swift +++ b/ui/BankingiOSApp/BankingiOSApp/fints4k/DispatchQueueAsyncRunner.swift @@ -3,7 +3,7 @@ import MultiplatformUtils import BankingUiSwift -class DispatchQueueAsyncRunner : BUCIAsyncRunner { +class DispatchQueueAsyncRunner : IAsyncRunner { func runAsync(runnable: @escaping () -> Void) { let frozen = FreezerKt.freeze(obj: runnable) diff --git a/ui/BankingiOSApp/BankingiOSApp/persistence/AppData.swift b/ui/BankingiOSApp/BankingiOSApp/persistence/AppData.swift index 11a6ec19..dcf0160f 100644 --- a/ui/BankingiOSApp/BankingiOSApp/persistence/AppData.swift +++ b/ui/BankingiOSApp/BankingiOSApp/persistence/AppData.swift @@ -6,7 +6,7 @@ class AppData : ObservableObject { @Inject private var presenter: BankingPresenterSwift - @Published var banks: [BUCCustomer] = [] + @Published var banks: [Customer] = [] init() { diff --git a/ui/BankingiOSApp/BankingiOSApp/persistence/CoreDataBankingPersistence.swift b/ui/BankingiOSApp/BankingiOSApp/persistence/CoreDataBankingPersistence.swift index d4e76b82..113c5b13 100644 --- a/ui/BankingiOSApp/BankingiOSApp/persistence/CoreDataBankingPersistence.swift +++ b/ui/BankingiOSApp/BankingiOSApp/persistence/CoreDataBankingPersistence.swift @@ -3,8 +3,8 @@ import CoreData import BankingUiSwift -class CoreDataBankingPersistence: BUCIBankingPersistence { - +class CoreDataBankingPersistence: IBankingPersistence, IRemitteeSearcher { + private let persistentContainer: NSPersistentContainer private let mapper = Mapper() diff --git a/ui/BankingiOSApp/BankingiOSApp/ui/SwiftUiRouter.swift b/ui/BankingiOSApp/BankingiOSApp/ui/SwiftUiRouter.swift index f41eb1ec..1e2e3213 100644 --- a/ui/BankingiOSApp/BankingiOSApp/ui/SwiftUiRouter.swift +++ b/ui/BankingiOSApp/BankingiOSApp/ui/SwiftUiRouter.swift @@ -1,27 +1,27 @@ import BankingUiSwift -class SwiftUiRouter : BUCIRouter { +class SwiftUiRouter : IRouter { - func showAddAccountDialog(presenter: BUCBankingPresenter) { + + func showAddAccountDialog(presenter: BankingPresenter) { } - func getTanFromUserFromNonUiThread(customer: BUCCustomer, tanChallenge: BUCTanChallenge, presenter: BUCBankingPresenter) -> BUCEnterTanResult { - return BUCEnterTanResult(enteredTan: nil, changeTanProcedureTo: nil, changeTanMediumTo: nil, changeTanMediumResultCallback: nil) + func getTanFromUserFromNonUiThread(customer: Customer, tanChallenge: TanChallenge, presenter: BankingPresenter, callback: @escaping (EnterTanResult) -> Void) { + callback(EnterTanResult.Companion().userDidNotEnterTan()) } - func getAtcFromUserFromNonUiThread(tanMedium: BUCTanGeneratorTanMedium) -> BUCEnterTanGeneratorAtcResult { - return BUCEnterTanGeneratorAtcResult(tan: nil, atc: nil) + func getAtcFromUserFromNonUiThread(tanMedium: TanGeneratorTanMedium, callback: @escaping (EnterTanGeneratorAtcResult) -> Void) { + callback(EnterTanGeneratorAtcResult.Companion().userDidNotEnterAtc()) } - func showTransferMoneyDialog(presenter: BUCBankingPresenter, preselectedBankAccount: BUCBankAccount?, preselectedValues: BUCTransferMoneyData?) { + func showTransferMoneyDialog(presenter: BankingPresenter, preselectedBankAccount: BankAccount?, preselectedValues: TransferMoneyData?) { } - func showSendMessageLogDialog(presenter: BUCBankingPresenter) { + func showSendMessageLogDialog(presenter: BankingPresenter) { } - } diff --git a/ui/BankingiOSApp/BankingiOSApp/ui/views/AccountTransactionsDialog.swift b/ui/BankingiOSApp/BankingiOSApp/ui/views/AccountTransactionsDialog.swift index a14a7303..e7035dca 100644 --- a/ui/BankingiOSApp/BankingiOSApp/ui/views/AccountTransactionsDialog.swift +++ b/ui/BankingiOSApp/BankingiOSApp/ui/views/AccountTransactionsDialog.swift @@ -6,14 +6,14 @@ struct AccountTransactionsDialog: View { var title: String - var transactions: [BUCAccountTransaction] + var transactions: [AccountTransaction] @Inject private var presenter: BankingPresenterSwift var body: some View { - List(transactions.sorted(by: { $0.valueDate.date > $1.valueDate.date } ), id: \.id) { transaction in + List(transactions.sorted(by: { $0.valueDate.date > $1.valueDate.date } ), id: \.technicalId) { transaction in HStack { VStack(alignment: .leading) { Text(transaction.bookingText ?? "") @@ -40,7 +40,7 @@ struct AccountTransactionsDialog: View { struct AccountTransactionsDialog_Previews: PreviewProvider { static var previews: some View { AccountTransactionsDialog(title: previewBanks[0].displayName, transactions: [ - BUCAccountTransaction(bankAccount: previewBanks[0].accounts[0], amount: CommonBigDecimal(double: 1234.56), currency: "€", unparsedUsage: "Usage", bookingDate: CommonDate(year: 2020, month: 5, day: 7), otherPartyName: "Marieke Musterfrau", otherPartyBankCode: nil, otherPartyAccountId: nil, bookingText: "SEPA Ueberweisung", valueDate: CommonDate(year: 2020, month: 5, day: 7)) + AccountTransaction(bankAccount: previewBanks[0].accounts[0], amount: CommonBigDecimal(double: 1234.56), currency: "€", unparsedUsage: "Usage", bookingDate: CommonDate(year: 2020, month: 5, day: 7), otherPartyName: "Marieke Musterfrau", otherPartyBankCode: nil, otherPartyAccountId: nil, bookingText: "SEPA Ueberweisung", valueDate: CommonDate(year: 2020, month: 5, day: 7)) ]) } } diff --git a/ui/BankingiOSApp/BankingiOSApp/ui/views/AddAccountDialog.swift b/ui/BankingiOSApp/BankingiOSApp/ui/views/AddAccountDialog.swift index 7167aeb6..dbc53e60 100644 --- a/ui/BankingiOSApp/BankingiOSApp/ui/views/AddAccountDialog.swift +++ b/ui/BankingiOSApp/BankingiOSApp/ui/views/AddAccountDialog.swift @@ -70,7 +70,7 @@ struct AddAccountDialog: View { } } - func handleAddAccountResponse(_ response: BUCAddAccountResponse) { + func handleAddAccountResponse(_ response: AddAccountResponse) { if (response.isSuccessful) { presentation.wrappedValue.dismiss() } diff --git a/ui/BankingiOSApp/BankingiOSApp/ui/views/BankAccountListItem.swift b/ui/BankingiOSApp/BankingiOSApp/ui/views/BankAccountListItem.swift index 26aead9a..aef3bee0 100644 --- a/ui/BankingiOSApp/BankingiOSApp/ui/views/BankAccountListItem.swift +++ b/ui/BankingiOSApp/BankingiOSApp/ui/views/BankAccountListItem.swift @@ -4,7 +4,7 @@ import BankingUiSwift struct BankAccountListItem : View { - var account: BUCBankAccount + var account: BankAccount var body: some View { @@ -23,4 +23,4 @@ struct BankAccountListItem_Previews: PreviewProvider { static var previews: some View { BankAccountListItem(account: previewBanks[0].accounts[0]) } -} \ No newline at end of file +} diff --git a/ui/BankingiOSApp/BankingiOSApp/ui/views/BankListItem.swift b/ui/BankingiOSApp/BankingiOSApp/ui/views/BankListItem.swift index e62c6721..19a60212 100644 --- a/ui/BankingiOSApp/BankingiOSApp/ui/views/BankListItem.swift +++ b/ui/BankingiOSApp/BankingiOSApp/ui/views/BankListItem.swift @@ -4,7 +4,7 @@ import BankingUiSwift struct BankListItem : View { - var bank: BUCCustomer + var bank: Customer var body: some View { diff --git a/ui/BankingiOSApp/BankingiOSApp/ui/views/TransferMoneyDialog.swift b/ui/BankingiOSApp/BankingiOSApp/ui/views/TransferMoneyDialog.swift index 6e2f59ab..f405b6bf 100644 --- a/ui/BankingiOSApp/BankingiOSApp/ui/views/TransferMoneyDialog.swift +++ b/ui/BankingiOSApp/BankingiOSApp/ui/views/TransferMoneyDialog.swift @@ -10,7 +10,7 @@ struct TransferMoneyDialog: View { private var showAccounts = false - private var accountsSupportingTransferringMoney: [BUCBankAccount] = [] + private var accountsSupportingTransferringMoney: [BankAccount] = [] @State private var selectedAccountIndex = 0 @@ -34,7 +34,7 @@ struct TransferMoneyDialog: View { @State private var transferMoneyResponseMessage: Message? = nil - private var account: BUCBankAccount? { + private var account: BankAccount? { if (self.selectedAccountIndex < self.accountsSupportingTransferringMoney.count) { return self.accountsSupportingTransferringMoney[selectedAccountIndex] } @@ -135,14 +135,14 @@ struct TransferMoneyDialog: View { } func transferMoney() { - let data = BUCTransferMoneyData(creditorName: remitteeName, creditorIban: remitteeIban, creditorBic: remitteeBic, amount: CommonBigDecimal(decimal: amount.replacingOccurrences(of: ",", with: ".")), usage: usage, instantPayment: instantPayment) + let data = TransferMoneyData(creditorName: remitteeName, creditorIban: remitteeIban, creditorBic: remitteeBic, amount: CommonBigDecimal(decimal: amount.replacingOccurrences(of: ",", with: ".")), usage: usage, instantPayment: instantPayment) presenter.transferMoneyAsync(bankAccount: account!, data: data) { response in self.handleTransferMoneyResponse(data, response) } } - func handleTransferMoneyResponse(_ data: BUCTransferMoneyData, _ response: BUCBankingClientResponse) { + func handleTransferMoneyResponse(_ data: TransferMoneyData, _ response: BankingClientResponse) { if (response.isSuccessful) { self.transferMoneyResponseMessage = Message(message: Text("Successfully transferred \(data.amount) \("€") to \(data.creditorName)"), primaryButton: .ok { self.presentation.wrappedValue.dismiss()