From 4048262fc59fa66bbab040ce4667e298b5639536 Mon Sep 17 00:00:00 2001 From: TapTap Date: Wed, 18 Nov 2026 19:39:51 +0000 Subject: [PATCH] feat: remove the Up next preview section The preview duplicated what the radio does and is not the real queue. Mood detail now only loads songs and recommendations, so opening a mood makes one fewer request. Also drop the Wasm warm-up from the CI image recipe: the target is local-only. Version 0.3.3. --- README.md | 2 +- ci/Dockerfile | 13 ++++--------- composeApp/build.gradle.kts | 2 +- .../musicmanager/client/api/ApiClient.kt | 3 --- .../musicmanager/client/store/AppStore.kt | 6 ------ .../client/ui/MoodDetailScreen.kt | 19 ------------------- .../musicmanager/client/ui/SettingsScreen.kt | 2 +- .../musicmanager/client/AppStoreTest.kt | 14 +++++++------- 8 files changed, 14 insertions(+), 47 deletions(-) diff --git a/README.md b/README.md index 7cf7b2d..e3cde19 100644 --- a/README.md +++ b/README.md @@ -200,7 +200,7 @@ Tagged builds (`v*`) publish to internal testing from CI. The Gitea secrets are: | `ANDROID_KEY_PASSWORD` | key password | | `PLAY_SERVICE_ACCOUNT_JSON` | contents of the service account JSON | -Then `git tag v0.3.2 && git push --tags` builds, signs and uploads the bundle. +Then `git tag v0.3.3 && git push --tags` builds, signs and uploads the bundle. Gradle Play Publisher asks Play for the next free `versionCode` (`ResolutionStrategy.AUTO`), so only the tag/version name needs to change. diff --git a/ci/Dockerfile b/ci/Dockerfile index 8998f21..3a543a7 100644 --- a/ci/Dockerfile +++ b/ci/Dockerfile @@ -43,21 +43,16 @@ RUN mkdir -p "$ANDROID_HOME/cmdline-tools" \ "build-tools;36.0.0" \ && rm -rf "$ANDROID_HOME/.temp" "$ANDROID_HOME/.downloadIntermediates" -# Warm the Gradle dependency cache and the Kotlin/Wasm (node, yarn, binaryen) -# toolchain so CI jobs do not download them on every run. Rebuild this image -# when dependencies change. +# Warm the Gradle dependency cache and the common/Android/desktop compilers so +# CI jobs do not download them on every run. The Wasm toolchain is intentionally +# not warmed: Wasm is not part of the pipeline. Rebuild this image when +# dependencies change. COPY . /warmup WORKDIR /warmup -# Warm dependencies and the common/Android/desktop compilers here. The Wasm -# executable build is memory hungry and stays in the web job, but node and yarn -# are cached: Kotlin downloads them from GitHub, which has been flaky during CI. RUN sed -i 's/kotlin.daemon.jvmargs=-Xmx3g/kotlin.daemon.jvmargs=-Xmx2g/' gradle.properties \ && gradle --no-daemon --max-workers=2 \ - :kotlinNodeJsSetup \ - :kotlinYarnSetup \ :composeApp:desktopTest \ :composeApp:assembleDebug \ - :composeApp:compileKotlinWasmJs \ --console=plain \ && rm -rf /warmup diff --git a/composeApp/build.gradle.kts b/composeApp/build.gradle.kts index 40a1b02..4bbadc2 100644 --- a/composeApp/build.gradle.kts +++ b/composeApp/build.gradle.kts @@ -41,7 +41,7 @@ val hasUploadKey = uploadKeyStore?.exists() == true && val appVersionCode = (System.getenv("VERSION_CODE") ?: localProperties.getProperty("VERSION_CODE") ?: "1").toInt() val appVersionName = System.getenv("VERSION_NAME") ?: localProperties.getProperty("VERSION_NAME") - ?: "0.3.2" + ?: "0.3.3" kotlin { androidTarget { diff --git a/composeApp/src/commonMain/kotlin/win/taptap/musicmanager/client/api/ApiClient.kt b/composeApp/src/commonMain/kotlin/win/taptap/musicmanager/client/api/ApiClient.kt index f1e210d..f1a9e6a 100644 --- a/composeApp/src/commonMain/kotlin/win/taptap/musicmanager/client/api/ApiClient.kt +++ b/composeApp/src/commonMain/kotlin/win/taptap/musicmanager/client/api/ApiClient.kt @@ -184,9 +184,6 @@ class ApiClient(private val http: HttpClient) { }, ) - suspend fun preview(moodId: String, limit: Int = 20): List = - get("/moods/$moodId/preview?limit=$limit").songs - suspend fun search( query: String, limit: Int = 10, diff --git a/composeApp/src/commonMain/kotlin/win/taptap/musicmanager/client/store/AppStore.kt b/composeApp/src/commonMain/kotlin/win/taptap/musicmanager/client/store/AppStore.kt index 2795f63..5f18010 100644 --- a/composeApp/src/commonMain/kotlin/win/taptap/musicmanager/client/store/AppStore.kt +++ b/composeApp/src/commonMain/kotlin/win/taptap/musicmanager/client/store/AppStore.kt @@ -45,7 +45,6 @@ data class AppState( val screen: Screen = Screen.Moods, val moods: List = emptyList(), val selectedMood: MoodDetail? = null, - val preview: List = emptyList(), val session: Session? = null, val queue: List = emptyList(), val current: Song? = null, @@ -282,23 +281,19 @@ class AppStore( loading = true, screen = Screen.MoodDetail, selectedMood = null, - preview = emptyList(), ) } try { val detail = api.mood(id) - val preview = runCatching { api.preview(id, 20) }.getOrDefault(emptyList()) if (request != moodRequestGeneration) return@launch cacheDetail(detail) _state.update { it.copy( loading = false, selectedMood = detail, - preview = preview, knownSongs = it.knownSongs + detail.songMap(), ) } - mergeSongs(preview) } catch (t: Throwable) { if (request != moodRequestGeneration) return@launch val cached = cache.load().moodDetails.firstOrNull { it.mood.id == id } @@ -307,7 +302,6 @@ class AppStore( loading = false, // Never leave a different mood editable under the new title. selectedMood = cached, - preview = emptyList(), knownSongs = it.knownSongs + (cached?.songMap() ?: emptyMap()), message = if (cached == null) t.friendlyMessage() else "Showing cached mood", messageIsError = cached == null, diff --git a/composeApp/src/commonMain/kotlin/win/taptap/musicmanager/client/ui/MoodDetailScreen.kt b/composeApp/src/commonMain/kotlin/win/taptap/musicmanager/client/ui/MoodDetailScreen.kt index bce6165..8f53c78 100644 --- a/composeApp/src/commonMain/kotlin/win/taptap/musicmanager/client/ui/MoodDetailScreen.kt +++ b/composeApp/src/commonMain/kotlin/win/taptap/musicmanager/client/ui/MoodDetailScreen.kt @@ -186,25 +186,6 @@ fun MoodDetailScreen(state: AppState, store: AppStore) { } } - if (state.preview.isNotEmpty()) { - item { - HorizontalDivider(Modifier.padding(vertical = 12.dp)) - SectionTitle("Up next") - Text( - "Preview of the radio mix: these are the tracks that would play next. " + - "Nothing here is downloaded or saved.", - style = MaterialTheme.typography.labelSmall, - color = MaterialTheme.colorScheme.onSurfaceVariant, - ) - Spacer(Modifier.height(4.dp)) - } - items(state.preview, key = { "preview-${it.id}" }) { song -> - SongRow(store, song, onPlay = { store.playSong(song) }) { - Text(formatDuration(song.duration), style = MaterialTheme.typography.labelSmall) - } - } - } - item { HorizontalDivider(Modifier.padding(vertical = 12.dp)) SectionTitle("Recommendations") { diff --git a/composeApp/src/commonMain/kotlin/win/taptap/musicmanager/client/ui/SettingsScreen.kt b/composeApp/src/commonMain/kotlin/win/taptap/musicmanager/client/ui/SettingsScreen.kt index b5d2a84..eac6af3 100644 --- a/composeApp/src/commonMain/kotlin/win/taptap/musicmanager/client/ui/SettingsScreen.kt +++ b/composeApp/src/commonMain/kotlin/win/taptap/musicmanager/client/ui/SettingsScreen.kt @@ -107,7 +107,7 @@ fun SettingsScreen(state: AppState, store: AppStore) { Column(Modifier.padding(18.dp), verticalArrangement = Arrangement.spacedBy(10.dp)) { Text("About", style = MaterialTheme.typography.titleMedium, fontWeight = FontWeight.SemiBold) Text( - "AudioManager 0.3.2 · $platformName", + "AudioManager 0.3.3 · $platformName", style = MaterialTheme.typography.bodySmall, color = MaterialTheme.colorScheme.onSurfaceVariant, ) diff --git a/composeApp/src/commonTest/kotlin/win/taptap/musicmanager/client/AppStoreTest.kt b/composeApp/src/commonTest/kotlin/win/taptap/musicmanager/client/AppStoreTest.kt index e8a6ab6..7762512 100644 --- a/composeApp/src/commonTest/kotlin/win/taptap/musicmanager/client/AppStoreTest.kt +++ b/composeApp/src/commonTest/kotlin/win/taptap/musicmanager/client/AppStoreTest.kt @@ -45,7 +45,6 @@ class AppStoreTest { "/api/v1/me" -> respond("""{"name":"alice","admin":false}""", HttpStatusCode.OK, jsonHeaders) "/api/v1/moods" -> respond("""{"moods":[${moodJson(1)}]}""", HttpStatusCode.OK, jsonHeaders) "/api/v1/moods/mo-1" -> respond(detailJson(listOf("a")), HttpStatusCode.OK, jsonHeaders) - "/api/v1/moods/mo-1/preview" -> respond("""{"songs":[]}""", HttpStatusCode.OK, jsonHeaders) "/api/v1/moods/mo-1/sessions" -> respond( """{"id":"s1","moodId":"mo-1","moodName":"Focus","startedAt":"now", "queue":[${songJson("a")}]}""", @@ -82,7 +81,6 @@ class AppStoreTest { "/api/v1/me" -> respond("""{"name":"alice","admin":false}""", HttpStatusCode.OK, jsonHeaders) "/api/v1/moods" -> respond("""{"moods":[${moodJson(0)}]}""", HttpStatusCode.OK, jsonHeaders) "/api/v1/moods/mo-1" -> respond(detailJson(emptyList()), HttpStatusCode.OK, jsonHeaders) - "/api/v1/moods/mo-1/preview" -> respond("""{"songs":[]}""", HttpStatusCode.OK, jsonHeaders) else -> respondError(HttpStatusCode.NotFound) } } @@ -205,7 +203,6 @@ class AppStoreTest { HttpStatusCode.OK, jsonHeaders, ) - "/api/v1/moods/mo-1/preview" -> respond("""{"songs":[]}""", HttpStatusCode.OK, jsonHeaders) "/api/v1/moods/mo-1/recommendations/v1/add" -> respond( """{"detail":${detailJson(listOf("a"))}, "recommendation":${recommendationJson(state = "added", songId = "a")}}""", @@ -245,8 +242,6 @@ class AppStoreTest { respond(detailJson(emptyList(), source = "deezer"), HttpStatusCode.OK, jsonHeaders) request.url.encodedPath == "/api/v1/moods/mo-1" -> respond(detailJson(emptyList()), HttpStatusCode.OK, jsonHeaders) - request.url.encodedPath == "/api/v1/moods/mo-1/preview" -> - respond("""{"songs":[]}""", HttpStatusCode.OK, jsonHeaders) request.url.encodedPath == "/api/v1/search" -> { val source = request.url.parameters["source"] val body = if (source == "deezer") { @@ -271,6 +266,13 @@ class AppStoreTest { runCurrent() store.setMoodSource("mo-1", "deezer") + awaitState("mood source updated") { + store.state.value.moods.first { it.id == "mo-1" }.source == "deezer" + } + // The source change re-runs the debounced search; move virtual time past + // the debounce before waiting for the new catalog's results. + advanceTimeBy(350) + runCurrent() awaitState { store.state.value.searchResults.any { it.source == "deezer" } } assertEquals("deezer", store.state.value.moods.first { it.id == "mo-1" }.source) @@ -345,7 +347,6 @@ class AppStoreTest { HttpStatusCode.OK, jsonHeaders, ) - "/api/v1/moods/mo-1/preview" -> respond("""{"songs":[]}""", HttpStatusCode.OK, jsonHeaders) "/api/v1/moods/mo-1/sessions" -> respond( """{"id":"s1","moodId":"mo-1","moodName":"Focus","startedAt":"now", "queue":[${songJson("a")},${songJson("b")},${songJson("c")}]}""", @@ -384,7 +385,6 @@ class AppStoreTest { "/api/v1/me" -> respond("""{"name":"alice","admin":false}""", HttpStatusCode.OK, jsonHeaders) "/api/v1/moods" -> respond("""{"moods":[${moodJson(3)}]}""", HttpStatusCode.OK, jsonHeaders) "/api/v1/moods/mo-1" -> respond(detailJson(listOf("a", "b", "c")), HttpStatusCode.OK, jsonHeaders) - "/api/v1/moods/mo-1/preview" -> respond("""{"songs":[]}""", HttpStatusCode.OK, jsonHeaders) "/api/v1/moods/mo-1/sessions" -> respond( """{"id":"s1","moodId":"mo-1","moodName":"Focus","startedAt":"now", "queue":[${songJson("a")},${songJson("b")},${songJson("c")}]}""",