A shared Compose Multiplatform client for Android, desktop and web on the native mood-first API. - Bearer login with persisted, restorable sessions. - Mood grid and full editor (create, settings, seeds, delete). - Server-driven radio sessions with automatic started/completed/skipped events and prefetching. - Add to current mood or choose another mood from the player. - Library search, original MP3 downloads, offline playback of downloads. - Offline cache of moods, songs and the last sync revision. - Platform audio: Media3 on Android, MP3SPI on desktop, HTML audio on web. - Platform storage: filesystem on Android/desktop, localStorage on web. - Desktop tests for API parsing, errors and cache persistence. - Gitea CI image with Android SDK 35, build pipeline and tagged releases.
119 lines
3.5 KiB
Kotlin
119 lines
3.5 KiB
Kotlin
@file:OptIn(org.jetbrains.kotlin.gradle.ExperimentalWasmDsl::class)
|
|
|
|
import org.jetbrains.compose.desktop.application.dsl.TargetFormat
|
|
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
|
|
|
|
plugins {
|
|
kotlin("multiplatform")
|
|
kotlin("plugin.serialization")
|
|
id("org.jetbrains.compose")
|
|
id("org.jetbrains.kotlin.plugin.compose")
|
|
id("com.android.application")
|
|
}
|
|
|
|
kotlin {
|
|
androidTarget {
|
|
compilerOptions {
|
|
jvmTarget.set(JvmTarget.JVM_17)
|
|
}
|
|
}
|
|
|
|
jvm("desktop") {
|
|
compilerOptions {
|
|
jvmTarget.set(JvmTarget.JVM_17)
|
|
}
|
|
}
|
|
|
|
wasmJs {
|
|
outputModuleName.set("composeApp")
|
|
browser {
|
|
commonWebpackConfig {
|
|
outputFileName = "composeApp.js"
|
|
}
|
|
}
|
|
binaries.executable()
|
|
}
|
|
|
|
sourceSets {
|
|
commonMain.dependencies {
|
|
implementation(compose.runtime)
|
|
implementation(compose.foundation)
|
|
implementation(compose.material3)
|
|
implementation(compose.materialIconsExtended)
|
|
implementation(compose.ui)
|
|
|
|
implementation("io.ktor:ktor-client-core:3.1.2")
|
|
implementation("io.ktor:ktor-client-content-negotiation:3.1.2")
|
|
implementation("io.ktor:ktor-serialization-kotlinx-json:3.1.2")
|
|
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.10.1")
|
|
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.8.0")
|
|
}
|
|
|
|
commonTest.dependencies {
|
|
implementation(kotlin("test"))
|
|
implementation("io.ktor:ktor-client-mock:3.1.2")
|
|
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.10.1")
|
|
}
|
|
|
|
androidMain.dependencies {
|
|
implementation("io.ktor:ktor-client-okhttp:3.1.2")
|
|
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.10.1")
|
|
implementation("androidx.activity:activity-compose:1.10.1")
|
|
implementation("androidx.media3:media3-exoplayer:1.6.1")
|
|
implementation("androidx.media3:media3-common:1.6.1")
|
|
}
|
|
|
|
val desktopMain by getting {
|
|
dependencies {
|
|
implementation(compose.desktop.currentOs)
|
|
implementation("io.ktor:ktor-client-cio:3.1.2")
|
|
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-swing:1.10.1")
|
|
implementation("com.googlecode.soundlibs:mp3spi:1.9.5.4")
|
|
}
|
|
}
|
|
|
|
val wasmJsMain by getting {
|
|
dependencies {
|
|
implementation("io.ktor:ktor-client-js:3.1.2")
|
|
implementation("org.jetbrains.kotlinx:kotlinx-browser:0.3")
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
android {
|
|
namespace = "win.taptap.musicmanager.client"
|
|
compileSdk = 35
|
|
|
|
defaultConfig {
|
|
applicationId = "win.taptap.musicmanager.client"
|
|
minSdk = 26
|
|
targetSdk = 35
|
|
versionCode = 1
|
|
versionName = "0.1.0"
|
|
}
|
|
|
|
compileOptions {
|
|
sourceCompatibility = JavaVersion.VERSION_17
|
|
targetCompatibility = JavaVersion.VERSION_17
|
|
}
|
|
|
|
packaging {
|
|
resources {
|
|
excludes += "/META-INF/{AL2.0,LGPL2.1}"
|
|
}
|
|
}
|
|
}
|
|
|
|
compose.desktop {
|
|
application {
|
|
mainClass = "win.taptap.musicmanager.client.MainKt"
|
|
|
|
nativeDistributions {
|
|
targetFormats(TargetFormat.Deb, TargetFormat.Dmg, TargetFormat.Msi)
|
|
packageName = "AudioManager"
|
|
packageVersion = "1.0.0"
|
|
}
|
|
}
|
|
}
|