diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 9c0593a..a50eaa1 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -10,10 +10,9 @@ val keystoreProperties = Properties () keystoreProperties . load ( FileInputStream ( rootProject . file ("keystore.properties") ) ) plugins { - id ("com.android.application") . version ("8.13.1") - id ("org.jetbrains.kotlin.android") . version ("2.2.21") - id ("org.jetbrains.kotlin.plugin.compose") . version ("2.2.21") - id ("org.jetbrains.kotlin.plugin.serialization") . version ("2.2.21") + id ("com.android.application") . version ("9.0.0") + id ("org.jetbrains.kotlin.plugin.compose") . version ("2.3.0") + id ("org.jetbrains.kotlin.plugin.serialization") . version ("2.3.0") } android { @@ -49,7 +48,7 @@ android { } compileOptions { // Required even though we don't have any Java sources because it needs to match Kotlin's JVM version - targetCompatibility = JavaVersion . VERSION_23 + targetCompatibility = JavaVersion . VERSION_25 } buildFeatures { compose = true @@ -58,22 +57,22 @@ android { kotlin { compilerOptions { - jvmTarget = JvmTarget . JVM_23 + jvmTarget = JvmTarget . JVM_25 } } dependencies { // Android runtime libraries implementation ( "com.google.android.material:material:1.13.0" ) - implementation ( "androidx.activity:activity-compose:1.12.1" ) + implementation ( "androidx.activity:activity-compose:1.12.2" ) implementation ( "androidx.core:core-ktx:1.17.0" ) implementation ( "androidx.compose.material3:material3:1.4.0" ) - implementation ( "androidx.compose.ui:ui:1.10.0" ) - implementation ( "androidx.compose.ui:ui-graphics:1.10.0" ) - debugImplementation ( "androidx.compose.ui:ui-tooling:1.10.0" ) + implementation ( "androidx.compose.ui:ui:1.10.1" ) + implementation ( "androidx.compose.ui:ui-graphics:1.10.1" ) + debugImplementation ( "androidx.compose.ui:ui-tooling:1.10.1" ) implementation ( "androidx.lifecycle:lifecycle-runtime-ktx:2.10.0" ) implementation ( "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.10.2" ) - implementation ( "org.jetbrains.kotlinx:kotlinx-serialization-json:1.9.0" ) + implementation ( "org.jetbrains.kotlinx:kotlinx-serialization-json:1.10.0" ) // Other libraries implementation ( "io.github.davidepianca98:kmqtt-common:1.0.0" ) implementation ( "io.github.davidepianca98:kmqtt-client:1.0.0" ) diff --git a/app/src/main/java/com/kernelmaft/zanbur/common/config.kt b/app/src/main/java/com/kernelmaft/zanbur/common/config.kt index c425c41..0fb9d9f 100644 --- a/app/src/main/java/com/kernelmaft/zanbur/common/config.kt +++ b/app/src/main/java/com/kernelmaft/zanbur/common/config.kt @@ -3,7 +3,7 @@ package com.kernelmaft.zanbur.common object Config { - const val MQTT_SERVER_HOST = "deorwine.kernelmaft.com" + const val MQTT_SERVER_HOST = "merovech.kernelmaft.com" const val MQTT_SERVER_PORT = 1883 const val MQTT_TOPIC = "zigbee2mqtt" diff --git a/app/src/main/java/com/kernelmaft/zanbur/network/exception-printer.kt b/app/src/main/java/com/kernelmaft/zanbur/network/exception-printer.kt new file mode 100644 index 0000000..cd8b172 --- /dev/null +++ b/app/src/main/java/com/kernelmaft/zanbur/network/exception-printer.kt @@ -0,0 +1,10 @@ +package com.kernelmaft.zanbur.network + +import kotlinx.coroutines.CoroutineExceptionHandler + + + +val exceptionPrinter = CoroutineExceptionHandler { _ , throwable -> + throwable . printStackTrace () + throw throwable +} diff --git a/app/src/main/java/com/kernelmaft/zanbur/network/mqtt.kt b/app/src/main/java/com/kernelmaft/zanbur/network/mqtt.kt index 212d73a..1710834 100644 --- a/app/src/main/java/com/kernelmaft/zanbur/network/mqtt.kt +++ b/app/src/main/java/com/kernelmaft/zanbur/network/mqtt.kt @@ -25,7 +25,7 @@ object MqttClient { this . coroutineScope = coroutineScope val json = Json { ignoreUnknownKeys = true } - coroutineScope . launch (IO) { + coroutineScope . launch ( IO + exceptionPrinter ) { client = MQTTClient ( MQTT5 , MQTT_SERVER_HOST , MQTT_SERVER_PORT , null ) { for ( handler in publishHandlers ) handler ( it , json ) } @@ -38,7 +38,7 @@ object MqttClient { fun addPublishHandler ( handler : MqttPublishHandler ) = publishHandlers . add (handler) fun publish ( topic : String , payload : UByteArray ) { - coroutineScope !! . launch (IO) { + coroutineScope !! . launch ( IO + exceptionPrinter ) { client !! . publish ( false , AT_MOST_ONCE , topic , payload ) } }