diff --git a/settings.gradle b/settings.gradle index 54d0864e..12207d17 100644 --- a/settings.gradle +++ b/settings.gradle @@ -24,6 +24,8 @@ include ':BankingAndroidApp' include ':BankingJavaFxControls' include ':BankingJavaFxApp' +include ':BankingUiNativeIntegration' + project(':BankingUiCommon').projectDir = "$rootDir/ui/BankingUiCommon/" as File @@ -35,6 +37,8 @@ project(':BankingAndroidApp').projectDir = "$rootDir/ui/BankingAndroidApp/" as F project(':BankingJavaFxControls').projectDir = "$rootDir/ui/BankingJavaFxControls/" as File project(':BankingJavaFxApp').projectDir = "$rootDir/ui/BankingJavaFxApp/" as File +project(':BankingUiNativeIntegration').projectDir = "$rootDir/ui/BankingUiNativeIntegration/" as File + project(':BankingPersistenceJson').projectDir = "$rootDir/persistence/json/BankingPersistenceJson/" as File project(':LuceneBankingPersistence').projectDir = "$rootDir/persistence/LuceneBankingPersistence/" as File diff --git a/ui/BankingUiNativeIntegration/build.gradle b/ui/BankingUiNativeIntegration/build.gradle new file mode 100644 index 00000000..8c6b5d2f --- /dev/null +++ b/ui/BankingUiNativeIntegration/build.gradle @@ -0,0 +1,69 @@ +plugins { + id "org.jetbrains.kotlin.multiplatform" + id "maven-publish" +} + + +ext.artifactName = "banking-ui-native-integration" + + +kotlin { + targets { + // Select iOS target for real device or emulator. + final def iOSIsRealDevice = System.getenv('SDK_NAME')?.startsWith("iphoneos") + final def iOSTarget = iOSIsRealDevice ? presets.iosArm64 : presets.iosX64 + + // iOS target. + fromPreset(iOSTarget, 'ios') { + binaries { + framework { + baseName = "BankingUiSwift" + } + } + } + } + + + sourceSets { + commonMain { + dependencies { + implementation project(":BankingUiCommon") + implementation project(":fints4kBankingClient") + } + } + + + iosMain { + dependencies { + implementation "org.jetbrains.kotlin:kotlin-stdlib-common:$kotlinVersion" + } + } + + } +} + + +// Task to generate iOS framework for xcode projects. +task packForXCode(type: Sync) { + + final File frameworkDir = new File(buildDir, "xcode-frameworks") + final String mode = project.findProperty("XCODE_CONFIGURATION")?.toUpperCase() ?: 'DEBUG' + + final def framework = kotlin.targets.ios.binaries.getFramework("", mode) + + inputs.property "mode", mode + dependsOn framework.linkTask + + from { framework.outputFile.parentFile } + into frameworkDir + + doLast { + new File(frameworkDir, 'gradlew').with { + text = "#!/bin/bash\nexport 'JAVA_HOME=${System.getProperty("java.home")}'\ncd '${rootProject.rootDir}'\n./gradlew \$@\n" + setExecutable(true) + } + } +} + +// Run packForXCode when building. +tasks.build.dependsOn packForXCode \ No newline at end of file diff --git a/ui/BankingUiNativeIntegration/src/iosMain/kotlin/net/dankito/banking/BankingPresenterSwift.kt b/ui/BankingUiNativeIntegration/src/iosMain/kotlin/net/dankito/banking/BankingPresenterSwift.kt new file mode 100644 index 00000000..5f96c979 --- /dev/null +++ b/ui/BankingUiNativeIntegration/src/iosMain/kotlin/net/dankito/banking/BankingPresenterSwift.kt @@ -0,0 +1,20 @@ +package net.dankito.banking + +import net.dankito.banking.fints.webclient.IWebClient +import net.dankito.banking.persistence.NoOpBankingPersistence +import net.dankito.banking.search.NoOpRemitteeSearcher +import net.dankito.banking.ui.IRouter +import net.dankito.banking.ui.presenter.BankingPresenter +import net.dankito.banking.util.IAsyncRunner +import net.dankito.banking.util.NoOpBankIconFinder +import net.dankito.banking.util.NoOpSerializer +import net.dankito.banking.util.extraction.NoOpInvoiceDataExtractor +import net.dankito.banking.util.extraction.NoOpTextExtractorRegistry +import net.dankito.utils.multiplatform.File + + +class BankingPresenterSwift(dataFolder: File, router: IRouter, webClient: IWebClient, asyncRunner: IAsyncRunner) + : BankingPresenter(fints4kBankingClientCreator(NoOpSerializer(), webClient), BankFinder(), dataFolder, NoOpBankingPersistence(), router, + NoOpRemitteeSearcher(), NoOpBankIconFinder(), NoOpTextExtractorRegistry(), NoOpInvoiceDataExtractor(), NoOpSerializer(), asyncRunner) { + +} \ No newline at end of file