Restore the desktop target.
- We are not targetting desktop for the time being, but unfortunately the IDE previews (which are very useful when developing UI) are only available for the Desktop target for now. It is worth keeping the desktop target just for that. We won't be spending much time focusing on desktop though. - Updated Compose multiplatform plugin and Kotlin versions. - Added coroutines swing dependency to be ablet o run the desktop app.
This commit is contained in:
parent
26436eb687
commit
8512178a24
9 changed files with 64 additions and 9 deletions
|
@ -1,3 +1,5 @@
|
|||
import org.jetbrains.compose.desktop.application.dsl.TargetFormat
|
||||
|
||||
plugins {
|
||||
alias(libs.plugins.kotlinMultiplatform)
|
||||
alias(libs.plugins.androidApplication)
|
||||
|
@ -12,7 +14,9 @@ kotlin {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
jvm("desktop")
|
||||
|
||||
listOf(
|
||||
iosX64(),
|
||||
iosArm64(),
|
||||
|
@ -49,6 +53,12 @@ kotlin {
|
|||
}
|
||||
}
|
||||
|
||||
val desktopMain by getting
|
||||
desktopMain.dependencies {
|
||||
implementation(compose.desktop.currentOs)
|
||||
implementation(libs.coroutines.swing)
|
||||
}
|
||||
|
||||
val iosX64Main by getting
|
||||
val iosArm64Main by getting
|
||||
val iosSimulatorArm64Main by getting
|
||||
|
@ -95,3 +105,16 @@ android {
|
|||
debugImplementation(libs.compose.ui.tooling)
|
||||
}
|
||||
}
|
||||
|
||||
compose.desktop {
|
||||
application {
|
||||
mainClass = "MainKt"
|
||||
|
||||
nativeDistributions {
|
||||
targetFormats(TargetFormat.Dmg, TargetFormat.Msi, TargetFormat.Deb)
|
||||
packageName = "net.agorise.kee"
|
||||
packageVersion = "1.0.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -95,5 +95,5 @@ private fun ImportAccountScreenContentLightPreview() = KeeTheme(useDarkTheme = f
|
|||
@Preview
|
||||
@Composable
|
||||
private fun ImportAccountScreenContentDarkPreview() = KeeTheme(useDarkTheme = true) {
|
||||
ImportAccountScreenContent(ImportAccountScreenModel.State())
|
||||
ImportAccountScreenContent(ImportAccountScreenModel.State(blockCount = 265482))
|
||||
}
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
package net.agorise.kee
|
||||
|
||||
class JVMPlatform: Platform {
|
||||
override val name: String = "Java ${System.getProperty("java.version")}"
|
||||
}
|
||||
|
||||
actual fun getPlatform(): Platform = JVMPlatform()
|
20
composeApp/src/desktopMain/kotlin/net/agorise/kee/main.kt
Normal file
20
composeApp/src/desktopMain/kotlin/net/agorise/kee/main.kt
Normal file
|
@ -0,0 +1,20 @@
|
|||
package net.agorise.kee
|
||||
|
||||
import androidx.compose.ui.unit.DpSize
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.window.Window
|
||||
import androidx.compose.ui.window.WindowPosition
|
||||
import androidx.compose.ui.window.application
|
||||
import androidx.compose.ui.window.rememberWindowState
|
||||
import cafe.adriel.voyager.navigator.Navigator
|
||||
import net.agorise.kee.ui.screen.home.HomeScreen
|
||||
|
||||
fun main() = application {
|
||||
val state = rememberWindowState(
|
||||
size = DpSize(420.dp, 880.dp),
|
||||
position = WindowPosition(300.dp, 300.dp)
|
||||
)
|
||||
Window(title = "Kee", onCloseRequest = ::exitApplication, state = state) {
|
||||
Navigator(HomeScreen())
|
||||
}
|
||||
}
|
|
@ -5,9 +5,9 @@ android-minSdk = "26"
|
|||
android-targetSdk = "34"
|
||||
androidx-activityCompose = "1.8.2"
|
||||
compose = "1.6.4"
|
||||
compose-plugin = "1.6.0"
|
||||
compose-plugin = "1.6.1"
|
||||
coroutines = "1.8.0"
|
||||
kotlin = "1.9.22"
|
||||
kotlin = "1.9.23"
|
||||
ktor = "2.3.9"
|
||||
multiplatform-settings = "1.1.1"
|
||||
voyager = "1.0.0"
|
||||
|
@ -16,7 +16,8 @@ voyager = "1.0.0"
|
|||
androidx-activity-compose = { group = "androidx.activity", name ="activity-compose", version.ref = "androidx-activityCompose" }
|
||||
compose-ui-tooling = { group = "androidx.compose.ui", name = "ui-tooling", version.ref = "compose" }
|
||||
compose-ui-tooling-preview = { group = "androidx.compose.ui", name = "ui-tooling-preview", version.ref = "compose" }
|
||||
coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "coroutines" }
|
||||
coroutines-core = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-core", version.ref = "coroutines" }
|
||||
coroutines-swing = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-swing", version.ref = "coroutines" }
|
||||
ktor-client-cio = { group = "io.ktor", name = "ktor-client-cio", version.ref = "ktor" }
|
||||
ktor-client-core = { group = "io.ktor", name = "ktor-client-core", version.ref = "ktor" }
|
||||
ktor-client-websockets = { group = "io.ktor", name = "ktor-client-websockets", version.ref = "ktor" }
|
||||
|
|
|
@ -12,6 +12,8 @@ kotlin {
|
|||
}
|
||||
}
|
||||
|
||||
jvm()
|
||||
|
||||
iosX64()
|
||||
iosArm64()
|
||||
iosSimulatorArm64()
|
||||
|
|
|
@ -8,10 +8,10 @@ import com.russhwolf.settings.Settings
|
|||
object KeePreferences {
|
||||
// TODO Use a stronger implementation that allows encryption
|
||||
private val settings: Settings = Settings()
|
||||
|
||||
|
||||
// Keys used to store/retrieve preferences
|
||||
private const val KEY_RECOVERY_WORDS = "key_recovery_words"
|
||||
|
||||
|
||||
fun isAccountActive(): Boolean {
|
||||
return settings.hasKey(KEY_RECOVERY_WORDS)
|
||||
}
|
||||
|
|
|
@ -12,6 +12,8 @@ kotlin {
|
|||
}
|
||||
}
|
||||
|
||||
jvm()
|
||||
|
||||
iosX64()
|
||||
iosArm64()
|
||||
iosSimulatorArm64()
|
||||
|
|
|
@ -52,7 +52,7 @@ class StargateBridge {
|
|||
incoming.receiveAsFlow().collect { message ->
|
||||
(message as? Frame.Text)?.let { textFrame ->
|
||||
val text = textFrame.readText()
|
||||
println(text)
|
||||
println("Received -> $text")
|
||||
if (text.contains("\"method\":\"Block\"")) {
|
||||
blockBroadcastChannel.send(true)
|
||||
} else if (text.contains("\"count\":")) {
|
||||
|
@ -68,7 +68,7 @@ class StargateBridge {
|
|||
private suspend fun DefaultClientWebSocketSession.writeMessages() {
|
||||
blockBroadcastChannel.receiveAsFlow().onEach {
|
||||
val blockCountRequest = getBlockCountRequest()
|
||||
println("Requesting: $blockCountRequest")
|
||||
println("Sent -> $blockCountRequest")
|
||||
outgoing.send(Frame.Text(blockCountRequest))
|
||||
}.launchIn(this)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue