diff --git a/gradle.properties b/gradle.properties index d3ef4f11..19dabe89 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,21 +1,28 @@ -#Gradle +# Gradle org.gradle.jvmargs=-Xmx8g -XX:MaxMetaspaceSize=1g -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 -Dkotlin.daemon.jvm.options\="-Xmx8g" org.gradle.caching=true org.gradle.configuration-cache=true -#Kotlin +# Kotlin kotlin.code.style=official -#Android +# Android android.useAndroidX=true android.nonTransitiveRClass=true -#Versioning -shared.version=0.0.9 +# Versioning +shared.version=0.0.11 node.name=Bisq -node.android.version=0.0.5 +node.android.version=0.0.7 client.name=BisqClient -client.android.version=0.0.3 -client.ios.version=0.0.3 \ No newline at end of file +client.android.version=0.0.5 +client.ios.version=0.0.5 + +# Networking + +## Defaults for connectivity when not set by user +client.x.trustednode.port=8090 +client.android.trustednode.ip=10.0.2.2 +client.ios.trustednode.ip=localhost \ No newline at end of file diff --git a/shared/domain/build.gradle.kts b/shared/domain/build.gradle.kts index 29828d66..d3806ad6 100644 --- a/shared/domain/build.gradle.kts +++ b/shared/domain/build.gradle.kts @@ -2,11 +2,49 @@ plugins { alias(libs.plugins.kotlinMultiplatform) alias(libs.plugins.kotlinCocoapods) alias(libs.plugins.androidLibrary) + alias(libs.plugins.buildconfig) kotlin("plugin.serialization") version "2.0.21" } version = project.findProperty("shared.version") as String +// NOTE: The following allow us to configure each app type independently and link for example with gradle.properties +// local.properties overrides any property if you need to setup for example local networking +// TODO potentially to be refactored into a shared/common module +buildConfig { + useKotlinOutput { internalVisibility = false } + forClass("network.bisq.mobile.client.shared", className = "BuildConfig") { + buildConfigField("APP_NAME", project.findProperty("client.name").toString()) + buildConfigField( + "ANDROID_APP_VERSION", + project.findProperty("client.android.version").toString() + ) + buildConfigField("IOS_APP_VERSION", project.findProperty("client.ios.version").toString()) + buildConfigField("SHARED_LIBS_VERSION", project.version.toString()) + buildConfigField("BUILD_TS", System.currentTimeMillis()) + // networking setup + buildConfigField("WS_PORT", project.findProperty("client.x.trustednode.port").toString()) + buildConfigField("WS_ANDROID_HOST", project.findProperty("client.android.trustednode.ip").toString()) + buildConfigField("WS_IOS_HOST", project.findProperty("client.ios.trustednode.ip").toString()) + } + forClass("network.bisq.mobile.android.node", className = "BuildNodeConfig") { + buildConfigField("APP_NAME", project.findProperty("node.name").toString()) + buildConfigField("APP_VERSION", project.findProperty("node.android.version").toString()) + buildConfigField("SHARED_LIBS_VERSION", project.version.toString()) + buildConfigField("BUILD_TS", System.currentTimeMillis()) + } +// buildConfigField("APP_SECRET", "Z3JhZGxlLWphdmEtYnVpbGRjb25maWctcGx1Z2lu") +// buildConfigField("OPTIONAL", null) +// buildConfigField("FEATURE_ENABLED", true) +// buildConfigField("MAGIC_NUMBERS", intArrayOf(1, 2, 3, 4)) +// buildConfigField("STRING_LIST", arrayOf("a", "b", "c")) +// buildConfigField("MAP", mapOf("a" to 1, "b" to 2)) +// buildConfigField("FILE", File("aFile")) +// buildConfigField("URI", uri("https://example.io")) +// buildConfigField("com.github.gmazzo.buildconfig.demos.kts.SomeData", "DATA", "SomeData(\"a\", 1)") + +} + kotlin { androidTarget { compilations.all { diff --git a/shared/domain/src/commonMain/kotlin/network/bisq/mobile/client/di/ClientModule.kt b/shared/domain/src/commonMain/kotlin/network/bisq/mobile/client/di/ClientModule.kt index b85d4da7..dcb37145 100644 --- a/shared/domain/src/commonMain/kotlin/network/bisq/mobile/client/di/ClientModule.kt +++ b/shared/domain/src/commonMain/kotlin/network/bisq/mobile/client/di/ClientModule.kt @@ -14,6 +14,7 @@ import network.bisq.mobile.client.market.ClientMarketPriceServiceFacade import network.bisq.mobile.client.market.MarketPriceApiGateway import network.bisq.mobile.client.offerbook.ClientOfferbookServiceFacade import network.bisq.mobile.client.offerbook.offer.OfferbookApiGateway +import network.bisq.mobile.client.shared.BuildConfig import network.bisq.mobile.client.websocket.WebSocketClient import network.bisq.mobile.client.websocket.rest_api_proxy.WebSocketRestApiClient import network.bisq.mobile.client.websocket.messages.SubscriptionRequest @@ -69,9 +70,9 @@ val clientModule = module { single { ClientApplicationBootstrapFacade() } single(named("RestApiHost")) { provideRestApiHost() } - single(named("RestApiPort")) { 8090 } + single(named("RestApiPort")) { (BuildConfig.WS_PORT.takeIf { it.isNotEmpty() } ?: "8090").toInt() } single(named("WebsocketApiHost")) { provideWebsocketHost() } - single(named("WebsocketApiPort")) { 8090 } + single(named("WebsocketApiPort")) { (BuildConfig.WS_PORT.takeIf { it.isNotEmpty() } ?: "8090").toInt() } single { WebSocketClient( @@ -103,9 +104,9 @@ val clientModule = module { } fun provideRestApiHost(): String { - return "10.0.2.2" // Default for Android emulator + return BuildConfig.WS_ANDROID_HOST.takeIf { it.isNotEmpty() } ?: "10.0.2.2" } fun provideWebsocketHost(): String { - return "10.0.2.2" // Default for Android emulator + return BuildConfig.WS_ANDROID_HOST.takeIf { it.isNotEmpty() } ?: "10.0.2.2" } \ No newline at end of file diff --git a/shared/domain/src/iosMain/kotlin/network/bisq/mobile/domain/di/ClientModule.ios.kt b/shared/domain/src/iosMain/kotlin/network/bisq/mobile/domain/di/ClientModule.ios.kt index efee0183..a613cc73 100644 --- a/shared/domain/src/iosMain/kotlin/network/bisq/mobile/domain/di/ClientModule.ios.kt +++ b/shared/domain/src/iosMain/kotlin/network/bisq/mobile/domain/di/ClientModule.ios.kt @@ -1,5 +1,6 @@ package network.bisq.mobile.domain.di +import network.bisq.mobile.client.shared.BuildConfig import network.bisq.mobile.domain.service.controller.NotificationServiceController import org.koin.core.qualifier.named import org.koin.dsl.module @@ -16,8 +17,8 @@ val iosClientModule = module { } fun provideRestApiHost(): String { - return "localhost" + return BuildConfig.WS_IOS_HOST.takeIf { it.isNotEmpty() } ?: "localhost" } fun provideWebsocketHost(): String { - return "localhost" + return BuildConfig.WS_IOS_HOST.takeIf { it.isNotEmpty() } ?: "localhost" } \ No newline at end of file diff --git a/shared/presentation/build.gradle.kts b/shared/presentation/build.gradle.kts index 0b9af696..5a876a4a 100644 --- a/shared/presentation/build.gradle.kts +++ b/shared/presentation/build.gradle.kts @@ -7,7 +7,6 @@ plugins { alias(libs.plugins.androidLibrary) alias(libs.plugins.jetbrainsCompose) alias(libs.plugins.compose.compiler) - alias(libs.plugins.buildconfig) alias(libs.plugins.ksp) } @@ -18,37 +17,6 @@ dependencies { version = project.findProperty("shared.version") as String -// The following allow us to configure each app type independently and link for example with gradle.properties -// TODO potentially to be refactored into a shared/common module -buildConfig { - forClass("network.bisq.mobile.client.shared", className = "BuildConfig") { - buildConfigField("APP_NAME", project.findProperty("client.name").toString()) - buildConfigField( - "ANDROID_APP_VERSION", - project.findProperty("client.android.version").toString() - ) - buildConfigField("IOS_APP_VERSION", project.findProperty("client.ios.version").toString()) - buildConfigField("SHARED_LIBS_VERSION", project.version.toString()) - buildConfigField("BUILD_TS", System.currentTimeMillis()) - } - forClass("network.bisq.mobile.android.node", className = "BuildNodeConfig") { - buildConfigField("APP_NAME", project.findProperty("node.name").toString()) - buildConfigField("APP_VERSION", project.findProperty("node.android.version").toString()) - buildConfigField("SHARED_LIBS_VERSION", project.version.toString()) - buildConfigField("BUILD_TS", System.currentTimeMillis()) - } -// buildConfigField("APP_SECRET", "Z3JhZGxlLWphdmEtYnVpbGRjb25maWctcGx1Z2lu") -// buildConfigField("OPTIONAL", null) -// buildConfigField("FEATURE_ENABLED", true) -// buildConfigField("MAGIC_NUMBERS", intArrayOf(1, 2, 3, 4)) -// buildConfigField("STRING_LIST", arrayOf("a", "b", "c")) -// buildConfigField("MAP", mapOf("a" to 1, "b" to 2)) -// buildConfigField("FILE", File("aFile")) -// buildConfigField("URI", uri("https://example.io")) -// buildConfigField("com.github.gmazzo.buildconfig.demos.kts.SomeData", "DATA", "SomeData(\"a\", 1)") - -} - kotlin { androidTarget { compilations.all {