Skip to content

Commit babdb41

Browse files
committed
Try to wrap logic in try/catch to understand error
1 parent c16be91 commit babdb41

File tree

8 files changed

+14
-6
lines changed

8 files changed

+14
-6
lines changed

composeApp/build.gradle.kts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import org.jetbrains.compose.desktop.application.dsl.TargetFormat
22
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
33

4-
val version = "1.0.46"
4+
val version = "1.0.47"
55
val versionNumber = getVersionInt()
66

77
plugins {
@@ -33,6 +33,7 @@ kotlin {
3333
implementation(libs.coil.network.okhttp)
3434
implementation(libs.accompanist.permissions)
3535
implementation(libs.accompanist.systemuicontroller)
36+
implementation(libs.androidx.work.runtime.ktx)
3637
}
3738

3839
commonMain.dependencies {

composeApp/src/androidMain/AndroidManifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
33
<uses-permission android:name="android.permission.INTERNET"/>
4+
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
45
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
56

67
<application
@@ -20,5 +21,4 @@
2021
</intent-filter>
2122
</activity>
2223
</application>
23-
2424
</manifest>
7.74 KB
Loading
7.74 KB
Loading

composeApp/src/commonMain/kotlin/data/httpClient/RealHttpClient.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ val realHttpClient = HttpClient {
1212
install(HttpTimeout) {
1313
requestTimeoutMillis = 5 * 60 * 1000 // ChatGPT can be very slow to reply, even when streaming...
1414
socketTimeoutMillis = 5 * 60 * 1000 // ChatGPT can be very slow to reply, even when streaming...
15+
connectTimeoutMillis = 5 * 60 * 1000 // ChatGPT can be very slow to reply, even when streaming...
1516
}
1617

1718
if (ENABLE_LOGGING) {

composeApp/src/commonMain/kotlin/presentation/conversation/stateMachine/ConversationStateMachine.kt

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,14 @@ fun ConversationStateMachine(
2525
val clipboardManager = LocalClipboardManager.current
2626

2727
LaunchedEffect(state) {
28-
when (val localState = state) {
29-
is ConversationState.Init -> localState.onInit(conversationId)
30-
is ConversationState.OpenConversation -> Unit
28+
// TODO: remove after investigating desktop crash
29+
try {
30+
when (val localState = state) {
31+
is ConversationState.Init -> localState.onInit(conversationId)
32+
is ConversationState.OpenConversation -> Unit
33+
}
34+
} catch (e: Exception) {
35+
showErrorEvent = e.message + "\n" + e.stackTrace
3136
}
3237
}
3338

composeApp/src/desktopMain/kotlin/main.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
import androidx.compose.ui.platform.LocalDensity
32
import androidx.compose.ui.unit.DpSize
43
import androidx.compose.ui.unit.dp

gradle/libs.versions.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ kotlinx-io-core = "0.7.0"
1818
#noinspection GradleDependency
1919
ktor = "3.0.1" # keeping this at 3.0.1 until ktor-server-test-host is not needed (we can mock SSE events)
2020
turbine = "1.2.0"
21+
workRuntimeKtx = "2.10.1"
2122

2223
[libraries]
2324
accompanist-permissions = { module = "com.google.accompanist:accompanist-permissions", version.ref = "accompanistPermissions" }
@@ -47,6 +48,7 @@ ktor-client-mock = { module = "io.ktor:ktor-client-mock", version.ref = "ktor" }
4748
ktor-server-test-host = { module = "io.ktor:ktor-server-test-host", version.ref = "ktor" }
4849
kotlin-serialization = { module = "io.ktor:ktor-serialization-kotlinx-json", version.ref = "ktor" }
4950
turbine = { module = "app.cash.turbine:turbine", version.ref = "turbine" }
51+
androidx-work-runtime-ktx = { group = "androidx.work", name = "work-runtime-ktx", version.ref = "workRuntimeKtx" }
5052

5153
[plugins]
5254
androidApplication = { id = "com.android.application", version.ref = "agp" }

0 commit comments

Comments
 (0)