Skip to content

Commit

Permalink
Last fixes for webview and SB implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
tomastiminskas committed Jan 22, 2024
1 parent 0e46983 commit 1ada87c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 14 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,6 @@ desktop/sphinx.db-journal
dev.db
*.hprof

/desktop/jcef-bundle
/desktop/cache
/desktop/kcef-bundle
/desktop/jcef-bundle
17 changes: 4 additions & 13 deletions desktop/src/jvmMain/kotlin/Main.kt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ import chat.sphinx.platform.imageResource
import chat.sphinx.utils.getPreferredWindowSize
import com.example.compose.AppTheme
import dev.datlag.kcef.KCEF
import dev.datlag.tooling.Tooling
import dev.datlag.tooling.getApplicationWriteableRootFolder
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.delay
import kotlinx.coroutines.withContext
Expand Down Expand Up @@ -137,15 +139,15 @@ fun main() = application {
var error by remember { mutableStateOf("") }
var downloading by remember { mutableStateOf(0F) }
var initialized by remember { mutableStateOf(false) } // if true, KCEF can be used to create clients, browsers etc
val isDebug = true
val isDebug = false

LaunchedEffect(Unit) {
withContext(Dispatchers.IO) { // IO scope recommended but not required

val kcefInstallDir = if (isDebug) {
File("kcef-bundle")
} else {
val rootFolder = AppIO.getWriteableExecutableFolder()
val rootFolder = Tooling.getApplicationWriteableRootFolder("Sphinx") ?: File("./")
File(rootFolder, "kcef-bundle")
}

Expand Down Expand Up @@ -173,17 +175,6 @@ fun main() = application {
}
}

// if (restartRequired) {
// toast("Restart Required")
// } else if (error.isNotEmpty()) {
// toast(error)
// println("ERROR KCEF $error")
// } else {
// if (!initialized) {
//// toast("Downloading $downloading%")
// }
// }

DisposableEffect(Unit) {
onDispose {
KCEF.disposeBlocking()
Expand Down

0 comments on commit 1ada87c

Please sign in to comment.