diff --git a/zeapp/badge/build.gradle.kts b/zeapp/badge/build.gradle.kts index d6304a08..acb465c3 100644 --- a/zeapp/badge/build.gradle.kts +++ b/zeapp/badge/build.gradle.kts @@ -41,6 +41,15 @@ kotlin { } } + os.startsWith("Windows") -> + jvm("windows") { + withJavaEnabled + + jvmToolchain { + languageVersion.set(JavaLanguageVersion.of(17)) + } + } + else -> throw StopActionException("Your operating system is not supported at this time: '${os}'.") } @@ -88,6 +97,18 @@ kotlin { } } } + + os.startsWith("Windows") -> { + val windowsMain by getting { + dependencies { + implementation(libs.jSerialComm) + } + + sourceSets { + dependsOn(sourceSets.getAt("jvmMain")) + } + } + } } } } diff --git a/zeapp/badge/src/windowsMain/kotlin/de/berlindroid/zekompanion/BadgeManager.kt b/zeapp/badge/src/windowsMain/kotlin/de/berlindroid/zekompanion/BadgeManager.kt new file mode 100644 index 00000000..320694fc --- /dev/null +++ b/zeapp/badge/src/windowsMain/kotlin/de/berlindroid/zekompanion/BadgeManager.kt @@ -0,0 +1,15 @@ +package de.berlindroid.zekompanion + +import com.fazecast.jSerialComm.SerialPort + + +actual typealias Environment = Any + +actual fun buildBadgeManager(environment: Environment): BadgeManager = object : JvmBadgeManager() { + override fun getBadger2040s() = SerialPort.getCommPorts() + .filter { + // Device doesn't show any better descriptive name on Windows, this should be good enough + it.portDescription.contains("CircuitPython") + } + .toList() +} diff --git a/zeapp/badge/src/windowsMain/kotlin/de/berlindroid/zekompanion/Platform.kt b/zeapp/badge/src/windowsMain/kotlin/de/berlindroid/zekompanion/Platform.kt new file mode 100644 index 00000000..2ace3615 --- /dev/null +++ b/zeapp/badge/src/windowsMain/kotlin/de/berlindroid/zekompanion/Platform.kt @@ -0,0 +1,3 @@ +package de.berlindroid.zekompanion + +actual fun getPlatform(): String = "Windows 🪟" diff --git a/zeapp/desktop/src/main/kotlin/de/berlindroid/zekompanion/desktop/ui/NameBadgeEditor.kt b/zeapp/desktop/src/main/kotlin/de/berlindroid/zekompanion/desktop/ui/NameBadgeEditor.kt index bdd704d2..9f649853 100644 --- a/zeapp/desktop/src/main/kotlin/de/berlindroid/zekompanion/desktop/ui/NameBadgeEditor.kt +++ b/zeapp/desktop/src/main/kotlin/de/berlindroid/zekompanion/desktop/ui/NameBadgeEditor.kt @@ -31,6 +31,8 @@ import androidx.compose.ui.unit.IntSize import androidx.compose.ui.unit.TextUnit import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp +import de.berlindroid.zekompanion.BADGE_HEIGHT +import de.berlindroid.zekompanion.BADGE_WIDTH import de.berlindroid.zekompanion.desktop.State import kotlin.math.max