Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ on:
workflow_dispatch:
inputs:
version:
description: "Version to build without publishing, for example v1.0.0"
default: "v1.0.0"
description: "Version to build without publishing, for example v1.0.1"
default: "v1.0.1"
required: true

concurrency:
Expand All @@ -25,7 +25,7 @@ permissions:
contents: read

env:
RELEASE_VERSION: ${{ inputs.version || (startsWith(github.ref, 'refs/tags/') && github.ref_name || 'v1.0.0') }}
RELEASE_VERSION: ${{ inputs.version || (startsWith(github.ref, 'refs/tags/') && github.ref_name || 'v1.0.1') }}

jobs:
validate:
Expand Down
4 changes: 2 additions & 2 deletions compose/androidApp/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ android {
applicationId = "com.dec.privatemusic2.android"
minSdk = 26
targetSdk = 35
versionCode = 10000
versionName = "1.0.0"
versionCode = 10001
versionName = "1.0.1"
}
signingConfigs {
if (hasReleaseSigning) {
Expand Down
8 changes: 7 additions & 1 deletion compose/composeApp/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,13 @@ compose.desktop {
nativeDistributions {
targetFormats(TargetFormat.Dmg, TargetFormat.Msi, TargetFormat.Deb)
packageName = "PrivateMusic"
packageVersion = "1.0.0"
packageVersion = "1.0.1"
windows {
menu = true
shortcut = true
menuGroup = "Private Music"
upgradeUuid = "7F2D5C36-2F6C-4F8D-9A4C-8D4A6E4C1001"
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.dec.privatemusic.player
import kotlinx.serialization.Serializable

interface CatalogApi {
val isDemo: Boolean get() = false
fun library(offset: Int = 0, count: Int = 200): TrackPage
fun search(query: String, offset: Int = 0, count: Int = 100): TrackPage
fun catalogMixes(): List<MusicMix>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ class CatalogViewModel(
private val api: CatalogApi,
private val scope: CoroutineScope = CoroutineScope(SupervisorJob() + Dispatchers.Default),
) {
val isDemo: Boolean get() = api.isDemo

private val mutableLibrary = MutableStateFlow<List<Track>>(emptyList())
private val mutableSearch = MutableStateFlow<List<Track>>(emptyList())
private val mutableMixes = MutableStateFlow<List<MusicMix>>(emptyList())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.dec.privatemusic.player

/** Offline catalog used by rendering tests and the opt-in desktop demo mode. */
class DemoCatalogApi : CatalogApi {
override val isDemo: Boolean = true
private val offline = mutableListOf<OfflineTrack>()

override fun library(offset: Int, count: Int): TrackPage = TrackPage(demoTracks.drop(offset).take(count), demoTracks.size)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ interface RustTransport {

class RustPlayerApi(
private val transport: RustTransport,
private val json: Json = Json { ignoreUnknownKeys = true },
private val json: Json = Json {
ignoreUnknownKeys = true
encodeDefaults = true
},
) : PlayerApi, CatalogApi {
override suspend fun state(): PlayerState = decode(buildJsonObject { put("command", "player_state") })

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,12 @@ fun PrivateMusicApp(viewModel: PlayerViewModel, sessionViewModel: SessionViewMod
val catalog = remember { CatalogViewModel(platformCatalogApi()) }
val library by catalog.library.collectAsState()
val recommendations by catalog.searchResults.collectAsState()
val homeTracks = library.ifEmpty { recommendations.ifEmpty { demoTracks } }
val catalogError by catalog.error.collectAsState()
val homeTracks = when {
catalog.isDemo -> library.ifEmpty { recommendations.ifEmpty { demoTracks } }
session.signed_in -> library.ifEmpty { recommendations }
else -> emptyList()
}
var screen by remember { mutableStateOf(Screen.Home) }
val scope = rememberCoroutineScope()

Expand Down Expand Up @@ -83,10 +88,10 @@ fun PrivateMusicApp(viewModel: PlayerViewModel, sessionViewModel: SessionViewMod
Screen.Home -> HomeScreen(
state = state,
tracks = homeTracks,
error = error,
error = error ?: catalogError,
onPlay = { index -> scope.launch { viewModel.play(homeTracks, index) } },
onDownload = { track -> catalog.download(track) },
onOpenPlayer = { screen = Screen.Player },
onOpenPlayer = { screen = if (state.track != null) Screen.Player else Screen.Profile },
onOpenQueue = { screen = Screen.Queue },
onOpenProfile = { screen = Screen.Profile },
onOpenSearch = { screen = Screen.Search },
Expand All @@ -101,7 +106,7 @@ fun PrivateMusicApp(viewModel: PlayerViewModel, sessionViewModel: SessionViewMod
onLyrics = { screen = Screen.Lyrics },
)
Screen.Queue -> QueueScreen(
tracks = queue.ifEmpty { demoTracks },
tracks = queue.ifEmpty { if (catalog.isDemo) demoTracks else emptyList() },
current = state.queue_index,
onBack = { screen = if (state.track != null) Screen.Player else Screen.Home },
onJump = { index -> scope.launch { viewModel.jump(index) } },
Expand Down Expand Up @@ -171,6 +176,9 @@ private fun HomeScreen(
}
}
if (error != null) item { Text(error, color = MaterialTheme.colorScheme.error) }
if (tracks.isEmpty() && error == null) item {
Text("Пока нет треков. Откройте «Профиль» и войдите в VK, чтобы загрузить свою музыку.", color = TextSecondary)
}
item {
Row(verticalAlignment = Alignment.CenterVertically) {
Text("Рекомендации", color = TextPrimary, fontSize = 22.sp, fontWeight = FontWeight.SemiBold, modifier = Modifier.weight(1f))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ fun SearchScreen(catalog: CatalogViewModel, onPlay: (List<Track>, Int) -> Unit)
var query by remember { mutableStateOf("") }
val tracks by catalog.searchResults.collectAsState()
LaunchedEffect(catalog) { catalog.search("") }
CatalogColumn("Поиск по VK") {
CatalogColumn("Поиск по VK", error = catalog.error.collectAsState().value) {
item {
Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) {
OutlinedTextField(value = query, onValueChange = { query = it }, modifier = Modifier.weight(1f), singleLine = true, label = { Text("Трек или исполнитель") })
Expand All @@ -99,7 +99,7 @@ fun MixesScreen(catalog: CatalogViewModel, onPlayMix: (MixLaunch) -> Unit) {
val releases by catalog.releases.collectAsState()
val loading by catalog.loading.collectAsState()
LaunchedEffect(catalog) { catalog.start() }
CatalogColumn("Миксы и релизы") {
CatalogColumn("Миксы и релизы", error = catalog.error.collectAsState().value) {
if (loading) item { LinearProgressIndicator(Modifier.fillMaxWidth()) }
items(mixes, key = { "${it.id}#${it.options}" }) { mix ->
Card(Modifier.fillMaxWidth().clickable(enabled = !loading) { catalog.playMix(mix, onPlayMix) }, colors = CardDefaults.cardColors(containerColor = MaterialTheme.colorScheme.surfaceVariant)) {
Expand Down Expand Up @@ -128,7 +128,7 @@ fun MixesScreen(catalog: CatalogViewModel, onPlayMix: (MixLaunch) -> Unit) {
fun DownloadsScreen(catalog: CatalogViewModel, onPlay: (List<Track>, Int) -> Unit) {
val downloads by catalog.downloads.collectAsState()
LaunchedEffect(catalog) { catalog.refreshDownloads() }
CatalogColumn("Загрузки") {
CatalogColumn("Загрузки", error = catalog.error.collectAsState().value) {
if (downloads.isEmpty()) item { Text("Пока ничего не загружено", color = MaterialTheme.colorScheme.onSurfaceVariant) }
itemsIndexed(downloads, key = { _, item -> item.track.key }) { index, item ->
Row(verticalAlignment = Alignment.CenterVertically) {
Expand All @@ -145,7 +145,7 @@ fun DownloadsScreen(catalog: CatalogViewModel, onPlay: (List<Track>, Int) -> Uni
fun LyricsScreen(track: Track?, catalog: CatalogViewModel) {
val lyrics by catalog.lyrics.collectAsState()
LaunchedEffect(track?.key) { if (track != null) catalog.lyrics(track) }
CatalogColumn("Текст песни") {
CatalogColumn("Текст песни", error = catalog.error.collectAsState().value) {
if (track == null) item { Text("Выберите трек") }
else {
item { Text("${track.artist} — ${track.title}", fontWeight = FontWeight.SemiBold, fontSize = 20.sp) }
Expand All @@ -161,13 +161,14 @@ fun LyricsScreen(track: Track?, catalog: CatalogViewModel) {
}

@Composable
private fun CatalogColumn(title: String, content: androidx.compose.foundation.lazy.LazyListScope.() -> Unit) {
private fun CatalogColumn(title: String, error: String? = null, content: androidx.compose.foundation.lazy.LazyListScope.() -> Unit) {
LazyColumn(
modifier = Modifier.fillMaxSize(),
contentPadding = PaddingValues(20.dp),
verticalArrangement = Arrangement.spacedBy(10.dp),
) {
item { Text(title, fontSize = 28.sp, fontWeight = FontWeight.Bold, modifier = Modifier.padding(bottom = 12.dp)) }
if (error != null) item { Text(error, color = MaterialTheme.colorScheme.error) }
content()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,17 @@ class RustPlayerApiTest {
api.close()
}

@Test
fun playTracksEncodesRustRequiredDefaults() = runBlocking {
val transport = FakeTransport()
val api = RustPlayerApi(transport)
api.playTracks(listOf(demoTracks.first()), 0)
assertTrue(transport.lastCommand.contains("\"is_hq\":false"))
assertTrue(transport.lastCommand.contains("\"artists\":[]"))
assertTrue(transport.lastCommand.contains("\"stream_url\":null"))
api.close()
}

private class FakeTransport : RustTransport {
val gate = Mutex(locked = true)
var eventsSent = 0
Expand Down
16 changes: 16 additions & 0 deletions docs/releases/1.0.1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Private Music 1.0.1

Исправительный выпуск Compose Multiplatform.

## Исправлено

- Команды воспроизведения теперь отправляют все обязательные поля Rust, включая `is_hq`; исправлена ошибка `missing field is_hq` при нажатии на трек.
- Чтение состояния плеера выполняет ровно один FFI‑запрос; ответ Rust больше не отправляется повторно как команда.
- Главная и очередь больше не показывают демонстрационные треки в production без входа в VK.
- Ошибки загрузки каталога отображаются на главной, в поиске, миксах, загрузках и текстах песен.
- Проверена загрузка упакованной Rust‑библиотеки из desktop‑ресурсов.
- Windows MSI теперь создаёт собственные ярлыки Start Menu/Desktop и использует постоянный `upgradeUuid` для обновления.

Если системный ярлык «Private Music» продолжает открывать старый Tauri из `AppData\Local\Private Music`, удалите прежнюю Tauri‑версию через «Установленные приложения» и используйте ярлык нового MSI. Удаление старой версии не требуется для запуска `C:\Program Files\PrivateMusic\PrivateMusic.exe` напрямую.

Пакеты и контрольные суммы подписаны именами версии `1.0.1`. Android сохраняет прежний `applicationId`; `versionCode` увеличен до `10001`.
Loading