diff --git a/composeApp/build.gradle.kts b/composeApp/build.gradle.kts index ca58dde9..7a4816dd 100644 --- a/composeApp/build.gradle.kts +++ b/composeApp/build.gradle.kts @@ -7,6 +7,7 @@ plugins { alias(libs.plugins.composeMultiplatform) alias(libs.plugins.composeCompiler) alias(libs.plugins.composeHotReload) + alias(libs.plugins.kotlinPluginSerialization) } kotlin { @@ -32,6 +33,7 @@ kotlin { androidMain.dependencies { implementation(libs.compose.uiToolingPreview) implementation(libs.androidx.activity.compose) + implementation(libs.okhttp.coroutines) } commonMain.dependencies { implementation(libs.compose.runtime) @@ -50,7 +52,7 @@ kotlin { implementation(libs.kermit) - implementation("com.vitorpamplona.quartz:quartz:1:05.0") + implementation("com.vitorpamplona.quartz:quartz:1.05.1") } commonTest.dependencies { implementation(libs.kotlin.test) @@ -76,12 +78,17 @@ android { packaging { resources { excludes += "/META-INF/{AL2.0,LGPL2.1}" + excludes += "META-INF/versions/9/OSGI-INF/MANIFEST.MF" } } buildTypes { getByName("release") { isMinifyEnabled = false } + getByName("debug") { + applicationIdSuffix = ".debug" + versionNameSuffix = "-DEBUG" + } } compileOptions { sourceCompatibility = JavaVersion.VERSION_11 diff --git a/composeApp/src/androidMain/kotlin/ac/aux/compose/MainActivity.kt b/composeApp/src/androidMain/kotlin/ac/aux/compose/MainActivity.kt index fd938cf7..290e28e2 100644 --- a/composeApp/src/androidMain/kotlin/ac/aux/compose/MainActivity.kt +++ b/composeApp/src/androidMain/kotlin/ac/aux/compose/MainActivity.kt @@ -6,6 +6,7 @@ import androidx.activity.compose.setContent import androidx.activity.enableEdgeToEdge import androidx.compose.runtime.Composable import androidx.compose.ui.tooling.preview.Preview +import androidx.navigation.compose.rememberNavController class MainActivity : ComponentActivity() { override fun onCreate(savedInstanceState: Bundle?) { @@ -13,13 +14,11 @@ class MainActivity : ComponentActivity() { super.onCreate(savedInstanceState) setContent { - AuxApp() + val navController = rememberNavController() + + AuxApp( + navController + ) } } } - -@Preview -@Composable -fun AuxAppAndroidPreview() { - AuxApp() -} \ No newline at end of file diff --git a/composeApp/src/commonMain/kotlin/ac/aux/compose/AuxApp.kt b/composeApp/src/commonMain/kotlin/ac/aux/compose/AuxApp.kt index ce7f0712..dc1d53f5 100644 --- a/composeApp/src/commonMain/kotlin/ac/aux/compose/AuxApp.kt +++ b/composeApp/src/commonMain/kotlin/ac/aux/compose/AuxApp.kt @@ -1,27 +1,13 @@ package ac.aux.compose import ac.aux.compose.ui.composable.navigation.AuxNavHost +import ac.aux.compose.ui.composable.navigation.routes.LandingRoute import ac.aux.compose.ui.theme.AuxTheme -import androidx.compose.animation.AnimatedVisibility -import androidx.compose.foundation.Image -import androidx.compose.foundation.background -import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.fillMaxSize -import androidx.compose.foundation.layout.fillMaxWidth -import androidx.compose.foundation.layout.safeContentPadding -import androidx.compose.material3.Button -import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Surface -import androidx.compose.material3.Text import androidx.compose.runtime.* -import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier -import androidx.compose.ui.tooling.preview.Preview import androidx.navigation.NavHostController -import org.jetbrains.compose.resources.painterResource - -import aux.composeapp.generated.resources.Res -import aux.composeapp.generated.resources.compose_multiplatform @Composable fun AuxApp( @@ -39,28 +25,4 @@ fun AuxApp( } } - MaterialTheme { - var showContent by remember { mutableStateOf(false) } - Column( - modifier = Modifier - .background(MaterialTheme.colorScheme.primaryContainer) - .safeContentPadding() - .fillMaxSize(), - horizontalAlignment = Alignment.CenterHorizontally, - ) { - Button(onClick = { showContent = !showContent }) { - Text("Click me!") - } - AnimatedVisibility(showContent) { - val greeting = remember { Greeting().greet() } - Column( - modifier = Modifier.fillMaxWidth(), - horizontalAlignment = Alignment.CenterHorizontally, - ) { - Image(painterResource(Res.drawable.compose_multiplatform), null) - Text("Compose: $greeting") - } - } - } - } } \ No newline at end of file diff --git a/composeApp/src/commonMain/kotlin/ac/aux/compose/Greeting.kt b/composeApp/src/commonMain/kotlin/ac/aux/compose/Greeting.kt deleted file mode 100644 index 037fac7c..00000000 --- a/composeApp/src/commonMain/kotlin/ac/aux/compose/Greeting.kt +++ /dev/null @@ -1,9 +0,0 @@ -package ac.aux.compose - -class Greeting { - private val platform = getPlatform() - - fun greet(): String { - return "Hello, ${platform.name}!" - } -} \ No newline at end of file diff --git a/composeApp/src/commonMain/kotlin/ac/aux/compose/ui/composable/ImplementationPendingScreen.kt b/composeApp/src/commonMain/kotlin/ac/aux/compose/ui/composable/ImplementationPendingScreen.kt index 5e60f01b..38bee8f5 100644 --- a/composeApp/src/commonMain/kotlin/ac/aux/compose/ui/composable/ImplementationPendingScreen.kt +++ b/composeApp/src/commonMain/kotlin/ac/aux/compose/ui/composable/ImplementationPendingScreen.kt @@ -1,5 +1,6 @@ package ac.aux.compose.ui.composable +import ac.aux.compose.ui.theme.AuxTheme import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.fillMaxSize @@ -10,8 +11,8 @@ import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier +import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp -import org.jetbrains.compose.ui.tooling.preview.Preview @Composable fun ImplementationPendingScreen( diff --git a/composeApp/src/commonMain/kotlin/ac/aux/compose/ui/composable/LandingScreen.kt b/composeApp/src/commonMain/kotlin/ac/aux/compose/ui/composable/LandingScreen.kt index 26de16f8..fd97a437 100644 --- a/composeApp/src/commonMain/kotlin/ac/aux/compose/ui/composable/LandingScreen.kt +++ b/composeApp/src/commonMain/kotlin/ac/aux/compose/ui/composable/LandingScreen.kt @@ -5,6 +5,7 @@ import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding import androidx.compose.material3.Button @@ -14,6 +15,7 @@ import androidx.compose.material3.Surface import androidx.compose.material3.Text import androidx.compose.material3.TextButton import androidx.compose.runtime.Composable +import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.tooling.preview.Preview @@ -30,7 +32,9 @@ fun LandingScreen( modifier = Modifier.padding(innerPadding) ) { Column( - verticalArrangement = Arrangement.spacedBy(10.dp) + modifier = Modifier.fillMaxWidth(), + verticalArrangement = Arrangement.spacedBy(10.dp), + horizontalAlignment = Alignment.CenterHorizontally ) { Text( text = "Aux", diff --git a/composeApp/src/commonMain/kotlin/ac/aux/compose/ui/composable/navigation/routes/LandingRoute.kt b/composeApp/src/commonMain/kotlin/ac/aux/compose/ui/composable/navigation/routes/LandingRoute.kt index 207b2631..320bb889 100755 --- a/composeApp/src/commonMain/kotlin/ac/aux/compose/ui/composable/navigation/routes/LandingRoute.kt +++ b/composeApp/src/commonMain/kotlin/ac/aux/compose/ui/composable/navigation/routes/LandingRoute.kt @@ -3,5 +3,4 @@ package ac.aux.compose.ui.composable.navigation.routes import kotlinx.serialization.Serializable @Serializable -object LandingRoute: Route() { -} \ No newline at end of file +object LandingRoute: Route() \ No newline at end of file diff --git a/composeApp/src/iosMain/kotlin/ac/aux/compose/MainViewController.kt b/composeApp/src/iosMain/kotlin/ac/aux/compose/MainViewController.kt index 5d9b2ee8..0ed35bfe 100644 --- a/composeApp/src/iosMain/kotlin/ac/aux/compose/MainViewController.kt +++ b/composeApp/src/iosMain/kotlin/ac/aux/compose/MainViewController.kt @@ -1,5 +1,10 @@ package ac.aux.compose import androidx.compose.ui.window.ComposeUIViewController +import androidx.navigation.compose.rememberNavController -fun MainViewController() = ComposeUIViewController { AuxApp() } \ No newline at end of file +fun MainViewController() = ComposeUIViewController { + val navController = rememberNavController() + + AuxApp(navController) +} \ No newline at end of file diff --git a/composeApp/src/jvmMain/kotlin/ac/aux/compose/main.kt b/composeApp/src/jvmMain/kotlin/ac/aux/compose/main.kt index f678fd73..ff6e33f3 100644 --- a/composeApp/src/jvmMain/kotlin/ac/aux/compose/main.kt +++ b/composeApp/src/jvmMain/kotlin/ac/aux/compose/main.kt @@ -2,12 +2,14 @@ package ac.aux.compose import androidx.compose.ui.window.Window import androidx.compose.ui.window.application +import androidx.navigation.compose.rememberNavController fun main() = application { Window( onCloseRequest = ::exitApplication, title = "Aux", ) { - AuxApp() + val navController = rememberNavController() + AuxApp(navController) } } \ No newline at end of file diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 9f9cf835..a9675c18 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,7 +1,7 @@ [versions] agp = "8.11.2" android-compileSdk = "36" -android-minSdk = "24" +android-minSdk = "26" android-targetSdk = "36" androidx-activity = "1.12.2" androidx-appcompat = "1.7.1" @@ -19,6 +19,7 @@ material3 = "1.10.0-alpha05" materialIconsCore = "1.7.3" materialIconsExtended = "1.7.3" navigationCompose = "2.9.2" +okhttp = "5.3.2" [libraries] kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test", version.ref = "kotlin" } @@ -35,14 +36,16 @@ androidx-lifecycle-runtimeCompose = { module = "org.jetbrains.androidx.lifecycle compose-runtime = { module = "org.jetbrains.compose.runtime:runtime", version.ref = "composeMultiplatform" } compose-foundation = { module = "org.jetbrains.compose.foundation:foundation", version.ref = "composeMultiplatform" } compose-material3 = { module = "org.jetbrains.compose.material3:material3", version.ref = "material3" } -compose-material-icons-core = { module = "androidx.compose.material:material-icons-core", version.ref = "materialIconsCore" } -compose-material-icons-extended = { module = "androidx.compose.material:material-icons-extended", version.ref = "materialIconsExtended" } +compose-material-icons-core = { module = "org.jetbrains.compose.material:material-icons-core", version.ref = "materialIconsCore" } +compose-material-icons-extended = { module = "org.jetbrains.compose.material:material-icons-extended", version.ref = "materialIconsExtended" } compose-ui = { module = "org.jetbrains.compose.ui:ui", version.ref = "composeMultiplatform" } compose-components-resources = { module = "org.jetbrains.compose.components:components-resources", version.ref = "composeMultiplatform" } compose-uiToolingPreview = { module = "org.jetbrains.compose.ui:ui-tooling-preview", version.ref = "composeMultiplatform" } kermit = { module = "co.touchlab:kermit", version.ref = "kermit" } kotlinx-coroutinesSwing = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-swing", version.ref = "kotlinx-coroutines" } navigation-compose = { module = "org.jetbrains.androidx.navigation:navigation-compose", version.ref = "navigationCompose" } +okhttp = { group = "com.squareup.okhttp3", name = "okhttp", version.ref = "okhttp" } +okhttp-coroutines = { group = "com.squareup.okhttp3", name = "okhttp-coroutines", version.ref = "okhttp" } [plugins] androidApplication = { id = "com.android.application", version.ref = "agp" } @@ -50,4 +53,5 @@ androidLibrary = { id = "com.android.library", version.ref = "agp" } composeHotReload = { id = "org.jetbrains.compose.hot-reload", version.ref = "composeHotReload" } composeMultiplatform = { id = "org.jetbrains.compose", version.ref = "composeMultiplatform" } composeCompiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" } -kotlinMultiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" } \ No newline at end of file +kotlinMultiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" } +kotlinPluginSerialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" } \ No newline at end of file