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

This commit is contained in:
dankito 2020-07-23 16:24:51 +02:00
parent 388f725c32
commit fbeec09916
11 changed files with 41 additions and 32 deletions

View File

@ -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")
}
}

View File

@ -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 ]

View File

@ -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)

View File

@ -6,7 +6,7 @@ class AppData : ObservableObject {
@Inject private var presenter: BankingPresenterSwift
@Published var banks: [BUCCustomer] = []
@Published var banks: [Customer] = []
init() {

View File

@ -3,8 +3,8 @@ import CoreData
import BankingUiSwift
class CoreDataBankingPersistence: BUCIBankingPersistence {
class CoreDataBankingPersistence: IBankingPersistence, IRemitteeSearcher {
private let persistentContainer: NSPersistentContainer
private let mapper = Mapper()

View File

@ -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) {
}
}

View File

@ -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))
])
}
}

View File

@ -70,7 +70,7 @@ struct AddAccountDialog: View {
}
}
func handleAddAccountResponse(_ response: BUCAddAccountResponse) {
func handleAddAccountResponse(_ response: AddAccountResponse) {
if (response.isSuccessful) {
presentation.wrappedValue.dismiss()
}

View File

@ -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])
}
}
}

View File

@ -4,7 +4,7 @@ import BankingUiSwift
struct BankListItem : View {
var bank: BUCCustomer
var bank: Customer
var body: some View {

View File

@ -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()