add empty message check and updates dependencies
This commit is contained in:
parent
9aa03fc03f
commit
a2f8b76ac7
@ -37,7 +37,7 @@ android {
|
|||||||
compose true
|
compose true
|
||||||
}
|
}
|
||||||
composeOptions {
|
composeOptions {
|
||||||
kotlinCompilerExtensionVersion '1.1.1'
|
kotlinCompilerExtensionVersion '1.4.0'
|
||||||
}
|
}
|
||||||
packagingOptions {
|
packagingOptions {
|
||||||
resources {
|
resources {
|
||||||
@ -49,20 +49,20 @@ android {
|
|||||||
dependencies {
|
dependencies {
|
||||||
|
|
||||||
implementation 'androidx.core:core-ktx:1.9.0'
|
implementation 'androidx.core:core-ktx:1.9.0'
|
||||||
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.5.1'
|
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.6.1'
|
||||||
implementation 'androidx.activity:activity-compose:1.6.1'
|
implementation 'androidx.activity:activity-compose:1.7.0'
|
||||||
implementation "androidx.compose.ui:ui:$compose_version"
|
implementation "androidx.compose.ui:ui:$compose_version"
|
||||||
implementation "androidx.compose.ui:ui-tooling-preview:$compose_version"
|
implementation "androidx.compose.ui:ui-tooling-preview:$compose_version"
|
||||||
implementation 'androidx.compose.material3:material3:1.1.0-alpha02'
|
implementation 'androidx.compose.material3:material3:1.1.0-beta01'
|
||||||
implementation 'com.google.android.material:material:1.7.0'
|
implementation 'com.google.android.material:material:1.8.0'
|
||||||
testImplementation 'junit:junit:4.13.2'
|
testImplementation 'junit:junit:4.13.2'
|
||||||
androidTestImplementation 'androidx.test.ext:junit:1.1.4'
|
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
|
||||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.0'
|
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
|
||||||
androidTestImplementation "androidx.compose.ui:ui-test-junit4:$compose_version"
|
androidTestImplementation "androidx.compose.ui:ui-test-junit4:$compose_version"
|
||||||
debugImplementation "androidx.compose.ui:ui-tooling:$compose_version"
|
debugImplementation "androidx.compose.ui:ui-tooling:$compose_version"
|
||||||
debugImplementation "androidx.compose.ui:ui-test-manifest:$compose_version"
|
debugImplementation "androidx.compose.ui:ui-test-manifest:$compose_version"
|
||||||
|
|
||||||
implementation "androidx.navigation:navigation-compose:2.6.0-alpha04"
|
implementation "androidx.navigation:navigation-compose:2.6.0-alpha08"
|
||||||
implementation 'com.google.accompanist:accompanist-permissions:0.23.1'
|
implementation 'com.google.accompanist:accompanist-permissions:0.23.1'
|
||||||
implementation 'com.google.accompanist:accompanist-insets:0.23.1'
|
implementation 'com.google.accompanist:accompanist-insets:0.23.1'
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@ import ch.broillet.jarvis.android.chat.ConversationUiState
|
|||||||
import ch.broillet.jarvis.android.chat.Message
|
import ch.broillet.jarvis.android.chat.Message
|
||||||
import io.socket.client.IO
|
import io.socket.client.IO
|
||||||
import io.socket.client.Socket
|
import io.socket.client.Socket
|
||||||
|
import io.socket.engineio.client.transports.WebSocket
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
import java.net.URISyntaxException
|
import java.net.URISyntaxException
|
||||||
|
|
||||||
@ -14,7 +15,10 @@ object SocketHandler {
|
|||||||
@Synchronized
|
@Synchronized
|
||||||
fun setSocket() {
|
fun setSocket() {
|
||||||
try {
|
try {
|
||||||
mSocket = IO.socket("https://jarvis-server.broillet.ch")
|
val options = IO.Options()
|
||||||
|
options.transports = arrayOf(WebSocket.NAME)
|
||||||
|
|
||||||
|
mSocket = IO.socket("https://jarvis-server.broillet.ch", options)
|
||||||
} catch (_: URISyntaxException) {
|
} catch (_: URISyntaxException) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -53,7 +57,9 @@ object SocketHandler {
|
|||||||
fun messageFromJarvis(data: Array<Any>, uiState: ConversationUiState) {
|
fun messageFromJarvis(data: Array<Any>, uiState: ConversationUiState) {
|
||||||
if (data[0].toString().contains("data")) {
|
if (data[0].toString().contains("data")) {
|
||||||
val result: JSONObject = data[0] as JSONObject
|
val result: JSONObject = data[0] as JSONObject
|
||||||
uiState.addMessage(Message(true, result.getString("data")))
|
if(result.getString("data") != "") {
|
||||||
|
uiState.addMessage(Message(true, result.getString("data")))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -61,8 +67,9 @@ object SocketHandler {
|
|||||||
fun messageFromUser(data: Array<Any>, uiState: ConversationUiState) {
|
fun messageFromUser(data: Array<Any>, uiState: ConversationUiState) {
|
||||||
if (data[0].toString().contains("data")) {
|
if (data[0].toString().contains("data")) {
|
||||||
val result: JSONObject = data[0] as JSONObject
|
val result: JSONObject = data[0] as JSONObject
|
||||||
uiState.addMessage(Message(false, result.getString("data")))
|
if(result.getString("data") != "") {
|
||||||
|
uiState.addMessage(Message(false, result.getString("data")))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
buildscript {
|
buildscript {
|
||||||
ext {
|
ext {
|
||||||
compose_version = '1.1.1'
|
compose_version = '1.4.0'
|
||||||
}
|
}
|
||||||
}// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
}// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||||
plugins {
|
plugins {
|
||||||
id 'com.android.application' version '7.3.1' apply false
|
id 'com.android.application' version '7.4.2' apply false
|
||||||
id 'com.android.library' version '7.3.1' apply false
|
id 'com.android.library' version '7.4.2' apply false
|
||||||
id 'org.jetbrains.kotlin.android' version '1.6.10' apply false
|
id 'org.jetbrains.kotlin.android' version '1.8.0' apply false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@ -1,6 +1,6 @@
|
|||||||
#Tue Nov 29 18:41:19 CET 2022
|
#Tue Nov 29 18:41:19 CET 2022
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
Loading…
Reference in New Issue
Block a user