28de93263b
- Add App.kt root composable with state-based routing (Login -> Schedule -> EventDetail) driven by AuthViewModel.state - Update MainActivity (Android), MainViewController (iOS), and Main.kt (Desktop) to host App() with their platform OAuthClient - Add iOS Xcode source files (MyIceApp.swift, ContentView.swift) and Info.plist with myice:// URL scheme - Delete Placeholder.kt - Add kotlinx-coroutines-swing to desktopMain to provide Dispatchers.Main for viewModelScope (app crashed on desktop without it)
106 lines
3.3 KiB
Kotlin
106 lines
3.3 KiB
Kotlin
import org.jetbrains.compose.desktop.application.dsl.TargetFormat
|
|
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
|
|
|
|
plugins {
|
|
alias(libs.plugins.kotlin.multiplatform)
|
|
alias(libs.plugins.kotlin.compose)
|
|
alias(libs.plugins.compose.multiplatform)
|
|
alias(libs.plugins.kotlin.serialization)
|
|
alias(libs.plugins.android.application)
|
|
}
|
|
|
|
kotlin {
|
|
androidTarget {
|
|
compilations.all {
|
|
compileTaskProvider.configure {
|
|
compilerOptions.jvmTarget.set(JvmTarget.JVM_11)
|
|
}
|
|
}
|
|
}
|
|
|
|
iosX64()
|
|
iosArm64()
|
|
iosSimulatorArm64()
|
|
|
|
jvm("desktop")
|
|
|
|
sourceSets {
|
|
val commonMain by getting {
|
|
dependencies {
|
|
implementation(compose.runtime)
|
|
implementation(compose.foundation)
|
|
implementation(compose.material3)
|
|
implementation(compose.components.uiToolingPreview)
|
|
implementation(libs.ktor.client.core)
|
|
implementation(libs.ktor.client.content.negotiation)
|
|
implementation(libs.ktor.serialization.kotlinx.json)
|
|
implementation(libs.kotlinx.serialization.json)
|
|
implementation(libs.kotlinx.coroutines.core)
|
|
implementation(libs.kotlinx.datetime)
|
|
implementation(libs.multiplatform.settings)
|
|
implementation(libs.multiplatform.settings.no.arg)
|
|
implementation(libs.lifecycle.viewmodel.compose)
|
|
}
|
|
}
|
|
val commonTest by getting {
|
|
dependencies {
|
|
implementation(kotlin("test"))
|
|
implementation(libs.ktor.client.mock)
|
|
implementation(libs.kotlinx.coroutines.test)
|
|
implementation(libs.multiplatform.settings.test)
|
|
}
|
|
}
|
|
val androidMain by getting {
|
|
dependencies {
|
|
implementation(libs.ktor.client.cio)
|
|
implementation(libs.androidx.activity.compose)
|
|
}
|
|
}
|
|
val desktopMain by getting {
|
|
dependencies {
|
|
implementation(libs.ktor.client.cio)
|
|
implementation(libs.kotlinx.coroutines.swing)
|
|
implementation(compose.desktop.currentOs)
|
|
}
|
|
}
|
|
}
|
|
|
|
// Darwin engine for all iOS targets
|
|
targets.filterIsInstance<org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget>()
|
|
.filter { it.konanTarget.family == org.jetbrains.kotlin.konan.target.Family.IOS }
|
|
.forEach { target ->
|
|
target.compilations.getByName("main").dependencies {
|
|
implementation(libs.ktor.client.darwin)
|
|
}
|
|
}
|
|
}
|
|
|
|
android {
|
|
namespace = "ch.parano.myice"
|
|
compileSdk = 36
|
|
|
|
defaultConfig {
|
|
applicationId = "ch.parano.myice"
|
|
minSdk = 24
|
|
targetSdk = 35
|
|
versionCode = 1
|
|
versionName = "1.0"
|
|
}
|
|
|
|
compileOptions {
|
|
sourceCompatibility = JavaVersion.VERSION_11
|
|
targetCompatibility = JavaVersion.VERSION_11
|
|
}
|
|
}
|
|
|
|
compose.desktop {
|
|
application {
|
|
mainClass = "ch.parano.myice.MainKt"
|
|
nativeDistributions {
|
|
targetFormats(TargetFormat.Dmg, TargetFormat.Msi, TargetFormat.Deb)
|
|
packageName = "myice"
|
|
packageVersion = "1.0.0"
|
|
}
|
|
}
|
|
}
|