Native Android client for Spotify, built with Jetpack Compose
Kotlin ad-freeadblockandroidjetpack-composekotlinlyricsmusic-playermusic-videomyspotispotifyspotify-adblockerspotify-clientspotify-connectspotui
2.0.2-beta.4: download sources and audio sources are extensions (songs played by an extension show their source and quality, with the queue, Play next and the song's radio as with Spotify, and Spotify plays a song no extension has), faster starts, extensions that say whether their source answers, simpler extensions screens, offline likes sent later, collaborative playlists on the owner's side, library filter chips, listening stats and friend activity, music video switch and picture-in-picture, Chinese, Russian and Polish
kota-zod99d09db66a7
diff --git a/.gitignore b/.gitignoreindex b3cb406f..495bd291 100644--- a/.gitignore+++ b/.gitignore@@ -4,6 +4,7 @@ build/.kotlin/*.apk*.zip+*.logdist/local.properties# device captures (logs can contain session data)diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 40876569..f97ff47d 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -2,6 +2,23 @@Each release on GitHub shows its section below. The app shows it too when it offers the update. Every detail: [docs/CHANGELOG-full.md](docs/CHANGELOG-full.md).+## 2.0.2-beta.4++- 🧩 **Download sources are extensions now**: the app no longer carries any download source. Install a download-source extension (Settings, Extensions) and downloads work as before: checked, encrypted, kept in Myspoti. Without one, downloads say so.+- 🔌 **For extension authors**: the `download-source` hook, `playback` events (start, progress, pause, resume, seek, skip, end) and `spotify.raw.request` (docs/extensions/API.md).+- 📊 **Plays now count on Spotify**: once the device is registered, the play reports (melody) leave from the app itself.+- 👥 **Collaborative playlists, owner side**: remove someone as a collaborator or from the playlist, or stop the collab (with a warning). Invitation links stay valid until they expire.+- 💾 **No save button** on your own playlists.+- ➕ **Add a playlist or album to another playlist**, with the choice of what to do about duplicates.+- 🗂️ **Library filter chips**: playlists, artists, albums, songs.+- 🌍 **Chinese, Russian and Polish**.+- 📈 **Listening stats**: top artists and tracks (4 weeks, 6 months, year), minutes per week counted on the phone, a "your #N artist" badge, and **friend activity**.+- 🎬 **Music videos**: a switch to turn them off, and **picture-in-picture** for clips.+- 🎧 **Songs played by an audio-source extension**: the player shows which extension plays and the quality it announces, the song shows at once with its large cover, lyrics, Canvas and like button, and the queue works as with Spotify (Play next, Add to queue, the song's radio after the last song). A song no extension has plays on Spotify instead of being skipped, and the next one goes back to the extension.+- ⚡ **Faster starts with extensions**: the next song is prepared during the current one, and a source that is slow or down is left sooner.+- 🩺 **Extensions say whether their source answers**: one that does not is shown inactive and skipped until it answers again. The extensions screens are simpler.+- 📴 **Likes and additions made offline** are sent when the network is back.+## 2.0.2-beta.3- 👋 **Leave a collaborative playlist** you joined, from the playlist's menu, like on the web player.diff --git a/README.md b/README.mdindex e370cfa5..64c09520 100644--- a/README.md+++ b/README.md@@ -4,7 +4,7 @@[](LICENSE)[](https://discord.gg/jXKnGVFnGS)-**Spotify without ads, with downloads, on a free account.** Your own Spotify account, playlists and Wrapped, in a native Android app that blocks the ads and lets you download your music in lossless quality.+**Spotify without ads, on a free account.** Your own Spotify account, playlists and Wrapped, in a native Android app that blocks the ads, with offline downloads through extensions you install.<p align="center"><img src="docs/screenshots/banner.jpg" alt="Myspoti: home, player, artist and album screens" width="100%">@@ -24,8 +24,8 @@### 🚫 Spotify with no ads, on a free accountNo audio ads, no video ads, no banners, and no 30-second break between songs. Myspoti switches off the ad breaks of Spotify's own player, so a free account plays like Premium: pick any song, skip as much as you want. No Premium, no modified Spotify app, nothing to root.-### ⬇️ Download your music, in lossless-Download a song, an album, a playlist or all your Liked Songs, and listen with no connection: on the plane, in the metro, with no data. The audio is better than Spotify's own: **lossless FLAC** (CD quality, or 24-bit hi-res when it exists), or small AAC files if you prefer. Each song is the very same recording, found by its ISRC on Tidal or Qobuz and checked before it is kept (after a one-off verification in Settings). Downloaded playlists stay in step: songs you add on Spotify download by themselves.+### ⬇️ Offline downloads, through extensions+Myspoti has no download source of its own. Install a **download-source extension** (Settings, Extensions) and you can download a song, an album, a playlist or all your Liked Songs, and listen with no connection: on the plane, in the metro, with no data. The extension decides where the files come from and in which formats (FLAC, M4A or MP3); Myspoti keeps them encrypted on your phone, refuses a file that is not the song's length, and keeps downloaded playlists in step: songs you add on Spotify download by themselves.### ✨ And everything you expect from Spotify, and moreYour home, search, library, playlists, podcasts, Spotify Connect and Android Auto, plus **word-by-word lyrics**, **official music videos** and **song meanings from Genius**.@@ -65,13 +65,19 @@ New versions are offered inside the app: one tap downloads and installs them.- Share any song, album, artist or playlist as a **Spotify Code** (scannable in the Spotify app) or a link.**Offline**-- Download songs, albums, playlists and Liked Songs, in **lossless FLAC** (CD or hi-res) or small AAC. The very recording is found by its ISRC on Tidal or Qobuz and checked before it is kept.+- With a download-source extension installed: download songs, albums, playlists and Liked Songs, in the formats the extension offers (or re-encoded to small AAC on the phone).- Downloads are encrypted and stay in Myspoti. Lists you downloaded stay in step with Spotify.- Your local audio files too.+**Extensions**+- Scripts written by other people, in a sandbox: lyrics from other sources, where a song's audio or download comes from, Home sections, menu entries, tools that use your Spotify account.+- Installing shows what an extension will do (each action with its author's reason, the critical ones marked) and asks for one tick: you install it on your own responsibility. An extension gets every action it lists, or is not installed; an update that asks for more waits for your OK and shows only what changes.+- With an audio-source extension on, every song you play (from a list, search, an artist, Recents, a link or shuffle) is asked there first, and plays on Spotify when it has nothing.+- For authors: [the extensions API](docs/extensions/API.md), and a desktop runner to test without a phone.+**And also**- Your recap: your top songs, artists and albums, kept on your phone.-- 7 languages: English, French, German, Spanish, Italian, Portuguese and Greek.+- 10 languages: English, French, German, Spanish, Italian, Portuguese, Greek, Russian, Polish and Chinese (Simplified).- Data saver, battery saver, AMOLED black, accent colour.## New since 1.1@@ -80,7 +86,7 @@ Version 2.0 is a new app, rebuilt from the ground up.- 🚀 **A new engine**: faster screens, quicker skips, and playback that recovers by itself when Spotify's player stumbles.- 🚫 **Ads stopped at the source** instead of skipped.-- 🎧 **Lossless downloads** (FLAC, hi-res) instead of YouTube audio, encrypted on your phone.+- 🎧 **Downloads through extensions** instead of built-in YouTube audio, encrypted on your phone.- 🎤 **Word-by-word lyrics**, from more sources, with **Genius song meanings**.- 🎬 **Music videos with their own sound**, in full screen, in better quality.- 👥 **Collaborative playlists**, an **Add songs** screen, and full playlist editing.@@ -105,11 +111,11 @@ Every change is in the [changelog](CHANGELOG.md).**Do downloads count in my Wrapped?** No. Songs played from a download are not reported to Spotify; they count in Myspoti's own recap only. Streamed songs and music videos count as usual.-**What leaves my phone?** Your plays go to Spotify. Lyrics are looked up on lyrics sites, song meanings on Genius, translations on Google Translate, music videos on YouTube, and downloads on the Tidal or Qobuz sources. Nothing is sent to the developer.+**What leaves my phone?** Your plays go to Spotify. Lyrics are looked up on lyrics sites, song meanings on Genius, translations on Google Translate, music videos on YouTube, and downloads on the hosts your download-source extension names (shown before you install it). Nothing is sent to the developer.## Not included-- No DRM circumvention, and no Spotify audio download: offline songs come from lossless catalogues, and a song with no lossless source is marked unavailable.+- No DRM circumvention, and no Spotify audio download: offline songs come from the download-source extension you install, and a song it has no file for is marked unavailable. Myspoti ships no download source of its own.- No ad is ever marked as heard.## Disclaimer@@ -153,9 +159,7 @@ Every push builds and tests on GitHub Actions. A `v*` tag publishes a signed APK## Credits-- UI derived from [Spotui](https://github.com/Spotui/Spotui) / [Metrolist](https://github.com/MetrolistGroup/Metrolist) (GPL-3.0); Spotui also gave the Kotlin port of the lossless resolver, the verification screen and the DASH-to-FLAC remux.-- [SpotiFLAC](https://github.com/spotbye/SpotiFLAC) (MIT): the lossless resolving idea and its community backend protocol.-- [SpotiFLAC Mobile](https://github.com/zarzet/SpotiFLAC-Mobile) (MIT) and its [extensions](https://github.com/zarzet/SpotiFLAC-Extension) (Apache-2.0): the signed download sessions and the Tidal / Qobuz requests.+- UI derived from [Spotui](https://github.com/Spotui/Spotui) / [Metrolist](https://github.com/MetrolistGroup/Metrolist) (GPL-3.0); Spotui also gave the DASH-to-FLAC remux.- [NewPipeExtractor](https://github.com/TeamNewPipe/NewPipeExtractor) (GPL-3.0): music videos.- Lyrics: [LRCLIB](https://lrclib.net), LyricsPlus, lrc.red, Kugou and NetEase; song meanings: [Genius](https://genius.com).- [Material Icons](https://github.com/google/material-design-icons) (Apache 2.0) and the [Manrope](https://github.com/googlefonts/manrope) font (SIL OFL 1.1, see `base/licenses/`).diff --git a/THIRD_PARTY_NOTICES.md b/THIRD_PARTY_NOTICES.mdindex 6849a837..675309a3 100644--- a/THIRD_PARTY_NOTICES.md+++ b/THIRD_PARTY_NOTICES.md@@ -6,39 +6,5 @@ It builds on the projects below; their licences are compatible with the GPL-3.0.## Spotui — GPL-3.0https://github.com/Spotui/Spotui-The Kotlin lossless resolver, the DASH-to-FLAC remux and the first verification-screen (`base/app/src/main/java/com/music/spotui/lossless/`, `SpotiflacScreen.kt`)-are ported from Spotui and stay under the GPL-3.0. Each file says so in its header.--## SpotiFLAC — MIT-https://github.com/spotbye/SpotiFLAC--The lossless resolving approach and its community backend protocol.--> MIT License — Copyright (c) 2026 afkarxyz.-> Permission is hereby granted, free of charge, to any person obtaining a copy of this-> software and associated documentation files (the "Software"), to deal in the Software-> without restriction, including without limitation the rights to use, copy, modify,-> merge, publish, distribute, sublicense, and/or sell copies of the Software, and to-> permit persons to whom the Software is furnished to do so, subject to the following-> conditions: The above copyright notice and this permission notice shall be included in-> all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS",-> WITHOUT WARRANTY OF ANY KIND.--## SpotiFLAC Mobile — MIT-https://github.com/zarzet/SpotiFLAC-Mobile--`ZarzSession.kt` implements the signed-session protocol of its extension runtime-(bootstrap, challenge, grant exchange, ZARZ-HMAC-V1 signatures, download tickets),-written in Kotlin from that runtime.--> MIT License — Copyright (c) 2026 zarzet. Same permission notice as above.--## SpotiFLAC Extensions — Apache-2.0-https://github.com/zarzet/SpotiFLAC-Extension--The request shapes of the `tidal-web` and `qobuz-web` extensions (download endpoints,-quality names, the Tidal web token and Qobuz app id they use) are followed in-`LosslessSource.kt`. No extension code is included.--> Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0+The DASH-to-FLAC remux (`base/app/src/main/java/com/music/spotui/data/offline/DashFlacRemux.kt`)+is ported from Spotui and stays under the GPL-3.0. The file says so in its header.diff --git a/base/api-spotify/src/main/kotlin/app/myspoti/spotify/SocialMappers.kt b/base/api-spotify/src/main/kotlin/app/myspoti/spotify/SocialMappers.ktnew file mode 100644index 00000000..d400f65c--- /dev/null+++ b/base/api-spotify/src/main/kotlin/app/myspoti/spotify/SocialMappers.kt@@ -0,0 +1,57 @@+package app.myspoti.spotify++import app.myspoti.api.AlbumRef+import app.myspoti.api.ArtistRef+import app.myspoti.api.FriendActivity+import app.myspoti.api.TimeRange+import app.myspoti.api.TopContent+import app.myspoti.api.Track+import app.myspoti.api.UserRef+import kotlinx.serialization.json.JsonElement++/**+ * The `timeRange` word of `userTopContent`'s `AffinityInput`. The Web Player's enum is+ * `SHORT_TERM`, `MID_TERM`, `LONG_TERM`; `MEDIUM_TERM` (the public Web API's word) is refused+ * with an HTTP error (checked live 2026-10-23).+ */+internal val TimeRange.gqlName: String+ get() = when (this) {+ TimeRange.SHORT_TERM -> "SHORT_TERM"+ TimeRange.MEDIUM_TERM -> "MID_TERM"+ TimeRange.LONG_TERM -> "LONG_TERM"+ }++/** `userTopContent`'s `data.me.profile`: `topArtists` (ArtistPageV2) and `topTracks` (TrackPageV2). */+internal fun topContent(profile: JsonElement?): TopContent = TopContent(+ artists = profile.list("topArtists.items").mapNotNull { artist(it.at("data")) },+ tracks = profile.list("topTracks.items").mapNotNull { track(it.at("data")) },+ artistTotal = profile.int("topArtists.totalCount"),+ trackTotal = profile.int("topTracks.totalCount"),+)++/**+ * The desktop client's `presence-view/v1/buddylist` answer: `{friends: [{timestamp, user{uri,+ * name, imageUrl}, track{uri, name, imageUrl, album{uri, name}, artist{uri, name}, context{uri,+ * name, index}}}]}`, as the Web Player's own (desktop-only) friend feed reads it. Latest first.+ */+internal fun buddyList(r: JsonElement?): List<FriendActivity> = r.list("friends").mapNotNull { f ->+ val userUri = f.str("user.uri") ?: return@mapNotNull null+ val t = f.obj("track")+ val track = t?.str("uri")?.let { uri ->+ Track(+ uri = uri,+ name = t.str("name") ?: "",+ durationMs = 0,+ artists = listOfNotNull(t.obj("artist")?.let { a -> a.str("uri")?.let { ArtistRef(it, a.str("name") ?: "") } }),+ album = t.obj("album")?.let { a -> a.str("uri")?.let { AlbumRef(it, a.str("name") ?: "") } },+ )+ }+ FriendActivity(+ user = UserRef(userUri, f.str("user.name") ?: userUri.substringAfterLast(':'), f.str("user.imageUrl")?.takeIf { it.isNotBlank() }),+ track = track,+ contextUri = t?.str("context.uri"),+ timestampMs = f.long("timestamp") ?: 0,+ contextName = t?.str("context.name")?.takeIf { it.isNotBlank() },+ trackImageUrl = t?.str("imageUrl")?.takeIf { it.isNotBlank() },+ )+}.sortedByDescending { it.timestampMs }diff --git a/base/api-spotify/src/main/kotlin/app/myspoti/spotify/SpotifyApi.kt b/base/api-spotify/src/main/kotlin/app/myspoti/spotify/SpotifyApi.ktindex 707d0905..c056f1bf 100644--- a/base/api-spotify/src/main/kotlin/app/myspoti/spotify/SpotifyApi.kt+++ b/base/api-spotify/src/main/kotlin/app/myspoti/spotify/SpotifyApi.kt@@ -73,6 +73,8 @@ class SpotifyApi(val operations: Set<String> get() = currentOps.namessuspend fun service(service: String, method: String, vararg args: JsonElement): JsonElement = bridge.service(service, method, *args)suspend fun get(url: String): JsonElement? = http.getJson(url)+ /** Any method on a Spotify address ([app.myspoti.spotify.gql.SpotifyHttp.sendRaw]). */+ suspend fun request(method: String, url: String, body: ByteArray?, headers: Map<String, String>) = http.sendRaw(method, url, body, headers)}init {diff --git a/base/api-spotify/src/main/kotlin/app/myspoti/spotify/SpotifyLibrary.kt b/base/api-spotify/src/main/kotlin/app/myspoti/spotify/SpotifyLibrary.ktindex 9b860ff8..d0240135 100644--- a/base/api-spotify/src/main/kotlin/app/myspoti/spotify/SpotifyLibrary.kt+++ b/base/api-spotify/src/main/kotlin/app/myspoti/spotify/SpotifyLibrary.kt@@ -10,6 +10,7 @@ import app.myspoti.api.Pageimport app.myspoti.api.Playlistimport app.myspoti.api.PlaylistAccessimport app.myspoti.api.PlaylistMember+import app.myspoti.api.PlaylistMergeimport app.myspoti.api.RowAdderimport app.myspoti.api.PlaylistSortimport app.myspoti.api.Playlists@@ -309,9 +310,37 @@ class SpotifyPlaylists(private val gql: Gql, private val bridge: Bridge, privatebridge.service("PlaylistPermissionsAPI", "getMembers", JsonPrimitive(uri)).list("members").mapNotNull { m ->val username = m.str("user.username") ?: return@mapNotNull nullPlaylistMember(username, m.str("user.displayName") ?: username,- m.list("user.images").firstNotNullOfOrNull { it.str("url") }, m.bool("isOwner") == true)+ m.list("user.images").firstNotNullOfOrNull { it.str("url") }, m.bool("isOwner") == true,+ isCollaborator = m.str("permissionLevel") == "CONTRIBUTOR")}.sortedByDescending { it.isOwner }+ /**+ * The members menu's "Remove as collaborator" / "Make collaborator": the page's+ * `setMemberPermission(uri, username, level)` (spclient `POST /playlist/{id}/permission/member/user/{username}`,+ * `{revision, permissionLevel}`; the page reads the member's revision itself first).+ */+ override suspend fun setMemberCollaborator(uri: Uri, username: String, collaborator: Boolean) {+ bridge.service("PlaylistPermissionsAPI", "setMemberPermission", JsonPrimitive(uri), JsonPrimitive(username),+ JsonPrimitive(if (collaborator) "CONTRIBUTOR" else "VIEWER"))+ }++ /** The members menu's "Remove from playlist": `removeMember(uri, username)` (`DELETE …/permission/member/user/{username}`). */+ override suspend fun removeMember(uri: Uri, username: String) {+ bridge.service("PlaylistPermissionsAPI", "removeMember", JsonPrimitive(uri), JsonPrimitive(username))+ }++ /**+ * Members first (a failure leaves the playlist collaborative, so the owner can retry), then the+ * base permission. Public (listed on the profile): collaborators are removed; private: they become listeners.+ */+ override suspend fun stopCollaboration(uri: Uri) {+ val public = published(uri)+ members(uri).filter { it.isCollaborator && !it.isOwner }.forEach {+ if (public) removeMember(uri, it.username) else setMemberCollaborator(uri, it.username, false)+ }+ setAccess(uri, if (public) PlaylistAccess.PUBLIC else PlaylistAccess.PRIVATE)+ }+/*** The page's "Leave playlist" (menu entry gated by `canCancelMembership`, then its dialog):* `PlaylistPermissionsAPI.removeMember(uri, ownUsername)`, which is spclient@@ -358,11 +387,14 @@ class SpotifyPlaylists(private val gql: Gql, private val bridge: Bridge, privatereturn all.sortedFor(sort, descending)}+ /** At most [PlaylistMerge.CHUNK] songs a request, each at the bottom, so a whole album or playlist keeps its order. */override suspend fun addTracks(uri: Uri, trackUris: List<Uri>) {- gql.query("addToPlaylist", vars(- "playlistItemUris" to trackUris, "playlistUri" to uri,- "newPosition" to mapOf("moveType" to "BOTTOM_OF_PLAYLIST", "fromUid" to null),- ))+ for (chunk in trackUris.chunked(PlaylistMerge.CHUNK)) {+ gql.query("addToPlaylist", vars(+ "playlistItemUris" to chunk, "playlistUri" to uri,+ "newPosition" to mapOf("moveType" to "BOTTOM_OF_PLAYLIST", "fromUid" to null),+ ))+ }}override suspend fun removeTracks(uri: Uri, uids: List<String>) {diff --git a/base/api-spotify/src/main/kotlin/app/myspoti/spotify/SpotifyMore.kt b/base/api-spotify/src/main/kotlin/app/myspoti/spotify/SpotifyMore.ktindex ea583e87..1d13a666 100644--- a/base/api-spotify/src/main/kotlin/app/myspoti/spotify/SpotifyMore.kt+++ b/base/api-spotify/src/main/kotlin/app/myspoti/spotify/SpotifyMore.kt@@ -205,6 +205,21 @@ class SpotifyPodcasts(private val gql: Gql, private val bridge: Bridge, private}class SpotifyUsers(private val gql: Gql, private val bridge: Bridge, private val http: SpotifyHttp) : Users {+ internal companion object {+ val BUDDYLIST_HOSTS = listOf("guc-spclient.spotify.com", "spclient.wg.spotify.com")++ /** `/{me}/is-blocking/{user}` on the social graph; both ids are the usernames, never the uris. */+ fun blockUrl(username: String, userUri: Uri): String {+ require(username.isNotEmpty()) { "no username" }+ val me = URLEncoder.encode(username, "UTF-8").replace("+", "%20")+ val target = URLEncoder.encode(idOf(userUri), "UTF-8").replace("+", "%20")+ return "https://spclient.wg.spotify.com/socialgraph/v4/$me/is-blocking/$target"+ }++ /** The protobuf `containsResult` (field 1, varint) of the GET, read from the body text: `08 01` is true, an empty body false. */+ fun blockedAnswer(body: String): Boolean = body.length >= 2 && body[0] == '\u0008' && body[1] == '\u0001'+ }+override suspend fun me(): Account {val p = gql.query("profileAttributes", vars()).at("data.me.profile")val a = gql.query("accountAttributes", vars()).at("data.me.account")@@ -249,14 +264,10 @@ class SpotifyUsers(private val gql: Gql, private val bridge: Bridge, private val}override suspend fun top(range: TimeRange, limit: Int): TopContent {- val input = mapOf("offset" to 0, "limit" to limit, "sortBy" to "AFFINITY", "timeRange" to range.name)- val p = gql.query("userTopContent", vars(+ val input = mapOf("offset" to 0, "limit" to limit, "sortBy" to "AFFINITY", "timeRange" to range.gqlName)+ return topContent(gql.query("userTopContent", vars("includeTopArtists" to true, "topArtistsInput" to input, "includeTopTracks" to true, "topTracksInput" to input,- )).at("data.me.profile")- return TopContent(- artists = p.list("topArtists.items").mapNotNull { artist(it.at("data")) },- tracks = p.list("topTracks.items").mapNotNull { track(it.at("data")) },- )+ )).at("data.me.profile"))}override suspend fun follow(userUris: List<Uri>) { gql.query("followUsers", vars("usernames" to userUris.map(::idOf))) }@@ -268,23 +279,45 @@ class SpotifyUsers(private val gql: Gql, private val bridge: Bridge, private valreturn userUris.map { u -> list.firstOrNull { it.str("uri") == u }?.bool("following") ?: false }}- /** The Web Player has no friend feed; this reads the desktop client's presence endpoint and returns nothing when refused. */+ // The Web Player's "Block" in a profile's menu is a plain spclient call on the social graph, with+ // the account's own username in the path; its answer to the GET is a protobuf `{ bool contains = 1 }`.+ override suspend fun isBlocked(userUri: Uri): Boolean {+ val (code, text) = http.send("GET", blockUrl(ownUsername(), userUri), accept = "application/x-protobuf")+ return when (code) {+ 200 -> blockedAnswer(text)+ 204, 404 -> false+ else -> throw app.myspoti.spotify.gql.HttpException(code, text.take(200))+ }+ }++ @Volatile private var username: String? = null+ private suspend fun ownUsername(): String = username ?: me().username.also { username = it }++ override suspend fun blockUser(userUri: Uri) = writeBlock("POST", userUri)+ override suspend fun unblockUser(userUri: Uri) = writeBlock("DELETE", userUri)++ private suspend fun writeBlock(method: String, userUri: Uri) {+ val (code, text) = http.send(method, blockUrl(ownUsername(), userUri))+ if (code !in 200..299) throw app.myspoti.spotify.gql.HttpException(code, text.take(200))+ }++ /**+ * The Web Player's own friend feed is a stub (its BuddyFeedAPI says `isSupported: false`), so+ * this reads the endpoint the desktop client's feed uses, with the page's token: guc-spclient+ * first (the desktop's host), then the generic spclient host.+ */override suspend fun friendActivity(): List<FriendActivity> {- val r = runCatching { http.getJson("https://spclient.wg.spotify.com/presence-view/v1/buddylist") }.getOrNull() ?: return emptyList()- return r.list("friends").mapNotNull { f ->- val user = f.obj("user") ?: return@mapNotNull null- val t = f.obj("track")- FriendActivity(- user = UserRef(user.str("uri") ?: "", user.str("name") ?: "", user.str("imageUrl")),- track = t?.let { tr ->- app.myspoti.api.Track(tr.str("uri") ?: "", tr.str("name") ?: "", 0,- listOfNotNull(tr.obj("artist")?.let { ArtistRef(it.str("uri") ?: "", it.str("name") ?: "") }),- tr.obj("album")?.let { app.myspoti.api.AlbumRef(it.str("uri") ?: "", it.str("name") ?: "") })- },- contextUri = t?.str("context.uri"),- timestampMs = f.long("timestamp") ?: 0,- )+ var last: Exception? = null+ for (host in BUDDYLIST_HOSTS) {+ try {+ return buddyList(http.getJson("https://$host/presence-view/v1/buddylist"))+ } catch (e: kotlinx.coroutines.CancellationException) {+ throw e+ } catch (e: Exception) {+ last = e+ }}+ throw last ?: IllegalStateException("friend activity unavailable")}override suspend fun history(): List<HistoryEntry> =diff --git a/base/api-spotify/src/main/kotlin/app/myspoti/spotify/SpotifyPlayer.kt b/base/api-spotify/src/main/kotlin/app/myspoti/spotify/SpotifyPlayer.ktindex cdd41db7..a7d56354 100644--- a/base/api-spotify/src/main/kotlin/app/myspoti/spotify/SpotifyPlayer.kt+++ b/base/api-spotify/src/main/kotlin/app/myspoti/spotify/SpotifyPlayer.kt@@ -24,6 +24,7 @@ import kotlinx.serialization.json.JsonObjectimport kotlinx.serialization.json.addJsonObjectimport kotlinx.serialization.json.buildJsonObjectimport kotlinx.serialization.json.booleanOrNull+import kotlinx.serialization.json.contentOrNullimport kotlinx.serialization.json.doubleimport kotlinx.serialization.json.doubleOrNullimport kotlinx.serialization.json.jsonPrimitive@@ -104,6 +105,17 @@ class SpotifyPlayer(private val bridge: Bridge, private val scope: CoroutineScop* pick a song): the UI says so.*/val refused: kotlinx.coroutines.flow.SharedFlow<Unit> = _refused+ /** When each kind of command (play, seek_to, transfer...) was last refused. */+ private val refusedKinds = java.util.concurrent.ConcurrentHashMap<String, Long>()+ /** The page was reloaded once this session for an account refused everything. */+ @Volatile private var refusedReloaded = false+ @Volatile private var refusedAllToldAt = 0L+ private val _refusedAll = kotlinx.coroutines.flow.MutableSharedFlow<Unit>(extraBufferCapacity = 1)+ /**+ * Spotify refuses this player every kind of command (a play, a seek, a transfer), whichever+ * way the host sent them: the fallbacks are pointless, the UI says so.+ */+ val refusedAll: kotlinx.coroutines.flow.SharedFlow<Unit> = _refusedAllprivate val _drmMissing = kotlinx.coroutines.flow.MutableStateFlow(false)/**@@ -120,6 +132,13 @@ class SpotifyPlayer(private val bridge: Bridge, private val scope: CoroutineScop* The watchers stand still until it is over.*/@Volatile var recoveryHeld: () -> Boolean = { false }+ /**+ * True while Spotify refuses this client its audio licences (set by the host): playback is+ * held, and a song the page moves on to by itself meanwhile is paused (see [onState]).+ */+ @Volatile var playbackHeld: () -> Boolean = { false }+ /** The song last paused by the hold: paused once, so a play the user asks for on it stands. */+ @Volatile private var heldPausedUri: Uri? = null/** Streaming quality ("auto", "low", "normal", "high", "very_high"), kept for every page load. */@Volatile var audioQuality: String = "auto"@@ -137,7 +156,10 @@ class SpotifyPlayer(private val bridge: Bridge, private val scope: CoroutineScopwhen (type) {"state" -> onState(playerState(payload))"queue" -> queue(payload)?.let { q -> _queue.value = q.copy(nextUp = q.nextUp.filter { it.kind != ItemKind.AD }) }- "refused" -> onRefused(late = ((payload as? JsonObject)?.get("late") as? kotlinx.serialization.json.JsonPrimitive)?.booleanOrNull == true)+ "refused" -> onRefused(+ late = ((payload as? JsonObject)?.get("late") as? kotlinx.serialization.json.JsonPrimitive)?.booleanOrNull == true,+ kind = ((payload as? JsonObject)?.get("kind") as? kotlinx.serialization.json.JsonPrimitive)?.contentOrNull,+ )"drm" -> (payload as? JsonObject)?.let { _drmMissing.value = (it["ok"] as? kotlinx.serialization.json.JsonPrimitive)?.booleanOrNull == false }}}@@ -200,8 +222,7 @@ class SpotifyPlayer(private val bridge: Bridge, private val scope: CoroutineScopownReload = truetry {runCatching {- reload()- withTimeoutOrNull(45_000) { delay(1_500); bridge.ready.first { it } } ?: return@runCatching+ if (!reloadAndWait(reload)) return@runCatchingif (s == null) return@runCatchingif (next) { delay(1_500); playOn(s) } else resumeAfterReload(s)}@@ -220,14 +241,25 @@ class SpotifyPlayer(private val bridge: Bridge, private val scope: CoroutineScopif (recoveryHeld()) { bridge.logger?.invoke("reload held: a sign-in page is open or Spotify is limiting playback"); return false }ownReload = truetry {- reload()- return withTimeoutOrNull(45_000) { delay(1_500); bridge.ready.first { it } } != null+ return reloadAndWait(reload)} finally {ownReload = falseplayingAtLoss = null}}+ /**+ * Reloads and waits for the *new* page's "ready". Reported (2.0.1, log seen): an ad stuck,+ * the page reloaded, and the music stayed off until Play was pressed. The host only asks for+ * the load; that page started 10 s later, and "ready" — still the old page's — was taken for+ * the new one after 1.5 s: the song after the ad was sent to the page that was going away.+ */+ private suspend fun reloadAndWait(reload: suspend () -> Unit): Boolean {+ val gone = bridge.pagesGone+ reload()+ return withTimeoutOrNull(45_000) { delay(1_500); bridge.ready.first { it && bridge.pagesGone != gone } } != null+ }+/*** A new page after [lost] was playing: the page restores the session paused, or not at* all, and takes commands only once its device is registered again. The song goes on from@@ -554,15 +586,25 @@ class SpotifyPlayer(private val bridge: Bridge, private val scope: CoroutineScop* 3. the list on shuffle (an account that may only shuffle);* then the user is told.*/- private fun onRefused(late: Boolean = false) {+ private fun onRefused(late: Boolean = false, kind: String? = null) {probeDrm()- val last = lastPlay ?: returnval now = System.currentTimeMillis()- if (now - last.third > if (late) LATE_REFUSED_WINDOW_MS else REFUSED_WINDOW_MS) return// A command acknowledged and never delivered: the page's media element stood still for 10 s// while its state may well say "playing". Not a refusal if the user paused, an ad is on or// another device plays.if (late && (pausedByUser || _adPlaying.value || remoteActive)) return+ // Reported (402 on free accounts in some countries): play, seek, shuffle and transfer all+ // refused from the first command of a session, after the host already sent each one again+ // another way (see RelayRoutes). Two kinds refused: playing the list, transferring and+ // shuffling would only be refused in turn. The page is loaded again once, the song asked+ // again there, and the user is told.+ if (kind != null) {+ refusedKinds[kind] = now+ refusedKinds.entries.removeIf { now - it.value > REFUSED_KINDS_MS }+ if (refusedKinds.size >= 2) { refusedEverything(); return }+ }+ val last = lastPlay ?: return+ if (now - last.third > if (late) LATE_REFUSED_WINDOW_MS else REFUSED_WINDOW_MS) return// A play of ours (an ad recovery, a reload restore): refused during an ad, and the steps// below would replay the list from its start and turn shuffle on, which nobody asked for.if (!lastPlayRefusable) { bridge.logger?.invoke("play refused by Spotify: not the user's, left alone"); return }@@ -612,6 +654,23 @@ class SpotifyPlayer(private val bridge: Bridge, private val scope: CoroutineScop}}+ private fun refusedEverything() {+ refusalStep = 0+ val now = System.currentTimeMillis()+ if (now - refusedAllToldAt > REFUSED_TOLD_GAP_MS) {+ refusedAllToldAt = now+ _refusedAll.tryEmit(Unit)+ }+ if (refusedReloaded) { bridge.logger?.invoke("refused: ${refusedKinds.keys.sorted()}: fallbacks stopped"); return }+ refusedReloaded = true+ bridge.logger?.invoke("refused: ${refusedKinds.keys.sorted()}: fallbacks stopped, the page loaded again once")+ val pick = lastPlay+ val order = lastOrder?.takeIf { pick != null && it.first == pick.first }?.second+ scope.launch {+ if (reloadPage() && pick != null) runCatching { play(pick.first, trackUri = pick.second, order = order) }+ }+ }+/** Plays the song after [s] (or [s] again when it is the last one) in its context. *//*** The song the user's skips point at, kept through what the page cannot take a skip in:@@ -826,6 +885,7 @@ class SpotifyPlayer(private val bridge: Bridge, private val scope: CoroutineScopif (!_adPlaying.value) {adSince = System.currentTimeMillis()adMuteTries = 0+ bridge.logger?.invoke("ad break started")// A song picked a moment ago and not playing yet: the ad came in its place.val p = lastPlayval came = p?.takeIf {@@ -845,6 +905,7 @@ class SpotifyPlayer(private val bridge: Bridge, private val scope: CoroutineScop}val adJustEnded = _adPlaying.value_adPlaying.value = false+ if (adJustEnded) bridge.logger?.invoke("ad break over after ${(System.currentTimeMillis() - adSince) / 1000} s: ${s?.item?.name ?: "nothing"}${if (s?.isPaused == true) " (paused)" else ""}")val pick = pickBeforeAdif (adJustEnded && pick != null) {pickBeforeAd = null@@ -887,6 +948,17 @@ class SpotifyPlayer(private val bridge: Bridge, private val scope: CoroutineScopelse if (lastTrackState?.item != null) lastSongUntil = System.currentTimeMillis()lastTrackState = s_state.value = s+ // Reported (2.0.2-beta.3, log seen): Spotify refusing the audio licences (429), the page+ // skips on by itself through every song it gets no licence for, to the end of the list and+ // round again. The hold's one pause was sent while the page was loading the next song and+ // never took (the page kept playing for minutes): each song it settles on while held is+ // paused, once.+ if (!playbackHeld()) heldPausedUri = null+ else if (s?.item != null && !s.isPaused && !s.isBuffering && s.item?.uri != heldPausedUri) {+ heldPausedUri = s.item?.uri+ bridge.logger?.invoke("playback held (Spotify limiting): ${s.item?.name} paused")+ scope.launch { runCatching { pause() } }+ }// Reported: the repeat button forgets what it was. A play command (and a reloaded page) starts// the page on its own options, repeat off; the mode the user chose is set again, once, when the// first song of that play reports another. Only within a few seconds of our own play: a repeat@@ -1410,6 +1482,16 @@ class SpotifyPlayer(private val bridge: Bridge, private val scope: CoroutineScop/** Until when a page reporting another repeat mode than [wantedRepeat] counts as having forgotten it. */@Volatile private var repeatRestoreUntil = 0L+ /**+ * The repeat mode chosen in an earlier run of the app: nothing is sent now. The page starts+ * with repeat off, so the mode is set again on the first song it reports, as after a play.+ */+ fun restoreRepeat(mode: Repeat) {+ if (wantedRepeat != null) return+ wantedRepeat = mode+ repeatRestoreUntil = maxOf(repeatRestoreUntil, System.currentTimeMillis() + REPEAT_RESTORE_MS)+ }+override suspend fun setRepeat(mode: Repeat) {wantedRepeat = modebridge.call("player.setRepeat", buildJsonObject { put("mode", mode.ordinal) })@@ -1520,6 +1602,10 @@ class SpotifyPlayer(private val bridge: Bridge, private val scope: CoroutineScopconst val RESTORE_WAIT_MS = 6_000L/** A page going away reports "nothing plays" that long before it is gone, at most. */const val UNLOAD_NULL_MS = 5_000L+ /** Two kinds of command refused within this: the account is refused everything. */+ const val REFUSED_KINDS_MS = 120_000L+ /** The "refused everything" message, at most once in this. */+ const val REFUSED_TOLD_GAP_MS = 30_000L/** Errors of a page not able to take a command yet (see [command]). */val TRANSIENT = listOf("No such device", "not ready", "page reloaded", "local player is disabled")/** Refusals of a page being reloaded: a skip is then held (see [Intent]). */diff --git a/base/api-spotify/src/main/kotlin/app/myspoti/spotify/bridge/Bridge.kt b/base/api-spotify/src/main/kotlin/app/myspoti/spotify/bridge/Bridge.ktindex 686427e6..500adc4c 100644--- a/base/api-spotify/src/main/kotlin/app/myspoti/spotify/bridge/Bridge.kt+++ b/base/api-spotify/src/main/kotlin/app/myspoti/spotify/bridge/Bridge.kt@@ -93,11 +93,16 @@ class Bridge(private val host: BridgeHost, scope: CoroutineScope) {* injected again, and the calls still waiting fail now instead of each timing out.*/fun pageGone() {+ pagesGone++gone = true_ready.value = falsepending.values.forEach { it.completeExceptionally(BridgeException("page reloaded")) }}+ /** How many pages went away ([pageGone]): a reload waits for this to move, not for "ready" alone. */+ @Volatile var pagesGone = 0+ private set+/** Between [pageGone] and the new page's "ready". */@Volatile private var gone = falsediff --git a/base/api-spotify/src/main/kotlin/app/myspoti/spotify/bridge/BridgeHost.kt b/base/api-spotify/src/main/kotlin/app/myspoti/spotify/bridge/BridgeHost.ktindex 0b670ab3..65071bd9 100644--- a/base/api-spotify/src/main/kotlin/app/myspoti/spotify/bridge/BridgeHost.kt+++ b/base/api-spotify/src/main/kotlin/app/myspoti/spotify/bridge/BridgeHost.kt@@ -189,3 +189,32 @@ object AdBlock {body.replace("\"$old\"", "\"$quoted\"")}.getOrDefault(body)}++/**+ * The media manifests Spotify sent the player: each song of a track-playback reply's state+ * machines, its `manifest` (formats and file ids) as it came. Read by extensions+ * (`spotify.media`), never changed; the last [MAX] songs are kept.+ */+object MediaManifests {+ private const val MAX = 200+ private val byUri = object : LinkedHashMap<String, JsonObject>(MAX, 0.75f, true) {+ override fun removeEldestEntry(eldest: MutableMap.MutableEntry<String, JsonObject>?) = size > MAX+ }++ /** Keeps the manifests of a track-playback reply's songs. */+ fun record(body: String) {+ if ("\"manifest\"" !in body) return+ val root = runCatching { Json.parseToJsonElement(body).jsonObject }.getOrNull() ?: return+ for (key in listOf("state_machine", "previous_state_machine")) {+ val tracks = (root[key] as? JsonObject)?.get("tracks") as? JsonArray ?: continue+ tracks.forEach { t ->+ val track = t as? JsonObject ?: return@forEach+ val uri = ((track["metadata"] as? JsonObject)?.get("uri") as? JsonPrimitive)?.contentOrNull ?: return@forEach+ val manifest = track["manifest"] as? JsonObject ?: return@forEach+ if (uri.startsWith("spotify:track:") && manifest.isNotEmpty()) synchronized(byUri) { byUri[uri] = manifest }+ }+ }+ }++ fun of(trackUri: String): JsonObject? = synchronized(byUri) { byUri[trackUri] }+}diff --git a/base/api-spotify/src/main/kotlin/app/myspoti/spotify/bridge/RelayRoutes.kt b/base/api-spotify/src/main/kotlin/app/myspoti/spotify/bridge/RelayRoutes.ktnew file mode 100644index 00000000..f2932e6b--- /dev/null+++ b/base/api-spotify/src/main/kotlin/app/myspoti/spotify/bridge/RelayRoutes.kt@@ -0,0 +1,77 @@+package app.myspoti.spotify.bridge++import java.net.Inet4Address+import java.net.Inet6Address+import java.net.InetAddress+import java.net.UnknownHostException++/**+ * Which way the host sends the page's relayed requests (see the host's ControlRelay).+ *+ * Some free accounts get every relayed command refused (402 COMMAND_FAILED) from the first one,+ * while the same phone plays in a browser. One lead (2026-10-23 reports): the WebView reaches+ * Spotify over one address family and the host's own client over the other (IPv6 against IPv4,+ * 464XLAT), so Spotify sees the commands come from another place than the player — a remote+ * control, which a free account may not use. A refused command is sent once more pinned to the+ * other family, then through the platform's own HTTP stack; whichever is taken is kept for the+ * rest of the session, for every relayed request.+ */+enum class RelayRoute { DEFAULT, IPV4, IPV6, HTTP_ENGINE }++enum class IpFamily {+ V4, V6;++ companion object {+ fun of(address: InetAddress?): IpFamily? = when (address) {+ is Inet6Address -> V6+ is Inet4Address -> V4+ else -> null+ }+ }+}++class RelayRoutes(private val engineAvailable: Boolean) {+ /** The route every relayed request takes: [RelayRoute.DEFAULT] until another was taken after a refusal. */+ @Volatile var kept: RelayRoute = RelayRoute.DEFAULT+ private set++ /**+ * The route to try after a refusal on every route in [tried] (the first one is [kept]).+ * [used]: the family the refused request went out on (null: not known), so the retry takes+ * the other one. Null: nothing left, the refusal stands.+ */+ fun next(tried: List<RelayRoute>, used: IpFamily?): RelayRoute? {+ val other = when {+ used == IpFamily.V6 -> RelayRoute.IPV4+ used == IpFamily.V4 -> RelayRoute.IPV6+ tried.lastOrNull() == RelayRoute.IPV4 -> RelayRoute.IPV6+ else -> RelayRoute.IPV4+ }+ // The other family is tried once: a retry pinned to it that was refused too leaves the+ // platform stack only.+ val familyRetried = tried.drop(1).any { it == RelayRoute.IPV4 || it == RelayRoute.IPV6 }+ val order = listOfNotNull(other.takeIf { !familyRetried }, RelayRoute.HTTP_ENGINE.takeIf { engineAvailable })+ return order.firstOrNull { it !in tried }+ }++ /** [route] was answered after the routes before it were refused: kept for the session. */+ fun won(route: RelayRoute) {+ kept = route+ }++ companion object {+ /** The addresses of [family] only; none is an unknown host (the network lacks that family). */+ fun only(family: IpFamily, host: String, all: List<InetAddress>): List<InetAddress> =+ all.filter { IpFamily.of(it) == family }.ifEmpty { throw UnknownHostException("$host has no ${family.name} address") }++ /**+ * An address for the logs: its family and the first part only, never the whole of it+ * ("v6 2a01:…", "v4 85.x.x.x"): enough to tell two paths apart, not to locate anyone.+ */+ fun mask(address: InetAddress?): String = when (address) {+ is Inet6Address -> "v6 " + (address.hostAddress ?: "").substringBefore(':') + ":…"+ is Inet4Address -> "v4 " + (address.hostAddress ?: "").substringBefore('.') + ".x.x.x"+ else -> "?"+ }+ }+}diff --git a/base/api-spotify/src/main/kotlin/app/myspoti/spotify/gql/Gql.kt b/base/api-spotify/src/main/kotlin/app/myspoti/spotify/gql/Gql.ktindex 3b954390..588b81ad 100644--- a/base/api-spotify/src/main/kotlin/app/myspoti/spotify/gql/Gql.kt+++ b/base/api-spotify/src/main/kotlin/app/myspoti/spotify/gql/Gql.kt@@ -150,6 +150,48 @@ class SpotifyHttp(return result}+ /** What [sendRaw] got back: the status, lower-case header names (values joined by ", "), the body text. */+ data class RawResponse(val status: Int, val headers: Map<String, String>, val body: String)++ /**+ * Any method on a Spotify address, for the extensions' raw door. `*.spotify.com` gets the+ * account's credentials as every other call here (web token, client token, the Web Player's+ * headers); `*.spotifycdn.com` (public files) gets none. Other hosts, plain http, and caller+ * headers that would replace the credentials are refused or dropped. No X-Requested-With.+ */+ suspend fun sendRaw(method: String, url: String, body: ByteArray?, headers: Map<String, String>): RawResponse {+ val target = url.toHttpUrl()+ val kind = rawTarget(target.scheme, target.host) ?: throw IllegalArgumentException("not a Spotify address: ${target.host}")+ val m = method.uppercase()+ require(m in RAW_METHODS) { "method $method" }+ val extra = headers.filterKeys { it.lowercase() !in RAW_DROPPED }+ val contentType = extra.entries.firstOrNull { it.key.equals("content-type", true) }?.value ?: JSON_TYPE+ val builder = Request.Builder().url(target)+ if (kind == RawTarget.ACCOUNT) {+ val (w, c) = tokens()+ builder.header("authorization", "Bearer ${w.access}")+ .header("client-token", c.value)+ .header("app-platform", "WebPlayer")+ .header("spotify-app-version", w.appVersion)+ .header("origin", "https://open.spotify.com")+ .header("referer", "https://open.spotify.com/")+ }+ builder.header("accept", "application/json").header("accept-language", language)+ .header("user-agent", browserUserAgent ?: USER_AGENT)+ extra.forEach { (k, v) -> if (!k.equals("content-type", true)) builder.header(k, v) }+ val payload = body?.toRequestBody(contentType.toMediaType())+ ?: if (m == "GET" || m == "HEAD" || m == "DELETE") null else ByteArray(0).toRequestBody(null)+ builder.method(m, payload)+ val result = withContext(Dispatchers.IO) {+ http.newCall(builder.build()).execute().use { r ->+ RawResponse(r.code, r.headers.names().associate { n -> n.lowercase() to r.headers.values(n).joinToString(", ") },+ if (m == "HEAD") "" else r.body.string())+ }+ }+ if (result.status == 401 && kind == RawTarget.ACCOUNT) lock.withLock { web = null }+ return result+ }+suspend fun getJson(url: String): JsonElement? {val (code, text) = send("GET", url)return when (code) {@@ -195,7 +237,28 @@ class SpotifyHttp(return ClientToken(granted["token"]!!.jsonPrimitive.content, System.currentTimeMillis() + seconds * 1000)}+ /** Who a raw request may go to: the account's own hosts (with its credentials) or Spotify's public CDN. */+ enum class RawTarget { ACCOUNT, PUBLIC }+companion object {+ private val RAW_METHODS = setOf("GET", "HEAD", "POST", "PUT", "PATCH", "DELETE")+ /** The credentials and what the transport sets itself: never taken from an extension. */+ private val RAW_DROPPED = setOf(+ "authorization", "client-token", "cookie", "host", "content-length", "connection", "transfer-encoding",+ "x-requested-with", "origin", "referer", "app-platform", "spotify-app-version",+ )++ /** [RawTarget] for https on `spotify.com` / `*.spotify.com` / `spotifycdn.com` / `*.spotifycdn.com`; null for anything else. */+ fun rawTarget(scheme: String, host: String): RawTarget? {+ if (scheme != "https") return null+ val h = host.lowercase()+ return when {+ h == "spotify.com" || h.endsWith(".spotify.com") -> RawTarget.ACCOUNT+ h == "spotifycdn.com" || h.endsWith(".spotifycdn.com") -> RawTarget.PUBLIC+ else -> null+ }+ }+/** How long a signed-in check answers from the token just fetched (see isSignedIn). */const val SIGNED_IN_FRESH_MS = 10_000Lconst val JSON_TYPE = "application/json;charset=UTF-8"diff --git a/base/api-spotify/src/main/kotlin/app/myspoti/spotify/report/DiagnosticDigest.kt b/base/api-spotify/src/main/kotlin/app/myspoti/spotify/report/DiagnosticDigest.ktnew file mode 100644index 00000000..5e0a3f95--- /dev/null+++ b/base/api-spotify/src/main/kotlin/app/myspoti/spotify/report/DiagnosticDigest.kt@@ -0,0 +1,122 @@+package app.myspoti.spotify.report++/**+ * The log a tester sends, made readable and small (a paste on Discord): what the 402 and ad+ * investigations had to dig out of 1 500 lines of polling and font warnings comes first, the+ * rest is cut down.+ *+ * - Noise is left out: the page's font warnings, the 15 s state/queue polling, library and+ * device look-ups (their calls and their answers), the page's own network notes unless one failed.+ * - The same line in a row is kept once with its count ("(×12)").+ * - Each kind of line is kept at most [perKind] times; what was cut is counted at the end.+ * - Tokens, account ids, e-mails and addresses are masked ([mask]).+ * - The whole stays under [maxBytes]: the oldest lines go first.+ *+ * Lines are "HH:mm:ss.SSS text", as the host's Logbook keeps them.+ */+object DiagnosticDigest {+ private val TIME = Regex("""^(\d\d:\d\d:\d\d\.\d{3}) (.*)$""", RegexOption.DOT_MATCHES_ALL)+ private val CALL = Regex("""^call #(\d+) (\S+)""")+ /** Look-ups and polling: their calls and their answers ("call #12 … ok in 8 ms") go. */+ private val QUIET_CALLS = setOf("library.contains", "player.state", "player.queue", "volume.get", "token.get", "media.state")+ private val QUIET_SERVICES = Regex(""""service":"(ConnectDevicesAPI|RootlistAPI|UserAPI|PlaylistPermissionsAPI|LibraryAPI)"""")+ private val NOISE = listOf(+ Regex("""^console WARNING: The resource .* was preloaded"""),+ Regex("""^relay PUT /track-playback/v1/devices/\S+/volume -> 2\d\d"""),+ )+ private val PAGE_NET = Regex("""^page net: """)+ private val PAGE_NET_FAILED = Regex(""""status":(0|[45]\d\d)""")++ /** Up to this many lines of one kind are kept (a long session's state PUTs, its page states). */+ const val PER_KIND = 80+ const val MAX_BYTES = 190_000+ private const val MAX_LINE = 400++ fun digest(lines: List<String>, perKind: Int = PER_KIND, maxBytes: Int = MAX_BYTES): String {+ val quietIds = HashSet<String>()+ val kept = ArrayList<String>()+ val counts = HashMap<String, Int>()+ val dropped = LinkedHashMap<String, Int>()+ var lastText: String? = null+ var lastStamp = ""+ var repeats = 0+ fun flush() {+ val text = lastText ?: return+ kept += "$lastStamp ${if (repeats > 1) "$text (×$repeats)" else text}"+ }+ for (raw in lines) {+ val m = TIME.find(raw)+ val stamp = m?.groupValues?.get(1) ?: ""+ val text = mask(m?.groupValues?.get(2) ?: raw).let { if (it.length > MAX_LINE) it.take(MAX_LINE) + "…" else it }+ if (isNoise(text, quietIds)) continue+ if (text == lastText) { repeats++; continue }+ val kind = kindOf(text)+ val n = (counts[kind] ?: 0) + 1+ counts[kind] = n+ if (n > perKind) { dropped[kind] = (dropped[kind] ?: 0) + 1; continue }+ flush()+ lastText = text+ lastStamp = stamp+ repeats = 1+ }+ flush()+ val tail = if (dropped.isEmpty()) "" else buildString {+ appendLine()+ appendLine("--- cut (more than $perKind lines of one kind) ---")+ dropped.entries.sortedByDescending { it.value }.forEach { (k, v) -> appendLine("$v × $k") }+ }+ // The newest lines matter most: the oldest go until the whole fits.+ var size = tail.length + kept.sumOf { it.length + 1 }+ var first = 0+ while (size > maxBytes && first < kept.size) { size -= kept[first].length + 1; first++ }+ return buildString {+ if (first > 0) appendLine("($first older lines left out to keep the report small)")+ kept.subList(first, kept.size).forEach { appendLine(it) }+ append(tail)+ }+ }++ private fun isNoise(text: String, quietIds: MutableSet<String>): Boolean {+ if (NOISE.any { it.containsMatchIn(text) }) return true+ if (PAGE_NET.containsMatchIn(text)) return !PAGE_NET_FAILED.containsMatchIn(text)+ val call = CALL.find(text) ?: return false+ val id = call.groupValues[1]+ // A failed call is never noise.+ if (" FAILED" in text) return false+ if (id in quietIds) { if (" ok in " in text) quietIds.remove(id); return true }+ val method = call.groupValues[2]+ if (method in QUIET_CALLS || (method == "service.call" && QUIET_SERVICES.containsMatchIn(text))) {+ if (" ok in " !in text) quietIds += id+ return true+ }+ return false+ }++ /** A line's kind: its words with numbers, quoted values and ids taken out. */+ internal fun kindOf(text: String): String =+ text.replace(Regex("\"[^\"]*\""), "\"…\"")+ .replace(Regex("#\\d+"), "#")+ .replace(Regex("\\d+"), "N")+ .split(' ').take(6).joinToString(" ")++ private val BEARER = Regex("""(?i)\bBearer\s+[A-Za-z0-9._~+/=-]+""")+ private val EMAIL = Regex("""[A-Za-z0-9._%+-]+@[A-Za-z0-9-]+(\.[A-Za-z0-9-]+)+""")+ private val USER_URI = Regex("""spotify:user:[^\s",:}]+""")+ private val PERSONAL = Regex(""""(username|displayName|email|accountId|userId|birthdate|id_token|access_token|accessToken|clientToken|token)"\s*:\s*"[^"]*"""")+ private val URL_TOKEN = Regex("""(__token__|token|hmac|sig|signature)=[^&\s"]+""")+ /** Long opaque strings: tokens, device ids, hashes. */+ private val OPAQUE = Regex("""\b[A-Za-z0-9_-]{32,}\b""")+ private val IPV4 = Regex("""(?<![\w./\\-])(\d{1,3})\.\d{1,3}\.\d{1,3}\.\d{1,3}(?![\w.])""")+ private val IPV6 = Regex("""(?<![\w:])([0-9a-fA-F]{1,4}):(?:[0-9a-fA-F]{0,4}:){3,6}[0-9a-fA-F]{0,4}(?![\w:])""")++ /** [text] without what identifies a person or opens an account; enough left to read the log. */+ fun mask(text: String): String = text+ .replace(BEARER, "Bearer ***")+ .replace(EMAIL, "***@***")+ .replace(USER_URI, "spotify:user:***")+ .replace(PERSONAL) { "\"${it.groupValues[1]}\":\"***\"" }+ .replace(URL_TOKEN) { "${it.groupValues[1]}=***" }+ .replace(OPAQUE) { it.value.take(4) + "…" }+ .replace(IPV4) { "${it.groupValues[1]}.x.x.x" }+ .replace(IPV6) { "${it.groupValues[1]}:…" }+}diff --git a/base/api-spotify/src/test/kotlin/app/myspoti/spotify/PlaybackFollowUpTest.kt b/base/api-spotify/src/test/kotlin/app/myspoti/spotify/PlaybackFollowUpTest.ktindex 120281b8..f99c886e 100644--- a/base/api-spotify/src/test/kotlin/app/myspoti/spotify/PlaybackFollowUpTest.kt+++ b/base/api-spotify/src/test/kotlin/app/myspoti/spotify/PlaybackFollowUpTest.kt@@ -7,9 +7,11 @@ import app.myspoti.spotify.bridge.BridgeHostimport kotlinx.coroutines.CoroutineScopeimport kotlinx.coroutines.Dispatchersimport kotlinx.coroutines.SupervisorJob+import kotlinx.coroutines.asyncimport kotlinx.coroutines.cancelimport kotlinx.coroutines.delayimport kotlinx.coroutines.flow.MutableSharedFlow+import kotlinx.coroutines.launchimport kotlinx.coroutines.runBlockingimport org.junit.jupiter.api.AfterEachimport org.junit.jupiter.api.Assertions.assertEquals@@ -42,12 +44,14 @@ class PlaybackFollowUpTest {private lateinit var scope: CoroutineScopeprivate lateinit var host: FakeHostprivate lateinit var player: SpotifyPlayer+ private lateinit var bridge: Bridge@BeforeEach fun up() {AdBlock.ahead.value = nullscope = CoroutineScope(SupervisorJob() + Dispatchers.Default)host = FakeHost()- player = SpotifyPlayer(Bridge(host, scope), scope)+ bridge = Bridge(host, scope)+ player = SpotifyPlayer(bridge, scope)// A message posted before the bridge listens is lost (a slow CI machine): wait for it.waitFor("bridge listening") { host.messages.subscriptionCount.value > 0 }}@@ -111,6 +115,73 @@ class PlaybackFollowUpTest {assertEquals(sent + 1, called("player.setRepeat"))}+ @Test fun `while playback is held, each song the page moves on to by itself is paused once`() = runBlocking {+ player.playbackHeld = { true }+ host.post("""{"type":"ready"}""")+ host.post(state(track("A")))+ waitFor("A paused") { called("player.pause") == 1 }+ // The same song again (the user played it on): left alone.+ host.post(state(track("A")))+ delay(300)+ assertEquals(1, called("player.pause"))+ // The page skipped on by itself to a song it has no licence for: paused too.+ host.post(state(track("B")))+ waitFor("B paused") { called("player.pause") == 2 }+ player.playbackHeld = { false }+ host.post(state(track("C")))+ delay(300)+ assertEquals(2, called("player.pause"), "no hold, no pause")+ }++ @Test fun `a reload waits for the new page, not the old page still ready`() = runBlocking {+ host.post("""{"type":"ready"}""")+ waitFor("ready") { bridge.ready.value }+ // The host only asks for the load: the old page stays ready until the new one starts.+ player.reloadHost = { }+ val reloaded = async(Dispatchers.Default) { player.reloadPage() }+ delay(2_500)+ assertFalse(reloaded.isCompleted, "still the old page")+ bridge.pageGone()+ host.post("""{"type":"ready"}""")+ assertTrue(reloaded.await())+ }++ @Test fun `the repeat mode of an earlier run is set again on the first song`() = runBlocking {+ player.restoreRepeat(Repeat.CONTEXT)+ host.post("""{"type":"ready"}""")+ host.post(state(track("A"), repeat = 0))+ waitFor("repeat set again") { called("player.setRepeat") == 1 }+ assertEquals("{\"mode\":1}", host.calls.last { it.first == "player.setRepeat" }.second)+ }++ @Test fun `two kinds of command refused stop the fallbacks, reload the page once and tell the user`() = runBlocking {+ host.post("""{"type":"ready"}""")+ host.post(state(track("A")))+ var reloads = 0+ player.reloadHost = {+ reloads+++ bridge.pageGone()+ host.post("""{"type":"ready"}""")+ }+ var told = 0+ val watch = scope.launch { player.refusedAll.collect { told++ } }+ player.play("spotify:playlist:C", trackUri = "spotify:track:P")+ val plays = called("player.play")+ // The play refused: the first fallback (the list without the song) runs.+ host.post("""{"type":"refused","status":402,"kind":"play"}""")+ waitFor("first fallback") { called("player.play") == plays + 1 }+ // Its transfer refused too: no more fallbacks, one reload, the song asked again there.+ host.post("""{"type":"refused","status":402,"kind":"transfer"}""")+ waitFor("reloaded and asked again") { reloads == 1 && called("player.play") == plays + 2 }+ waitFor("told") { told == 1 }+ host.post("""{"type":"refused","status":402,"kind":"seek_to"}""")+ delay(2_000)+ assertEquals(1, reloads, "reloaded once only")+ assertEquals(plays + 2, called("player.play"), "no fallback play: ${host.calls.map { it.first }}")+ assertFalse(host.calls.any { "pullToLocalDevice" in it.second }, "no transfer fallback")+ watch.cancel()+ }+@Test fun `a webview without widevine is reported`() = runBlocking {assertFalse(player.drmMissing.value)host.post("""{"type":"drm","ok":true}""")diff --git a/base/api-spotify/src/test/kotlin/app/myspoti/spotify/PlaylistMergeTest.kt b/base/api-spotify/src/test/kotlin/app/myspoti/spotify/PlaylistMergeTest.ktnew file mode 100644index 00000000..0b5419a3--- /dev/null+++ b/base/api-spotify/src/test/kotlin/app/myspoti/spotify/PlaylistMergeTest.kt@@ -0,0 +1,59 @@+package app.myspoti.spotify++import app.myspoti.api.Page+import app.myspoti.api.PlaylistMerge+import app.myspoti.api.Track+import kotlinx.coroutines.runBlocking+import org.junit.jupiter.api.Assertions.assertEquals+import org.junit.jupiter.api.Assertions.assertFalse+import org.junit.jupiter.api.Assertions.assertTrue+import org.junit.jupiter.api.Test++class PlaylistMergeTest {+ private fun t(id: String) = Track("spotify:track:$id", id, 1000, emptyList(), null)+ private fun uris(vararg ids: String) = ids.map { "spotify:track:$it" }++ @Test fun `nothing already there adds everything without a question`() {+ val plan = PlaylistMerge.plan(uris("x"), uris("a", "b"))+ assertFalse(plan.hasDuplicates)+ assertEquals(uris("a", "b"), plan.fresh)+ }++ @Test fun `some already there offers add all or only the new ones, in order`() {+ val plan = PlaylistMerge.plan(uris("b", "z"), uris("a", "b", "c"))+ assertTrue(plan.someDuplicate)+ assertFalse(plan.allDuplicate)+ assertEquals(1, plan.duplicateCount)+ assertEquals(uris("a", "b", "c"), plan.all)+ assertEquals(uris("a", "c"), plan.fresh)+ }++ @Test fun `all already there offers add anyway or don't add`() {+ val plan = PlaylistMerge.plan(uris("a", "b", "z"), uris("a", "b"))+ assertTrue(plan.allDuplicate)+ assertFalse(plan.someDuplicate)+ assertTrue(plan.fresh.isEmpty())+ }++ @Test fun `an empty source is no duplicate case`() {+ val plan = PlaylistMerge.plan(uris("a"), emptyList())+ assertFalse(plan.hasDuplicates)+ assertFalse(plan.allDuplicate)+ }++ @Test fun `local files are left out`() {+ assertEquals(uris("a"), PlaylistMerge.addable(listOf("spotify:local:x:y:z:1", "spotify:track:a")))+ }++ @Test fun `every page is read until the last one`() = runBlocking {+ val seen = mutableListOf<Int>()+ val all = PlaylistMerge.readAll { offset ->+ seen += offset+ val items = (offset until minOf(250, offset + 100)).map { t("t$it") }+ Page(items, offset, 250, (offset + 100).takeIf { it < 250 })+ }+ assertEquals(listOf(0, 100, 200), seen)+ assertEquals(250, all.size)+ assertEquals("spotify:track:t249", all.last())+ }+}diff --git a/base/api-spotify/src/test/kotlin/app/myspoti/spotify/SocialMappersTest.kt b/base/api-spotify/src/test/kotlin/app/myspoti/spotify/SocialMappersTest.ktnew file mode 100644index 00000000..7a876f48--- /dev/null+++ b/base/api-spotify/src/test/kotlin/app/myspoti/spotify/SocialMappersTest.kt@@ -0,0 +1,96 @@+package app.myspoti.spotify++import app.myspoti.api.FriendActivity+import app.myspoti.api.TimeRange+import app.myspoti.spotify.bridge.Bridge+import org.junit.jupiter.api.Assertions.assertEquals+import org.junit.jupiter.api.Assertions.assertFalse+import org.junit.jupiter.api.Assertions.assertNull+import org.junit.jupiter.api.Assertions.assertTrue+import org.junit.jupiter.api.Test++/** Listening stats (`userTopContent`) and friend activity (`presence-view/v1/buddylist`) parsing. */+class SocialMappersTest {+ private fun json(s: String) = Bridge.json.parseToJsonElement(s)++ @Test fun `time ranges use the Web Player enum words`() {+ assertEquals(listOf("SHORT_TERM", "MID_TERM", "LONG_TERM"), TimeRange.entries.map { it.gqlName })+ }++ // Shape seen live (2026-10-23), trimmed.+ private val top = json("""+ {"topArtists":{"__typename":"ArtistPageV2","items":[+ {"data":{"__typename":"Artist","profile":{"name":"Artist A"},"uri":"spotify:artist:aaa",+ "visuals":{"avatarImage":{"sources":[{"height":640,"url":"https://i.scdn.co/image/a640","width":640},{"height":160,"url":"https://i.scdn.co/image/a160","width":160}]}}}},+ {"data":{"__typename":"Artist","profile":{"name":"Artist B"},"uri":"spotify:artist:bbb","visuals":{"avatarImage":null}}}+ ],"totalCount":46},+ "topTracks":{"__typename":"TrackPageV2","items":[+ {"data":{"__typename":"Track","albumOfTrack":{"coverArt":{"sources":[{"height":300,"url":"https://i.scdn.co/image/c300","width":300}]},"name":"Album X","uri":"spotify:album:xxx"},+ "artists":{"items":[{"profile":{"name":"Artist A"},"uri":"spotify:artist:aaa"},{"profile":{"name":"Artist C"},"uri":"spotify:artist:ccc"}]},+ "contentRating":{"label":"EXPLICIT"},"duration":{"totalMilliseconds":116230},"mediaType":"AUDIO","name":"Song 1","saved":true,"uri":"spotify:track:t1"}}+ ],"totalCount":50}}+ """)++ @Test fun `top content maps artists, tracks and totals`() {+ val t = topContent(top)+ assertEquals(listOf("Artist A", "Artist B"), t.artists.map { it.name })+ assertEquals("spotify:artist:aaa", t.artists[0].uri)+ assertEquals(2, t.artists[0].images.size)+ assertEquals(46, t.artistTotal)+ assertEquals(50, t.trackTotal)+ val song = t.tracks.single()+ assertEquals("Song 1", song.name)+ assertEquals(listOf("Artist A", "Artist C"), song.artists.map { it.name })+ assertEquals("Album X", song.album?.name)+ assertEquals(116230L, song.durationMs)+ }++ @Test fun `top content without data is empty`() {+ val t = topContent(json("""{"topArtists":null}"""))+ assertTrue(t.artists.isEmpty() && t.tracks.isEmpty())+ assertNull(t.artistTotal)+ }++ private val buddies = json("""+ {"friends":[+ {"timestamp":1000,"user":{"uri":"spotify:user:old","name":"Old Friend","imageUrl":""},+ "track":{"uri":"spotify:track:t9","name":"Older","imageUrl":"http://i.scdn.co/image/c9",+ "album":{"uri":"spotify:album:a9","name":"Alb9"},"artist":{"uri":"spotify:artist:r9","name":"Art9"},+ "context":{"uri":"spotify:playlist:p9","name":"Road trip","index":0}}},+ {"timestamp":5000,"user":{"uri":"spotify:user:new","name":"New Friend","imageUrl":"https://i.scdn.co/image/u1"},+ "track":{"uri":"spotify:track:t1","name":"Newer","imageUrl":"http://i.scdn.co/image/c1",+ "album":{"uri":"spotify:album:a1","name":"Alb1"},"artist":{"uri":"spotify:artist:r1","name":"Art1"},+ "context":{"uri":"spotify:album:a1","name":"","index":3}}},+ {"timestamp":7000,"user":{"name":"no uri"}}+ ]}+ """)++ @Test fun `buddylist maps friends latest first`() {+ val list = buddyList(buddies)+ assertEquals(listOf("New Friend", "Old Friend"), list.map { it.user.name })+ val n = list[0]+ assertEquals("https://i.scdn.co/image/u1", n.user.imageUrl)+ assertEquals("Newer", n.track?.name)+ assertEquals("Art1", n.track?.artists?.single()?.name)+ assertEquals("spotify:album:a1", n.track?.album?.uri)+ assertEquals("spotify:album:a1", n.contextUri)+ assertNull(n.contextName)+ assertEquals(5000L, n.timestampMs)+ val o = list[1]+ assertNull(o.user.imageUrl)+ assertEquals("Road trip", o.contextName)+ assertEquals("http://i.scdn.co/image/c9", o.trackImageUrl)+ }++ @Test fun `empty or refused feed maps to no friends`() {+ assertTrue(buddyList(json("""{"friends":[]}""")).isEmpty())+ assertTrue(buddyList(null).isEmpty())+ }++ @Test fun `now playing lasts 15 minutes`() {+ val f = FriendActivity(app.myspoti.api.UserRef("spotify:user:x", "x", null), null, null, timestampMs = 1_000_000)+ assertTrue(f.isNowPlaying(1_000_000 + 14 * 60_000))+ assertFalse(f.isNowPlaying(1_000_000 + 15 * 60_000))+ assertFalse(f.isNowPlaying(999_000))+ }+}diff --git a/base/api-spotify/src/test/kotlin/app/myspoti/spotify/SpotifyWritesTest.kt b/base/api-spotify/src/test/kotlin/app/myspoti/spotify/SpotifyWritesTest.ktindex 68910505..b3d72eb2 100644--- a/base/api-spotify/src/test/kotlin/app/myspoti/spotify/SpotifyWritesTest.kt+++ b/base/api-spotify/src/test/kotlin/app/myspoti/spotify/SpotifyWritesTest.kt@@ -214,6 +214,56 @@ class SpotifyWritesTest {assertEquals(listOf("getUser", "getBasePermission", "remove", "removeMember"), host.calls.map { it.method() })}+ private val membersReply = """{"members":[+ {"permissionLevel":"OWNER","isOwner":true,"user":{"username":"owner","displayName":"Owner","images":[]}},+ {"permissionLevel":"CONTRIBUTOR","isOwner":false,"user":{"username":"guest1","displayName":"Guest 1","images":[]}},+ {"permissionLevel":"VIEWER","isOwner":false,"user":{"username":"guest2","displayName":"Guest 2","images":[]}}]}"""++ @Test fun `members carry their level, and the owner's menu writes setMemberPermission and removeMember by username`() = runBridge({ call ->+ if (call.method() == "getMembers") Bridge.json.parseToJsonElement(membersReply) else JsonNull+ }) { host, bridge ->+ val playlists = SpotifyPlaylists(FakeGql { _, _ -> JsonNull }, bridge, SpotifyHttp(OkHttpClient(), bridge))+ assertEquals(listOf(false, true, false), playlists.members("spotify:playlist:p").map { it.isCollaborator })+ host.calls.clear()+ playlists.setMemberCollaborator("spotify:playlist:p", "guest1", false)+ playlists.setMemberCollaborator("spotify:playlist:p", "guest2", true)+ playlists.removeMember("spotify:playlist:p", "guest2")+ assertEquals(listOf("setMemberPermission", "setMemberPermission", "removeMember"), host.calls.map { it.method() })+ assertEquals("""["spotify:playlist:p","guest1","VIEWER"]""", host.calls[0].args())+ assertEquals("""["spotify:playlist:p","guest2","CONTRIBUTOR"]""", host.calls[1].args())+ assertEquals("""["spotify:playlist:p","guest2"]""", host.calls[2].args())+ }++ @Test fun `stopping the collaboration of a private playlist makes the collaborators listeners, then makes it private`() = runBridge({ call ->+ when (call.method()) {+ "getMembers" -> Bridge.json.parseToJsonElement(membersReply)+ "getPublishedState" -> kotlinx.serialization.json.JsonPrimitive("false")+ else -> JsonNull+ }+ }) { host, bridge ->+ val playlists = SpotifyPlaylists(FakeGql { _, _ -> JsonNull }, bridge, SpotifyHttp(OkHttpClient(), bridge))+ playlists.stopCollaboration("spotify:playlist:p")+ val writes = host.calls.filter { it.method().startsWith("set") || it.method() == "removeMember" }+ assertEquals(listOf("setMemberPermission", "setBasePermission"), writes.map { it.method() })+ assertEquals("""["spotify:playlist:p","guest1","VIEWER"]""", writes[0].args())+ assertEquals("""["spotify:playlist:p","BLOCKED"]""", writes[1].args())+ }++ @Test fun `stopping the collaboration of a public playlist removes the collaborators, not the listeners`() = runBridge({ call ->+ when (call.method()) {+ "getMembers" -> Bridge.json.parseToJsonElement(membersReply)+ "getPublishedState" -> kotlinx.serialization.json.JsonPrimitive("true")+ else -> JsonNull+ }+ }) { host, bridge ->+ val playlists = SpotifyPlaylists(FakeGql { _, _ -> JsonNull }, bridge, SpotifyHttp(OkHttpClient(), bridge))+ playlists.stopCollaboration("spotify:playlist:p")+ val writes = host.calls.filter { it.method().startsWith("set") || it.method() == "removeMember" }+ assertEquals(listOf("removeMember", "setBasePermission"), writes.map { it.method() })+ assertEquals("""["spotify:playlist:p","guest1"]""", writes[0].args())+ assertEquals("""["spotify:playlist:p","VIEWER"]""", writes[1].args())+ }+@Test fun `a playlist can be left only when its capabilities say canCancelMembership`() {fun parse(flag: String) = playlist(Bridge.json.parseToJsonElement("""{"uri":"spotify:playlist:p","name":"n","currentUserCapabilities":{"canEditItems":true,"canCancelMembership":$flag}}"""))!!assertEquals(true, parse("true").canLeave)@@ -243,6 +293,17 @@ class SpotifyWritesTest {assertEquals("spotify:playlist:37i9dQZF1EJMv6aMStShzx", joined.playlist)}+ @Test fun `a whole album is added in requests of 100 songs, each at the bottom and in order`() = runBridge({ JsonNull }) { _, bridge ->+ val gql = FakeGql { _, _ -> JsonNull }+ val playlists = SpotifyPlaylists(gql, bridge, SpotifyHttp(OkHttpClient(), bridge))+ val uris = (0 until 230).map { "spotify:track:t$it" }+ playlists.addTracks("spotify:playlist:p", uris)+ assertEquals(listOf(100, 100, 30), gql.variables.map { it["playlistItemUris"]!!.jsonArray.size })+ assertEquals("spotify:track:t100", gql.variables[1]["playlistItemUris"]!!.jsonArray[0].jsonPrimitive.content)+ assertEquals("BOTTOM_OF_PLAYLIST", gql.variables[2]["newPosition"]!!.jsonObject["moveType"]!!.jsonPrimitive.content)+ assertEquals("spotify:playlist:p", gql.variables[2]["playlistUri"]!!.jsonPrimitive.content)+ }+@Test fun `a Blend's members and its taste-match card read as the live service gives them`() {val blends = SpotifyBlends(SpotifyHttp(OkHttpClient(), Bridge(RecordingHost { JsonNull }, scope)))// Shortened from what the live service answered for a two-person Blend.@@ -262,4 +323,14 @@ class SpotifyWritesTest {assertEquals("#F5F3E4", story?.background)assertEquals(null, blends.parseStory(Bridge.json.parseToJsonElement("""{"intro_story":null,"stories":[]}""")))}++ @Test fun `blocking a profile is the social graph's is-blocking path with both usernames, and its protobuf answer is read`() {+ assertEquals("https://spclient.wg.spotify.com/socialgraph/v4/me.name/is-blocking/other",+ SpotifyUsers.blockUrl("me.name", "spotify:user:other"))+ assertEquals("https://spclient.wg.spotify.com/socialgraph/v4/me/is-blocking/a%20b", SpotifyUsers.blockUrl("me", "spotify:user:a b"))+ org.junit.jupiter.api.Assertions.assertThrows(IllegalArgumentException::class.java) { SpotifyUsers.blockUrl("", "spotify:user:x") }+ assertEquals(true, SpotifyUsers.blockedAnswer(String(byteArrayOf(8, 1))))+ assertEquals(false, SpotifyUsers.blockedAnswer(String(byteArrayOf(8, 0))))+ assertEquals(false, SpotifyUsers.blockedAnswer(""))+ }}diff --git a/base/api-spotify/src/test/kotlin/app/myspoti/spotify/bridge/RelayRoutesTest.kt b/base/api-spotify/src/test/kotlin/app/myspoti/spotify/bridge/RelayRoutesTest.ktnew file mode 100644index 00000000..7f0823ec--- /dev/null+++ b/base/api-spotify/src/test/kotlin/app/myspoti/spotify/bridge/RelayRoutesTest.kt@@ -0,0 +1,46 @@+package app.myspoti.spotify.bridge++import org.junit.jupiter.api.Assertions.assertEquals+import org.junit.jupiter.api.Assertions.assertNull+import org.junit.jupiter.api.Test+import org.junit.jupiter.api.assertThrows+import java.net.InetAddress+import java.net.UnknownHostException++class RelayRoutesTest {+ private val v4 = InetAddress.getByAddress("spclient", byteArrayOf(85.toByte(), 1, 2, 3))+ private val v6 = InetAddress.getByAddress("spclient", ByteArray(16).also { it[0] = 0x2a; it[1] = 0x01 })++ @Test fun `a refusal over IPv6 is tried over IPv4, then through the platform stack`() {+ val routes = RelayRoutes(engineAvailable = true)+ assertEquals(RelayRoute.IPV4, routes.next(listOf(RelayRoute.DEFAULT), IpFamily.V6))+ assertEquals(RelayRoute.HTTP_ENGINE, routes.next(listOf(RelayRoute.DEFAULT, RelayRoute.IPV4), IpFamily.V4))+ assertNull(routes.next(listOf(RelayRoute.DEFAULT, RelayRoute.IPV4, RelayRoute.HTTP_ENGINE), null))+ }++ @Test fun `a refusal over IPv4 is tried over IPv6, and nothing else without the platform stack`() {+ val routes = RelayRoutes(engineAvailable = false)+ assertEquals(RelayRoute.IPV6, routes.next(listOf(RelayRoute.DEFAULT), IpFamily.V4))+ assertNull(routes.next(listOf(RelayRoute.DEFAULT, RelayRoute.IPV6), IpFamily.V6))+ }++ @Test fun `the route that won is kept, and its refusal tries the other family`() {+ val routes = RelayRoutes(engineAvailable = true)+ assertEquals(RelayRoute.DEFAULT, routes.kept)+ routes.won(RelayRoute.IPV4)+ assertEquals(RelayRoute.IPV4, routes.kept)+ assertEquals(RelayRoute.IPV6, routes.next(listOf(RelayRoute.IPV4), null))+ }++ @Test fun `pinning keeps one family, and a network without it has no address`() {+ assertEquals(listOf(v4), RelayRoutes.only(IpFamily.V4, "spclient", listOf(v6, v4)))+ assertEquals(listOf(v6), RelayRoutes.only(IpFamily.V6, "spclient", listOf(v6, v4)))+ assertThrows<UnknownHostException> { RelayRoutes.only(IpFamily.V6, "spclient", listOf(v4)) }+ }++ @Test fun `addresses are masked in the logs`() {+ assertEquals("v4 85.x.x.x", RelayRoutes.mask(v4))+ assertEquals("v6 2a01:…", RelayRoutes.mask(v6))+ assertEquals(IpFamily.V6, IpFamily.of(v6))+ }+}diff --git a/base/api-spotify/src/test/kotlin/app/myspoti/spotify/gql/RawTargetTest.kt b/base/api-spotify/src/test/kotlin/app/myspoti/spotify/gql/RawTargetTest.ktnew file mode 100644index 00000000..842d3813--- /dev/null+++ b/base/api-spotify/src/test/kotlin/app/myspoti/spotify/gql/RawTargetTest.kt@@ -0,0 +1,22 @@+package app.myspoti.spotify.gql++import app.myspoti.spotify.gql.SpotifyHttp.RawTarget+import org.junit.jupiter.api.Assertions.assertEquals+import org.junit.jupiter.api.Assertions.assertNull+import org.junit.jupiter.api.Test++class RawTargetTest {+ @Test fun `the account's credentials only go to spotify dot com`() {+ assertEquals(RawTarget.ACCOUNT, SpotifyHttp.rawTarget("https", "api.spotify.com"))+ assertEquals(RawTarget.ACCOUNT, SpotifyHttp.rawTarget("https", "gue1-spclient.spotify.com"))+ assertEquals(RawTarget.ACCOUNT, SpotifyHttp.rawTarget("https", "spotify.com"))+ assertEquals(RawTarget.PUBLIC, SpotifyHttp.rawTarget("https", "open.spotifycdn.com"))+ }++ @Test fun `other hosts, look-alikes and plain http are refused`() {+ assertNull(SpotifyHttp.rawTarget("http", "api.spotify.com"))+ assertNull(SpotifyHttp.rawTarget("https", "evilspotify.com"))+ assertNull(SpotifyHttp.rawTarget("https", "spotify.com.evil.net"))+ assertNull(SpotifyHttp.rawTarget("https", "example.com"))+ }+}diff --git a/base/api-spotify/src/test/kotlin/app/myspoti/spotify/report/DiagnosticDigestTest.kt b/base/api-spotify/src/test/kotlin/app/myspoti/spotify/report/DiagnosticDigestTest.ktnew file mode 100644index 00000000..67f9ad2f--- /dev/null+++ b/base/api-spotify/src/test/kotlin/app/myspoti/spotify/report/DiagnosticDigestTest.kt@@ -0,0 +1,69 @@+package app.myspoti.spotify.report++import org.junit.jupiter.api.Assertions.assertEquals+import org.junit.jupiter.api.Assertions.assertFalse+import org.junit.jupiter.api.Assertions.assertTrue+import org.junit.jupiter.api.Test++class DiagnosticDigestTest {+ @Test fun `tokens, accounts, e-mails and addresses are masked`() {+ val line = """registration: Authorization=Bearer BQDx1y2z.abc-DEF user spotify:user:ytdgg4jsixgf6n3nd44dpz3j7 """ ++ """mail [email protected] {"username":"jane","displayName":"Jane D","name":"Halo"} """ ++ """device 62623a152cc9c682fe53263500ad6201eee30a9c audio?__token__=exp=1792855998~hmac=4fc1 """ ++ """from 85.12.34.56 and 2a01:e0a:1f2:3c40::1 UA Chrome/153.0.0.0 track spotify:track:76hCWqC3QR1e6ny32DYoAO"""+ val masked = DiagnosticDigest.mask(line)+ assertFalse("BQDx1y2z" in masked, masked)+ assertFalse("ytdgg4" in masked, masked)+ assertFalse("jane.doe" in masked || "\"jane\"" in masked || "Jane D" in masked, masked)+ assertFalse("62623a152cc9c682fe53263500ad6201eee30a9c" in masked, masked)+ assertFalse("1792855998" in masked, masked)+ assertFalse("85.12.34.56" in masked || "e0a:1f2" in masked, masked)+ // What the reader needs stays: the song, the browser version, the address families.+ assertTrue("\"name\":\"Halo\"" in masked, masked)+ assertTrue("spotify:track:76hCWqC3QR1e6ny32DYoAO" in masked, masked)+ assertTrue("Chrome/153.0.0.0" in masked, masked)+ assertTrue("85.x.x.x" in masked && "2a01:…" in masked, masked)+ }++ @Test fun `identical lines in a row are kept once with their count`() {+ val out = DiagnosticDigest.digest(listOf(+ "10:00:00.000 page state: \"Halo\" paused=false buffering=false",+ "10:00:00.100 page state: \"Halo\" paused=false buffering=false",+ "10:00:00.200 page state: \"Halo\" paused=false buffering=false",+ "10:00:01.000 call #8 player.resume {}",+ ))+ assertEquals(listOf(+ "10:00:00.000 page state: \"Halo\" paused=false buffering=false (×3)",+ "10:00:01.000 call #8 player.resume {}",+ ), out.trim().lines())+ }++ @Test fun `polling and look-ups go with their answers, failures stay`() {+ val out = DiagnosticDigest.digest(listOf(+ "10:00:00.000 call #4 player.state {}",+ "10:00:00.010 call #5 service.call {\"service\":\"ConnectDevicesAPI\",\"method\":\"getDevices\",\"args\":[]}",+ "10:00:00.020 call #4 player.state ok in 7 ms: null",+ "10:00:00.030 call #5 service.call ok in 4 ms: [{\"id\":\"x\"}]",+ "10:00:00.040 console WARNING: The resource https://encore.scdn.co/fonts/a.woff2 was preloaded using link preload but not used",+ "10:00:00.050 page net: {\"type\":\"net\",\"url\":\"https://apresolve.spotify.com/\",\"status\":200}",+ "10:00:00.060 page net: {\"type\":\"net\",\"url\":\"https://apresolve.spotify.com/\",\"status\":503}",+ "10:00:00.070 call #6 player.queue FAILED after 20000 ms: timeout",+ "10:00:00.080 relay POST /connect-state/v1/player/command/from/…/to/self -> 402 in 300 ms",+ )).trim().lines()+ assertEquals(3, out.size, out.joinToString("\n"))+ assertTrue(out[0].contains("\"status\":503"))+ assertTrue(out[1].contains("FAILED"))+ assertTrue(out[2].contains("-> 402"))+ }++ @Test fun `each kind is capped, the cut is counted, and the newest lines fit the size`() {+ val lines = (1..300).map { "10:00:${(it % 60).toString().padStart(2, '0')}.000 relay PUT /track-playback/v1/devices/…/state -> 200 in $it ms" }+ val out = DiagnosticDigest.digest(lines, perKind = 50)+ assertEquals(50, out.lines().count { it.startsWith("10:") })+ assertTrue(out.contains("250 × relay PUT"), out.takeLast(300))+ val small = DiagnosticDigest.digest((1..400).map { "10:00:00.000 event $it ${"x".repeat(100)}" }, perKind = 1000, maxBytes = 5_000)+ assertTrue(small.length <= 5_100, "size ${small.length}")+ assertTrue(small.contains("event 400 "), "the newest line is kept")+ assertTrue(small.startsWith("("), "the cut is said")+ }+}diff --git a/base/api/src/main/kotlin/app/myspoti/api/Api.kt b/base/api/src/main/kotlin/app/myspoti/api/Api.ktindex 95e41b15..f7e80c7c 100644--- a/base/api/src/main/kotlin/app/myspoti/api/Api.kt+++ b/base/api/src/main/kotlin/app/myspoti/api/Api.kt@@ -178,6 +178,23 @@ interface Playlists {*/suspend fun leave(uri: Uri)+ /**+ * Owner: turns a member into a collaborator or back into a listener (the "Shared with" list's+ * menu): `PlaylistPermissionsAPI.setMemberPermission(uri, username, "CONTRIBUTOR" | "VIEWER")`.+ */+ suspend fun setMemberCollaborator(uri: Uri, username: String, collaborator: Boolean)++ /** Owner: removes a member from the playlist (`PlaylistPermissionsAPI.removeMember(uri, username)`). */+ suspend fun removeMember(uri: Uri, username: String)++ /**+ * Owner: stops collaborating. Every collaborator becomes a listener when the playlist is private+ * (not listed on the profile), or is removed from it when it is public; then the base permission+ * goes back to private / public. The invitation links already shared are NOT revoked: the Web+ * Player has no call for it (they expire by themselves, after 7 days).+ */+ suspend fun stopCollaboration(uri: Uri)+/** Who added each row of a playlist (shown on collaborative ones). */suspend fun addedBy(uri: Uri): List<RowAdder>@@ -227,6 +244,16 @@ interface Users {suspend fun follow(userUris: List<Uri>)suspend fun unfollow(userUris: List<Uri>)suspend fun isFollowing(userUris: List<Uri>): List<Boolean>+ /** Whether this account blocked [userUri] (the Web Player's profile menu: `GET /socialgraph/v4/{me}/is-blocking/{user}`). */+ suspend fun isBlocked(userUri: Uri): Boolean+ /** Blocks [userUri] (`POST /socialgraph/v4/{me}/is-blocking/{user}`); Spotify also drops the follow between the two. */+ suspend fun blockUser(userUri: Uri)+ /** Lifts the block ([blockUser]'s `DELETE`). */+ suspend fun unblockUser(userUri: Uri)+ /**+ * What the people the account follows are listening to, latest first. Throws when Spotify+ * refuses the feed (an empty list means nobody shares their activity).+ */suspend fun friendActivity(): List<FriendActivity>/** Contexts played lately (Recents). */suspend fun history(): List<HistoryEntry>diff --git a/base/api/src/main/kotlin/app/myspoti/api/Media.kt b/base/api/src/main/kotlin/app/myspoti/api/Media.ktindex f5d1ac52..ef0ab7ce 100644--- a/base/api/src/main/kotlin/app/myspoti/api/Media.kt+++ b/base/api/src/main/kotlin/app/myspoti/api/Media.kt@@ -112,12 +112,42 @@ data class UserProfile(val publicPlaylists: List<Playlist>,)+/**+ * The windows Spotify ranks the account's top artists and tracks over (the official app's+ * "Listening stats" and the profile's "Top artists this month"): about the past 4 weeks, the+ * past 6 months, and about a year.+ */enum class TimeRange { SHORT_TERM, MEDIUM_TERM, LONG_TERM }-data class TopContent(val artists: List<Artist>, val tracks: List<Track>)+/**+ * The account's most played artists and tracks over a [TimeRange], best first. The totals are+ * how many Spotify ranks in that window (the lists hold at most the asked limit).+ */+data class TopContent(+ val artists: List<Artist>,+ val tracks: List<Track>,+ val artistTotal: Int? = null,+ val trackTotal: Int? = null,+)++/**+ * A friend's latest listen (the official "Friend Activity" feed): someone the account follows+ * who shares their listening activity. [trackImageUrl] is the cover Spotify sends with it and+ * [contextName] the playlist, album or artist it was played from.+ */+data class FriendActivity(+ val user: UserRef,+ val track: Track?,+ val contextUri: Uri?,+ val timestampMs: Long,+ val contextName: String? = null,+ val trackImageUrl: String? = null,+) {+ /** The official feed shows a friend as listening now for 15 minutes after their last play started. */+ fun isNowPlaying(nowMs: Long = System.currentTimeMillis()): Boolean = nowMs - timestampMs in 0 until NOW_PLAYING_MS-/** A friend's latest listen (friend activity). */-data class FriendActivity(val user: UserRef, val track: Track?, val contextUri: Uri?, val timestampMs: Long)+ companion object { const val NOW_PLAYING_MS = 15 * 60_000L }+}data class UserRef(val uri: Uri, val name: String, val imageUrl: String?)diff --git a/base/api/src/main/kotlin/app/myspoti/api/Models.kt b/base/api/src/main/kotlin/app/myspoti/api/Models.ktindex 528a2a44..b70c00ae 100644--- a/base/api/src/main/kotlin/app/myspoti/api/Models.kt+++ b/base/api/src/main/kotlin/app/myspoti/api/Models.kt@@ -184,7 +184,11 @@ data class BlendMember(val username: String, val name: String, val imageUrl: Strdata class RowAdder(val rowUid: String, val trackUri: String, val username: String)/** Someone who can change a playlist: its owner, or a collaborator who joined it. */-data class PlaylistMember(val username: String, val name: String, val imageUrl: String?, val isOwner: Boolean)+data class PlaylistMember(+ val username: String, val name: String, val imageUrl: String?, val isOwner: Boolean,+ /** Permission level CONTRIBUTOR (adds and removes songs); otherwise a listener (VIEWER). */+ val isCollaborator: Boolean = !isOwner,+)/** Where an invitation stands for the signed-in account. */enum class BlendInvitationState {diff --git a/base/api/src/main/kotlin/app/myspoti/api/PlaylistMerge.kt b/base/api/src/main/kotlin/app/myspoti/api/PlaylistMerge.ktnew file mode 100644index 00000000..fa56e8af--- /dev/null+++ b/base/api/src/main/kotlin/app/myspoti/api/PlaylistMerge.kt@@ -0,0 +1,59 @@+package app.myspoti.api++/**+ * Adding a whole playlist or album to another playlist, with the Web Player's duplicate+ * handling: its `CHECK_DUPLICATE_TRACKS` step reads the target (`getContents`), splits what is+ * to be added into songs already there and new ones, and only calls `PlaylistAPI.add` straight+ * away when nothing is already there. Otherwise its dialog offers "Add anyway" / "Don't add"+ * (everything is a duplicate) or "Add all" / "Add new ones" (some are).+ */+data class MergePlan(+ /** Everything the source holds, in its order. */+ val all: List<Uri>,+ /** The part of [all] that is not in the target yet, in order. */+ val fresh: List<Uri>,+) {+ val duplicateCount: Int get() = all.size - fresh.size+ val hasDuplicates: Boolean get() = duplicateCount > 0+ /** Every song is already there: the dialog offers "Add anyway" and "Don't add". */+ val allDuplicate: Boolean get() = all.isNotEmpty() && fresh.isEmpty()+ /** Some are there, some not: the dialog offers "Add all" and "Add new ones". */+ val someDuplicate: Boolean get() = hasDuplicates && fresh.isNotEmpty()+}++object PlaylistMerge {+ /** The most songs sent in one write. */+ const val CHUNK = 100++ fun plan(existing: Collection<Uri>, incoming: List<Uri>): MergePlan {+ val there = existing.toHashSet()+ return MergePlan(incoming, incoming.filter { it !in there })+ }++ /** Local files cannot be added by uri: they are left out of an album or playlist add. */+ fun addable(uris: List<Uri>): List<Uri> = uris.filter { !it.startsWith("spotify:local:") }++ /** Reads every page ([page] gets the offset to read) and returns the song uris in order. */+ suspend fun readAll(page: suspend (offset: Int) -> Page<Track>): List<Uri> {+ val out = ArrayList<Uri>()+ var offset: Int? = 0+ var guard = 0+ while (offset != null && guard++ < 400) {+ val p = page(offset)+ if (p.items.isEmpty()) break+ out += p.items.map { it.uri }+ offset = p.nextOffset+ }+ return out+ }++ /** The songs of [source] (an album or a playlist). */+ suspend fun sourceTracks(api: MyspotiApi, source: Uri): List<Uri> = addable(+ if (source.startsWith("spotify:album:")) readAll { api.catalog.albumTracks(source, it, 50) }+ else readAll { api.playlists.tracks(source, it, 100) }+ )++ /** What adding [source] to [target] would do. */+ suspend fun plan(api: MyspotiApi, target: Uri, source: Uri): MergePlan =+ plan(readAll { api.playlists.tracks(target, it, 100) }, sourceTracks(api, source))+}diff --git a/base/app/build.gradle.kts b/base/app/build.gradle.ktsindex 03437408..6ba7e508 100644--- a/base/app/build.gradle.kts+++ b/base/app/build.gradle.kts@@ -27,6 +27,8 @@ android {defaultConfig {applicationId = if (beta) "app.myspoti" else "app.myspoti.stable"manifestPlaceholders["appLabel"] = if (beta) "Myspoti Beta" else "Myspoti"+ // The adb command line (com.music.spotui.cli): betas and debug builds only.+ manifestPlaceholders["cliEnabled"] = beta.toString()minSdk = 29targetSdk = 36// CI release builds pass the tag's version (-PappVersionName / -PappVersionCode).@@ -34,8 +36,6 @@ android {versionName = version// GitHub "owner/repo" whose releases the app checks for updates; empty = off// (local builds). CI sets it to the repository it builds.- // Inspectable hidden player in a test build (-PwebDebug=true); never in releases.- buildConfigField("boolean", "WEB_DEBUG", "${(findProperty("webDebug") as String?) == "true"}")buildConfigField("String", "UPDATE_REPO", "\"${(findProperty("updateRepo") as String?) ?: System.getenv("MYSPOTI_UPDATE_REPO") ?: ""}\"")ndk {abiFilters += listOf("arm64-v8a", "armeabi-v7a")@@ -73,6 +73,7 @@ android {// Installs next to the release apps (own data, own sign-in).applicationIdSuffix = ".dev"manifestPlaceholders["appLabel"] = "Myspoti dev"+ manifestPlaceholders["cliEnabled"] = "true"}release {// Real key when provided (CI releases); otherwise the debug key, so a local@@ -102,10 +103,10 @@ android {dependencies {implementation(project(":host-android"))+ // Third-party extensions: the sandbox (Rhino), manifests, packages and catalogues.+ implementation(project(":extensions"))// Jam: scan the invite QR code (Google code scanner, no camera permission).implementation("com.google.android.gms:play-services-code-scanner:16.1.0")- // The SpotiFLAC verification opens in a browser tab, as SpotiFLAC Mobile does.- implementation("androidx.browser:browser:1.8.0")testImplementation("junit:junit:4.13.2")// The real org.json in unit tests (android.jar only has stubs).testImplementation("org.json:json:20240303")diff --git a/base/app/proguard-rules.pro b/base/app/proguard-rules.proindex 8e7357b0..318e340a 100644--- a/base/app/proguard-rules.pro+++ b/base/app/proguard-rules.pro@@ -77,3 +77,8 @@# no-argument constructors it fails to start and the scan crashes.-keep class * implements com.google.firebase.components.ComponentRegistrar { <init>(); }-keep class com.google.mlkit.** { *; }++# Extensions: a Spotify call's result is turned into JSON from the API models' own field names+# (SpotifyDispatcher reads them by reflection), and the sandbox loads prelude.js from its jar.+-keepclassmembers class app.myspoti.api.** { <fields>; }+-keep class app.myspoti.extensions.** { *; }diff --git a/base/app/src/debug/java/com/music/spotui/di/TestControlReceiver.kt b/base/app/src/debug/java/com/music/spotui/di/TestControlReceiver.ktindex e5c7778c..78c3c75b 100644--- a/base/app/src/debug/java/com/music/spotui/di/TestControlReceiver.kt+++ b/base/app/src/debug/java/com/music/spotui/di/TestControlReceiver.kt@@ -12,6 +12,7 @@ import kotlinx.serialization.json.jsonObject* commands, as a tap would, with* `adb shell am broadcast -a app.myspoti.TEST -p app.myspoti.dev --es cmd <cmd> ...`.* cmd: play (--es track <uri> --es context <uri>), resume, pause, next, previous, seek (--el ms <n>).+ * cmd: download (--es id <spotify id> --es title T --es artist A --ei ms <duration>), playdownloaded (--es id).* cmd: screenon (--ez on false to release) holds the screen on for a long run: One UI does not* honour the huge `screen_off_timeout` set over adb, the window flag does.* cmd: uitrace (--ei secs <n>, default 30) logs, 5 times a second under the tag MspTrace, what the@@ -21,6 +22,8 @@ import kotlinx.serialization.json.jsonObject* cmd: gql (--es op <operation> --es vars <json>) runs a persisted operation through the app's own* Gql layer and logs the raw response: learning a server shape from the phone's real account beats* guessing one from a bundle.+ * cmd: extlist logs the installed extensions; extuninstall (--es id <extension id>) removes one+ * through the app's own uninstall path, as its page's Uninstall button does.*/class TestControlReceiver : BroadcastReceiver() {override fun onReceive(context: Context, intent: Intent) {@@ -75,6 +78,48 @@ class TestControlReceiver : BroadcastReceiver() {val file = app.myspoti.host.android.Logbook.export(context)Log.i("MspPlayer", "diagnostic report: ${file.absolutePath} (${file.length()} bytes)")}.onFailure { Log.i("MspPlayer", "diagnostic report failed: $it") }+ // Debug: the friend feed on each host and the typed result, as shapes and counts only+ // (no friend's name or track leaves the phone's log).+ "friends" -> app.myspoti.host.android.MyspotiRuntime.scope.launch {+ val spotify = app.myspoti.host.android.MyspotiRuntime.spotify+ for (host in listOf("guc-spclient.spotify.com", "spclient.wg.spotify.com")) {+ runCatching { spotify.raw.get("https://$host/presence-view/v1/buddylist") }+ .onSuccess { Log.i("MspPlayer", "buddylist $host -> ${shape(it)}") }+ .onFailure { Log.i("MspPlayer", "buddylist $host failed: $it") }+ }+ runCatching { app.myspoti.host.android.MyspotiRuntime.api.users.friendActivity() }+ .onSuccess { l -> Log.i("MspPlayer", "friendActivity -> ${l.size} friend(s), now=${l.count { it.isNowPlaying() }}, " ++ "withTrack=${l.count { it.track != null }}, withContext=${l.count { it.contextName != null }}, withCover=${l.count { it.trackImageUrl != null }}") }+ .onFailure { Log.i("MspPlayer", "friendActivity failed: $it") }+ }+ // Debug: the account's Spotify top lists per window (counts and totals only).+ "extlist" -> com.music.spotui.extensions.Extensions.registry.value.extensions+ .forEach { Log.i("MspPlayer", "extension ${it.id} ${it.version} enabled=${it.enabled} source=${it.source}") }+ "extuninstall" -> app.myspoti.host.android.MyspotiRuntime.scope.launch {+ val id = intent.getStringExtra("id").orEmpty()+ if (com.music.spotui.extensions.Extensions.registry.value.find(id) == null) Log.i("MspPlayer", "extension $id: not installed")+ else { com.music.spotui.extensions.Extensions.uninstall(id); Log.i("MspPlayer", "extension $id: uninstalled") }+ }+ "top" -> app.myspoti.host.android.MyspotiRuntime.scope.launch {+ app.myspoti.api.TimeRange.entries.forEach { r ->+ runCatching { app.myspoti.host.android.MyspotiRuntime.api.users.top(r, 50) }+ .onSuccess { Log.i("MspPlayer", "top $r -> artists=${it.artists.size}/${it.artistTotal} tracks=${it.tracks.size}/${it.trackTotal}") }+ .onFailure { Log.i("MspPlayer", "top $r failed: $it") }+ }+ }+ // Debug: downloads one song (--es id <spotify id> --es title T --es artist A --ei ms <duration>)+ // through the download-source extensions, as the download button does.+ "download" -> com.music.spotui.data.offline.OfflineDownloader.enqueue(listOf(com.music.spotui.data.entity.SongsModel(+ 0, intent.getStringExtra("title").orEmpty(), "", intent.getStringExtra("artist").orEmpty(), "", "",+ spotifyTrackId = intent.getStringExtra("id").orEmpty(), durationMs = intent.getIntExtra("ms", 0),+ )))+ // Debug: plays the downloaded songs in the local player (--es id <spotify id> to start there).+ "playdownloaded" -> {+ val all = com.music.spotui.data.offline.OfflineStore.tracks.values.toList()+ val at = all.indexOfFirst { it.trackId == intent.getStringExtra("id") }.coerceAtLeast(0)+ Log.i("MspPlayer", "downloaded: ${all.size} song(s)")+ if (all.isNotEmpty()) LocalPlayer.play(all.map(com.music.spotui.data.offline.OfflineStore::toLocalTrack), at, context = "test")+ }// Debug: how many local audio files the app would list (Local Files check without the UI)."localfiles" -> Thread {val n = runCatching { kotlinx.coroutines.runBlocking { com.music.spotui.data.local.LocalMusic.tracks(context, refresh = true).size } }@@ -83,3 +128,13 @@ class TestControlReceiver : BroadcastReceiver() {}}}++/** A JSON value's structure without its values: object keys, array sizes and the first element's shape. */+private fun shape(e: kotlinx.serialization.json.JsonElement?, depth: Int = 0): String = when {+ e == null -> "null"+ depth > 4 -> "..."+ e is kotlinx.serialization.json.JsonObject -> e.entries.joinToString(",", "{", "}") { (k, v) -> "$k:${shape(v, depth + 1)}" }+ e is kotlinx.serialization.json.JsonArray -> "[${e.size}]" + (e.firstOrNull()?.let { shape(it, depth + 1) } ?: "")+ e is kotlinx.serialization.json.JsonNull -> "null"+ else -> (e as kotlinx.serialization.json.JsonPrimitive).let { if (it.isString) "s" else "n" }+}diff --git a/base/app/src/main/AndroidManifest.xml b/base/app/src/main/AndroidManifest.xmlindex fe6579c8..158b7260 100644--- a/base/app/src/main/AndroidManifest.xml+++ b/base/app/src/main/AndroidManifest.xml@@ -63,26 +63,31 @@android:value="true" />+ <!-- Debug and beta builds only (cliEnabled, build.gradle.kts): tools/myspoti-cli drives the app over adb.+ DUMP is held by the adb shell, not by other apps. -->+ <receiver+ android:name="com.music.spotui.cli.CliReceiver"+ android:enabled="${cliEnabled}"+ android:exported="true"+ android:permission="android.permission.DUMP">+ <intent-filter>+ <action android:name="${applicationId}.CLI" />+ </intent-filter>+ </receiver>+<activityandroid:name="app.myspoti.MainActivity"android:exported="true"android:launchMode="singleTask"android:screenOrientation="unspecified"android:supportsPictureInPicture="true"- android:configChanges="orientation|screenSize|screenLayout|keyboardHidden"+ android:configChanges="orientation|screenSize|smallestScreenSize|screenLayout|keyboardHidden"android:windowSoftInputMode="adjustResize"android:theme="@style/Theme.Myspoti"><intent-filter><action android:name="android.intent.action.MAIN" /><category android:name="android.intent.category.LAUNCHER" /></intent-filter>- <!-- The SpotiFLAC verification page hands its grant back here, as to SpotiFLAC Mobile. -->- <intent-filter>- <action android:name="android.intent.action.VIEW" />- <category android:name="android.intent.category.DEFAULT" />- <category android:name="android.intent.category.BROWSABLE" />- <data android:scheme="spotiflac" android:host="session-grant" />- </intent-filter><intent-filter><action android:name="android.media.action.MEDIA_PLAY_FROM_SEARCH" /><category android:name="android.intent.category.DEFAULT" />diff --git a/base/app/src/main/java/app/myspoti/MainActivity.kt b/base/app/src/main/java/app/myspoti/MainActivity.ktindex 648551ef..111ce1a2 100644--- a/base/app/src/main/java/app/myspoti/MainActivity.kt+++ b/base/app/src/main/java/app/myspoti/MainActivity.kt@@ -55,8 +55,8 @@ class MainActivity : AppCompatActivity() {private var loginWait: kotlinx.coroutines.Job? = null/** The one-time setup screen (permissions, battery) after signing in. */private var setupNeeded by mutableStateOf(false)- /** SpotiFLAC verification, opened from the setup screen or the settings. */- private var showSpotiflac by mutableStateOf(false)+ /** In the picture-in-picture window: only the music video is drawn. */+ private var inPip by mutableStateOf(false)private val prefs get() = getSharedPreferences("myspoti_prefs", Context.MODE_PRIVATE)@@ -77,21 +77,24 @@ class MainActivity : AppCompatActivity() {}androidx.compose.foundation.layout.Box(androidx.compose.ui.Modifier.fillMaxSize()) {when {- showSpotiflac -> com.music.spotui.ui.screens.SpotiflacScreen(onClose = { showSpotiflac = false; com.music.spotui.data.offline.SpotiflacGate.resume() })- signedIn && setupNeeded -> com.music.spotui.ui.screens.SetupScreen(- onDone = { setupNeeded = false },- onSpotiflac = { showSpotiflac = true },- )+ signedIn && setupNeeded -> com.music.spotui.ui.screens.SetupScreen(onDone = { setupNeeded = false })signedIn -> App()connecting -> ConnectingScreen()else -> WelcomeScreen(onLogin = { showLogin() })}// "Ask each time": the download quality question, above every screen.com.music.spotui.ui.components.DownloadAskHost()+ // An extension about to change the Spotify account waits for the user's yes.+ com.music.spotui.extensions.ExtensionConfirmHost()+ // An extension's sign-in page, in a web view of its own.+ com.music.spotui.extensions.ExtensionAuthHost()// Beta and dev builds only: hold the faint dot to copy the recent logs.if (com.music.spotui.data.api.UpdateChecker.isBeta || app.myspoti.engine.BuildConfig.DEBUG)com.music.spotui.ui.components.BetaLogButton(androidx.compose.ui.Modifier.align(androidx.compose.ui.Alignment.BottomEnd))+ // Picture-in-picture: the clip alone, over the app (which stays composed underneath,+ // so coming back finds the same screen).+ if (inPip) com.music.spotui.ui.components.PipVideo()}}}@@ -111,6 +114,28 @@ class MainActivity : AppCompatActivity() {if (savedInstanceState == null) handle(intent)}+ // Leaving the app (Home, recents) while a music video plays: it goes on in a small window.+ override fun onUserLeaveHint() {+ super.onUserLeaveHint()+ val mv = com.music.spotui.video.MusicVideoController+ if (!com.music.spotui.data.preferences.MusicVideoPref.on || !mv.on.value || mv.player == null) return+ if (!com.music.spotui.di.SongPlayer.isPlaying() || isInPictureInPictureMode) return+ val ratio = mv.aspect.floatValue.coerceIn(0.5f, 2.3f)+ runCatching {+ enterPictureInPictureMode(+ android.app.PictureInPictureParams.Builder()+ .setAspectRatio(android.util.Rational((ratio * 1000).toInt(), 1000))+ .build(),+ )+ }+ }++ override fun onPictureInPictureModeChanged(isInPictureInPictureMode: Boolean, newConfig: android.content.res.Configuration) {+ super.onPictureInPictureModeChanged(isInPictureInPictureMode, newConfig)+ inPip = isInPictureInPictureMode+ com.music.spotui.video.MusicVideoController.inPip.value = isInPictureInPictureMode+ }+override fun onNewIntent(intent: Intent) {super.onNewIntent(intent)handle(intent)@@ -290,11 +315,6 @@ class MainActivity : AppCompatActivity() {/** Spotify links (open.spotify.com/...) play their item; voice search plays its best match. */private fun handle(intent: Intent?) {intent ?: return- // The SpotiFLAC verification's return (spotiflac://session-grant?grant=…&state=…).- if (intent.data?.scheme == "spotiflac" && intent.data?.host == "session-grant") {- com.music.spotui.lossless.ZarzSession.grants.value = intent.data.toString()- return- }when (intent.action) {Intent.ACTION_VIEW -> {val link = intent.data?.toString() ?: return@@ -308,6 +328,11 @@ class MainActivity : AppCompatActivity() {com.music.spotui.data.api.InviteLinks.page.value = urireturn}+ // A song, with an audio-source extension on: asked there first, like any play.+ if (uri.startsWith("spotify:track:") && com.music.spotui.extensions.Extensions.hasAudioSource()) {+ com.music.spotui.di.SongPlayer.playSong(uri)+ return+ }lifecycleScope.launch {MyspotiRuntime.api.ready.first { it }runCatching { MyspotiRuntime.api.player.play(uri) }diff --git a/base/app/src/main/java/app/myspoti/MyspotiApplication.kt b/base/app/src/main/java/app/myspoti/MyspotiApplication.ktindex ebefe6e0..34c7ebda 100644--- a/base/app/src/main/java/app/myspoti/MyspotiApplication.kt+++ b/base/app/src/main/java/app/myspoti/MyspotiApplication.kt@@ -31,6 +31,11 @@ class MyspotiApplication : Application() {AutoBrowser.children(context, parentId)override suspend fun search(query: String): List<MediaBrowserCompat.MediaItem> = AutoBrowser.search(query)}+ // The report's header: the extensions installed, with their versions.+ app.myspoti.host.android.Logbook.headerExtras = {+ val all = com.music.spotui.extensions.Extensions.registry.value.extensions+ listOf("extensions" to (all.joinToString { "${it.id} ${it.version}${if (it.enabled) "" else " (off)"}" }.ifEmpty { "none" }))+ }prefetch()}diff --git a/base/app/src/main/java/com/music/spotui/App.kt b/base/app/src/main/java/com/music/spotui/App.ktindex fed88c90..6fd182fb 100644--- a/base/app/src/main/java/com/music/spotui/App.kt+++ b/base/app/src/main/java/com/music/spotui/App.kt@@ -1,5 +1,8 @@package com.music.spotui+import com.music.spotui.ui.theme.tone+import com.music.spotui.ui.theme.AppText+import androidx.compose.foundation.layout.fillMaxSizeimport androidx.compose.foundation.verticalScrollimport androidx.compose.foundation.layout.heightIn@@ -52,6 +55,9 @@ fun App() {}}+ // Debug and beta builds: `myspoti-cli nav <route>` (see CliReceiver).+ LaunchedEffect(Unit) { com.music.spotui.cli.CliReceiver.nav.collect { r -> runCatching { navController.navigate(r) } } }+UpdatePrompt()SupportPrompt()// The playlists at the top of the library, fetched ahead on Wi-Fi (see PagePrefetch).@@ -157,6 +163,8 @@ private fun SupportPrompt() {*/@Composableprivate fun SupportDialog(supporter: Boolean, onSupport: () -> Unit, onSponsor: () -> Unit, onDecline: () -> Unit, onSupported: (com.music.spotui.data.api.SupportReminder.Level) -> Unit) {+ // The owner's reminder: no extension draws, listens or acts over it.+ com.music.spotui.extensions.ProtectedSurfaceEffect(app.myspoti.extensions.ProtectedSurface.SUPPORT)var choosing by androidx.compose.runtime.remember { mutableStateOf(false) }androidx.compose.ui.window.Dialog(onDismissRequest = onDecline) {androidx.compose.foundation.layout.Column(@@ -164,25 +172,25 @@ private fun SupportDialog(supporter: Boolean, onSupport: () -> Unit, onSponsor:modifier = Modifier.fillMaxWidth().clip(androidx.compose.foundation.shape.RoundedCornerShape(16.dp))- .background(androidx.compose.ui.graphics.Color(0xFF242424))+ .background(tone(0xFF242424)).padding(horizontal = 24.dp, vertical = 28.dp),) {androidx.compose.foundation.Image(painter = androidx.compose.ui.res.painterResource(app.myspoti.engine.R.drawable.ic_launcher_foreground),contentDescription = null,modifier = Modifier.size(72.dp).clip(androidx.compose.foundation.shape.RoundedCornerShape(20.dp))- .background(androidx.compose.ui.graphics.Color(0xFF181818)),+ .background(tone(0xFF181818)),)androidx.compose.material3.Text(androidx.compose.ui.res.stringResource(if (supporter) app.myspoti.engine.R.string.supporter_thanks_title else app.myspoti.engine.R.string.support_title),- color = androidx.compose.ui.graphics.Color.White, fontFamily = com.music.spotui.ui.theme.AppSans,+ color = AppText, fontFamily = com.music.spotui.ui.theme.AppSans,fontWeight = androidx.compose.ui.text.font.FontWeight.Bold, fontSize = 20.sp,textAlign = androidx.compose.ui.text.style.TextAlign.Center,modifier = Modifier.padding(top = 18.dp),)androidx.compose.material3.Text(androidx.compose.ui.res.stringResource(if (supporter) app.myspoti.engine.R.string.supporter_thanks_body else app.myspoti.engine.R.string.support_body),- color = androidx.compose.ui.graphics.Color.White.copy(alpha = 0.8f),+ color = AppText.copy(alpha = 0.8f),fontFamily = com.music.spotui.ui.theme.AppSans, fontSize = 14.sp, lineHeight = 20.sp,textAlign = androidx.compose.ui.text.style.TextAlign.Center,modifier = Modifier.padding(top = 12.dp),@@ -206,7 +214,7 @@ private fun SupportDialog(supporter: Boolean, onSupport: () -> Unit, onSponsor:com.music.spotui.ui.components.GitHubSponsorButton(Modifier.padding(top = 10.dp), onClick = onSponsor)androidx.compose.material3.Text(androidx.compose.ui.res.stringResource(app.myspoti.engine.R.string.support_decline),- color = androidx.compose.ui.graphics.Color.White, fontFamily = com.music.spotui.ui.theme.AppSans,+ color = AppText, fontFamily = com.music.spotui.ui.theme.AppSans,fontWeight = androidx.compose.ui.text.font.FontWeight.Bold, fontSize = 15.sp,modifier = Modifier.padding(top = 8.dp).pressable(0.96f, onClick = onDecline).padding(horizontal = 24.dp, vertical = 12.dp),)@@ -217,7 +225,7 @@ private fun SupportDialog(supporter: Boolean, onSupport: () -> Unit, onSponsor:) { com.music.spotui.ui.components.SupportChoice(onChosen = onSupported) }else androidx.compose.material3.Text(androidx.compose.ui.res.stringResource(app.myspoti.engine.R.string.supporter_i_supported),- color = androidx.compose.ui.graphics.Color.White.copy(alpha = 0.6f), fontFamily = com.music.spotui.ui.theme.AppSans,+ color = AppText.copy(alpha = 0.6f), fontFamily = com.music.spotui.ui.theme.AppSans,fontSize = 13.sp,modifier = Modifier.pressable(0.96f) { choosing = true }.padding(horizontal = 24.dp, vertical = 8.dp),)@@ -239,6 +247,7 @@ private fun UpdatePrompt() {}updateCardOpen.value = release != nullval r = release ?: return+ com.music.spotui.extensions.ProtectedSurfaceEffect(app.myspoti.extensions.ProtectedSurface.UPDATE)val scope = androidx.compose.runtime.rememberCoroutineScope()val updater = com.music.spotui.data.api.AppUpdaterval state by updater.state.collectAsState()@@ -305,36 +314,36 @@ private fun UpdateDialog(modifier = Modifier.fillMaxWidth().clip(androidx.compose.foundation.shape.RoundedCornerShape(16.dp))- .background(androidx.compose.ui.graphics.Color(0xFF242424))+ .background(tone(0xFF242424)).padding(horizontal = 24.dp, vertical = 28.dp),) {androidx.compose.foundation.Image(painter = androidx.compose.ui.res.painterResource(app.myspoti.engine.R.drawable.ic_launcher_foreground),contentDescription = null,modifier = Modifier.size(72.dp).clip(androidx.compose.foundation.shape.RoundedCornerShape(20.dp))- .background(androidx.compose.ui.graphics.Color(0xFF181818)),+ .background(tone(0xFF181818)),)androidx.compose.material3.Text(androidx.compose.ui.res.stringResource(app.myspoti.engine.R.string.main_update_available),- color = androidx.compose.ui.graphics.Color.White, fontFamily = com.music.spotui.ui.theme.AppSans,+ color = AppText, fontFamily = com.music.spotui.ui.theme.AppSans,fontWeight = androidx.compose.ui.text.font.FontWeight.Bold, fontSize = 20.sp,textAlign = androidx.compose.ui.text.style.TextAlign.Center,modifier = Modifier.padding(top = 18.dp),)androidx.compose.material3.Text(- "Myspoti $version", color = androidx.compose.ui.graphics.Color.White.copy(alpha = 0.7f),+ "Myspoti $version", color = AppText.copy(alpha = 0.7f),fontFamily = com.music.spotui.ui.theme.AppSans, fontSize = 15.sp, modifier = Modifier.padding(top = 6.dp),)// What's new (the release's CHANGELOG section), scrollable if long.if (notes.isNotBlank()) androidx.compose.material3.Text(- notes, color = androidx.compose.ui.graphics.Color.White.copy(alpha = 0.8f),+ notes, color = AppText.copy(alpha = 0.8f),fontFamily = com.music.spotui.ui.theme.AppSans, fontSize = 14.sp, lineHeight = 20.sp,modifier = Modifier.padding(top = 16.dp).fillMaxWidth().heightIn(max = 240.dp).verticalScroll(androidx.compose.foundation.rememberScrollState()),)// The download and install, under the notes.if (status != null) androidx.compose.material3.Text(- status, color = androidx.compose.ui.graphics.Color.White.copy(alpha = 0.8f),+ status, color = AppText.copy(alpha = 0.8f),fontFamily = com.music.spotui.ui.theme.AppSans, fontSize = 14.sp,textAlign = androidx.compose.ui.text.style.TextAlign.Center,modifier = Modifier.padding(top = 16.dp).fillMaxWidth(),@@ -342,10 +351,10 @@ private fun UpdateDialog(if (progress != null) {val bar = Modifier.padding(top = 10.dp).fillMaxWidth().height(4.dp).clip(androidx.compose.foundation.shape.RoundedCornerShape(50))if (progress < 0f) androidx.compose.material3.LinearProgressIndicator(- modifier = bar, color = com.music.spotui.ui.theme.AppAccent, trackColor = androidx.compose.ui.graphics.Color.White.copy(alpha = 0.15f))+ modifier = bar, color = com.music.spotui.ui.theme.AppAccent, trackColor = AppText.copy(alpha = 0.15f))else androidx.compose.material3.LinearProgressIndicator(progress = { progress }, modifier = bar, color = com.music.spotui.ui.theme.AppAccent,- trackColor = androidx.compose.ui.graphics.Color.White.copy(alpha = 0.15f), drawStopIndicator = {})+ trackColor = AppText.copy(alpha = 0.15f), drawStopIndicator = {})}androidx.compose.foundation.layout.Box(contentAlignment = androidx.compose.ui.Alignment.Center,@@ -365,7 +374,7 @@ private fun UpdateDialog(}androidx.compose.material3.Text(androidx.compose.ui.res.stringResource(app.myspoti.engine.R.string.age_assurance_intro_cta_not_now),- color = androidx.compose.ui.graphics.Color.White, fontFamily = com.music.spotui.ui.theme.AppSans,+ color = AppText, fontFamily = com.music.spotui.ui.theme.AppSans,fontWeight = androidx.compose.ui.text.font.FontWeight.Bold, fontSize = 15.sp,modifier = Modifier.padding(top = 8.dp).pressable(0.96f, onClick = onLater).padding(horizontal = 24.dp, vertical = 12.dp),)diff --git a/base/app/src/main/java/com/music/spotui/cli/Cli.kt b/base/app/src/main/java/com/music/spotui/cli/Cli.ktnew file mode 100644index 00000000..1904499f--- /dev/null+++ b/base/app/src/main/java/com/music/spotui/cli/Cli.kt@@ -0,0 +1,193 @@+package com.music.spotui.cli++import app.myspoti.extensions.Hook+import app.myspoti.extensions.Setting+import kotlinx.serialization.json.Json+import kotlinx.serialization.json.JsonArray+import kotlinx.serialization.json.JsonElement+import kotlinx.serialization.json.JsonNull+import kotlinx.serialization.json.JsonObject+import kotlinx.serialization.json.JsonPrimitive+import kotlinx.serialization.json.buildJsonObject+import kotlinx.serialization.json.contentOrNull+import kotlinx.serialization.json.jsonArray++/**+ * Debug and beta builds: the commands `tools/myspoti-cli` sends over adb ([CliReceiver]), so a test+ * drives the app's own paths without a screenshot or a tap. Nothing here knows a provider: the+ * commands name the app's own parts (extensions, hooks, player, routes).+ */+sealed interface CliCommand {+ data object Status : CliCommand+ data object ExtList : CliCommand+ /** A package zip on the phone, installed with all it asks, without the prompt. */+ data class ExtInstall(val path: String) : CliCommand+ data class ExtUninstall(val id: String) : CliCommand+ data class ExtEnable(val id: String, val on: Boolean) : CliCommand+ /** [json]: the value as JSON text, null to go back to the default. */+ data class ExtSetting(val id: String, val key: String, val json: String?) : CliCommand+ data class ExtPress(val id: String, val key: String) : CliCommand+ data class ExtCall(val id: String, val hook: Hook, val input: String) : CliCommand+ data class ExtLog(val id: String, val lines: Int) : CliCommand+ data class ExtStorage(val id: String) : CliCommand+ data class Play(val uri: String, val context: String?) : CliCommand+ data object Pause : CliCommand+ data object Resume : CliCommand+ data object Next : CliCommand+ data object Previous : CliCommand+ data class Nav(val route: String) : CliCommand+}++class CliError(message: String) : Exception(message)++object CliParser {+ val COMMANDS = listOf(+ "status", "ext.list", "ext.install <zip path>", "ext.uninstall <id>", "ext.enable <id>", "ext.disable <id>",+ "ext.setting <id> <key> <value|null>", "ext.press <id> <key>", "ext.call <id> <hook> [json]",+ "ext.log <id> [lines]", "ext.storage <id>", "play <spotify uri> [context uri]", "pause", "resume", "next", "previous",+ "nav <route>",+ )++ private val ID = Regex("[A-Za-z0-9][A-Za-z0-9._-]{0,127}")+ private val KEY = Regex("[A-Za-z0-9_.-]{1,64}")+ private val URI = Regex("spotify:[a-z]+(:[A-Za-z0-9_.-]+)+")++ /** The arguments the script sends: a JSON array of strings, base64 in [args64] (no shell quoting). */+ fun args(args: String?, args64: String?): List<String> {+ val text = args64?.takeIf { it.isNotBlank() }?.let {+ runCatching { String(java.util.Base64.getDecoder().decode(it.trim()), Charsets.UTF_8) }.getOrElse { throw CliError("args64 is not base64") }+ } ?: args?.takeIf { it.isNotBlank() } ?: return emptyList()+ val array = runCatching { Json.parseToJsonElement(text).jsonArray }.getOrElse { throw CliError("args must be a JSON array of strings") }+ return array.map { (it as? JsonPrimitive)?.takeIf { p -> p.isString }?.content ?: throw CliError("args must be a JSON array of strings") }+ }++ fun parse(cmd: String, args: List<String>): CliCommand {+ fun arg(i: Int, what: String): String = args.getOrNull(i)?.takeIf { it.isNotBlank() } ?: throw CliError("$cmd: missing <$what>")+ fun id(i: Int = 0) = arg(i, "id").also { if (!ID.matches(it)) throw CliError("$cmd: bad extension id '$it'") }+ fun key(i: Int) = arg(i, "key").also { if (!KEY.matches(it)) throw CliError("$cmd: bad key '$it'") }+ fun most(n: Int) { if (args.size > n) throw CliError("$cmd: too many arguments (${args.size}, at most $n)") }+ return when (cmd.trim()) {+ "status" -> CliCommand.Status.also { most(0) }+ "ext.list" -> CliCommand.ExtList.also { most(0) }+ "ext.install" -> CliCommand.ExtInstall(arg(0, "zip path").also {+ if (!it.startsWith("/") || ".." in it.split('/')) throw CliError("ext.install: give an absolute path on the phone")+ most(1)+ })+ "ext.uninstall" -> CliCommand.ExtUninstall(id()).also { most(1) }+ "ext.enable" -> CliCommand.ExtEnable(id(), true).also { most(1) }+ "ext.disable" -> CliCommand.ExtEnable(id(), false).also { most(1) }+ "ext.setting" -> CliCommand.ExtSetting(id(), key(1), settingJson(args.getOrNull(2) ?: throw CliError("ext.setting: missing <value>"))).also { most(3) }+ "ext.press" -> CliCommand.ExtPress(id(), key(1)).also { most(2) }+ "ext.call" -> {+ most(3)+ val hook = arg(1, "hook").let { h -> Hook.of(h) ?: throw CliError("ext.call: unknown hook '$h' (${Hook.entries.joinToString { it.key }})") }+ val input = args.getOrNull(2)?.takeIf { it.isNotBlank() } ?: "{}"+ runCatching { Json.parseToJsonElement(input) }.getOrElse { throw CliError("ext.call: the input is not JSON") }+ CliCommand.ExtCall(id(), hook, input)+ }+ "ext.log" -> CliCommand.ExtLog(id(), args.getOrNull(1)?.let { it.toIntOrNull()?.coerceIn(1, 1000) ?: throw CliError("ext.log: [lines] is a number") } ?: 50).also { most(2) }+ "ext.storage" -> CliCommand.ExtStorage(id()).also { most(1) }+ "play" -> {+ most(2)+ val uri = arg(0, "spotify uri").also { if (!URI.matches(it)) throw CliError("play: not a spotify: uri") }+ CliCommand.Play(uri, args.getOrNull(1)?.takeIf { it.isNotBlank() }?.also { if (!URI.matches(it)) throw CliError("play: the context is not a spotify: uri") })+ }+ "pause" -> CliCommand.Pause.also { most(0) }+ "resume" -> CliCommand.Resume.also { most(0) }+ "next" -> CliCommand.Next.also { most(0) }+ "previous" -> CliCommand.Previous.also { most(0) }+ "nav" -> CliCommand.Nav(arg(0, "route").also { if ("://" in it || it.startsWith("/")) throw CliError("nav: a route of the app, like settings or extension/<id>") ; most(1) })+ else -> throw CliError("unknown command '$cmd' (${COMMANDS.joinToString(", ")})")+ }+ }++ /** A setting's value as typed: JSON when it reads as JSON (true, 3, "x"), else a string; `null` resets it. */+ fun settingJson(value: String): String? {+ val v = value.trim()+ if (v == "null") return null+ val parsed = runCatching { Json.parseToJsonElement(v) }.getOrNull()+ // The JSON reader takes a bare word as a literal: only true, false and numbers stay unquoted.+ val json = when (parsed) {+ is JsonPrimitive -> parsed.isString || v == "true" || v == "false" || v.toDoubleOrNull() != null+ is JsonArray, is JsonObject -> true+ else -> false+ }+ return if (json) parsed.toString() else JsonPrimitive(value).toString()+ }+}++/** What leaves the phone: no value of a secret setting, of the storage, nor anything that reads as a token. */+object CliMask {+ const val MASK = "***"++ private val SENSITIVE = Regex("(?i)(token|secret|passw|cookie|auth(?!or)|session|bearer|credential|signature|^sig$|^key$|apikey|api_key|private|jwt|sid$|policy|key-pair-id)")+ private val BEARER = Regex("(?i)\\b(bearer|basic)\\s+[A-Za-z0-9._~+/=-]{6,}")+ private val HEADER = Regex("(?i)\\b(cookie|set-cookie|authorization)\\s*[:=]\\s*[^\\n,}]+")+ private val QUERY = Regex("([?&;])([^=&#\\s\"]+)=([^&#\\s\"]*)")+ private val JWT = Regex("\\beyJ[A-Za-z0-9_-]{8,}\\.[A-Za-z0-9_-]{4,}\\.[A-Za-z0-9_-]*")++ fun sensitiveName(name: String): Boolean = SENSITIVE.containsMatchIn(name)++ /** [text] with every [known] value (secrets, stored values, 6 characters or more) and token-looking part replaced. */+ fun text(text: String, known: Collection<String> = emptyList()): String {+ var out = text+ known.filter { it.length >= 6 }.sortedByDescending { it.length }.forEach { out = out.replace(it, MASK) }+ out = BEARER.replace(out) { "${it.groupValues[1]} $MASK" }+ out = HEADER.replace(out) { "${it.groupValues[1]}: $MASK" }+ out = JWT.replace(out, MASK)+ out = QUERY.replace(out) { m -> if (sensitiveName(m.groupValues[2]) && m.groupValues[3].isNotEmpty()) "${m.groupValues[1]}${m.groupValues[2]}=$MASK" else m.value }+ return out+ }++ /** [e] with the values under sensitive names masked and every string run through [text]. */+ fun json(e: JsonElement, known: Collection<String> = emptyList()): JsonElement = when (e) {+ is JsonObject -> JsonObject(e.mapValues { (k, v) -> if (sensitiveName(k) && v !is JsonNull && v !is JsonObject && v !is JsonArray) JsonPrimitive(MASK) else json(v, known) })+ is JsonArray -> JsonArray(e.map { json(it, known) })+ is JsonPrimitive -> if (e.isString) JsonPrimitive(text(e.content, known)) else e+ }++ /**+ * An extension's settings as shown: a secret one (or one its manifest does not list) reads+ * [MASK] once set, a button has no value. [values]: key → JSON text, as stored.+ */+ fun settings(declared: List<Setting>, values: Map<String, String>): JsonObject = buildJsonObject {+ declared.filter { it.type != "button" }.forEach { s ->+ val v = values[s.key]+ put(s.key, when {+ v == null -> s.default ?: JsonNull+ s.type == "secret" || sensitiveName(s.key) -> JsonPrimitive(MASK)+ else -> runCatching { Json.parseToJsonElement(v) }.getOrDefault(JsonPrimitive(MASK))+ })+ }+ values.keys.filter { k -> declared.none { it.key == k } }.forEach { put(it, JsonPrimitive(MASK)) }+ }++ /** The values to hide wherever they show up: secret settings and the storage, as plain strings. */+ fun knownSecrets(declared: List<Setting>, settings: Map<String, String>, storage: Map<String, String>): List<String> {+ val secretSettings = declared.filter { it.type == "secret" || sensitiveName(it.key) }.mapNotNull { settings[it.key] }+ return (secretSettings + storage.values).flatMap { strings(it) }.distinct()+ }++ /** A stored JSON value's strings (the whole text too, and an object's values one by one). */+ private fun strings(json: String): List<String> {+ val e = runCatching { Json.parseToJsonElement(json) }.getOrNull() ?: return listOf(json)+ fun walk(x: JsonElement): List<String> = when (x) {+ is JsonObject -> x.values.flatMap(::walk)+ is JsonArray -> x.flatMap(::walk)+ is JsonPrimitive -> listOfNotNull(x.contentOrNull)+ }+ return walk(e) + json+ }+}++/** One answer, written to the reply file and the log. */+object CliReply {+ fun ok(cmd: String, result: JsonElement = JsonNull): String =+ JsonObject(mapOf("ok" to JsonPrimitive(true), "cmd" to JsonPrimitive(cmd), "result" to result)).toString()++ fun error(cmd: String, message: String): String =+ JsonObject(mapOf("ok" to JsonPrimitive(false), "cmd" to JsonPrimitive(cmd), "error" to JsonPrimitive(message))).toString()++ /** A request id the script chose: the reply file's name, so nothing else. */+ fun safeRequestId(id: String?): String? = id?.takeIf { Regex("[A-Za-z0-9_-]{1,64}").matches(it) }+}diff --git a/base/app/src/main/java/com/music/spotui/cli/CliReceiver.kt b/base/app/src/main/java/com/music/spotui/cli/CliReceiver.ktnew file mode 100644index 00000000..c4ae7077--- /dev/null+++ b/base/app/src/main/java/com/music/spotui/cli/CliReceiver.kt@@ -0,0 +1,197 @@+package com.music.spotui.cli++import android.content.BroadcastReceiver+import android.content.Context+import android.content.Intent+import android.util.Log+import app.myspoti.extensions.ExtensionPackage+import com.music.spotui.di.SongPlayer+import com.music.spotui.extensions.Extensions+import com.music.spotui.extensions.Grants+import kotlinx.coroutines.CoroutineScope+import kotlinx.coroutines.Dispatchers+import kotlinx.coroutines.SupervisorJob+import kotlinx.coroutines.flow.MutableSharedFlow+import kotlinx.coroutines.launch+import kotlinx.coroutines.withContext+import kotlinx.serialization.json.Json+import kotlinx.serialization.json.JsonArray+import kotlinx.serialization.json.JsonElement+import kotlinx.serialization.json.JsonNull+import kotlinx.serialization.json.JsonPrimitive+import kotlinx.serialization.json.buildJsonObject+import kotlinx.serialization.json.put+import java.io.File++/**+ * The command line's door (`adb shell am broadcast -a <package>.CLI -p <package> --es cmd … --es args64 …+ * --es req <id>`), see docs/cli.md and tools/myspoti-cli. Only the adb shell may send it (DUMP), the+ * manifest turns it on in debug and beta builds only, and it answers nothing elsewhere. The reply goes+ * to `<external files>/cli/<req>.json` and, cut, to logcat under [TAG].+ */+class CliReceiver : BroadcastReceiver() {+ override fun onReceive(context: Context, intent: Intent) {+ if (!enabled) return+ val cmd = intent.getStringExtra("cmd").orEmpty()+ val req = CliReply.safeRequestId(intent.getStringExtra("req")) ?: "last"+ val app = context.applicationContext+ val pending = goAsync()+ scope.launch {+ val reply = try {+ val command = CliParser.parse(cmd, CliParser.args(intent.getStringExtra("args"), intent.getStringExtra("args64")))+ CliReply.ok(cmd, run(app, command))+ } catch (e: CliError) {+ CliReply.error(cmd, e.message.orEmpty())+ } catch (t: Throwable) {+ CliReply.error(cmd, CliMask.text(t.message ?: t.toString()))+ }+ runCatching {+ val dir = File(app.getExternalFilesDir(null), "cli").apply { mkdirs() }+ val tmp = File(dir, "$req.json.tmp")+ tmp.writeText(reply)+ tmp.renameTo(File(dir, "$req.json"))+ }.onFailure { Log.w(TAG, "$req: reply not written: $it") }+ Log.i(TAG, "$req $cmd ${reply.take(3500)}")+ pending.resultData = if (reply.length < 1000) reply else null+ pending.finish()+ }+ }++ private suspend fun run(ctx: Context, c: CliCommand): JsonElement = when (c) {+ CliCommand.Status -> onMain {+ val np = SongPlayer.nowPlaying.value+ buildJsonObject {+ put("package", ctx.packageName)+ put("version", app.myspoti.engine.BuildConfig.VERSION_NAME)+ put("versionCode", app.myspoti.engine.BuildConfig.VERSION_CODE)+ put("debug", app.myspoti.engine.BuildConfig.DEBUG)+ put("beta", com.music.spotui.data.api.UpdateChecker.isBeta)+ put("signedIn", ctx.getSharedPreferences("myspoti_prefs", Context.MODE_PRIVATE).getBoolean("LoggedIn", false))+ put("playing", SongPlayer.isPlaying())+ put("uri", np.uri)+ put("context", np.contextUri)+ put("positionMs", SongPlayer.getCurrentPosition())+ put("durationMs", SongPlayer.getDuration())+ // Who plays: the app's own player (an extension's stream, a download, a file) or Spotify's engine.+ val local = com.music.spotui.di.LocalPlayer.active.value && !SongPlayer.routing+ put("player", if (local) "local" else "engine")+ put("routing", SongPlayer.routing)+ // The local player's own view: asked to play, and idle (stopped by an error), buffering, ready or ended.+ if (com.music.spotui.di.LocalPlayer.active.value) {+ put("playWhenReady", com.music.spotui.di.LocalPlayer.playWhenReady())+ put("playbackState", com.music.spotui.di.LocalPlayer.playbackState())+ }+ if (local) com.music.spotui.di.LocalPlayer.current()?.let { t ->+ val streamed = t.uri.scheme == com.music.spotui.extensions.ExtensionAudio.SCHEME+ put("source", if (streamed) "audio-source" else if (com.music.spotui.data.offline.OfflineStore.byLocalId(t.id) != null) "download" else "file")+ if (streamed) com.music.spotui.extensions.ExtensionAudio.providerOf(t.uri.lastPathSegment.orEmpty())?.let { put("extension", it) }+ }+ put("extensions", if (Extensions.isReady) Extensions.registry.value.extensions.size else 0)+ put("ui", nav.subscriptionCount.value > 0)+ }+ }+ CliCommand.ExtList -> JsonArray(ready().registry.value.extensions.map { e ->+ val m = Extensions.manifest(e.id)+ buildJsonObject {+ put("id", e.id); put("name", e.name); put("version", e.version)+ put("enabled", e.enabled); put("running", Extensions.isRunning(e.id)); put("source", e.source)+ e.disabledReason?.let { put("disabledReason", it) }+ Extensions.errors.value[e.id]?.let { put("error", CliMask.text(it, secrets(e.id))) }+ // Its last status probe: live, inactive (skipped for audio and downloads) or unknown (no answer, still used).+ val st = Extensions.statusOf(e.id)+ put("inactive", st?.state == "inactive")+ put("status", st?.state ?: "not probed")+ st?.detail?.let { put("statusDetail", CliMask.text(it, secrets(e.id))) }+ put("actions", JsonArray(m?.actionSet()?.map { JsonPrimitive(it.key) }.orEmpty()))+ put("settings", CliMask.settings(m?.settings.orEmpty(), Extensions.settingValues(e.id)))+ }+ })+ is CliCommand.ExtInstall -> {+ val f = File(c.path)+ if (!f.isFile) throw CliError("ext.install: no file at ${c.path} (push it under the app's external files folder)")+ val zip = withContext(Dispatchers.IO) { f.readBytes() }+ val p = runCatching { ExtensionPackage.read(zip) }.getOrElse { throw CliError("ext.install: not an extension package: ${it.message}") }+ val m = p.manifest+ val plan = ready().plan(p)+ Extensions.install(zip, p, Grants.keys(m), "file", Extensions.clashes(m), { true }, noticeAccepted = true)+ buildJsonObject {+ put("id", m.id); put("version", m.version); put("plan", plan::class.simpleName)+ put("running", Extensions.isRunning(m.id))+ Extensions.errors.value[m.id]?.let { put("error", CliMask.text(it, secrets(m.id))) }+ }+ }+ is CliCommand.ExtUninstall -> { installed(c.id); Extensions.uninstall(c.id); JsonNull }+ is CliCommand.ExtEnable -> {+ installed(c.id)+ val m = Extensions.manifest(c.id)+ Extensions.setEnabled(c.id, c.on, if (c.on && m != null) Extensions.clashes(m) else emptyList()).join()+ buildJsonObject { put("enabled", Extensions.registry.value.find(c.id)?.enabled); put("running", Extensions.isRunning(c.id)) }+ }+ is CliCommand.ExtSetting -> {+ val s = setting(c.id, c.key)+ if (s.type == "button") throw CliError("ext.setting: ${c.key} is a button, use ext.press")+ Extensions.setSetting(c.id, c.key, c.json)+ JsonPrimitive(if (c.json == null) "reset" else "set")+ }+ is CliCommand.ExtPress -> {+ if (setting(c.id, c.key).type != "button") throw CliError("ext.press: ${c.key} is not a button")+ Extensions.pressSetting(c.id, c.key)+ JsonPrimitive("pressed")+ }+ is CliCommand.ExtCall -> {+ installed(c.id)+ val answer = runCatching { Extensions.callHook(c.id, c.hook, c.input) }.getOrElse { throw CliError("ext.call: ${it.message ?: it}") }+ answer?.let { CliMask.json(runCatching { Json.parseToJsonElement(it) }.getOrElse { _ -> JsonPrimitive(it) }, secrets(c.id)) } ?: JsonNull+ }+ is CliCommand.ExtLog -> {+ installed(c.id)+ val known = secrets(c.id)+ JsonArray(Extensions.logLines(c.id).takeLast(c.lines).map { JsonPrimitive(CliMask.text(it, known)) })+ }+ is CliCommand.ExtStorage -> {+ installed(c.id)+ val values = Extensions.storageValues(c.id)+ buildJsonObject {+ put("keys", JsonArray(values.keys.sorted().map(::JsonPrimitive)))+ put("bytes", values.entries.sumOf { it.key.length + it.value.length })+ }+ }+ is CliCommand.Play -> onMain { SongPlayer.playSong(c.uri, contextUri = c.context); JsonNull }+ CliCommand.Pause -> onMain { SongPlayer.pause(by = "cli"); JsonNull }+ CliCommand.Resume -> onMain { SongPlayer.play(by = "cli"); JsonNull }+ CliCommand.Next -> onMain { SongPlayer.next(); JsonNull }+ CliCommand.Previous -> onMain { SongPlayer.previous(); JsonNull }+ is CliCommand.Nav -> {+ if (nav.subscriptionCount.value == 0) throw CliError("nav: the app's screen is not open (adb shell monkey -p ${ctx.packageName} 1)")+ nav.emit(c.route)+ JsonPrimitive(c.route)+ }+ }++ private fun ready(): Extensions = Extensions.also { if (!it.isReady) throw CliError("extensions are not loaded yet") }++ private fun installed(id: String) { if (ready().registry.value.find(id) == null) throw CliError("$id is not installed") }++ private fun setting(id: String, key: String) = installed(id).let {+ Extensions.manifest(id)?.settings?.firstOrNull { it.key == key } ?: throw CliError("$id has no setting '$key'")+ }++ private fun secrets(id: String): List<String> {+ val m = Extensions.manifest(id)+ return CliMask.knownSecrets(m?.settings.orEmpty(), Extensions.settingValues(id), Extensions.storageValues(id))+ }++ private suspend fun <T> onMain(block: () -> T): T = withContext(Dispatchers.Main) { block() }++ companion object {+ const val TAG = "MyspotiCli"++ /** Debug and beta builds; the manifest leaves the receiver off in the others too. */+ val enabled: Boolean get() = app.myspoti.engine.BuildConfig.DEBUG || com.music.spotui.data.api.UpdateChecker.isBeta++ private val scope = CoroutineScope(SupervisorJob() + Dispatchers.IO)++ /** `nav <route>`: the app's screen navigates there (App collects it). */+ val nav = MutableSharedFlow<String>(extraBufferCapacity = 1)+ }+}diff --git a/base/app/src/main/java/com/music/spotui/data/BetaLogs.kt b/base/app/src/main/java/com/music/spotui/data/BetaLogs.ktindex 605d9508..58f8cf06 100644--- a/base/app/src/main/java/com/music/spotui/data/BetaLogs.kt+++ b/base/app/src/main/java/com/music/spotui/data/BetaLogs.kt@@ -33,8 +33,8 @@ object BetaLogs {/** The app's log tags (Myspoti = the Web Player bridge). */private val TAGS = listOf(- "Myspoti", "MspPlayer", "Api", "player", "Offline", "OfflineLists", "LosslessSource", "LosslessRegistry",- "DashFlacRemux", "Spotiflac", "Wrapped", "SpotifySync", "LyricsApi", "LyricTranslate", "MusicVideo",+ "Myspoti", "MspPlayer", "Api", "player", "Offline", "OfflineLists", "Extensions",+ "DashFlacRemux", "SpotifySync", "LyricsApi", "LyricTranslate", "MusicVideo","ScreenCache", "AppUpdater",)diff --git a/base/app/src/main/java/com/music/spotui/data/LibraryOutbox.kt b/base/app/src/main/java/com/music/spotui/data/LibraryOutbox.ktnew file mode 100644index 00000000..2aa2f6e7--- /dev/null+++ b/base/app/src/main/java/com/music/spotui/data/LibraryOutbox.kt@@ -0,0 +1,63 @@+package com.music.spotui.data++import android.content.Context+import android.net.ConnectivityManager+import android.net.Network+import org.json.JSONObject++/**+ * Likes, unlikes, saves and follows made without a connection: shown at once, kept here (the last+ * tap on an item wins) and sent to Spotify when the network is back, in the order they were made.+ */+object LibraryOutbox {+ private const val PREFS = "library_outbox"+ private const val KEY = "pending"++ /** What waits, in order: item uri -> saved. Pure, for tests: see [Pending]. */+ class Pending(text: String?) {+ private val items = LinkedHashMap<String, Boolean>().apply {+ runCatching { JSONObject(text ?: "{}") }.getOrNull()?.let { o -> o.keys().forEach { put(it, o.optBoolean(it)) } }+ }+ val all: Map<String, Boolean> get() = items++ /** The newest tap on [uri]: it moves to the end, the earlier one is forgotten. */+ fun put(uri: String, saved: Boolean) { items.remove(uri); items[uri] = saved }+ fun sent(uri: String, saved: Boolean) { if (items[uri] == saved) items.remove(uri) }+ fun text(): String = JSONObject(items as Map<*, *>).toString()+ }++ private var context: Context? = null+ private var send: (suspend (uri: String, saved: Boolean) -> Unit)? = null++ private fun prefs() = context?.getSharedPreferences(PREFS, Context.MODE_PRIVATE)+ @Synchronized private fun read() = Pending(prefs()?.getString(KEY, null))+ @Synchronized private fun write(p: Pending) { prefs()?.edit()?.putString(KEY, p.text())?.apply() }++ @Synchronized fun put(uri: String, saved: Boolean) = write(read().apply { put(uri, saved) })+ val waiting: Int get() = read().all.size++ /** [sender] writes one change to Spotify (throws when it cannot); called when the network is back. */+ fun init(c: Context, sender: suspend (uri: String, saved: Boolean) -> Unit, onAvailable: () -> Unit) {+ if (context != null) return+ context = c.applicationContext+ send = sender+ val cm = c.getSystemService(ConnectivityManager::class.java) ?: return+ runCatching {+ cm.registerDefaultNetworkCallback(object : ConnectivityManager.NetworkCallback() {+ override fun onAvailable(network: Network) = onAvailable()+ })+ }+ }++ /** Sends what waits, oldest first; stops at the first failure (the rest waits for the next network). */+ suspend fun flush() {+ val sender = send ?: return+ for ((uri, saved) in read().all.entries.toList()) {+ runCatching { sender(uri, saved) }.onFailure {+ android.util.Log.w("LibraryOutbox", "kept for later: $uri (${it.message})")+ return+ }+ synchronized(this) { write(read().apply { sent(uri, saved) }) }+ }+ }+}diff --git a/base/app/src/main/java/com/music/spotui/data/api/LyricsApi.kt b/base/app/src/main/java/com/music/spotui/data/api/LyricsApi.ktindex 5b60c963..e77e752d 100644--- a/base/app/src/main/java/com/music/spotui/data/api/LyricsApi.kt+++ b/base/app/src/main/java/com/music/spotui/data/api/LyricsApi.kt@@ -102,13 +102,30 @@ object LyricsApi {return job.await()}- private suspend fun resolve(track: Track): Lyrics? {- val result = if (wordSync) wordFirst(track) else fromSpotify(track) ?: lineFallbacks(track)+ private suspend fun resolve(track: Track): Lyrics? = coroutineScope {+ // Extensions that provide lyrics are asked at the same time as the app's own sources+ // (each within its time limit); the better answer is kept (LyricsMerge), Spotify's own+ // complete lyrics first at the same level, and then the extensions are not waited for.+ val ext = if (extensionsAsked()) async {+ runCatching {+ com.music.spotui.extensions.Extensions.lyricsFor(track.trackId, track.title, track.artist, track.album, track.durationMs, track.coverUrl)+ }.getOrNull()+ } else null+ val own = if (wordSync) wordFirst(track) else fromSpotify(track) ?: lineFallbacks(track)+ val fromExt = when {+ ext == null -> null+ own != null && com.music.spotui.extensions.LyricsMerge.rank(own) == 3 && com.music.spotui.extensions.LyricsMerge.isSpotifyComplete(own) -> { ext.cancel(); null }+ else -> ext.await()+ }+ val result = com.music.spotui.extensions.LyricsMerge.choose(own, fromExt)cache[track.key] = result ?: Miss()Log.d("LyricsApi", "${track.title}: ${result?.let { "${it.lines.size} lines from ${it.provider}, synced=${it.synced}, words=${it.wordSynced}" } ?: "none"}")- return result+ result}+ /** Whether lyrics extensions are installed and running (false in unit tests: no app). */+ private fun extensionsAsked(): Boolean = runCatching { com.music.spotui.extensions.Extensions.hasLyrics() }.getOrDefault(false)+/*** "Word by word" (the setting): the sources with each word's time come first — Spotify's own* when it has them, then LyricsPlus, lrc.red and Kugou, asked together; the line-synceddiff --git a/base/app/src/main/java/com/music/spotui/data/api/ScreenCache.kt b/base/app/src/main/java/com/music/spotui/data/api/ScreenCache.ktindex 1d7886de..1d705197 100644--- a/base/app/src/main/java/com/music/spotui/data/api/ScreenCache.kt+++ b/base/app/src/main/java/com/music/spotui/data/api/ScreenCache.kt@@ -37,6 +37,14 @@ object ScreenCache {/** A playlist page fetched ahead (see PagePrefetch), one file per playlist. */fun page(id: String) = Entry("page_$id", com.music.spotui.data.entity.ContextPageModel.serializer())+ /**+ * The page of a list downloaded as a whole (see OfflineCollections): cover, details and songs+ * in order, so it opens offline. Never pruned; gone with the list or at logout.+ */+ fun offlinePage(id: String) = Entry("offline_page_$id", com.music.spotui.data.entity.ContextPageModel.serializer())++ fun dropOfflinePage(id: String) { io.launch { File(dir, "offline_page_$id.json").delete() } }+/** When the page of [id] was last saved; null when there is none. */fun pageSavedAt(id: String): Long? = File(dir, "page_$id.json").takeIf { it.exists() }?.lastModified()diff --git a/base/app/src/main/java/com/music/spotui/data/api/SpotifySync.kt b/base/app/src/main/java/com/music/spotui/data/api/SpotifySync.ktindex ede5ce5d..f0e8cc97 100644--- a/base/app/src/main/java/com/music/spotui/data/api/SpotifySync.kt+++ b/base/app/src/main/java/com/music/spotui/data/api/SpotifySync.kt@@ -46,6 +46,23 @@ object SpotifySync {}}+ /**+ * Adds many songs at once (a whole album or playlist, read beforehand) at the bottom of one of+ * the user's playlists, in 100-song requests. Run in the app's scope so closing the sheet+ * does not cancel it. [onDone] gets whether Spotify took all of it.+ */+ fun addUrisToPlaylist(context: Context, playlistId: String, uris: List<String>, onDone: (Boolean) -> Unit = {}) {+ if (playlistId.isBlank() || uris.isEmpty()) { onDone(false); return }+ scope.launch {+ val ok = runCatching { api.playlists.addTracks("spotify:playlist:$playlistId", uris) }+ .onFailure { Log.w(TAG, "add ${uris.size} songs to $playlistId failed: ${it.message}") }.isSuccess+ // Part of it may be in even when refused: read the playlist again when asked.+ membershipCache.remove(playlistId)+ com.music.spotui.data.offline.OfflineCollections.refreshOne(context.applicationContext, "spotify:playlist:$playlistId")+ onDone(ok)+ }+ }+/*** Takes one row out of a playlist, named by its row id (not by its song: the same song twice* in a playlist is two rows, and removing "the song" took both). Without a row id (an old@@ -98,6 +115,17 @@ object SpotifySync {}}+ /** Stops a collaboration (owner): collaborators become listeners (private) or leave (public). */+ fun stopPlaylistCollaboration(uri: String, onDone: (Boolean) -> Unit = {}) {+ scope.launch {+ val ok = visibilityWrites.withLock {+ runCatching { api.playlists.stopCollaboration(uri) }+ .onFailure { Log.w(TAG, "stopping the collaboration on $uri refused: ${it.message}") }.isSuccess+ }+ onDone(ok)+ }+ }+/** Whether the playlist is listed on the user's profile. */fun setPlaylistPublished(uri: String, published: Boolean, onDone: (Boolean) -> Unit = {}) {scope.launch {diff --git a/base/app/src/main/java/com/music/spotui/data/api/TopStats.kt b/base/app/src/main/java/com/music/spotui/data/api/TopStats.ktnew file mode 100644index 00000000..5fc77e9a--- /dev/null+++ b/base/app/src/main/java/com/music/spotui/data/api/TopStats.kt@@ -0,0 +1,45 @@+package com.music.spotui.data.api++import app.myspoti.api.TimeRange+import app.myspoti.api.TopContent+import app.myspoti.host.android.MyspotiRuntime+import kotlinx.coroutines.sync.Mutex+import kotlinx.coroutines.sync.withLock++/**+ * The account's top artists and tracks as Spotify ranks them (`userTopContent`), per window,+ * kept for half an hour: the stats screen and every artist page's "your top artist" line share+ * one answer instead of asking again on each open.+ */+object TopStats {+ const val LIMIT = 50+ private const val TTL_MS = 30 * 60_000L++ private val lock = Mutex()+ private val cache = java.util.concurrent.ConcurrentHashMap<TimeRange, Pair<Long, TopContent>>()++ suspend fun get(range: TimeRange, force: Boolean = false): TopContent = lock.withLock {+ val now = System.currentTimeMillis()+ cache[range]?.takeIf { !force && now - it.first < TTL_MS }?.second+ ?: MyspotiRuntime.api.users.top(range, LIMIT).also { cache[range] = now to it }+ }++ /** What is cached, without asking Spotify. */+ fun cached(range: TimeRange): TopContent? = cache[range]?.second++ /** Forgets every answer (sign-out: they belong to one account). */+ fun clear() = cache.clear()++ /**+ * Where an artist ranks in the account's top artists, as the badge on its page says it:+ * the shortest window that has it in its top 10 (the official "top artist this month"+ * comes first), otherwise its best rank in any window. [ranked] holds each window's artist+ * uris, best first. Null when the artist is in none of them.+ */+ fun rankOf(artistUri: String, ranked: Map<TimeRange, List<String>>): Pair<TimeRange, Int>? {+ val ranks = TimeRange.entries.mapNotNull { r ->+ ranked[r]?.indexOf(artistUri)?.takeIf { it >= 0 }?.let { r to it + 1 }+ }+ return ranks.firstOrNull { it.second <= 10 } ?: ranks.minByOrNull { it.second }+ }+}diff --git a/base/app/src/main/java/com/music/spotui/data/entity/SongsModel.kt b/base/app/src/main/java/com/music/spotui/data/entity/SongsModel.ktindex d62f80f6..a52bf937 100644--- a/base/app/src/main/java/com/music/spotui/data/entity/SongsModel.kt+++ b/base/app/src/main/java/com/music/spotui/data/entity/SongsModel.kt@@ -11,11 +11,9 @@ data class SongsModel(// Real Spotify track id (e.g. "3n3Ppam7vgaVa1iaRUc9Lp"), kept so playback can// seed Spotify's recommendations endpoint for autoplay radio. Empty when unknown.val spotifyTrackId : String = "",- // Whether the Spotify track is the explicit version, so the YouTube fallback- // can pick the matching (explicit vs clean) edit.+ // Whether the Spotify track is the explicit version (the E badge).val explicit : Boolean = false,- // Track length in ms (from Spotify). Used to disambiguate the YouTube match:- // a same-title-different-artist song almost always has a different duration.+ // Track length in ms (from Spotify), 0 when unknown.val durationMs : Int = 0,// Spotify album id of the track, when known (opens the album page by id).val albumId : String = "",diff --git a/base/app/src/main/java/com/music/spotui/data/local/LibraryChips.kt b/base/app/src/main/java/com/music/spotui/data/local/LibraryChips.ktnew file mode 100644index 00000000..e94353f8--- /dev/null+++ b/base/app/src/main/java/com/music/spotui/data/local/LibraryChips.kt@@ -0,0 +1,33 @@+package com.music.spotui.data.local++import com.music.spotui.data.entity.ArtistsModel+import com.music.spotui.data.entity.LibraryEntry++/**+ * The chips under "Your Library" (Playlists, Artists, Albums, Songs), like the official app's+ * filter row: one at a time, tapping the chosen one again shows everything.+ */+enum class LibraryChip { ALL, PLAYLISTS, ARTISTS, ALBUMS, SONGS }++object LibraryChips {+ /**+ * [songIds]: the library ids of the rows that hold songs rather than a playlist (Liked Songs,+ * Local Files, Downloaded). Folders count as playlists, as they sit among them in Spotify.+ * Artists are a separate list, so only the Artists chip keeps them.+ */+ fun apply(+ chip: LibraryChip,+ entries: List<LibraryEntry>,+ artists: List<ArtistsModel>,+ songIds: Set<String>,+ ): Pair<List<LibraryEntry>, List<ArtistsModel>> = when (chip) {+ LibraryChip.ALL -> entries to artists+ LibraryChip.ARTISTS -> emptyList<LibraryEntry>() to artists+ LibraryChip.SONGS -> entries.filter { it.spotifyId in songIds } to emptyList()+ LibraryChip.PLAYLISTS -> entries.filter { it.spotifyId !in songIds && (it.isPlaylist || it.isFolder) } to emptyList()+ LibraryChip.ALBUMS -> entries.filter { it.spotifyId !in songIds && !it.isPlaylist && !it.isFolder } to emptyList()+ }++ /** A tap on [tapped] while [current] is chosen. */+ fun toggle(current: LibraryChip, tapped: LibraryChip): LibraryChip = if (current == tapped) LibraryChip.ALL else tapped+}diff --git a/base/app/src/main/java/com/music/spotui/data/local/ListenHistory.kt b/base/app/src/main/java/com/music/spotui/data/local/ListenHistory.ktindex 6b1fccd4..b76b2618 100644--- a/base/app/src/main/java/com/music/spotui/data/local/ListenHistory.kt+++ b/base/app/src/main/java/com/music/spotui/data/local/ListenHistory.kt@@ -65,6 +65,42 @@ object ListenHistory {val topAlbums: List<Ranked>,)+ /** One calendar week of listening: its first day (local midnight, epoch ms) and the minutes played in it. */+ data class Week(val startMs: Long, val minutes: Long)++ /** Minutes per week over the last [weeks] calendar weeks, oldest first, the current week last. */+ fun weekly(weeks: Int = 8, nowMs: Long = System.currentTimeMillis()): List<Week> = weekly(all(), weeks, nowMs)++ /**+ * Groups [listens] by calendar week (weeks start on the locale's first day, in [zone]); the+ * current, unfinished week is last. Weeks without listens count 0.+ */+ fun weekly(+ listens: List<Listen>,+ weeks: Int,+ nowMs: Long,+ zone: java.util.TimeZone = java.util.TimeZone.getDefault(),+ firstDayOfWeek: Int = java.util.Calendar.getInstance().firstDayOfWeek,+ ): List<Week> {+ val cal = java.util.Calendar.getInstance(zone).apply {+ this.firstDayOfWeek = firstDayOfWeek+ timeInMillis = nowMs+ set(java.util.Calendar.HOUR_OF_DAY, 0); set(java.util.Calendar.MINUTE, 0)+ set(java.util.Calendar.SECOND, 0); set(java.util.Calendar.MILLISECOND, 0)+ while (get(java.util.Calendar.DAY_OF_WEEK) != firstDayOfWeek) add(java.util.Calendar.DAY_OF_MONTH, -1)+ }+ // Week starts, newest first; calendar arithmetic keeps daylight-saving weeks right.+ val starts = (0 until weeks).map { i ->+ if (i > 0) cal.add(java.util.Calendar.WEEK_OF_YEAR, -1)+ cal.timeInMillis+ }.reversed()+ val ends = starts.drop(1) + Long.MAX_VALUE+ return starts.indices.map { i ->+ val ms = listens.filter { it.atMs >= starts[i] && it.atMs < ends[i] && it.atMs <= nowMs }.sumOf { it.playedMs }+ Week(starts[i], ms / 60_000)+ }+ }+/** Totals and top lists for listens since [sinceMs]. */fun recap(sinceMs: Long): Recap {val list = all().filter { it.atMs >= sinceMs }diff --git a/base/app/src/main/java/com/music/spotui/lossless/DashFlacRemux.kt b/base/app/src/main/java/com/music/spotui/data/offline/DashFlacRemux.ktsimilarity index 82%rename from base/app/src/main/java/com/music/spotui/lossless/DashFlacRemux.ktrename to base/app/src/main/java/com/music/spotui/data/offline/DashFlacRemux.ktindex 7c29866e..4a6b2185 100644--- a/base/app/src/main/java/com/music/spotui/lossless/DashFlacRemux.kt+++ b/base/app/src/main/java/com/music/spotui/data/offline/DashFlacRemux.kt@@ -1,27 +1,28 @@-package com.music.spotui.lossless+package com.music.spotui.data.offline/*- * Ported from the SpotiFLAC port in Spotui (https://github.com/Spotui/Spotui), GPL-3.0.+ * Ported from Spotui (https://github.com/Spotui/Spotui), GPL-3.0.*/import android.util.Log/**- * Downloads a TIDAL DASH-FLAC stream and remuxes it into a real single `.flac` file- * — no ffmpeg. The DASH segments are fragmented MP4 carrying raw FLAC frames, so:+ * Downloads an MPEG-DASH stream of FLAC in fragmented MP4 (FLAC-in-ISOBMFF) and remuxes it+ * into a real single `.flac` file, no ffmpeg:* 1. take STREAMINFO from the init segment's `dfLa` box,* 2. concatenate every media segment's `mdat` payload (the FLAC frames),* 3. write `fLaC` + STREAMINFO metadata block + frames.- * This is what unlocks 24-bit hi-res (HI_RES comes back as a segmented DASH- * `<MPD>` manifest, not a single-file URL).+ * A plain container operation: the manifest is a download-source extension's `dash-flac` file+ * (one `SegmentTemplate` with `initialization`, `media` with `$Number$`, and a+ * `SegmentTimeline`), the segments are fetched with the extension's headers.*/internal object DashFlacRemux {private const val TAG = "DashFlacRemux"- private const val UA = "SpotiFLAC"+ private val UA get() = OfflineDownloader.DownloadUaprivate const val PARALLEL_SEGMENTS = 3- /** [trackUrl] is either a `data:application/dash+xml;base64,…` URI or the MPD text itself. */- fun download(streamUrl: String, outFile: java.io.File): Boolean = runCatching {+ /** [streamUrl] is either a `data:application/dash+xml;base64,…` URI or the MPD text itself. */+ fun download(streamUrl: String, outFile: java.io.File, headers: Map<String, String> = emptyMap()): Boolean = runCatching {val mpd = mpdFromUrl(streamUrl) ?: return falseval initUrl = htmlUnescape(Regex("initialization=\"([^\"]+)\"").find(mpd)?.groupValues?.get(1) ?: return false)val mediaTmpl = htmlUnescape(Regex("media=\"([^\"]+)\"").find(mpd)?.groupValues?.get(1) ?: return false)@@ -29,7 +30,7 @@ internal object DashFlacRemux {val segCount = segmentCount(mpd)if (segCount <= 0) return false- val initBytes = httpBytes(initUrl) ?: return false+ val initBytes = httpBytes(initUrl, headers) ?: return falseval streamInfo = flacStreamInfoFromInit(initBytes) ?: return falsejava.io.BufferedOutputStream(java.io.FileOutputStream(outFile)).use { out ->@@ -40,19 +41,19 @@ internal object DashFlacRemux {out.write((streamInfo.size ushr 8) and 0xFF)out.write(streamInfo.size and 0xFF)out.write(streamInfo)- // Three segments in flight at once (SpotiFLAC's transfer policy), written in order.+ // Three segments in flight at once, written in order.val pool = java.util.concurrent.Executors.newFixedThreadPool(PARALLEL_SEGMENTS)try {val numbers = (startNumber until startNumber + segCount).toList()for (batch in numbers.chunked(PARALLEL_SEGMENTS * 2)) {- val parts = batch.map { n -> pool.submit<ByteArray?> { httpBytes(mediaTmpl.replace("\$Number$", n.toString())) } }+ val parts = batch.map { n -> pool.submit<ByteArray?> { httpBytes(mediaTmpl.replace("\$Number$", n.toString()), headers) } }for (p in parts) writeMdatPayloads(p.get() ?: return false, out)}} finally {pool.shutdownNow()}}- Log.d(TAG, "tidal DASH remuxed to FLAC ($segCount segments)")+ Log.d(TAG, "DASH remuxed to FLAC ($segCount segments)")true}.getOrElse { Log.w(TAG, "DASH remux failed: ${it.message}"); runCatching { outFile.delete() }; false }@@ -108,11 +109,12 @@ internal object DashFlacRemux {}}- private fun httpBytes(url: String): ByteArray? = runCatching {+ private fun httpBytes(url: String, headers: Map<String, String>): ByteArray? = runCatching {val conn = (java.net.URL(url).openConnection() as java.net.HttpURLConnection).apply {connectTimeout = 15_000readTimeout = 30_000setRequestProperty("User-Agent", UA)+ headers.forEach { (k, v) -> setRequestProperty(k, v) }}try {if (conn.responseCode !in 200..299) null else conn.inputStream.use { it.readBytes() }diff --git a/base/app/src/main/java/com/music/spotui/data/offline/DashLive.kt b/base/app/src/main/java/com/music/spotui/data/offline/DashLive.ktnew file mode 100644index 00000000..8a26c73b--- /dev/null+++ b/base/app/src/main/java/com/music/spotui/data/offline/DashLive.kt@@ -0,0 +1,205 @@+package com.music.spotui.data.offline++import java.io.IOException+import java.net.HttpURLConnection+import java.net.URL+import java.util.concurrent.Callable+import java.util.concurrent.Executors+import java.util.concurrent.FutureTask++/**+ * An MPEG-DASH manifest of FLAC in fragmented MP4 (an `audio-source` answer),+ * played live as one file: the init segment, a `sidx` index written here from the manifest's+ * segment durations and sizes (so the player can seek), then the media segments in order. Only a+ * segment being read is fetched; nothing is kept on disk.+ */+internal class DashLive(+ private val head: ByteArray,+ private val segmentUrls: List<String>,+ private val segmentSizes: LongArray,+ /** Each segment fetched: its index, its length and how long it took (the debug log). */+ private val fetched: (index: Int, bytes: Int, ms: Long) -> Unit = { _, _, _ -> },+ private val fetch: (url: String) -> ByteArray,+) {+ /** The whole virtual file's length. */+ val length: Long = head.size + segmentSizes.sum()++ private val starts = LongArray(segmentSizes.size).also { s ->+ var at = head.size.toLong()+ for (i in segmentSizes.indices) { s[i] = at; at += segmentSizes[i] }+ }+ /** Guards [cachedIndex], [cached] and [loading]; never held during a fetch. */+ private val lock = Any()+ private var cachedIndex = -1+ private var cached: ByteArray = ByteArray(0)+ /** The segments being fetched: a read of one waits for that fetch instead of starting another. */+ private val loading = HashMap<Int, FutureTask<ByteArray>>()++ /** Fetches the first segment ahead, so the song starts without waiting for it. */+ fun warm() {+ if (segmentUrls.isNotEmpty() && synchronized(lock) { cachedIndex < 0 }) segment(0)+ }++ /**+ * Segment [i]'s bytes: from memory, else fetched (outside the lock, so a read is never held+ * behind another segment's fetch, the next song's warm-up included), shared with a+ * concurrent ask for the same segment.+ */+ private fun segment(i: Int): ByteArray {+ val task = synchronized(lock) {+ if (cachedIndex == i) return cached+ loading.getOrPut(i) { FutureTask { fetchChecked(i) } }+ }+ task.run() // nothing when another thread runs or ran it: then only waits for it below+ val bytes = try {+ task.get()+ } catch (e: InterruptedException) {+ Thread.currentThread().interrupt()+ throw java.io.InterruptedIOException("segment ${i + 1} interrupted")+ } catch (e: java.util.concurrent.ExecutionException) {+ synchronized(lock) { loading.remove(i, task) }+ throw (e.cause as? IOException) ?: IOException(e.cause)+ }+ synchronized(lock) {+ loading.remove(i, task)+ cached = bytes+ cachedIndex = i+ }+ return bytes+ }++ private fun fetchChecked(i: Int): ByteArray {+ val t0 = System.nanoTime()+ val bytes = fetch(segmentUrls[i])+ fetched(i, bytes.size, (System.nanoTime() - t0) / 1_000_000)+ if (bytes.size.toLong() != segmentSizes[i]) throw IOException("segment ${i + 1} changed size")+ return bytes+ }++ /** Copies up to [length] bytes from [position] into [buffer]; -1 at the end. */+ fun read(position: Long, buffer: ByteArray, offset: Int, length: Int): Int {+ if (position >= this.length) return -1+ if (position < head.size) {+ val n = minOf(length.toLong(), head.size - position).toInt()+ System.arraycopy(head, position.toInt(), buffer, offset, n)+ return n+ }+ var i = starts.binarySearch(position).let { if (it >= 0) it else -it - 2 }+ if (i < 0) i = 0+ val seg = segment(i)+ val inSeg = (position - starts[i]).toInt()+ val n = minOf(length, seg.size - inSeg)+ System.arraycopy(seg, inSeg, buffer, offset, n)+ return n+ }++ /** What the manifest says: where the init and the segments are, and each segment's length. */+ data class Plan(val initUrl: String, val segmentUrls: List<String>, val timescale: Long, val durations: LongArray)++ companion object {+ // Segment sizes are asked all at once (same CDN host, kept-alive connections): ~4 rounds for a song.+ private const val PARALLEL = 16+ private val cache = object : LinkedHashMap<String, Pair<Long, DashLive>>(8, 0.75f, true) {+ override fun removeEldestEntry(eldest: MutableMap.MutableEntry<String, Pair<Long, DashLive>>?) = size > 4+ }+ private const val KEEP_MS = 10 * 60_000L+ private const val LOG = app.myspoti.host.android.WebPlayerHost.LOG++ /** The live file of [manifestB64] (kept a few minutes: the player opens it again on every seek). */+ fun open(manifestB64: String, headers: Map<String, String>, userAgent: String): DashLive {+ synchronized(cache) {+ cache[manifestB64]?.takeIf { System.currentTimeMillis() - it.first < KEEP_MS }?.let { return it.second }+ }+ val mpd = String(java.util.Base64.getMimeDecoder().decode(manifestB64))+ val plan = parse(mpd) ?: throw IOException("not a segmented DASH manifest")+ val get = { url: String -> httpBytes(url, headers, userAgent) }+ val pool = Executors.newFixedThreadPool(PARALLEL)+ val live = try {+ val init = pool.submit(Callable { get(plan.initUrl) })+ val sizes = plan.segmentUrls.map { u -> pool.submit(Callable { size(u, headers, userAgent) }) }+ val initBytes = init.get()+ val segmentSizes = LongArray(sizes.size) { sizes[it].get() }+ DashLive(initBytes + sidx(plan.timescale, plan.durations, segmentSizes), plan.segmentUrls, segmentSizes, fetched = { i, n, ms ->+ android.util.Log.d(LOG, "dash: segment ${i + 1}/${plan.segmentUrls.size} fetched, $n bytes in $ms ms")+ }, fetch = get)+ } catch (e: java.util.concurrent.ExecutionException) {+ throw (e.cause as? IOException) ?: IOException(e.cause)+ } finally {+ pool.shutdownNow()+ }+ synchronized(cache) { cache[manifestB64] = System.currentTimeMillis() to live }+ android.util.Log.d(LOG, "dash: opened, ${live.length} bytes in ${plan.segmentUrls.size} segments")+ return live+ }++ /** A SegmentTemplate with a SegmentTimeline (`<S d= r=/>`, r repeats), absolute addresses. */+ fun parse(mpd: String): Plan? {+ fun attr(name: String) = Regex("\\b$name=\"([^\"]+)\"").find(mpd)?.groupValues?.get(1)?.replace("&", "&")+ val init = attr("initialization") ?: return null+ val media = attr("media") ?: return null+ if (!init.startsWith("http") || !media.startsWith("http")) return null+ val timescale = attr("timescale")?.toLongOrNull() ?: 1L+ val start = attr("startNumber")?.toIntOrNull() ?: 1+ val durations = ArrayList<Long>()+ for (m in Regex("<S\\b[^>]*/?>").findAll(mpd)) {+ val d = Regex("\\bd=\"(\\d+)\"").find(m.value)?.groupValues?.get(1)?.toLongOrNull() ?: return null+ val r = Regex("\\br=\"(\\d+)\"").find(m.value)?.groupValues?.get(1)?.toIntOrNull() ?: 0+ repeat(r + 1) { durations += d }+ }+ if (durations.isEmpty()) return null+ val urls = durations.indices.map { media.replace("\$Number\$", (start + it).toString()) }+ return Plan(init, urls, timescale, durations.toLongArray())+ }++ /** An ISO-BMFF `sidx` (version 0): one reference per segment, each starting with a sync sample. */+ fun sidx(timescale: Long, durations: LongArray, sizes: LongArray): ByteArray {+ val n = sizes.size+ val out = java.nio.ByteBuffer.allocate(32 + 12 * n)+ out.putInt(32 + 12 * n).put("sidx".toByteArray()).putInt(0) // size, type, version 0 + flags+ out.putInt(1).putInt(timescale.toInt()).putInt(0).putInt(0) // reference_ID, timescale, earliest time, first offset+ out.putShort(0).putShort(n.toShort())+ for (i in 0 until n) {+ out.putInt((sizes[i] and 0x7FFFFFFF).toInt()) // reference_type 0 (media) + size+ out.putInt(durations[i].toInt())+ out.putInt(0x90000000.toInt()) // starts_with_SAP, SAP type 1+ }+ return out.array()+ }++ private fun connect(url: String, method: String, headers: Map<String, String>, userAgent: String): HttpURLConnection =+ (URL(url).openConnection() as HttpURLConnection).apply {+ requestMethod = method+ connectTimeout = 10_000+ readTimeout = 15_000+ setRequestProperty("User-Agent", userAgent)+ headers.forEach { (k, v) -> setRequestProperty(k, v) }+ }++ private fun httpBytes(url: String, headers: Map<String, String>, userAgent: String): ByteArray {+ val c = connect(url, "GET", headers, userAgent)+ try {+ if (c.responseCode !in 200..299) throw IOException("segment HTTP ${c.responseCode}")+ return c.inputStream.use { it.readBytes() }+ } finally {+ c.disconnect()+ }+ }++ /** A segment's length: HEAD, else the total of a one-byte range. */+ private fun size(url: String, headers: Map<String, String>, userAgent: String): Long {+ val h = connect(url, "HEAD", headers, userAgent)+ try {+ if (h.responseCode in 200..299 && h.contentLengthLong > 0) return h.contentLengthLong+ } finally {+ h.disconnect()+ }+ val r = connect(url, "GET", headers + ("Range" to "bytes=0-0"), userAgent)+ try {+ val total = r.getHeaderField("Content-Range")?.substringAfter('/')?.toLongOrNull()+ return total ?: throw IOException("segment size unknown (HTTP ${r.responseCode})")+ } finally {+ r.disconnect()+ }+ }+ }+}diff --git a/base/app/src/main/java/com/music/spotui/data/offline/LocalPlayPlan.kt b/base/app/src/main/java/com/music/spotui/data/offline/LocalPlayPlan.ktindex 8933c025..5417413d 100644--- a/base/app/src/main/java/com/music/spotui/data/offline/LocalPlayPlan.kt+++ b/base/app/src/main/java/com/music/spotui/data/offline/LocalPlayPlan.kt@@ -4,7 +4,7 @@ package com.music.spotui.data.offline* Whether a song picked in a list plays from the phone (the downloaded file) or from the Web Player.** Offline, or with the data saver on mobile data, the Web Player cannot stream: the list's- * downloaded songs play. Online, a downloaded song also plays from its file (the lossless one+ * downloaded songs play. Online, a downloaded song also plays from its file (the one* the user chose to keep) as long as the whole list is on the phone: the local queue holds only* downloaded songs, so a list that is only partly downloaded would lose the others, and it keeps* streaming from Spotify's own queue.diff --git a/base/app/src/main/java/com/music/spotui/data/offline/OfflineCollections.kt b/base/app/src/main/java/com/music/spotui/data/offline/OfflineCollections.ktindex 5d725757..d498966a 100644--- a/base/app/src/main/java/com/music/spotui/data/offline/OfflineCollections.kt+++ b/base/app/src/main/java/com/music/spotui/data/offline/OfflineCollections.kt@@ -77,7 +77,7 @@ object OfflineCollections {/** Download a song on its own. */fun downloadSong(song: SongsModel, quality: com.music.spotui.data.preferences.DownloadQuality? = null) {// Episodes have no track id and their own downloader (PodcastDownloader): sending one- // here would only be dropped, or worse, hit the lossless path.+ // here would only be dropped, or worse, hit the track download path.if (song.spotifyTrackId.isBlank() || episodeKeyOf(song) != null) returnsynchronized(lock) { singles += song.spotifyTrackId }save()@@ -98,11 +98,12 @@ object OfflineCollections {/** Download a list as a whole, and keep it in step from now on. */fun download(page: ContextPageModel, quality: com.music.spotui.data.preferences.DownloadQuality? = null) {- // An episode in a list is not a lossless track: it stays out of the collection, and the+ // An episode in a list is not a track: it stays out of the collection, and the// list download never enqueues it (its own menu row is the way to download an episode).val ids = page.tracks.map { it.spotifyTrackId }.filter { it.isNotBlank() && !isEpisodeKey(it) }.toSet()collections[page.uri] = OfflineCollection(page.uri, page.type, page.name, ids, System.currentTimeMillis(), quality?.name.orEmpty())save()+ keepPage(page)OfflineDownloader.enqueue(page.tracks, quality)}@@ -110,6 +111,7 @@ object OfflineCollections {fun remove(uri: String) {val c = collections.remove(uri) ?: returnsave()+ com.music.spotui.data.api.ScreenCache.dropOfflinePage(uri.substringAfterLast(':'))c.trackIds.filterNot { isKept(it) }.forEach { OfflineDownloader.remove(it) }}@@ -133,12 +135,30 @@ object OfflineCollections {val gone = c.trackIds - idscollections[page.uri] = c.copy(name = page.name, trackIds = ids, syncedAt = System.currentTimeMillis())save()+ keepPage(page)val missing = songs.filter { !OfflineStore.isDownloaded(it.spotifyTrackId) && OfflineStore.status[it.spotifyTrackId] == null }if (missing.isNotEmpty()) OfflineDownloader.enqueue(missing, com.music.spotui.data.preferences.DownloadQuality.saved(c.quality), auto = true)gone.filterNot { isKept(it) || isEpisodeKey(it) }.forEach { OfflineDownloader.remove(it) }if (missing.isNotEmpty() || gone.isNotEmpty()) Log.i(TAG, "${page.name}: +${missing.size} -${gone.size}")}+ /** The list's page as it is now, for opening it offline ([offlinePage]). */+ private fun keepPage(page: ContextPageModel) {+ if (page.complete) com.music.spotui.data.api.ScreenCache.offlinePage(page.uri.substringAfterLast(':')).write(page)+ }++ /**+ * The downloaded list at [uri] as a page, for offline: the one kept when it was downloaded or+ * last synced, else (a list downloaded before pages were kept) its downloaded songs. Blocks.+ */+ fun offlinePage(uri: String): ContextPageModel? {+ val c = collections[uri] ?: return null+ com.music.spotui.data.api.ScreenCache.offlinePage(uri.substringAfterLast(':')).read()?.let { return it }+ val songs = c.trackIds.mapNotNull { id -> OfflineStore.tracks[id]?.takeIf { OfflineStore.isDownloaded(id) }?.let(OfflineStore::toSong) }+ if (songs.isEmpty()) return null+ return ContextPageModel(uri = uri, type = c.type, name = c.name, coverUri = songs.first().coverUri, tracks = songs)+ }+/** Brings every downloaded list up to date (at start, at most every 6 hours, online only). */fun refreshAll(context: Context, force: Boolean = false) {scope.launch {diff --git a/base/app/src/main/java/com/music/spotui/data/offline/OfflineCrypto.kt b/base/app/src/main/java/com/music/spotui/data/offline/OfflineCrypto.ktindex ac44128a..8c69eb07 100644--- a/base/app/src/main/java/com/music/spotui/data/offline/OfflineCrypto.kt+++ b/base/app/src/main/java/com/music/spotui/data/offline/OfflineCrypto.kt@@ -38,6 +38,7 @@ object OfflineCrypto {const val HEADER = 4 + IV_BYTESprivate const val KEYSTORE_ALIAS = "myspoti_offline"private const val PREFS = "offline_crypto"+ private const val LOG = app.myspoti.host.android.WebPlayerHost.LOG@Volatile private var key: SecretKey? = null@@ -135,9 +136,35 @@ object OfflineCrypto {private var uri: Uri? = nullprivate var left = 0Lprivate var usingOther = false+ /** An extension's DASH answer, read as one file (see [DashLive]). */+ private var dash: DashLive? = null+ private var dashAt = 0L+ /** The song's first bytes read ahead ([StreamHead]), served before [other] goes on from their end. */+ private var head: ByteArray? = null+ private var headAt = 0override fun open(dataSpec: DataSpec): Long {uri = dataSpec.uri+ // A song an extension gives the audio of (audio-source hook): asked here, on the+ // player's loading thread, then read from where it says with its headers. An address+ // the server refuses (expired or gone: 401, 403, 404, 410) is asked for once more.+ if (dataSpec.uri.scheme == com.music.spotui.extensions.ExtensionAudio.SCHEME) {+ val length = com.music.spotui.extensions.AudioRoute.openStream(+ ask = { again -> com.music.spotui.extensions.ExtensionAudio.resolve(dataSpec.uri, again) },+ open = { stream ->+ try {+ if (stream.manifest != null) openDash(dataSpec, stream) else openUrl(dataSpec, stream)+ } catch (e: IOException) {+ // Closed before it is opened again (it keeps the source that failed).+ runCatching { other.close() }+ throw e+ }+ },+ status = { (it as? androidx.media3.datasource.HttpDataSource.InvalidResponseCodeException)?.responseCode },+ )+ usingOther = dash == null+ return length+ }val file = dataSpec.uri.takeIf { it.scheme == "file" }?.path?.let(::File)if (file == null || !isEncrypted(file)) {usingOther = true@@ -157,8 +184,62 @@ object OfflineCrypto {return left}+ /** The address an extension gave; from its start read ahead when there is one (else as usual). */+ private fun openUrl(dataSpec: DataSpec, stream: app.myspoti.extensions.AudioStream): Long {+ val spec = dataSpec.buildUpon().setUri(Uri.parse(stream.url))+ .setHttpRequestHeaders(dataSpec.httpRequestHeaders + stream.headers).build()+ val ahead = if (dataSpec.position == 0L && dataSpec.length == C.LENGTH_UNSET.toLong())+ StreamHead.take(dataSpec.uri.lastPathSegment.orEmpty(), stream.url) else null+ if (ahead != null) {+ try {+ val rest = other.open(spec.buildUpon().setPosition(ahead.bytes.size.toLong()).build())+ head = ahead.bytes+ headAt = 0+ android.util.Log.d(LOG, "stream: opened from its read-ahead start (${ahead.bytes.size} bytes), ${if (rest == C.LENGTH_UNSET.toLong()) "length unknown" else "${ahead.bytes.size + rest} bytes"}")+ return if (rest == C.LENGTH_UNSET.toLong()) rest else ahead.bytes.size + rest+ } catch (e: IOException) {+ // The rest could not be had from there: the whole file, as without a head.+ runCatching { other.close() }+ }+ }+ return other.open(spec).also { n ->+ android.util.Log.d(LOG, "stream: opened at ${dataSpec.position}, ${if (n == C.LENGTH_UNSET.toLong()) "length unknown" else "$n bytes"}")+ }+ }++ private fun openDash(dataSpec: DataSpec, stream: app.myspoti.extensions.AudioStream): Long {+ val live = DashLive.open(stream.manifest!!, stream.headers, OfflineDownloader.DownloadUa)+ if (dataSpec.position > live.length) throw IOException("position past the end")+ transferInitializing(dataSpec)+ dash = live+ dashAt = dataSpec.position+ left = if (dataSpec.length != C.LENGTH_UNSET.toLong()) dataSpec.length else live.length - dataSpec.position+ transferStarted(dataSpec)+ android.util.Log.d(LOG, "dash: read from $dashAt of ${live.length} bytes")+ return left+ }+override fun read(buffer: ByteArray, offset: Int, length: Int): Int {+ head?.let { h ->+ if (headAt < h.size) {+ if (length == 0) return 0+ val n = minOf(length, h.size - headAt)+ System.arraycopy(h, headAt, buffer, offset, n)+ headAt += n+ return n+ }+ head = null+ }if (usingOther) return other.read(buffer, offset, length)+ dash?.let { live ->+ if (length == 0) return 0+ if (left == 0L) return C.RESULT_END_OF_INPUT+ val n = live.read(dashAt, buffer, offset, minOf(length.toLong(), left).toInt())+ if (n < 0) return C.RESULT_END_OF_INPUT+ dashAt += n; left -= n+ bytesTransferred(n)+ return n+ }if (length == 0) return 0if (left == 0L) return C.RESULT_END_OF_INPUTval r = raf ?: return C.RESULT_END_OF_INPUT@@ -173,7 +254,9 @@ object OfflineCrypto {override fun getUri(): Uri? = if (usingOther) other.uri else urioverride fun close() {+ head = nullif (usingOther) { usingOther = false; other.close(); return }+ if (dash != null) { dash = null; if (uri != null) { uri = null; transferEnded() }; return }raf?.close(); raf = null; cipher = nullif (uri != null) { uri = null; transferEnded() }}diff --git a/base/app/src/main/java/com/music/spotui/data/offline/OfflineDownloader.kt b/base/app/src/main/java/com/music/spotui/data/offline/OfflineDownloader.ktindex 087504d6..7b9a0735 100644--- a/base/app/src/main/java/com/music/spotui/data/offline/OfflineDownloader.kt+++ b/base/app/src/main/java/com/music/spotui/data/offline/OfflineDownloader.kt@@ -4,11 +4,8 @@ import android.util.Logimport androidx.compose.runtime.mutableStateMapOfimport androidx.compose.runtime.snapshots.SnapshotStateMapimport com.music.spotui.data.entity.SongsModel-import com.music.spotui.data.preferences.isLosslessEnabled+import com.music.spotui.data.preferences.isDownloadsEnabledimport com.music.spotui.di.Graph-import com.music.spotui.lossless.DashFlacRemux-import com.music.spotui.lossless.LosslessSource-import com.music.spotui.video.AudioAlignimport com.music.spotui.video.InterruptibleHttpimport com.music.spotui.video.YouTubeSourceimport kotlinx.coroutines.CancellationException@@ -24,11 +21,8 @@ import kotlinx.coroutines.ensureActiveimport kotlinx.coroutines.isActiveimport kotlinx.coroutines.launchimport kotlinx.coroutines.runInterruptible-import kotlinx.coroutines.sync.Mutex-import kotlinx.coroutines.sync.withLockimport kotlinx.coroutines.withContextimport kotlinx.coroutines.sync.withPermit-import okhttp3.HttpUrl.Companion.toHttpUrlimport org.json.JSONArrayimport org.json.JSONObjectimport java.io.File@@ -39,23 +33,26 @@ import java.util.concurrent.ConcurrentHashMap/*** Downloads songs for offline listening. Spotify only gives the track (title, artist,- * duration, ISRC); the audio comes lossless, FlAC, resolved like SpotiFLAC does:+ * duration, ISRC); where the audio file is, and that it is the right recording, is the job+ * of a `download-source` extension (docs/extensions/API.md §3), which answers the files it+ * has, best first. Myspoti then:*- * 1. the same recording on a lossless service, matched by the exact ISRC, else by- * title + artist + duration within 3 s — never a live take, a remix or a cover;- * 2. the most reliable source first: SpotiFLAC's own gated backend (the signing- * session the user verified once), then the public Tidal community backends,- * then Amazon's self-resolving endpoint. 24-bit when it exists, else CD;- * 3. a check against the recording's official 30 s preview (Deezer, looked up by- * ISRC): the two audios are aligned, which confirms the right take. Without a- * preview, only an exact ISRC match is trusted.+ * 1. fetches the first file that works (a FLAC, a DASH manifest of FLAC frames joined+ * into one FLAC, or an M4A / MP3);+ * 2. checks what any file must pass, whoever sent it: real, decodable audio whose length+ * is the song's (Spotify's duration), so a preview or another cut is refused;+ * 3. keeps it encrypted ([OfflineCrypto]), with its cover, in the Downloaded list.*- * Nothing that fails the check is kept: the song is marked unavailable instead.+ * No extension giving download files: downloads say to install one. Nothing that fails the+ * check is kept: the song is marked unavailable instead.*/object OfflineDownloader {private const val TAG = "Offline"private const val WORKERS = 3- private const val MIN_SCORE = 0.5+ /** A file may be this much shorter than the song (seconds): more is a preview or a cut. */+ private const val SHORTER_MAX = 5+ /** And this much longer (trailing silence, a longer intro): more is another version. */+ private const val LONGER_MAX = 15data class Request(val trackId: String,@@ -89,21 +86,6 @@ object OfflineDownloader {/** Two AAC encodes at once at most: the CPU stays free for the rest of the app. */private val encodeSlots = kotlinx.coroutines.sync.Semaphore(2)- @Volatile private var hinted = false-- /**- * Without the SpotiFLAC verification only the public servers are tried, and they are- * often down or throttled: say once per run where the reliable source is, instead of- * leaving a list of "no matching recording".- */- private fun hintVerification() {- if (hinted || com.music.spotui.data.preferences.hasSpotiflacSession(Graph.app)) return- hinted = true- scope.launch(Dispatchers.Main) {- android.widget.Toast.makeText(Graph.app, app.myspoti.engine.R.string.downloads_verify_hint, android.widget.Toast.LENGTH_LONG).show()- }- }-private val scope = CoroutineScope(SupervisorJob() + Dispatchers.IO)/** Songs queued, downloading, or whose download did not succeed (for the Downloaded list). */val requests: SnapshotStateMap<String, Request> = mutableStateMapOf()@@ -111,8 +93,6 @@ object OfflineDownloader {/** Requests not finished yet, in order (persisted: a restart resumes them). */private val pending = LinkedHashMap<String, Request>()private val running = ConcurrentHashMap<String, Job>()- // One decode + alignment at a time: they are the CPU- and memory-heavy part.- private val checkLock = Mutex()@Volatile private var started = falseprivate fun start() {@@ -140,37 +120,34 @@ object OfflineDownloader {fun enqueue(songs: List<SongsModel>,quality: com.music.spotui.data.preferences.DownloadQuality? = null,- verifiedOrSkipped: Boolean = false,/** Started by the app (a downloaded list keeping in step), not by a tap. */auto: Boolean = false,) {// Downloads switched off in Settings: say so, instead of a list of failed songs.- if (!isLosslessEnabled(Graph.app)) {+ if (!isDownloadsEnabled(Graph.app)) {scope.launch(Dispatchers.Main) {android.widget.Toast.makeText(Graph.app, app.myspoti.engine.R.string.downloads_off_toast, android.widget.Toast.LENGTH_LONG).show()}return}- val verified = com.music.spotui.data.preferences.hasSpotiflacSession(Graph.app)+ // No extension gives download files: say where to get one, instead of a list of failures.+ if (!com.music.spotui.extensions.Extensions.hasDownloadSource()) {+ if (!auto) scope.launch(Dispatchers.Main) {+ android.widget.Toast.makeText(Graph.app, app.myspoti.engine.R.string.downloads_need_source, android.widget.Toast.LENGTH_LONG).show()+ }+ return+ }if (auto) {- // Automatic downloads wait for Wi-Fi (never the user's mobile data), and for a- // verified server: nothing opens by itself, the next sync takes them.+ // Automatic downloads wait for Wi-Fi (never the user's mobile data): the next sync takes them.if (com.music.spotui.data.DataSaver.metered || !OfflineStore.isOnline(Graph.app)) { OfflineCollections.waitForWifi(); return }- if (!verified) return- } else if (verifiedOrSkipped || verified) {+ } else if (com.music.spotui.data.DataSaver.metered) {// Asked for by the user on mobile data: it goes ahead, but they are told.- if (com.music.spotui.data.DataSaver.metered) scope.launch(Dispatchers.Main) {+ scope.launch(Dispatchers.Main) {android.widget.Toast.makeText(Graph.app, app.myspoti.engine.R.string.download_on_mobile_data, android.widget.Toast.LENGTH_LONG).show()}}- // No SpotiFLAC server verified (never done, or lapsed): the verification opens first,- // and these songs download once it is done or skipped (SpotiflacGate.resume).- if (!auto && !verifiedOrSkipped && !verified) {- SpotiflacGate.hold(songs, quality)- return- }val q = quality?.let { com.music.spotui.data.preferences.DownloadQuality.saved(it.name) }?.name.orEmpty()- // Episodes go to PodcastDownloader: their id is no track id, so the lossless lookup+ // Episodes go to PodcastDownloader: their id is no track id, so the download-source lookup// would 404 (or worse, match an unrelated recording by title).enqueueAll(songs.filter { it.spotifyTrackId.isNotBlank() && !isEpisodeKey(it.spotifyTrackId) }.map { Request.of(it).copy(quality = q) })}@@ -178,7 +155,7 @@ object OfflineDownloader {private fun enqueueAll(list: List<Request>) {val added = synchronized(pending) {list.filter { r ->- // Last guard before the lossless path, whatever the caller (resume, retry, list).+ // Last guard before the track download path, whatever the caller (resume, retry, list).!isEpisodeKey(r.trackId) &&!OfflineStore.isDownloaded(r.trackId) && pending.putIfAbsent(r.trackId, r) == null}.also { if (it.isNotEmpty()) savePending() }@@ -271,7 +248,6 @@ object OfflineDownloader {throw e} catch (e: Unavailable) {Log.i(TAG, "${r.title}: ${e.message}")- hintVerification()OfflineStatus.Unavailable} catch (t: Throwable) {Log.w(TAG, "${r.title} failed", t)@@ -286,60 +262,30 @@ object OfflineDownloader {}private suspend fun download(r: Request): OfflineTrack {- if (!isLosslessEnabled(Graph.app)) throw Unavailable("lossless downloads are off")+ if (!isDownloadsEnabled(Graph.app)) throw Unavailable("downloads are off")val quality = qualityOf(r)val tmp = OfflineStore.tmpDir- val audioTmp = File(tmp, "${r.trackId}.flacpart")- val previewTmp = File(tmp, "${r.trackId}.preview")+ val audioTmp = File(tmp, "${r.trackId}.part")try {val meta = spotifyMeta(r)+ Log.i(TAG, "${meta.title}: isrc=${meta.isrc ?: "-"}")- // The official 30 s preview of the recording, for the alignment check.- val previewLink = previewUrl(meta)- val preview = previewLink?.let { url ->- runCatching { httpGet(url, previewTmp); previewTmp }- .onFailure { Log.w(TAG, "${meta.title}: preview download failed: $it") }.getOrNull()- }- val previewFeatures = preview?.let { f ->- checkLock.withLock {- runCatching { runInterruptible(Dispatchers.Default) { AudioAlign.features(AudioAlign.decode(f)) } }- .onFailure { Log.w(TAG, "${meta.title}: preview decode failed: $it") }.getOrNull()- }- }- Log.i(TAG, "${meta.title}: isrc=${meta.isrc ?: "-"} preview=${if (previewFeatures != null) "ok" else if (previewLink != null) "unusable" else "none"}")-- // ── Lossless resolve: gated SpotiFLAC first, then the community backends.- val file = resolveAndFetch(r, meta, audioTmp, quality == com.music.spotui.data.preferences.DownloadQuality.HI_RES,- small = quality == com.music.spotui.data.preferences.DownloadQuality.SMALL)- ?: throw Unavailable("no lossless match")+ // ── The files the download-source extensions give, tried in their order; each one+ // is checked (real audio, the song's length) before it is taken.+ val file = resolveAndFetch(r, meta, audioTmp, quality)currentCoroutineContext().ensureActive()- // ── Verification before the file is kept.- if (previewFeatures != null) {- val score = checkLock.withLock {- val full = runInterruptible(Dispatchers.Default) { AudioAlign.features(AudioAlign.decode(audioTmp)) }- val map = AudioAlign.align(previewFeatures, full)- if (map.segments.isEmpty()) 0.0 else map.score- }- Log.i(TAG, "${meta.title}: ${file.provider} score ${"%.2f".format(score)}")- if (score < MIN_SCORE) throw Unavailable("the lossless file did not match the recording's preview")- file.verified = true- } else if (!file.isrcMatched) {- // No preview to compare with: only an exact ISRC match is trusted.- throw Unavailable("no preview and no ISRC match")- }-val out: File- if (file.aac) {- // Tidal's own AAC: already small, kept as it was served.- out = File(OfflineStore.audioDir, "${r.trackId}.m4a")+ if (file.lossy != null) {+ // A small file as the source served it (M4A, MP3): kept as it is.+ out = File(OfflineStore.audioDir, "${r.trackId}.${file.lossy}")if (!audioTmp.renameTo(out)) throw IOException("could not move the file")} else if (quality == com.music.spotui.data.preferences.DownloadQuality.SMALL) {// "Smallest": the checked FLAC becomes AAC, encoded on the phone.out = File(OfflineStore.audioDir, "${r.trackId}.m4a")val aacTmp = File(OfflineStore.tmpDir, "${r.trackId}.m4apart")try {- // Not under checkLock: encoding is long, the other downloads must not queue behind it.+ // Encoding is long: a few at a time, the other downloads go on meanwhile.encodeSlots.withPermit { runInterruptible(Dispatchers.Default) { AacTranscoder.transcode(audioTmp, aacTmp) } }if (aacTmp.length() < 10_000 || !aacTmp.renameTo(out)) throw IOException("could not encode the small file")} finally {@@ -356,23 +302,28 @@ object OfflineDownloader {runInterruptible(Dispatchers.IO) { OfflineCrypto.encryptInPlace(Graph.app, out) }val cover = runCatching {val c = File(OfflineStore.coverDir, "${r.trackId}.jpg")- httpGet(meta.coverUrl, c); c.name+ httpGet(app.myspoti.host.android.Covers.large(meta.coverUrl), c); c.name}.getOrDefault("")OfflineTrack(trackId = r.trackId, title = meta.title, artist = meta.artist, album = meta.album,albumId = meta.albumId, durationMs = meta.durationMs, coverUrl = meta.coverUrl,- file = out.name, cover = cover, source = file.provider, verified = file.verified,- bytes = out.length(), addedAt = System.currentTimeMillis(),+ file = out.name, cover = cover, source = file.provider, verified = file.isrcMatched,+ bytes = out.length(), addedAt = System.currentTimeMillis(), providerId = file.extensionId,)}} finally {- audioTmp.delete(); previewTmp.delete()+ audioTmp.delete()}}- private class Fetched(val provider: String, val isrcMatched: Boolean, val aac: Boolean = false) {- var verified = false- }+ private class Fetched(+ val provider: String,+ val isrcMatched: Boolean,+ /** The id of the download-source extension that supplied it. */+ val extensionId: String,+ /** The extension of a lossy file kept as served (m4a, mp3); null for a FLAC. */+ val lossy: String? = null,+ )/** This download's quality: the one chosen when it started, else Settings (CD when Settings says "ask"). */private fun qualityOf(r: Request): com.music.spotui.data.preferences.DownloadQuality =@@ -380,51 +331,90 @@ object OfflineDownloader {?: com.music.spotui.data.preferences.DownloadQuality.saved(com.music.spotui.data.preferences.getDownloadQuality(Graph.app).name)?: com.music.spotui.data.preferences.DownloadQuality.CD- /** Runs the resolver and saves the audio into [out]; null when nothing matched. */- private suspend fun resolveAndFetch(r: Request, meta: Meta, out: File, hiRes: Boolean, small: Boolean = false): Fetched? {- val resolved = LosslessSource.resolve(- Graph.app, r.trackId,- LosslessSource.TrackInfo(meta.title, meta.artist, (meta.durationMs / 1000).toInt(), meta.isrc.orEmpty()),- preferHiRes = hiRes,- small = small,- )- if (resolved !is LosslessSource.Success) return null- val track = resolved.track- setStatus(r.trackId, OfflineStatus.Downloading(-1f))- val ok = when {- track.dashBase64.isNotBlank() ->- runInterruptible(Dispatchers.IO) {- DashFlacRemux.download("data:application/dash+xml;base64,${track.dashBase64}", out)- }- else -> fetchWithProgress(r.trackId, track.url, out)- }- if (!ok || out.length() < 10_000) return null- if (track.aac) {- Log.i(TAG, "${meta.title}: saved ${track.provider}")- return Fetched(track.provider, resolved.isrcMatched, aac = true)+ /** The quality as a download-source extension is asked for it. */+ internal fun queryQuality(q: com.music.spotui.data.preferences.DownloadQuality): String = when (q) {+ com.music.spotui.data.preferences.DownloadQuality.HI_RES -> "hi-res"+ com.music.spotui.data.preferences.DownloadQuality.SMALL -> "small"+ else -> "cd"+ }++ /**+ * Asks the download-source extensions for [meta]'s files and saves the first one that works+ * into [out]. Unavailable when no extension has a file, or none of them could be used.+ */+ private suspend fun resolveAndFetch(r: Request, meta: Meta, out: File, quality: com.music.spotui.data.preferences.DownloadQuality): Fetched {+ val track = com.music.spotui.extensions.Extensions.trackInfo(r.trackId, meta.title, meta.artist, meta.album, meta.durationMs, meta.coverUrl)+ .copy(isrc = meta.isrc)+ val (extensionId, extension, files) = com.music.spotui.extensions.Extensions.downloadFiles(track, queryQuality(quality))+ ?: throw Unavailable("no download source has this song")+ for (file in files) {+ currentCoroutineContext().ensureActive()+ setStatus(r.trackId, OfflineStatus.Downloading(-1f))+ val label = listOfNotNull(file.provider ?: extension, file.bitDepth?.takeIf { file.lossless }?.let { "$it-bit" }).joinToString(" ")+ val ok = try {+ when {+ file.format == "dash-flac" -> runInterruptible(Dispatchers.IO) {+ DashFlacRemux.download("data:application/dash+xml;base64,${file.manifest}", out, file.headers)+ }+ else -> fetchWithProgress(r.trackId, file.url!!, out, file.headers)+ } && out.length() >= 10_000+ } catch (e: CancellationException) {+ throw e+ } catch (e: Exception) {+ Log.w(TAG, "${meta.title}: $label ${file.format}: ${e.message}")+ false+ }+ if (!ok) continue+ val refused = runCatching {+ if (file.lossless) checkFlacHeader(out, meta, file.bitDepth) else checkAudio(out, meta)+ }.exceptionOrNull()+ if (refused != null) { Log.i(TAG, "${meta.title}: $label: ${refused.message}"); continue }+ if (!file.lossless) {+ Log.i(TAG, "${meta.title}: saved $label ${file.format}")+ return Fetched(label, file.isrcMatched, extensionId, lossy = file.format)+ }+ Log.i(TAG, "${meta.title}: saved FLAC from $label")+ return Fetched(label, file.isrcMatched, extensionId)}- checkFlacHeader(out, meta, track)- Log.i(TAG, "${meta.title}: saved lossless FLAC from ${track.provider} (${track.quality}-bit)")- return Fetched("${track.provider} ${track.quality}-bit", resolved.isrcMatched)+ throw Unavailable("none of the ${files.size} files from $extension could be used")}/**- * A STREAMINFO read on the saved file: anything that is not a FLAC file (an- * encrypted or AAC stream some backends hand out) is refused, previews trimmed by- * the backend are caught (the header states the real length), and a misplaced- * 24-bit label shows up in the log.+ * A STREAMINFO read on the saved file: anything that is not a FLAC file (an encrypted or+ * AAC stream) is refused, a preview or another cut is caught (the header states the real+ * length), and a misplaced 24-bit label shows up in the log.*/- private fun checkFlacHeader(file: File, meta: Meta, track: com.music.spotui.lossless.LosslessSource.LosslessFile) {+ private fun checkFlacHeader(file: File, meta: Meta, bitDepth: Int?) {val seconds = runCatching {file.inputStream().use { s ->val head = ByteArray(42); var off = 0while (off < head.size) { val n = s.read(head, off, head.size - off); if (n < 0) break; off += n }- LosslessSource.flacDurationSec(head)+ flacDurationSec(head)}- }.getOrNull() ?: throw Unavailable("the lossless source did not send a FLAC file")- val expected = meta.durationMs / 1000- if (expected > 0 && seconds < expected - 5) throw Unavailable("backed out: the file is a ${seconds}s preview")- Log.d(TAG, "${meta.title}: FLAC ${seconds}s header check, labelled ${track.quality}-bit")+ }.getOrNull() ?: throw Unavailable("the source did not send a FLAC file")+ checkLength(seconds.toLong(), meta)+ Log.d(TAG, "${meta.title}: FLAC ${seconds}s header check, labelled ${bitDepth ?: "-"}-bit")+ }++ /** An M4A / MP3 as served: the phone's own extractor must find an audio track of the song's length. */+ private fun checkAudio(file: File, meta: Meta) {+ val extractor = android.media.MediaExtractor()+ val seconds = try {+ extractor.setDataSource(file.path)+ val format = (0 until extractor.trackCount).map { extractor.getTrackFormat(it) }+ .firstOrNull { it.getString(android.media.MediaFormat.KEY_MIME)?.startsWith("audio/") == true }+ ?: throw Unavailable("the source did not send an audio file")+ if (format.containsKey(android.media.MediaFormat.KEY_DURATION)) format.getLong(android.media.MediaFormat.KEY_DURATION) / 1_000_000 else -1L+ } catch (e: IOException) {+ throw Unavailable("the file could not be read: ${e.message}")+ } finally {+ extractor.release()+ }+ if (seconds > 0) checkLength(seconds, meta)+ }++ private fun checkLength(seconds: Long, meta: Meta) {+ lengthMismatch(seconds, meta.durationMs)?.let { throw Unavailable("backed out: $it") }}private data class Meta(@@ -450,30 +440,6 @@ object OfflineDownloader {).also { if (it.title.isBlank() || it.artist.isBlank()) throw Unavailable("no track metadata") }}- /** The official 30 s preview of the recording: by ISRC, else by artist + title + duration. */- private suspend fun previewUrl(m: Meta): String? = runInterruptible {- runCatching {- if (m.isrc != null) {- val o = JSONObject(httpText("https://api.deezer.com/track/isrc:${m.isrc}"))- o.optString("preview").takeIf { !o.has("error") && it.startsWith("http") }?.let { return@runCatching it }- }- val main = m.artist.substringBefore(",").trim()- val url = "https://api.deezer.com/search".toHttpUrl().newBuilder().addQueryParameter("q", "$main ${m.title}").build().toString()- val data = JSONObject(httpText(url)).optJSONArray("data") ?: JSONArray()- pickPreview((0 until data.length()).mapNotNull { i ->- data.optJSONObject(i)?.let {- PreviewHit(it.optString("preview"), it.optString("title"), it.optJSONObject("artist")?.optString("name").orEmpty(), it.optLong("duration", -1))- }- }, m.title, main, m.durationMs)- }.getOrNull()- }-- private fun httpText(url: String): String =- InterruptibleHttp.read(YouTubeSource.http.newCall(okhttp3.Request.Builder().url(url).build())) {- if (!it.isSuccessful) throw IOException("HTTP ${it.code}")- it.body?.string().orEmpty()- }-private suspend fun httpGet(url: String, out: File) = runInterruptible {InterruptibleHttp.read(YouTubeSource.http.newCall(okhttp3.Request.Builder().url(url).build())) { res ->if (!res.isSuccessful) throw IOException("HTTP ${res.code}")@@ -483,13 +449,13 @@ object OfflineDownloader {}/**- * Downloads the FLAC URL into [out] with HTTP **Range** requests in chunks,- * reporting progress. The FLAC backends hand out signed CDN urls: a plain- * streaming GET with a browser User-Agent, retried per chunk on resets.+ * Downloads the file URL into [out] with HTTP **Range** requests in chunks,+ * reporting progress: a plain streaming GET with a browser User-Agent and the+ * extension's headers, retried per chunk on resets.*/- private suspend fun fetchWithProgress(trackId: String, url: String, out: File): Boolean {- // A quick HEAD for the size: the progress bar needs it, the CDN allows it.- val total = runInterruptible(Dispatchers.IO) { contentLength(url) }+ private suspend fun fetchWithProgress(trackId: String, url: String, out: File, headers: Map<String, String> = emptyMap()): Boolean {+ // A quick HEAD for the size: the progress bar needs it (-1 when the server says nothing).+ val total = runInterruptible(Dispatchers.IO) { contentLength(url, headers) }val watcher = if (total > 0) scope.launch {while (isActive) {setStatus(trackId, OfflineStatus.Downloading((out.length().toFloat() / total).coerceIn(0f, 1f)))@@ -497,7 +463,7 @@ object OfflineDownloader {}} else nulltry {- return runInterruptible(Dispatchers.IO) { rangedDownload(url, out, total) }+ return runInterruptible(Dispatchers.IO) { rangedDownload(url, out, total, headers) }} finally {watcher?.cancel()setStatus(trackId, OfflineStatus.Downloading(-1f))@@ -509,7 +475,7 @@ object OfflineDownloader {* same way (follows the 302s to podtrac/radiofrance/simplecast, restarts from zero when a* server ignores Range, retries each chunk three times).*/- internal fun rangedDownload(url: String, out: File, knownTotal: Long): Boolean {+ internal fun rangedDownload(url: String, out: File, knownTotal: Long, headers: Map<String, String> = emptyMap()): Boolean {val chunk = 4L * 1024 * 1024 // 4 MB: the stream gets its turn between two chunksvar total = knownTotaljava.io.RandomAccessFile(out, "rw").use { output ->@@ -527,7 +493,8 @@ object OfflineDownloader {connectTimeout = 20_000readTimeout = 60_000instanceFollowRedirects = true- setRequestProperty("User-Agent", LosslessUa)+ setRequestProperty("User-Agent", DownloadUa)+ headers.forEach { (k, v) -> setRequestProperty(k, v) }setRequestProperty("Range", "bytes=$position-$end")}try {@@ -584,14 +551,15 @@ object OfflineDownloader {com.music.spotui.di.SongPlayer.activeDevice.value == null && !com.music.spotui.di.LocalPlayer.active.value}.getOrDefault(false)- private fun contentLength(url: String): Long =+ private fun contentLength(url: String, headers: Map<String, String> = emptyMap()): Long =runCatching {val conn = (URL(url).openConnection() as HttpURLConnection).apply {requestMethod = "HEAD"connectTimeout = 15_000readTimeout = 15_000instanceFollowRedirects = true- setRequestProperty("User-Agent", LosslessUa)+ setRequestProperty("User-Agent", DownloadUa)+ headers.forEach { (k, v) -> setRequestProperty(k, v) }}try {conn.contentLengthLong.takeIf { it > 0 } ?: -1L@@ -602,11 +570,34 @@ object OfflineDownloader {// ── Pure helpers (unit-tested) ──- /** The lossless backends expect a browser-ish User-Agent on downloads. */- internal const val LosslessUa =+ /** File hosts expect a browser-ish User-Agent on downloads. */+ internal const val DownloadUa ="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 " +"(KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"+ /** Length from a FLAC STREAMINFO header, or null if [head] is not one. */+ internal fun flacDurationSec(head: ByteArray): Int? {+ if (head.size < 26 || String(head, 0, 4, Charsets.US_ASCII) != "fLaC") return null+ // Bytes 18..25: sample rate (20 bits), channels (3), bits/sample (5), total samples (36).+ var bits = 0L+ for (i in 18..25) bits = (bits shl 8) or (head[i].toLong() and 0xFF)+ val sampleRate = (bits ushr 44).toInt()+ val totalSamples = bits and 0xFFFFFFFFFL+ if (sampleRate <= 0 || totalSamples <= 0) return null+ return (totalSamples / sampleRate).toInt()+ }++ /** Why a file of [seconds] is not the song of [durationMs], or null when it is (or the song's length is unknown). */+ internal fun lengthMismatch(seconds: Long, durationMs: Long): String? {+ val expected = durationMs / 1000+ return when {+ expected <= 0 -> null+ seconds < expected - SHORTER_MAX -> "the file is ${seconds}s, the song ${expected}s (a preview)"+ seconds > expected + LONGER_MAX -> "the file is ${seconds}s, the song ${expected}s (another version)"+ else -> null+ }+ }+/** "bytes 0-99/1234" → 1234; null when absent or "*". */fun contentRangeTotal(header: String?): Long? =header?.substringAfterLast('/', "")?.trim()?.toLongOrNull()?.takeIf { it > 0 }@@ -614,28 +605,4 @@ object OfflineDownloader {/** "US-UM7-17-03861" / "usum71703861" → "USUM71703861"; null when not an ISRC. */fun normalizeIsrc(raw: String): String? =raw.uppercase().filter { it.isLetterOrDigit() }.takeIf { Regex("[A-Z]{2}[A-Z0-9]{3}\\d{7}").matches(it) }-- data class PreviewHit(val url: String, val title: String, val artist: String, val durationSec: Long)-- private fun folded(s: String) = java.text.Normalizer.normalize(s, java.text.Normalizer.Form.NFD)- .replace(Regex("""\p{M}+"""), "").lowercase()-- /** Title without "(feat. …)", "[Remastered]", " - Radio Edit"…, letters and digits only. */- internal fun titleKey(s: String) = folded(s)- .replace(Regex("""\(.*?\)|\[.*?]"""), " ")- .replace(Regex("""\s+-\s+.*$"""), " ")- .replace(Regex("""\b(?:feat|ft)\.?\s.*$"""), " ")- .filter { it.isLetterOrDigit() }-- /** The search result that is the same song: title, main artist, and duration within 3 s. */- fun pickPreview(results: List<PreviewHit>, title: String, artist: String, durationMs: Long): String? {- if (durationMs <= 0) return null- val t = titleKey(title)- val a = folded(artist).filter { it.isLetterOrDigit() }- return results.firstOrNull { h ->- h.url.startsWith("http") && h.durationSec > 0 &&- kotlin.math.abs(h.durationSec * 1000 - durationMs) <= 3000 &&- titleKey(h.title) == t && folded(h.artist).filter { it.isLetterOrDigit() } == a- }?.url- }}diff --git a/base/app/src/main/java/com/music/spotui/data/offline/OfflineStore.kt b/base/app/src/main/java/com/music/spotui/data/offline/OfflineStore.ktindex a2a2f1c1..649f8aa0 100644--- a/base/app/src/main/java/com/music/spotui/data/offline/OfflineStore.kt+++ b/base/app/src/main/java/com/music/spotui/data/offline/OfflineStore.kt@@ -23,9 +23,9 @@ data class OfflineTrack(val file: String,/** Cover file name in the covers folder, empty when it could not be fetched. */val cover: String,- /** Where the audio came from (YouTube watch URL, or the podcast publisher). */+ /** Where the audio came from (the download-source extension's provider, or "podcast"). */val source: String,- /** The audio was checked against the recording's official preview. */+ /** The extension found the file by the song's ISRC (older downloads: checked against a preview). */val verified: Boolean,val bytes: Long,val addedAt: Long,@@ -34,6 +34,11 @@ data class OfflineTrack(* older index stays valid (and its files are not swept as strays).*/val kind: String = KIND_MUSIC,+ /**+ * The id of the download-source extension that supplied the file. Null when unknown: a+ * podcast episode, or a download made before this field existed.+ */+ val providerId: String? = null,) {val isEpisode: Boolean get() = kind == KIND_PODCAST@@ -42,6 +47,7 @@ data class OfflineTrack(.put("albumId", albumId).put("duration", durationMs).put("coverUrl", coverUrl).put("file", file).put("cover", cover).put("source", source).put("verified", verified).put("bytes", bytes).put("added", addedAt).put("kind", kind)+ .apply { providerId?.let { put("providerId", it) } }companion object {const val KIND_MUSIC = "MUSIC"@@ -55,6 +61,8 @@ data class OfflineTrack(addedAt = o.optLong("added"),// Absent in an index written before podcasts: those entries are all music.kind = o.optString("kind").ifBlank { KIND_MUSIC },+ // Absent in an index written before it was kept: unknown.+ providerId = o.optString("providerId").ifBlank { null },)}}@@ -193,7 +201,7 @@ object OfflineStore {artist = t.artist,album = t.album,durationMs = t.durationMs,- artUri = coverFile(t)?.let { Uri.fromFile(it) } ?: Uri.parse(t.coverUrl),+ artUri = coverFile(t)?.let { Uri.fromFile(it) } ?: Uri.parse(app.myspoti.host.android.Covers.large(t.coverUrl)),)fun toSong(t: OfflineTrack) = SongsModel(diff --git a/base/app/src/main/java/com/music/spotui/data/offline/PodcastDownloader.kt b/base/app/src/main/java/com/music/spotui/data/offline/PodcastDownloader.ktindex abdafa04..adeaf216 100644--- a/base/app/src/main/java/com/music/spotui/data/offline/PodcastDownloader.kt+++ b/base/app/src/main/java/com/music/spotui/data/offline/PodcastDownloader.kt@@ -4,7 +4,7 @@ import android.util.Logimport androidx.compose.runtime.mutableStateMapOfimport androidx.compose.runtime.snapshots.SnapshotStateMapimport com.music.spotui.data.entity.SongsModel-import com.music.spotui.data.preferences.isLosslessEnabled+import com.music.spotui.data.preferences.isDownloadsEnabledimport com.music.spotui.di.Graphimport kotlinx.coroutines.CancellationExceptionimport kotlinx.coroutines.CoroutineScope@@ -38,7 +38,7 @@ internal fun episodeKeyOf(song: SongsModel) = song.url.takeIf { isEpisodeKey(it)/*** Downloads podcast episodes for offline listening — a separate path from- * [OfflineDownloader], which is the lossless/SpotiFLAC one.+ * [OfflineDownloader], which is the songs' one (download-source extensions).** Spotify never hands out an episode's audio in GraphQL: the Web Player asks* `soundfinder/v1/unauth/episode/<id>/com.widevine.alpha`, which returns either the@@ -119,7 +119,7 @@ object PodcastDownloader {if (episodeKeyOf(song) == null) returnval req = Request.of(song)// "Downloads" off in Settings means no downloads at all, podcasts included.- if (!isLosslessEnabled(Graph.app)) {+ if (!isDownloadsEnabled(Graph.app)) {toast(app.myspoti.engine.R.string.downloads_off_toast)return}@@ -295,7 +295,7 @@ object PodcastDownloader {connectTimeout = 20_000readTimeout = 20_000instanceFollowRedirects = true- setRequestProperty("User-Agent", OfflineDownloader.LosslessUa)+ setRequestProperty("User-Agent", OfflineDownloader.DownloadUa)setRequestProperty("Accept", "*/*")}try {@@ -312,7 +312,7 @@ object PodcastDownloader {connectTimeout = 15_000readTimeout = 30_000instanceFollowRedirects = true- setRequestProperty("User-Agent", OfflineDownloader.LosslessUa)+ setRequestProperty("User-Agent", OfflineDownloader.DownloadUa)}try {if (conn.responseCode !in 200..299) returndiff --git a/base/app/src/main/java/com/music/spotui/data/offline/SpotiflacGate.kt b/base/app/src/main/java/com/music/spotui/data/offline/SpotiflacGate.ktdeleted file mode 100644index 98a3840b..00000000--- a/base/app/src/main/java/com/music/spotui/data/offline/SpotiflacGate.kt+++ /dev/null@@ -1,32 +0,0 @@-package com.music.spotui.data.offline--import com.music.spotui.data.entity.SongsModel-import com.music.spotui.data.preferences.DownloadQuality-import kotlinx.coroutines.channels.BufferOverflow-import kotlinx.coroutines.flow.MutableSharedFlow-import kotlinx.coroutines.flow.SharedFlow--/**- * Downloads asked for while no SpotiFLAC server is verified: they wait here, the app opens- * the verification ([open]), and they start when the user leaves it, verified or not.- */-object SpotiflacGate {- private val _open = MutableSharedFlow<Unit>(extraBufferCapacity = 1, onBufferOverflow = BufferOverflow.DROP_OLDEST)- /** The navigation opens the verification page on each emission. */- val open: SharedFlow<Unit> = _open-- @Volatile private var pending: Pair<List<SongsModel>, DownloadQuality?>? = null-- fun hold(songs: List<SongsModel>, quality: DownloadQuality?) {- val before = pending?.first.orEmpty()- pending = (before + songs).distinctBy { it.spotifyTrackId } to (quality ?: pending?.second)- _open.tryEmit(Unit)- }-- /** The verification page closed: what waited is downloaded now. */- fun resume() {- val (songs, quality) = pending ?: return- pending = null- OfflineDownloader.enqueue(songs, quality, verifiedOrSkipped = true)- }-}diff --git a/base/app/src/main/java/com/music/spotui/data/offline/StreamHead.kt b/base/app/src/main/java/com/music/spotui/data/offline/StreamHead.ktnew file mode 100644index 00000000..2705b639--- /dev/null+++ b/base/app/src/main/java/com/music/spotui/data/offline/StreamHead.kt@@ -0,0 +1,71 @@+package com.music.spotui.data.offline++import java.net.HttpURLConnection+import java.net.URL++/**+ * The first bytes of the next song an extension streams (an `audio-source` answer with a url),+ * read ahead while the one before plays: the player starts on them at once and asks the rest of+ * the file from where they end (an HTTP range). One song at a time, in memory, dropped once served+ * or stale. Anything unusual (no range support, a short file, an error) leaves no head, and the+ * song opens as before.+ */+internal object StreamHead {+ /** How much is read ahead. */+ const val BYTES = 512 * 1024++ class Head(val key: String, val url: String, val bytes: ByteArray, val total: Long, val until: Long)++ private var slot: Head? = null++ @Synchronized fun put(head: Head) { slot = head }++ /**+ * The head of the song [key] read from [url], given once; null when there is none, it is of+ * another address, or it went stale ([Head.until]).+ */+ @Synchronized fun take(key: String, url: String, now: Long = System.currentTimeMillis()): Head? {+ val h = slot ?: return null+ if (h.key != key) {+ if (now >= h.until) slot = null+ return null+ }+ slot = null+ return h.takeIf { it.url == url && now < it.until }+ }++ /** The total of a `Content-Range: bytes 0-524287/9876543`, or null. */+ fun total(contentRange: String?): Long? =+ contentRange?.takeIf { it.trim().startsWith("bytes 0-") }?.substringAfter('/')?.trim()?.toLongOrNull()++ /**+ * Reads the first [BYTES] of [url] (with the extension's [headers]) and keeps them for the+ * song [key] until [until]. Stops early, keeping nothing, once [active] says the song changed.+ */+ fun fetch(key: String, url: String, headers: Map<String, String>, until: Long, active: () -> Boolean) {+ val c = (URL(url).openConnection() as HttpURLConnection).apply {+ connectTimeout = 10_000+ readTimeout = 15_000+ headers.forEach { (k, v) -> setRequestProperty(k, v) }+ setRequestProperty("Range", "bytes=0-${BYTES - 1}")+ }+ try {+ if (c.responseCode != 206) return+ val total = total(c.getHeaderField("Content-Range")) ?: return+ if (total <= BYTES) return+ val buf = ByteArray(BYTES)+ var at = 0+ c.inputStream.use { s ->+ while (at < BYTES) {+ if (!active()) return+ val n = s.read(buf, at, BYTES - at)+ if (n < 0) break+ at += n+ }+ }+ if (at == BYTES && active()) put(Head(key, url, buf, total, until))+ } finally {+ c.disconnect()+ }+ }+}diff --git a/base/app/src/main/java/com/music/spotui/data/preferences/LosslessPref.kt b/base/app/src/main/java/com/music/spotui/data/preferences/DownloadPref.ktsimilarity index 66%rename from base/app/src/main/java/com/music/spotui/data/preferences/LosslessPref.ktrename to base/app/src/main/java/com/music/spotui/data/preferences/DownloadPref.ktindex 13957614..b667b21d 100644--- a/base/app/src/main/java/com/music/spotui/data/preferences/LosslessPref.kt+++ b/base/app/src/main/java/com/music/spotui/data/preferences/DownloadPref.kt@@ -1,11 +1,12 @@package com.music.spotui.data.preferences/*- * Lossless (SpotiFLAC) download preferences: availability and quality.+ * Download preferences: availability and quality.*/import android.content.Context+// The stored file keeps its first name: renaming it would reset everyone's settings.private const val PREF = "LosslessPref"private const val KEY_HI_RES = "hires_24bit"private const val KEY_ENABLED = "enabled"@@ -13,17 +14,17 @@ private const val KEY_SMALL = "small_aac"private const val KEY_ASK = "ask_each_time"/**- * Hi-res downloads (24-bit when the provider has it: bigger files, ~3× a CD-quality FLAC).- * Default off: CD-quality FLAC already beats everything the old sources could give.+ * Hi-res downloads (24-bit when the source has it: bigger files, ~3× a CD-quality FLAC).+ * Default off: CD quality is asked for.*/fun isHiRes(context: Context): Boolean = prefs(context).getBoolean(KEY_HI_RES, false)fun setHiRes(context: Context, on: Boolean) = prefs(context).edit().putBoolean(KEY_HI_RES, on).apply()-/** Download tracking switches off, "Downloaded" becomes Local Files only (lossless off = no FLAC downloads). */-fun isLosslessEnabled(context: Context): Boolean = prefs(context).getBoolean(KEY_ENABLED, true)+/** Downloads on. Off: no downloads at all, "Downloaded" becomes Local Files only. */+fun isDownloadsEnabled(context: Context): Boolean = prefs(context).getBoolean(KEY_ENABLED, true)-fun setLosslessEnabled(context: Context, on: Boolean) = prefs(context).edit().putBoolean(KEY_ENABLED, on).apply()+fun setDownloadsEnabled(context: Context, on: Boolean) = prefs(context).edit().putBoolean(KEY_ENABLED, on).apply()/** Downloads kept small: the checked FLAC re-encoded to AAC on the phone. */fun isSmallDownloads(context: Context): Boolean = prefs(context).getBoolean(KEY_SMALL, false)diff --git a/base/app/src/main/java/com/music/spotui/data/preferences/QualityPref.kt b/base/app/src/main/java/com/music/spotui/data/preferences/QualityPref.ktindex 94009df4..e366a38f 100644--- a/base/app/src/main/java/com/music/spotui/data/preferences/QualityPref.kt+++ b/base/app/src/main/java/com/music/spotui/data/preferences/QualityPref.kt@@ -68,7 +68,7 @@ fun isCanvasWifiOnly(c: Context): Boolean = prefs(c).getBoolean(KEY_CANVAS_WIFI,fun setCanvasWifiOnly(c: Context, on: Boolean) = prefs(c).edit().putBoolean(KEY_CANVAS_WIFI, on).apply()fun getDownloadQuality(c: Context): DownloadQuality = when {- !isLosslessEnabled(c) -> DownloadQuality.OFF+ !isDownloadsEnabled(c) -> DownloadQuality.OFFisAskDownloadQuality(c) -> DownloadQuality.ASKisSmallDownloads(c) -> DownloadQuality.SMALLisHiRes(c) -> DownloadQuality.HI_RES@@ -76,7 +76,7 @@ fun getDownloadQuality(c: Context): DownloadQuality = when {}fun setDownloadQuality(c: Context, q: DownloadQuality) {- setLosslessEnabled(c, q != DownloadQuality.OFF)+ setDownloadsEnabled(c, q != DownloadQuality.OFF)setHiRes(c, q == DownloadQuality.HI_RES)setSmallDownloads(c, q == DownloadQuality.SMALL)setAskDownloadQuality(c, q == DownloadQuality.ASK)diff --git a/base/app/src/main/java/com/music/spotui/data/preferences/SettingsPref.kt b/base/app/src/main/java/com/music/spotui/data/preferences/SettingsPref.ktindex 485cdc83..e21f4af6 100644--- a/base/app/src/main/java/com/music/spotui/data/preferences/SettingsPref.kt+++ b/base/app/src/main/java/com/music/spotui/data/preferences/SettingsPref.kt@@ -112,6 +112,22 @@ object CrossfadePref {}}+/**+ * "Music videos": the video button in the player, the lookup behind it and a clip that starts+ * by itself on the next song. On by default; off, the player is audio (and Canvas) only.+ */+object MusicVideoPref {+ private const val KEY = "music_video_enabled"+ var on by androidx.compose.runtime.mutableStateOf(prefs(com.music.spotui.di.Graph.app).getBoolean(KEY, true))+ private set++ fun set(c: Context, value: Boolean) {+ on = value+ prefs(c).edit().putBoolean(KEY, value).apply()+ if (!value) com.music.spotui.video.MusicVideoController.setOn(false)+ }+}+fun getCrossfadeSeconds(c: Context): Int =prefs(c).getInt(KEY_CROSSFADE, 0).coerceIn(0, CrossfadePref.MAX)diff --git a/base/app/src/main/java/com/music/spotui/data/preferences/SpotiflacSessionPref.kt b/base/app/src/main/java/com/music/spotui/data/preferences/SpotiflacSessionPref.ktdeleted file mode 100644index 49268de7..00000000--- a/base/app/src/main/java/com/music/spotui/data/preferences/SpotiflacSessionPref.kt+++ /dev/null@@ -1,64 +0,0 @@-package com.music.spotui.data.preferences--import android.content.Context--/**- * The signed sessions of the SpotiFLAC download servers (Zarz), one per extension- * they are issued to (Tidal, Qobuz): the server-issued session_id + session_secret- * that sign the download requests, captured by the verification screen after the- * user solves the challenge themselves. The install id is shared.- */-private const val PREF = "SpotiflacSession"--private fun prefs(c: Context, appVersion: String) =- c.getSharedPreferences(PREF + "_" + appVersion.substringBefore('@'), Context.MODE_PRIVATE)--fun saveSpotiflacSession(- context: Context,- sessionId: String,- sessionSecret: String,- installId: String,- expiresAt: String,- appVersion: String,-) {- prefs(context, appVersion).edit()- .putString("app_version", appVersion)- .putString("session_id", sessionId)- .putString("session_secret", sessionSecret)- .putString("expires_at", expiresAt)- .apply()- context.getSharedPreferences(PREF, Context.MODE_PRIVATE).edit().putString("install_id", installId).apply()-}--data class SpotiflacSession(- val sessionId: String,- val sessionSecret: String,- val installId: String,- val expiresAt: String,-)--/** The install id the servers bind sessions to (kept across sessions). */-fun spotiflacInstallId(context: Context): String =- context.getSharedPreferences(PREF, Context.MODE_PRIVATE).getString("install_id", "").orEmpty()--fun getSpotiflacSession(context: Context, appVersion: String): SpotiflacSession? {- val p = prefs(context, appVersion)- // A session for another version of the extension does not sign this one's requests.- if (p.getString("app_version", "") != appVersion) return null- val id = p.getString("session_id", null)?.takeIf { it.isNotBlank() } ?: return null- val secret = p.getString("session_secret", null)?.takeIf { it.isNotBlank() } ?: return null- return SpotiflacSession(id, secret, spotiflacInstallId(context), p.getString("expires_at", "").orEmpty())-}--/** At least one download server is verified. */-fun hasSpotiflacSession(context: Context): Boolean =- com.music.spotui.lossless.ZarzSession.Ext.entries.any { getSpotiflacSession(context, it.appVersion) != null }--fun clearSpotiflacSession(context: Context, appVersion: String) {- prefs(context, appVersion).edit().clear().apply()-}--/** Forgets every session (Settings, "Forget"). */-fun clearSpotiflacSessions(context: Context) {- com.music.spotui.lossless.ZarzSession.Ext.entries.forEach { clearSpotiflacSession(context, it.appVersion) }-}diff --git a/base/app/src/main/java/com/music/spotui/di/Graph.kt b/base/app/src/main/java/com/music/spotui/di/Graph.ktindex 4c7469d4..afe2ed4d 100644--- a/base/app/src/main/java/com/music/spotui/di/Graph.kt+++ b/base/app/src/main/java/com/music/spotui/di/Graph.kt@@ -26,6 +26,7 @@ object Graph {com.music.spotui.data.api.SupportReminder.init(application)com.music.spotui.data.offline.OfflineStore.init(application)com.music.spotui.data.offline.OfflineCollections.init(application)+ SongPlayer.startLibraryOutbox(application)com.music.spotui.data.offline.OfflineCollections.refreshAll(application)com.music.spotui.data.local.LocalPlaylists.init(application)com.music.spotui.data.local.LibraryOrder.init(application)@@ -33,6 +34,8 @@ object Graph {com.music.spotui.data.offline.OfflineDownloader.resumePending()// Episodes have their own queue and their own file: resumed the same way.com.music.spotui.data.offline.PodcastDownloader.resumePending()+ // Installed extensions: each enabled one loads in its own sandbox, off the main thread.+ com.music.spotui.extensions.Extensions.init(application)}val api: Api by lazy { Api(app) }diff --git a/base/app/src/main/java/com/music/spotui/di/LocalPlayer.kt b/base/app/src/main/java/com/music/spotui/di/LocalPlayer.ktindex 6a5109b0..32a8f8bc 100644--- a/base/app/src/main/java/com/music/spotui/di/LocalPlayer.kt+++ b/base/app/src/main/java/com/music/spotui/di/LocalPlayer.kt@@ -1,5 +1,7 @@package com.music.spotui.di+import kotlinx.coroutines.isActive+import kotlinx.coroutines.launchimport androidx.compose.runtime.mutableStateOfimport androidx.media3.common.AudioAttributesimport androidx.media3.common.C@@ -21,9 +23,24 @@ object LocalPlayer {private val tracks = mutableListOf<LocalTrack>()/** The order before shuffle, to go back to. */private var unshuffled: List<LocalTrack>? = null- /** Where the queue comes from (Local Files, Downloaded…), shown in the player. */- var contextName: String = ""- private set+ /**+ * The songs the user queued ("Play next", "Add to queue"), kept right after the current one+ * as Spotify's queue is (see [LocalQueueOrder]); a song leaves it when it starts.+ */+ private val queued: MutableSet<LocalTrack> = java.util.Collections.newSetFromMap(java.util.IdentityHashMap())+ private val isQueued: (LocalTrack) -> Boolean = { it in queued }+ /** The queued song playing now (the player then says it plays from the queue). */+ private var playingQueued: LocalTrack? = null+ /** Where the queue comes from (Local Files, Downloaded…). */+ private var listName: String = ""+ /** The songs of the song radio added after the list (see continueIfLast), and its name. */+ private val radioSongs: MutableSet<LocalTrack> = java.util.Collections.newSetFromMap(java.util.IdentityHashMap())+ private var radioName: String = ""+ /** Where the song playing comes from, shown in the player: the list, or the song radio that goes on after it. */+ val contextName: String get() = if (current()?.let { it in radioSongs } == true) radioName else listName+ /** The Spotify list the queue was taken from ("" for Local Files and the Downloaded list, and in its song radio). */+ val contextUri: String get() = if (current()?.let { it in radioSongs } == true) "" else listUri+ private var listUri: String = ""private var exo: ExoPlayer? = null@androidx.annotation.OptIn(androidx.media3.common.util.UnstableApi::class)@@ -32,41 +49,148 @@ object LocalPlayer {.setHandleAudioBecomingNoisy(true)// Downloaded songs are encrypted files: the player reads them through the decrypting source..setMediaSourceFactory(androidx.media3.exoplayer.source.DefaultMediaSourceFactory(- com.music.spotui.data.offline.OfflineCrypto.Factory(Graph.app)))+ com.music.spotui.data.offline.OfflineCrypto.Factory(Graph.app)).setLoadErrorHandlingPolicy(NoAudioNotRetried)).build().also { p ->p.addListener(object : Player.Listener {override fun onEvents(player: Player, events: Player.Events) = publish()++ // Each change of what the player does, one line each, so a song that never starts says why.+ override fun onPlaybackStateChanged(state: Int) {+ log("state ${stateName(state)} at ${p.currentPosition} ms, item ${p.currentMediaItemIndex + 1}/${p.mediaItemCount}")+ if (state == Player.STATE_ENDED) atEnd(p)+ }+ override fun onPlayWhenReadyChanged(playWhenReady: Boolean, reason: Int) =+ log("playWhenReady $playWhenReady (${PLAY_WHEN_READY_REASONS.getOrElse(reason - 1) { "reason $reason" }})")+ override fun onIsPlayingChanged(isPlaying: Boolean) =+ log("isPlaying $isPlaying at ${p.currentPosition} ms")+ override fun onPlaybackSuppressionReasonChanged(reason: Int) =+ log("suppressed: ${if (reason == Player.PLAYBACK_SUPPRESSION_REASON_NONE) "no" else "reason $reason"}")++ // The next song an extension streams is asked for as soon as this one starts: it then+ // starts at once instead of waiting for the extension when this one ends.+ // The last one starting asks what goes on after it (see continueIfLast).+ override fun onMediaItemTransition(mediaItem: androidx.media3.common.MediaItem?, reason: Int) { prefetchNext(p); continueIfLast(p) }++ // A song whose audio an extension did not give or that would not play (audio-source+ // hook) is never skipped silently: Spotify plays it, where it was, and goes on.+ override fun onPlayerError(error: androidx.media3.common.PlaybackException) {+ log("error ${error.errorCodeName}: ${generic(error.cause?.toString() ?: error.message.orEmpty())}")+ val item = p.currentMediaItem?.localConfiguration?.uri ?: return+ if (item.scheme != com.music.spotui.extensions.ExtensionAudio.SCHEME) return+ val t = current() ?: return+ if (SongPlayer.playUnavailableOnSpotify(t, p.currentPosition)) return+ if (!p.hasNextMediaItem()) return+ log("skipped ${t.title}: no extension had it and Spotify cannot play it now")+ p.seekToNextMediaItem()+ p.prepare()+ p.play()+ }})exo = p}- fun play(list: List<LocalTrack>, index: Int, shuffle: Boolean = false, context: String? = null) {+ /**+ * The player's load errors: a song no extension gave usable audio for fails at once (each+ * retry would ask the extensions again, five asks in two seconds were seen); others as usual.+ */+ @androidx.annotation.OptIn(androidx.media3.common.util.UnstableApi::class)+ private object NoAudioNotRetried : androidx.media3.exoplayer.upstream.DefaultLoadErrorHandlingPolicy() {+ override fun getRetryDelayMsFor(info: androidx.media3.exoplayer.upstream.LoadErrorHandlingPolicy.LoadErrorInfo): Long =+ if (com.music.spotui.extensions.AudioRoute.isNoAudio(info.exception)) C.TIME_UNSET else super.getRetryDelayMsFor(info)+ }++ private val prefetch = kotlinx.coroutines.CoroutineScope(kotlinx.coroutines.SupervisorJob() + kotlinx.coroutines.Dispatchers.IO)++ private var ahead: kotlinx.coroutines.Job? = null++ /**+ * Resolves the next item's audio ahead (ExtensionAudio keeps the answer for its data source),+ * and reads its start: the first bytes of a url (StreamHead), the index and first segment of a+ * DASH answer, so a skip starts at once. Off a metered network only, apart from the answer+ * and the DASH index; the next song changing abandons it.+ */+ private fun prefetchNext(p: ExoPlayer) {+ ahead?.cancel()+ val i = p.nextMediaItemIndex+ if (i == C.INDEX_UNSET) return+ val uri = p.getMediaItemAt(i).localConfiguration?.uri ?: return+ if (uri.scheme != com.music.spotui.extensions.ExtensionAudio.SCHEME) return+ ahead = prefetch.launch {+ // Not at once: a song skipped in its first seconds would have cost its source an ask+ // for nothing, and sources limit how often they are asked (the song is asked anyway+ // when it starts).+ kotlinx.coroutines.delay(AHEAD_DELAY_MS)+ runCatching {+ val s = com.music.spotui.extensions.ExtensionAudio.resolve(uri, ahead = true) ?: return@launch+ val cheap = !com.music.spotui.data.DataSaver.metered+ if (s.manifest != null) {+ val live = com.music.spotui.data.offline.DashLive.open(s.manifest!!, s.headers, com.music.spotui.data.offline.OfflineDownloader.DownloadUa)+ if (cheap && isActive) live.warm()+ } else if (cheap && isActive) {+ com.music.spotui.data.offline.StreamHead.fetch(uri.lastPathSegment.orEmpty(), s.url, s.headers,+ System.currentTimeMillis() + s.keepMs(HEAD_KEEP_MS)) { isActive }+ }+ }+ }+ }++ private const val AHEAD_DELAY_MS = 10_000L++ /** The most a song's start read ahead is kept (less when its address expires sooner). */+ private const val HEAD_KEEP_MS = 10 * 60_000L++ /**+ * [startMs]: where the song at [index] starts (a resume). [continues]: the extensions play the+ * queue, it goes on after its last song as Spotify's does (see continueIfLast).+ */+ fun play(list: List<LocalTrack>, index: Int, shuffle: Boolean = false, context: String? = null, contextUri: String = "", startMs: Long = 0L, continues: Boolean = false) {if (list.isEmpty()) returnSongPlayer.pauseEngineForLocal()+ forgetRadio(); this.continues = continuestracks.clear(); tracks.addAll(list); unshuffled = null- contextName = context ?: Graph.app.getString(app.myspoti.engine.R.string.local_files_title)+ queued.clear(); playingQueued = null; radioSongs.clear()+ listName = context ?: Graph.app.getString(app.myspoti.engine.R.string.local_files_title)+ listUri = contextUriactive.value = trueval p = player()p.shuffleModeEnabled = false- p.setMediaItems(list.map(::item), index.coerceIn(0, list.lastIndex), 0L)+ p.setMediaItems(list.map(::item), index.coerceIn(0, list.lastIndex), startMs.coerceAtLeast(0L))p.prepare()if (shuffle) setShuffle(true)p.play()+ continueIfLast(p)}/** Back to Spotify: stop and forget the local queue. */fun stop() {if (!active.value) returnactive.value = false+ forgetRadio(); continues = falseexo?.let { it.stop(); it.clearMediaItems() }tracks.clear(); unshuffled = null+ queued.clear(); playingQueued = null; radioSongs.clear()SongPlayer.restoreEngineQueue()}- fun resume() { exo?.play() }+ /** A player stopped by an error (idle) is prepared again first: a play alone does nothing there. */+ fun resume() {+ val p = exo ?: return+ if (p.playbackState == Player.STATE_IDLE && p.mediaItemCount > 0) { log("resume after an error: preparing again"); p.prepare() }+ p.play()+ }fun pause() { exo?.pause() }- fun next() { exo?.let { if (it.hasNextMediaItem()) it.seekToNextMediaItem() } }- fun previous() { exo?.let { if (it.currentPosition > 3000 || !it.hasPreviousMediaItem()) it.seekTo(0) else it.seekToPreviousMediaItem() } }+ fun next() {+ exo?.let {+ if (it.hasNextMediaItem()) { com.music.spotui.extensions.Extensions.skipAsked("forward"); it.seekToNextMediaItem() }+ else if (atEnd(it)) com.music.spotui.extensions.Extensions.skipAsked("forward")+ }+ }+ fun previous() {+ exo?.let {+ if (it.currentPosition > 3000 || !it.hasPreviousMediaItem()) it.seekTo(0)+ else { com.music.spotui.extensions.Extensions.skipAsked("backward"); it.seekToPreviousMediaItem() }+ }+ }fun seekTo(ms: Long) { exo?.seekTo(ms) }/*** Shuffle reorders the songs after the current one (and off puts the list's order back),@@ -77,12 +201,12 @@ object LocalPlayer {if (on == (unshuffled != null) || tracks.isEmpty()) returnval cur = p.currentMediaItemIndex.coerceIn(0, tracks.lastIndex)if (on) {- unshuffled = tracks.toList()- arrange(tracks.subList(0, cur + 1).toList() + tracks.subList(cur + 1, tracks.size).shuffled())+ unshuffled = tracks.filterNot(isQueued)+ arrange(LocalQueueOrder.shuffled(tracks.toList(), cur, isQueued) { it.shuffled() })} else {val before = unshuffled.orEmpty()unshuffled = null- arrange(before.filter { b -> tracks.any { it === b } } + tracks.filter { t -> before.none { it === t } })+ arrange(LocalQueueOrder.unshuffled(tracks.toList(), cur, before, isQueued))}}@@ -94,25 +218,78 @@ object LocalPlayer {return (i + 1 until tracks.size).map { it to tracks[it] }}- fun skipTo(index: Int) { exo?.let { if (index in tracks.indices) { it.seekTo(index, 0L); it.play() } } }+ /** How many of [upcoming] the user queued (they come first). */+ fun queuedCount(): Int = exo?.let { LocalQueueOrder.queuedAfter(tracks, it.currentMediaItemIndex, isQueued) } ?: 0++ /** The current song is one the user queued ("Playing from the queue"). */+ fun fromQueue(): Boolean = playingQueued?.let { it === current() } == true++ /** A tap on the song at [index] of the queue: it plays at once; the songs queued before it stay queued. */+ fun skipTo(index: Int) {+ val p = exo ?: return+ if (index !in tracks.indices) return+ val (order, at) = LocalQueueOrder.skip(tracks.toList(), p.currentMediaItemIndex, index, isQueued)+ if (order != tracks) arrange(order)+ p.seekTo(at, 0L); p.play()+ }++ /**+ * Moves the song at [from] before or [after] the one at [target], into [target]'s part of the+ * queue (queued, or the list's songs), as a drag in the queue does.+ */+ fun moveBeside(from: Int, target: Int, after: Boolean) {+ if (exo == null) return+ if (from !in tracks.indices || target !in tracks.indices || from == target) return+ val t = tracks[from]+ if (tracks[target] in queued) queued += t else queued -= t+ val order = tracks.toMutableList().apply { removeAt(from) }+ val at = order.indexOfFirst { it === tracks[target] }+ order.add(if (after) at + 1 else at, t)+ val playing = current()+ arrange(LocalQueueOrder.settle(order, order.indexOfFirst { it === playing }, isQueued))+ }++ /** Moves the song at [from] into the queued songs: first ([target] null), else beside [target]. */+ fun moveIntoQueue(from: Int, target: Int?, after: Boolean) {+ val p = exo ?: return+ if (from !in tracks.indices) return+ if (target != null) return moveBeside(from, target, after)+ val t = tracks[from]+ queued += t+ val cur = p.currentMediaItemIndex+ val order = tracks.toMutableList().apply { removeAt(from) }+ order.add((if (from > cur) cur + 1 else cur).coerceIn(0, order.size), t)+ arrange(order)+ }- /** Moves the song at [from] so it ends at [to] (indices of the list after the move). */- fun move(from: Int, to: Int) {+ /**+ * "Play next" / "Add to queue": [t] joins the queued songs, first ([next]) or after those+ * queued before it, ahead of the list's own next songs (as in Spotify's queue).+ */+ fun enqueue(t: LocalTrack, next: Boolean) {val p = exo ?: return- if (from !in tracks.indices || to !in tracks.indices || from == to) return- p.moveMediaItem(from, to)- tracks.add(to, tracks.removeAt(from))+ val at = LocalQueueOrder.insertIndex(tracks, p.currentMediaItemIndex, next, isQueued)+ queued += t+ p.addMediaItem(at, item(t))+ tracks.add(at, t)publish()}- /** Moves the song at [from] right after the current one. */- fun moveNext(from: Int) { exo?.let { val cur = it.currentMediaItemIndex; move(from, if (from > cur) cur + 1 else cur) } }+ /** "Clear queue": the songs the user queued go; the list's own stay. */+ fun clearQueued() {+ val p = exo ?: return+ for (i in tracks.indices.reversed()) if (i > p.currentMediaItemIndex && tracks[i] in queued) {+ p.removeMediaItem(i); queued -= tracks.removeAt(i)+ }+ publish()+ }fun remove(index: Int) {val p = exo ?: returnif (index !in tracks.indices || index == p.currentMediaItemIndex) returnp.removeMediaItem(index)val t = tracks.removeAt(index)+ queued -= tunshuffled = unshuffled?.filterNot { it === t }publish()}@@ -127,20 +304,115 @@ object LocalPlayer {publish()}+ // ── After the last song ──+ /** The extensions play the queue: it goes on after its last song (files of the device never do). */+ private var continues = false+ /** The song whose song radio was asked, once per last song. */+ private var radioOf: String? = null+ private var radio: kotlinx.coroutines.Job? = null+ /** Its song radio gave nothing: Spotify goes on after it. */+ private var radioEmpty = false+ /** The song ended (or Next) while its song radio was asked: the radio plays as soon as it comes. */+ private var moveOnWhenReady = false++ private fun forgetRadio() { radio?.cancel(); radio = null; radioOf = null; radioEmpty = false; moveOnWhenReady = false }++ /** The Spotify id of a song an extension streams or of a downloaded one, "" for a file of the device. */+ private fun spotifyId(t: LocalTrack?): String = t?.let(::spotifyIdOf).orEmpty()++ /**+ * The last song of a queue the extensions play started: its song radio (what Spotify's autoplay+ * goes on with) is asked now, in the background, and added after it, each song asked to the+ * extensions when it plays as any other, so the queue goes on as Spotify's would.+ */+ private fun continueIfLast(p: ExoPlayer) {+ if (p.mediaItemCount == 0 || p.currentMediaItemIndex != p.mediaItemCount - 1) return+ val id = spotifyId(current())+ if (id == radioOf || !com.music.spotui.extensions.AudioRoute.continues(continues, id,+ repeatAll = p.repeatMode == Player.REPEAT_MODE_ALL, autoplay = com.music.spotui.data.preferences.AutoplayPref.on)) return+ forgetRadio(); radioOf = id+ radio = prefetch.launch {+ val songs = runCatching { Graph.api.getRecommendations(listOf(id)) }.getOrDefault(emptyList())+ kotlinx.coroutines.withContext(kotlinx.coroutines.Dispatchers.Main) { radioCame(p, id, songs) }+ }+ }++ private fun radioCame(p: ExoPlayer, id: String, songs: List<com.music.spotui.data.entity.SongsModel>) {+ if (!active.value || radioOf != id) return+ val more = com.music.spotui.extensions.AudioRoute.continuation(songs, tracks.map(::spotifyId))+ if (more.isEmpty()) {+ radioEmpty = true+ if (moveOnWhenReady) spotifyContinues()+ return+ }+ val added = more.map(com.music.spotui.extensions.ExtensionAudio::localTrack).let { if (shuffled) it.shuffled() else it }+ val from = tracks.size+ // Named after the song it goes on from, as Spotify's song radio is.+ radioName = Graph.app.getString(app.myspoti.engine.R.string.song_radio_name, tracks.lastOrNull { spotifyId(it) == id }?.title ?: current()?.title.orEmpty())+ radioSongs += added+ tracks.addAll(added)+ p.addMediaItems(added.map(::item))+ log("queue ended, continuing with ${added.size} songs (song radio)")+ if (moveOnWhenReady) { moveOnWhenReady = false; skipTo(from) } else prefetchNext(p)+ publish()+ }++ /**+ * No song after the current one (it ended, or Next): its song radio plays, now or when it+ * comes, or Spotify goes on when it had none. False: the queue just ends (see AudioRoute.continues).+ */+ private fun atEnd(p: ExoPlayer): Boolean {+ continueIfLast(p)+ if (radioOf == null || radioOf != spotifyId(current())) return false+ if (radioEmpty) spotifyContinues() else moveOnWhenReady = true+ return true+ }++ private fun spotifyContinues() {+ moveOnWhenReady = false+ val t = current() ?: return+ SongPlayer.continueOnSpotify(t, spotifyId(t))+ }+private fun item(t: LocalTrack) = MediaItem.Builder().setUri(t.uri).setMediaId(t.id.toString())- .setMediaMetadata(MediaMetadata.Builder().setTitle(t.title).setArtist(t.artist).build()).build()+ .setMediaMetadata(MediaMetadata.Builder().setTitle(t.title).setArtist(t.artist).setAlbumTitle(t.album)+ .setArtworkUri(android.net.Uri.parse(app.myspoti.host.android.Covers.large(t.artUri.toString()))).setDurationMs(t.durationMs.takeIf { it > 0 }).build()).build()fun setRepeatMode(mode: Int) {exo?.repeatMode = when (mode) { 1 -> Player.REPEAT_MODE_ALL; 2 -> Player.REPEAT_MODE_ONE; else -> Player.REPEAT_MODE_OFF }}+ /** The Spotify id of [t]: a downloaded song's, or the song an extension streams; "" for the phone's own files. */+ fun spotifyIdOf(t: LocalTrack): String =+ com.music.spotui.data.offline.OfflineStore.byLocalId(t.id)?.trackId+ ?: t.uri.takeIf { it.scheme == com.music.spotui.extensions.ExtensionAudio.SCHEME }?.lastPathSegment.orEmpty()+fun isPlaying() = exo?.isPlaying == true+ /** For the diagnostic (`status`): whether it is to play, and its state (idle, buffering, ready, ended). */+ fun playWhenReady() = exo?.playWhenReady == true+ fun playbackState(): String = exo?.let { stateName(it.playbackState) } ?: "none"fun position() = exo?.currentPosition ?: 0Lfun duration() = exo?.duration?.takeIf { it > 0 } ?: current()?.durationMs ?: 0Lfun current(): LocalTrack? = exo?.currentMediaItemIndex?.let { tracks.getOrNull(it) }+ private fun log(line: String) = app.myspoti.host.android.Logbook.log("local: $line")++ /** An error's text without the addresses it may carry. */+ private fun generic(text: String) = text.replace(Regex("\\b\\w+://\\S+"), "<address>").take(200)++ private fun stateName(state: Int) = when (state) {+ Player.STATE_IDLE -> "idle"; Player.STATE_BUFFERING -> "buffering"+ Player.STATE_READY -> "ready"; Player.STATE_ENDED -> "ended"; else -> "state $state"+ }++ /** Player.PLAY_WHEN_READY_CHANGE_REASON_*, from 1. */+ private val PLAY_WHEN_READY_REASONS = listOf("asked", "audio focus lost", "audio becoming noisy", "remote", "end of item", "suppressed too long")+private fun publish() {if (!active.value) returnval t = current() ?: return+ // A queued song that started (or was skipped past) leaves the queue: it plays from there now.+ if (t in queued) playingQueued = t+ exo?.currentMediaItemIndex?.let { cur -> for (i in 0..minOf(cur, tracks.lastIndex)) queued -= tracks[i] }SongPlayer.onLocalState(t, exo?.playWhenReady == true, position(), duration())- SongPlayer.onLocalQueue(t, upcoming())+ SongPlayer.onLocalQueue(t, upcoming(), queuedCount())}}diff --git a/base/app/src/main/java/com/music/spotui/di/LocalQueueOrder.kt b/base/app/src/main/java/com/music/spotui/di/LocalQueueOrder.ktnew file mode 100644index 00000000..d83757fa--- /dev/null+++ b/base/app/src/main/java/com/music/spotui/di/LocalQueueOrder.kt@@ -0,0 +1,53 @@+package com.music.spotui.di++/**+ * The local player's play order with Spotify's two parts after the current song: the songs the+ * user queued ("Next in queue", right after it, in the order they were added), then the rest of+ * the list ("Next from"). Songs are told apart by identity (a list may hold one song twice);+ * [isQueued] says which are queued. [cur] is the current song's index.+ */+internal object LocalQueueOrder {+ /** Where a song added goes: right after the current one ([next]), else after the songs queued before it. */+ fun <T> insertIndex(order: List<T>, cur: Int, next: Boolean, isQueued: (T) -> Boolean): Int =+ (cur + 1 + if (next) 0 else queuedAfter(order, cur, isQueued)).coerceIn(0, order.size)++ /** How many queued songs follow the current one. */+ fun <T> queuedAfter(order: List<T>, cur: Int, isQueued: (T) -> Boolean): Int =+ order.drop(cur + 1).takeWhile(isQueued).size++ /** [order] with the queued songs after the current one moved up right after it, in their order. */+ fun <T> settle(order: List<T>, cur: Int, isQueued: (T) -> Boolean): List<T> {+ val tail = order.drop(cur + 1)+ return order.take(cur + 1) + tail.filter(isQueued) + tail.filterNot(isQueued)+ }++ /**+ * A tap on the song at [target] of the list: the list's songs before it are skipped, the queued+ * ones stay queued, right after it (as Spotify keeps them). The new order and [target]'s index in it.+ */+ fun <T> skip(order: List<T>, cur: Int, target: Int, isQueued: (T) -> Boolean): Pair<List<T>, Int> {+ if (target <= cur || target !in order.indices || isQueued(order[target])) return order to target+ val between = order.subList(cur + 1, target)+ val skipped = between.filterNot(isQueued)+ return (order.take(cur + 1) + skipped + order[target] + between.filter(isQueued) + order.drop(target + 1)) to cur + 1 + skipped.size+ }++ /** Shuffle on: the queued songs keep their place and order, the rest of the list is [shuffle]d. */+ fun <T> shuffled(order: List<T>, cur: Int, isQueued: (T) -> Boolean, shuffle: (List<T>) -> List<T>): List<T> {+ val tail = order.drop(cur + 1)+ return order.take(cur + 1) + tail.filter(isQueued) + shuffle(tail.filterNot(isQueued))+ }++ /**+ * Shuffle off: the list back in its order [before] (songs added since at its end), the queued+ * songs still right after the current one.+ */+ fun <T> unshuffled(order: List<T>, cur: Int, before: List<T>, isQueued: (T) -> Boolean): List<T> {+ val current = order.getOrNull(cur)+ val queued = order.drop(cur + 1).filter(isQueued)+ val rest = before.filter { b -> order.any { it === b } && queued.none { it === b } } ++ order.filter { t -> before.none { it === t } && queued.none { it === t } }+ val at = rest.indexOfFirst { it === current }+ return if (at < 0) queued + rest else rest.take(at + 1) + queued + rest.drop(at + 1)+ }+}diff --git a/base/app/src/main/java/com/music/spotui/di/NoisyAudio.kt b/base/app/src/main/java/com/music/spotui/di/NoisyAudio.ktindex 27f4dc8d..d0e44985 100644--- a/base/app/src/main/java/com/music/spotui/di/NoisyAudio.kt+++ b/base/app/src/main/java/com/music/spotui/di/NoisyAudio.kt@@ -15,7 +15,7 @@ object NoisyAudio {private val receiver = object : BroadcastReceiver() {override fun onReceive(context: Context, intent: Intent) {if (intent.action != AudioManager.ACTION_AUDIO_BECOMING_NOISY) return- if (SongPlayer.activeDevice.value == null && SongPlayer.isPlaying()) SongPlayer.pause()+ if (SongPlayer.activeDevice.value == null && SongPlayer.isPlaying()) SongPlayer.pause(by = "headphones unplugged")}}diff --git a/base/app/src/main/java/com/music/spotui/di/SessionActions.kt b/base/app/src/main/java/com/music/spotui/di/SessionActions.ktindex dcd9a342..a2610029 100644--- a/base/app/src/main/java/com/music/spotui/di/SessionActions.kt+++ b/base/app/src/main/java/com/music/spotui/di/SessionActions.kt@@ -15,8 +15,8 @@ object SessionActions {/*** Signs out and drops everything tied to the account, so the next account on* this phone starts clean: prefs and in-memory caches, the saved screens,- * the listen history (the Recap), the SpotiFLAC download sessions, and the- * Web Player's cookies, Web storage and cache (in the host).+ * the listen history (the Recap), and the Web Player's cookies, Web storage+ * and cache (in the host).*/fun logout(context: android.content.Context) {val app = context.applicationContext@@ -30,6 +30,7 @@ object SessionActions {com.music.spotui.ui.screens.ContextViewModel.clearCache()com.music.spotui.data.api.Api.HomeCache.clear()com.music.spotui.data.api.Api.LikedCache.tracks = null+ com.music.spotui.data.api.TopStats.clear()com.music.spotui.data.api.ProfileCache.clearSession()SongPlayer.clearSession()listOf("PlaybackState", "LibraryCache", "RecentItems", "LikedSongs",@@ -37,7 +38,6 @@ object SessionActions {app.getSharedPreferences(name, android.content.Context.MODE_PRIVATE).edit().clear().apply()}com.music.spotui.data.local.ListenHistory.clear()- com.music.spotui.data.preferences.clearSpotiflacSessions(app)_signedOut.value = trueMyspotiRuntime.host.logout()}diff --git a/base/app/src/main/java/com/music/spotui/di/SongPlayer.kt b/base/app/src/main/java/com/music/spotui/di/SongPlayer.ktindex 5581bc98..cd402054 100644--- a/base/app/src/main/java/com/music/spotui/di/SongPlayer.kt+++ b/base/app/src/main/java/com/music/spotui/di/SongPlayer.kt@@ -34,6 +34,8 @@ import java.util.concurrent.ConcurrentHashMapobject SongPlayer {private const val SPOTIFY_TRACK_PREFIX = "spotify:track:"private const val PENDING_MS = 6000L+ /** The longest a song is shown loading while the extensions are asked (they answer sooner). */+ private const val ROUTE_HOLD_MS = 40_000L/** The end-of-track timer pauses this close to the end (before the next item starts). */private const val END_OF_TRACK_MARGIN_MS = 600L/** How often the state is read again while another device plays. */@@ -155,6 +157,7 @@ object SongPlayer {com.music.spotui.data.api.LyricsApi.wordSync =com.music.spotui.data.preferences.isLyricsWordSync(Graph.app)restoreLastTrack(state)+ restoreRepeat(state)scope.launch { api.player.state.collect { s -> if (acceptsSessionUpdates()) applyState(s) } }// Another device plays (the phone as a remote): the state is read again every few seconds// so the notification, the mini player and the slider keep up. Reported: the notification@@ -213,6 +216,11 @@ object SongPlayer {android.widget.Toast.makeText(Graph.app, message, android.widget.Toast.LENGTH_LONG).show()}}+ scope.launch {+ MyspotiRuntime.spotify.player.refusedAll.collect {+ android.widget.Toast.makeText(Graph.app, app.myspoti.engine.R.string.play_refused_all, android.widget.Toast.LENGTH_LONG).show()+ }+ }// Said once the page has asked its WebView: a device that cannot decrypt Spotify's streams// plays nothing (no sound, 0:00), and nothing else in the app says why.scope.launch {@@ -233,8 +241,8 @@ object SongPlayer {/** System controls (notification, headset, car) land here. */private object Controls : app.myspoti.host.android.PlaybackControls {- override fun play() = SongPlayer.play()- override fun pause() = SongPlayer.pause()+ override fun play() = SongPlayer.play(by = "media session")+ override fun pause() = SongPlayer.pause(by = "media session")override fun next() = SongPlayer.next()override fun previous() = SongPlayer.previous()override fun seekTo(ms: Long) = SongPlayer.seekTo(ms)@@ -307,7 +315,7 @@ object SongPlayer {synchronized(wantedSaved) { wantedSaved.clear() }_queue.value = EngineQueue(); apiQueue = null; _nowPlaying.value = NowPlaying()lastTrackPrefs().edit().clear().apply(); savedLast = ""; resumeWhenReady = false- _activeDevice.value = null; _sleepEndsAt.value = null; sleepTrackId = null+ _activeDevice.value = null; _sleepEndsAt.value = null; sleepTrackId = null; spotifyFallbackId = null_video.value = VideoState(); videoFullscreen.value = falseboundState?.let { state ->state.updateQueue(emptyList())@@ -389,6 +397,8 @@ object SongPlayer {val item = s.itemval uri = item?.uri.orEmpty()if (uri.isNotEmpty()) lastPageUri = uri+ // The song the extensions are asked for shows meanwhile, not what the engine paused on.+ if (routing && !LocalPlayer.active.value) returnval id = trackIdOf(uri)val pending = pendingTrackIdif (pending != null) {@@ -411,6 +421,7 @@ object SongPlayer {positionMs = reportedpositionAt = SystemClock.elapsedRealtime()}+ val leftId = trackIdOf(_nowPlaying.value.uri)val trackChanged = uri != _nowPlaying.value.uri// Autoplay off: stop once, when the player moves on to a track it picked itself.// Tracks only: this is the music setting (similar songs). An episode the page rolls on@@ -464,6 +475,10 @@ object SongPlayer {if (trackChanged) {refreshCurrentLiked()refreshDevice()+ // The engine moved on by itself from a song no extension had: the new one is asked there.+ if (playing && !adState.value) main.post {+ if (_nowPlaying.value.uri == uri) backToExtensions(song, leftId, upcomingSongs(song)) { intendPlaying(); playing = true; transport { api.player.resume() } }+ }}val mv = com.music.spotui.video.MusicVideoControllermv.onAudioBuffering(isBuffering, song.spotifyTrackId)@@ -488,7 +503,7 @@ object SongPlayer {}private fun refreshCurrentLiked() {- val uri = _nowPlaying.value.uri.takeIf { it.startsWith(SPOTIFY_TRACK_PREFIX) || it.startsWith("spotify:episode:") } ?: return+ val uri = currentLikeUri().takeIf { it.startsWith(SPOTIFY_TRACK_PREFIX) || it.startsWith("spotify:episode:") } ?: returnscope.launch {// Through the shared, cached request path: a state Spotify confirmed less than// [SAVED_FRESH_MS] ago is not asked for again (its row asked for it already).@@ -649,8 +664,17 @@ object SongPlayer {* Play [song] (a play key "spotify:track:<id>|<text>" or "episode:<id>"). [contextUri] is* the list it was picked from; when null, the last list that registered this track is used.*/- /** [order]: the context's track uris in the order to play them (a sorted playlist). */- fun playSong(song: String, context: Context? = null, contextUri: String? = null, order: List<String>? = null, positionMs: Long? = null) {+ /**+ * [order]: the context's track uris in the order to play them (a sorted playlist).+ * [songs]: what the caller knows of the song (and of its list, in play order), for the+ * audio-source extensions: asked first when one is on ([askExtensions]), they play it in the+ * local player with the rest as the queue; a miss plays on Spotify as before. Without+ * [songs], the song is looked up on Spotify (a link, Recents, an extension's block).+ */+ fun playSong(+ song: String, context: Context? = null, contextUri: String? = null, order: List<String>? = null, positionMs: Long? = null,+ songs: List<SongsModel>? = null, askExtensions: Boolean = true,+ ) {// Data saver on mobile data: Spotify can't stream, only downloads and Local Files play.if (com.music.spotui.data.DataSaver.active) {main.post {@@ -658,6 +682,19 @@ object SongPlayer {}return}+ val routedId = if (song.startsWith("episode:")) null else spotifyTrackIdForPlayback(song)+ if (askExtensions && com.music.spotui.extensions.AudioRoute.asks(routedId, com.music.spotui.extensions.Extensions.hasAudioSource())) {+ val ctx = (contextUri ?: contextRegistry[song]).orEmpty()+ val shuffle = isShuffleOn()+ playThroughExtensions(routedId!!, songs?.firstOrNull { it.spotifyTrackId == routedId }, knownContextName(ctx), { playSong(song, context, contextUri, order, positionMs, askExtensions = false) }) { isLatest, shown ->+ com.music.spotui.extensions.ExtensionAudio.route(routedId, songs, knownContextName(ctx), shuffle, ctx, isLatest, shown, positionMs ?: 0L)+ }+ return+ }+ if (askExtensions && routedId != null) com.music.spotui.extensions.Extensions.audioSkipped()?.let {+ app.myspoti.host.android.Logbook.log("audio: $it, Spotify plays $routedId")+ }+ routeAsk.incrementAndGet(); routingState.value = nullLocalPlayer.stop()cancelBurst()val episodeId = song.removePrefix("episode:").takeIf { song.startsWith("episode:") }@@ -681,8 +718,190 @@ object SongPlayer {}}- fun play() {+ // ── A song sent to the audio-source extensions ──+ /** Bumped by every play; a resolution that finishes after a newer one was asked plays nothing. */+ private val routeAsk = java.util.concurrent.atomic.AtomicInteger()+ /** The Spotify id of the song the extensions are being asked for, shown loading meanwhile. */+ private val routingState = mutableStateOf<String?>(null)+ private var routingUntil = 0L+ private var routingContext = ""+ /** A song is shown loading while the extensions are asked for its audio (nothing plays yet). */+ val routing: Boolean get() = routingState.value != null && SystemClock.elapsedRealtime() < routingUntil++ /**+ * Plays the song [trackId] through the audio-source extensions ([play]: ExtensionAudio, told+ * whether its answer is still the latest ask and how to show the song once it knows it).+ * What played pauses and the song shows at once, loading, under its own Spotify uri: its+ * lyrics, Canvas, artists and colours load while the extensions answer. The latest pick wins:+ * an older answer plays nothing. [contextName]: the list it is played from, shown meanwhile.+ * [fallback] (on the main thread): they had nothing, Spotify plays.+ */+ fun playThroughExtensions(+ trackId: String, song: SongsModel?, contextName: String, fallback: () -> Unit,+ play: suspend (isLatest: () -> Boolean, shown: (SongsModel) -> Unit) -> Boolean,+ ) {+ val ask = routeAsk.incrementAndGet()+ val isLatest = { routeAsk.get() == ask }+ spotifyFallbackId = null; fallbackRest = null+ cancelBurst()+ if (LocalPlayer.active.value) LocalPlayer.pause()+ else if (playing) { intendPaused(); transport(pullBack = false) { api.player.pause() } }+ playing = false; bufferingState.value = true+ positionMs = 0; positionAt = SystemClock.elapsedRealtime()+ routingState.value = trackId; routingUntil = SystemClock.elapsedRealtime() + ROUTE_HOLD_MS+ routingContext = contextName+ song?.let(::showRouted)+ scope.launch {+ val played = runCatching { play(isLatest) { s -> main.post { if (isLatest()) showRouted(s) } } }+ .onFailure { app.myspoti.host.android.Logbook.log("audio: asking the extensions for $trackId failed: $it") }+ .getOrDefault(false)+ if (!played) main.post {+ if (isLatest()) {+ app.myspoti.host.android.Logbook.log("audio: no extension had ${song?.title ?: trackId}, Spotify plays")+ spotifyPlayed.add(trackId)+ routingState.value = null; spotifyFallbackId = trackId; fallback()+ }+ }+ }+ }++ /**+ * A song of the local queue an extension streams had no audio there, or would not play: Spotify+ * plays it from [positionMs], in the list it came from, and goes on with that list (as a miss+ * at the pick does). False: it cannot (no Spotify id, data saver), the caller skips it.+ */+ fun playUnavailableOnSpotify(t: com.music.spotui.data.local.LocalTrack, positionMs: Long): Boolean {+ val id = streamedTrackId(t)+ if (id.isBlank() || com.music.spotui.data.DataSaver.active) return false+ app.myspoti.host.android.Logbook.log("local: ${t.title} not available from extensions, Spotify plays it")+ spotifyPlayed.add(id)+ spotifyFallbackId = id+ // The local queue after it, for the extensions to go on with once Spotify has played it.+ fallbackRest = Triple(id, LocalPlayer.upcoming().map { (_, u) -> localSong(u).copy(spotifyTrackId = LocalPlayer.spotifyIdOf(u)) }, LocalPlayer.contextName)+ playSong(buildSpotifyPlayQuery(id, t.title, t.artist), contextUri = LocalPlayer.contextUri.ifBlank { null },+ positionMs = positionMs.takeIf { it > 0 }, askExtensions = false)+ return true+ }++ /**+ * The local queue the extensions played ended with no song radio to go on with: Spotify goes+ * on after its last song [t] ([trackId]) as after a song played alone (its autoplay), from the+ * song's last second; the song it moves on to is asked to the extensions again (backToExtensions).+ */+ fun continueOnSpotify(t: com.music.spotui.data.local.LocalTrack, trackId: String) {+ if (trackId.isBlank() || com.music.spotui.data.DataSaver.active) return+ app.myspoti.host.android.Logbook.log("local: queue ended, Spotify continues")+ spotifyFallbackId = trackId+ val end = (t.durationMs.takeIf { it > 0 } ?: LocalPlayer.duration()) - END_LEAD_MS+ playSong(buildSpotifyPlayQuery(trackId, t.title, t.artist), contextUri = SPOTIFY_TRACK_PREFIX + trackId,+ positionMs = end.takeIf { it > 0 }, askExtensions = false)+ }++ /** How long before its end the last song is played by Spotify, so its autoplay goes on at once. */+ private const val END_LEAD_MS = 1_000L++ /** The songs the extensions had nothing for this session: a resume of one goes straight to Spotify. */+ private val spotifyPlayed = java.util.Collections.synchronizedSet(HashSet<String>())++ /**+ * The song Spotify plays because no extension had it: only that one falls back, the song after+ * it (a next, a previous, the engine moving on) is asked to the extensions again ([backToExtensions]).+ */+ private var spotifyFallbackId: String? = null++ /**+ * The song Spotify plays for want of the extensions while the local player played a queue, the+ * songs that came after it there, and that queue's name: the extensions go on with them+ * ([backToExtensions]) rather than with the engine's list, which has neither the songs the+ * user queued, nor the local order, nor the song radio.+ */+ private var fallbackRest: Triple<String, List<SongsModel>, String>? = null++ /**+ * [target], played after [leftId], asked to the extensions as a pick is, with [songs] (from it+ * on) as the list, when [leftId] is the song Spotify played for want of them. A song they+ * missed lately is not asked: Spotify plays it, and the one after it is asked. [fallback] (on+ * the main thread): they had nothing, the engine goes on. False: the engine goes on as usual.+ * Going [forward] off a song of the local queue, the song after it there is asked, not the engine's.+ */+ private fun backToExtensions(asked: SongsModel, leftId: String, songs: List<SongsModel>, forward: Boolean = true, fallback: () -> Unit): Boolean {+ val target = fallbackRest?.takeIf { forward && it.first == leftId }?.second?.firstOrNull() ?: asked+ val id = target.spotifyTrackId+ val remote = _activeDevice.value != null || routing || LocalPlayer.active.value+ if (!com.music.spotui.extensions.AudioRoute.backFromFallback(spotifyFallbackId, leftId, id,+ com.music.spotui.extensions.Extensions.hasAudioSource(), remote)) return false+ if (id in spotifyPlayed || com.music.spotui.extensions.Extensions.missedLately(id)) {+ spotifyFallbackId = id+ // Spotify plays this one too: the local queue goes on after it.+ fallbackRest = fallbackRest?.takeIf { it.first == leftId }?.let { (_, rest, n) ->+ com.music.spotui.extensions.AudioRoute.resumeList(rest, id)?.let { Triple(id, it.drop(1), n) }+ }+ return false+ }+ app.myspoti.host.android.Logbook.log("audio: back to the extensions for ${target.title}")+ val ctx = _nowPlaying.value.contextUri+ val local = fallbackRest?.takeIf { it.first == leftId }?.let { (_, rest, name) ->+ com.music.spotui.extensions.AudioRoute.resumeList(rest, id)?.let { it to name }+ }+ val name = local?.second ?: knownContextName(ctx)+ val shuffle = isShuffleOn()+ playThroughExtensions(id, target, name, fallback) { isLatest, shown ->+ com.music.spotui.extensions.ExtensionAudio.route(id, local?.first ?: songs, name, shuffle, ctx, isLatest, shown)+ }+ return true+ }++ /** [first] then the engine's songs after it, for the extensions' list. */+ private fun upcomingSongs(first: SongsModel): List<SongsModel> {+ val up = _queue.value.let { it.queued + it.nextUp }.map { it.song }.filter { it.spotifyTrackId.isNotBlank() }+ val from = up.indexOfFirst { it.spotifyTrackId == first.spotifyTrackId }+ return listOf(first) + if (from >= 0) up.drop(from + 1) else up.filter { it.spotifyTrackId != first.spotifyTrackId }+ }++ /**+ * A resume of the engine's paused song with an audio-source extension on (after a launch, the+ * mini player, the notification, headphones) is asked there first, from where it was, with+ * the engine's queue after it; Spotify resumes when they have nothing. False: Spotify resumes.+ */+ private fun resumeThroughExtensions(): Boolean {+ val np = _nowPlaying.value+ if (!np.uri.startsWith(SPOTIFY_TRACK_PREFIX) || _activeDevice.value != null || routing) return false+ val id = trackIdOf(np.uri)+ if (id.isBlank() || id in spotifyPlayed || !com.music.spotui.extensions.Extensions.hasAudioSource()) return false+ val q = _queue.value+ val songs = (listOfNotNull(q.current) + (q.queued + q.nextUp).map { it.song }).takeIf { l -> l.any { it.spotifyTrackId == id } }+ app.myspoti.host.android.Logbook.log("audio: resume of $id asked to the extensions")+ playSong(np.uri, contextUri = np.contextUri.ifBlank { null }, positionMs = getCurrentPosition(), songs = songs)+ return true+ }++ /** The song being resolved, as if it played (paused, loading): screens, notification, lyrics. */+ private fun showRouted(song: SongsModel) {+ val uri = SPOTIFY_TRACK_PREFIX + song.spotifyTrackId+ currentTrackId = song.spotifyTrackId+ durationMs = song.durationMs.toLong()+ val changed = _nowPlaying.value.uri != uri+ if (changed) _nowPlaying.value = NowPlaying(uri = uri, contextName = routingContext)+ // Its real saved state, as for a song Spotify plays: known at once when seen, else asked.+ val liked = likedFor(uri, library[uri] ?: false)+ // Its large cover, as a song Spotify plays shows (the list gave the small one).+ val cover = app.myspoti.host.android.Covers.large(song.coverUri)+ boundState?.let { st ->+ st.likeState.value = liked+ st.updateSongState(cover, song.title, song.singer, false, songIdFor(song.spotifyTrackId, uri), 0, song.album)+ }+ pushNotification(song.copy(coverUri = cover), liked)+ if (changed) refreshCurrentLiked()+ if (com.music.spotui.video.MusicVideoController.inForeground && app.myspoti.power.EnergySettings.state.value.policy.allowBackgroundLookups)+ com.music.spotui.data.api.LyricsApi.prefetch(lyricsTrack(song))+ }++ /** [by]: who asked, for the diagnostic (the app's screens, the media session, an extension...). */+ fun play(by: String = "user") {+ app.myspoti.host.android.Logbook.log("play asked by $by")+ if (routing) return // the song asked for starts by itselfif (LocalPlayer.active.value) { Haptics.click(); LocalPlayer.resume(); return }+ if (resumeThroughExtensions()) { Haptics.click(); return }// Smart shuffle was turned off while paused: the list's order comes back as it plays on.plainOrderDue?.let { if (restorePlainOrder(it)) return }Haptics.click(); intendPlaying(); playing = true; positionAt = SystemClock.elapsedRealtime()@@ -707,7 +926,10 @@ object SongPlayer {}}- fun pause() { Haptics.click(); cancelBurst(); pauseSilently() }+ fun pause(by: String = "user") {+ app.myspoti.host.android.Logbook.log("pause asked by $by")+ Haptics.click(); cancelBurst(); pauseSilently()+ }private fun pauseSilently() {if (LocalPlayer.active.value) { LocalPlayer.pause(); return }@@ -721,6 +943,7 @@ object SongPlayer {Log.d(TAG, "next tapped")Haptics.click()if (LocalPlayer.active.value) { LocalPlayer.next(); return }+ com.music.spotui.extensions.Extensions.skipAsked("forward")// Spotify is refusing licences: every skip asks for one more and makes the limit last// (a tester's log: 183 refusals in 8 min of fast skipping, the page then skipping on its// own through songs it could not play). Nothing is sent until the limit is over.@@ -728,6 +951,10 @@ object SongPlayer {android.widget.Toast.makeText(Graph.app, app.myspoti.engine.R.string.spotify_limited, android.widget.Toast.LENGTH_SHORT).show()return}+ // Off a song Spotify played for want of an extension: the next one is asked there first.+ if (pendingSkips == 0) _queue.value.let { it.queued + it.nextUp }.firstOrNull()?.song?.let { t ->+ if (backToExtensions(t, trackIdOf(_nowPlaying.value.uri), upcomingSongs(t)) { intendPlaying(); transport { api.player.next() } }) return+ }intendPlaying()tapSeq++// The first tap skips at once. Taps that follow it within SKIP_BURST_MS, or within@@ -840,6 +1067,7 @@ object SongPlayer {fun previous() {Haptics.click()if (LocalPlayer.active.value) { LocalPlayer.previous(); return }+ if (getCurrentPosition() <= 3_000) com.music.spotui.extensions.Extensions.skipAsked("backward")intendPlaying()// A previous counts as -1 in the burst. Skips still waiting to be sent (nexts tapped// within SKIP_BURST_MS) just lose one: next, next, previous is one next, and nothing@@ -853,6 +1081,11 @@ object SongPlayer {if (pendingSkips == 0) main.removeCallbacks(sendSkips)return}+ // Off a song Spotify played for want of an extension (a previous that goes back a song).+ if (getCurrentPosition() <= 3_000) _nowPlaying.value.prev?.let { t ->+ val songs = listOf(t) + upcomingSongs(_queue.value.current ?: t).filter { it.spotifyTrackId != t.spotifyTrackId }+ if (backToExtensions(t, trackIdOf(_nowPlaying.value.uri), songs, forward = false) { intendPlaying(); transport { api.player.previous() } }) return+ }cancelBurst()skipSentAt = SystemClock.elapsedRealtime()transport(waitReady = !stateSeen) { api.player.previous() }@@ -873,9 +1106,25 @@ object SongPlayer {/** A transport command waits that long for the page to load before it is dropped. */private const val READY_WAIT_MS = 30_000L- /** Shuffle-play a list: Spotify picks the first track of its own shuffled context. */- fun shufflePlay(songs: List<SongsModel>) {+ /**+ * Shuffle-play a list: Spotify picks the first track of its own shuffled context. With an+ * audio-source extension on, it is asked first for a random song of the list, which then+ * plays shuffled in the local player.+ */+ fun shufflePlay(songs: List<SongsModel>, askExtensions: Boolean = true) {if (songs.isEmpty()) return+ val first = if (askExtensions && com.music.spotui.extensions.Extensions.hasAudioSource()) com.music.spotui.extensions.AudioRoute.shufflePick(songs) else null+ if (askExtensions && first == null) com.music.spotui.extensions.Extensions.audioSkipped()?.let {+ app.myspoti.host.android.Logbook.log("audio: $it, Spotify shuffles the list")+ }+ if (first != null) {+ val ctx = contextRegistry[songs.first().url].orEmpty()+ playThroughExtensions(first.spotifyTrackId, first, knownContextName(ctx), { shufflePlay(songs, askExtensions = false) }) { isLatest, _ ->+ com.music.spotui.extensions.ExtensionAudio.playList(songs, first, knownContextName(ctx), true, ctx, isLatest)+ }+ return+ }+ routeAsk.incrementAndGet(); routingState.value = nullLocalPlayer.stop()val ctx = contextRegistry[songs.first().url]cancelBurst()@@ -927,6 +1176,9 @@ object SongPlayer {return true}+ /** Shuffle as the player shows it (Spotify's, or the local queue's). */+ fun isShuffleOn(): Boolean = if (LocalPlayer.active.value) LocalPlayer.shuffled else boundState?.shuffle?.value == true+fun setShuffle(on: Boolean) {Haptics.toggle(on)if (LocalPlayer.active.value) { LocalPlayer.setShuffle(on); return }@@ -953,9 +1205,24 @@ object SongPlayer {Haptics.toggle(mode != 0)_repeatMode.value = modeboundState?.repeat?.value = mode != 0+ lastTrackPrefs().edit().putInt("repeat", mode.coerceIn(0, 2)).apply()command { api.player.setRepeat(Repeat.entries[mode.coerceIn(0, 2)]) }}+ /**+ * Reported: the repeat button forgets what it was. The mode is the user's choice, kept from+ * one run of the app to the next (the page always starts with repeat off): shown at once and+ * set again on the first song the page reports.+ */+ private fun restoreRepeat(state: CurrentSongState) {+ val p = lastTrackPrefs()+ if (!p.contains("repeat")) return+ val mode = p.getInt("repeat", 0).coerceIn(0, 2)+ _repeatMode.value = mode+ state.repeat.value = mode != 0+ MyspotiRuntime.spotify.player.restoreRepeat(Repeat.entries[mode])+ }+fun cycleRepeat() = setRepeatMode((_repeatMode.value + 1) % 3)/** Podcast playback speed (Spotify refuses it on music). */@@ -1006,9 +1273,10 @@ object SongPlayer {/** Save / remove the current track in Liked Songs. */fun setLiked(on: Boolean) {- if (LocalPlayer.active.value) return // a local file is not in the Spotify library+ // A file of the device is not in the Spotify library; a stream or a download is.+ if (LocalPlayer.active.value && !routing && localSpotifyUri(LocalPlayer.current()) == null) returnHaptics.toggle(on)- val uri = pendingItemUri ?: _nowPlaying.value.uri.ifBlank { if (currentTrackId.isNotBlank()) SPOTIFY_TRACK_PREFIX + currentTrackId else "" }+ val uri = currentLikeUri().ifBlank { if (currentTrackId.isNotBlank()) SPOTIFY_TRACK_PREFIX + currentTrackId else "" }if (uri.isBlank()) { boundState?.likeState?.value = on; return }setSaved(uri, on)}@@ -1041,7 +1309,7 @@ object SongPlayer {if (uri == intentUri && SystemClock.elapsedRealtime() < intentUntil && saved != intentValue) returnlibrary[uri] = savedsavedAt[uri] = SystemClock.elapsedRealtime()- if (uri == (pendingItemUri ?: _nowPlaying.value.uri)) {+ if (uri == currentLikeUri()) {boundState?.likeState?.value = savedpushNotification(null, saved)}@@ -1164,19 +1432,23 @@ object SongPlayer {val track = uri.startsWith(SPOTIFY_TRACK_PREFIX)if (track) likedTaps.tryEmit(trackIdOf(uri) to on)val write = libraryWrites.incrementAndGet()+ // No connection: the change stays on screen and is sent when the network is back.+ if (!com.music.spotui.data.offline.OfflineStore.isOnline(Graph.app)) {+ com.music.spotui.data.LibraryOutbox.put(uri, on)+ return+ }scope.launch {// One write at a time; a refused one is undone on screen if no newer tap replaced it.libraryLock.withLock {- runCatching {- if (uri.startsWith("spotify:playlist:")) {- if (on) api.playlists.follow(uri) else api.playlists.unfollow(uri)- } else {- if (on) api.library.add(listOf(uri)) else api.library.remove(listOf(uri))- }- }.onSuccess {+ runCatching { writeLibrary(uri, on) }.onSuccess {if (track) likedChanges.value++}.onFailure {Log.w(TAG, "library change failed: ${it.message}")+ // The connection went while it was sent: kept for later, like an offline tap.+ if (it is java.io.IOException && !com.music.spotui.data.offline.OfflineStore.isOnline(Graph.app)) {+ com.music.spotui.data.LibraryOutbox.put(uri, on)+ return@withLock+ }if (write == libraryWrites.get()) {intentUntil = 0onLibraryItem(uri, !on)@@ -1190,6 +1462,28 @@ object SongPlayer {private val libraryLock = kotlinx.coroutines.sync.Mutex()private val libraryWrites = java.util.concurrent.atomic.AtomicInteger()+ private suspend fun writeLibrary(uri: String, on: Boolean) {+ if (uri.startsWith("spotify:playlist:")) {+ if (on) api.playlists.follow(uri) else api.playlists.unfollow(uri)+ } else {+ if (on) api.library.add(listOf(uri)) else api.library.remove(listOf(uri))+ }+ }++ /** The library changes made offline ([com.music.spotui.data.LibraryOutbox]), sent once Spotify is reachable. */+ fun startLibraryOutbox(context: Context) = com.music.spotui.data.LibraryOutbox.init(context,+ sender = { uri, on -> libraryLock.withLock { writeLibrary(uri, on) }; if (uri.startsWith(SPOTIFY_TRACK_PREFIX)) likedChanges.value++ },+ onAvailable = { scope.launch { kotlinx.coroutines.delay(3_000); flushLibraryOutbox() } },+ ).also { scope.launch { flushLibraryOutbox() } }++ private suspend fun flushLibraryOutbox() {+ if (com.music.spotui.data.LibraryOutbox.waiting == 0) return+ // The engine is started after the app's graph: wait for it, then for Spotify to answer.+ while (!MyspotiRuntime.isStarted) kotlinx.coroutines.delay(1_000)+ api.ready.first { it }+ com.music.spotui.data.LibraryOutbox.flush()+ }+// ── Music video: Spotify's own clips are not played by this engine; the YouTube// clips (MusicVideoController) are. These keep the player screen's contract. ──data class VideoState(val available: Boolean = false, val on: Boolean = false, val ready: Boolean = false, val aspect: Float = 0f, val placed: Boolean = false)@@ -1306,6 +1600,23 @@ object SongPlayer {Haptics.confirm()chosenRemote = if (device.isSelf) null else device.id_activeDevice.value = if (device.isSelf) null else device+ // A downloaded or streamed song plays in Myspoti's own player, which no other device can+ // reach: the device gets the same Spotify song, list and place, played by Spotify.+ val trackId = currentTrackId+ if (!device.isSelf && LocalPlayer.active.value && trackId.isNotBlank()) {+ val track = SPOTIFY_TRACK_PREFIX + trackId+ val context = LocalPlayer.contextUri.ifBlank { track }+ val at = LocalPlayer.position()+ val wasPlaying = LocalPlayer.isPlaying()+ Log.i(TAG, "local song to ${device.name}: $track in $context at $at ms")+ LocalPlayer.stop()+ command {+ api.devices.transfer(device.id)+ api.player.play(context, trackUri = track.takeIf { it != context }, positionMs = at)+ if (!wasPlaying) api.player.pause()+ }+ return+ }command { if (device.isSelf) api.devices.pullHere() else api.devices.transfer(device.id) }}@@ -1404,15 +1715,29 @@ object SongPlayer {fun playNext(trackId: String) {if (trackId.isBlank()) returnHaptics.confirm()+ if (LocalPlayer.active.value) { localQueue(trackId, next = true); return }command { api.player.playNext(listOf(SPOTIFY_TRACK_PREFIX + trackId)) }}fun addToQueue(trackId: String) {if (trackId.isBlank()) returnHaptics.confirm()+ if (LocalPlayer.active.value) { localQueue(trackId, next = false); return }command { api.player.addToQueue(listOf(SPOTIFY_TRACK_PREFIX + trackId)) }}+ /**+ * While the local player plays, the paused engine's queue would never be heard: the song goes+ * into the local queue, and only one neither a download nor an extension has goes to Spotify.+ */+ private fun localQueue(trackId: String, next: Boolean) {+ scope.launch {+ if (com.music.spotui.extensions.ExtensionAudio.enqueue(trackId, next)) return@launch+ val uris = listOf(SPOTIFY_TRACK_PREFIX + trackId)+ command { if (next) api.player.playNext(uris) else api.player.addToQueue(uris) }+ }+ }+fun skipTo(item: QueueItem) {if (item.provider == LOCAL) { item.uid.toIntOrNull()?.let(LocalPlayer::skipTo); return }cancelBurst()@@ -1427,6 +1752,7 @@ object SongPlayer {/** "Clear queue": drops the tracks the user queued (not the context's next ones). */fun clearQueue() {+ if (LocalPlayer.active.value) { LocalPlayer.clearQueued(); return }_queue.value = _queue.value.copy(queued = emptyList())command { api.player.clearQueue() }}@@ -1436,7 +1762,7 @@ object SongPlayer {if (item.provider == LOCAL) {val from = item.uid.toIntOrNull() ?: returnval t = target.uid.toIntOrNull() ?: return- LocalPlayer.move(from, if (after) (if (from < t) t else t + 1) else (if (from < t) t - 1 else t))+ LocalPlayer.moveBeside(from, t, after)return}// Read when the edit runs, after the ones before it: never a row id that has gone stale.@@ -1458,7 +1784,7 @@ object SongPlayer {* other (both at once left it in both places), then placed where it was dropped.*/fun moveIntoQueue(item: QueueItem, target: QueueItem?, after: Boolean) {- if (item.provider == LOCAL) { item.uid.toIntOrNull()?.let(LocalPlayer::moveNext); return }+ if (item.provider == LOCAL) { item.uid.toIntOrNull()?.let { LocalPlayer.moveIntoQueue(it, target?.uid?.toIntOrNull(), after) }; return }queueCommand {val a = apiItem(item) ?: return@queueCommandval first = apiQueue?.queued?.firstOrNull()@@ -1484,11 +1810,11 @@ object SongPlayer {}}- fun isPlaying(): Boolean = if (LocalPlayer.active.value) LocalPlayer.isPlaying() else playing- fun getDuration(): Long = if (LocalPlayer.active.value) LocalPlayer.duration() else durationMs+ fun isPlaying(): Boolean = if (LocalPlayer.active.value && !routing) LocalPlayer.isPlaying() else playing+ fun getDuration(): Long = if (LocalPlayer.active.value && !routing) LocalPlayer.duration() else durationMsfun getCurrentPosition(): Long {- if (LocalPlayer.active.value) return LocalPlayer.position()+ if (LocalPlayer.active.value && !routing) return LocalPlayer.position()val base = positionMsif (!playing || isBuffering) return baseval now = base + (SystemClock.elapsedRealtime() - positionAt)@@ -1497,8 +1823,11 @@ object SongPlayer {/** A local file starts: Spotify pauses (wherever it plays). */fun pauseEngineForLocal() {+ // A song the extensions were asked for has its answer, or other files play: older answers play nothing.+ routeAsk.incrementAndGet(); routingState.value = nulllocalStartedAt = SystemClock.elapsedRealtime()- engineUriBeforeLocal = _nowPlaying.value.uri+ // What the page reported last (the screens may already show the song asked for).+ engineUriBeforeLocal = lastPageUriengineRepaused = falseif (playing) command { api.player.pause() }playing = false@@ -1536,35 +1865,80 @@ object SongPlayer {/** The local player's track / state, shown like any other (player, mini player, notification). */fun onLocalState(t: com.music.spotui.data.local.LocalTrack, isPlaying: Boolean, pos: Long, dur: Long) {main.post {- currentTrackId = ""+ // A state of what played before the song now being asked for, or of a song already left.+ if (routing || LocalPlayer.current() !== t) return@post+ val trackId = streamedTrackId(t)+ // A download keeps its Spotify id too (likes, menu): only a file of the device has none.+ currentTrackId = trackId.ifBlank { localSpotifyUri(t)?.let(::trackIdOf).orEmpty() }playing = isPlaying; positionMs = pos; positionAt = SystemClock.elapsedRealtime(); durationMs = durbufferingState.value = false- val uri = "local:${t.id}"- if (_nowPlaying.value.uri != uri) _nowPlaying.value = NowPlaying(uri = uri, contextName = LocalPlayer.contextName)+ // A song an extension streams keeps its Spotify uri: its lyrics, Canvas and artists load as for Spotify.+ val uri = if (trackId.isNotBlank()) SPOTIFY_TRACK_PREFIX + trackId else "local:${t.id}"+ val songChanged = _nowPlaying.value.uri != uri+ // From the list, its song radio, or the songs the user queued (as Spotify's player says).+ val shown = NowPlaying(uri = uri, contextUri = LocalPlayer.contextUri, contextName = LocalPlayer.contextName,+ provider = if (LocalPlayer.fromQueue()) "queue" else "")+ if (_nowPlaying.value.let { it.uri != uri || it.contextUri != shown.contextUri || it.contextName != shown.contextName || it.provider != shown.provider })+ _nowPlaying.value = shownval song = localSong(t, dur)+ val likeUri = localSpotifyUri(t)+ val liked = likeUri?.let { likedFor(it, library[it] ?: false) } ?: false+ // Its large cover, as a song Spotify plays shows (the queue keeps the small one).+ val cover = app.myspoti.host.android.Covers.large(song.coverUri)boundState?.let { st ->- st.likeState.value = false- st.updateSongState(song.coverUri, song.title, song.singer, isPlaying, song.id, 0, song.album)+ st.likeState.value = liked+ st.updateSongState(cover, song.title, song.singer, isPlaying, song.id, 0, song.album)}- pushNotification(song, false)+ pushNotification(song.copy(coverUri = cover), liked)+ if (songChanged) refreshCurrentLiked()val source = if (t.uri.scheme == "file") com.music.spotui.data.local.ListenHistory.Source.DOWNLOADelse com.music.spotui.data.local.ListenHistory.Source.LOCAL- trackListen(uri, song, source, isPlaying)+ trackListen("local:${t.id}", song, source, isPlaying)}}- private fun localSong(t: com.music.spotui.data.local.LocalTrack, dur: Long = t.durationMs) =- SongsModel(id = ("local:" + t.id).hashCode() and 0x7fffffff, title = t.title, album = t.album,- singer = t.artist, coverUri = t.artUri.toString(), url = "local:${t.uri}", durationMs = dur.toInt())+ /** The Spotify uri of what the local player plays: a song an extension streams or a download; null for a file of the device. */+ private fun localSpotifyUri(t: com.music.spotui.data.local.LocalTrack?): String? {+ t ?: return null+ return LocalPlayer.spotifyIdOf(t).takeIf { it.isNotBlank() }?.let { SPOTIFY_TRACK_PREFIX + it }+ }++ /** The uri a like of the song shown saves ("" or a local: uri for a file of the device). */+ private fun currentLikeUri(): String = when {+ routing -> _nowPlaying.value.uri+ LocalPlayer.active.value -> localSpotifyUri(LocalPlayer.current()).orEmpty()+ else -> pendingItemUri ?: _nowPlaying.value.uri+ }- /** The local player's queue: [upcoming] are the songs after [current], with their list index as uid. */- fun onLocalQueue(current: com.music.spotui.data.local.LocalTrack, upcoming: List<Pair<Int, com.music.spotui.data.local.LocalTrack>>) {+ /**+ * The song shown can be liked: anything with a Spotify id (from Spotify, an extension's stream,+ * a download); not a file of the device. Read by the screens (state: recomposes as it changes).+ */+ val canLike: Boolean get() {+ val uri = _nowPlaying.value.uri+ if (!LocalPlayer.active.value || !uri.startsWith("local:")) return true+ return uri.removePrefix("local:").toLongOrNull()?.let { com.music.spotui.data.offline.OfflineStore.byLocalId(it) } != null+ }++ /** The Spotify id of a song an extension streams (audio-source), "" for files. */+ private fun streamedTrackId(t: com.music.spotui.data.local.LocalTrack) =+ t.uri.takeIf { it.scheme == com.music.spotui.extensions.ExtensionAudio.SCHEME }?.lastPathSegment.orEmpty()++ private fun localSong(t: com.music.spotui.data.local.LocalTrack, dur: Long = t.durationMs): SongsModel {+ val trackId = streamedTrackId(t)+ return SongsModel(id = if (trackId.isNotBlank()) songIdFor(trackId, "") else ("local:" + t.id).hashCode() and 0x7fffffff, title = t.title, album = t.album,+ singer = t.artist, coverUri = t.artUri.toString(), url = "local:${t.uri}", durationMs = dur.toInt(), spotifyTrackId = trackId)+ }++ /**+ * The local player's queue: [upcoming] are the songs after [current], with their list index as+ * uid; its first [queuedCount] are the ones the user queued ("Next in queue"), the rest the list's.+ */+ fun onLocalQueue(current: com.music.spotui.data.local.LocalTrack, upcoming: List<Pair<Int, com.music.spotui.data.local.LocalTrack>>, queuedCount: Int = 0) {main.post {if (!LocalPlayer.active.value) return@post- _queue.value = EngineQueue(- current = localSong(current),- nextUp = upcoming.map { (i, t) -> QueueItem(localSong(t), "local:${t.id}", i.toString(), LOCAL) },- )+ val items = upcoming.map { (i, t) -> QueueItem(localSong(t), "local:${t.id}", i.toString(), LOCAL) }+ _queue.value = EngineQueue(current = localSong(current), queued = items.take(queuedCount), nextUp = items.drop(queuedCount))}}diff --git a/base/app/src/main/java/com/music/spotui/extensions/AudioRoute.kt b/base/app/src/main/java/com/music/spotui/extensions/AudioRoute.ktnew file mode 100644index 00000000..3b7be984--- /dev/null+++ b/base/app/src/main/java/com/music/spotui/extensions/AudioRoute.kt@@ -0,0 +1,137 @@+package com.music.spotui.extensions++import app.myspoti.extensions.AudioStream+import com.music.spotui.data.entity.SongsModel+import java.io.IOException++/**+ * How a play goes through the `audio-source` extensions before Spotify (docs/extensions/API.md+ * §3), wherever it starts: a list, a search result, an artist, Recents, a link, an extension's+ * block, shuffle. Without Android: [ExtensionAudio] plays what this decides.+ */+object AudioRoute {+ /** Whether a play of [trackId] asks the extensions first. Episodes and plays without an id never do. */+ fun asks(trackId: String?, hasAudioSource: Boolean): Boolean = hasAudioSource && !trackId.isNullOrBlank()++ /**+ * Whether the song [targetId] played after [currentId] (a next, a previous, the engine moving+ * on) is asked to the extensions again: [currentId] is the song Spotify played because none had+ * it ([fallbackId]), only that one falls back. Never on another device ([remote]).+ */+ fun backFromFallback(fallbackId: String?, currentId: String, targetId: String?, hasAudioSource: Boolean, remote: Boolean): Boolean =+ hasAudioSource && !remote && !fallbackId.isNullOrBlank() && fallbackId == currentId && !targetId.isNullOrBlank() && targetId != currentId++ /**+ * The songs to play when [trackId] is picked: [given] when it holds it (a list, a search+ * result), else the song alone as [lookup] finds it (a link, a block: only the uri is known).+ * Null: no song to give the extensions, Spotify plays.+ */+ suspend fun songsFor(trackId: String, given: List<SongsModel>?, lookup: suspend () -> SongsModel?): List<SongsModel>? {+ if (given != null && given.any { it.spotifyTrackId == trackId }) return given+ val one = lookup()?.takeIf { it.spotifyTrackId == trackId } ?: return null+ return listOf(one)+ }++ /**+ * The local player's queue: the playable songs with a Spotify id, once each, in order, and+ * where the picked one is in it (it is kept even when marked unplayable: it was picked).+ */+ fun queue(songs: List<SongsModel>, picked: SongsModel): Pair<List<SongsModel>, Int> {+ val list = songs.filter { it.spotifyTrackId.isNotBlank() && (it.playable || it.spotifyTrackId == picked.spotifyTrackId) }+ .distinctBy { it.spotifyTrackId }+ .ifEmpty { listOf(picked) }+ return list to list.indexOfFirst { it.spotifyTrackId == picked.spotifyTrackId }.coerceAtLeast(0)+ }++ /**+ * Back to the extensions after one song Spotify played for want of them: the local queue as it+ * was after that song ([rest]: queued songs, list, song radio, in play order) from the song the+ * engine moved on to ([targetId]); null when the engine went elsewhere (its own list is used then).+ */+ fun resumeList(rest: List<SongsModel>, targetId: String): List<SongsModel>? =+ rest.indexOfFirst { it.spotifyTrackId == targetId }.takeIf { it >= 0 }?.let { rest.drop(it) }++ /**+ * Whether the local queue goes on after its last song as Spotify does after a list or a song+ * played alone (its song radio): a queue the extensions play ([fromExtensions]) whose last+ * song has a Spotify id ([lastId]), without repeat all (it loops) and with autoplay on. Files+ * of the device never do.+ */+ fun continues(fromExtensions: Boolean, lastId: String?, repeatAll: Boolean, autoplay: Boolean): Boolean =+ fromExtensions && !repeatAll && autoplay && !lastId.isNullOrBlank()++ /** The songs the queue goes on with: [radio]'s playable ones with an id, once each, none of [queued] again. */+ fun continuation(radio: List<SongsModel>, queued: Collection<String>): List<SongsModel> =+ radio.filter { it.spotifyTrackId.isNotBlank() && it.playable && it.spotifyTrackId !in queued }.distinctBy { it.spotifyTrackId }++ /**+ * Opens the stream an extension gave: [ask] answers it (`again`: the cached answer is dropped+ * and the extension asked once more), [open] reads it. A server that refuses the address+ * (HTTP 401, 403, 404 or 410, read by [status] from the error: expired or gone) gets one more answer, then the song fails+ * cleanly with a [NoAudioException] (never retried by the player: each try would ask the+ * extensions again); any other error is thrown as it is.+ */+ fun <T> openStream(ask: (again: Boolean) -> AudioStream?, open: (AudioStream) -> T, status: (Throwable) -> Int?): T {+ val first = ask(false) ?: throw NoAudioException("no extension has the audio of this song")+ return try {+ open(first)+ } catch (e: IOException) {+ val code = refusal(e, status) ?: throw e+ val again = ask(true) ?: throw NoAudioException("the extension's address was refused (HTTP $code), and it gave no other", e)+ try {+ open(again)+ } catch (e2: IOException) {+ val code2 = refusal(e2, status) ?: throw e2+ throw NoAudioException("the extension's address was refused again (HTTP $code2)", e2)+ }+ }+ }++ /** The statuses of an address that expired or is gone: the extension is asked once more. */+ private val REFUSED = setOf(401, 403, 404, 410)++ /** One of [REFUSED] in [e] or one of its causes, else null. */+ private fun refusal(e: Throwable, status: (Throwable) -> Int?): Int? =+ generateSequence(e) { it.cause }.take(8).mapNotNull(status).firstOrNull { it in REFUSED }++ /** The first song of a shuffle play: any playable song with an id, or null (Spotify shuffles). */+ fun shufflePick(songs: List<SongsModel>, random: kotlin.random.Random = kotlin.random.Random.Default): SongsModel? =+ songs.filter { it.spotifyTrackId.isNotBlank() && it.playable }.randomOrNull(random)++ /** True when [e] or one of its causes says no extension gave usable audio ([NoAudioException]). */+ fun isNoAudio(e: Throwable?): Boolean = generateSequence(e) { it.cause }.take(8).any { it is NoAudioException }+}++/** No extension gave audio for the song, or the address it gave was refused twice: Spotify plays it. */+class NoAudioException(message: String, cause: Throwable? = null) : IOException(message, cause)++/**+ * The songs no extension had audio for, so they are not asked again for [keepMs] (a queue that+ * reaches them, a replay, a resume): a miss asked ahead ([ahead]) only keeps further asks ahead+ * away, the ask when the song starts still goes out. [clear] when an extension is live again or+ * changes (loaded, stopped). [clock]: ms.+ */+class AudioMisses(private val keepMs: Long = 60_000L, private val clock: () -> Long = System::currentTimeMillis) {+ private class Miss(val at: Long, val ahead: Boolean)+ private val misses = java.util.concurrent.ConcurrentHashMap<String, Miss>()++ fun record(trackId: String, ahead: Boolean) {+ if (trackId.isBlank()) return+ // A miss when the song starts is never weakened by a later one ahead.+ misses.compute(trackId) { _, m -> if (ahead && m != null && !m.ahead && fresh(m)) m else Miss(clock(), ahead) }+ }++ /** Whether an ask for [trackId] ([ahead] or when it starts) is skipped: a recent miss covers it. */+ fun skips(trackId: String, ahead: Boolean): Boolean {+ val m = misses[trackId] ?: return false+ if (!fresh(m)) { misses.remove(trackId, m); return false }+ return ahead || !m.ahead+ }++ /** A song the extensions answered after all. */+ fun forget(trackId: String) { misses.remove(trackId) }++ fun clear() = misses.clear()++ private fun fresh(m: Miss) = clock() - m.at < keepMs+}diff --git a/base/app/src/main/java/com/music/spotui/extensions/ExtensionAudio.kt b/base/app/src/main/java/com/music/spotui/extensions/ExtensionAudio.ktnew file mode 100644index 00000000..c9c3cb0c--- /dev/null+++ b/base/app/src/main/java/com/music/spotui/extensions/ExtensionAudio.kt@@ -0,0 +1,217 @@+package com.music.spotui.extensions++import android.net.Uri+import app.myspoti.extensions.AudioStream+import app.myspoti.extensions.TrackInfo+import com.music.spotui.data.entity.SongsModel+import com.music.spotui.data.local.LocalTrack+import com.music.spotui.data.offline.OfflineStore+import com.music.spotui.di.LocalPlayer+import kotlinx.coroutines.Dispatchers+import kotlinx.coroutines.flow.first+import kotlinx.coroutines.withContext+import java.util.concurrent.ConcurrentHashMap++/**+ * The `audio-source` hook: a list's songs play in Myspoti's own player, like downloads, from+ * where an extension says their audio is (docs/extensions/API.md §3). Each song is a+ * `myspoti-ext://track/<id>?…` item; the player's data source ([resolve]) asks the extensions+ * when it opens it, on its loading thread. A song no extension has audio for is played by Spotify.+ */+object ExtensionAudio {+ const val SCHEME = "myspoti-ext"+ /**+ * An answer is reused for seeks and replays a while, then asked again (addresses expire): at+ * most this long, less when the extension says when it expires ([AudioStream.expiresInMs]).+ */+ private const val KEEP_MS = 10 * 60_000L++ private class Known(val stream: AudioStream, val at: Long = System.currentTimeMillis()) {+ val fresh get() = System.currentTimeMillis() - at < stream.keepMs(KEEP_MS)+ }+ private val known = ConcurrentHashMap<String, Known>()++ fun uri(s: SongsModel): Uri = Uri.Builder().scheme(SCHEME).authority("track").appendPath(s.spotifyTrackId)+ .appendQueryParameter("title", s.title).appendQueryParameter("artist", s.singer)+ .appendQueryParameter("album", s.album).appendQueryParameter("duration", s.durationMs.toString())+ .appendQueryParameter("cover", s.coverUri).build()++ private fun track(u: Uri): TrackInfo = Extensions.trackInfo(+ u.lastPathSegment.orEmpty(), u.getQueryParameter("title").orEmpty(), u.getQueryParameter("artist").orEmpty(),+ u.getQueryParameter("album").orEmpty(), u.getQueryParameter("duration")?.toLongOrNull() ?: 0, u.getQueryParameter("cover"),+ )++ /**+ * Where the sound of [t] comes from, for the player: "<extension> · FLAC · 24-bit · 96 kHz" for+ * a stream (the name in its manifest, then the quality it announced, nothing it did not say),+ * "Downloaded · <source> · <extension>" for a download; "" for the phone's own files and while+ * the stream's answer is not known yet.+ */+ fun sourceLabel(t: LocalTrack, downloaded: String): String {+ OfflineStore.byLocalId(t.id)?.takeIf { t.uri.scheme == "file" }?.let { o ->+ return listOfNotNull(downloaded, o.source.ifBlank { null }, extensionName(o.providerId)).distinct().joinToString(" · ")+ }+ if (t.uri.scheme != SCHEME) return ""+ val s = known[t.uri.lastPathSegment.orEmpty()]?.stream ?: return ""+ return listOfNotNull(extensionName(s.providerId), s.qualityLabel()).joinToString(" · ")+ }++ /** The name (from its manifest) of the extension streaming [t], or null (a file, not answered yet). */+ fun streamedBy(t: LocalTrack): String? =+ t.uri.takeIf { it.scheme == SCHEME }?.let { known[it.lastPathSegment.orEmpty()]?.stream?.providerId }?.let(::extensionName)++ private fun extensionName(id: String?): String? = id?.let { Extensions.registry.value.find(it)?.name }++ /** Bumped with each answer kept: the player's source line reads it to show an answer that came after the song changed. */+ val answers = androidx.compose.runtime.mutableIntStateOf(0)++ private fun keep(trackId: String, stream: AudioStream) {+ known[trackId] = Known(stream)+ answers.intValue+++ }++ private val warming = ConcurrentHashMap.newKeySet<String>()++ /**+ * A page just opened: the first of its [songs] are asked ahead, and a DASH answer's index and+ * first segment fetched, so a tap starts at once. 3 songs on Wi-Fi, 1 on mobile data; none+ * offline or with the data saver on. A song asked a moment ago is not asked again.+ */+ suspend fun warm(songs: List<SongsModel>) {+ if (!Extensions.hasAudioSource() || com.music.spotui.data.DataSaver.active || !OfflineStore.isOnline(com.music.spotui.di.Graph.app)) return+ if (com.music.spotui.di.SongPlayer.activeDevice.value != null) return+ val count = if (com.music.spotui.data.DataSaver.metered) 1 else 3+ songs.asSequence()+ .filter { it.spotifyTrackId.isNotBlank() && it.playable && !OfflineStore.isDownloaded(it.spotifyTrackId) }+ .filter { known[it.spotifyTrackId]?.fresh != true }+ .take(count).toList()+ .forEach { s ->+ if (!warming.add(s.spotifyTrackId)) return@forEach+ try {+ val a = withContext(Dispatchers.IO) {+ Extensions.audio(Extensions.trackInfo(s.spotifyTrackId, s.title, s.singer, s.album, s.durationMs.toLong(), s.coverUri))+ } ?: return@forEach+ keep(s.spotifyTrackId, a)+ a.manifest?.let { m ->+ withContext(Dispatchers.IO) {+ runCatching { com.music.spotui.data.offline.DashLive.open(m, a.headers, com.music.spotui.data.offline.OfflineDownloader.DownloadUa).warm() }+ }+ }+ } finally {+ warming.remove(s.spotifyTrackId)+ }+ }+ }++ /** The extension that gave the audio of the song with Spotify id [trackId] last, or null. */+ fun providerOf(trackId: String): String? = known[trackId]?.stream?.providerId++ /** The quality the extension announced for the song [trackId] ("FLAC · 24-bit · 96 kHz"), or null. */+ fun qualityOf(trackId: String): String? = known[trackId]?.stream?.qualityLabel()++ /**+ * For the player's data source: the audio of a `myspoti-ext:` item, or null. Blocks.+ * [again]: the answer kept is dropped and the extensions are asked anew (its address was refused).+ * [ahead]: asked before the song plays (the extension is told so).+ */+ fun resolve(u: Uri, again: Boolean = false, ahead: Boolean = false): AudioStream? {+ val key = u.lastPathSegment.orEmpty()+ if (again) known.remove(key)+ known[key]?.takeIf { it.fresh }?.let { return it.stream }+ // The song skipped to while its ask ahead is still out: that answer is waited for rather+ // than a second ask (which cost the source a request and the song seconds); only a miss+ // ahead is asked again, as the song now plays.+ if (!again) asking[key]?.let { pending ->+ runCatching { pending.get(Extensions.AUDIO_MS, java.util.concurrent.TimeUnit.MILLISECONDS) }.getOrNull()?.let { return it }+ }+ val mine = java.util.concurrent.CompletableFuture<AudioStream?>()+ asking[key] = mine+ return try {+ Extensions.audioBlocking(track(u), ahead)?.also { keep(key, it) }.also { mine.complete(it) }+ } catch (t: Throwable) {+ mine.complete(null); throw t+ } finally {+ asking.remove(key, mine)+ }+ }++ /** The asks out now, by song: a second ask of the same song waits for the first. */+ private val asking = java.util.concurrent.ConcurrentHashMap<String, java.util.concurrent.CompletableFuture<AudioStream?>>()++ /**+ * Plays [songs] from [picked] in the local player when an extension has the picked song's+ * audio (asked first, so a miss falls back to Spotify at once); the rest of [songs] is the+ * queue (see [AudioRoute.queue]). Downloaded songs play from their file. False: no extension+ * had it, the caller plays through Spotify. [isLatest] false once the answer came: a newer+ * song was asked for meanwhile, nothing plays (see SongPlayer.playThroughExtensions).+ * [startMs]: where in the picked song it starts (a resume).+ */+ suspend fun playList(+ songs: List<SongsModel>, picked: SongsModel, context: String, shuffle: Boolean, contextUri: String = "",+ isLatest: () -> Boolean = { true }, startMs: Long = 0L,+ ): Boolean {+ if (picked.spotifyTrackId.isBlank() || !Extensions.hasAudioSource()) return false+ // Another Spotify Connect device plays: the song goes there, played by Spotify.+ if (com.music.spotui.di.SongPlayer.activeDevice.value != null) return false+ // A song asked ahead (the next one of the queue) is not asked again: the extension would+ // take a second ask for a refused address and resolve it anew.+ val first = known[picked.spotifyTrackId]?.takeIf { it.fresh }?.stream ?: withContext(Dispatchers.IO) {+ Extensions.audio(Extensions.trackInfo(picked.spotifyTrackId, picked.title, picked.singer, picked.album, picked.durationMs.toLong(), picked.coverUri))+ } ?: return false+ keep(picked.spotifyTrackId, first)+ val (list, at) = AudioRoute.queue(songs, picked)+ val tracks = list.map(::localTrack)+ return withContext(Dispatchers.Main) {+ isLatest().also {+ if (it) LocalPlayer.play(tracks, at, shuffle = shuffle, context = context, contextUri = contextUri, startMs = startMs, continues = true)+ else app.myspoti.host.android.Logbook.log("audio: ${picked.title} answered after a newer pick, not played")+ }+ }+ }++ /** The local player's item for [s]: its file when downloaded, else asked to the extensions when it plays. */+ fun localTrack(s: SongsModel): LocalTrack =+ OfflineStore.tracks[s.spotifyTrackId]?.takeIf { OfflineStore.isDownloaded(s.spotifyTrackId) }?.let(OfflineStore::toLocalTrack) ?: LocalTrack(+ id = OfflineStore.localIdOf(s.spotifyTrackId), uri = uri(s), title = s.title, artist = s.singer,+ album = s.album, durationMs = s.durationMs.toLong(), artUri = Uri.parse(s.coverUri),+ )++ /**+ * Any play of the song [trackId] (SongPlayer.playSong): [songs] when the caller has the list+ * or the song, else the song as Spotify describes it ([shown] once known), then [playList].+ * False: Spotify plays.+ */+ suspend fun route(+ trackId: String, songs: List<SongsModel>?, context: String, shuffle: Boolean, contextUri: String,+ isLatest: () -> Boolean = { true }, shown: (SongsModel) -> Unit = {}, startMs: Long = 0L,+ ): Boolean {+ val list = AudioRoute.songsFor(trackId, songs) { lookup(trackId) }+ ?: run { app.myspoti.host.android.Logbook.log("audio: $trackId not found on Spotify, the extensions are not asked"); return false }+ val picked = list.first { it.spotifyTrackId == trackId }+ if (songs?.any { it.spotifyTrackId == trackId } != true) shown(picked)+ return playList(list, picked, context, shuffle, contextUri, isLatest, startMs)+ }++ /**+ * "Play next" / "Add to queue" while the local player plays: the song joins its queue (its+ * download, else the extension's stream). False: neither has it, Spotify's queue takes it.+ */+ suspend fun enqueue(trackId: String, next: Boolean): Boolean {+ val downloaded = OfflineStore.tracks[trackId]?.takeIf { OfflineStore.isDownloaded(trackId) }?.let(OfflineStore::toLocalTrack)+ val track = downloaded ?: if (Extensions.hasAudioSource()) lookup(trackId)?.let(::localTrack) else null+ track ?: return false+ withContext(Dispatchers.Main) { LocalPlayer.enqueue(track, next) }+ return true+ }++ /** The song's title, artists, album and length from Spotify, for a play that knows only its uri. */+ private suspend fun lookup(trackId: String): SongsModel? = runCatching {+ kotlinx.coroutines.withTimeout(LOOKUP_MS) {+ val api = app.myspoti.host.android.MyspotiRuntime.api+ api.ready.first { it }+ com.music.spotui.di.Graph.api.songOf(api.catalog.track("spotify:track:$trackId"))+ }+ }.getOrNull()++ private const val LOOKUP_MS = 10_000L+}diff --git a/base/app/src/main/java/com/music/spotui/extensions/ExtensionAuth.kt b/base/app/src/main/java/com/music/spotui/extensions/ExtensionAuth.ktnew file mode 100644index 00000000..9b197d0c--- /dev/null+++ b/base/app/src/main/java/com/music/spotui/extensions/ExtensionAuth.kt@@ -0,0 +1,240 @@+package com.music.spotui.extensions++import android.annotation.SuppressLint+import android.graphics.Bitmap+import android.os.Message+import android.webkit.WebChromeClient+import android.webkit.WebResourceError+import android.webkit.WebResourceRequest+import android.webkit.WebView+import android.webkit.WebViewClient+import androidx.activity.compose.BackHandler+import androidx.compose.foundation.background+import androidx.compose.foundation.clickable+import androidx.compose.foundation.interaction.MutableInteractionSource+import androidx.compose.foundation.layout.Column+import androidx.compose.foundation.layout.Row+import androidx.compose.foundation.layout.fillMaxSize+import androidx.compose.foundation.layout.fillMaxWidth+import androidx.compose.foundation.layout.imePadding+import androidx.compose.foundation.layout.navigationBarsPadding+import androidx.compose.foundation.layout.padding+import androidx.compose.foundation.layout.offset+import androidx.compose.foundation.layout.statusBarsPadding+import androidx.compose.material.icons.Icons+import androidx.compose.material.icons.rounded.Close+import androidx.compose.material.icons.rounded.Lock+import androidx.compose.material3.Icon+import androidx.compose.material3.IconButton+import androidx.compose.material3.Text+import androidx.compose.runtime.Composable+import androidx.compose.runtime.LaunchedEffect+import androidx.compose.runtime.collectAsState+import androidx.compose.runtime.getValue+import androidx.compose.runtime.key+import androidx.compose.runtime.mutableStateOf+import androidx.compose.runtime.remember+import androidx.compose.runtime.setValue+import androidx.compose.ui.Alignment+import androidx.compose.ui.Modifier+import androidx.compose.ui.draw.alpha+import androidx.compose.ui.res.stringResource+import androidx.compose.ui.text.style.TextOverflow+import androidx.compose.ui.unit.IntOffset+import androidx.compose.ui.unit.dp+import androidx.compose.ui.unit.sp+import androidx.compose.ui.viewinterop.AndroidView+import androidx.webkit.ProfileStore+import androidx.webkit.WebViewCompat+import androidx.webkit.WebViewFeature+import app.myspoti.engine.R+import app.myspoti.extensions.AuthRequest+import app.myspoti.extensions.AuthResult+import com.music.spotui.ui.theme.AppMuted+import com.music.spotui.ui.theme.AppText+import com.music.spotui.ui.theme.tone+import kotlinx.coroutines.delay+import kotlinx.coroutines.flow.MutableStateFlow+import java.util.concurrent.atomic.AtomicInteger++/**+ * Sign-in pages of extensions (`webview.auth`): one at a time, full screen, in a web view whose+ * profile belongs to that extension, so its cookies are never the app's or Spotify's and stay+ * between two sign-ins of the same extension. Nothing is injected in the page and nothing of it is+ * read but the address: when the page goes to the callback, it closes and the extension gets that+ * address (`auth` event). The extension's own page (`webview.page`) stays locked as it is.+ *+ * A hidden sign-in ([AuthRequest.hidden]) runs the same web view out of sight first: a check that+ * passes by itself (a redirect, an invisible captcha) ends without any screen. If it has not reached+ * the callback after [AuthRequest.HIDDEN_MS], the very same page (nothing reloaded) is shown with its+ * Close button. Whatever the mode, it ends after [AuthRequest.TIMEOUT_MS] with "timeout", and a page+ * that cannot be loaded ends with "network: …".+ */+object ExtensionAuth {+ class Open(val extensionId: String, val id: String, val request: AuthRequest) {+ /** Shown to the user: at once, or once a hidden sign-in needed them. */+ val visible = MutableStateFlow(!request.hidden)+ }++ val open = MutableStateFlow<Open?>(null)+ private val counter = AtomicInteger()++ /** Shows [request] for [extensionId]; its id. Throws when it cannot be shown now. */+ fun open(extensionId: String, request: AuthRequest): String {+ check(WebViewFeature.isFeatureSupported(WebViewFeature.MULTI_PROFILE)) {+ "this phone's WebView cannot keep sign-in pages apart (update Android System WebView)"+ }+ val o = Open(extensionId, "auth-${counter.incrementAndGet()}", request)+ synchronized(this) {+ check(open.value == null) { "a sign-in page is already open" }+ open.value = o+ }+ Extensions.log(extensionId, "sign-in ${o.id} opened on ${java.net.URI(request.url).host}" + if (request.hidden) " (hidden)" else "")+ return o.id+ }++ /** Closes [o] and tells its extension: [url] when the callback was reached, else [error]. */+ fun finish(o: Open, url: String?, error: String? = null) {+ synchronized(this) { if (open.value !== o) return; open.value = null }+ Extensions.authDone(o.extensionId, AuthResult(o.id, url = url, error = if (url == null) error ?: "closed" else null))+ }++ /** The extension stopped: its page goes, without an answer. */+ fun cancel(extensionId: String) = synchronized(this) { if (open.value?.extensionId == extensionId) open.value = null }++ /** The web view profile of [extensionId]: its own cookies and storage. */+ fun profile(extensionId: String) = "ext-auth-" + extensionId.replace(Regex("[^A-Za-z0-9._-]"), "_")+}++/** Above every screen (MainActivity's root box): the open sign-in, hidden or full screen. */+@Composable+fun ExtensionAuthHost() {+ val o by ExtensionAuth.open.collectAsState()+ val current = o ?: return+ key(current) { AuthPage(current) }+}++@Composable+private fun AuthPage(current: ExtensionAuth.Open) {+ val visible by current.visible.collectAsState()+ val name = Extensions.registry.value.find(current.extensionId)?.name ?: current.extensionId+ var host by remember { mutableStateOf(runCatching { java.net.URI(current.request.url).host }.getOrNull().orEmpty()) }+ LaunchedEffect(Unit) {+ if (current.request.hidden) {+ delay(AuthRequest.HIDDEN_MS)+ if (ExtensionAuth.open.value === current && !current.visible.value) {+ Extensions.log(current.extensionId, "sign-in ${current.id} needs the user: shown")+ current.visible.value = true+ }+ delay(AuthRequest.TIMEOUT_MS - AuthRequest.HIDDEN_MS)+ } else delay(AuthRequest.TIMEOUT_MS)+ ExtensionAuth.finish(current, null, "timeout")+ }+ BackHandler(enabled = visible) { ExtensionAuth.finish(current, null, "closed") }+ // One web view for both modes: showing a hidden page only moves it, its state stays. Hidden, it is+ // laid out full screen (a 1 dp page lays itself out for 1 px and stays zoomed in once shown), so its+ // scripts run as on screen, but placed beside the screen and transparent: never seen, never touched.+ val frame = if (visible) Modifier.fillMaxSize().background(tone(0xFF121212))+ .clickable(remember { MutableInteractionSource() }, indication = null) {}+ .statusBarsPadding().navigationBarsPadding().imePadding()+ else Modifier.fillMaxSize().offset { IntOffset(100_000, 0) }.alpha(0f)+ Column(frame) {+ if (visible) {+ Row(Modifier.fillMaxWidth().padding(horizontal = 8.dp, vertical = 4.dp), verticalAlignment = Alignment.CenterVertically) {+ IconButton(onClick = { ExtensionAuth.finish(current, null, "closed") }) {+ Icon(Icons.Rounded.Close, stringResource(R.string.ext_auth_close), tint = AppText)+ }+ Column(Modifier.weight(1f)) {+ Text(stringResource(R.string.ext_auth_title, name), color = AppText, fontSize = 15.sp, maxLines = 1, overflow = TextOverflow.Ellipsis)+ Row(verticalAlignment = Alignment.CenterVertically) {+ Icon(Icons.Rounded.Lock, null, tint = AppMuted, modifier = Modifier.padding(end = 4.dp))+ Text(host, color = AppMuted, fontSize = 12.sp, maxLines = 1, overflow = TextOverflow.Ellipsis)+ }+ }+ }+ Text(stringResource(R.string.ext_auth_notice), color = AppMuted, fontSize = 11.sp, modifier = Modifier.padding(horizontal = 16.dp, vertical = 4.dp))+ }+ AndroidView(+ modifier = if (visible) Modifier.weight(1f).fillMaxWidth() else Modifier.fillMaxSize(),+ factory = { ctx -> authView(ctx, current) { h -> host = h } },+ onRelease = { it.stopLoading(); it.destroy() },+ )+ }+}++@SuppressLint("SetJavaScriptEnabled")+private fun authView(ctx: android.content.Context, o: ExtensionAuth.Open, onHost: (String) -> Unit): WebView {+ val view = WebView(ctx)+ // Before anything else touches it: this view's cookies and storage are the extension's profile.+ val profile = ExtensionAuth.profile(o.extensionId)+ ProfileStore.getInstance().getOrCreateProfile(profile)+ WebViewCompat.setProfile(view, profile)+ WebViewCompat.getProfile(view).cookieManager.apply {+ setAcceptCookie(true)+ setAcceptThirdPartyCookies(view, true)+ }+ view.settings.apply {+ javaScriptEnabled = true+ domStorageEnabled = true+ allowFileAccess = false+ allowContentAccess = false+ // window.open is taken (onCreateWindow) and loaded here: some checks hand the callback over that way.+ javaScriptCanOpenWindowsAutomatically = true+ setSupportMultipleWindows(true)+ setGeolocationEnabled(false)+ }++ /** The callback, reached by a link, a redirect, a form or a window.open: the page closes on it. */+ fun reached(url: String): Boolean {+ if (!o.request.reached(url)) return false+ ExtensionAuth.finish(o, url)+ return true+ }++ /** Only web pages in this view: no app, intent or file scheme leaves it. */+ fun refused(uri: android.net.Uri) = uri.scheme != "https" && uri.scheme != "http"++ view.webViewClient = object : WebViewClient() {+ override fun shouldOverrideUrlLoading(view: WebView, request: WebResourceRequest): Boolean =+ reached(request.url.toString()) || refused(request.url)++ override fun onPageStarted(view: WebView, url: String, favicon: Bitmap?) {+ // A form POSTed to an https callback does not go through shouldOverrideUrlLoading.+ if (reached(url)) { view.stopLoading(); return }+ runCatching { java.net.URI(url).host }.getOrNull()?.let(onHost)+ }++ override fun onReceivedError(view: WebView, request: WebResourceRequest, error: WebResourceError) {+ // The page itself cannot be loaded (no network, no such host): the sign-in ends. A check's+ // HTTP status (403, 503 of a challenge page) is not an error, the page goes on.+ if (request.isForMainFrame && !o.request.reached(request.url.toString()))+ ExtensionAuth.finish(o, null, "network: ${error.description}")+ }+ }+ view.webChromeClient = object : WebChromeClient() {+ override fun onCreateWindow(view: WebView, isDialog: Boolean, isUserGesture: Boolean, resultMsg: Message): Boolean {+ // A throwaway view only learns where the new window goes, then that address is the+ // callback (done) or loads here; no second window is ever shown.+ val probe = WebView(view.context)+ // The same profile: even the first request of the new window never carries other cookies.+ WebViewCompat.setProfile(probe, ExtensionAuth.profile(o.extensionId))+ probe.webViewClient = object : WebViewClient() {+ private var taken = false+ private fun take(url: String) {+ if (taken) return+ taken = true+ probe.stopLoading()+ if (!reached(url) && !refused(android.net.Uri.parse(url))) view.loadUrl(url)+ probe.post { probe.destroy() }+ }+ override fun shouldOverrideUrlLoading(v: WebView, request: WebResourceRequest): Boolean { take(request.url.toString()); return true }+ override fun onPageStarted(v: WebView, url: String, favicon: Bitmap?) { if (url != "about:blank") take(url) }+ }+ (resultMsg.obj as WebView.WebViewTransport).webView = probe+ resultMsg.sendToTarget()+ return true+ }+ }+ view.loadUrl(o.request.url)+ return view+}diff --git a/base/app/src/main/java/com/music/spotui/extensions/ExtensionConfirm.kt b/base/app/src/main/java/com/music/spotui/extensions/ExtensionConfirm.ktnew file mode 100644index 00000000..1552e89d--- /dev/null+++ b/base/app/src/main/java/com/music/spotui/extensions/ExtensionConfirm.kt@@ -0,0 +1,131 @@+package com.music.spotui.extensions++import androidx.compose.foundation.layout.Column+import androidx.compose.foundation.layout.padding+import androidx.compose.foundation.rememberScrollState+import androidx.compose.foundation.verticalScroll+import androidx.compose.material3.AlertDialog+import androidx.compose.material3.Text+import androidx.compose.material3.TextButton+import androidx.compose.runtime.Composable+import androidx.compose.runtime.collectAsState+import androidx.compose.runtime.getValue+import androidx.compose.ui.Modifier+import androidx.compose.ui.res.stringResource+import androidx.compose.ui.text.font.FontFamily+import androidx.compose.ui.unit.dp+import androidx.compose.ui.unit.sp+import app.myspoti.engine.R+import com.music.spotui.ui.theme.AppAccent+import com.music.spotui.ui.theme.AppMuted+import com.music.spotui.ui.theme.AppText+import com.music.spotui.ui.theme.tone+import app.myspoti.extensions.Consent+import app.myspoti.extensions.RawGrant+import kotlinx.coroutines.CompletableDeferred+import kotlinx.coroutines.flow.MutableStateFlow++/**+ * The question an extension's destructive Spotify call waits on ("X wants to remove from the+ * library."). The extension's own thread waits; the dialog is drawn over every screen by+ * [ExtensionConfirmHost]. No answer (the sandbox's 120 s), dismissing it, or a later question+ * replacing it: refused.+ */+object ExtensionConfirm {+ /** [offer]: a `raw.request` write, which may be allowed for good ("Always"). */+ class Question(val extensionId: String, val text: String, val offer: RawGrant?, internal val answer: CompletableDeferred<Consent>)++ /** The questions waiting, oldest first; the first one is shown. */+ val waiting = MutableStateFlow<List<Question>>(emptyList())++ suspend fun ask(extensionId: String, text: String): Boolean = ask(extensionId, text, null) != Consent.REFUSE++ suspend fun ask(extensionId: String, text: String, offer: RawGrant?): Consent {+ val q = Question(extensionId, text, offer, CompletableDeferred())+ synchronized(this) { waiting.value = waiting.value + q }+ return try {+ q.answer.await()+ } finally {+ q.answer.complete(Consent.REFUSE)+ synchronized(this) { waiting.value = waiting.value - q }+ }+ }++ fun answer(q: Question, allow: Boolean) = answer(q, if (allow) Consent.ONCE else Consent.REFUSE)++ fun answer(q: Question, consent: Consent) {+ q.answer.complete(consent)+ synchronized(this) { waiting.value = waiting.value - q }+ }+}++@Composable+fun ExtensionConfirmHost() {+ SuspendedNotice()+ WelcomeNotice()+ val waiting by ExtensionConfirm.waiting.collectAsState()+ val q = waiting.firstOrNull() ?: return+ ProtectedSurfaceEffect(app.myspoti.extensions.ProtectedSurface.CONFIRM)+ AlertDialog(+ onDismissRequest = { ExtensionConfirm.answer(q, false) },+ containerColor = tone(0xFF282828),+ title = { Text(stringResource(R.string.extension_confirm_title), color = AppText) },+ text = {+ Column(Modifier.verticalScroll(rememberScrollState())) {+ val first = q.text.lineSequence().first()+ Text(first, color = AppText)+ val rest = q.text.substringAfter('\n', "")+ if (rest.isNotBlank()) Text(rest, color = AppMuted, fontSize = 12.sp, fontFamily = FontFamily.Monospace, modifier = Modifier.padding(top = 8.dp))+ Text(stringResource(R.string.extension_confirm_detail), color = AppMuted, fontSize = 12.sp, modifier = Modifier.padding(top = 8.dp))+ q.offer?.let { g ->+ TextButton(onClick = { ExtensionConfirm.answer(q, Consent.ALWAYS) }, modifier = Modifier.padding(top = 8.dp)) {+ Text(stringResource(R.string.extension_confirm_always, g.toString()), color = AppAccent, fontSize = 13.sp)+ }+ }+ }+ },+ confirmButton = { TextButton(onClick = { ExtensionConfirm.answer(q, true) }) { Text(stringResource(if (q.offer != null) R.string.extension_confirm_once else R.string.extension_confirm_allow), color = AppAccent) } },+ dismissButton = { TextButton(onClick = { ExtensionConfirm.answer(q, false) }) { Text(stringResource(R.string.extension_confirm_refuse), color = AppText) } },+ )+}++/**+ * The playback arbiter suspended an extension (it kept undoing another one): say so, with a+ * button to turn it off, or to let it go on.+ */+@Composable+private fun SuspendedNotice() {+ val notice by Extensions.suspendedNotice.collectAsState()+ val (id, other) = notice ?: return+ val name = { x: String -> Extensions.registry.value.find(x)?.name ?: x }+ AlertDialog(+ onDismissRequest = { Extensions.suspendedNotice.value = null },+ containerColor = tone(0xFF282828),+ title = { Text(stringResource(R.string.ext_suspended_title, name(id)), color = AppText) },+ text = { Text(stringResource(R.string.ext_suspended_body, name(other)), color = AppMuted) },+ confirmButton = { TextButton(onClick = { Extensions.suspendedNotice.value = null; Extensions.setEnabled(id, false) }) { Text(stringResource(R.string.area_turn_off), color = AppAccent) } },+ dismissButton = { TextButton(onClick = { Extensions.suspendedNotice.value = null; Extensions.resumePlayback(id) }) { Text(stringResource(R.string.ext_suspended_keep), color = AppText) } },+ )+}++/** An extension's own few words after its first install: what it does, then what is left to do. */+@Composable+private fun WelcomeNotice() {+ val shown by Extensions.welcome.collectAsState()+ val (id, w) = shown ?: return+ val name = Extensions.registry.value.find(id)?.name ?: id+ AlertDialog(+ onDismissRequest = { Extensions.welcome.value = null },+ containerColor = tone(0xFF282828),+ title = { Text(stringResource(R.string.ext_welcome_title, name), color = AppText) },+ text = {+ Column(Modifier.verticalScroll(rememberScrollState())) {+ if (w.message.isNotBlank()) Text(w.message, color = AppText)+ if (w.steps.isNotEmpty()) Text(stringResource(R.string.ext_welcome_steps), color = AppMuted, fontSize = 12.sp, modifier = Modifier.padding(top = 12.dp, bottom = 4.dp))+ w.steps.forEachIndexed { i, step -> Text("${i + 1}. $step", color = AppText, fontSize = 14.sp, modifier = Modifier.padding(top = 4.dp)) }+ Text(stringResource(R.string.ext_welcome_from), color = AppMuted, fontSize = 11.sp, modifier = Modifier.padding(top = 12.dp))+ }+ },+ confirmButton = { TextButton(onClick = { Extensions.welcome.value = null }) { Text(stringResource(R.string.ext_welcome_ok), color = AppAccent) } },+ )+}diff --git a/base/app/src/main/java/com/music/spotui/extensions/ExtensionRegistry.kt b/base/app/src/main/java/com/music/spotui/extensions/ExtensionRegistry.ktnew file mode 100644index 00000000..6ce1eee0--- /dev/null+++ b/base/app/src/main/java/com/music/spotui/extensions/ExtensionRegistry.kt@@ -0,0 +1,308 @@+package com.music.spotui.extensions++import app.myspoti.extensions.Action+import app.myspoti.extensions.Area+import app.myspoti.extensions.Ask+import app.myspoti.extensions.Change+import app.myspoti.extensions.Clash+import app.myspoti.extensions.Hook+import app.myspoti.extensions.Level+import app.myspoti.extensions.Manifest+import app.myspoti.extensions.Origin+import app.myspoti.extensions.Snapshot+import app.myspoti.extensions.Storage+import kotlinx.serialization.Serializable+import kotlinx.serialization.builtins.MapSerializer+import kotlinx.serialization.builtins.serializer+import kotlinx.serialization.json.Json+import java.io.File++// The parts of the extension manager that do not need Android: what is installed and granted,+// what an update asks again, the extensions' stores and logs. Unit-tested on the JVM.++internal val RegistryJson = Json { ignoreUnknownKeys = true; encodeDefaults = true }++/** One installed extension, as the registry keeps it. */+@Serializable+data class InstalledExtension(+ val id: String,+ val name: String,+ val version: String,+ val versionCode: Int,+ val author: String,+ /** Of the package kept on the phone: a package changed behind the app's back does not run. */+ val sha256: String,+ /** The [Ask.key]s the user accepted: what the sandbox lets this extension do. */+ val granted: Set<String>,+ val enabled: Boolean = true,+ /** Why the app turned it off (it crashed, a repository blocked it), shown on its page. */+ val disabledReason: String? = null,+ val installedAt: Long = 0,+ /** Where it came from: "file", the https address of the package, or a repository's index. */+ val source: String = "file",+ /** Installed from GitHub: the repository, tag or branch and commit. Updates come from there. */+ val origin: Origin? = null,+ /**+ * What the user accepted (at install, or with Accept on an update card): every update is+ * weighed against it ([UpdateGate]). Null for an extension installed before snapshots: its+ * running manifest is taken as accepted the first time an update is checked.+ */+ val accepted: Snapshot? = null,+ /** The version before the running one, kept on disk (`previous.zip`): one tap reverts to it. */+ val previous: KeptVersion? = null,+ /** A newer version waiting for the user's OK (`staging.zip`): it asks [PendingUpdate.changes]. */+ val pendingUpdate: PendingUpdate? = null,+ /** The version the user answered "Keep current" to: not offered again, a newer one is. */+ val declinedVersionCode: Int = 0,+ /** When its source was last checked for an update (at most once a day, apart from the button). */+ val lastCheck: Long = 0,+ /** Its repository answered 404: it keeps running from the copy on the phone, marked "source gone". */+ val sourceGone: Boolean = false,+ /** The `raw.request` writes the user allowed for good, listed with its rights and revocable there. */+ val rawGrants: List<app.myspoti.extensions.RawGrant> = emptyList(),+)++/** A version kept on disk to revert to, or waiting in staging. */+@Serializable+data class KeptVersion(val version: String, val versionCode: Int, val sha256: String, val origin: Origin? = null)++/** A newer version that asks something the user has not accepted; the old one keeps running. */+@Serializable+data class PendingUpdate(val kept: KeptVersion, val changes: List<Change>, val changelog: String = "")++@Serializable+data class Registry(+ /** In installation order (the order hooks ask them in until the user sets a [priority]). */+ val extensions: List<InstalledExtension> = emptyList(),+ /** Repositories (index.json addresses) the user added, at their own risk. */+ val repositories: List<String> = emptyList(),+ /**+ * Per [Area] key, the ids in the order the user set on the Installed tab: asked first, first+ * answer wins (lyrics: the best answer, ties to the higher one; blocks: shown first; playback+ * commands: the higher wins a contradiction). An extension not listed (installed since) comes+ * after, in installation order. Before areas, keys were hook keys: [migrated] maps them.+ */+ val priority: Map<String, List<String>> = emptyMap(),+ /** Per exclusive action key (audio.source, download.source), the extension the user made active. */+ val active: Map<String, String> = emptyMap(),+ /** The extensions whose third-party notice the user accepted (once per extension, kept after uninstall). */+ val noticeAccepted: Set<String> = emptySet(),+) {+ fun find(id: String) = extensions.firstOrNull { it.id == id }++ /** [items] (in installation order) in the order [area] asks them: see [priority]. */+ fun <T> byPriority(area: String, items: List<T>, id: (T) -> String): List<T> {+ val order = priority[area].orEmpty()+ return items.sortedBy { order.indexOf(id(it)).let { i -> if (i < 0) Int.MAX_VALUE else i } }+ }++ /**+ * [id] moved by [delta] places (negative: higher) among [providers], the ids of the+ * extensions providing [hook] in installation order; the whole order is then kept.+ */+ fun move(area: String, providers: List<String>, id: String, delta: Int): Registry {+ val now = byPriority(area, providers) { it }.toMutableList()+ val from = now.indexOf(id)+ if (from < 0) return this+ val to = (from + delta).coerceIn(0, now.lastIndex)+ if (to == from) return this+ now.add(to, now.removeAt(from))+ return copy(priority = priority + (area to now))+ }++ /**+ * A registry written before actions, as one now: granted hook and permission keys become+ * action keys ([Action.migrateGranted]), priorities per hook become priorities per area.+ */+ fun migrated(): Registry {+ val byArea = LinkedHashMap<String, List<String>>()+ priority.forEach { (key, ids) ->+ val area = Hook.ofLegacy(key)?.action?.area?.key ?: key+ byArea[area] = (byArea[area].orEmpty() + ids).distinct()+ }+ return copy(extensions = extensions.map { it.copy(granted = Action.migrateGranted(it.granted)) }, priority = byArea)+ }++ /** [e] in place of the extension with its id (kept at its position), or added at the end. */+ fun put(e: InstalledExtension): Registry {+ val i = extensions.indexOfFirst { it.id == e.id }+ return copy(extensions = if (i < 0) extensions + e else extensions.toMutableList().also { it[i] = e })+ }++ fun remove(id: String) = copy(+ extensions = extensions.filterNot { it.id == id },+ priority = priority.mapValues { (_, ids) -> ids - id }.filterValues { it.isNotEmpty() },+ active = active.filterValues { it != id },+ )++ companion object {+ fun read(file: File): Registry = runCatching { RegistryJson.decodeFromString(serializer(), file.readText()).migrated() }.getOrDefault(Registry())++ fun write(file: File, r: Registry) = writeAtomically(file, RegistryJson.encodeToString(serializer(), r))+ }+}++/** Where an extension stands on the Installed tab: the areas its actions act in (support actions alone: [Area.OTHER]). */+object Areas {+ fun of(m: Manifest): Set<Area> = m.actionSet().mapNotNull { it.area }.toSet().ifEmpty { setOf(Area.OTHER) }++ /**+ * Per area (in [Area] order), the installed extensions acting there in the user's order;+ * an area no extension acts in is still there (its Built-in row).+ */+ fun group(r: Registry, manifestOf: (String) -> Manifest?): Map<Area, List<InstalledExtension>> =+ Area.entries.associateWith { area -> r.byPriority(area.key, r.extensions.filter { e -> manifestOf(e.id)?.let { area in of(it) } == true }) { it.id } }+}++/** How the user settled a [Clash] when installing or turning on an extension. */+object Clashes {+ /**+ * The registry after the new extension [id] is installed, each clash resolved by [keepNew]+ * (true: the new one acts, the other stays installed: idle for an exclusive action, turned off+ * for a conflict or a replacement). Returns it and whether the new one starts turned off.+ */+ fun apply(r: Registry, id: String, clashes: List<Clash>, keepNew: (Clash) -> Boolean): Pair<Registry, Boolean> {+ var out = r+ var newOff = false+ clashes.forEach { c ->+ val keep = keepNew(c)+ when (c.kind) {+ Clash.Kind.EXCLUSIVE -> out = out.copy(active = out.active + (c.action!!.key to if (keep) id else c.otherId))+ Clash.Kind.CONFLICT, Clash.Kind.REPLACES ->+ if (keep) out.find(c.otherId)?.let { o -> out = out.put(o.copy(enabled = false, disabledReason = "replaced by $id")) }+ else newOff = true+ }+ }+ return out to newOff+ }+}++/**+ * What installing grants: every action the extension lists. There is nothing to untick: to refuse+ * an action, the user does not install the extension (or uninstalls it).+ */+object Grants {+ fun keys(m: Manifest): Set<String> = m.asks().map { it.key }.toSet()++ /**+ * The actions [m] lists that [e] was not granted: left from the time the install prompt let+ * the user untick some. While there are any, it does not run; the user accepts them once on+ * its page.+ */+ fun refused(e: InstalledExtension, m: Manifest): Set<String> = keys(m) - e.granted++ /** What [m] is granted when it replaces a version: all it lists but the [refused] ones still waiting for the user. */+ fun replacing(m: Manifest, refused: Set<String>): Set<String> = keys(m) - refused+}++/** What happens when a package is offered for an extension that may already be installed. */+sealed interface InstallPlan {+ val manifest: Manifest++ /** Not installed: every ask is shown. */+ data class Fresh(override val manifest: Manifest) : InstallPlan++ /**+ * A newer version. [newAsks]: the rights it asks that the installed one did not (or asks+ * wider: more hosts, any host). [refused]: the ones it lists that the user had unticked+ * before installs granted everything. The prompt lists the actions again when there is+ * either; installing grants all it lists.+ */+ data class Update(+ override val manifest: Manifest,+ val from: InstalledExtension,+ val newAsks: List<Ask>,+ val refused: Set<String>,+ ) : InstallPlan {+ val reAsk: Boolean get() = newAsks.isNotEmpty() || refused.isNotEmpty()+ }++ /** The same version, or an older one, is installed. */+ data class NotNewer(override val manifest: Manifest, val installed: InstalledExtension) : InstallPlan++ companion object {+ /**+ * [installed] and [installedManifest]: the extension with [manifest]'s id on the phone,+ * if any, and the manifest of its package.+ */+ fun of(manifest: Manifest, installed: InstalledExtension?, installedManifest: Manifest?): InstallPlan {+ if (installed == null) return Fresh(manifest)+ if (manifest.versionCode <= installed.versionCode) return NotNewer(manifest, installed)+ val old = installedManifest?.asks().orEmpty()+ val newAsks = manifest.asks().filter { a -> widens(a, old.firstOrNull { it.key == a.key }) }+ val refused = (old.map { it.key }.toSet() - installed.granted) intersect Grants.keys(manifest)+ return Update(manifest, installed, newAsks, refused)+ }++ /** Whether [now] asks more than [before] did: new, now critical, more hosts, or another reason. */+ internal fun widens(now: Ask, before: Ask?): Boolean = before == null ||+ (now.level == Level.CRITICAL && before.level != Level.CRITICAL) ||+ !before.hosts.containsAll(now.hosts) || now.why.trim() != before.why.trim()+ }+}++/**+ * A small JSON map in a file (key → JSON text): an extension's `myspoti.storage`, and its+ * settings. Kept in memory, written through on every change.+ */+class FileStore(private val file: File) : Storage {+ private val values: MutableMap<String, String> by lazy {+ runCatching { RegistryJson.decodeFromString(MAP, file.readText()).toMutableMap() }.getOrElse { LinkedHashMap() }+ }++ @Synchronized override fun get(key: String): String? = values[key]+ @Synchronized override fun set(key: String, json: String) { values[key] = json; save() }+ @Synchronized override fun remove(key: String) { if (values.remove(key) != null) save() }+ @Synchronized override fun size(): Int = values.entries.sumOf { it.key.length + it.value.length }+ @Synchronized fun all(): Map<String, String> = values.toMap()++ private fun save() = writeAtomically(file, RegistryJson.encodeToString(MAP, values))++ companion object {+ private val MAP = MapSerializer(String.serializer(), String.serializer())+ }+}++/** An extension's log: the last lines in memory, and on disk (cut to [maxChars]) for its page. */+class ExtensionLog(private val file: File, private val maxLines: Int = 300, private val maxChars: Int = 64 * 1024) {+ private val lines: ArrayDeque<String> by lazy {+ ArrayDeque(runCatching { file.readLines() }.getOrDefault(emptyList()).takeLast(maxLines))+ }++ @Synchronized fun add(line: String) {+ lines.addLast(line)+ while (lines.size > maxLines) lines.removeFirst()+ runCatching {+ file.parentFile?.mkdirs()+ if (file.length() > maxChars) writeAtomically(file, lines.joinToString("\n", postfix = "\n"))+ else file.appendText(line + "\n")+ }+ }++ @Synchronized fun lines(): List<String> = lines.toList()++ @Synchronized fun clear() { lines.clear(); file.delete() }+}++/** Counts each extension's failures in a row; at [limit] the app turns it off. */+class FailureCounter(private val limit: Int = 3) {+ private val inARow = HashMap<String, Int>()++ /** A failure of [id]: true when it is one too many and the extension is to be turned off. */+ @Synchronized fun failed(id: String): Boolean {+ val n = (inARow[id] ?: 0) + 1+ inARow[id] = n+ return n >= limit+ }++ @Synchronized fun succeeded(id: String) { inARow.remove(id) }++ @Synchronized fun reset(id: String) { inARow.remove(id) }+}++internal fun writeAtomically(file: File, text: String) {+ file.parentFile?.mkdirs()+ val tmp = File(file.parentFile, file.name + ".tmp")+ tmp.writeText(text)+ if (!tmp.renameTo(file)) { file.delete(); tmp.renameTo(file) }+}diff --git a/base/app/src/main/java/com/music/spotui/extensions/ExtensionStore.kt b/base/app/src/main/java/com/music/spotui/extensions/ExtensionStore.ktnew file mode 100644index 00000000..d5ac0b6c--- /dev/null+++ b/base/app/src/main/java/com/music/spotui/extensions/ExtensionStore.kt@@ -0,0 +1,190 @@+package com.music.spotui.extensions++import app.myspoti.extensions.Catalog+import app.myspoti.extensions.Discovery+import app.myspoti.extensions.ExtensionException+import app.myspoti.extensions.GitHubAuth+import app.myspoti.extensions.Manifest+import app.myspoti.extensions.Rating+import app.myspoti.extensions.Ranking+import app.myspoti.extensions.Store+import kotlinx.coroutines.CoroutineScope+import kotlinx.coroutines.Dispatchers+import kotlinx.coroutines.SupervisorJob+import kotlinx.coroutines.async+import kotlinx.coroutines.awaitAll+import kotlinx.coroutines.sync.Semaphore+import kotlinx.coroutines.sync.withPermit+import kotlinx.coroutines.withContext+import java.io.File+import kotlinx.coroutines.flow.MutableStateFlow+import kotlinx.coroutines.flow.StateFlow+import kotlinx.coroutines.flow.asStateFlow+import kotlinx.coroutines.launch++/**+ * The repositories' indexes as the store shows them, read once per visit (or on Refresh) and+ * shared by the list, the store pages and the "update available" count, plus the extensions+ * discovered on GitHub (topic [Discovery.TOPIC], listed under [Discovery.SOURCE]) with their+ * ratings. Nothing is downloaded here but indexes, manifests and counts: a package only when+ * the user taps Install.+ */+object ExtensionStore {+ /**+ * The official repository: always read, shown only once it lists an extension (never+ * removable). Each extension in it is reviewed (one pull request per extension).+ */+ const val OFFICIAL_REPO = "https://raw.githubusercontent.com/kota-zo/myspoti-extensions/main/index.json"++ /** One repository's index: [catalog] once read, [error] if it could not be. */+ data class Repo(val url: String, val catalog: Catalog? = null, val error: String? = null, val loading: Boolean = false)++ private val scope = CoroutineScope(SupervisorJob() + Dispatchers.IO)+ private val _repos = MutableStateFlow<Map<String, Repo>>(emptyMap())+ val repos: StateFlow<Map<String, Repo>> = _repos.asStateFlow()++ /** The ids whose package is being downloaded (a spinner in place of the button). */+ val busy = MutableStateFlow<Set<String>>(emptySet())++ /** Reads [urls]' indexes not read yet (all of them when [force]); forgets the removed ones. GitHub's discovery too. */+ fun refresh(userUrls: List<String>, force: Boolean = false) {+ val urls = sources(userUrls)+ _repos.value = _repos.value.filterKeys { it in urls || it == Discovery.SOURCE }+ discover(force)+ urls.forEach { url ->+ val now = _repos.value[url]+ if (now?.loading == true || (!force && now?.catalog != null)) return@forEach+ _repos.value = _repos.value + (url to (now ?: Repo(url)).copy(loading = true, error = null))+ scope.launch {+ val r = runCatching { Extensions.catalog(url) }+ _repos.value = _repos.value + (url to Repo(url, r.getOrNull() ?: now?.catalog, r.exceptionOrNull()?.let { it.message ?: it.toString() }))+ }+ }+ }++ /** Every catalogue, the discovered one last (an index, its sha256 checked, wins a tie). */+ fun read(): List<Pair<String, Catalog>> = _repos.value.values.sortedBy { it.url == Discovery.SOURCE }.mapNotNull { r -> r.catalog?.let { r.url to it } }++ /** The newest listing of [id] across the repositories: (index address, entry). */+ fun entry(id: String): Pair<String, Catalog.Entry>? = Store.newest(read())[id]++ fun isOfficial(url: String) = url == OFFICIAL_REPO++ /** The repositories read: the official one first, then the user's. */+ fun sources(userUrls: List<String>) = (listOf(OFFICIAL_REPO) + userUrls).distinct()++ /** The official repository has something to show: until then it is left out of the Store. */+ fun officialShown() = _repos.value[OFFICIAL_REPO]?.catalog?.extensions?.isNotEmpty() == true++ // ── GitHub discovery ──++ private const val MAX_SEARCH = 2 * 1024 * 1024++ /** Per repository (`owner/name`), its 👍 / 👎 (no account needed to read them). */+ val ratings = MutableStateFlow<Map<String, Rating>>(emptyMap())++ /** Per repository, the downloads of its release's package, read on its store page. */+ val downloads = MutableStateFlow<Map<String, Long>>(emptyMap())++ /**+ * The repositories with the topic: one search (cached 6 hours, [force]: Refresh, still+ * within the cache's age for GitHub's sake), their manifests from raw.githubusercontent.com+ * (8 at a time, cached alike), one search for the ratings issues. A repository whose manifest+ * is missing or refused is left out.+ */+ fun discover(force: Boolean = false) {+ val now = _repos.value[Discovery.SOURCE]+ if (now?.loading == true || (!force && now?.catalog != null)) return+ _repos.value = _repos.value + (Discovery.SOURCE to (now ?: Repo(Discovery.SOURCE)).copy(loading = true, error = null))+ scope.launch {+ val r = runCatching {+ val found = Discovery.parseSearch(ExtensionUpdates.cached(Discovery.SEARCH_URL, Discovery.CACHE_MS, MAX_SEARCH) ?: throw ExtensionException("GitHub search answered 404"))+ val gate = Semaphore(8)+ val entries = withContext(Dispatchers.IO) {+ found.map { f ->+ async {+ gate.withPermit {+ runCatching {+ val text = f.manifestUrl()?.let { ExtensionUpdates.cached(it, Discovery.CACHE_MS) } ?: return@runCatching null+ Manifest.parse(text).takeIf { it.problems().isEmpty() }?.let { Discovery.entry(f, it) }+ }.getOrNull()+ }+ }+ }.awaitAll().filterNotNull()+ }+ runCatching { ExtensionUpdates.cached(Discovery.RATINGS_URL, Discovery.CACHE_MS, MAX_SEARCH) }.getOrNull()+ ?.let { ratings.value = Discovery.parseRatings(it, found.map { f -> f.fullName }.toSet()) }+ Catalog(name = "GitHub", extensions = entries.distinctBy { it.id })+ }+ _repos.value = _repos.value + (Discovery.SOURCE to Repo(Discovery.SOURCE, r.getOrNull() ?: now?.catalog, r.exceptionOrNull()?.let { it.message ?: it.toString() }))+ }+ }++ /** The download count of [repo]'s release package, for its store page (cached 6 hours). */+ fun loadDownloads(repo: String) {+ if (repo in downloads.value) return+ scope.launch {+ runCatching { ExtensionUpdates.cached(Discovery.releaseUrl(repo), Discovery.CACHE_MS)?.let(Discovery::parseDownloads) }+ .getOrNull()?.let { downloads.value = downloads.value + (repo to it) }+ }+ }++ /** The discovered extensions in the store's order, hidden ones left out unless [showAll]. */+ fun discovered(showAll: Boolean, now: Long = System.currentTimeMillis()): List<Ranking.Ranked<Catalog.Entry>> {+ val entries = _repos.value[Discovery.SOURCE]?.catalog?.extensions.orEmpty()+ val r = ratings.value+ return Ranking.listed(entries.map { Ranking.Ranked(it, it.id, null, it.repo?.let(r::get), Ranking.time(it.updatedAt)) },+ ExtensionUpdates.blocks.value, now, showAll)+ }++ /** How many discovered extensions "Show all" would add. */+ fun hiddenCount(): Int = discovered(true).size - discovered(false).size++ // ── Rating (hidden while [GitHubAuth.GITHUB_CLIENT_ID] is empty) ──++ private val tokenFile get() = File(Extensions.dir, "github_token")++ /** The device-flow sign-in waiting for the user to type [GitHubAuth.DeviceCode.userCode] on GitHub. */+ val signIn = MutableStateFlow<GitHubAuth.DeviceCode?>(null)++ fun signedIn(): Boolean = GitHubAuth.enabled && tokenFile.isFile++ /**+ * 👍 ([up]) or 👎 on [repo]'s ratings issue. Without a token: GitHub's device flow first+ * ([signIn] shows the code; polled until the user typed it, or it expires).+ */+ suspend fun rate(repo: String, up: Boolean) = withContext(Dispatchers.IO) {+ if (!GitHubAuth.enabled) return@withContext+ val issue = ratings.value[repo]?.issue?.takeIf { it > 0 } ?: throw ExtensionException("this extension has no ratings issue")+ suspend fun react(token: String) = ExtensionUpdates.get(GitHubAuth.reactionsUrl(repo, issue), 64 * 1024, accept = "application/vnd.github+json", method = "POST", body = GitHubAuth.reactionBody(up), token = token)+ var a = react(tokenFile.takeIf { it.isFile }?.readText()?.trim()?.ifEmpty { null } ?: deviceFlow())+ // The OAuth app's tokens expire: a refused one is dropped and the device flow runs again, once.+ if (a.status == 401) { tokenFile.delete(); a = react(deviceFlow()) }+ if (a.status == 401) { tokenFile.delete(); throw ExtensionException("GitHub sign-in expired: try again") }+ if (a.status !in 200..299) throw ExtensionException("GitHub answered ${a.status}")+ ratings.value[repo]?.let { r -> ratings.value = ratings.value + (repo to if (up) r.copy(up = r.up + 1) else r.copy(down = r.down + 1)) }+ }++ private suspend fun deviceFlow(): String {+ val code = ExtensionUpdates.get(GitHubAuth.DEVICE_CODE_URL, 64 * 1024, accept = "application/json", method = "POST", body = GitHubAuth.deviceCodeBody())+ .body?.decodeToString()?.let(GitHubAuth::parseDeviceCode) ?: throw ExtensionException("GitHub sign-in unavailable")+ signIn.value = code+ try {+ var wait = code.interval * 1000L+ val until = System.currentTimeMillis() + code.expiresIn * 1000L+ while (System.currentTimeMillis() < until && signIn.value != null) {+ kotlinx.coroutines.delay(wait)+ val text = ExtensionUpdates.get(GitHubAuth.TOKEN_URL, 64 * 1024, accept = "application/json", method = "POST", body = GitHubAuth.tokenBody(code.deviceCode)).body?.decodeToString().orEmpty()+ when (val p = GitHubAuth.parsePoll(text)) {+ is GitHubAuth.Poll.Token -> { writeAtomically(tokenFile, p.token); return p.token }+ GitHubAuth.Poll.Pending -> Unit+ GitHubAuth.Poll.SlowDown -> wait += 5_000+ is GitHubAuth.Poll.Failed -> throw ExtensionException("GitHub sign-in: ${p.reason}")+ }+ }+ throw ExtensionException("GitHub sign-in not finished")+ } finally {+ signIn.value = null+ }+ }+}diff --git a/base/app/src/main/java/com/music/spotui/extensions/ExtensionUi.kt b/base/app/src/main/java/com/music/spotui/extensions/ExtensionUi.ktnew file mode 100644index 00000000..6aecd825--- /dev/null+++ b/base/app/src/main/java/com/music/spotui/extensions/ExtensionUi.kt@@ -0,0 +1,466 @@+package com.music.spotui.extensions++import androidx.compose.foundation.background+import androidx.compose.foundation.clickable+import androidx.compose.foundation.horizontalScroll+import androidx.compose.foundation.layout.Arrangement+import androidx.compose.foundation.layout.Box+import androidx.compose.foundation.layout.Column+import androidx.compose.foundation.layout.Row+import androidx.compose.foundation.layout.Spacer+import androidx.compose.foundation.layout.aspectRatio+import androidx.compose.foundation.layout.fillMaxWidth+import androidx.compose.foundation.layout.height+import androidx.compose.foundation.layout.padding+import androidx.compose.foundation.layout.size+import androidx.compose.foundation.layout.width+import androidx.compose.foundation.rememberScrollState+import androidx.compose.foundation.shape.CircleShape+import androidx.compose.foundation.shape.RoundedCornerShape+import androidx.compose.material.icons.Icons+import androidx.compose.material.icons.automirrored.rounded.ManageSearch+import androidx.compose.material.icons.automirrored.rounded.OpenInNew+import androidx.compose.material.icons.automirrored.rounded.PlaylistAdd+import androidx.compose.material.icons.automirrored.rounded.PlaylistPlay+import androidx.compose.material.icons.automirrored.rounded.QueueMusic+import androidx.compose.material.icons.automirrored.rounded.VolumeUp+import androidx.compose.material.icons.rounded.Add+import androidx.compose.material.icons.rounded.Album+import androidx.compose.material.icons.rounded.BarChart+import androidx.compose.material.icons.rounded.Bolt+import androidx.compose.material.icons.rounded.Bookmark+import androidx.compose.material.icons.rounded.Check+import androidx.compose.material.icons.rounded.Code+import androidx.compose.material.icons.rounded.Dashboard+import androidx.compose.material.icons.rounded.Download+import androidx.compose.material.icons.rounded.Edit+import androidx.compose.material.icons.rounded.Extension+import androidx.compose.material.icons.rounded.Favorite+import androidx.compose.material.icons.rounded.GraphicEq+import androidx.compose.material.icons.rounded.Headphones+import androidx.compose.material.icons.rounded.Home+import androidx.compose.material.icons.rounded.Info+import androidx.compose.material.icons.rounded.Language+import androidx.compose.material.icons.rounded.LibraryAdd+import androidx.compose.material.icons.rounded.LibraryMusic+import androidx.compose.material.icons.rounded.Link+import androidx.compose.material.icons.rounded.Lyrics+import androidx.compose.material.icons.rounded.Mic+import androidx.compose.material.icons.rounded.MoreHoriz+import androidx.compose.material.icons.rounded.MusicNote+import androidx.compose.material.icons.rounded.Notifications+import androidx.compose.material.icons.rounded.Person+import androidx.compose.material.icons.rounded.PlayArrow+import androidx.compose.material.icons.rounded.PlayCircle+import androidx.compose.material.icons.rounded.Public+import androidx.compose.material.icons.rounded.Radio+import androidx.compose.material.icons.rounded.Refresh+import androidx.compose.material.icons.rounded.Repeat+import androidx.compose.material.icons.rounded.Save+import androidx.compose.material.icons.rounded.Search+import androidx.compose.material.icons.rounded.Settings+import androidx.compose.material.icons.rounded.Share+import androidx.compose.material.icons.rounded.Shuffle+import androidx.compose.material.icons.rounded.SmartButton+import androidx.compose.material.icons.rounded.Star+import androidx.compose.material.icons.rounded.Timer+import androidx.compose.material.icons.rounded.Translate+import androidx.compose.material.icons.rounded.Tune+import androidx.compose.material.icons.rounded.Web+import androidx.compose.material.icons.rounded.Key+import androidx.compose.material3.DropdownMenu+import androidx.compose.material3.DropdownMenuItem+import androidx.compose.material3.Icon+import androidx.compose.material3.IconButton+import androidx.compose.material3.Text+import androidx.compose.runtime.Composable+import androidx.compose.runtime.DisposableEffect+import androidx.compose.runtime.collectAsState+import androidx.compose.runtime.getValue+import androidx.compose.runtime.mutableStateOf+import androidx.compose.runtime.produceState+import androidx.compose.runtime.remember+import androidx.compose.runtime.setValue+import androidx.compose.ui.Alignment+import androidx.compose.ui.Modifier+import androidx.compose.ui.draw.clip+import androidx.compose.ui.graphics.Color+import androidx.compose.ui.graphics.vector.ImageVector+import androidx.compose.ui.layout.ContentScale+import androidx.compose.ui.res.stringResource+import androidx.compose.ui.text.font.FontWeight+import androidx.compose.ui.text.style.TextOverflow+import androidx.compose.ui.unit.dp+import androidx.compose.ui.unit.sp+import app.myspoti.engine.R+import app.myspoti.extensions.Action+import app.myspoti.extensions.Area+import app.myspoti.extensions.Ask+import app.myspoti.extensions.Block+import app.myspoti.extensions.Conflicts+import app.myspoti.extensions.Hook+import app.myspoti.extensions.ItemKind+import app.myspoti.extensions.ProtectedSurface+import app.myspoti.extensions.Surface+import app.myspoti.extensions.SurfaceGuard+import app.myspoti.extensions.Target+import app.myspoti.extensions.TextStyle+import com.bumptech.glide.integration.compose.ExperimentalGlideComposeApi+import com.bumptech.glide.integration.compose.GlideImage+import com.music.spotui.ui.theme.AppAccent+import com.music.spotui.ui.theme.AppMuted+import com.music.spotui.ui.theme.AppText+import com.music.spotui.ui.theme.tone+import kotlinx.serialization.json.JsonPrimitive+import kotlinx.serialization.json.buildJsonObject++// What extensions add to the app's screens, drawn by the app: its fonts, colours and icons.+// Each block says which extension it comes from; while a protected surface is on screen+// (support, update, install warnings, confirmations, report, about) nothing here is drawn.++// ── Protected surfaces ──++/** Marks [surface] as on screen while this is composed: extension UI waits beneath it. */+@Composable+fun ProtectedSurfaceEffect(surface: ProtectedSurface) {+ DisposableEffect(surface) {+ SurfaceGuard.app.shown(surface)+ onDispose { SurfaceGuard.app.hidden(surface) }+ }+}++@Composable+private fun shielded(): Boolean = SurfaceGuard.app.state.collectAsState().value.isNotEmpty()++// ── Icons and labels ──++fun actionIcon(a: Action?): ImageVector = when (a) {+ Action.PLAYBACK_CONTROL -> Icons.Rounded.PlayCircle+ Action.PLAYBACK_QUEUE -> Icons.AutoMirrored.Rounded.QueueMusic+ Action.PLAYBACK_EVENTS -> Icons.Rounded.GraphicEq+ Action.LYRICS_PROVIDE -> Icons.Rounded.Lyrics+ Action.TRACKINFO_PROVIDE -> Icons.Rounded.Info+ Action.AUDIO_SOURCE -> Icons.Rounded.Headphones+ Action.DOWNLOAD_SOURCE -> Icons.Rounded.Download+ Action.HOME_SECTIONS -> Icons.Rounded.Dashboard+ Action.SEARCH_PROVIDE -> Icons.AutoMirrored.Rounded.ManageSearch+ Action.MENU_ITEMS -> Icons.Rounded.MoreHoriz+ Action.PLAYER_BUTTONS -> Icons.Rounded.SmartButton+ Action.SETTINGS_PAGE -> Icons.Rounded.Tune+ Action.NOTIFY -> Icons.Rounded.Notifications+ Action.LIBRARY_READ -> Icons.Rounded.LibraryMusic+ Action.LIBRARY_WRITE -> Icons.Rounded.LibraryAdd+ Action.PLAYLISTS_WRITE -> Icons.AutoMirrored.Rounded.PlaylistAdd+ Action.SPOTIFY_CATALOG -> Icons.Rounded.Album+ Action.SPOTIFY_RAW -> Icons.Rounded.Code+ Action.NETWORK -> Icons.Rounded.Public+ Action.WEBVIEW_PAGE -> Icons.Rounded.Web+ Action.WEBVIEW_AUTH -> Icons.Rounded.Key+ Action.STORAGE -> Icons.Rounded.Save+ null -> Icons.Rounded.Extension+}++fun actionLabel(a: Action?): Int = when (a) {+ Action.PLAYBACK_CONTROL -> R.string.action_playback_control+ Action.PLAYBACK_QUEUE -> R.string.action_playback_queue+ Action.PLAYBACK_EVENTS -> R.string.action_playback_events+ Action.LYRICS_PROVIDE -> R.string.action_lyrics_provide+ Action.TRACKINFO_PROVIDE -> R.string.action_trackinfo_provide+ Action.AUDIO_SOURCE -> R.string.action_audio_source+ Action.DOWNLOAD_SOURCE -> R.string.action_download_source+ Action.HOME_SECTIONS -> R.string.action_home_sections+ Action.SEARCH_PROVIDE -> R.string.action_search_provide+ Action.MENU_ITEMS -> R.string.action_menu_items+ Action.PLAYER_BUTTONS -> R.string.action_player_buttons+ Action.SETTINGS_PAGE -> R.string.action_settings_page+ Action.NOTIFY -> R.string.action_notify+ Action.LIBRARY_READ -> R.string.action_library_read+ Action.LIBRARY_WRITE -> R.string.action_library_write+ Action.PLAYLISTS_WRITE -> R.string.action_playlists_write+ Action.SPOTIFY_CATALOG -> R.string.action_spotify_catalog+ Action.SPOTIFY_RAW -> R.string.action_spotify_raw+ Action.NETWORK -> R.string.action_network+ Action.WEBVIEW_PAGE -> R.string.action_webview_page+ Action.WEBVIEW_AUTH -> R.string.action_webview_auth+ Action.STORAGE -> R.string.action_storage+ null -> R.string.action_unknown+}++/** An ask's label: `network.any` has its own. */+fun askLabel(a: Ask): Int = if (a.key == Action.NETWORK_ANY) R.string.action_network_any else actionLabel(a.action)++fun areaIcon(area: Area): ImageVector = when (area) {+ Area.PLAYBACK -> Icons.Rounded.PlayCircle+ Area.LYRICS -> Icons.Rounded.Lyrics+ Area.AUDIO -> Icons.Rounded.Headphones+ Area.HOME -> Icons.Rounded.Home+ Area.MENUS -> Icons.Rounded.MoreHoriz+ Area.LIBRARY -> Icons.Rounded.LibraryMusic+ Area.OTHER -> Icons.Rounded.Extension+}++fun areaLabel(area: Area): Int = when (area) {+ Area.PLAYBACK -> R.string.area_playback+ Area.LYRICS -> R.string.area_lyrics+ Area.AUDIO -> R.string.area_audio+ Area.HOME -> R.string.area_home+ Area.MENUS -> R.string.area_menus+ Area.LIBRARY -> R.string.area_library+ Area.OTHER -> R.string.area_other+}++/** A block's icon name ([app.myspoti.extensions.Blocks.ICONS]) as the app's own icon. */+fun blockIcon(name: String): ImageVector = when (name) {+ "add" -> Icons.Rounded.Add+ "album" -> Icons.Rounded.Album+ "artist" -> Icons.Rounded.Person+ "bolt" -> Icons.Rounded.Bolt+ "bookmark" -> Icons.Rounded.Bookmark+ "chart" -> Icons.Rounded.BarChart+ "check" -> Icons.Rounded.Check+ "download" -> Icons.Rounded.Download+ "edit" -> Icons.Rounded.Edit+ "favorite" -> Icons.Rounded.Favorite+ "headphones" -> Icons.Rounded.Headphones+ "info" -> Icons.Rounded.Info+ "language" -> Icons.Rounded.Language+ "link" -> Icons.Rounded.Link+ "lyrics" -> Icons.Rounded.Lyrics+ "mic" -> Icons.Rounded.Mic+ "music" -> Icons.Rounded.MusicNote+ "open" -> Icons.AutoMirrored.Rounded.OpenInNew+ "play" -> Icons.Rounded.PlayArrow+ "playlist" -> Icons.AutoMirrored.Rounded.PlaylistPlay+ "queue" -> Icons.AutoMirrored.Rounded.QueueMusic+ "radio" -> Icons.Rounded.Radio+ "refresh" -> Icons.Rounded.Refresh+ "repeat" -> Icons.Rounded.Repeat+ "search" -> Icons.Rounded.Search+ "settings" -> Icons.Rounded.Settings+ "share" -> Icons.Rounded.Share+ "shuffle" -> Icons.Rounded.Shuffle+ "star" -> Icons.Rounded.Star+ "timer" -> Icons.Rounded.Timer+ "translate" -> Icons.Rounded.Translate+ "tune" -> Icons.Rounded.Tune+ "volume" -> Icons.AutoMirrored.Rounded.VolumeUp+ else -> Icons.Rounded.Extension+}++private fun nameOf(id: String) = Extensions.registry.value.find(id)?.name ?: id++/** A Spotify page an extension's block opens: a song plays, a list or artist opens over the app. */+fun openFromExtension(uri: String) {+ val parts = uri.split(':')+ when (parts.getOrNull(1)) {+ "track" -> com.music.spotui.di.SongPlayer.playSong(uri)+ "episode" -> com.music.spotui.di.SongPlayer.playSong("episode:${parts[2]}")+ else -> com.music.spotui.data.api.InviteLinks.page.value = uri+ }+}++/** What a place is about, for the blocks' `tap`: `{ kind, uri, title, subtitle }`. */+fun placeJson(kind: String, uri: String, title: String, subtitle: String = ""): String = buildJsonObject {+ put("kind", JsonPrimitive(kind)); put("uri", JsonPrimitive(uri)); put("title", JsonPrimitive(title)); put("subtitle", JsonPrimitive(subtitle))+}.toString()++// ── Blocks on a page (Home, search, a song's credits) ──++/**+ * The extensions' blocks for [hook] on [surface], asked with [input] (and tapped with [context]),+ * each group under the name of the extension it comes from. Nothing while a protected surface shows.+ */+@Composable+fun ExtensionBlocks(hook: Hook, surface: Surface, input: String, context: String = input, modifier: Modifier = Modifier, delayMs: Long = 0) {+ if (!Extensions.isReady) return+ val tick by Extensions.blocksTick.collectAsState()+ val registry by Extensions.registry.collectAsState()+ val shown by produceState(Conflicts.Shown<String>(emptyList(), emptyList()), input, tick, registry) {+ // Typing: asked once the text rests.+ if (delayMs > 0) kotlinx.coroutines.delay(delayMs)+ value = runCatching { Extensions.blocks(hook, surface, input) }.getOrDefault(Conflicts.Shown(emptyList(), emptyList()))+ }+ if (shielded() || shown.shown.isEmpty()) return+ Column(modifier.fillMaxWidth()) {+ var last: String? = null+ shown.shown.forEach { (owner, block) ->+ if (owner != last) { From(owner); last = owner }+ BlockView(owner, block, surface, context)+ }+ }+}++@Composable+private fun From(owner: String) {+ Row(verticalAlignment = Alignment.CenterVertically, modifier = Modifier.padding(start = 16.dp, end = 16.dp, top = 14.dp, bottom = 2.dp)) {+ Icon(Icons.Rounded.Extension, null, tint = AppMuted, modifier = Modifier.size(14.dp))+ Spacer(Modifier.width(6.dp))+ Text(stringResource(R.string.ext_from, nameOf(owner)), color = AppMuted, fontSize = 12.sp, maxLines = 1, overflow = TextOverflow.Ellipsis)+ }+}++private fun tapped(owner: String, target: Target?, surface: Surface, context: String) {+ target ?: return+ target.open?.let(::openFromExtension)+ target.action?.let { Extensions.tap(owner, surface, it, context) }+}++@OptIn(ExperimentalGlideComposeApi::class)+@Composable+private fun BlockView(owner: String, b: Block, surface: Surface, context: String) {+ when (b) {+ is Block.Section -> {+ if (b.title.isNotBlank()) Text(b.title, color = AppText, fontSize = 21.sp, fontWeight = FontWeight.Bold, maxLines = 2,+ overflow = TextOverflow.Ellipsis, modifier = Modifier.padding(start = 16.dp, end = 16.dp, top = 8.dp))+ b.subtitle?.let { Text(it, color = AppMuted, fontSize = 13.sp, modifier = Modifier.padding(horizontal = 16.dp)) }+ b.blocks.forEach { BlockView(owner, it, surface, context) }+ }+ is Block.Text -> Text(+ b.text,+ color = if (b.style == TextStyle.CAPTION) AppMuted else AppText,+ fontSize = when (b.style) { TextStyle.TITLE -> 18.sp; TextStyle.BODY -> 14.sp; TextStyle.CAPTION -> 12.sp },+ fontWeight = if (b.style == TextStyle.TITLE) FontWeight.Bold else FontWeight.Normal,+ modifier = Modifier.padding(horizontal = 16.dp, vertical = 4.dp),+ )+ is Block.Card -> Row(+ verticalAlignment = Alignment.CenterVertically,+ modifier = Modifier.fillMaxWidth().padding(horizontal = 16.dp, vertical = 6.dp).clip(RoundedCornerShape(10.dp))+ .background(tone(0xFF242424)).clickable(enabled = b.target != null) { tapped(owner, b.target, surface, context) }.padding(10.dp),+ ) {+ b.image?.let { GlideImage(model = it, contentDescription = null, contentScale = ContentScale.Crop, modifier = Modifier.size(56.dp).clip(RoundedCornerShape(6.dp))) }+ Column(Modifier.padding(start = if (b.image != null) 12.dp else 0.dp)) {+ Text(b.title, color = AppText, fontSize = 15.sp, fontWeight = FontWeight.SemiBold, maxLines = 2, overflow = TextOverflow.Ellipsis)+ b.subtitle?.let { Text(it, color = AppMuted, fontSize = 13.sp, maxLines = 2, overflow = TextOverflow.Ellipsis) }+ }+ }+ is Block.Image -> GlideImage(+ model = b.url, contentDescription = null, contentScale = ContentScale.Crop,+ modifier = Modifier.fillMaxWidth().padding(horizontal = 16.dp, vertical = 6.dp).aspectRatio(b.ratio).clip(RoundedCornerShape(10.dp))+ .clickable(enabled = b.target != null) { tapped(owner, b.target, surface, context) },+ )+ is Block.Button -> ExtButton(b.label, b.icon, Modifier.padding(horizontal = 16.dp, vertical = 6.dp)) { Extensions.tap(owner, surface, b.action, context) }+ is Block.MenuEntry -> MenuEntryRow(owner, b, showOwner = false) { Extensions.tap(owner, surface, b.action, context) }+ is Block.Items -> {+ b.title?.let { Text(it, color = AppText, fontSize = 17.sp, fontWeight = FontWeight.Bold, modifier = Modifier.padding(start = 16.dp, end = 16.dp, top = 6.dp)) }+ if (b.kind == ItemKind.TRACKS) b.items.forEach { item ->+ Row(+ verticalAlignment = Alignment.CenterVertically,+ modifier = Modifier.fillMaxWidth().clickable { openFromExtension(item.uri) }.padding(horizontal = 16.dp, vertical = 6.dp),+ ) {+ GlideImage(model = item.image, contentDescription = null, contentScale = ContentScale.Crop,+ modifier = Modifier.size(48.dp).clip(RoundedCornerShape(4.dp)).background(tone(0xFF2A2A2A)))+ Column(Modifier.padding(start = 12.dp)) {+ Text(item.title, color = AppText, fontSize = 15.sp, maxLines = 1, overflow = TextOverflow.Ellipsis)+ item.subtitle?.let { Text(it, color = AppMuted, fontSize = 13.sp, maxLines = 1, overflow = TextOverflow.Ellipsis) }+ }+ }+ } else Row(Modifier.fillMaxWidth().horizontalScroll(rememberScrollState()).padding(horizontal = 10.dp)) {+ b.items.forEach { item ->+ Column(Modifier.width(140.dp).clickable { openFromExtension(item.uri) }.padding(6.dp)) {+ GlideImage(model = item.image, contentDescription = null, contentScale = ContentScale.Crop,+ modifier = Modifier.size(128.dp).clip(if (b.kind == ItemKind.ARTISTS) CircleShape else RoundedCornerShape(8.dp)).background(tone(0xFF2A2A2A)))+ Text(item.title, color = AppText, fontSize = 13.sp, fontWeight = FontWeight.SemiBold, maxLines = 1, overflow = TextOverflow.Ellipsis, modifier = Modifier.padding(top = 6.dp))+ item.subtitle?.let { Text(it, color = AppMuted, fontSize = 11.sp, maxLines = 2, overflow = TextOverflow.Ellipsis) }+ }+ }+ }+ }+ }+}++@Composable+private fun ExtButton(label: String, icon: String, modifier: Modifier = Modifier, onClick: () -> Unit) {+ Row(+ verticalAlignment = Alignment.CenterVertically,+ modifier = modifier.clip(RoundedCornerShape(50)).background(tone(0xFF2A2A2A)).clickable(onClick = onClick).padding(horizontal = 14.dp, vertical = 8.dp),+ ) {+ Icon(blockIcon(icon), null, tint = AppText, modifier = Modifier.size(18.dp))+ Spacer(Modifier.width(6.dp))+ Text(label, color = AppText, fontSize = 13.sp, maxLines = 1, overflow = TextOverflow.Ellipsis)+ }+}++// ── ⋯ menus ──++/**+ * The extensions' entries at the end of a ⋯ menu ([surface]: a song, album, playlist or artist+ * menu): a few on screen (quotas), the rest under "Extensions ⋯". Each entry names its extension.+ */+@Composable+fun ExtensionMenuEntries(surface: Surface, uri: String, title: String, subtitle: String = "", onDone: () -> Unit) {+ if (!Extensions.isReady || uri.isBlank()) return+ val input = remember(uri, title) { placeJson(surface.key.substringAfter('.'), uri, title, subtitle) }+ val tick by Extensions.blocksTick.collectAsState()+ val shown by produceState(Conflicts.Shown<String>(emptyList(), emptyList()), input, tick) {+ value = runCatching { Extensions.blocks(Hook.MENU, surface, input) }.getOrDefault(Conflicts.Shown(emptyList(), emptyList()))+ }+ if (shielded()) return+ var more by remember { mutableStateOf(false) }+ shown.shown.forEach { (owner, b) -> if (b is Block.MenuEntry) MenuEntryRow(owner, b) { Extensions.tap(owner, surface, b.action, input); onDone() } }+ if (shown.overflow.isNotEmpty()) {+ Row(+ verticalAlignment = Alignment.CenterVertically,+ modifier = Modifier.fillMaxWidth().height(56.dp).clickable { more = !more }.padding(horizontal = 16.dp),+ ) {+ Icon(Icons.Rounded.Extension, null, tint = AppMuted, modifier = Modifier.size(24.dp))+ Spacer(Modifier.width(16.dp))+ Text(stringResource(R.string.ext_overflow) + " ⋯", color = AppText, fontSize = 16.sp)+ }+ if (more) shown.overflow.forEach { (owner, b) ->+ if (b is Block.MenuEntry) MenuEntryRow(owner, b, indent = true) { Extensions.tap(owner, surface, b.action, input); onDone() }+ }+ }+}++@Composable+private fun MenuEntryRow(owner: String, b: Block.MenuEntry, showOwner: Boolean = true, indent: Boolean = false, onClick: () -> Unit) {+ Row(+ verticalAlignment = Alignment.CenterVertically,+ modifier = Modifier.fillMaxWidth().height(56.dp).clickable(onClick = onClick).padding(start = if (indent) 32.dp else 16.dp, end = 16.dp),+ ) {+ Icon(blockIcon(b.icon), null, tint = AppMuted, modifier = Modifier.size(24.dp))+ Spacer(Modifier.width(16.dp))+ Text(b.label, color = AppText, fontSize = 16.sp, maxLines = 1, overflow = TextOverflow.Ellipsis, modifier = Modifier.weight(1f, fill = false))+ if (showOwner) {+ Spacer(Modifier.width(8.dp))+ Text(nameOf(owner), color = AppMuted.copy(alpha = 0.7f), fontSize = 11.sp, maxLines = 1, overflow = TextOverflow.Ellipsis)+ }+ }+}++// ── The player ──++/** The extensions' buttons under the player's own controls: a few on screen, the rest behind ⋯. */+@Composable+fun ExtensionPlayerButtons(track: app.myspoti.extensions.TrackInfo?) {+ if (!Extensions.isReady || track == null) return+ val input = remember(track) { track.toJson() }+ val context = remember(track) { placeJson("track", track.uri, track.title, track.artist) }+ val tick by Extensions.blocksTick.collectAsState()+ val shown by produceState(Conflicts.Shown<String>(emptyList(), emptyList()), input, tick) {+ value = runCatching { Extensions.blocks(Hook.PLAYER, Surface.PLAYER, input) }.getOrDefault(Conflicts.Shown(emptyList(), emptyList()))+ }+ if (shielded() || (shown.shown.isEmpty() && shown.overflow.isEmpty())) return+ var more by remember { mutableStateOf(false) }+ Row(+ verticalAlignment = Alignment.CenterVertically,+ horizontalArrangement = Arrangement.spacedBy(8.dp),+ modifier = Modifier.fillMaxWidth().horizontalScroll(rememberScrollState()).padding(horizontal = 20.dp, vertical = 4.dp),+ ) {+ shown.shown.forEach { (owner, b) ->+ if (b is Block.Button) ExtButton(b.label, b.icon) { Extensions.tap(owner, Surface.PLAYER, b.action, context) }+ }+ if (shown.overflow.isNotEmpty()) Box {+ IconButton(onClick = { more = true }) { Icon(Icons.Rounded.MoreHoriz, stringResource(R.string.ext_overflow), tint = Color.White.copy(alpha = 0.8f)) }+ DropdownMenu(expanded = more, onDismissRequest = { more = false }) {+ shown.overflow.forEach { (owner, b) ->+ if (b is Block.Button) DropdownMenuItem(+ text = { Text("${b.label} · ${nameOf(owner)}", color = AppText) },+ leadingIcon = { Icon(blockIcon(b.icon), null, tint = AppAccent) },+ onClick = { more = false; Extensions.tap(owner, Surface.PLAYER, b.action, context) },+ )+ }+ }+ }+ }+}diff --git a/base/app/src/main/java/com/music/spotui/extensions/ExtensionUpdates.kt b/base/app/src/main/java/com/music/spotui/extensions/ExtensionUpdates.ktnew file mode 100644index 00000000..bc402e0c--- /dev/null+++ b/base/app/src/main/java/com/music/spotui/extensions/ExtensionUpdates.kt@@ -0,0 +1,322 @@+package com.music.spotui.extensions++import app.myspoti.extensions.Archive+import app.myspoti.extensions.BlockList+import app.myspoti.extensions.Catalog+import app.myspoti.extensions.ExtensionException+import app.myspoti.extensions.ExtensionPackage+import app.myspoti.extensions.GitHub+import app.myspoti.extensions.GitHubRepo+import app.myspoti.extensions.Manifest+import app.myspoti.extensions.Origin+import app.myspoti.extensions.Snapshot+import app.myspoti.extensions.UpdateGate+import app.myspoti.host.android.Logbook+import kotlinx.coroutines.delay+import kotlinx.coroutines.flow.MutableStateFlow+import kotlinx.coroutines.flow.StateFlow+import kotlinx.coroutines.flow.asStateFlow+import kotlinx.coroutines.Dispatchers+import kotlinx.coroutines.withContext+import java.io.File+import java.net.HttpURLConnection+import java.net.URI++/**+ * Extensions installed from GitHub: the download (the release's package, else the archive of+ * the tag or the default branch, cut down to a package), the daily update check and its gate+ * ([UpdateGate]: an update that asks nothing new is applied, anything else waits for the user's+ * OK on an "Update needs your OK" card while the old version runs), revert, and the kill switch+ * (the official repository's `blocked.json`, read once a day).+ *+ * The extension's copy on the phone is complete: a repository deleted or unreachable changes+ * nothing to what runs, the extension is only marked "source gone".+ */+object ExtensionUpdates {+ private const val DAY_MS = 24 * 3600 * 1000L+ private const val MAX_TEXT = 512 * 1024++ /** A package downloaded and read, with where it came from on GitHub (null: not from GitHub). */+ class Fetched(val zip: ByteArray, val pkg: ExtensionPackage, val origin: Origin?)++ /** What a check found, for the "Check for updates" button. */+ enum class Result { UP_TO_DATE, APPLIED, NEEDS_OK, DECLINED, SOURCE_GONE, INCOMPATIBLE, BLOCKED, NOT_FROM_GITHUB, FAILED }++ private val _blocks = MutableStateFlow(BlockList.EMPTY)+ val blocks: StateFlow<BlockList> = _blocks.asStateFlow()++ /** The ids being checked now (a spinner on the button). */+ val checking = MutableStateFlow<Set<String>>(emptySet())++ fun blocked(id: String, sha256: String?): Catalog.Block? = _blocks.value.blocks(id, sha256)++ // ── Downloads ──++ /** One answer: [status], the [body] (at most the limit asked), the redirect [location] when not followed, the [finalUrl]. */+ internal class Answer(val status: Int, val body: ByteArray?, val location: String?, val finalUrl: String)++ /** https only, no cookies. [follow]: follow redirects (else [Answer.location] is the target). */+ internal fun get(url: String, max: Int, follow: Boolean = true, accept: String? = null, method: String = "GET", body: String? = null, token: String? = null): Answer {+ val uri = runCatching { URI(url) }.getOrNull()+ if (uri?.scheme != "https" || uri.host.isNullOrBlank()) throw ExtensionException("an https address is needed")+ if (com.music.spotui.data.DataSaver.active) throw ExtensionException("the data saver is on")+ val c = uri.toURL().openConnection() as HttpURLConnection+ c.connectTimeout = 15_000; c.readTimeout = 20_000; c.useCaches = false+ c.instanceFollowRedirects = follow+ c.requestMethod = method+ c.setRequestProperty("User-Agent", "Myspoti-Extensions/1")+ accept?.let { c.setRequestProperty("Accept", it) }+ token?.let { c.setRequestProperty("Authorization", "Bearer $it") }+ try {+ if (body != null) {+ c.doOutput = true+ c.setRequestProperty("Content-Type", if (body.startsWith("{")) "application/json" else "application/x-www-form-urlencoded")+ c.outputStream.use { it.write(body.toByteArray()) }+ }+ val status = c.responseCode+ val stream = if (status in 200..299) c.inputStream else null+ val bytes = stream?.use { s ->+ val out = java.io.ByteArrayOutputStream()+ val buf = ByteArray(16 * 1024)+ while (true) {+ val n = s.read(buf)+ if (n < 0) break+ out.write(buf, 0, n)+ if (out.size() > max) throw ExtensionException("larger than ${max / 1024} KB")+ }+ out.toByteArray()+ }+ return Answer(status, bytes, c.getHeaderField("Location"), c.url.toString())+ } finally {+ c.disconnect()+ }+ }++ /**+ * The newest release's tag, read from GitHub's redirect (no API call), and the repository the+ * redirect points into (another one when it moved); nulls without a release. A missing+ * repository is told by its archive or manifest answering 404, not by this page.+ */+ private fun latestTag(repo: GitHubRepo): Pair<String?, String?> {+ val a = get(repo.latestRelease, MAX_TEXT, follow = false)+ return GitHub.tagFromLocation(a.location) to GitHub.repoOf(a.location)+ }++ private class SourceGone : ExtensionException("its GitHub repository is gone")++ /**+ * The complete extension from [repo]: at [ref] when given (a tag when [tag]), else the newest+ * release (its [GitHub.ASSET], else its archive), else the default branch's archive. An+ * archive is cut down to the package; [expectSha], when given, must be the download's or the+ * package's sha256.+ */+ suspend fun fromGitHub(repo: GitHubRepo, ref: String? = null, tag: Boolean = false, expectSha: String? = null): Fetched = withContext(Dispatchers.IO) {+ var at = ref+ var isTag = tag+ var movedTo: String? = null+ if (at == null) latestTag(repo).let { (t, r) -> at = t; isTag = t != null; movedTo = r }+ var asset = false+ var answer: Answer? = null+ if (isTag && at != null) {+ answer = get(repo.releaseAsset(at!!), GitHub.MAX_ARCHIVE).takeIf { it.status in 200..299 }+ asset = answer != null+ }+ if (answer == null) {+ answer = get(repo.archive(at ?: GitHubRepo.HEAD, isTag), GitHub.MAX_ARCHIVE)+ if (answer.status == 404) throw SourceGone()+ if (answer.status !in 200..299) throw ExtensionException("GitHub answered ${answer.status}")+ }+ val raw = answer.body ?: throw ExtensionException("GitHub sent nothing")+ val zip = Archive.toPackage(raw)+ if (expectSha != null && ExtensionPackage.sha256(raw) != expectSha.lowercase() && ExtensionPackage.sha256(zip) != expectSha.lowercase())+ throw ExtensionException("the package is not the one the store lists (sha256 differs)")+ val pkg = ExtensionPackage.read(zip)+ val from = movedTo ?: GitHub.repoOf(answer.finalUrl) ?: repo.slug+ Fetched(zip, pkg, Origin(from, at ?: GitHubRepo.HEAD, isTag, commit = if (asset) null else Archive.commit(raw), asset = asset))+ }++ // ── Updates ──++ /** Once at launch, then every few hours while the app runs: the kill switch and the updates that are due. */+ suspend fun daily() {+ while (true) {+ runCatching { refreshBlocks() }.onFailure { Logbook.log("ext: blocked.json not read: ${it.message}") }+ runCatching { checkAll(force = false) }+ delay(6 * 3600 * 1000L)+ }+ }++ /** Every extension from GitHub not checked for a day ([force]: all of them). */+ suspend fun checkAll(force: Boolean) {+ val now = System.currentTimeMillis()+ Extensions.registry.value.extensions.filter { it.origin != null && (force || now - it.lastCheck > DAY_MS) }.forEach { check(it.id, manual = force) }+ }++ /**+ * Looks for a newer version of [id] on GitHub. Not newer, or the one the user declined+ * (unless [manual]): nothing. Newer: downloaded to `staging.zip` and weighed against what+ * the user accepted; asks nothing new: applied (the running one kept to revert to); else it+ * waits there, listed on the card, while the old one keeps running.+ */+ suspend fun check(id: String, manual: Boolean): Result = withContext(Dispatchers.IO) {+ val e = Extensions.registry.value.find(id) ?: return@withContext Result.FAILED+ val origin = e.origin ?: return@withContext Result.NOT_FROM_GITHUB+ val repo = origin.gitHub() ?: return@withContext Result.NOT_FROM_GITHUB+ checking.value = checking.value + id+ try {+ val result = runCatching { checkOnce(e, origin, repo, manual) }.getOrElse { t ->+ if (t is SourceGone) {+ Extensions.update { r -> r.find(id)?.let { r.put(it.copy(sourceGone = true)) } ?: r }+ if (!e.sourceGone) Extensions.log(id, "its GitHub repository ${origin.repo} is gone: it keeps running from the copy on the phone")+ Result.SOURCE_GONE+ } else {+ Extensions.log(id, "update check failed: ${t.message ?: t}")+ Result.FAILED+ }+ }+ if (result != Result.FAILED) Extensions.update { r -> r.find(id)?.let { r.put(it.copy(lastCheck = System.currentTimeMillis())) } ?: r }+ result+ } finally {+ checking.value = checking.value - id+ }+ }++ private suspend fun checkOnce(e: InstalledExtension, origin: Origin, repo: GitHubRepo, manual: Boolean): Result {+ val id = e.id+ // Where to look: the newest release when it came from one (or one appeared), else its branch.+ val (tag, movedTo) = latestTag(repo)+ val ref = tag ?: if (origin.tag) GitHubRepo.HEAD else origin.ref+ val manifestAnswer = get(repo.raw(ref, "manifest.json"), MAX_TEXT)+ if (manifestAnswer.status == 404 && tag == null) throw SourceGone()+ val listed = manifestAnswer.body?.let { runCatching { Manifest.parse(it.decodeToString()) }.getOrNull() }+ if (e.sourceGone) Extensions.update { r -> r.find(id)?.let { r.put(it.copy(sourceGone = false)) } ?: r }+ // A release without a manifest at its root (its package only in the asset) is read in full.+ if (listed != null && listed.versionCode <= e.versionCode) return Result.UP_TO_DATE+ if (listed != null && !manual && listed.versionCode == e.declinedVersionCode) return Result.DECLINED+ if (listed != null && e.pendingUpdate?.kept?.versionCode == listed.versionCode) return Result.NEEDS_OK+ val f = fromGitHub(repo, tag ?: ref, tag = tag != null).let { f -> movedTo?.let { Fetched(f.zip, f.pkg, f.origin?.copy(repo = it)) } ?: f }+ val m = f.pkg.manifest+ if (m.versionCode <= e.versionCode) return Result.UP_TO_DATE+ if (!manual && m.versionCode == e.declinedVersionCode) return Result.DECLINED+ if (blocked(m.id, f.pkg.sha256) != null) return Result.BLOCKED+ if (!Catalog.Entry(m.id, m.name, m.version, m.versionCode, m.apiVersion, m.author, url = "", sha256 = "", minAppVersion = m.minAppVersion)+ .compatible(app.myspoti.engine.BuildConfig.VERSION_NAME)) return Result.INCOMPATIBLE+ val accepted = e.accepted ?: Extensions.manifest(id)?.let { Snapshot.of(it, origin.repo) } ?: return Result.FAILED+ val kept = KeptVersion(m.version, m.versionCode, f.pkg.sha256, f.origin)+ return when (val d = UpdateGate.decide(accepted, Snapshot.of(m, f.origin?.repo))) {+ UpdateGate.Decision.Apply -> {+ val plan = InstallPlan.of(m, e, accepted.toManifest()) as? InstallPlan.Update ?: return Result.UP_TO_DATE+ Extensions.install(f.zip, f.pkg, Grants.replacing(m, plan.refused), e.source, origin = f.origin, accepted = false)+ Extensions.update { r -> r.find(id)?.let { r.put(it.copy(accepted = it.accepted ?: accepted, pendingUpdate = null)) } ?: r }+ Extensions.log(id, "updated by itself to ${m.version}: it asks nothing new")+ Result.APPLIED+ }+ is UpdateGate.Decision.Ask -> {+ Extensions.writeBytesAtomically(File(Extensions.dir, "$id/staging.zip"), f.zip)+ Extensions.update { r -> r.find(id)?.let { r.put(it.copy(pendingUpdate = PendingUpdate(kept, d.changes, m.changelog))) } ?: r }+ Extensions.log(id, "${m.version} waits for your OK: ${d.changes.joinToString { "${it.kind.name.lowercase()} ${it.key}" }}")+ Result.NEEDS_OK+ }+ }+ }++ /** The staged update of [id], read and checked against what was staged. */+ private fun staged(id: String): ExtensionPackage? {+ val e = Extensions.registry.value.find(id) ?: return null+ val p = e.pendingUpdate ?: return null+ val bytes = runCatching { File(Extensions.dir, "$id/staging.zip").readBytes() }.getOrNull() ?: return null+ return runCatching { ExtensionPackage.read(bytes) }.getOrNull()?.takeIf { it.sha256 == p.kept.sha256 }+ }++ /**+ * The user read the card and accepted: the staged version is installed with all it lists+ * granted (but the actions unticked before, still waiting on their own card), and becomes the+ * accepted snapshot.+ */+ suspend fun accept(id: String) = withContext(Dispatchers.IO) {+ val e = Extensions.registry.value.find(id) ?: return@withContext+ val p = staged(id) ?: run { Extensions.update { r -> r.put(e.copy(pendingUpdate = null)) }; throw ExtensionException("the update is no longer on the phone: check again") }+ val accepted = e.accepted?.toManifest() ?: Extensions.manifest(id)+ val plan = InstallPlan.of(p.manifest, e, accepted) as? InstallPlan.Update ?: return@withContext+ val grant = Grants.replacing(p.manifest, plan.refused)+ val zip = File(Extensions.dir, "$id/staging.zip").readBytes()+ Extensions.install(zip, p, grant, e.source, clashes = Extensions.clashes(p.manifest), origin = e.pendingUpdate?.kept?.origin, accepted = true)+ Extensions.update { r -> r.find(id)?.let { r.put(it.copy(pendingUpdate = null)) } ?: r }+ }++ /** "Keep current": the staged version is dropped and not offered again (a newer one will be). */+ fun keepCurrent(id: String) {+ val e = Extensions.registry.value.find(id) ?: return+ File(Extensions.dir, "$id/staging.zip").delete()+ Extensions.update { r -> r.put(e.copy(pendingUpdate = null, declinedVersionCode = e.pendingUpdate?.kept?.versionCode ?: e.declinedVersionCode)) }+ Extensions.log(id, "kept ${e.version}: ${e.pendingUpdate?.kept?.version} declined")+ }++ /**+ * Back to the version kept on disk; the one left becomes the kept one (so a second tap undoes+ * it), and it is not applied again by itself.+ */+ suspend fun revert(id: String) = withContext(Dispatchers.IO) {+ val e = Extensions.registry.value.find(id) ?: return@withContext+ val prev = e.previous ?: throw ExtensionException("no previous version on the phone")+ val folder = File(Extensions.dir, id)+ val bytes = runCatching { File(folder, "previous.zip").readBytes() }.getOrElse { throw ExtensionException("the previous version is missing") }+ val p = ExtensionPackage.read(bytes)+ if (p.sha256 != prev.sha256) throw ExtensionException("the previous version changed on the phone")+ blocked(id, p.sha256)?.let { throw ExtensionException("blocked by Myspoti: ${it.reason.ifBlank { "no reason given" }}") }+ val refused = Extensions.manifest(id)?.let { Grants.refused(e, it) }.orEmpty()+ Extensions.stop(id)+ val current = File(folder, "package.zip").readBytes()+ Extensions.writeBytesAtomically(File(folder, "package.zip"), bytes)+ Extensions.writeBytesAtomically(File(folder, "previous.zip"), current)+ Extensions.packages[id] = p+ val now = e.copy(+ version = prev.version, versionCode = prev.versionCode, sha256 = prev.sha256, origin = prev.origin ?: e.origin,+ granted = Grants.replacing(p.manifest, refused),+ previous = KeptVersion(e.version, e.versionCode, e.sha256, e.origin),+ declinedVersionCode = maxOf(e.declinedVersionCode, e.versionCode),+ )+ Extensions.update { it.put(now) }+ Extensions.log(id, "reverted ${e.version} → ${prev.version}")+ Extensions.start(now)+ }++ // ── The kill switch ──++ private val blocksFile get() = File(Extensions.dir, "cache/blocked.json")++ /** The last list read, at launch, before the network answers. */+ fun readCachedBlocks() {+ runCatching { _blocks.value = BlockList.parse(blocksFile.readText()) }+ }++ /** Reads `blocked.json` (once a day; [force]: now) and turns off what it blocks. */+ suspend fun refreshBlocks(force: Boolean = false) = withContext(Dispatchers.IO) {+ val f = blocksFile+ if (force || !f.isFile || System.currentTimeMillis() - f.lastModified() > DAY_MS) {+ val a = get(GitHub.BLOCKED_URL, MAX_TEXT)+ if (a.status != 404 && a.status !in 200..299) throw ExtensionException("GitHub answered ${a.status}")+ val text = a.body?.decodeToString().orEmpty()+ _blocks.value = BlockList.of(a.status, text)+ writeAtomically(f, if (a.status == 404) "{}" else text)+ }+ Extensions.registry.value.extensions.forEach { e ->+ blocked(e.id, e.sha256)?.let { b -> if (e.enabled) Extensions.disable(e.id, "blocked by Myspoti: ${b.reason.ifBlank { "no reason given" }}") }+ }+ }++ // ── A small cache of GitHub answers (the store's search, manifests, ratings) ──++ /** [url]'s body, from the cache when younger than [maxAgeMs], else fetched and kept; null on 404. */+ internal fun cached(url: String, maxAgeMs: Long, max: Int = MAX_TEXT): String? {+ val f = File(Extensions.dir, "cache/" + ExtensionPackage.sha256(url.toByteArray()).take(24))+ if (f.isFile && System.currentTimeMillis() - f.lastModified() < maxAgeMs) return f.readText().ifEmpty { null }+ val a = runCatching { get(url, max, accept = if (url.startsWith("https://api.github.com/")) "application/vnd.github+json" else null) }+ .getOrElse { if (f.isFile) return f.readText().ifEmpty { null } else throw it }+ if (a.status == 404) { writeAtomically(f, ""); return null }+ if (a.status !in 200..299) { if (f.isFile) return f.readText().ifEmpty { null }; throw ExtensionException("GitHub answered ${a.status}") }+ val text = a.body?.decodeToString().orEmpty()+ writeAtomically(f, text)+ return text+ }+}diff --git a/base/app/src/main/java/com/music/spotui/extensions/Extensions.kt b/base/app/src/main/java/com/music/spotui/extensions/Extensions.ktnew file mode 100644index 00000000..12e229b4--- /dev/null+++ b/base/app/src/main/java/com/music/spotui/extensions/Extensions.kt@@ -0,0 +1,1111 @@+package com.music.spotui.extensions++import android.app.Application+import android.os.Handler+import android.os.Looper+import app.myspoti.extensions.Action+import app.myspoti.extensions.ActivityLog+import app.myspoti.extensions.Area+import app.myspoti.extensions.AudioQuery+import app.myspoti.extensions.AudioStream+import app.myspoti.extensions.Blocks+import app.myspoti.extensions.Clash+import app.myspoti.extensions.Conflicts+import app.myspoti.extensions.PageContent+import app.myspoti.extensions.PlaybackArbiter+import app.myspoti.extensions.Surface+import app.myspoti.extensions.SurfaceGuard+import app.myspoti.extensions.mode+import app.myspoti.extensions.BasicHttp+import app.myspoti.extensions.Catalog+import app.myspoti.extensions.DownloadFile+import app.myspoti.extensions.DownloadQuery+import app.myspoti.extensions.PlaybackEvent+import app.myspoti.extensions.ExtensionException+import app.myspoti.extensions.ExtensionPackage+import app.myspoti.extensions.ExtensionRuntime+import app.myspoti.extensions.Hook+import app.myspoti.extensions.Host+import app.myspoti.extensions.HttpRequest+import app.myspoti.extensions.HttpResponse+import app.myspoti.extensions.LyricsResult+import app.myspoti.extensions.Manifest+import app.myspoti.extensions.Snapshot+import app.myspoti.extensions.SpotifyCall+import app.myspoti.extensions.SpotifyDispatcher+import app.myspoti.extensions.SpotifyRaw+import app.myspoti.extensions.Storage+import app.myspoti.extensions.TrackInfo+import app.myspoti.host.android.Logbook+import app.myspoti.host.android.MyspotiRuntime+import com.music.spotui.data.entity.Lyrics+import com.music.spotui.di.SongPlayer+import kotlinx.coroutines.CoroutineScope+import kotlinx.coroutines.Dispatchers+import kotlinx.coroutines.FlowPreview+import kotlinx.coroutines.SupervisorJob+import kotlinx.coroutines.async+import kotlinx.coroutines.flow.MutableStateFlow+import kotlinx.coroutines.flow.StateFlow+import kotlinx.coroutines.flow.asStateFlow+import kotlinx.coroutines.flow.debounce+import kotlinx.coroutines.flow.distinctUntilChanged+import kotlinx.coroutines.flow.filter+import kotlinx.coroutines.launch+import kotlinx.coroutines.runBlocking+import kotlinx.coroutines.runInterruptible+import kotlinx.coroutines.withContext+import kotlinx.coroutines.withTimeoutOrNull+import kotlinx.serialization.json.JsonElement+import kotlinx.serialization.json.JsonObject+import java.io.File+import java.net.HttpURLConnection+import java.net.URI+import java.util.concurrent.ConcurrentHashMap++/**+ * The extensions installed on this phone: their packages, the rights the user granted, one+ * sandbox ([ExtensionRuntime]) each, on its own thread, for the enabled ones; and the fixed+ * points of the app that ask them (lyrics, a song's audio, a song's download files, the `track`+ * and `playback` events).+ *+ * Files: `files/extensions/registry.json`, and per extension `files/extensions/<id>/`+ * (`package.zip`, the running version, complete: it runs offline and outlives its repository;+ * `previous.zip`, the version before, to revert to; `staging.zip`, an update waiting for the+ * user's OK; `storage.json`, `settings.json`, `log.txt`). GitHub sources, updates and the kill+ * switch: [ExtensionUpdates].+ *+ * Nothing here runs on the main thread except posting to it; a failing extension is turned off+ * with its reason (it failed to load, failed [FailureCounter] times in a row, or threw something+ * the sandbox does not expect), never the app.+ */+object Extensions {+ /** A lyrics hook call (as the desktop runner gives it). */+ const val LYRICS_MS = 8_000L+ /** An audio-source hook call. */+ const val AUDIO_MS = 15_000L+ /** A download-source hook call (an extension may try several places). */+ const val DOWNLOAD_MS = 30_000L+ private const val TRACK_MS = 3_000L+ /** A block, tap or page-message hook call: the screen waits for it. */+ private const val BLOCKS_MS = 3_000L+ private const val PAGE_MS = 5_000L+ /** An `online` event: the extension sends what waited. */+ private const val ONLINE_MS = 30_000L+ /** A `setting` event: a button may pair again with a server. */+ private const val SETTING_MS = 30_000L+ private const val SETTING_PAUSE_MS = 800L+ /** An `auth` event. */+ internal const val AUTH_MS = 10_000L+ private const val MAX_INDEX = 1024 * 1024++ private lateinit var ctx: Application+ internal lateinit var dir: File+ private val main by lazy { Handler(Looper.getMainLooper()) }+ private val scope = CoroutineScope(SupervisorJob() + Dispatchers.IO)+ private val lock = Any()++ private val _registry = MutableStateFlow(Registry())+ val registry: StateFlow<Registry> = _registry.asStateFlow()++ /** The last failure of each extension, for its page. */+ private val _errors = MutableStateFlow<Map<String, String>>(emptyMap())+ val errors: StateFlow<Map<String, String>> = _errors.asStateFlow()++ /** Bumped when an extension's log gets a line, so an open log view reads it again. */+ val logTick = MutableStateFlow(0L)++ private val runtimes = ConcurrentHashMap<String, ExtensionRuntime>()+ internal val packages = ConcurrentHashMap<String, ExtensionPackage>()+ private val stores = ConcurrentHashMap<String, FileStore>()+ private val settings = ConcurrentHashMap<String, FileStore>()+ private val logs = ConcurrentHashMap<String, ExtensionLog>()+ private val failures = FailureCounter()++ val isReady: Boolean get() = ::dir.isInitialized++ fun init(application: Application) {+ if (isReady) return+ ctx = application+ dir = File(application.filesDir, "extensions")+ _registry.value = Registry.read(File(dir, "registry.json"))+ // A protected surface just went: what extensions draw is asked again.+ CoroutineScope(SupervisorJob() + Dispatchers.Default).launch { guard.state.collect { if (it.isEmpty()) blocksTick.value++ } }+ scope.launch {+ // Nothing is ever installed without the prompt: a folder the old debug inbox left is dropped.+ File(dir, "inbox").takeIf { it.exists() }?.deleteRecursively()+ ExtensionUpdates.readCachedBlocks()+ // One after the other, their sources asked only once all are loaded: a cold start is busy enough.+ _registry.value.extensions.filter { it.enabled }.forEach { start(it, probe = false) }+ started.complete(Unit)+ probeAll()+ ExtensionUpdates.daily()+ }+ watchTracks()+ watchPlayback()+ watchNetwork()+ watchStatus()+ }++ // ── Writes allowed for good ──++ /** Keeps [g] for [id]: its `raw.request` writes [g] covers run without asking. */+ fun addRawGrant(id: String, g: app.myspoti.extensions.RawGrant) = update { r ->+ r.find(id)?.let { e -> if (g in e.rawGrants) r else r.put(e.copy(rawGrants = e.rawGrants + g)) } ?: r+ }.also { log(id, "always allowed: $g") }++ fun revokeRawGrant(id: String, g: app.myspoti.extensions.RawGrant) = update { r ->+ r.find(id)?.let { e -> r.put(e.copy(rawGrants = e.rawGrants - g)) } ?: r+ }.also { log(id, "no longer allowed: $g") }++ // ── Work that waits for the network ──++ /** Whether the device has a network now. */+ private fun isOnline(): Boolean {+ val cm = ctx.getSystemService(android.net.ConnectivityManager::class.java) ?: return true+ return cm.getNetworkCapabilities(cm.activeNetwork)?.hasCapability(android.net.NetworkCapabilities.NET_CAPABILITY_VALIDATED) == true+ }++ /** The marker of an `online` event asked and not yet delivered: it survives a restart. */+ private fun onlineMarker(id: String) = File(dir, "$id/online")++ private fun askOnline(id: String) {+ runCatching { onlineMarker(id).apply { parentFile?.mkdirs() }.createNewFile() }+ if (isOnline()) deliverOnline(id)+ }++ /** Sends `online` to [id] if it asked for it and runs; the marker goes first, so it is sent once. */+ private fun deliverOnline(id: String) {+ val rt = runtimes[id] ?: return+ if (!onlineMarker(id).delete()) return+ scope.launch { runCatching { runInterruptible { rt.emit(ExtensionRuntime.EVENT_ONLINE, "{}", ONLINE_MS) } }.onFailure { failed(id, it.toString()) } }+ }++ /** The network went (and the extensions' sources are asked again once it is back). */+ @Volatile private var networkLost = false++ private fun watchNetwork() {+ val cm = ctx.getSystemService(android.net.ConnectivityManager::class.java) ?: return+ runCatching {+ cm.registerDefaultNetworkCallback(object : android.net.ConnectivityManager.NetworkCallback() {+ override fun onCapabilitiesChanged(network: android.net.Network, caps: android.net.NetworkCapabilities) {+ if (!caps.hasCapability(android.net.NetworkCapabilities.NET_CAPABILITY_VALIDATED)) return+ runtimes.keys.forEach(::deliverOnline)+ if (networkLost) { networkLost = false; probeAll() }+ }++ override fun onLost(network: android.net.Network) { networkLost = true }+ })+ }.onFailure { Logbook.log("ext: no network callback: ${it.message}") }+ }++ // ── Installed extensions ──++ fun manifest(id: String): Manifest? = pkg(id)?.manifest++ fun pkg(id: String): ExtensionPackage? = packages[id] ?: runCatching {+ ExtensionPackage.read(File(dir, "$id/package.zip").readBytes())+ }.getOrNull()?.let { packages.putIfAbsent(id, it) ?: it } // an install's newer package is never replaced by an older read++ fun isRunning(id: String) = runtimes.containsKey(id)++ /**+ * What installing [p] would do, given what is on the phone: an update is weighed against+ * what the user accepted ([InstalledExtension.accepted]), not the version running.+ */+ fun plan(p: ExtensionPackage): InstallPlan {+ val installed = _registry.value.find(p.manifest.id)+ return InstallPlan.of(p.manifest, installed, installed?.let { it.accepted?.toManifest() ?: manifest(it.id) })+ }++ /**+ * What [m] would collide with among the enabled extensions: an exclusive action another one+ * provides now, `conflictsWith`, `replaces` (see [Conflicts.clashes]).+ */+ fun clashes(m: Manifest): List<Clash> = _registry.value.let { r ->+ val enabled = r.byPriority(Area.PLAYBACK.key, r.extensions.filter { it.enabled && it.id != m.id }) { it.id }.mapNotNull { manifest(it.id) }+ Conflicts.clashes(m, enabled, r.active)+ }++ /**+ * Installs (or updates to) [p] with [granted]; its sandbox starts at once. [keepNew]: how the+ * user settled each of [clashes] (see [Clashes.apply]); [noticeAccepted]: the third-party notice.+ * [origin]: the GitHub repository it came from (else the one it came from before is kept).+ * [accepted]: the user saw what it asks (install prompt, update card), so it becomes the+ * snapshot later updates are weighed against; false for an update applied by itself.+ * The version it replaces is kept as `previous.zip`.+ */+ suspend fun install(+ zip: ByteArray, p: ExtensionPackage, granted: Set<String>, source: String,+ clashes: List<Clash> = emptyList(), keepNew: (Clash) -> Boolean = { true }, noticeAccepted: Boolean = true,+ origin: app.myspoti.extensions.Origin? = null, accepted: Boolean = true,+ ) = withContext(Dispatchers.IO) {+ val id = p.manifest.id+ ExtensionUpdates.blocked(id, p.sha256)?.let { throw ExtensionException("blocked by Myspoti: ${it.reason.ifBlank { "no reason given" }}") }+ // Under the extension's start lock: a start racing this update never sees the new package+ // beside the old entry (it read as "changed on the phone" and turned the extension off).+ val (e, before) = synchronized(startLocks.getOrPut(id) { Any() }) {+ val before = _registry.value.find(id)+ val beforeManifest = before?.let { manifest(id) }+ stop(id)+ val folder = File(dir, id).apply { mkdirs() }+ val current = File(folder, "package.zip")+ if (before != null && current.isFile && before.sha256 != p.sha256) current.copyTo(File(folder, "previous.zip"), overwrite = true)+ writeBytesAtomically(current, zip)+ File(folder, "staging.zip").delete()+ packages[id] = p+ var startOff = false+ update { r ->+ val (settled, off) = Clashes.apply(r, id, clashes, keepNew)+ startOff = off+ settled.copy(noticeAccepted = if (noticeAccepted) settled.noticeAccepted + id else settled.noticeAccepted)+ }+ clashes.filter { keepNew(it) && it.kind != Clash.Kind.EXCLUSIVE }.forEach { stop(it.otherId); log(it.otherId, "turned off: replaced by $id") }+ val e = InstalledExtension(+ id = id, name = p.manifest.name, version = p.manifest.version, versionCode = p.manifest.versionCode,+ author = p.manifest.author, sha256 = p.sha256, granted = granted, enabled = !startOff,+ disabledReason = if (startOff) "kept the extension it conflicts with" else null,+ installedAt = before?.installedAt ?: System.currentTimeMillis(), source = source,+ origin = origin ?: before?.origin,+ accepted = if (accepted) Snapshot.of(p.manifest, (origin ?: before?.origin)?.repo)+ else before?.accepted ?: beforeManifest?.let { Snapshot.of(it, before?.origin?.repo) },+ previous = if (before != null && before.sha256 != p.sha256) KeptVersion(before.version, before.versionCode, before.sha256, before.origin) else before?.previous,+ declinedVersionCode = before?.declinedVersionCode ?: 0,+ lastCheck = before?.lastCheck ?: 0,+ // The writes it declared are allowed with the install (shown under spotify.raw before it).+ rawGrants = (before?.rawGrants.orEmpty() ++ if (app.myspoti.extensions.Action.SPOTIFY_RAW.key in granted) p.manifest.declaredWrites() else emptyList()).distinct(),+ )+ update { it.put(e) }+ e to before+ }+ failures.reset(id)+ clearError(id)+ log(id, if (before == null) "installed ${p.manifest.version} from $source" else "updated ${before.version} → ${p.manifest.version}")+ start(e)+ if (before == null) p.manifest.welcome?.takeIf { p.manifest.problems().isEmpty() }?.let { welcome.value = id to it }+ }++ suspend fun uninstall(id: String) = withContext(Dispatchers.IO) {+ stop(id)+ update { it.remove(id) }+ packages.remove(id); stores.remove(id); settings.remove(id); logs.remove(id)+ clearError(id)+ File(dir, id).deleteRecursively()+ Logbook.log("ext $id: uninstalled")+ }++ fun setEnabled(id: String, on: Boolean, clashes: List<Clash> = emptyList(), keepNew: (Clash) -> Boolean = { true }) = scope.launch {+ val e = _registry.value.find(id) ?: return@launch+ if (on) {+ ExtensionUpdates.blocked(id, e.sha256)?.let { return@launch disable(id, "blocked by Myspoti: ${it.reason.ifBlank { "no reason given" }}") }+ // The user kept the one it conflicts with: it stays off.+ if (Clashes.apply(_registry.value, id, clashes, keepNew).second) return@launch+ update { Clashes.apply(it, id, clashes, keepNew).first }+ clashes.filter { keepNew(it) && it.kind != Clash.Kind.EXCLUSIVE }.forEach { stop(it.otherId); log(it.otherId, "turned off: replaced by $id") }+ arbiter.resume(id)+ val now = e.copy(enabled = true, disabledReason = null)+ update { it.put(now) }+ failures.reset(id)+ clearError(id)+ start(now)+ } else {+ stop(id)+ update { it.put(e.copy(enabled = false)) }+ log(id, "turned off")+ }+ }++ /**+ * The user accepted, once, the actions they had unticked before installs granted everything+ * ([Grants.refused]): it is granted all it lists. Turning it back on is the caller's (clashes).+ */+ suspend fun acceptAll(id: String) = withContext(Dispatchers.IO) {+ val e = _registry.value.find(id) ?: return@withContext+ val m = manifest(id) ?: return@withContext+ update { it.put(e.copy(granted = Grants.keys(m), disabledReason = null)) }+ log(id, "accepted all its actions")+ }++ fun settingValues(id: String): Map<String, String> = settingsOf(id).all()++ /** [json]: the value as JSON text, null to go back to the manifest's default. */+ fun setSetting(id: String, key: String, json: String?) {+ val s = settingsOf(id)+ if (json == null) s.remove(key) else s.set(key, json)+ // Typing changes a text field at each key: the extension hears of it once the user pauses.+ settingJobs.remove("$id\u0000$key")?.cancel()+ settingJobs["$id\u0000$key"] = scope.launch { kotlinx.coroutines.delay(SETTING_PAUSE_MS); sendSetting(id, key, pressed = false) }+ }++ /** A button setting was pressed: the extension does what it says (pair again…). */+ fun pressSetting(id: String, key: String) {+ log(id, "setting $key pressed")+ scope.launch { sendSetting(id, key, pressed = true) }+ }++ private val settingJobs = ConcurrentHashMap<String, kotlinx.coroutines.Job>()++ private suspend fun sendSetting(id: String, key: String, pressed: Boolean) {+ val rt = runtimes[id]?.takeIf { it.listens(ExtensionRuntime.EVENT_SETTING) } ?: return+ val json = kotlinx.serialization.json.buildJsonObject {+ put("key", kotlinx.serialization.json.JsonPrimitive(key))+ if (pressed) put("pressed", kotlinx.serialization.json.JsonPrimitive(true))+ }.toString()+ runCatching { runInterruptible { rt.emit(ExtensionRuntime.EVENT_SETTING, json, SETTING_MS) } }.onFailure { failed(id, it.toString()) }+ }++ fun logLines(id: String): List<String> = logOf(id).lines()++ fun clearLog(id: String) { logOf(id).clear(); logTick.value++ }++ // ── The hooks, at their fixed points ──++ /**+ * The running extensions providing [hook], in their area's priority order. An exclusive action+ * ([app.myspoti.extensions.Mode.EXCLUSIVE]) has one: the one the user made active, else the first.+ */+ private fun providing(hook: Hook): List<Pair<String, ExtensionRuntime>> = _registry.value.let { r ->+ val area = (hook.action?.area ?: Area.OTHER).key+ // A source whose last `status` said it does not answer is skipped: the next one, or Spotify, plays.+ val skip = { id: String -> hook in SOURCE_HOOKS && health.inactive(id) }+ val all = r.byPriority(area, r.extensions) { it.id }.mapNotNull { e -> runtimes[e.id]?.takeIf { e.enabled && it.provides(hook) && !skip(e.id) }?.let { e.id to it } }+ val action = hook.action+ if (action == null || action.mode != app.myspoti.extensions.Mode.EXCLUSIVE) all+ else Conflicts.activeFor(all.map { it.first }, r.active[action.key]).let { one -> all.filter { it.first == one } }+ }++ /** The installed extensions per area, in the user's order (the Installed tab). */+ fun byArea(): Map<Area, List<InstalledExtension>> = Areas.group(_registry.value, ::manifest)++ /** Moves [id] up (negative [delta]) or down in [area]'s order. */+ fun movePriority(area: Area, id: String, delta: Int) = update { r ->+ r.move(area.key, Areas.group(r, ::manifest).getValue(area).map { it.id }, id, delta)+ }++ /** Makes [id] the one acting for the exclusive [action]; the others stay installed, idle. */+ fun setActive(action: Action, id: String) {+ update { it.copy(active = it.active + (action.key to id)) }+ log(id, "now active for ${action.key}")+ }++ /** Who acts for the exclusive [action] now (null: nobody). */+ fun activeFor(action: Action): String? = _registry.value.let { r ->+ Conflicts.activeFor(action.area?.let { byArea()[it] }.orEmpty().filter { it.enabled && action in manifest(it.id)?.actionSet().orEmpty() }.map { it.id }, r.active[action.key])+ }++ // ── Who did what, and the playback arbiter ──++ /** The last things extensions did, per area (the Installed tab's activity). */+ val activity = ActivityLog()++ private fun did(area: Area, id: String, text: String) = activity.add(area, id, text)++ /** Protected surfaces on screen (support, update, install, confirmations, report, about). */+ val guard: SurfaceGuard get() = SurfaceGuard.app++ /** An extension the arbiter suspended (it fought another over playback): the app asks to turn it off. */+ val suspendedNotice = MutableStateFlow<Pair<String, String>?>(null)++ /** An extension just installed for the first time, and its welcome (`welcome` in its manifest). */+ val welcome = MutableStateFlow<Pair<String, app.myspoti.extensions.Welcome>?>(null)++ private val arbiter = PlaybackArbiter({ id -> byArea()[Area.PLAYBACK].orEmpty().indexOfFirst { it.id == id }.let { if (it < 0) Int.MAX_VALUE else it } })++ /** Lets a suspended extension send playback commands again. */+ fun resumePlayback(id: String) = arbiter.resume(id)++ /** One playback command from [id] through the arbiter: whether it may run. */+ private fun arbitrate(id: String, command: String): Boolean {+ val v = arbiter.submit(id, command)+ val name = { x: String -> _registry.value.find(x)?.name ?: x }+ when {+ v.allowed -> did(Area.PLAYBACK, id, "${commandLabel(command)} by ${name(id)}")+ v.reason == "rate" -> log(id, "playback: too many commands, $command dropped")+ v.reason == "overridden" -> { did(Area.PLAYBACK, id, "${commandLabel(command)} by ${name(id)} overridden by ${name(v.winner.orEmpty())}"); log(id, "playback: $command overridden by ${v.winner}") }+ }+ v.suspend?.let { lower ->+ val other = if (lower == id) v.winner.orEmpty() else id+ did(Area.PLAYBACK, lower, "${name(lower)} suspended: it kept undoing ${name(other)}")+ log(lower, "playback commands suspended: it kept contradicting $other")+ suspendedNotice.value = lower to other+ }+ return v.allowed+ }++ private fun commandLabel(command: String) = when (command) {+ "next" -> "Skipped"; "previous" -> "Went back"; "pause" -> "Paused"; "play", "resume" -> "Played"; "seek" -> "Moved in the song"+ else -> command.replaceFirstChar { it.uppercase() }+ }++ // ── Blocks, pages and taps ──++ /** Bumped when an extension asks for its blocks to be asked again (`myspoti.ui.refresh`). */+ val blocksTick = MutableStateFlow(0L)++ /** The blocks the extensions draw on [surface] for [input], merged (de-duplicated, quotas) in their area's order. */+ suspend fun blocks(hook: Hook, surface: Surface, input: String): Conflicts.Shown<String> {+ if (!isReady || guard.suspended) return Conflicts.Shown(emptyList(), emptyList())+ val providers = providing(hook)+ if (providers.isEmpty()) return Conflicts.Shown(emptyList(), emptyList())+ val answers = kotlinx.coroutines.coroutineScope {+ providers.map { (id, rt) -> async { id to (callHook(id, rt, hook, input, BLOCKS_MS) { Blocks.parse(it, surface) } ?: emptyList()) } }.map { it.await() }+ }+ return Conflicts.merge(answers, surface)+ }++ /** A block of [id] with an action was tapped on [surface]; [context]: what the place is about (JSON). */+ fun tap(id: String, surface: Surface, action: String, context: String) {+ if (guard.suspended) return+ val rt = runtimes[id] ?: return+ val input = """{"action":${kotlinx.serialization.json.JsonPrimitive(action)},"surface":"${surface.key}","context":$context}"""+ scope.launch { callHook(id, rt, Hook.TAP, input, BLOCKS_MS) { it } }+ }++ /** [id]'s page, or null. */+ suspend fun page(id: String): PageContent? {+ val rt = runtimes[id]?.takeIf { it.provides(Hook.PAGE) } ?: return null+ return callHook(id, rt, Hook.PAGE, "{}", PAGE_MS) { PageContent.parse(it, rt.manifest.name) }+ }++ /** Where [id]'s open page receives messages (its WebView), or nothing. */+ private val pageSinks = ConcurrentHashMap<String, (String) -> Unit>()++ fun attachPage(id: String, sink: ((String) -> Unit)?) { if (sink == null) pageSinks.remove(id) else pageSinks[id] = sink }++ /** A message [id]'s page posted: its extension's answer goes back to that page only. */+ fun pageMessage(id: String, data: String) {+ if (data.length > 64 * 1024 || guard.suspended) return+ val rt = runtimes[id] ?: return+ val json = runCatching { kotlinx.serialization.json.Json.parseToJsonElement(data).toString() }.getOrElse { kotlinx.serialization.json.JsonPrimitive(data).toString() }+ scope.launch { callHook(id, rt, Hook.MESSAGE, json, BLOCKS_MS) { it }?.let { reply -> main.post { pageSinks[id]?.invoke(reply) } } }+ }++ /** The extensions that have a page (webview.page granted). */+ fun hasPage(id: String): Boolean = runtimes[id]?.provides(Hook.PAGE) == true++ fun hasLyrics(): Boolean = isReady && providing(Hook.LYRICS).isNotEmpty()++ /**+ * An audio-source extension is asked for songs: one runs and is not inactive, or one that is on+ * is still being started at launch (the song then waits for it, see [audio]).+ */+ fun hasAudioSource(): Boolean = isReady && (providing(Hook.AUDIO_SOURCE).isNotEmpty() || startingAudioSource())++ /** The app is still starting the extensions on at launch, an audio source among them. */+ private fun startingAudioSource(): Boolean =+ !started.isCompleted && _registry.value.extensions.any { it.enabled && Action.AUDIO_SOURCE.key in it.granted }++ /**+ * Why no audio-source extension is asked for a song while some are on ("x skipped (inactive:+ * …)", "x not running"), for the log; null when none is on (Spotify plays as it always did).+ */+ fun audioSkipped(): String? = _registry.value.extensions.filter { it.enabled && Action.AUDIO_SOURCE.key in it.granted }+ .takeIf { it.isNotEmpty() }?.joinToString { e ->+ when {+ runtimes[e.id] == null -> "${e.id} not running"+ health.inactive(e.id) -> "${e.id} skipped (inactive: ${health.last(e.id)?.detail ?: "no detail"})"+ else -> "${e.id} not the active one"+ }+ }++ /** What [id]'s last `status` probe said (null: not probed yet), for the adb CLI. */+ fun statusOf(id: String): app.myspoti.extensions.ExtensionStatus? = health.last(id)++ /** An enabled extension gives songs' download files (without one, downloads say to install one). */+ fun hasDownloadSource(): Boolean = isReady && providing(Hook.DOWNLOAD_SOURCE).isNotEmpty()++ /**+ * The files [track] can be downloaded from in [quality] (`hi-res`, `cd`, `small`), best first,+ * from the first extension (priority order) that has any, with that extension's id and name.+ */+ suspend fun downloadFiles(track: TrackInfo, quality: String): Triple<String, String, List<DownloadFile>>? {+ if (!isReady) return null+ val input = DownloadQuery.toJson(track, quality)+ probeStale(Hook.DOWNLOAD_SOURCE)+ return HookDispatch.firstInOrder(providing(Hook.DOWNLOAD_SOURCE)) { (id, rt) ->+ callHook(id, rt, Hook.DOWNLOAD_SOURCE, input, DOWNLOAD_MS) { DownloadFile.parseList(it).takeIf { l -> l.isNotEmpty() } }+ }?.let { (c, files) ->+ log(c.first, "download files for ${track.title}: ${files.joinToString { "${it.format}/${it.bitDepth ?: "-"}" }}")+ did(Area.AUDIO, c.first, "Download of ${track.title} from ${c.second.manifest.name}")+ Triple(c.first, c.second.manifest.name, files)+ }+ }++ /** Lyrics from the extensions (the best, ties to the higher priority), or null. */+ suspend fun lyrics(track: TrackInfo): Lyrics? {+ if (!isReady) return null+ val input = track.toJson()+ return HookDispatch.bestInOrder(providing(Hook.LYRICS), LyricsMerge::rank) { (id, rt) ->+ callHook(id, rt, Hook.LYRICS, input, LYRICS_MS) { LyricsResult.parse(it, rt.manifest.name) }?.let(LyricsMerge::toLyrics)+ }?.let { (c, l) -> log(c.first, "lyrics for ${track.title}: ${l.lines.size} lines"); did(Area.LYRICS, c.first, "Lyrics of ${track.title} from ${c.second.manifest.name}"); l }+ }++ /**+ * Where [track]'s audio is, from the first extension (in priority order) that knows. [ahead]:+ * asked before the song plays (the next one of the queue), which the extension is told.+ */+ suspend fun audio(track: TrackInfo, timeoutMs: Long = AUDIO_MS, ahead: Boolean = false): AudioStream? {+ if (!isReady) return null+ // None had it a moment ago: not asked again (a queue reaching it, a replay, a resume).+ if (misses.skips(track.id, ahead)) {+ Logbook.log("audio: ${track.title}${if (ahead) " (ahead)" else ""} not asked again: no extension had it under a minute ago")+ return null+ }+ // Picked right after launch: the extensions still loading are waited for, not skipped.+ if (!started.isCompleted) {+ val t0 = System.currentTimeMillis()+ val loaded = withTimeoutOrNull(START_AUDIO_MS) { started.await() } != null+ Logbook.log("audio: extensions not loaded yet, waited ${System.currentTimeMillis() - t0} ms${if (loaded) "" else " (still loading)"}")+ }+ // The same song as a download asks with: its ISRC, which an extension matches recordings by.+ val input = AudioQuery.toJson(withIsrc(track), ahead)+ probeStale(Hook.AUDIO_SOURCE)+ val asked = providing(Hook.AUDIO_SOURCE)+ _registry.value.extensions.filter { it.enabled && health.inactive(it.id) && runtimes[it.id]?.provides(Hook.AUDIO_SOURCE) == true }+ .forEach { Logbook.log("audio: ${it.id} skipped (inactive: ${health.last(it.id)?.detail ?: "no detail"})") }+ if (asked.isEmpty()) return null+ val label = "${track.title}${if (ahead) " (ahead)" else ""}"+ Logbook.log("audio: asked ${asked.joinToString { it.first }} for $label")+ val t0 = System.currentTimeMillis()+ val found = HookDispatch.firstInOrder(asked) { (id, rt) ->+ callHook(id, rt, Hook.AUDIO_SOURCE, input, timeoutMs, AudioStream::parse)+ }+ val ms = System.currentTimeMillis() - t0+ if (found == null) { Logbook.log("audio: no extension had $label ($ms ms)"); misses.record(track.id, ahead); return null }+ misses.forget(track.id)+ val (c, a) = found+ log(c.first, "audio for ${track.title} ($ms ms)")+ did(Area.AUDIO, c.first, "Audio of ${track.title} from ${c.second.manifest.name}")+ return a.copy(providerId = c.first)+ }++ /** The songs no extension had audio for lately, by Spotify id: forgotten when one is live again or changes. */+ private val misses = AudioMisses()++ /** No extension had [trackId] under a minute ago, when it was to start: it is not asked again. */+ fun missedLately(trackId: String): Boolean = misses.skips(trackId, ahead = false)++ private val isrcs = java.util.concurrent.ConcurrentHashMap<String, String>()++ /** [track] with its ISRC from Spotify's catalogue when it lacks one (kept; at most 3 s to ask). */+ private suspend fun withIsrc(track: TrackInfo): TrackInfo {+ if (!track.isrc.isNullOrBlank() || track.id.isBlank()) return track+ val known = isrcs[track.id] ?: runCatching {+ kotlinx.coroutines.withTimeout(3_000) { app.myspoti.host.android.MyspotiRuntime.api.catalog.isrc("spotify:track:${track.id}") }+ }.getOrNull()?.let(com.music.spotui.data.offline.OfflineDownloader::normalizeIsrc)?.also { isrcs[track.id] = it }+ return if (known == null) track else track.copy(isrc = known)+ }++ /** For the player's loading thread (never the main one). */+ fun audioBlocking(track: TrackInfo, ahead: Boolean = false): AudioStream? = runBlocking(Dispatchers.IO) { audio(track, ahead = ahead) }++ private suspend fun <T : Any> callHook(id: String, rt: ExtensionRuntime, hook: Hook, input: String, timeoutMs: Long, parse: (String) -> T?): T? =+ runInterruptible(Dispatchers.IO) {+ busy.merge(id, 1, Int::plus)+ try {+ val raw = rt.call(hook, input, timeoutMs)+ // An answer the app cannot use is a failure too, said in its log (the sandbox logs its own).+ val out = try { raw?.let(parse) } catch (e: ExtensionException) { log(id, "failed: ${e.message}"); throw e }+ failures.succeeded(id)+ out+ } catch (e: app.myspoti.extensions.ExtensionBusy) {+ // It was still busy (a slow lookup before): not its fault, nothing counted.+ log(id, "${hook.key} skipped: ${e.message}")+ null+ } catch (e: ExtensionException) {+ // Stopped meanwhile (updated, turned off): its cut-short call is not counted.+ if (!rt.closed) failed(id, e.message ?: "failed")+ null+ } catch (e: InterruptedException) {+ throw e+ } catch (t: Throwable) {+ // Not a failure the sandbox knows: the extension is stopped before it does it again.+ disable(id, t.toString())+ null+ } finally {+ busy.computeIfPresent(id) { _, n -> (n - 1).takeIf { it > 0 } }+ }+ }++ // ── Whether each extension's source answers: the `status` hook ──++ /** A `status` call: a probe never holds a song's audio longer than this. */+ private const val STATUS_MS = 5_000L+ /** How long a command waits for the extensions the app is still starting. */+ private const val START_WAIT_MS = 20_000L+ /** How long a song picked right after launch waits for them (then plays from Spotify). */+ private const val START_AUDIO_MS = 5_000L+ /** How old a probe may be: asked again after it while the app is in sight or plays, and before a source is asked. */+ private const val STATUS_EVERY_MS = 5 * 60_000L+ private val SOURCE_HOOKS = setOf(Hook.AUDIO_SOURCE, Hook.DOWNLOAD_SOURCE)+ private val health = app.myspoti.extensions.StatusBook()+ /** The hook calls each extension is answering now: a probe would wait behind them, it is not sent. */+ private val busy = ConcurrentHashMap<String, Int>()++ /** The inactive extensions and what their `status` said (their rows and pages show it). */+ private val _statuses = MutableStateFlow<Map<String, app.myspoti.extensions.ExtensionStatus>>(emptyMap())+ val statuses: StateFlow<Map<String, app.myspoti.extensions.ExtensionStatus>> = _statuses.asStateFlow()++ /**+ * Asks [id]'s `status` (at most [STATUS_MS]). `live: false`: it is inactive, skipped for songs'+ * audio and downloads, still on and not counted as failing; live again at the next probe that+ * says so. No answer in time (a busy start), a throw or no `{ live }`: unknown, still used.+ */+ private suspend fun probe(id: String, rt: ExtensionRuntime) {+ if ((busy[id] ?: 0) > 0) return+ // One probe at a time per extension: a second (the one at load, then one before a song) waits for the first.+ val mine = scope.async(start = kotlinx.coroutines.CoroutineStart.LAZY) { probeNow(id, rt) }+ val running = probing.putIfAbsent(id, mine)+ if (running != null) { mine.cancel(); running.join(); return }+ mine.invokeOnCompletion { probing.remove(id, mine) }+ mine.await()+ }++ private val probing = ConcurrentHashMap<String, kotlinx.coroutines.Deferred<Unit>>()++ private suspend fun probeNow(id: String, rt: ExtensionRuntime) {+ val t0 = System.currentTimeMillis()+ val s = runInterruptible(Dispatchers.IO) { app.myspoti.extensions.ExtensionStatus.probe(rt, STATUS_MS) }+ if (runtimes[id] !== rt) return+ val ms = System.currentTimeMillis() - t0+ val changed = health.record(id, s)+ if (changed && s.live) misses.clear()+ if (changed) log(id, when (s.state) {+ "live" -> "status: live${s.detail?.let { " ($it)" } ?: ""} in $ms ms"+ "inactive" -> "status: inactive: ${s.detail ?: "no detail"} in $ms ms"+ else -> "status: no answer (${s.detail ?: "no detail"}) in $ms ms, still used"+ })+ _statuses.value = health.inactiveNow()+ }++ private fun probeAll() = runtimes.forEach { (id, rt) -> scope.launch { probe(id, rt) } }++ /**+ * Before [hook] is asked: its extensions probed [STATUS_EVERY_MS] ago or more are probed again,+ * together, within [STATUS_MS]. One never probed (its probe at launch is on its way) is not+ * waited for: it is in use until a probe says otherwise.+ */+ private suspend fun probeStale(hook: Hook) {+ val due = _registry.value.extensions.mapNotNull { e ->+ runtimes[e.id]?.takeIf { e.enabled && it.provides(hook) && health.last(e.id) != null && health.stale(e.id, STATUS_EVERY_MS) }?.let { e.id to it }+ }+ if (due.isEmpty()) return+ withTimeoutOrNull(STATUS_MS + 500) { kotlinx.coroutines.coroutineScope { due.map { (id, rt) -> async { probe(id, rt) } }.forEach { it.await() } } }+ }++ /** Every minute, the probes [STATUS_EVERY_MS] old are asked again while the app is in sight or plays. */+ private fun watchStatus() {+ CoroutineScope(SupervisorJob() + Dispatchers.Main).launch {+ while (true) {+ kotlinx.coroutines.delay(60_000)+ if (!com.music.spotui.video.MusicVideoController.inForeground && !SongPlayer.isPlaying()) continue+ runtimes.forEach { (id, rt) -> if (health.stale(id, STATUS_EVERY_MS)) scope.launch { probe(id, rt) } }+ }+ }+ }++ /** Each new song to the extensions that listen (`player.read` granted: the sandbox checks). */+ @OptIn(FlowPreview::class)+ private fun watchTracks() {+ CoroutineScope(SupervisorJob() + Dispatchers.Main).launch {+ // Not while a song is shown loading (the extensions asked for it): it is told once it plays.+ androidx.compose.runtime.snapshotFlow { if (SongPlayer.routing) "" else SongPlayer.nowPlaying.value.uri }+ .filter { it.isNotBlank() }+ .distinctUntilChanged()+ // The title and the length follow the uri a moment later.+ .debounce(1_500)+ .collect {+ val track = currentTrack() ?: return@collect+ val (origin, providerId) = currentOrigin()+ val json = PlaybackEvent.trackEventJson(track, origin, providerId)+ runtimes.forEach { (id, rt) ->+ scope.launch { runCatching { runInterruptible { rt.emit(ExtensionRuntime.EVENT_TRACK, json, TRACK_MS) } }.onFailure { failed(id, it.toString()) } }+ }+ }+ }+ }++ private val playback = PlaybackTracker()+ private val playbackOut = kotlinx.coroutines.channels.Channel<String>(256, kotlinx.coroutines.channels.BufferOverflow.DROP_OLDEST)++ /** The user tapped next ("forward") or previous ("backward"): a `skip` event says which. */+ fun skipAsked(direction: String) = playback.skipAsked(direction, System.currentTimeMillis())++ /**+ * The `playback` events: both players read once a second (on the main thread, where they+ * live), only while an extension listens; delivered in order, one at a time.+ */+ private fun watchPlayback() {+ scope.launch {+ for (json in playbackOut) {+ runtimes.forEach { (id, rt) ->+ if (rt.listens(ExtensionRuntime.EVENT_PLAYBACK)) runCatching {+ runInterruptible { rt.emit(ExtensionRuntime.EVENT_PLAYBACK, json, TRACK_MS) }+ }.onFailure { failed(id, it.toString()) }+ }+ }+ }+ CoroutineScope(SupervisorJob() + Dispatchers.Main).launch {+ var idle = 0+ var listening = false+ while (true) {+ kotlinx.coroutines.delay(1_000)+ if (runtimes.values.none { it.listens(ExtensionRuntime.EVENT_PLAYBACK) }) {+ if (listening) { playback.observe(null, System.currentTimeMillis()); listening = false }+ continue+ }+ listening = true+ val snap = runCatching { playbackSnapshot() }.getOrNull()+ // A blank moment between two songs is not a stop: three seconds of nothing is.+ idle = if (snap == null) idle + 1 else 0+ if (snap == null && idle < 3) continue+ playback.observe(snap, System.currentTimeMillis()).forEach { playbackOut.trySend(it.toJson()) }+ }+ }+ }++ /** What is playing now, in the player that plays (Myspoti's own, or the Web Player); null: nothing. */+ private fun playbackSnapshot(): PlaybackTracker.Snapshot? {+ // A song shown loading while the extensions are asked for it does not play yet.+ if (SongPlayer.routing) return null+ val local = com.music.spotui.di.LocalPlayer+ if (local.active.value) {+ val t = local.current() ?: return null+ val spotifyId = local.spotifyIdOf(t)+ val duration = local.duration()+ val (origin, providerId) = originOf(t)+ return PlaybackTracker.Snapshot(+ key = "local:${t.id}:${t.uri}",+ track = trackInfo(spotifyId, t.title, t.artist, t.album, duration, t.artUri.toString()),+ source = PlaybackEvent.LOCAL, playing = local.isPlaying(), positionMs = local.position(), durationMs = duration,+ contextUri = local.contextUri, shuffle = local.shuffled, origin = origin, providerId = providerId,+ )+ }+ val np = SongPlayer.nowPlaying.value+ if (np.uri.isBlank()) return null+ val info = currentTrack() ?: return null+ return PlaybackTracker.Snapshot(+ key = "spotify:${np.uri}", track = info.copy(uri = np.uri), source = PlaybackEvent.SPOTIFY,+ playing = SongPlayer.isPlaying(), positionMs = SongPlayer.getCurrentPosition(), durationMs = SongPlayer.getDuration(),+ contextUri = np.contextUri, shuffle = SongPlayer.isShuffleOn(),+ )+ }++ /**+ * Where the song playing comes from, for the `track` and `playback` events: `origin` (see+ * [PlaybackEvent.ORIGINS]) and the id of the extension that supplied it (null for Spotify).+ */+ private fun currentOrigin(): Pair<String, String?> {+ val local = com.music.spotui.di.LocalPlayer+ val t = if (local.active.value) local.current() else null+ return if (t == null) PlaybackEvent.ORIGIN_SPOTIFY to null else originOf(t)+ }++ private fun originOf(t: com.music.spotui.data.local.LocalTrack): Pair<String, String?> {+ if (t.uri.scheme == ExtensionAudio.SCHEME) return PlaybackEvent.ORIGIN_AUDIO_SOURCE to ExtensionAudio.providerOf(t.uri.lastPathSegment.orEmpty())+ val offline = com.music.spotui.data.offline.OfflineStore.byLocalId(t.id)+ return if (offline != null) PlaybackEvent.ORIGIN_DOWNLOAD to offline.providerId else PlaybackEvent.ORIGIN_LOCAL_FILE to null+ }++ /** The song playing in Myspoti, as hooks receive it. */+ fun currentTrack(): TrackInfo? {+ val t = runCatching { SongPlayer.currentLyricsTrack() }.getOrNull() ?: return null+ return trackInfo(t.trackId, t.title, t.artist, t.album, t.durationMs, t.coverUrl)+ }++ fun trackInfo(trackId: String, title: String, artist: String, album: String, durationMs: Long, cover: String?): TrackInfo {+ val artists = artist.split(", ").map { it.trim() }.filter { it.isNotEmpty() }+ return TrackInfo(+ id = trackId, uri = if (trackId.isBlank()) "" else "spotify:track:$trackId", title = title,+ artist = artists.firstOrNull().orEmpty(), artists = artists, album = album, durationMs = durationMs,+ cover = cover?.takeIf { it.startsWith("http") },+ )+ }++ // ── Repositories ──++ fun addRepository(url: String) = update { r -> if (url in r.repositories) r else r.copy(repositories = r.repositories + url) }++ fun removeRepository(url: String) = update { r -> r.copy(repositories = r.repositories - url) }++ /** Reads a repository's index, and turns off what it blocks. */+ suspend fun catalog(url: String): Catalog = withContext(Dispatchers.IO) {+ val c = Catalog.parse(download(url, MAX_INDEX).decodeToString())+ _registry.value.extensions.forEach { e ->+ c.blocks(e.id, e.sha256)?.let { b -> if (e.enabled) disable(e.id, "blocked by ${c.name}: ${b.reason.ifBlank { "no reason given" }}") }+ }+ c+ }++ /**+ * The package of a catalogue entry: from GitHub when the entry names a repository (with the+ * index's sha256 checked when it gives one), else from its address, sha256 checked.+ */+ suspend fun fetch(indexUrl: String, entry: Catalog.Entry): ExtensionUpdates.Fetched = withContext(Dispatchers.IO) {+ val repo = entry.repo?.let { app.myspoti.extensions.GitHubRepo.parse(it) }+ if (repo == null) return@withContext download(indexUrl, entry).let { (zip, p) -> ExtensionUpdates.Fetched(zip, p, null) }+ val f = ExtensionUpdates.fromGitHub(repo, expectSha = entry.sha256.ifBlank { null })+ if (f.pkg.manifest.id != entry.id) throw ExtensionException("the package is ${f.pkg.manifest.id}, the store lists ${entry.id}")+ f+ }++ /** The package of a catalogue entry, its sha256 checked before anything of it is read. */+ suspend fun download(indexUrl: String, entry: Catalog.Entry): Pair<ByteArray, ExtensionPackage> = withContext(Dispatchers.IO) {+ val bytes = download(Catalog.resolve(indexUrl, entry.url), ExtensionPackage.MAX_ZIP)+ if (ExtensionPackage.sha256(bytes) != entry.sha256.lowercase()) throw ExtensionException("the package is not the one the repository lists (sha256 differs)")+ val p = ExtensionPackage.read(bytes)+ if (p.manifest.id != entry.id) throw ExtensionException("the package is ${p.manifest.id}, the repository lists ${entry.id}")+ bytes to p+ }++ /** A package at an https address. */+ suspend fun downloadPackage(url: String): Pair<ByteArray, ExtensionPackage> = withContext(Dispatchers.IO) {+ val bytes = download(url, ExtensionPackage.MAX_ZIP)+ bytes to ExtensionPackage.read(bytes)+ }++ /** https only, no cookies, at most [max] bytes. */+ private fun download(url: String, max: Int): ByteArray {+ val uri = runCatching { URI(url) }.getOrNull()+ if (uri?.scheme != "https" || uri.host.isNullOrBlank()) throw ExtensionException("an https address is needed")+ if (com.music.spotui.data.DataSaver.active) throw ExtensionException("the data saver is on")+ val c = uri.toURL().openConnection() as HttpURLConnection+ c.connectTimeout = 15_000; c.readTimeout = 20_000; c.useCaches = false+ c.setRequestProperty("User-Agent", "Myspoti-Extensions/1")+ try {+ if (c.responseCode !in 200..299) throw ExtensionException("the server answered ${c.responseCode}")+ val out = java.io.ByteArrayOutputStream()+ c.inputStream.use { s ->+ val buf = ByteArray(16 * 1024)+ while (true) {+ val n = s.read(buf)+ if (n < 0) break+ out.write(buf, 0, n)+ if (out.size() > max) throw ExtensionException("larger than ${max / 1024} KB")+ }+ }+ return out.toByteArray()+ } finally {+ c.disconnect()+ }+ }++ // ── Sandboxes ──++ private const val SLOW_LOAD_MS = 10_000L++ /** The sha256 of the package each runtime runs. */+ private val runningSha = ConcurrentHashMap<String, String>()+ private val startLocks = ConcurrentHashMap<String, Any>()+ /** The extensions on at launch have all been started (or failed to). */+ private val started = kotlinx.coroutines.CompletableDeferred<Unit>()++ /**+ * Starts [e] unless that very package already runs. One start of an extension at a time: an+ * update arriving while the app starts the version before waits for it, and the version+ * before, loaded meanwhile, is closed instead of replacing the new one. [probe]: its `status`+ * is asked in the background once it is loaded.+ */+ internal fun start(asked: InstalledExtension, probe: Boolean = true): Unit = synchronized(startLocks.getOrPut(asked.id) { Any() }) {+ // What is installed now: an update that landed while this start waited its turn is the one+ // to run (the entry it was asked with would no longer match the package on the phone).+ val e = _registry.value.find(asked.id) ?: return+ if (!e.enabled) return+ if (runtimes.containsKey(e.id)) { if (runningSha[e.id] == e.sha256) return else stop(e.id) }+ val p = pkg(e.id) ?: return disable(e.id, "its package is missing")+ if (p.sha256 != e.sha256) return disable(e.id, "its package changed on the phone")+ ExtensionUpdates.blocked(e.id, e.sha256)?.let { return disable(e.id, "blocked by Myspoti: ${it.reason.ifBlank { "no reason given" }}") }+ // Unticked back when the prompt allowed it: it waits for the user's OK on its page.+ if (Grants.refused(e, p.manifest).isNotEmpty()) return disable(e.id, "it waits for your OK on its page")+ var rt = ExtensionRuntime(p.manifest, p.script, AndroidHost, e.granted)+ try {+ try {+ rt.start()+ } catch (slow: app.myspoti.extensions.ExtensionTimeout) {+ // Right after an update or a cold start the phone may be busy: once more, with more time.+ rt.close()+ log(e.id, "slow to load: trying once more")+ rt = ExtensionRuntime(p.manifest, p.script, AndroidHost, e.granted, ExtensionRuntime.Limits(loadMs = SLOW_LOAD_MS))+ rt.start()+ }+ // Turned off, removed or updated while it loaded: what loaded is not what should run.+ val now = _registry.value.find(e.id)+ if (now == null || !now.enabled || now.sha256 != e.sha256) { rt.close(); return }+ runtimes[e.id] = rt+ runningSha[e.id] = e.sha256+ misses.clear()+ log(e.id, "loaded ${p.manifest.version} (granted: ${e.granted.sorted().joinToString().ifBlank { "nothing" }})")+ if (onlineMarker(e.id).exists() && isOnline()) deliverOnline(e.id)+ if (probe) scope.launch { probe(e.id, rt) }+ } catch (t: Throwable) {+ rt.close()+ disable(e.id, "did not load: ${t.message ?: t}")+ }+ }++ internal fun stop(id: String) {+ runningSha.remove(id)+ runtimes.remove(id)?.close(); ExtensionAuth.cancel(id)+ health.forget(id); _statuses.value = health.inactiveNow()+ misses.clear()+ }++ /** Delivers a sign-in page's outcome to [id] ([ExtensionAuth]). */+ internal fun authDone(id: String, result: app.myspoti.extensions.AuthResult) {+ val rt = runtimes[id] ?: return+ log(id, "sign-in ${result.id}: ${if (result.url != null) "reached the callback" else result.error}")+ val json = kotlinx.serialization.json.Json.encodeToString(app.myspoti.extensions.AuthResult.serializer(), result)+ scope.launch { runCatching { runInterruptible { rt.emit(ExtensionRuntime.EVENT_AUTH, json, AUTH_MS) } }.onFailure { failed(id, it.toString()) } }+ }++ private fun failed(id: String, message: String) {+ setError(id, message)+ if (failures.failed(id)) disable(id, "failed 3 times in a row: $message")+ }++ /** Turns [id] off with [reason], shown on its page and in a short message. */+ fun disable(id: String, reason: String) {+ stop(id)+ val e = _registry.value.find(id) ?: return+ update { it.put(e.copy(enabled = false, disabledReason = reason)) }+ setError(id, reason)+ log(id, "turned off: $reason")+ main.post {+ android.widget.Toast.makeText(ctx, ctx.getString(app.myspoti.engine.R.string.extension_turned_off, e.name, reason), android.widget.Toast.LENGTH_LONG).show()+ }+ }++ private fun setError(id: String, message: String) { _errors.value = _errors.value + (id to message) }+ private fun clearError(id: String) { _errors.value = _errors.value - id }++ internal fun update(change: (Registry) -> Registry) = synchronized(lock) {+ val r = change(_registry.value)+ _registry.value = r+ runCatching { Registry.write(File(dir, "registry.json"), r) }.onFailure { Logbook.log("ext: registry not saved: ${it.message}") }+ }++ fun log(id: String, message: String) {+ val stamp = java.text.SimpleDateFormat("MM-dd HH:mm:ss", java.util.Locale.US).format(java.util.Date())+ logOf(id).add("$stamp $message")+ logTick.value+++ Logbook.log("ext $id: $message")+ }++ private fun logOf(id: String) = logs.getOrPut(id) { ExtensionLog(File(dir, "$id/log.txt")) }+ private fun settingsOf(id: String) = settings.getOrPut(id) { FileStore(File(dir, "$id/settings.json")) }+ private fun storeOf(id: String) = stores.getOrPut(id) { FileStore(File(dir, "$id/storage.json")) }++ internal fun writeBytesAtomically(file: File, bytes: ByteArray) {+ val tmp = File(file.parentFile, file.name + ".tmp")+ tmp.writeBytes(bytes)+ if (!tmp.renameTo(file)) { file.delete(); tmp.renameTo(file) }+ }++ // ── What the sandbox reaches of the app ──++ private object AndroidHost : Host {+ private val dispatcher by lazy {+ SpotifyDispatcher(MyspotiRuntime.api, AppRaw, app.myspoti.extensions.PlayerMedia { app.myspoti.spotify.bridge.MediaManifests.of(it) })+ }++ override fun http(extensionId: String, request: HttpRequest): HttpResponse {+ if (com.music.spotui.data.DataSaver.active) throw IllegalStateException("the data saver is on")+ return BasicHttp.send(request, userAgent(extensionId))+ }++ override fun log(extensionId: String, message: String) = Extensions.log(extensionId, message)++ override fun storage(extensionId: String): Storage = storeOf(extensionId)++ override fun setting(extensionId: String, key: String): String? = settingsOf(extensionId).get(key)++ override fun nowPlaying(): String? = currentTrack()?.toJson()++ override fun control(extensionId: String, action: String, argument: Long?): Boolean {+ if (!arbitrate(extensionId, action)) return false+ main.post {+ when (action) {+ "play" -> SongPlayer.play(by = "extension")+ "pause" -> SongPlayer.pause(by = "extension")+ "next" -> SongPlayer.next()+ "previous" -> SongPlayer.previous()+ "seek" -> argument?.let(SongPlayer::seekTo)+ }+ }+ return true+ }++ override fun notify(extensionId: String, text: String) {+ val name = _registry.value.find(extensionId)?.name ?: extensionId+ Extensions.log(extensionId, "notify: $text")+ main.post { android.widget.Toast.makeText(ctx, "$name: $text", android.widget.Toast.LENGTH_SHORT).show() }+ }++ override suspend fun spotify(extensionId: String, call: SpotifyCall): String {+ if (!MyspotiRuntime.isStarted) throw IllegalStateException("no Spotify account")+ // Playback commands go through the arbiter like myspoti.player's; a dropped one answers null.+ if (call.area == "player" && call.method in ARBITRATED && !arbitrate(extensionId, call.method)) return "null"+ if (call.area == "devices" && call.method != "list" && !arbitrate(extensionId, "transfer")) return "null"+ return dispatcher.execute(call)+ }++ private val ARBITRATED = setOf("play", "pause", "resume", "seek", "next", "previous", "setShuffle", "setRepeat", "skipTo")++ override fun refresh(extensionId: String, surface: String) { blocksTick.value++ }++ override fun postToPage(extensionId: String, json: String) { main.post { pageSinks[extensionId]?.invoke(json) } }++ override fun spotifyMutation(name: String): Boolean = app.myspoti.spotify.gql.isMutation(name)++ override suspend fun confirm(extensionId: String, text: String): Boolean {+ val ok = ExtensionConfirm.ask(extensionId, text)+ Extensions.log(extensionId, if (ok) "the user allowed: ${text.lineSequence().first()}" else "the user refused: ${text.lineSequence().first()}")+ return ok+ }++ override fun rawGrants(extensionId: String) = _registry.value.find(extensionId)?.rawGrants.orEmpty()++ override suspend fun confirmWrite(extensionId: String, text: String, offer: app.myspoti.extensions.RawGrant): app.myspoti.extensions.Consent {+ val c = ExtensionConfirm.ask(extensionId, text, offer)+ if (c == app.myspoti.extensions.Consent.ALWAYS) addRawGrant(extensionId, offer)+ else Extensions.log(extensionId, "the user ${if (c == app.myspoti.extensions.Consent.ONCE) "allowed once" else "refused"}: $offer")+ return c+ }++ override fun openAuth(extensionId: String, request: app.myspoti.extensions.AuthRequest): String = ExtensionAuth.open(extensionId, request)++ override fun whenOnline(extensionId: String) = askOnline(extensionId)+ }++ /** The raw door: the Web Player's GraphQL, page services and Spotify URLs, as the account. */+ private object AppRaw : SpotifyRaw {+ private val api get() = MyspotiRuntime.spotify+ override suspend fun gql(operation: String, variables: JsonObject): JsonElement = api.raw.gql(operation, variables)+ override fun operations(): Set<String> = api.raw.operations+ override suspend fun service(service: String, method: String, args: List<JsonElement>): JsonElement = api.raw.service(service, method, *args.toTypedArray())+ override suspend fun get(url: String): JsonElement? = api.raw.get(url)+ override fun isMutation(operation: String): Boolean = app.myspoti.spotify.gql.isMutation(operation)+ override suspend fun request(method: String, url: String, body: ByteArray?, headers: Map<String, String>): JsonElement =+ api.raw.request(method, url, body, headers).let { app.myspoti.extensions.RawRequest.response(it.status, it.headers, it.body) }+ }++ /** Lyrics asked with a time limit of their own, for the app's lyrics resolver. */+ suspend fun lyricsFor(trackId: String, title: String, artist: String, album: String, durationMs: Long, cover: String?): Lyrics? =+ if (!hasLyrics()) null+ else withTimeoutOrNull(LYRICS_MS + 1_000) { lyrics(trackInfo(trackId, title, artist, album, durationMs, cover)) }++ // ── Debug and beta command line (com.music.spotui.cli) ──++ /** [hook] of [id] alone, with [input]: its answer as JSON text, null when it has none. */+ internal suspend fun callHook(id: String, hook: Hook, input: String, timeoutMs: Long = DOWNLOAD_MS): String? {+ // Asked while the app starts (a command can be what starts it): its extensions load first.+ if (!runtimes.containsKey(id) && _registry.value.find(id)?.enabled == true) withTimeoutOrNull(START_WAIT_MS) { started.await() }+ val rt = runtimes[id] ?: throw ExtensionException("$id is not running")+ if (!rt.provides(hook)) throw ExtensionException("$id does not provide ${hook.key}")+ return runInterruptible(Dispatchers.IO) { rt.call(hook, input, timeoutMs) }+ }++ /** [id]'s storage as stored (key → JSON text), for the command line's masked view. */+ internal fun storageValues(id: String): Map<String, String> = storeOf(id).all()+}diff --git a/base/app/src/main/java/com/music/spotui/extensions/HookDispatch.kt b/base/app/src/main/java/com/music/spotui/extensions/HookDispatch.ktnew file mode 100644index 00000000..394570a1--- /dev/null+++ b/base/app/src/main/java/com/music/spotui/extensions/HookDispatch.kt@@ -0,0 +1,93 @@+package com.music.spotui.extensions++import app.myspoti.extensions.LyricsResult+import com.music.spotui.data.entity.LyricLine+import com.music.spotui.data.entity.LyricWord+import com.music.spotui.data.entity.Lyrics+import kotlinx.coroutines.CancellationException+import kotlinx.coroutines.async+import kotlinx.coroutines.coroutineScope++/**+ * The order hooks are asked in, without Android: every extension providing the hook is asked+ * at once (each on its own thread, within its time limit), and the answers are taken in+ * priority order ([Registry.byPriority]: the user's order on the Installed tab, else+ * installation order), so the higher one wins a tie and a slow one never makes a quick one wait+ * longer than its own limit.+ */+object HookDispatch {+ /**+ * The first non-null answer in [candidates]' order. Answers behind it are not waited for+ * (they are cancelled); a failure is no answer.+ */+ suspend fun <C, R : Any> firstInOrder(candidates: List<C>, ask: suspend (C) -> R?): Pair<C, R>? = coroutineScope {+ val asked = candidates.map { c -> c to async { answer { ask(c) } } }+ for ((c, job) in asked) {+ val r = job.await() ?: continue+ asked.forEach { it.second.cancel() }+ return@coroutineScope c to r+ }+ null+ }++ /** The best answer by [rank] (higher is better), ties to the earlier candidate. Waits for all. */+ suspend fun <C, R : Any> bestInOrder(candidates: List<C>, rank: (R) -> Int, ask: suspend (C) -> R?): Pair<C, R>? = coroutineScope {+ val asked = candidates.map { c -> c to async { answer { ask(c) } } }+ var best: Pair<C, R>? = null+ for ((c, job) in asked) {+ val r = job.await() ?: continue+ if (best == null || rank(r) > rank(best.second)) best = c to r+ }+ best+ }++ private suspend fun <R> answer(block: suspend () -> R?): R? = try {+ block()+ } catch (e: CancellationException) {+ throw e+ } catch (_: Exception) {+ null+ }+}++/**+ * Lyrics from extensions next to the app's own: the extensions' answer is used when it is at+ * least as good (word by word > line by line > plain text), except against Spotify's own complete+ * lyrics, which stay first at the same level (they are what the official app shows, with colours).+ */+object LyricsMerge {+ fun rank(l: Lyrics): Int = when {+ l.synced && l.wordSynced -> 3+ l.synced -> 2+ else -> 1+ }++ /** Whether [own] is Spotify's own, complete lyrics. */+ fun isSpotifyComplete(own: Lyrics?): Boolean = own != null && own.colors != null && own.uncapped++ fun choose(own: Lyrics?, fromExtension: Lyrics?): Lyrics? {+ if (fromExtension == null || fromExtension.isEmpty) return own+ if (own == null || own.isEmpty) return fromExtension+ val mine = rank(own)+ val theirs = rank(fromExtension)+ return when {+ theirs > mine -> fromExtension.copy(colors = own.colors)+ theirs < mine -> own+ isSpotifyComplete(own) -> own+ else -> fromExtension.copy(colors = own.colors)+ }+ }++ /** An extension's checked answer as the app's lyrics. */+ fun toLyrics(r: LyricsResult): Lyrics = Lyrics(+ lines = r.lines.map { l ->+ LyricLine(+ timeMs = if (r.synced) l.startMs else 0,+ text = l.text,+ words = if (r.synced) l.words?.map { w -> LyricWord(w.startMs, w.endMs ?: 0, w.text) } else null,+ )+ },+ synced = r.synced,+ provider = r.provider,+ )+}diff --git a/base/app/src/main/java/com/music/spotui/extensions/PlaybackTracker.kt b/base/app/src/main/java/com/music/spotui/extensions/PlaybackTracker.ktnew file mode 100644index 00000000..d455d6bf--- /dev/null+++ b/base/app/src/main/java/com/music/spotui/extensions/PlaybackTracker.kt@@ -0,0 +1,132 @@+package com.music.spotui.extensions++import app.myspoti.extensions.PlaybackEvent+import app.myspoti.extensions.TrackInfo++/**+ * Turns what the players show, read about once a second, into `playback` events for the+ * extensions (docs/extensions/API.md §3). Without Android: [observe] takes a [Snapshot] and the+ * time, and answers the events since the last one.+ */+class PlaybackTracker(+ /** A progress event each time this much more of the song was played. */+ private val progressEveryMs: Long = 10_000,+) {+ /** What one player shows at one moment; [key] tells one song (and source) from another. */+ data class Snapshot(+ val key: String,+ val track: TrackInfo,+ val source: String,+ val playing: Boolean,+ val positionMs: Long,+ val durationMs: Long,+ val contextUri: String = "",+ val shuffle: Boolean = false,+ val origin: String = PlaybackEvent.ORIGIN_SPOTIFY,+ val providerId: String? = null,+ )++ private var cur: Snapshot? = null+ private var at = 0L+ private var played = 0L+ private var nextProgress = progressEveryMs+ /** The current song already ended (the queue stopped on its last song): it does not leave again. */+ private var ended = false+ /** The last next / previous the user asked for, and when (a skip's direction). */+ @Volatile private var hint: Pair<String, Long>? = null++ /** The user asked for the next ("forward") or previous ("backward") song. */+ fun skipAsked(direction: String, now: Long) { hint = direction to now }++ fun observe(s: Snapshot?, now: Long): List<PlaybackEvent> {+ val out = ArrayList<PlaybackEvent>(2)+ val before = cur+ if (before == null) {+ if (s != null) start(s, now, "play", out)+ return out+ }+ if (ended) {+ // After the last song ended: the next thing that plays is a new start.+ if (s == null) { cur = null; ended = false }+ else if (s.key != before.key || s.playing) start(s, now, if (s.key != before.key) "next" else "play", out)+ else { cur = s; at = now }+ return out+ }+ if (s == null || s.key != before.key) {+ // The song left: played to its end, skipped, or playback stopped.+ val reason = leave(before, s, now, out)+ if (s != null) start(s, now, reason, out) else cur = null+ return out+ }+ val elapsed = (now - at).coerceAtLeast(0)+ val expected = before.positionMs + if (before.playing) elapsed else 0+ val delta = s.positionMs - expected+ if (nearEnd(before) && s.positionMs < 5_000 && before.positionMs - s.positionMs > 10_000) {+ // Repeat one: the same song again from the start.+ played += (before.durationMs - before.positionMs).coerceIn(0, elapsed)+ out += event("end", before.copy(positionMs = before.durationMs), now, "finished")+ start(s, now, "next", out)+ return out+ }+ if (before.playing) played += if (kotlin.math.abs(delta) > SEEK_MS) elapsed.coerceAtMost(1_500) else elapsed+ if (kotlin.math.abs(delta) > SEEK_MS) out += event("seek", s, now, if (delta > 0) "forward" else "backward")+ if (before.playing && !s.playing && nearEnd(s)) {+ // The queue stopped at the end of its last song.+ played += elapsed.coerceAtMost(s.positionMs)+ out += event("end", s, now, "finished")+ cur = s; at = now; ended = true+ return out+ }+ if (before.playing && !s.playing) out += event("pause", s, now)+ if (!before.playing && s.playing) out += event("resume", s, now)+ if (s.playing && played >= nextProgress) {+ out += event("progress", s, now)+ while (nextProgress <= played) nextProgress += progressEveryMs+ }+ cur = s+ at = now+ return out+ }++ private fun start(s: Snapshot, now: Long, reason: String, out: MutableList<PlaybackEvent>) {+ cur = s+ ended = false+ at = now+ played = 0+ nextProgress = progressEveryMs+ out += event("start", s, now, reason)+ }++ /** The leaving event of [before]; answers the next song's start reason. */+ private fun leave(before: Snapshot, next: Snapshot?, now: Long, out: MutableList<PlaybackEvent>): String {+ val elapsed = (now - at).coerceAtLeast(0)+ val position = if (before.playing) (before.positionMs + elapsed).coerceAtMost(before.durationMs.takeIf { it > 0 } ?: Long.MAX_VALUE) else before.positionMs+ if (before.playing) played += (position - before.positionMs).coerceAtLeast(0)+ val asked = hint?.takeIf { now - it.second < HINT_MS }?.first+ hint = null+ val left = before.copy(positionMs = position)+ return when {+ asked != null -> { out += event("skip", left, now, asked); "skip" }+ nearEnd(left) -> { out += event("end", left, now, "finished"); "next" }+ next == null || next.source != before.source -> { out += event("end", left, now, "stop"); "play" }+ else -> { out += event("skip", left, now, "other"); "skip" }+ }+ }++ private fun nearEnd(s: Snapshot) = s.durationMs > 0 && s.positionMs >= s.durationMs - END_MS++ private fun event(type: String, s: Snapshot, now: Long, reason: String? = null) = PlaybackEvent(+ type = type, track = s.track, positionMs = s.positionMs.coerceAtLeast(0), durationMs = s.durationMs, timestamp = now,+ source = s.source, contextUri = s.contextUri, shuffle = s.shuffle, reason = reason, playedMs = played,+ origin = s.origin, providerId = s.providerId,+ )++ companion object {+ /** A position off by more than this from where playing would have put it is a seek. */+ const val SEEK_MS = 3_000L+ /** Within this of the end, a song that leaves was played to its end. */+ const val END_MS = 5_000L+ /** A next / previous tap explains a change of song for this long. */+ const val HINT_MS = 4_000L+ }+}diff --git a/base/app/src/main/java/com/music/spotui/lossless/LosslessRegistry.kt b/base/app/src/main/java/com/music/spotui/lossless/LosslessRegistry.ktdeleted file mode 100644index dde3aef8..00000000--- a/base/app/src/main/java/com/music/spotui/lossless/LosslessRegistry.kt+++ /dev/null@@ -1,113 +0,0 @@-package com.music.spotui.lossless--/*- * Ported from Spotui (https://github.com/Spotui/Spotui), GPL-3.0 — see LICENSE.- * Endpoint registry for the community FLAC backends (Tidal, Qobuz, Amazon).- */--import android.util.Log-import org.json.JSONObject-import java.net.HttpURLConnection-import java.net.URL-import java.security.MessageDigest-import javax.crypto.Cipher-import javax.crypto.spec.GCMParameterSpec-import javax.crypto.spec.SecretKeySpec--/**- * Endpoint registry for the community FLAC backends (Tidal etc.). SpotiFLAC keeps- * the current backend hostnames in an AES-GCM-encrypted JSON blob on a public- * gist and rotates them as servers come and go; this fetches + decrypts that blob- * so the source list stays current, and falls back to a known-good default if the- * fetch fails.- *- * These are public community APIs (a plain `GET .../track/?id=…` with a shared,- * published API key) — no login, no CAPTCHA, no per-user credentials.- */-internal object LosslessRegistry {-- private const val TAG = "LosslessRegistry"-- // Community backend API key (shared/published constant in SpotiFLAC's sources).- const val API_KEY = "ak_8e3f1a7c2b5d9e4f0a6c3b8d1e5f2a9c7b4d0e6f"-- private const val GIST_URL =- "https://gist.githubusercontent.com/BartolomeoRusso9/ef9fdbbc894818aea89d25a8d99f8c77/raw"-- // AES-GCM key material (matches SpotiFLAC's community-url scheme).- private val SEED_PARTS = listOf("spotif", "lac:co", "mmunity:url:v1")- private val AAD = "spotiflac|community|url|v1".toByteArray()-- // Known-good defaults (used until/if the registry refresh succeeds).- private val DEFAULT_TIDAL = listOf("https://tidal.anandserver.cfd")- private val DEFAULT_AMAZON = listOf("https://amazon.anandserver.cfd")-- private const val CACHE_TTL_MS = 30 * 60 * 1000L- private const val FAILURE_RETRY_MS = 5 * 60 * 1000L- @Volatile private var cached: JSONObject? = null- @Volatile private var cachedAt = 0L- @Volatile private var failedAt = 0L-- /** Current Tidal community endpoints, freshest first, default appended. */- fun tidalEndpoints(): List<String> = endpoints("tidal", "stream", DEFAULT_TIDAL)-- /** Current Amazon community endpoints (self-resolve by Spotify id). */- fun amazonEndpoints(): List<String> {- val fromReg = registry()?.optJSONObject("amazon")- ?.let { listOfNotNull(it.optString("antra").takeIf(String::isNotBlank)) }- .orEmpty()- return (fromReg + DEFAULT_AMAZON).map { it.trimEnd('/') }.distinct()- }-- private fun endpoints(provider: String, category: String, default: List<String>): List<String> {- val fromReg = registry()?.optJSONObject(provider)?.optJSONArray(category)?.let { arr ->- (0 until arr.length()).mapNotNull { arr.optString(it).takeIf(String::isNotBlank) }- }.orEmpty()- return (fromReg + default).map { it.trimEnd('/') }.distinct()- }-- private fun registry(): JSONObject? {- val now = nowMs()- cached?.let { if (now - cachedAt < CACHE_TTL_MS) return it }- if (now - failedAt < FAILURE_RETRY_MS) return cached- return runCatching {- val conn = URL("$GIST_URL?t=$now").openConnection() as HttpURLConnection- val text = try {- conn.connectTimeout = 8000- conn.readTimeout = 8000- conn.setRequestProperty("User-Agent", "SpotiFLAC-Agent")- if (conn.responseCode !in 200..299) throw java.io.IOException("HTTP ${conn.responseCode}")- conn.inputStream.bufferedReader().use { it.readText() }- } finally {- conn.disconnect()- }- val json = JSONObject(decrypt(text))- cached = json- cachedAt = now- json- }.onFailure {- // Remember the miss: a resolve calls this several times, and each retry- // would spend up to 16 s of the play-time lossless budget on timeouts.- failedAt = now- Log.d(TAG, "registry refresh failed, using defaults: ${it.message}")- }.getOrNull() ?: cached- }-- private fun decrypt(b64Input: String): String {- var b = b64Input.filterNot { it.isWhitespace() }.replace('-', '+').replace('_', '/')- while (b.length % 4 != 0) b += "="- val raw = android.util.Base64.decode(b, android.util.Base64.DEFAULT)- val nonce = raw.copyOfRange(0, 12)- val body = raw.copyOfRange(12, raw.size)- val md = MessageDigest.getInstance("SHA-256")- SEED_PARTS.forEach { md.update(it.toByteArray()) }- val cipher = Cipher.getInstance("AES/GCM/NoPadding").apply {- init(Cipher.DECRYPT_MODE, SecretKeySpec(md.digest(), "AES"), GCMParameterSpec(128, nonce))- updateAAD(AAD)- }- return String(cipher.doFinal(body), Charsets.UTF_8)- }-- // Avoids Date.now()-style calls that some sandboxes block; System.currentTimeMillis is fine on-device.- private fun nowMs(): Long = System.currentTimeMillis()-}diff --git a/base/app/src/main/java/com/music/spotui/lossless/LosslessSource.kt b/base/app/src/main/java/com/music/spotui/lossless/LosslessSource.ktdeleted file mode 100644index 2219a666..00000000--- a/base/app/src/main/java/com/music/spotui/lossless/LosslessSource.kt+++ /dev/null@@ -1,495 +0,0 @@-package com.music.spotui.lossless--/*- * Ported from Spotui (https://github.com/Spotui/Spotui), GPL-3.0, and adapted:- * Odesli is gone (public API closed), so ids come from the providers' own- * backends (search by title+artist, ISRC matched) and Qobuz's public ISRC search.- */--import android.content.Context-import android.util.Log-import kotlinx.coroutines.Dispatchers-import kotlinx.coroutines.withContext-import org.json.JSONArray-import org.json.JSONObject-import java.net.HttpURLConnection-import java.net.URL-import java.net.URLEncoder-import java.security.MessageDigest--/**- * Resolves a Spotify track to lossless FLAC — the SpotiFLAC download servers first- * (Qobuz, with the user's signed session), then the public community backends. Each- * provider fails gracefully: a down or throttled source just falls through.- *- * Priority (most reliable first):- * 1. Qobuz (found by ISRC in its own catalogue) through the SpotiFLAC (Zarz)- * servers and the user's signed session — 16 or 24-bit.- * 2. Tidal community backends — `/track/?id=`, single-file FLAC (16) or a- * DASH manifest to remux into one FLAC file (24).- * 3. Amazon self-resolve by Spotify id (often dormant).- *- * The same recording only: ISRC first (exact), else title+artist normalised with- * a duration within 3 s — a live take, a remix or a cover is never taken.- */-object LosslessSource {-- private const val TAG = "LosslessSource"- private const val USER_AGENT =- "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 " +- "(KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"-- /** Lost audio types the resolver hands back. Either [url] or [dashBase64] is set. */- data class LosslessFile(- val url: String,- val dashBase64: String,- val provider: String,- /** Bit depth the source claims (the STREAMINFO after a remux tells the truth). */- val quality: Int,- /** An AAC file served as it is (Tidal's LOW / HIGH), not a FLAC. */- val aac: Boolean = false,- )-- sealed interface Result- data class Success(val track: LosslessFile, val isrcMatched: Boolean) : Result- object NotFound : Result- data class Error(val message: String) : Result-- /** Track details from the play site; the downloader fills them from Spotify. */- data class TrackInfo(val title: String = "", val artist: String = "", val durationSec: Int = 0, val isrc: String = "")-- /** Backends sometimes serve 30 s previews instead of the song: anything under this is one. */- const val MIN_FULL_TRACK_SEC = 35-- suspend fun resolve(- context: Context,- spotifyId: String,- info: TrackInfo = TrackInfo(),- preferHiRes: Boolean = false,- /** The "smallest" quality: Tidal's own AAC first, as SpotiFLAC asks for LOW / HIGH. */- small: Boolean = false,- ): Result = withContext(Dispatchers.IO) {- // Qobuz's own catalogue search finds the ISRC quickly and does not depend on the- // community backends; the Tidal id does (their search), and they are often down.- fun verified(ext: ZarzSession.Ext) = com.music.spotui.data.preferences.getSpotiflacSession(context, ext.appVersion) != null- // No verified server at all: only the public ones are left, often down. Say so.- if (ZarzSession.Ext.entries.none(::verified)) verificationNeeded(context)-- // 1. Tidal through the SpotiFLAC download servers (Zarz), with the user's verified- // session, as SpotiFLAC Mobile's tidal-web extension does: the most reliable source.- // Tidal's own public API finds the exact ISRC.- if (verified(ZarzSession.Ext.TIDAL)) {- tidalIdForIsrc(info.isrc)?.let { id ->- if (small) zarzTidalAac(context, id)?.let { return@withContext it }- zarzTidal(context, id, info, preferHiRes)?.let { return@withContext it }- }- }- // 2. Qobuz the same way (qobuz-web), found by ISRC in Qobuz's own catalogue.- val qobuz = qobuzIdForIsrc(info.isrc)- if (qobuz != null && verified(ZarzSession.Ext.QOBUZ)) {- zarzQobuz(context, qobuz, info, preferHiRes)?.let { return@withContext it }- }-- // 3. Tidal community backends (no account needed).- val tidal = tidalHit(info)- if (tidal != null) tidalDirect(tidal, info, preferHiRes)?.let { return@withContext it }-- // 4. Amazon (self-resolves from the Spotify id; usually dormant).- amazon(spotifyId)?.let { return@withContext it }-- NotFound- }-- /**- * Qobuz by its track id, as the qobuz-web extension asks for it: a download ticket for- * the track's URL, then POST /dl/qbz with it. 24-bit max first when hi-res is wanted.- */- private fun zarzQobuz(context: Context, qobuzId: String, info: TrackInfo, preferHiRes: Boolean): Result? {- val trackUrl = "https://open.qobuz.com/track/$qobuzId"- val qualities = if (preferHiRes) listOf("hi-res-max", "cd") else listOf("cd")- for (q in qualities) {- try {- val ticket = ZarzSession.ticket(context, ZarzSession.Ext.QOBUZ, "qbz", "track", trackUrl)- val o = ZarzSession.signedJson(context, ZarzSession.Ext.QOBUZ, "POST", "/dl/qbz", JSONObject()- .put("quality", q).put("upload_to_r2", false).put("id", qobuzId)- .put("type", "track").put("url", trackUrl), mapOf("X-Zarz-Ticket" to ticket))- val data = o.optJSONObject("data") ?: JSONObject()- val url = listOf("download_url", "url", "link")- .firstNotNullOfOrNull { k -> o.optString(k).ifBlank { data.optString(k) }.takeIf { it.startsWith("http") } }- ?: continue- val bits = o.optInt("bit_depth", data.optInt("bit_depth", 0)).takeIf { it in 8..32 } ?: if (q == "cd") 16 else 24- if (!isFullTrack(url, info.durationSec)) continue- // The Qobuz id came from a search on the ISRC itself, checked against it.- return Success(LosslessFile(url, "", "Qobuz", bits), isrcMatched = true)- } catch (e: ZarzSession.VerifyRequired) {- // The servers want a new verification: forget the session, Settings asks again.- verificationNeeded(context)- Log.w(TAG, "zarz qobuz: verification required")- return null- } catch (e: Exception) {- Log.w(TAG, "zarz qobuz: ${e.message}")- }- }- return null- }-- /**- * Tidal by its track id, as the tidal-web extension asks for it: a ticket for the- * id, then POST /dl/tid. The answer carries Tidal's own manifest: one FLAC file- * (CD), or a DASH manifest remuxed into one FLAC (hi-res).- */- private fun zarzTidal(context: Context, tidalId: String, info: TrackInfo, preferHiRes: Boolean): Result? {- val qualities = if (preferHiRes) listOf("HI_RES_LOSSLESS", "LOSSLESS") else listOf("LOSSLESS")- for (q in qualities) {- try {- val ticket = ZarzSession.ticket(context, ZarzSession.Ext.TIDAL, "tid", "track", tidalId)- val o = ZarzSession.signedJson(context, ZarzSession.Ext.TIDAL, "POST", "/dl/tid",- JSONObject().put("id", tidalId).put("quality", q), mapOf("X-Zarz-Ticket" to ticket))- val data = o.optJSONObject("data") ?: continue- if (data.optString("assetPresentation").equals("PREVIEW", true)) continue- val file = parseTidalTrack(JSONObject().put("data", data).toString(), "https://tidal.zarz") ?: continue- val named = file.copy(provider = if (file.dashBase64.isNotBlank()) "Tidal hi-res" else "Tidal")- if (named.url.isNotBlank() && !isFullTrack(named.url, info.durationSec)) continue- return Success(named, isrcMatched = true)- } catch (e: ZarzSession.VerifyRequired) {- verificationNeeded(context)- Log.w(TAG, "zarz tidal: verification required")- return null- } catch (e: Exception) {- Log.w(TAG, "zarz tidal: ${e.message}")- }- }- return null- }-- /**- * Tidal's own AAC (LOW = 96 kbit/s, else HIGH = 320), one file as Tidal serves it:- * the small download, without a FLAC to fetch and re-encode on the phone.- */- private fun zarzTidalAac(context: Context, tidalId: String): Result? {- for (q in listOf("LOW", "HIGH")) {- try {- val ticket = ZarzSession.ticket(context, ZarzSession.Ext.TIDAL, "tid", "track", tidalId)- val o = ZarzSession.signedJson(context, ZarzSession.Ext.TIDAL, "POST", "/dl/tid",- JSONObject().put("id", tidalId).put("quality", q), mapOf("X-Zarz-Ticket" to ticket))- val data = o.optJSONObject("data") ?: continue- if (data.optString("assetPresentation").equals("PREVIEW", true)) continue- val url = aacManifestUrl(data.optString("manifest")) ?: continue- return Success(LosslessFile(url, "", "Tidal AAC ${if (q == "LOW") 96 else 320}", 16, aac = true), isrcMatched = true)- } catch (e: ZarzSession.VerifyRequired) {- verificationNeeded(context)- return null- } catch (e: Exception) {- Log.w(TAG, "zarz tidal aac: ${e.message}")- }- }- return null- }-- /** The one file of a Tidal AAC manifest (BTS JSON, mimeType audio/mp4); null for anything else. */- internal fun aacManifestUrl(manifestB64: String): String? = runCatching {- val m = JSONObject(String(java.util.Base64.getMimeDecoder().decode(manifestB64), Charsets.UTF_8))- val urls = m.optJSONArray("urls") ?: return null- if (urls.length() != 1 || !m.optString("mimeType").contains("mp4")) return null- urls.optString(0).takeIf { it.startsWith("http") }- }.getOrNull()-- /** Tidal's public API: the track carrying this exact ISRC (the web player's own token). */- internal fun tidalIdForIsrc(isrc: String): String? {- if (isrc.isBlank()) return null- return runCatching {- val body = get("https://tidal.com/v1/tracks?isrc=${URLEncoder.encode(isrc.trim(), "UTF-8")}&countryCode=US",- mapOf("x-tidal-token" to TIDAL_PUBLIC_TOKEN))- val items = JSONObject(body).optJSONArray("items") ?: JSONArray()- (0 until items.length()).map { items.getJSONObject(it) }- // Several releases carry the ISRC: one that streams in full, lossless first.- .filter { isrcMatches(it.optString("isrc"), isrc.trim()) && it.optBoolean("streamReady", true) }- .sortedByDescending { if (it.optString("audioQuality") == "HI_RES_LOSSLESS") 2 else if (it.optString("audioQuality") == "LOSSLESS") 1 else 0 }- .firstOrNull()?.optString("id")?.takeIf(String::isNotBlank)- }.getOrElse { Log.w(TAG, "tidal isrc lookup: ${it.message}"); null }- }-- /** The public token Tidal's web player sends (the tidal-web extension's default). */- private const val TIDAL_PUBLIC_TOKEN = "49YxDN9a2aFV6RTG"-- /** The public Tidal community backends direct: search gave the id already. */- private fun tidalDirect(tidal: TidalHit, info: TrackInfo, preferHiRes: Boolean): Result? {- val qualities = if (preferHiRes) listOf("HI_RES", "LOSSLESS") else listOf("LOSSLESS")- for (endpoint in LosslessRegistry.tidalEndpoints()) {- if (endpoint.isBlank()) continue- for (q in qualities) {- val body = runCatching { get("$endpoint/track/?id=${tidal.id}&quality=$q", keyHeader()) }- .getOrElse { Log.w(TAG, "tidal $endpoint: ${it.message}"); continue }- val fromResponse = runCatching { parseTidalTrack(body, endpoint) }.getOrElse {- Log.w(TAG, "tidal $endpoint parse: ${it.message}"); null- }- val file = fromResponse ?: continue- if (file.url.isBlank()) {- // DASH manifest: storage-side remux makes it a real FLAC (24-bit).- return Success(file, isrcMatches(tidal.isrc, info.isrc))- }- if (!isFullTrack(file.url, info.durationSec)) continue- return Success(file, isrcMatches(tidal.isrc, info.isrc))- }- }- return null- }-- /** Extracts the audio reference (url or base64 DASH manifest) from a /track/ response. */- private fun parseTidalTrack(body: String, endpoint: String): LosslessFile? {- val obj = JSONObject(body)- val data = obj.optJSONObject("data") ?: return null- val bits = data.optInt("bitDepth", 16).let { if (it in 8..32) it else 16 }- val direct = data.optString("url").takeIf { it.startsWith("http") }- if (direct != null) {- if (!direct.contains(".flac", true)) return null- val host = endpoint.removePrefix("https://").substringBefore('.')- return LosslessFile(direct, "", "Tidal ($host)", bits)- }- val manifest = data.optString("manifest").takeIf { it.isNotBlank() } ?: return null- val decoded = String(android.util.Base64.decode(manifest, android.util.Base64.DEFAULT), Charsets.UTF_8)- if (!decoded.contains("<MPD")) {- val m = JSONObject(decoded)- val urls = m.optJSONArray("urls") ?: return null- if (urls.length() != 1) return null- val url = urls.optString(0).takeIf { it.contains(".flac", true) } ?: return null- val host = endpoint.removePrefix("https://").substringBefore('.')- return LosslessFile(url, "", "Tidal ($host)", bits)- }- return LosslessFile("", manifest, "Tidal hi-res", 24)- }-- private fun amazon(spotifyId: String): Result? {- for (endpoint in LosslessRegistry.amazonEndpoints()) {- if (endpoint.isBlank()) continue- val body = runCatching { get("$endpoint/api/resolve/spotify/$spotifyId", keyHeader()) }- .getOrElse { Log.w(TAG, "amazon $endpoint: ${it.message}"); continue }- val url = runCatching {- val json = JSONObject(body)- val data = json.optJSONObject("data") ?: json- if (data.has("decryption_key") || json.has("decryption_key")) return@runCatching null- listOf("url", "stream_url", "download_url", "streamUrl")- .firstNotNullOfOrNull { data.optString(it).takeIf(String::isNotBlank) }- }.getOrElse { Log.w(TAG, "amazon $endpoint parse: ${it.message}"); null } ?: continue- if (url.startsWith("http") && url.contains("flac", true)) {- return Success(LosslessFile(url, "", "Amazon", 16), isrcMatched = false)- }- }- return null- }-- // ── Provider id discovery ─────────────────────────────────────────────────-- internal data class TidalHit(- val id: String, val title: String, val artist: String, val durationSec: Int, val isrc: String,- /** Every credited artist, when the search lists them (the first alone is [artist]). */- val artists: List<String> = emptyList(),- )-- /** Spotify id → Tidal track via the Tidal backend's own search, ISRC or title matched. */- internal suspend fun tidalHit(info: TrackInfo): TidalHit? {- val queries = searchQueries(info.title, info.artist)- for (endpoint in LosslessRegistry.tidalEndpoints()) {- if (endpoint.isBlank()) continue- for (query in queries) {- val q = URLEncoder.encode(query, "UTF-8")- val hits = runCatching {- val root = JSONObject(get("$endpoint/search/?s=$q", keyHeader()))- val items: JSONArray = root.optJSONObject("data")?.optJSONArray("items") ?: JSONArray()- (0 until items.length()).mapNotNull { i ->- val o = items.optJSONObject(i) ?: return@mapNotNull null- val names = o.optJSONArray("artists")?.let { a -> (0 until a.length()).mapNotNull { a.optJSONObject(it)?.optString("name") } }.orEmpty()- TidalHit(- id = o.optString("id"), title = fullTitle(o.optString("title"), o.optString("version")),- artist = o.optJSONObject("artist")?.optString("name").orEmpty(),- durationSec = o.optInt("duration"), isrc = o.optString("isrc"),- artists = names,- )- }- }.getOrElse { Log.w(TAG, "tidal search $endpoint: ${it.message}"); emptyList() }- pickHit(hits, info.isrc, info.title, info.artist, info.durationSec)?.let { return it }- }- }- return null- }-- /**- * What is typed in the search: the title and the main artist ("A, B" is Spotify's list, Tidal's- * search wants one name), then the bare title when Spotify's carries a version suffix- * ("Song - 2011 Remaster", "Song - Slowed") that makes the full phrase match nothing.- */- internal fun searchQueries(title: String, artist: String): List<String> {- val main = artist.substringBefore(",").trim()- val bare = title.substringBefore(" - ").substringBefore(" (").trim()- return listOf("$title $main".trim(), "$bare $main".trim()).filter { it.isNotBlank() }.distinct()- }-- /**- * Tidal keeps the version of a recording apart from its title ("Song" + "2011 Remaster",- * "Slowed + Reverb"), where Spotify writes it into the title: the two are put back together.- */- internal fun fullTitle(title: String, version: String): String =- if (version.isBlank() || titleKey(title).containsAll(titleKey(version))) title else "$title ($version)"-- /**- * The hit is the very recording Spotify plays: both sides have an ISRC and it is the- * same. A title + artist match (no ISRC, or another one) is not an ISRC match.- */- internal fun isrcMatches(hitIsrc: String, spotifyIsrc: String): Boolean =- spotifyIsrc.isNotBlank() && hitIsrc.equals(spotifyIsrc, ignoreCase = true)-- /**- * The same recording: ISRC exact if Spotify has one; otherwise same title and- * artist with a length within 3 s, so a live version or a cover never wins.- */- internal fun pickHit(- hits: List<TidalHit>, isrc: String, title: String, artist: String, durationSec: Int,- ): TidalHit? {- hits.firstOrNull { isrc.isNotBlank() && it.isrc.equals(isrc, ignoreCase = true) && it.id.isNotBlank() }- ?.let { return it }- val wanted = titleKey(title)- val artists = artist.split(',').map(::key).filter { it.isNotEmpty() }- return hits.firstOrNull {- it.id.isNotBlank() && titleKey(it.title) == wanted && sameArtist(it, artists) &&- (durationSec <= 0 || kotlin.math.abs(it.durationSec - durationSec) <= 3)- }- }-- /**- * A title as the words it is made of, order aside: "Song - 2011 Remaster" and "Song (Remastered- * 2011)" are one recording, "Song - Slowed" and "Song" are not (the duration tells the rest).- */- internal fun titleKey(title: String): List<String> = title.lowercase()- .split(Regex("[^\\p{L}\\p{N}]+")).filter { it.isNotEmpty() && it != "version" }- .map { if (it == "remastered") "remaster" else it }.sorted()-- private fun key(s: String) = s.lowercase().filter { it.isLetterOrDigit() }-- /**- * The hit's main artist, or any of its credited ones, is one of Spotify's: Spotify hands over- * "A, B", Tidal's search names the first alone, and requiring the whole string made every- * track with a featured artist unfindable.- */- private fun sameArtist(hit: TidalHit, artists: List<String>): Boolean =- (listOf(hit.artist) + hit.artists).map(::key).any { it.isNotEmpty() && it in artists }-- // Qobuz public search API (app_id/secret are the community's published constants).- private const val QOBUZ_APP_ID = "712109809"- private const val QOBUZ_APP_SECRET = "589be88e4538daea11f509d29e4a23b1"- private const val QOBUZ_API_BASE = "https://www.qobuz.com/api.json/0.2"-- /** Qobuz track id by ISRC (signed search); null when Spotify has no ISRC or Qobuz no match. */- internal fun qobuzIdForIsrc(isrc: String): String? {- if (isrc.isBlank()) return null- return runCatching {- val ts = (System.currentTimeMillis() / 1000).toString()- val sigPayload = "tracksearch" + "limit" + "1" + "query" + isrc.trim() + ts + QOBUZ_APP_SECRET- val sig = MessageDigest.getInstance("MD5").digest(sigPayload.toByteArray())- .joinToString("") { "%02x".format(it) }- val resp = get(- "$QOBUZ_API_BASE/track/search?query=${URLEncoder.encode(isrc.trim(), "UTF-8")}&limit=1" +- "&app_id=$QOBUZ_APP_ID&request_ts=$ts&request_sig=$sig",- emptyMap(),- )- val items: JSONArray = JSONObject(resp).optJSONObject("tracks")?.optJSONArray("items") ?: JSONArray()- // The search is full text: only a track carrying this very ISRC is the recording.- (0 until items.length()).firstNotNullOfOrNull { i ->- items.optJSONObject(i)?.takeIf { isrcMatches(it.optString("isrc"), isrc.trim()) }- ?.optString("id")?.takeIf(String::isNotBlank)- }- }.getOrElse { Log.w(TAG, "qobuz isrc search: ${it.message}"); null }- }-- // ── Content checks ────────────────────────────────────────────────────────-- /**- * The backends sometimes hand out a 30 s preview instead of the song. A FLAC- * file states its length in STREAMINFO (first 42 bytes), so one tiny range- * read tells.- */- internal fun isFullTrack(url: String, expectedSec: Int): Boolean {- if (expectedSec <= 0 || url.isBlank()) return true- val seconds = runCatching {- val conn = (URL(url).openConnection() as HttpURLConnection).apply {- connectTimeout = 8_000- readTimeout = 8_000- setRequestProperty("User-Agent", USER_AGENT)- setRequestProperty("Range", "bytes=0-41")- }- val head = try {- if (conn.responseCode !in 200..299) ByteArray(0) else readHead(conn.inputStream, 42)- } finally {- conn.disconnect()- }- flacDurationSec(head)- }.getOrNull() ?: return true // not a plain FLAC header: cannot tell here, keep it- val full = seconds >= expectedSec - 5- if (!full) Log.w(TAG, "rejected ${seconds}s preview (expected ${expectedSec}s)")- return full- }-- /** Reads at most [n] bytes (API-safe: no readNBytes), whatever the stream supplies. */- private fun readHead(input: java.io.InputStream, n: Int): ByteArray {- val b = ByteArray(n)- var off = 0- while (off < n) {- val r = input.read(b, off, n - off)- if (r < 0) break- off += r- }- return if (off == n) b else b.copyOf(off)- }-- /** Length from a FLAC STREAMINFO header, or null if [head] is not one. */- internal fun flacDurationSec(head: ByteArray): Int? {- if (head.size < 26 || String(head, 0, 4, Charsets.US_ASCII) != "fLaC") return null- // Bytes 18..25: sample rate (20 bits), channels (3), bits/sample (5), total samples (36).- var bits = 0L- for (i in 18..25) bits = (bits shl 8) or (head[i].toLong() and 0xFF)- val sampleRate = (bits ushr 44).toInt()- val totalSamples = bits and 0xFFFFFFFFFL- if (sampleRate <= 0 || totalSamples <= 0) return null- return (totalSamples / sampleRate).toInt()- }-- // ── HTTP ──────────────────────────────────────────────────────────────────-- private fun keyHeader() = mapOf("X-API-Key" to LosslessRegistry.API_KEY)-- @Volatile private var verifyToldAt = 0L-- /**- * A download server asks for its verification again: the user is told (once in a while)- * instead of downloads quietly falling back to the public servers. The session itself is- * only dropped when the server says it is invalid (ZarzSession).- */- private fun verificationNeeded(context: Context) {- val now = System.currentTimeMillis()- if (now - verifyToldAt < 10 * 60_000L) return- verifyToldAt = now- Log.w(TAG, "zarz: verification required")- android.os.Handler(android.os.Looper.getMainLooper()).post {- android.widget.Toast.makeText(context.applicationContext, app.myspoti.engine.R.string.spotiflac_verify_again, android.widget.Toast.LENGTH_LONG).show()- }- }-- internal fun get(urlString: String, headers: Map<String, String>): String {- val conn = (URL(urlString).openConnection() as HttpURLConnection).apply {- connectTimeout = 8_000- readTimeout = 8_000- setRequestProperty("User-Agent", USER_AGENT)- setRequestProperty("Accept", "application/json, text/plain, */*")- headers.forEach { (k, v) -> setRequestProperty(k, v) }- }- return try {- conn.connect()- val code = conn.responseCode- val stream = if (code in 200..299) conn.inputStream else conn.errorStream- val text = stream?.bufferedReader()?.use { it.readText() }.orEmpty()- if (code !in 200..299) throw java.io.IOException("HTTP $code: ${text.take(120)}")- text- } finally {- conn.disconnect()- }- }-}diff --git a/base/app/src/main/java/com/music/spotui/lossless/ZarzSession.kt b/base/app/src/main/java/com/music/spotui/lossless/ZarzSession.ktdeleted file mode 100644index 2f98c9d9..00000000--- a/base/app/src/main/java/com/music/spotui/lossless/ZarzSession.kt+++ /dev/null@@ -1,246 +0,0 @@-package com.music.spotui.lossless--/*- * The signed session SpotiFLAC Mobile's download extensions use (qobuz-web,- * tidal-web…), written from its protocol: the extension manifest's `signedSession`- * block and the app's signed_session runtime (bootstrap → hosted challenge →- * grant → exchange; ZARZ-HMAC-V1 signatures; download tickets).- * SpotiFLAC Mobile is MIT (Copyright (c) 2026 zarzet), its extensions Apache-2.0:- * see THIRD_PARTY_NOTICES.md.- */--import android.content.Context-import com.music.spotui.data.preferences.getSpotiflacSession-import com.music.spotui.data.preferences.saveSpotiflacSession-import org.json.JSONObject-import java.net.HttpURLConnection-import java.net.URL-import java.net.URLEncoder-import java.security.MessageDigest-import java.security.SecureRandom-import java.text.SimpleDateFormat-import java.util.Locale-import java.util.TimeZone-import javax.crypto.Mac-import javax.crypto.spec.SecretKeySpec--internal object ZarzSession {- const val BASE = "https://api.zarz.moe/v2"- const val PLATFORM = "extension"-- /** The extension a session is issued to; the server checks it in every signature. */- enum class Ext(val appVersion: String) {- TIDAL("[email protected]"),- QOBUZ("[email protected]"),- }- const val CALLBACK = "spotiflac://session-grant"- private const val SCHEME = "ZARZ-HMAC-V1"- private const val PREFIX = "X-Zarz-"- private const val WINDOW_SECONDS = 300L- private const val REFRESH_AHEAD_MS = 3_600_000L-- /**- * The grant redirects the verification page sends back to the app- * (spotiflac://session-grant…). A StateFlow, not a SharedFlow: the value is- * held until the screen takes it, so a rotation (or a screen that starts- * collecting a moment later) cannot lose the return. The screen clears it.- */- val grants = kotlinx.coroutines.flow.MutableStateFlow<String?>(null)-- /** A challenge page to open (the user solves it), or null when a session came back directly. */- class Bootstrap(val challengeUrl: String?, val state: String)-- /** The gateway wants the user to verify again (HTTP 428 / VERIFY_REQUIRED). */- class VerifyRequired : Exception("VERIFY_REQUIRED")-- fun installId(context: Context): String =- com.music.spotui.data.preferences.spotiflacInstallId(context).takeIf { it.isNotBlank() } ?: randomHex(16)-- /** GET /bootstrap: a session right away, or the challenge to solve. */- fun bootstrap(context: Context, ext: Ext, installId: String): Bootstrap {- val (code, text) = request(ext, "GET", "$BASE/bootstrap?app_version=${enc(ext.appVersion)}&install_id=${enc(installId)}", null, emptyMap())- if (code !in 200..299) throw java.io.IOException("bootstrap HTTP $code: ${text.take(120)}")- val o = JSONObject(text)- if (store(context, ext, installId, o)) return Bootstrap(null, "")- val state = randomHex(16)- val given = o.optString("auth_url").ifBlank { o.optString("challenge_url") }- val callback = "$CALLBACK?cb_version=v2grant&state=$state"- val url = when {- given.startsWith("https://") -> if ("state=" in given) given else "$given${if ('?' in given) '&' else '?'}state=$state"- o.optString("challenge_id").isNotBlank() -> "$BASE/challenge?id=${enc(o.optString("challenge_id"))}&cb=${enc(callback)}"- else -> throw java.io.IOException("bootstrap gave neither a session nor a challenge")- }- return Bootstrap(url, state)- }-- /** POST /session/exchange with the grant the challenge page handed back. */- fun exchange(context: Context, ext: Ext, installId: String, grant: String) {- val body = JSONObject().put("grant", grant).put("install_id", installId)- .put("app_version", ext.appVersion).put("platform", PLATFORM).toString()- val (code, text) = request(ext, "POST", "$BASE/session/exchange", body, mapOf("Content-Type" to "application/json"))- if (code !in 200..299 || !store(context, ext, installId, JSONObject(text))) throw java.io.IOException("session exchange failed: HTTP $code")- }-- /**- * A signed JSON call ([path] under [BASE], e.g. "/tickets"); returns the body.- * Refreshes a session that expires within the hour first.- */- /**- * As SpotiFLAC Mobile's signed-session client does: a request refused because another- * download renewed the session meanwhile (the renewal changes the secret) is sent again- * once with the new one; the session is dropped only when the gateway says to start- * over (401 SESSION_INVALID, bootstrap_session); "verify" (428) keeps it; a provider- * that is briefly unavailable (503, same_operation) is waited for, at most twice.- */- fun signedJson(context: Context, ext: Ext, method: String, path: String, body: JSONObject?, extra: Map<String, String> = emptyMap()): JSONObject {- refreshIfDue(context, ext)- var sessionRetried = false- var providerRetries = 0- while (true) {- val used = com.music.spotui.data.preferences.getSpotiflacSession(context, ext.appVersion) ?: throw VerifyRequired()- val (code, text) = signed(context, ext, method, path, body?.toString(), extra)- val o = runCatching { JSONObject(text) }.getOrDefault(JSONObject())- val err = o.optString("code").uppercase()- val origin = o.optString("origin").lowercase()- val action = o.optString("action").lowercase()- if (code == 503 && origin == "provider" && err == "PROVIDER_UNAVAILABLE" && o.optBoolean("retryable") &&- o.optString("retry_mode").equals("same_operation", true) && providerRetries < 2) {- providerRetries++- Thread.sleep((o.optLong("retry_after_seconds", 2).coerceIn(1, 120)) * 1000)- continue- }- val sessionRefused = (code == 401 && err == "SESSION_INVALID") || (code == 403 && err == "REQUEST_AUTH_INVALID")- if (sessionRefused) {- val latest = com.music.spotui.data.preferences.getSpotiflacSession(context, ext.appVersion)- if (!sessionRetried && latest != null && latest.sessionSecret != used.sessionSecret) { sessionRetried = true; continue }- if (code == 401 && origin == "gateway" && action == "bootstrap_session")- com.music.spotui.data.preferences.clearSpotiflacSession(context, ext.appVersion)- throw VerifyRequired()- }- if (code == 428 || err == "VERIFY_REQUIRED" || o.optBoolean("needsVerification")) throw VerifyRequired()- if (code !in 200..299) throw java.io.IOException("HTTP $code: ${(o.optString("error").ifBlank { text }).take(160)}")- return o- }- }-- /** A download ticket for one resource ("qbz", "track", the track's URL). */- fun ticket(context: Context, ext: Ext, provider: String, type: String, id: String): String {- val hash = sha256Hex("$provider:$type:${id.lowercase()}".toByteArray())- val o = signedJson(context, ext, "POST", "/tickets", JSONObject()- .put("capability", "download_ticket").put("provider", provider).put("resource_hash", hash))- return o.optString("ticket_id").ifBlank { o.optString("ticket") }.trim().ifBlank { throw java.io.IOException("no ticket_id") }- }-- private val refreshLocks = Ext.entries.associateWith { Any() }-- /**- * Renews the session in its last hour, one renewal at a time (as SpotiFLAC Mobile): the- * renewal changes the secret, so renewing on every call of parallel downloads made the- * server refuse the others and the session was lost. An ended session still gets a try.- */- private fun refreshIfDue(context: Context, ext: Ext) = synchronized(refreshLocks.getValue(ext)) {- // Read again under the lock: another download may have just renewed it.- val s = getSpotiflacSession(context, ext.appVersion) ?: throw VerifyRequired()- val expires = parseIso(s.expiresAt) ?: return- val left = expires - System.currentTimeMillis()- if (left > REFRESH_AHEAD_MS) return- val renewed = runCatching {- val (code, text) = signed(context, ext, "POST", "/session/refresh", JSONObject().put("install_id", s.installId).toString(), emptyMap())- if (code in 200..299) { store(context, ext, s.installId, JSONObject(text), keepMissing = true); true } else false- }.getOrDefault(false)- if (!renewed && left <= 0) throw VerifyRequired()- }-- private fun signed(context: Context, ext: Ext, method: String, path: String, body: String?, extra: Map<String, String>): Pair<Int, String> {- val s = getSpotiflacSession(context, ext.appVersion) ?: throw VerifyRequired()- val url = BASE + path- val bytes = (body ?: "").toByteArray(Charsets.UTF_8)- val headers = signHeaders(s.sessionId, s.sessionSecret, ext.appVersion, method, URL(url).path, bytes, System.currentTimeMillis(), randomHex(12)) +- extra + (if (body != null) mapOf("Content-Type" to "application/json") else emptyMap())- return request(ext, method, url, body, headers)- }-- /** ZARZ-HMAC-V1: a key rolled every 5 minutes from the secret, then the request signed with it. */- internal fun signHeaders(sessionId: String, secret: String, appVersion: String, method: String, path: String, body: ByteArray, nowMs: Long, nonce: String): Map<String, String> {- val ts = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", Locale.US).apply { timeZone = TimeZone.getTimeZone("UTC") }.format(java.util.Date(nowMs))- val hash = sha256Hex(body)- val window = (nowMs / 1000) / WINDOW_SECONDS- val rolling = hmac(secret.toByteArray(), "$window:$sessionId".toByteArray())- val signing = listOf(SCHEME, method, path, "", hash, ts, nonce, sessionId, appVersion, PLATFORM).joinToString("\n")- val signature = hmac(rolling.toByteArray(), signing.toByteArray())- return linkedMapOf(- "Session" to sessionId, "Timestamp" to ts, "Nonce" to nonce, "Body-SHA256" to hash,- "Signature" to signature, "App-Version" to appVersion, "Platform" to PLATFORM,- ).mapKeys { PREFIX + it.key }- }-- private fun store(context: Context, ext: Ext, installId: String, o: JSONObject, keepMissing: Boolean = false): Boolean {- val id = o.optString("session_id"); val secret = o.optString("session_secret"); val exp = o.optString("expires_at")- if (id.isBlank() || secret.isBlank()) {- if (!keepMissing || exp.isBlank()) return false- val old = getSpotiflacSession(context, ext.appVersion) ?: return false- saveSpotiflacSession(context, old.sessionId, old.sessionSecret, installId, exp, ext.appVersion)- return true- }- saveSpotiflacSession(context, id, secret, installId, exp, ext.appVersion)- return true- }-- private fun request(ext: Ext, method: String, url: String, body: String?, headers: Map<String, String>): Pair<Int, String> {- val conn = (URL(url).openConnection() as HttpURLConnection).apply {- requestMethod = method- connectTimeout = 15_000- readTimeout = 30_000- setRequestProperty("Accept", "application/json")- // As SpotiFLAC Mobile's runtime: "SpotiFLAC-Mobile/<extension version>" (the bare name gets 403).- setRequestProperty("User-Agent", "SpotiFLAC-Mobile/${ext.appVersion}")- headers.forEach { (k, v) -> setRequestProperty(k, v) }- if (body != null) doOutput = true- }- try {- if (body != null) conn.outputStream.use { it.write(body.toByteArray(Charsets.UTF_8)) }- val code = conn.responseCode- val text = (if (code in 200..299) conn.inputStream else conn.errorStream)?.bufferedReader()?.use { it.readText() }.orEmpty()- return code to text- } finally {- conn.disconnect()- }- }-- /**- * The grant and state of a verification return link, read as SpotiFLAC Mobile reads- * it: `grant` (or `code`) and `state` in the query, else anywhere in the link- * (fragment included), else in a nested `cb` link. Null when either is missing.- */- internal fun parseGrant(text: String): Pair<String, String>? {- val t = text.trim()- if (t.isEmpty()) return null- fun nonEmpty(v: String?) = v?.trim()?.takeIf { it.isNotEmpty() }- fun query(name: String): String? = Regex("[?&]" + name + "=([^&#]*)").find(t.substringBefore('#'))?.groupValues?.get(1)- ?.let { runCatching { java.net.URLDecoder.decode(it, "UTF-8") }.getOrNull() }- var grant = nonEmpty(query("grant") ?: query("code"))- var state = nonEmpty(query("state"))- val nested = nonEmpty(query("cb"))- if (grant == null && nested != null) parseGrant(nested)?.let { return it }- fun anywhere(name: String): String? = Regex("(?:^|[?&#\\s])" + name + "=([^&#\\s]+)").find(t)?.groupValues?.get(1)- ?.let { runCatching { java.net.URLDecoder.decode(it, "UTF-8") }.getOrNull() }- grant = nonEmpty(grant ?: anywhere("grant") ?: anywhere("code"))- state = nonEmpty(state ?: anywhere("state"))- return if (grant != null && state != null) grant to state else null- }-- internal fun parseIso(value: String): Long? = runCatching {- java.time.OffsetDateTime.parse(value.trim()).toInstant().toEpochMilli()- }.getOrNull()-- private fun hmac(key: ByteArray, data: ByteArray): String = java.util.Base64.getUrlEncoder().withoutPadding().encodeToString(- Mac.getInstance("HmacSHA256").apply { init(SecretKeySpec(key, "HmacSHA256")) }.doFinal(data),- )-- internal fun sha256Hex(data: ByteArray): String =- MessageDigest.getInstance("SHA-256").digest(data).joinToString("") { "%02x".format(it) }-- private fun randomHex(n: Int): String = ByteArray(n).also { SecureRandom().nextBytes(it) }.joinToString("") { "%02x".format(it) }-- private fun enc(s: String) = URLEncoder.encode(s, "UTF-8")-}diff --git a/base/app/src/main/java/com/music/spotui/ui/components/AboutSheet.kt b/base/app/src/main/java/com/music/spotui/ui/components/AboutSheet.ktindex 2891ba86..6db76c65 100644--- a/base/app/src/main/java/com/music/spotui/ui/components/AboutSheet.kt+++ b/base/app/src/main/java/com/music/spotui/ui/components/AboutSheet.kt@@ -1,5 +1,9 @@package com.music.spotui.ui.components+import com.music.spotui.ui.theme.tone+import com.music.spotui.ui.theme.AppText+import com.music.spotui.ui.theme.AppMuted+import android.content.Contextimport android.content.Intentimport android.net.Uri@@ -51,29 +55,30 @@ private fun openUrl(context: Context, url: String) {@Composablefun AboutSheet(onDismiss: () -> Unit) {val context = LocalContext.current+ com.music.spotui.extensions.ProtectedSurfaceEffect(app.myspoti.extensions.ProtectedSurface.ABOUT)// Opened in full: half open, it hid the support buttons at the bottom.ModalBottomSheet(onDismissRequest = onDismiss,sheetState = androidx.compose.material3.rememberModalBottomSheetState(skipPartiallyExpanded = true),- containerColor = Color(0xFF282828),+ containerColor = tone(0xFF282828),) {Column(Modifier.navigationBarsPadding().verticalScroll(rememberScrollState()).padding(bottom = 20.dp)) {Row(verticalAlignment = Alignment.CenterVertically, modifier = Modifier.padding(horizontal = 20.dp)) {Image(painterResource(R.drawable.ic_launcher_foreground), contentDescription = null,- modifier = Modifier.size(56.dp).clip(RoundedCornerShape(14.dp)).background(Color(0xFF121212)),+ modifier = Modifier.size(56.dp).clip(RoundedCornerShape(14.dp)).background(tone(0xFF121212)),)Column(Modifier.padding(start = 14.dp)) {- Text("Myspoti", color = Color.White, fontSize = 20.sp, fontWeight = FontWeight.Bold)+ Text("Myspoti", color = AppText, fontSize = 20.sp, fontWeight = FontWeight.Bold)Text("${stringResource(R.string.settings_item_version_title)} ${BuildConfig.VERSION_NAME}",- color = Color(0xFFB3B3B3), fontSize = 13.sp)+ color = AppMuted, fontSize = 13.sp)}}- Text(stringResource(R.string.about_free), color = Color(0xFFB3B3B3), fontSize = 13.sp,+ Text(stringResource(R.string.about_free), color = AppMuted, fontSize = 13.sp,modifier = Modifier.padding(start = 20.dp, end = 20.dp, top = 12.dp, bottom = 8.dp))AboutRow(stringResource(R.string.about_discord), stringResource(R.string.about_discord_detail)) { openUrl(context, DISCORD_URL) }AboutRow(stringResource(R.string.about_github), stringResource(R.string.about_github_detail)) { openUrl(context, "https://github.com/$repo") }- Text(stringResource(R.string.support_body), color = Color(0xFFB3B3B3), fontSize = 13.sp,+ Text(stringResource(R.string.support_body), color = AppMuted, fontSize = 13.sp,modifier = Modifier.padding(start = 20.dp, end = 20.dp, top = 14.dp, bottom = 12.dp))Box(contentAlignment = Alignment.Center,@@ -92,9 +97,9 @@ fun GitHubSponsorButton(modifier: Modifier = Modifier, onClick: (() -> Unit)? =Box(contentAlignment = Alignment.Center,modifier = modifier.fillMaxWidth().height(48.dp).clip(RoundedCornerShape(50))- .border(1.dp, Color.White.copy(alpha = 0.6f), RoundedCornerShape(50))+ .border(1.dp, AppText.copy(alpha = 0.6f), RoundedCornerShape(50)).pressable(0.96f) { onClick?.invoke() ?: SupportReminder.openSponsors(context) },- ) { Text(stringResource(R.string.support_github_action), color = Color.White, fontSize = 16.sp, fontWeight = FontWeight.Bold) }+ ) { Text(stringResource(R.string.support_github_action), color = AppText, fontSize = 16.sp, fontWeight = FontWeight.Bold) }}/** "Support Myspoti" from the profile menu: Ko-fi or GitHub Sponsors, the user picks. */@@ -102,14 +107,15 @@ fun GitHubSponsorButton(modifier: Modifier = Modifier, onClick: (() -> Unit)? =@Composablefun SupportSheet(onDismiss: () -> Unit) {val context = LocalContext.current+ com.music.spotui.extensions.ProtectedSurfaceEffect(app.myspoti.extensions.ProtectedSurface.SUPPORT)ModalBottomSheet(onDismissRequest = onDismiss,sheetState = androidx.compose.material3.rememberModalBottomSheetState(skipPartiallyExpanded = true),- containerColor = Color(0xFF282828),+ containerColor = tone(0xFF282828),) {androidx.compose.foundation.layout.Column(Modifier.padding(start = 20.dp, end = 20.dp, bottom = 28.dp)) {- Text(stringResource(R.string.support_title), color = Color.White, fontSize = 20.sp, fontWeight = FontWeight.Bold)- Text(stringResource(R.string.support_body), color = Color(0xFFB3B3B3), fontSize = 14.sp,+ Text(stringResource(R.string.support_title), color = AppText, fontSize = 20.sp, fontWeight = FontWeight.Bold)+ Text(stringResource(R.string.support_body), color = AppMuted, fontSize = 14.sp,modifier = Modifier.padding(top = 10.dp, bottom = 18.dp))Box(contentAlignment = Alignment.Center,@@ -124,7 +130,7 @@ fun SupportSheet(onDismiss: () -> Unit) {@Composableprivate fun AboutRow(title: String, detail: String, onClick: () -> Unit) {Column(Modifier.fillMaxWidth().clickable(onClick = onClick).padding(horizontal = 20.dp, vertical = 10.dp)) {- Text(title, color = Color.White, fontSize = 16.sp)- Text(detail, color = Color(0xFFB3B3B3), fontSize = 12.sp)+ Text(title, color = AppText, fontSize = 16.sp)+ Text(detail, color = AppMuted, fontSize = 12.sp)}}diff --git a/base/app/src/main/java/com/music/spotui/ui/components/AddCollectionToPlaylistSheet.kt b/base/app/src/main/java/com/music/spotui/ui/components/AddCollectionToPlaylistSheet.ktnew file mode 100644index 00000000..e052ea9c--- /dev/null+++ b/base/app/src/main/java/com/music/spotui/ui/components/AddCollectionToPlaylistSheet.kt@@ -0,0 +1,159 @@+package com.music.spotui.ui.components++import android.os.Handler+import android.os.Looper+import android.widget.Toast+import androidx.compose.foundation.layout.Column+import androidx.compose.foundation.layout.Spacer+import androidx.compose.foundation.layout.height+import androidx.compose.foundation.layout.heightIn+import androidx.compose.foundation.layout.imePadding+import androidx.compose.foundation.layout.navigationBarsPadding+import androidx.compose.foundation.layout.padding+import androidx.compose.foundation.lazy.LazyColumn+import androidx.compose.material.icons.Icons+import androidx.compose.material.icons.outlined.AddCircleOutline+import androidx.compose.material3.AlertDialog+import androidx.compose.material3.ExperimentalMaterial3Api+import androidx.compose.material3.ModalBottomSheet+import androidx.compose.material3.Text+import androidx.compose.material3.TextButton+import androidx.compose.material3.rememberModalBottomSheetState+import androidx.compose.runtime.Composable+import androidx.compose.runtime.LaunchedEffect+import androidx.compose.runtime.getValue+import androidx.compose.runtime.mutableStateOf+import androidx.compose.runtime.remember+import androidx.compose.runtime.rememberCoroutineScope+import androidx.compose.runtime.setValue+import androidx.compose.ui.Modifier+import androidx.compose.ui.platform.LocalContext+import androidx.compose.ui.res.stringResource+import androidx.compose.ui.text.font.FontWeight+import androidx.compose.ui.text.style.TextOverflow+import androidx.compose.ui.unit.dp+import androidx.compose.ui.unit.sp+import app.myspoti.api.MergePlan+import app.myspoti.api.PlaylistMerge+import app.myspoti.engine.R+import app.myspoti.host.android.MyspotiRuntime+import com.music.spotui.data.api.EditablePlaylist+import com.music.spotui.data.api.EditablePlaylists+import com.music.spotui.data.api.SpotifySync+import com.music.spotui.ui.theme.AppMuted+import com.music.spotui.ui.theme.AppText+import com.music.spotui.ui.theme.tone+import kotlinx.coroutines.launch++/**+ * "Add playlist to another playlist" / an album's "Add to playlist": every song of [sourceUri]+ * (a playlist or an album) goes to the bottom of the playlist the user picks. As in the Web+ * Player, the target is read first and a dialog asks when songs are already there: "Add all" or+ * "Add new ones" when some are, "Add anyway" or "Don't add" when all are.+ */+@OptIn(ExperimentalMaterial3Api::class)+@Composable+fun AddCollectionToPlaylistSheet(sourceUri: String, title: String, onDismiss: () -> Unit) {+ val context = LocalContext.current+ val scope = rememberCoroutineScope()+ val sheetState = rememberModalBottomSheetState(skipPartiallyExpanded = true)+ var playlists by remember { mutableStateOf<List<EditablePlaylist>?>(null) }+ var query by remember { mutableStateOf("") }+ var reading by remember { mutableStateOf(false) }+ var asking by remember { mutableStateOf<Pair<EditablePlaylist, MergePlan>?>(null) }+ LaunchedEffect(Unit) { playlists = EditablePlaylists.load() }+ val shown = remember(playlists, query) {+ playlists.orEmpty().filter { "spotify:playlist:${it.id}" != sourceUri && matchesFind(query, it.name) }+ }++ fun say(text: String) = Handler(Looper.getMainLooper()).post { Toast.makeText(context, text, Toast.LENGTH_SHORT).show() }++ fun write(target: EditablePlaylist, uris: List<String>) {+ onDismiss()+ if (uris.isEmpty()) return+ SpotifySync.addUrisToPlaylist(context, target.id, uris) { ok ->+ say(if (ok) context.getString(R.string.add_collection_done, uris.size, target.name) else context.getString(R.string.playlist_change_refused))+ }+ }++ fun pick(target: EditablePlaylist) {+ if (reading) return+ reading = true+ scope.launch {+ val plan = runCatching { PlaylistMerge.plan(MyspotiRuntime.api, "spotify:playlist:${target.id}", sourceUri) }.getOrNull()+ reading = false+ when {+ plan == null -> { say(context.getString(R.string.playlist_change_refused)); onDismiss() }+ plan.all.isEmpty() -> { say(context.getString(R.string.add_collection_nothing)); onDismiss() }+ plan.hasDuplicates -> asking = target to plan+ else -> write(target, plan.all)+ }+ }+ }++ ModalBottomSheet(onDismissRequest = onDismiss, sheetState = sheetState, containerColor = tone(0xFF1A1A1A)) {+ Column(modifier = Modifier.navigationBarsPadding().imePadding()) {+ Text(+ title, color = AppText, fontSize = 20.sp, fontWeight = FontWeight.Bold, maxLines = 1, overflow = TextOverflow.Ellipsis,+ modifier = Modifier.padding(20.dp, 4.dp, 20.dp, 12.dp),+ )+ FindInListField(+ query = query, onQuery = { query = it },+ hint = stringResource(R.string.add_to_playlist_search_hint),+ modifier = Modifier.padding(horizontal = 20.dp),+ )+ val list = playlists+ when {+ list == null || reading -> Text(+ stringResource(if (reading) R.string.add_collection_reading else R.string.loading_playlists),+ color = AppMuted, fontSize = 14.sp, modifier = Modifier.padding(20.dp, 12.dp),+ )+ shown.isEmpty() -> Text(+ stringResource(if (list.isEmpty()) R.string.add_to_playlist_empty else R.string.add_to_playlist_no_match, query.trim()),+ color = AppMuted, fontSize = 14.sp, modifier = Modifier.padding(20.dp, 12.dp),+ )+ else -> LazyColumn(modifier = Modifier.heightIn(max = 420.dp).padding(top = 4.dp)) {+ items(shown.size) { i -> PickRow(shown[i]) { pick(shown[i]) } }+ }+ }+ Spacer(Modifier.height(16.dp))+ }+ }++ asking?.let { (target, plan) ->+ val some = plan.someDuplicate+ AlertDialog(+ // Outside the dialog: nothing is added (the Web Player's onOutside).+ onDismissRequest = { asking = null; onDismiss() },+ containerColor = tone(0xFF282828),+ title = { Text(stringResource(if (some) R.string.duplicate_title_some else R.string.duplicate_title_all), color = AppText) },+ text = { Text(stringResource(if (some) R.string.duplicate_text_some else R.string.duplicate_text_all, target.name), color = AppMuted) },+ confirmButton = {+ TextButton(onClick = {+ asking = null+ if (some) write(target, plan.fresh) else onDismiss()+ }) { Text(stringResource(if (some) R.string.duplicate_add_new else R.string.duplicate_dont_add), color = com.music.spotui.ui.theme.AppAccent) }+ },+ dismissButton = {+ TextButton(onClick = { asking = null; write(target, plan.all) }) {+ Text(stringResource(if (some) R.string.duplicate_add_all else R.string.duplicate_add_anyway), color = AppText)+ }+ },+ )+ }+}++/** The ⋯ menu of an album page: the album's "Add to playlist". */+@OptIn(ExperimentalMaterial3Api::class)+@Composable+fun AlbumOptionsSheet(albumUri: String, name: String, onDismiss: () -> Unit) {+ var adding by remember { mutableStateOf(false) }+ if (adding) { AddCollectionToPlaylistSheet(albumUri, name, onDismiss); return }+ ModalBottomSheet(onDismissRequest = onDismiss, containerColor = tone(0xFF282828)) {+ Column(Modifier.navigationBarsPadding().padding(bottom = 12.dp)) {+ Text(name, color = AppText, fontSize = 18.sp, fontWeight = FontWeight.Bold, maxLines = 1, overflow = TextOverflow.Ellipsis,+ modifier = Modifier.padding(20.dp, 0.dp, 20.dp, 8.dp))+ OptionRow(Icons.Outlined.AddCircleOutline, stringResource(R.string.context_menu_add_to_playlist)) { adding = true }+ }+ }+}diff --git a/base/app/src/main/java/com/music/spotui/ui/components/AddSongsScreen.kt b/base/app/src/main/java/com/music/spotui/ui/components/AddSongsScreen.ktindex 0d03badc..66d69aa4 100644--- a/base/app/src/main/java/com/music/spotui/ui/components/AddSongsScreen.kt+++ b/base/app/src/main/java/com/music/spotui/ui/components/AddSongsScreen.kt@@ -1,5 +1,9 @@package com.music.spotui.ui.components+import com.music.spotui.ui.theme.tone+import com.music.spotui.ui.theme.AppText+import com.music.spotui.ui.theme.AppMuted+import androidx.compose.foundation.backgroundimport androidx.compose.foundation.clickableimport androidx.compose.foundation.layout.Box@@ -116,32 +120,32 @@ fun AddSongsScreen(page: ContextPageModel, onClose: (added: Boolean) -> Unit) {val close = { onClose(added.isNotEmpty()) }Dialog(onDismissRequest = close, properties = DialogProperties(usePlatformDefaultWidth = false, decorFitsSystemWindows = false)) {- Column(Modifier.fillMaxSize().background(Color(0xFF121212)).statusBarsPadding().navigationBarsPadding().imePadding()) {+ Column(Modifier.fillMaxSize().background(tone(0xFF121212)).statusBarsPadding().navigationBarsPadding().imePadding()) {Row(verticalAlignment = Alignment.CenterVertically, modifier = Modifier.fillMaxWidth().height(56.dp).padding(horizontal = 4.dp)) {Box(contentAlignment = Alignment.Center, modifier = Modifier.size(48.dp).clip(CircleShape).clickable(onClick = close)) {- Icon(Icons.Default.Close, contentDescription = stringResource(R.string.add_songs_close), tint = Color.White)+ Icon(Icons.Default.Close, contentDescription = stringResource(R.string.add_songs_close), tint = AppText)}- Text(stringResource(R.string.add_songs_title), color = Color.White, fontSize = 17.sp, fontWeight = FontWeight.Bold,+ Text(stringResource(R.string.add_songs_title), color = AppText, fontSize = 17.sp, fontWeight = FontWeight.Bold,modifier = Modifier.weight(1f).padding(start = 4.dp), maxLines = 1, overflow = TextOverflow.Ellipsis)}Row(verticalAlignment = Alignment.CenterVertically,modifier = Modifier.padding(horizontal = 16.dp).fillMaxWidth().height(44.dp)- .clip(RoundedCornerShape(8.dp)).background(Color(0xFF2A2A2A)).padding(horizontal = 12.dp),+ .clip(RoundedCornerShape(8.dp)).background(tone(0xFF2A2A2A)).padding(horizontal = 12.dp),) {- Icon(Icons.Default.Search, contentDescription = null, tint = Color(0xFFB3B3B3), modifier = Modifier.size(22.dp))+ Icon(Icons.Default.Search, contentDescription = null, tint = AppMuted, modifier = Modifier.size(22.dp))Spacer(Modifier.width(10.dp))Box(Modifier.weight(1f)) {- if (query.isEmpty()) Text(stringResource(R.string.add_songs_search_hint), color = Color(0xFFB3B3B3), fontSize = 15.sp)+ if (query.isEmpty()) Text(stringResource(R.string.add_songs_search_hint), color = AppMuted, fontSize = 15.sp)BasicTextField(value = query, onValueChange = { query = it }, singleLine = true,- textStyle = TextStyle(color = Color.White, fontSize = 15.sp), cursorBrush = SolidColor(Green),+ textStyle = TextStyle(color = AppText, fontSize = 15.sp), cursorBrush = SolidColor(Green),keyboardOptions = KeyboardOptions(imeAction = ImeAction.Search),keyboardActions = KeyboardActions(onSearch = { keyboard?.hide() }),modifier = Modifier.fillMaxWidth().focusRequester(focus),)}- if (query.isNotEmpty()) Icon(Icons.Default.Close, contentDescription = null, tint = Color.White,+ if (query.isNotEmpty()) Icon(Icons.Default.Close, contentDescription = null, tint = AppText,modifier = Modifier.size(20.dp).clickable { query = "" })}val searching = query.isNotBlank()@@ -149,21 +153,21 @@ fun AddSongsScreen(page: ContextPageModel, onClose: (added: Boolean) -> Unit) {LazyColumn(Modifier.weight(1f).padding(top = 8.dp)) {if (!searching) item(key = "suggestions-title") {Row(verticalAlignment = Alignment.CenterVertically, modifier = Modifier.fillMaxWidth().padding(start = 16.dp, end = 8.dp, top = 8.dp)) {- Text(stringResource(R.string.recommended_songs), color = Color.White, fontSize = 18.sp, fontWeight = FontWeight.Bold, modifier = Modifier.weight(1f))+ Text(stringResource(R.string.recommended_songs), color = AppText, fontSize = 18.sp, fontWeight = FontWeight.Bold, modifier = Modifier.weight(1f))TextButton(onClick = { suggestionsRound++ }) {- Text(stringResource(R.string.recommended_songs_refresh), color = Color.White, fontWeight = FontWeight.Bold)+ Text(stringResource(R.string.recommended_songs_refresh), color = AppText, fontWeight = FontWeight.Bold)}}}when {list == null -> item(key = "loading") { SkeletonList(count = 8) }list.isEmpty() && searching -> item(key = "none") {- Text(stringResource(R.string.add_songs_nothing, query.trim()), color = Color(0xFFB3B3B3), fontSize = 14.sp,+ Text(stringResource(R.string.add_songs_nothing, query.trim()), color = AppMuted, fontSize = 14.sp,modifier = Modifier.padding(24.dp))}else -> items(list, key = { (if (searching) "r-" else "s-") + it.spotifyTrackId }) { song ->val there = song.spotifyTrackId in inList || song.spotifyTrackId in added- AddSongRow(song, there, onPlay = { SongPlayer.playSong(song.url, context) }) {+ AddSongRow(song, there, onPlay = { SongPlayer.playSong(song.url, context, songs = listOf(song)) }) {if (there) return@AddSongRowadded += song.spotifyTrackIdcom.music.spotui.di.Haptics.confirm()@@ -192,15 +196,15 @@ private fun AddSongRow(song: SongsModel, added: Boolean, onPlay: () -> Unit, onAGlideImage(model = song.coverUri, contentDescription = null, contentScale = ContentScale.Crop, transition = CrossFade,modifier = Modifier.size(48.dp).clip(RoundedCornerShape(4.dp)))Column(Modifier.weight(1f).padding(start = 12.dp, end = 8.dp)) {- Text(song.title, color = Color.White, fontSize = 15.sp, maxLines = 1, overflow = TextOverflow.Ellipsis)+ Text(song.title, color = AppText, fontSize = 15.sp, maxLines = 1, overflow = TextOverflow.Ellipsis)Row(verticalAlignment = Alignment.CenterVertically) {if (song.explicit) { com.music.spotui.ui.screens.ExplicitBadge(); Spacer(Modifier.width(6.dp)) }- Text(song.singer, color = Color(0xFFB3B3B3), fontSize = 13.sp, maxLines = 1, overflow = TextOverflow.Ellipsis)+ Text(song.singer, color = AppMuted, fontSize = 13.sp, maxLines = 1, overflow = TextOverflow.Ellipsis)}}Box(contentAlignment = Alignment.Center, modifier = Modifier.size(48.dp).clip(CircleShape).clickable(enabled = !added, onClick = onAdd)) {if (added) Icon(Icons.Default.CheckCircle, contentDescription = stringResource(R.string.add_songs_added), tint = Green, modifier = Modifier.size(26.dp))- else Icon(Icons.Outlined.AddCircleOutline, contentDescription = stringResource(R.string.recommended_songs_add), tint = Color.White, modifier = Modifier.size(26.dp))+ else Icon(Icons.Outlined.AddCircleOutline, contentDescription = stringResource(R.string.recommended_songs_add), tint = AppText, modifier = Modifier.size(26.dp))}}}diff --git a/base/app/src/main/java/com/music/spotui/ui/components/AddToPlaylistSheet.kt b/base/app/src/main/java/com/music/spotui/ui/components/AddToPlaylistSheet.ktindex bdcb59f3..73458111 100644--- a/base/app/src/main/java/com/music/spotui/ui/components/AddToPlaylistSheet.kt+++ b/base/app/src/main/java/com/music/spotui/ui/components/AddToPlaylistSheet.kt@@ -1,5 +1,9 @@package com.music.spotui.ui.components+import com.music.spotui.ui.theme.tone+import com.music.spotui.ui.theme.AppText+import com.music.spotui.ui.theme.AppMuted+import android.content.Contextimport android.os.Handlerimport android.os.Looper@@ -95,12 +99,12 @@ fun AddToPlaylistSheet(ModalBottomSheet(onDismissRequest = onDismiss,sheetState = sheetState,- containerColor = androidx.compose.ui.graphics.Color(0xFF1A1A1A),+ containerColor = tone(0xFF1A1A1A),) {Column(modifier = Modifier.navigationBarsPadding().imePadding()) {Text(stringResource(R.string.context_menu_add_to_another_playlist),- color = androidx.compose.ui.graphics.Color.White,+ color = AppText,fontSize = 20.sp,fontWeight = FontWeight.Bold,maxLines = 1,@@ -139,7 +143,7 @@ fun AddToPlaylistSheet(@OptIn(ExperimentalGlideComposeApi::class)@Composable-private fun PickRow(playlist: EditablePlaylist, onClick: () -> Unit) {+internal fun PickRow(playlist: EditablePlaylist, onClick: () -> Unit) {Row(verticalAlignment = Alignment.CenterVertically,modifier = Modifier.fillMaxWidth().clickable(onClick = onClick).padding(horizontal = 20.dp, vertical = 8.dp),@@ -154,7 +158,7 @@ private fun PickRow(playlist: EditablePlaylist, onClick: () -> Unit) {contentDescription = "",)Column(Modifier.weight(1f).padding(start = 14.dp)) {- Text(playlist.name, color = androidx.compose.ui.graphics.Color.White, fontSize = 15.sp, fontWeight = FontWeight.Medium,+ Text(playlist.name, color = AppText, fontSize = 15.sp, fontWeight = FontWeight.Medium,maxLines = 1, overflow = TextOverflow.Ellipsis)Text(pluralStringResource(R.plurals.liked_songs_header_metadata_text, playlist.trackCount, playlist.trackCount),@@ -165,7 +169,7 @@ private fun PickRow(playlist: EditablePlaylist, onClick: () -> Unit) {Icon(Icons.Default.Add,contentDescription = null,- tint = androidx.compose.ui.graphics.Color(0xFFB3B3B3),+ tint = AppMuted,modifier = Modifier.size(22.dp),)}diff --git a/base/app/src/main/java/com/music/spotui/ui/components/AppComponents.kt b/base/app/src/main/java/com/music/spotui/ui/components/AppComponents.ktindex 3e4a7c25..c507ea52 100644--- a/base/app/src/main/java/com/music/spotui/ui/components/AppComponents.kt+++ b/base/app/src/main/java/com/music/spotui/ui/components/AppComponents.kt@@ -1,5 +1,8 @@package com.music.spotui.ui.components+import com.music.spotui.ui.theme.tone+import com.music.spotui.ui.theme.AppText+import androidx.compose.ui.res.stringResourceimport androidx.compose.foundation.layout.Spacer@@ -46,6 +49,7 @@ import androidx.compose.ui.graphics.graphicsLayerimport androidx.compose.ui.draw.clipimport androidx.compose.ui.draw.clipToBoundsimport androidx.compose.ui.graphics.Color+import androidx.compose.ui.input.pointer.pointerInputimport androidx.compose.ui.graphics.toArgbimport androidx.compose.ui.layout.ContentScaleimport androidx.compose.ui.platform.LocalContext@@ -89,8 +93,8 @@ fun Loader(kind: SkeletonKind = SkeletonKind.List) {.padding(horizontal = 16.dp, vertical = 12.dp),) {if (!visible) return@Column- val tile = Color(0xFF242424)- val line = Color(0xFF2A2A2A)+ val tile = tone(0xFF242424)+ val line = tone(0xFF2A2A2A)when (kind) {SkeletonKind.Home -> {repeat(4) {@@ -131,10 +135,10 @@ fun SkeletonList(count: Int = 6, round: Boolean = false, modifier: Modifier = Moif (!visible) return@Columnif (round) repeat(count) {Row(Modifier.padding(vertical = 8.dp), verticalAlignment = Alignment.CenterVertically) {- Box(Modifier.size(48.dp).clip(androidx.compose.foundation.shape.CircleShape).background(Color(0xFF242424)))- Box(Modifier.padding(start = 12.dp).width(150.dp).height(14.dp).clip(RoundedCornerShape(4.dp)).background(Color(0xFF2A2A2A)))+ Box(Modifier.size(48.dp).clip(androidx.compose.foundation.shape.CircleShape).background(tone(0xFF242424)))+ Box(Modifier.padding(start = 12.dp).width(150.dp).height(14.dp).clip(RoundedCornerShape(4.dp)).background(tone(0xFF2A2A2A)))}- } else SkeletonRows(Color(0xFF242424), Color(0xFF2A2A2A), count)+ } else SkeletonRows(tone(0xFF242424), tone(0xFF2A2A2A), count)}}@@ -310,6 +314,14 @@ fun MiniPlayer(navController: NavHostController) {maxLines = 1, overflow = androidx.compose.ui.text.style.TextOverflow.Ellipsis,modifier = Modifier.weight(1f, fill = false),)+ // The extension the sound comes from, discreet, as the output's name.+ playingExtensionName()?.let { name ->+ Text(+ text = " · $name", color = Color.White.copy(alpha = 0.55f), fontSize = 11.sp,+ maxLines = 1, overflow = androidx.compose.ui.text.style.TextOverflow.Ellipsis,+ modifier = Modifier.widthIn(max = 110.dp),+ )+ }if (routeLabel != null) {Icon(imageVector = if (route.kind == AudioRoute.Kind.BLUETOOTH) Icons.Filled.BluetoothAudio else Icons.Filled.Headphones,@@ -358,7 +370,7 @@ fun MiniPlayer(navController: NavHostController) {contentDescription = stringResource(R.string.mr_user_route_category_name),)Spacer(modifier = Modifier.width(20.dp))- if (!com.music.spotui.di.LocalPlayer.active.value) com.music.spotui.ui.screens.AddButton(song = { com.music.spotui.ui.screens.nowPlayingSong(vm) }, liked = liked, size = 24.dp) { vm.updateLikeState(true) }+ if (SongPlayer.canLike) com.music.spotui.ui.screens.AddButton(song = { com.music.spotui.ui.screens.nowPlayingSong(vm) }, liked = liked, size = 24.dp) { vm.updateLikeState(true) }Spacer(modifier = Modifier.width(20.dp))com.music.spotui.ui.components.PlayPauseIcon(playing = songPlayingState,@@ -434,13 +446,13 @@ fun Snackbar(showMessage : String) {.fillMaxWidth().height(48.dp).clip(RoundedCornerShape(4.dp))- .background(Color.White),+ .background(AppText),contentAlignment = Alignment.Center){Text(fontWeight = FontWeight.W500,fontSize = 14.sp,- color = Color.Black,+ color = com.music.spotui.ui.theme.AppBackground,text = showMessage)}diff --git a/base/app/src/main/java/com/music/spotui/ui/components/ArtistChooser.kt b/base/app/src/main/java/com/music/spotui/ui/components/ArtistChooser.ktindex 9b395bc5..44eda722 100644--- a/base/app/src/main/java/com/music/spotui/ui/components/ArtistChooser.kt+++ b/base/app/src/main/java/com/music/spotui/ui/components/ArtistChooser.kt@@ -1,5 +1,8 @@package com.music.spotui.ui.components+import com.music.spotui.ui.theme.tone+import com.music.spotui.ui.theme.AppText+import androidx.compose.foundation.backgroundimport androidx.compose.foundation.clickableimport androidx.compose.foundation.layout.Box@@ -95,9 +98,9 @@ fun ArtistChooserHost(navController: NavHostController) {val artists = ArtistChooser.artistsif (artists.isEmpty()) returnval dismiss = { ArtistChooser.artists = emptyList() }- ModalBottomSheet(onDismissRequest = dismiss, containerColor = Color(0xFF282828)) {+ ModalBottomSheet(onDismissRequest = dismiss, containerColor = tone(0xFF282828)) {Column(Modifier.navigationBarsPadding().padding(bottom = 12.dp)) {- Text(stringResource(R.string.choose_artist), color = Color.White, fontSize = 18.sp, fontWeight = FontWeight.Bold,+ Text(stringResource(R.string.choose_artist), color = AppText, fontSize = 18.sp, fontWeight = FontWeight.Bold,modifier = Modifier.padding(20.dp, 0.dp, 20.dp, 12.dp))artists.forEach { a ->// The picture comes in after the name: the sheet opens at once.@@ -113,11 +116,11 @@ fun ArtistChooserHost(navController: NavHostController) {go(ArtistChooser.routeOf(a))}.padding(horizontal = 20.dp, vertical = 8.dp),) {- Box(Modifier.size(48.dp).clip(CircleShape).background(Color(0xFF3E3E3E))) {+ Box(Modifier.size(48.dp).clip(CircleShape).background(tone(0xFF3E3E3E))) {if (picture != null) GlideImage(model = picture, contentDescription = null, contentScale = ContentScale.Crop, modifier = Modifier.size(48.dp))}Spacer(Modifier.width(14.dp))- Text(a.name, color = Color.White, fontSize = 16.sp, maxLines = 1, overflow = TextOverflow.Ellipsis)+ Text(a.name, color = AppText, fontSize = 16.sp, maxLines = 1, overflow = TextOverflow.Ellipsis)}}}diff --git a/base/app/src/main/java/com/music/spotui/ui/components/ArtistOptionsSheet.kt b/base/app/src/main/java/com/music/spotui/ui/components/ArtistOptionsSheet.ktindex 435b0728..e3969d55 100644--- a/base/app/src/main/java/com/music/spotui/ui/components/ArtistOptionsSheet.kt+++ b/base/app/src/main/java/com/music/spotui/ui/components/ArtistOptionsSheet.kt@@ -1,5 +1,9 @@package com.music.spotui.ui.components+import com.music.spotui.ui.theme.tone+import com.music.spotui.ui.theme.AppText+import com.music.spotui.ui.theme.AppMuted+import android.content.Intentimport android.widget.Toastimport androidx.compose.foundation.clickable@@ -57,14 +61,14 @@ fun ArtistOptionsSheet(artistId: String, artistName: String, artistImage: Stringapp.myspoti.host.android.MyspotiRuntime.api.extras.isArtistBanned(listOf(uri)).single()}.getOrNull()}- ModalBottomSheet(onDismissRequest = onDismiss, sheetState = sheetState, containerColor = Color(0xFF282828)) {+ ModalBottomSheet(onDismissRequest = onDismiss, sheetState = sheetState, containerColor = tone(0xFF282828)) {Column(Modifier.navigationBarsPadding().verticalScroll(rememberScrollState())) {Text(- artistName, color = Color.White, fontSize = 18.sp, fontWeight = FontWeight.Bold,+ artistName, color = AppText, fontSize = 18.sp, fontWeight = FontWeight.Bold,maxLines = 1, overflow = TextOverflow.Ellipsis,modifier = Modifier.fillMaxWidth().padding(horizontal = 20.dp, vertical = 12.dp),)- HorizontalDivider(color = Color(0xFF3E3E3E), thickness = 0.5.dp)+ HorizontalDivider(color = tone(0xFF3E3E3E), thickness = 0.5.dp)Spacer(Modifier.height(8.dp))ArtistMenuRow(Icons.Default.Share, stringResource(R.string.share_link), enabled = artistId.isNotBlank()) {SpotifyCode.show(ShareTarget("spotify:artist:$artistId", artistName, coverUri = artistImage))@@ -88,6 +92,7 @@ fun ArtistOptionsSheet(artistId: String, artistName: String, artistImage: Stringcom.music.spotui.di.Haptics.confirm()onDismiss()}+ com.music.spotui.extensions.ExtensionMenuEntries(app.myspoti.extensions.Surface.ARTIST_MENU, if (artistId.isBlank()) "" else uri, artistName, onDone = onDismiss)Spacer(Modifier.height(12.dp))}}@@ -96,7 +101,7 @@ fun ArtistOptionsSheet(artistId: String, artistName: String, artistImage: String/** One row of the artist menu, laid out like the track menu's rows. */@Composableprivate fun ArtistMenuRow(icon: ImageVector, label: String, enabled: Boolean = true, onClick: () -> Unit) {- val tint = if (enabled) Color.White else Color(0xFF6A6A6A)+ val tint = if (enabled) AppText else Color(0xFF6A6A6A)Row(verticalAlignment = Alignment.CenterVertically,modifier = Modifier@@ -104,7 +109,7 @@ private fun ArtistMenuRow(icon: ImageVector, label: String, enabled: Boolean = t.clickable(enabled = enabled) { onClick() }.padding(horizontal = 20.dp, vertical = 14.dp),) {- Icon(icon, contentDescription = null, tint = if (enabled) Color(0xFFB3B3B3) else Color(0xFF6A6A6A), modifier = Modifier.size(22.dp))+ Icon(icon, contentDescription = null, tint = if (enabled) AppMuted else Color(0xFF6A6A6A), modifier = Modifier.size(22.dp))Text(label, color = tint, fontSize = 15.sp, modifier = Modifier.padding(start = 16.dp))}}diff --git a/base/app/src/main/java/com/music/spotui/ui/components/BetaLogButton.kt b/base/app/src/main/java/com/music/spotui/ui/components/BetaLogButton.ktindex dae0331e..013b26fe 100644--- a/base/app/src/main/java/com/music/spotui/ui/components/BetaLogButton.kt+++ b/base/app/src/main/java/com/music/spotui/ui/components/BetaLogButton.kt@@ -1,5 +1,9 @@package com.music.spotui.ui.components+import com.music.spotui.ui.theme.tone+import com.music.spotui.ui.theme.AppText+import com.music.spotui.ui.theme.AppMuted+import android.content.ClipDataimport android.content.ClipboardManagerimport android.content.Context@@ -88,7 +92,7 @@ fun BetaLogButton(modifier: Modifier = Modifier) {) {val g = grow.valueBugIcon(- color = androidx.compose.ui.graphics.lerp(Color(0xFFB3B3B3), Color(0xFF1DB954), g),+ color = androidx.compose.ui.graphics.lerp(AppMuted, Color(0xFF1DB954), g),modifier = Modifier.size((16 + 12 * g).dp),)}@@ -125,15 +129,16 @@ private const val HOLD_MS = 900@Composableprivate fun LogsDialog(onDismiss: () -> Unit) {+ com.music.spotui.extensions.ProtectedSurfaceEffect(app.myspoti.extensions.ProtectedSurface.REPORT)val context = LocalContext.currentvar text by remember { mutableStateOf<String?>(null) }LaunchedEffect(Unit) { text = BetaLogs.recent() }Dialog(onDismissRequest = onDismiss, properties = DialogProperties(usePlatformDefaultWidth = false)) {- Column(Modifier.fillMaxSize().background(Color(0xFF121212)).statusBarsPadding().navigationBarsPadding()) {+ Column(Modifier.fillMaxSize().background(tone(0xFF121212)).statusBarsPadding().navigationBarsPadding()) {Row(Modifier.fillMaxWidth().padding(horizontal = 8.dp), verticalAlignment = Alignment.CenterVertically) {- Text(stringResource(R.string.beta_logs_title, BetaLogs.MINUTES), color = Color.White, fontSize = 17.sp,+ Text(stringResource(R.string.beta_logs_title, BetaLogs.MINUTES), color = AppText, fontSize = 17.sp,modifier = Modifier.weight(1f).padding(start = 8.dp))- TextButton(onClick = onDismiss) { Text(stringResource(R.string.beta_logs_close), color = Color(0xFFB3B3B3)) }+ TextButton(onClick = onDismiss) { Text(stringResource(R.string.beta_logs_close), color = AppMuted) }}Box(Modifier.weight(1f).fillMaxWidth().padding(horizontal = 8.dp)) {val logs = text@@ -148,7 +153,7 @@ private fun LogsDialog(onDismiss: () -> Unit) {}Row(Modifier.fillMaxWidth().padding(8.dp), horizontalArrangement = Arrangement.spacedBy(8.dp, Alignment.End)) {TextButton(onClick = { text?.let { share(context, it) } }, enabled = text != null) {- Text(stringResource(R.string.beta_logs_share), color = Color.White)+ Text(stringResource(R.string.beta_logs_share), color = AppText)}TextButton(onClick = { text?.let { copy(context, it) } }, enabled = text != null,modifier = Modifier.background(Color(0xFF1DB954), RoundedCornerShape(20.dp))) {diff --git a/base/app/src/main/java/com/music/spotui/ui/components/BlendPanel.kt b/base/app/src/main/java/com/music/spotui/ui/components/BlendPanel.ktindex ddd77cae..dab96e9c 100644--- a/base/app/src/main/java/com/music/spotui/ui/components/BlendPanel.kt+++ b/base/app/src/main/java/com/music/spotui/ui/components/BlendPanel.kt@@ -1,5 +1,9 @@package com.music.spotui.ui.components+import com.music.spotui.ui.theme.tone+import com.music.spotui.ui.theme.AppText+import com.music.spotui.ui.theme.AppMuted+import android.content.Intentimport androidx.compose.animation.AnimatedVisibilityimport androidx.compose.animation.expandVertically@@ -95,22 +99,22 @@ private fun CompactLine(info: BlendInfo, onClick: () -> Unit) {// Overlapping faces, as Spotify shows a Blend's members.Box(Modifier.width((28 + 18 * (members.size.coerceAtMost(4) - 1).coerceAtLeast(0)).dp).height(28.dp)) {members.take(4).forEachIndexed { n, m ->- Box(Modifier.padding(start = (18 * n).dp).size(28.dp).clip(CircleShape).background(Color(0xFF121212)).padding(1.5.dp)) {+ Box(Modifier.padding(start = (18 * n).dp).size(28.dp).clip(CircleShape).background(tone(0xFF121212)).padding(1.5.dp)) {ProfileAvatar(m.imageUrl, m.name, 25.dp)}}}Column(Modifier.weight(1f).padding(start = 10.dp, end = 8.dp)) {- Text(info.story?.title ?: info.group?.title ?: stringResource(R.string.blend_title), color = Color.White, fontSize = 14.sp,+ Text(info.story?.title ?: info.group?.title ?: stringResource(R.string.blend_title), color = AppText, fontSize = 14.sp,fontWeight = FontWeight.Bold, maxLines = 1, overflow = TextOverflow.Ellipsis)- if (members.isNotEmpty()) Text(members.joinToString(", ") { it.name }, color = Color(0xFFB3B3B3), fontSize = 12.sp,+ if (members.isNotEmpty()) Text(members.joinToString(", ") { it.name }, color = AppMuted, fontSize = 12.sp,maxLines = 1, overflow = TextOverflow.Ellipsis)}info.group?.link?.let { link ->Box(contentAlignment = Alignment.Center,- modifier = Modifier.size(36.dp).clip(CircleShape).background(Color(0xFF2A2A2A)).clickable { BlendInfo.share(context, link) },- ) { Icon(Icons.Filled.Add, contentDescription = stringResource(R.string.blend_invite_more), tint = Color.White, modifier = Modifier.size(20.dp)) }+ modifier = Modifier.size(36.dp).clip(CircleShape).background(tone(0xFF2A2A2A)).clickable { BlendInfo.share(context, link) },+ ) { Icon(Icons.Filled.Add, contentDescription = stringResource(R.string.blend_invite_more), tint = AppText, modifier = Modifier.size(20.dp)) }}}}@@ -148,9 +152,9 @@ private fun color(hex: String?, fallback: Color): Color =@OptIn(ExperimentalGlideComposeApi::class)@Composableprivate fun StoryCard(story: BlendStory) {- val background = color(story.background, Color(0xFF2A2A2A))- val title = color(story.titleColor, Color.White)- val text = color(story.textColor, Color(0xFFB3B3B3))+ val background = color(story.background, tone(0xFF2A2A2A))+ val title = color(story.titleColor, AppText)+ val text = color(story.textColor, AppMuted)Row(verticalAlignment = Alignment.CenterVertically,modifier = Modifier@@ -180,14 +184,14 @@ private fun Members(group: BlendGroup) {val context = LocalContext.currentText(group.title ?: stringResource(R.string.blend_members),- color = Color.White, fontSize = 16.sp, fontWeight = FontWeight.Bold,+ color = AppText, fontSize = 16.sp, fontWeight = FontWeight.Bold,modifier = Modifier.padding(start = 16.dp, end = 16.dp, top = 18.dp, bottom = 10.dp),)LazyRow(contentPadding = PaddingValues(horizontal = 16.dp), horizontalArrangement = Arrangement.spacedBy(16.dp)) {items(group.members, key = { it.username }) { m ->Column(horizontalAlignment = Alignment.CenterHorizontally, modifier = Modifier.width(72.dp)) {ProfileAvatar(m.imageUrl, m.name, 64.dp)- Text(m.name, color = Color.White, fontSize = 12.sp, maxLines = 1, overflow = TextOverflow.Ellipsis,+ Text(m.name, color = AppText, fontSize = 12.sp, maxLines = 1, overflow = TextOverflow.Ellipsis,textAlign = TextAlign.Center, modifier = Modifier.padding(top = 6.dp))}}@@ -197,10 +201,10 @@ private fun Members(group: BlendGroup) {horizontalAlignment = Alignment.CenterHorizontally,modifier = Modifier.width(72.dp).clip(RoundedCornerShape(8.dp)).clickable { BlendInfo.share(context, link) },) {- Box(contentAlignment = Alignment.Center, modifier = Modifier.size(64.dp).clip(CircleShape).background(Color(0xFF2A2A2A))) {- Icon(Icons.Filled.Add, contentDescription = null, tint = Color.White, modifier = Modifier.size(28.dp))+ Box(contentAlignment = Alignment.Center, modifier = Modifier.size(64.dp).clip(CircleShape).background(tone(0xFF2A2A2A))) {+ Icon(Icons.Filled.Add, contentDescription = null, tint = AppText, modifier = Modifier.size(28.dp))}- Text(group.inviteLabel ?: stringResource(R.string.blend_invite_more), color = Color(0xFFB3B3B3), fontSize = 12.sp,+ Text(group.inviteLabel ?: stringResource(R.string.blend_invite_more), color = AppMuted, fontSize = 12.sp,maxLines = 2, textAlign = TextAlign.Center, lineHeight = 14.sp, modifier = Modifier.padding(top = 6.dp))}}diff --git a/base/app/src/main/java/com/music/spotui/ui/components/DownloadBadge.kt b/base/app/src/main/java/com/music/spotui/ui/components/DownloadBadge.ktindex f802a246..a9c6f9e1 100644--- a/base/app/src/main/java/com/music/spotui/ui/components/DownloadBadge.kt+++ b/base/app/src/main/java/com/music/spotui/ui/components/DownloadBadge.kt@@ -1,5 +1,7 @@package com.music.spotui.ui.components+import com.music.spotui.ui.theme.AppText+import androidx.compose.foundation.backgroundimport androidx.compose.foundation.layout.Boximport androidx.compose.foundation.layout.size@@ -38,10 +40,10 @@ fun DownloadBadge(status: OfflineStatus?, size: Dp = 16.dp, modifier: Modifier =}OfflineStatus.Queued -> Icon(Icons.Outlined.ArrowCircleDown,stringResource(R.string.download_badge_downloading_content_description),- tint = Color.White.copy(alpha = 0.5f), modifier = modifier.size(size))+ tint = AppText.copy(alpha = 0.5f), modifier = modifier.size(size))is OfflineStatus.Downloading -> Box(contentAlignment = Alignment.Center, modifier = modifier.size(size)) {if (status.progress < 0f) CircularProgressIndicator(color = Green, strokeWidth = 2.dp, modifier = Modifier.size(size))- else CircularProgressIndicator(progress = { status.progress }, color = Green, trackColor = Color.White.copy(alpha = 0.2f),+ else CircularProgressIndicator(progress = { status.progress }, color = Green, trackColor = AppText.copy(alpha = 0.2f),strokeWidth = 2.dp, modifier = Modifier.size(size))}OfflineStatus.Failed, OfflineStatus.Unavailable -> Icon(Icons.Outlined.ErrorOutline,@@ -61,10 +63,10 @@ fun DownloadListButton(downloaded: Int, total: Int, busy: Boolean, kept: BooleanBox(contentAlignment = Alignment.Center, modifier = modifier.size(28.dp).pressable(0.92f, onClick = onClick)) {when {all -> Icon(Icons.Outlined.DeleteOutline, stringResource(R.string.context_menu_undownload),- tint = Color.White.copy(alpha = 0.8f), modifier = Modifier.size(28.dp))+ tint = AppText.copy(alpha = 0.8f), modifier = Modifier.size(28.dp))busy -> DownloadBadge(OfflineStatus.Downloading(if (total > 0) downloaded.toFloat() / total else -1f), size = 24.dp)else -> Icon(Icons.Outlined.ArrowCircleDown, stringResource(R.string.context_menu_download),- tint = Color.White.copy(alpha = 0.8f), modifier = Modifier.size(28.dp))+ tint = AppText.copy(alpha = 0.8f), modifier = Modifier.size(28.dp))}}}diff --git a/base/app/src/main/java/com/music/spotui/ui/components/EpisodeSheets.kt b/base/app/src/main/java/com/music/spotui/ui/components/EpisodeSheets.ktindex 185868fa..f80fc312 100644--- a/base/app/src/main/java/com/music/spotui/ui/components/EpisodeSheets.kt+++ b/base/app/src/main/java/com/music/spotui/ui/components/EpisodeSheets.kt@@ -1,5 +1,8 @@package com.music.spotui.ui.components+import com.music.spotui.ui.theme.tone+import com.music.spotui.ui.theme.AppText+import android.content.Contextimport android.content.Intentimport android.widget.Toast@@ -60,7 +63,7 @@ import com.music.spotui.data.offline.episodeKeyOfimport com.music.spotui.di.SongPlayerprivate val Accent: Color get() = com.music.spotui.ui.theme.AppAccent-private val Sheet: Color get() = Color(0xFF1F1F1F)+private val Sheet: Color get() = tone(0xFF1F1F1F)/** "episode:<id>" — an episode has no track id; the downloader and the library key on this. */val SongsModel.episodeKey: String? get() = episodeKeyOf(this)@@ -91,7 +94,7 @@ fun EpisodeDownloadButton(song: SongsModel, size: Dp = 26.dp) {},) {when (status) {- null -> Icon(Icons.Outlined.Download, stringResource(R.string.episode_download), tint = Color.White.copy(alpha = 0.85f), modifier = Modifier.size(size))+ null -> Icon(Icons.Outlined.Download, stringResource(R.string.episode_download), tint = AppText.copy(alpha = 0.85f), modifier = Modifier.size(size))else -> DownloadBadge(status, size = size)}}@@ -126,8 +129,8 @@ fun EpisodeOptionsSheet(modifier = Modifier.size(52.dp).clip(RoundedCornerShape(4.dp)),)Column(Modifier.weight(1f).padding(start = 12.dp)) {- Text(song.title, color = Color.White, fontSize = 15.sp, fontWeight = FontWeight.Bold, maxLines = 2, overflow = TextOverflow.Ellipsis)- Text(song.singer, color = Color.White.copy(alpha = 0.65f), fontSize = 12.sp, maxLines = 1, overflow = TextOverflow.Ellipsis)+ Text(song.title, color = AppText, fontSize = 15.sp, fontWeight = FontWeight.Bold, maxLines = 2, overflow = TextOverflow.Ellipsis)+ Text(song.singer, color = AppText.copy(alpha = 0.65f), fontSize = 12.sp, maxLines = 1, overflow = TextOverflow.Ellipsis)}}SheetAction(Icons.Outlined.Share, stringResource(R.string.a11y_share)) {@@ -193,9 +196,9 @@ private fun SheetAction(icon: ImageVector, label: String, onClick: () -> Unit) {verticalAlignment = Alignment.CenterVertically,modifier = Modifier.fillMaxWidth().clickable(onClick = onClick).padding(horizontal = 20.dp, vertical = 14.dp),) {- Icon(icon, contentDescription = null, tint = Color.White.copy(alpha = 0.9f), modifier = Modifier.size(22.dp))+ Icon(icon, contentDescription = null, tint = AppText.copy(alpha = 0.9f), modifier = Modifier.size(22.dp))Spacer(Modifier.width(16.dp))- Text(label, color = Color.White, fontSize = 15.sp)+ Text(label, color = AppText, fontSize = 15.sp)}}@@ -247,7 +250,7 @@ fun PodcastSpeedSheet(onDismiss: () -> Unit) {Column(Modifier.fillMaxWidth().navigationBarsPadding().padding(bottom = 20.dp)) {Text(stringResource(R.string.playback_speed),- color = Color.White, fontSize = 20.sp, fontWeight = FontWeight.Bold,+ color = AppText, fontSize = 20.sp, fontWeight = FontWeight.Bold,modifier = Modifier.padding(horizontal = 20.dp, vertical = 8.dp),)Text(@@ -269,7 +272,7 @@ fun PodcastSpeedSheet(onDismiss: () -> Unit) {.weight(1f).height(44.dp).clip(CircleShape)- .background(if (selected) Color.White else Color.White.copy(alpha = 0.12f))+ .background(if (selected) AppText else AppText.copy(alpha = 0.12f)).clickable {SongPlayer.setSpeed(speed)onDismiss()@@ -277,7 +280,7 @@ fun PodcastSpeedSheet(onDismiss: () -> Unit) {) {Text(text = speedLabel(speed),- color = if (selected) Color.Black else Color.White,+ color = if (selected) Color.Black else AppText,fontSize = 15.sp,fontWeight = FontWeight.Bold,)diff --git a/base/app/src/main/java/com/music/spotui/ui/components/ErrorRetry.kt b/base/app/src/main/java/com/music/spotui/ui/components/ErrorRetry.ktindex 013d3927..6a45152e 100644--- a/base/app/src/main/java/com/music/spotui/ui/components/ErrorRetry.kt+++ b/base/app/src/main/java/com/music/spotui/ui/components/ErrorRetry.kt@@ -1,5 +1,7 @@package com.music.spotui.ui.components+import com.music.spotui.ui.theme.AppText+import androidx.compose.foundation.backgroundimport androidx.compose.foundation.layout.Columnimport androidx.compose.foundation.layout.Spacer@@ -24,10 +26,10 @@ import app.myspoti.engine.R@Composablefun ErrorRetry(message: String, modifier: Modifier = Modifier, onRetry: () -> Unit) {Column(modifier.fillMaxWidth().padding(24.dp, 40.dp), horizontalAlignment = Alignment.CenterHorizontally) {- Text(message, color = Color.White, fontSize = 15.sp, textAlign = TextAlign.Center)+ Text(message, color = AppText, fontSize = 15.sp, textAlign = TextAlign.Center)Spacer(Modifier.height(14.dp))- Text(stringResource(R.string.retry_button), color = Color.Black, fontSize = 14.sp, fontWeight = FontWeight.Bold,- modifier = Modifier.clip(RoundedCornerShape(50)).background(Color.White)+ Text(stringResource(R.string.retry_button), color = com.music.spotui.ui.theme.AppBackground, fontSize = 14.sp, fontWeight = FontWeight.Bold,+ modifier = Modifier.clip(RoundedCornerShape(50)).background(AppText).pressable(0.96f) { onRetry() }.padding(horizontal = 22.dp, vertical = 10.dp))}}diff --git a/base/app/src/main/java/com/music/spotui/ui/components/FastScrollbar.kt b/base/app/src/main/java/com/music/spotui/ui/components/FastScrollbar.ktindex 87c7c32d..3704ca07 100644--- a/base/app/src/main/java/com/music/spotui/ui/components/FastScrollbar.kt+++ b/base/app/src/main/java/com/music/spotui/ui/components/FastScrollbar.kt@@ -1,5 +1,7 @@package com.music.spotui.ui.components+import com.music.spotui.ui.theme.AppText+import androidx.compose.foundation.backgroundimport androidx.compose.foundation.gestures.detectVerticalDragGesturesimport androidx.compose.foundation.layout.Box@@ -60,7 +62,7 @@ fun FastScrollbar(state: LazyListState, modifier: Modifier = Modifier, minItems:.offset { IntOffset(0, (fraction * travel).roundToInt()) }.padding(end = 3.dp).size(width = 5.dp, height = 56.dp)- .background(Color.White.copy(alpha = if (dragging) 0.8f else 0.5f), RoundedCornerShape(50))+ .background(AppText.copy(alpha = if (dragging) 0.8f else 0.5f), RoundedCornerShape(50)))// A wider invisible strip so the thin thumb is easy to grab.Box(diff --git a/base/app/src/main/java/com/music/spotui/ui/components/FindInList.kt b/base/app/src/main/java/com/music/spotui/ui/components/FindInList.ktindex 3fb0c0a6..2f3d850e 100644--- a/base/app/src/main/java/com/music/spotui/ui/components/FindInList.kt+++ b/base/app/src/main/java/com/music/spotui/ui/components/FindInList.kt@@ -1,5 +1,8 @@package com.music.spotui.ui.components+import com.music.spotui.ui.theme.AppText+import com.music.spotui.ui.theme.AppMuted+import androidx.compose.foundation.backgroundimport androidx.compose.foundation.layout.Boximport androidx.compose.foundation.layout.Row@@ -61,24 +64,24 @@ fun FindInListField(query: String, onQuery: (String) -> Unit, hint: String, modiverticalAlignment = Alignment.CenterVertically,modifier = modifier.fillMaxWidth().clip(RoundedCornerShape(8.dp)).background(Color(0x33FFFFFF)).padding(horizontal = 12.dp),) {- Icon(Icons.Default.Search, contentDescription = null, tint = Color.White, modifier = Modifier.size(18.dp))+ Icon(Icons.Default.Search, contentDescription = null, tint = AppText, modifier = Modifier.size(18.dp))BasicTextField(value = query,onValueChange = onQuery,singleLine = true,- textStyle = TextStyle(color = Color.White, fontSize = 15.sp),- cursorBrush = SolidColor(Color.White),+ textStyle = TextStyle(color = AppText, fontSize = 15.sp),+ cursorBrush = SolidColor(AppText),keyboardOptions = KeyboardOptions(imeAction = ImeAction.Search),modifier = Modifier.weight(1f).padding(8.dp, 10.dp),decorationBox = { inner ->Box {- if (query.isEmpty()) Text(hint, color = Color(0xFFB3B3B3), fontSize = 15.sp, maxLines = 1, overflow = androidx.compose.ui.text.style.TextOverflow.Ellipsis)+ if (query.isEmpty()) Text(hint, color = AppMuted, fontSize = 15.sp, maxLines = 1, overflow = androidx.compose.ui.text.style.TextOverflow.Ellipsis)inner()}},)if (query.isNotEmpty()) Icon(- Icons.Default.Close, contentDescription = null, tint = Color(0xFFB3B3B3),+ Icons.Default.Close, contentDescription = null, tint = AppMuted,modifier = Modifier.size(18.dp).pressable(0.92f) { onQuery("") },)}@@ -87,5 +90,5 @@ fun FindInListField(query: String, onQuery: (String) -> Unit, hint: String, modi/** "Couldn't find …" under a "Find in…" field with no match. */@Composablefun FindInListEmpty(text: String) {- Text(text, color = Color(0xFFB3B3B3), fontSize = 14.sp, modifier = Modifier.fillMaxWidth().padding(16.dp, 24.dp))+ Text(text, color = AppMuted, fontSize = 14.sp, modifier = Modifier.fillMaxWidth().padding(16.dp, 24.dp))}diff --git a/base/app/src/main/java/com/music/spotui/ui/components/FitText.kt b/base/app/src/main/java/com/music/spotui/ui/components/FitText.ktindex db235fc1..0c02d79c 100644--- a/base/app/src/main/java/com/music/spotui/ui/components/FitText.kt+++ b/base/app/src/main/java/com/music/spotui/ui/components/FitText.kt@@ -1,5 +1,7 @@package com.music.spotui.ui.components+import com.music.spotui.ui.theme.AppText+import androidx.compose.material3.Textimport androidx.compose.runtime.Composableimport androidx.compose.runtime.getValue@@ -24,7 +26,7 @@ import androidx.compose.ui.unit.spfun FitText(text: String,modifier: Modifier = Modifier,- color: Color = Color.White,+ color: Color = AppText,fontSize: TextUnit,minSize: TextUnit = 14.sp,fontWeight: FontWeight? = null,diff --git a/base/app/src/main/java/com/music/spotui/ui/components/MusicVideo.kt b/base/app/src/main/java/com/music/spotui/ui/components/MusicVideo.ktindex c5c9ea6e..2185b703 100644--- a/base/app/src/main/java/com/music/spotui/ui/components/MusicVideo.kt+++ b/base/app/src/main/java/com/music/spotui/ui/components/MusicVideo.kt@@ -75,13 +75,15 @@ import kotlinx.coroutines.delay* the rest of the UI. Only the [active] surface receives the frames.*/@Composable-fun VideoSurface(modifier: Modifier = Modifier, active: Boolean = true, fitHeight: Boolean = false, onTap: (() -> Unit)? = null) {+fun VideoSurface(modifier: Modifier = Modifier, active: Boolean = true, fitHeight: Boolean = false, pip: Boolean = false, onTap: (() -> Unit)? = null) {val ratio = MusicVideoController.aspect.floatValue.coerceIn(0.4f, 3f)var view by remember { mutableStateOf<android.view.TextureView?>(null) }val player = MusicVideoController.player- DisposableEffect(player, view, active) {+ // In the picture-in-picture window only its own surface shows the clip; outside it, never that one.+ val mine = pip == MusicVideoController.inPip.value+ DisposableEffect(player, view, active, mine) {val v = view- val attached = player != null && v != null && active+ val attached = player != null && v != null && active && mineif (attached) { player!!.setVideoTextureView(v); MusicVideoController.surfaces++ }onDispose {if (attached) MusicVideoController.surfaces--@@ -301,3 +303,11 @@ private fun RoundIcon(icon: Int, description: String, sizeDp: Int, flip: Boolean)}}++/** What the picture-in-picture window shows: the clip alone, centred on black. */+@Composable+fun PipVideo() {+ Box(Modifier.fillMaxSize().background(Color.Black), contentAlignment = Alignment.Center) {+ VideoSurface(fitHeight = true, pip = true)+ }+}diff --git a/base/app/src/main/java/com/music/spotui/ui/components/PlayerSheets.kt b/base/app/src/main/java/com/music/spotui/ui/components/PlayerSheets.ktindex ad9ac4e0..4d960f6f 100644--- a/base/app/src/main/java/com/music/spotui/ui/components/PlayerSheets.kt+++ b/base/app/src/main/java/com/music/spotui/ui/components/PlayerSheets.kt@@ -1,5 +1,9 @@package com.music.spotui.ui.components+import com.music.spotui.ui.theme.tone+import com.music.spotui.ui.theme.AppText+import com.music.spotui.ui.theme.AppMuted+import androidx.compose.ui.res.stringResourceimport app.myspoti.engine.R@@ -92,7 +96,7 @@ import com.music.spotui.di.SongPlayerimport com.music.spotui.ui.screens.ExplicitBadgeprivate val Green: Color get() = com.music.spotui.ui.theme.AppAccent-private val SheetColor = Color(0xFF282828)+private val SheetColor: androidx.compose.ui.graphics.Color get() = tone(0xFF282828)/*** Name of the output playing now: the Connect device, else the headphones this phone@@ -122,6 +126,31 @@ fun activeDeviceIcon(): ImageVector {}}+/**+ * Where the sound comes from while Myspoti's own player plays a song (an extension's stream: its+ * name and the quality it announced; a download), shown under the output device; "" when Spotify+ * plays (a song it plays for want of the extensions included) or while a song is being asked for.+ */+@Composable+fun playingSourceLabel(): String {+ val uri = SongPlayer.nowPlaying.value.uri+ val answers = com.music.spotui.extensions.ExtensionAudio.answers.intValue+ val downloaded = stringResource(R.string.player_source_downloaded)+ if (!com.music.spotui.di.LocalPlayer.active.value || SongPlayer.routing) return ""+ return remember(uri, answers, downloaded) {+ com.music.spotui.di.LocalPlayer.current()?.let { com.music.spotui.extensions.ExtensionAudio.sourceLabel(it, downloaded) }.orEmpty()+ }+}++/** The name of the extension streaming the song playing, for the mini player; null otherwise (see [playingSourceLabel]). */+@Composable+fun playingExtensionName(): String? {+ val uri = SongPlayer.nowPlaying.value.uri+ val answers = com.music.spotui.extensions.ExtensionAudio.answers.intValue+ if (!com.music.spotui.di.LocalPlayer.active.value || SongPlayer.routing) return null+ return remember(uri, answers) { com.music.spotui.di.LocalPlayer.current()?.let(com.music.spotui.extensions.ExtensionAudio::streamedBy) }+}+private fun deviceIcon(type: String): ImageVector = when (type.uppercase()) {"SMARTPHONE", "TABLET" -> Icons.Default.Smartphone"SPEAKER", "AVR", "STB", "AUDIO_DONGLE" -> Icons.Default.Speaker@@ -146,18 +175,18 @@ fun DevicesSheet(onDismiss: () -> Unit) {Column(modifier = Modifier.fillMaxWidth().navigationBarsPadding().padding(bottom = 16.dp)) {Text(stringResource(R.string.listen_on),- color = Color.White, fontSize = 22.sp, fontWeight = FontWeight.Bold,+ color = AppText, fontSize = 22.sp, fontWeight = FontWeight.Bold,modifier = Modifier.padding(horizontal = 20.dp, vertical = 8.dp),)// The output playing now, the song, and its quality (tap: what plays, and change it).Row(verticalAlignment = Alignment.CenterVertically,modifier = Modifier.fillMaxWidth().padding(horizontal = 12.dp, vertical = 4.dp)- .clip(RoundedCornerShape(16.dp)).background(Color(0xFF333333)).padding(16.dp),+ .clip(RoundedCornerShape(16.dp)).background(tone(0xFF333333)).padding(16.dp),) {Column(Modifier.weight(1f)) {Row(verticalAlignment = Alignment.CenterVertically) {- Text(activeDeviceLabel(), color = Color.White, fontSize = 20.sp, fontWeight = FontWeight.Bold,+ Text(activeDeviceLabel(), color = AppText, fontSize = 20.sp, fontWeight = FontWeight.Bold,maxLines = 1, overflow = TextOverflow.Ellipsis, modifier = Modifier.weight(1f, fill = false))if (remote == null) Text(stringResource(streamingLabel(com.music.spotui.data.preferences.getStreamingQuality(context, com.music.spotui.data.DataSaver.metered))),@@ -209,14 +238,14 @@ fun DevicesSheet(onDismiss: () -> Unit) {DeviceRow(deviceIcon(d.type), d.name, null) { SongPlayer.transferTo(d); onDismiss() }}if (list.none { !it.isSelf } && !headphones && remote == null)- Text(stringResource(R.string.no_devices), color = Color.White.copy(alpha = 0.7f), modifier = Modifier.padding(20.dp))+ Text(stringResource(R.string.no_devices), color = AppText.copy(alpha = 0.7f), modifier = Modifier.padding(20.dp))}JamSection(onDismiss)// Bluetooth: pair or pick headphones and speakers in the system settings.Column(horizontalAlignment = Alignment.CenterHorizontally,modifier = Modifier.fillMaxWidth().padding(horizontal = 20.dp, vertical = 8.dp)- .clip(RoundedCornerShape(12.dp)).background(Color(0xFF333333))+ .clip(RoundedCornerShape(12.dp)).background(tone(0xFF333333)).clickable { AudioRoute.openBluetooth(context) }.padding(14.dp),) {Icon(Icons.Default.Bluetooth, null, tint = Green, modifier = Modifier.size(26.dp))@@ -232,11 +261,11 @@ private fun DeviceRow(icon: ImageVector, name: String, detail: String?, current:verticalAlignment = Alignment.CenterVertically,modifier = Modifier.fillMaxWidth().clickable(onClick = onClick).padding(horizontal = 20.dp, vertical = 14.dp),) {- Icon(icon, contentDescription = null, tint = if (current) Green else Color.White, modifier = Modifier.size(28.dp))+ Icon(icon, contentDescription = null, tint = if (current) Green else AppText, modifier = Modifier.size(28.dp))Spacer(Modifier.width(16.dp))Column {- Text(name, color = if (current) Green else Color.White, fontSize = 16.sp, fontWeight = FontWeight.Medium)- if (detail != null) Text(detail, color = Color(0xFFB3B3B3), fontSize = 13.sp)+ Text(name, color = if (current) Green else AppText, fontSize = 16.sp, fontWeight = FontWeight.Medium)+ if (detail != null) Text(detail, color = AppMuted, fontSize = 13.sp)}}}@@ -248,16 +277,20 @@ private fun streamingLabel(q: com.music.spotui.data.preferences.StreamingQualitycom.music.spotui.data.preferences.StreamingQuality.HIGH -> R.string.quality_streaming_high}-/** The sound quality page: what plays now (codec and bitrate, or the downloaded file), and the setting. */+/** The sound quality page: what plays now (codec and bitrate, the downloaded file, or what an extension announced), and the setting. */@OptIn(ExperimentalMaterial3Api::class)@Composable-private fun QualitySheet(onDismiss: () -> Unit) {+fun QualitySheet(onDismiss: () -> Unit) {val local = com.music.spotui.di.LocalPlayer.active.valueval now by androidx.compose.runtime.produceState<String?>(null) {value = if (local) {val t = com.music.spotui.di.LocalPlayer.current()val file = t?.let { com.music.spotui.data.offline.OfflineStore.byLocalId(it.id) }- file?.let { "${it.file.substringAfterLast('.').uppercase()} · ${it.source}" } ?: ""+ file?.let { "${it.file.substringAfterLast('.').uppercase()} · ${it.source}" }+ // A stream an extension gives: the quality it announced, as it said it.+ ?: t?.uri?.takeIf { it.scheme == com.music.spotui.extensions.ExtensionAudio.SCHEME }+ ?.let { com.music.spotui.extensions.ExtensionAudio.qualityOf(it.lastPathSegment.orEmpty()) }+ ?: ""} else {val (bitrate, mime) = app.myspoti.host.android.MyspotiRuntime.spotify.player.audioInfo()if (bitrate <= 0) "" else "${codecName(mime)} · ${bitrate / 1000} kbit/s"@@ -265,7 +298,7 @@ private fun QualitySheet(onDismiss: () -> Unit) {}ModalBottomSheet(onDismissRequest = onDismiss, containerColor = SheetColor) {Column(Modifier.fillMaxWidth().navigationBarsPadding().padding(bottom = 16.dp)) {- Text(stringResource(R.string.quality_sheet_title), color = Color.White, fontSize = 20.sp, fontWeight = FontWeight.Bold,+ Text(stringResource(R.string.quality_sheet_title), color = AppText, fontSize = 20.sp, fontWeight = FontWeight.Bold,modifier = Modifier.padding(horizontal = 20.dp, vertical = 8.dp))val text = nowText(@@ -304,11 +337,11 @@ private fun JamSection(onDismiss: () -> Unit) {}fun failed() = android.widget.Toast.makeText(context, context.getString(R.string.jam_failed), android.widget.Toast.LENGTH_SHORT).show()Column(Modifier.fillMaxWidth().padding(horizontal = 20.dp, vertical = 12.dp)) {- Text(stringResource(R.string.jam_title), color = Color.White, fontSize = 18.sp, fontWeight = FontWeight.Bold)+ Text(stringResource(R.string.jam_title), color = AppText, fontSize = 18.sp, fontWeight = FontWeight.Bold)val s = sessionif (s != null) {Text(stringResource(R.string.jam_members, s.members.size), color = Green, fontSize = 13.sp, modifier = Modifier.padding(top = 4.dp))- Text(stringResource(R.string.jam_invite), color = Color.White, fontSize = 15.sp,+ Text(stringResource(R.string.jam_invite), color = AppText, fontSize = 15.sp,modifier = Modifier.fillMaxWidth().clickable {scope.launch {val url = runCatching { jam.inviteLink() }.getOrNull() ?: return@launch failed()@@ -316,7 +349,7 @@ private fun JamSection(onDismiss: () -> Unit) {context.startActivity(android.content.Intent.createChooser(send, null).addFlags(android.content.Intent.FLAG_ACTIVITY_NEW_TASK))}}.padding(vertical = 10.dp))- Text(stringResource(R.string.jam_leave), color = Color.White, fontSize = 15.sp,+ Text(stringResource(R.string.jam_leave), color = AppText, fontSize = 15.sp,modifier = Modifier.fillMaxWidth().clickable {scope.launch { runCatching { if (s.isHost) jam.end() else jam.leave() }; onDismiss() }}.padding(vertical = 10.dp))@@ -387,7 +420,7 @@ fun SleepTimerSheet(onDismiss: () -> Unit) {Column(modifier = Modifier.fillMaxWidth().navigationBarsPadding().padding(bottom = 16.dp)) {Text(stringResource(R.string.context_menu_sleep_timer),- color = Color.White, fontSize = 20.sp, fontWeight = FontWeight.Bold,+ color = AppText, fontSize = 20.sp, fontWeight = FontWeight.Bold,modifier = Modifier.padding(horizontal = 20.dp, vertical = 8.dp),)val endOfTrack = stringResource(R.string.context_menu_sleep_timer_end_of_track)@@ -399,7 +432,7 @@ fun SleepTimerSheet(onDismiss: () -> Unit) {options.forEach { (label, minutes) ->Text(label,- color = Color.White, fontSize = 16.sp,+ color = AppText, fontSize = 16.sp,modifier = Modifier.fillMaxWidth().clickable { SongPlayer.setSleepTimer(minutes); onDismiss() }@@ -451,10 +484,10 @@ fun QueueSheet(contextName: String, onDismiss: () -> Unit) {Column(modifier = Modifier.fillMaxWidth().fillMaxHeight(0.92f).navigationBarsPadding()) {Row(verticalAlignment = Alignment.Top, modifier = Modifier.fillMaxWidth().padding(horizontal = 20.dp)) {Column(modifier = Modifier.weight(1f)) {- Text(stringResource(R.string.action_queue_label), color = Color.White, fontSize = 22.sp, fontWeight = FontWeight.Bold)+ Text(stringResource(R.string.action_queue_label), color = AppText, fontSize = 22.sp, fontWeight = FontWeight.Bold)if (contextName.isNotBlank()) Row(modifier = Modifier.padding(top = 4.dp)) {- Text(stringResource(R.string.playing_on), color = Color.White.copy(alpha = 0.7f), fontSize = 14.sp)- Text(contextName, color = Color.White, fontSize = 14.sp, maxLines = 1, overflow = TextOverflow.Ellipsis)+ Text(stringResource(R.string.playing_on), color = AppText.copy(alpha = 0.7f), fontSize = 14.sp)+ Text(contextName, color = AppText, fontSize = 14.sp, maxLines = 1, overflow = TextOverflow.Ellipsis)}Row(verticalAlignment = Alignment.CenterVertically, modifier = Modifier.padding(top = 4.dp, bottom = 8.dp)) {Icon(activeDeviceIcon(), contentDescription = null, tint = Green, modifier = Modifier.size(16.dp))@@ -473,13 +506,13 @@ fun QueueSheet(contextName: String, onDismiss: () -> Unit) {modifier = Modifier.size(36.dp).clip(CircleShape)- .background(Color.White)+ .background(AppText).clickable { if (playing) SongPlayer.pause() else SongPlayer.play() },) {Icon(if (playing) Icons.Default.Pause else Icons.Default.PlayArrow,contentDescription = if (playing) stringResource(R.string.content_description_pause_button) else stringResource(R.string.content_description_play_button),- tint = Color.Black, modifier = Modifier.size(22.dp),+ tint = com.music.spotui.ui.theme.AppBackground, modifier = Modifier.size(22.dp),)}}, onClick = {})@@ -512,10 +545,10 @@ private fun PillButton(label: String, onClick: () -> Unit) {contentAlignment = Alignment.Center,modifier = Modifier.clip(RoundedCornerShape(50))- .background(Color(0xFF3E3E3E))+ .background(tone(0xFF3E3E3E)).clickable(onClick = onClick).padding(horizontal = 18.dp, vertical = 8.dp),- ) { Text(label, color = Color.White, fontSize = 14.sp, fontWeight = FontWeight.Bold) }+ ) { Text(label, color = AppText, fontSize = 14.sp, fontWeight = FontWeight.Bold) }}private val QueueHeaderHeight = 48.dp@@ -758,7 +791,7 @@ private fun QueueList(}if (e.queuedSection) Text(stringResource(R.string.clear_queue),- color = Color.White, fontSize = 13.sp, fontWeight = FontWeight.Bold,+ color = AppText, fontSize = 13.sp, fontWeight = FontWeight.Bold,modifier = Modifier.padding(end = 20.dp).clickable {@@ -774,7 +807,7 @@ private fun QueueList(modifier = Modifier.graphicsLayer { translationY = if (isDragged) dragOffset else 0f }.zIndex(if (isDragged) 1f else 0f)- .background(if (isDragged) Color(0xFF3A3A3A) else SheetColor)+ .background(if (isDragged) tone(0xFF3A3A3A) else SheetColor)) {SwipeLeftToRemove(enabled = !editing && dragging == null, onRemove = {if (e.queued) queued = queued - item else nextUp = nextUp - item@@ -784,7 +817,7 @@ private fun QueueList(if (editing) Icon(Icons.Default.RemoveCircleOutline,contentDescription = stringResource(R.string.aligned_curation_first_save_default_row_remove_action_description),- tint = Color.White.copy(alpha = 0.8f),+ tint = AppText.copy(alpha = 0.8f),modifier = Modifier.padding(end = 12.dp).size(24.dp)@@ -797,7 +830,7 @@ private fun QueueList(Icon(Icons.Default.DragHandle,contentDescription = stringResource(R.string.edit_playlist_items_move_chip),- tint = Color.White.copy(alpha = 0.8f),+ tint = AppText.copy(alpha = 0.8f),modifier = Modifier.size(28.dp).pointerInput(item.uid + item.uri) {@@ -847,7 +880,7 @@ private fun SwipeLeftToRemove(enabled: Boolean, onRemove: () -> Unit, content: @contentAlignment = Alignment.CenterEnd,modifier = Modifier.matchParentSize().background(if (armed) Color(0xFFE22134) else Color(0xFF7A1F1F)),) {- Icon(Icons.Default.Delete, contentDescription = stringResource(R.string.aligned_curation_first_save_default_row_remove_action_description), tint = Color.White, modifier = Modifier.padding(end = 24.dp).size(24.dp))+ Icon(Icons.Default.Delete, contentDescription = stringResource(R.string.aligned_curation_first_save_default_row_remove_action_description), tint = AppText, modifier = Modifier.padding(end = 24.dp).size(24.dp))}Box(modifier = Modifier@@ -879,7 +912,7 @@ private fun SwipeLeftToRemove(enabled: Boolean, onRemove: () -> Unit, content: @@Composableprivate fun SheetHeader(text: String) {Text(- text, color = Color.White, fontSize = 15.sp, fontWeight = FontWeight.Bold,+ text, color = AppText, fontSize = 15.sp, fontWeight = FontWeight.Bold,modifier = Modifier.padding(horizontal = 20.dp),)}@@ -933,7 +966,7 @@ private fun QueueSheetRow(Spacer(Modifier.width(4.dp))}Text(- song.title, color = if (current) Green else Color.White, fontSize = 16.sp,+ song.title, color = if (current) Green else AppText, fontSize = 16.sp,maxLines = 1, overflow = TextOverflow.Ellipsis,)}@@ -941,13 +974,13 @@ private fun QueueSheetRow(// Mixed in by smart shuffle: marked, as in the official app, not taken for one of the playlist's songs.if (rec) { Icon(Icons.Outlined.AutoAwesome, contentDescription = stringResource(R.string.smart_shuffle_recommended), tint = Green, modifier = Modifier.size(14.dp)); Spacer(Modifier.width(4.dp)) }if (song.explicit) { ExplicitBadge(); Spacer(Modifier.width(6.dp)) }- Text(song.singer, color = Color.White.copy(alpha = 0.7f), fontSize = 14.sp, maxLines = 1, overflow = TextOverflow.Ellipsis)+ Text(song.singer, color = AppText.copy(alpha = 0.7f), fontSize = 14.sp, maxLines = 1, overflow = TextOverflow.Ellipsis)}}if (rec) Icon(Icons.Outlined.AddCircleOutline,contentDescription = stringResource(R.string.smart_shuffle_add),- tint = Color.White,+ tint = AppText,modifier = Modifier.padding(end = 12.dp).size(26.dp).clip(CircleShape).clickable { com.music.spotui.ui.screens.SmartShuffle.keep(context, song) },)trailing()@@ -960,12 +993,12 @@ private fun QueueAction(icon: ImageVector, label: String, active: Boolean, modifhorizontalAlignment = Alignment.CenterHorizontally,modifier = modifier.clip(RoundedCornerShape(8.dp))- .background(Color(0xFF3E3E3E))+ .background(tone(0xFF3E3E3E)).clickable(onClick = onClick).padding(vertical = 10.dp),) {- Icon(icon, contentDescription = null, tint = if (active) Green else Color.White, modifier = Modifier.size(26.dp))+ Icon(icon, contentDescription = null, tint = if (active) Green else AppText, modifier = Modifier.size(26.dp))Spacer(Modifier.height(4.dp))- Text(label, color = if (active) Green else Color.White, fontSize = 13.sp, maxLines = 1, overflow = androidx.compose.ui.text.style.TextOverflow.Ellipsis)+ Text(label, color = if (active) Green else AppText, fontSize = 13.sp, maxLines = 1, overflow = androidx.compose.ui.text.style.TextOverflow.Ellipsis)}}diff --git a/base/app/src/main/java/com/music/spotui/ui/components/PlaylistOptionsSheet.kt b/base/app/src/main/java/com/music/spotui/ui/components/PlaylistOptionsSheet.ktindex 65be0a4c..789e3897 100644--- a/base/app/src/main/java/com/music/spotui/ui/components/PlaylistOptionsSheet.kt+++ b/base/app/src/main/java/com/music/spotui/ui/components/PlaylistOptionsSheet.kt@@ -1,5 +1,9 @@package com.music.spotui.ui.components+import com.music.spotui.ui.theme.tone+import com.music.spotui.ui.theme.AppText+import com.music.spotui.ui.theme.AppMuted+import android.content.Contextimport android.graphics.Bitmapimport android.net.Uri@@ -113,6 +117,8 @@ fun PlaylistOptionsSheet(var renamingBlend by remember { mutableStateOf(false) }var leavingBlend by remember { mutableStateOf(false) }var leavingPlaylist by remember { mutableStateOf(false) }+ var stoppingCollab by remember { mutableStateOf(false) }+ var mergingInto by remember { mutableStateOf(false) }LaunchedEffect(page.uri, mine) {if (mine) {access = runCatching { MyspotiRuntime.api.playlists.access(page.uri) }.getOrNull()@@ -141,7 +147,7 @@ fun PlaylistOptionsSheet(com.music.spotui.data.api.SpotifySync.setPlaylistPublished(page.uri, on) { ok -> if (!ok) restore() }}- ModalBottomSheet(onDismissRequest = onDismiss, containerColor = Color(0xFF282828)) {+ ModalBottomSheet(onDismissRequest = onDismiss, containerColor = tone(0xFF282828)) {Column(Modifier.navigationBarsPadding().padding(bottom = 12.dp)) {// As the official app: the playlist itself on top (cover, name, owner), then one action a row.Row(verticalAlignment = Alignment.CenterVertically, modifier = Modifier.fillMaxWidth().padding(20.dp, 0.dp, 20.dp, 12.dp)) {@@ -150,14 +156,16 @@ fun PlaylistOptionsSheet(modifier = Modifier.size(52.dp).clip(androidx.compose.foundation.shape.RoundedCornerShape(4.dp)),)Column(Modifier.weight(1f).padding(start = 12.dp)) {- Text(page.name, color = Color.White, fontSize = 16.sp, fontWeight = FontWeight.Bold, maxLines = 1, overflow = TextOverflow.Ellipsis)- if (page.ownerName.isNotBlank()) Text(stringResource(R.string.playlist_by, page.ownerName), color = Color(0xFFB3B3B3), fontSize = 13.sp,+ Text(page.name, color = AppText, fontSize = 16.sp, fontWeight = FontWeight.Bold, maxLines = 1, overflow = TextOverflow.Ellipsis)+ if (page.ownerName.isNotBlank()) Text(stringResource(R.string.playlist_by, page.ownerName), color = AppMuted, fontSize = 13.sp,maxLines = 1, overflow = TextOverflow.Ellipsis)}}- androidx.compose.material3.HorizontalDivider(color = Color.White.copy(alpha = 0.08f))+ androidx.compose.material3.HorizontalDivider(color = AppText.copy(alpha = 0.08f))Spacer(Modifier.height(6.dp))val share = { SpotifyCode.show(ShareTarget(page.uri, page.name, page.ownerName, page.coverUri)); onDismiss() }+ // Every song of this playlist into another one of yours (Web Player: "Add playlist to other playlist").+ if (page.uri.startsWith("spotify:playlist:")) OptionRow(Icons.Outlined.AddCircleOutline, stringResource(R.string.add_playlist_to_playlist)) { mergingInto = true }if (page.isBlend) {// A Blend is Spotify's: renamed, shared and left through its own service.OptionRow(Icons.Outlined.Edit, stringResource(R.string.blend_rename)) { renamingBlend = true }@@ -196,7 +204,7 @@ fun PlaylistOptionsSheet(when (a) {null -> OptionRow(Icons.Outlined.Lock, stringResource(R.string.playlist_access_title), enabled = false) {}PlaylistAccess.PRIVATE -> OptionRow(Icons.Outlined.Public, stringResource(R.string.playlist_make_public)) { change(PlaylistAccess.PUBLIC, R.string.playlist_now_public) }- PlaylistAccess.COLLABORATIVE -> OptionRow(Icons.Outlined.GroupRemove, stringResource(R.string.playlist_stop_collab)) { change(PlaylistAccess.PUBLIC, R.string.playlist_now_solo) }+ PlaylistAccess.COLLABORATIVE -> OptionRow(Icons.Outlined.GroupRemove, stringResource(R.string.playlist_stop_collab)) { stoppingCollab = true }else -> OptionRow(Icons.Outlined.Lock, stringResource(R.string.playlist_make_private)) { change(PlaylistAccess.PRIVATE, R.string.playlist_now_private) }}// Only a playlist others may see can be listed on the profile.@@ -219,9 +227,16 @@ fun PlaylistOptionsSheet(onDismiss(); onProfile(page.ownerUri.substringAfterLast(':'))}}+ // Entries from extensions (menu.items), after the app's own.+ com.music.spotui.extensions.ExtensionMenuEntries(+ if (page.type == "album") app.myspoti.extensions.Surface.ALBUM_MENU else app.myspoti.extensions.Surface.PLAYLIST_MENU,+ page.uri, page.name, page.ownerName, onDone = onDismiss,+ )}}+ if (mergingInto) AddCollectionToPlaylistSheet(page.uri, stringResource(R.string.add_playlist_to_playlist)) { mergingInto = false; onDismiss() }+if (editing) EditDetailsDialog(page, onDismiss = { editing = false }) { name, description, cover ->editing = false// Name and description show at once, in the page and in the library; the cover needs the page again.@@ -256,9 +271,9 @@ fun PlaylistOptionsSheet(if (leavingBlend) AlertDialog(onDismissRequest = { leavingBlend = false },- containerColor = Color(0xFF282828),- title = { Text(stringResource(R.string.blend_leave), color = Color.White) },- text = { Text(stringResource(R.string.blend_leave_confirm, page.name), color = Color(0xFFB3B3B3)) },+ containerColor = tone(0xFF282828),+ title = { Text(stringResource(R.string.blend_leave), color = AppText) },+ text = { Text(stringResource(R.string.blend_leave_confirm, page.name), color = AppMuted) },confirmButton = {TextButton(onClick = {leavingBlend = false@@ -269,14 +284,35 @@ fun PlaylistOptionsSheet(onDismiss(); onDeleted()}) { Text(stringResource(R.string.blend_leave_button), color = Color(0xFFF15E6C)) }},- dismissButton = { TextButton(onClick = { leavingBlend = false }) { Text(stringResource(R.string.cancel), color = Color.White) } },+ dismissButton = { TextButton(onClick = { leavingBlend = false }) { Text(stringResource(R.string.cancel), color = AppText) } },)+ if (stoppingCollab) {+ // Public (listed on the profile): collaborators are removed; private: they become listeners.+ val public = published == true+ AlertDialog(+ onDismissRequest = { stoppingCollab = false },+ containerColor = tone(0xFF282828),+ title = { Text(stringResource(R.string.playlist_stop_collab), color = AppText) },+ text = { Text(stringResource(if (public) R.string.playlist_stop_collab_public else R.string.playlist_stop_collab_private, page.name), color = AppMuted) },+ confirmButton = {+ TextButton(onClick = {+ stoppingCollab = false+ access = if (public) PlaylistAccess.PUBLIC else PlaylistAccess.PRIVATE+ android.widget.Toast.makeText(context, R.string.playlist_now_solo, android.widget.Toast.LENGTH_SHORT).show()+ // Written in order with the other visibility taps; a refusal puts back what Spotify has.+ com.music.spotui.data.api.SpotifySync.stopPlaylistCollaboration(page.uri) { ok -> if (ok) onChanged() else restore() }+ }) { Text(stringResource(R.string.playlist_stop_collab), color = Color(0xFFF15E6C)) }+ },+ dismissButton = { TextButton(onClick = { stoppingCollab = false }) { Text(stringResource(R.string.cancel), color = AppText) } },+ )+ }+if (leavingPlaylist) AlertDialog(onDismissRequest = { leavingPlaylist = false },- containerColor = Color(0xFF282828),- title = { Text(stringResource(R.string.playlist_leave), color = Color.White) },- text = { Text(stringResource(R.string.playlist_leave_confirm, page.name), color = Color(0xFFB3B3B3)) },+ containerColor = tone(0xFF282828),+ title = { Text(stringResource(R.string.playlist_leave), color = AppText) },+ text = { Text(stringResource(R.string.playlist_leave_confirm, page.name), color = AppMuted) },confirmButton = {TextButton(onClick = {leavingPlaylist = false@@ -287,13 +323,13 @@ fun PlaylistOptionsSheet(onDismiss(); onDeleted()}) { Text(stringResource(R.string.playlist_leave_button), color = Color(0xFFF15E6C)) }},- dismissButton = { TextButton(onClick = { leavingPlaylist = false }) { Text(stringResource(R.string.cancel), color = Color.White) } },+ dismissButton = { TextButton(onClick = { leavingPlaylist = false }) { Text(stringResource(R.string.cancel), color = AppText) } },)if (deleting) AlertDialog(onDismissRequest = { deleting = false },- containerColor = Color(0xFF282828),- text = { Text(stringResource(R.string.playlist_delete_confirm, page.name), color = Color.White) },+ containerColor = tone(0xFF282828),+ text = { Text(stringResource(R.string.playlist_delete_confirm, page.name), color = AppText) },confirmButton = {TextButton(onClick = {deleting = false@@ -303,7 +339,7 @@ fun PlaylistOptionsSheet(onDismiss(); onDeleted()}) { Text(stringResource(R.string.actions_picker_delete), color = Color(0xFFF15E6C)) }},- dismissButton = { TextButton(onClick = { deleting = false }) { Text(stringResource(R.string.cancel), color = Color.White) } },+ dismissButton = { TextButton(onClick = { deleting = false }) { Text(stringResource(R.string.cancel), color = AppText) } },)}@@ -328,19 +364,19 @@ private fun EditDetailsDialog(page: ContextPageModel, onDismiss: () -> Unit, onS}}val fieldColors = OutlinedTextFieldDefaults.colors(- focusedTextColor = Color.White, unfocusedTextColor = Color.White, cursorColor = AppAccent,+ focusedTextColor = AppText, unfocusedTextColor = AppText, cursorColor = AppAccent,focusedBorderColor = AppAccent, unfocusedBorderColor = Color(0xFF555555),- focusedLabelColor = AppAccent, unfocusedLabelColor = Color(0xFFB3B3B3),+ focusedLabelColor = AppAccent, unfocusedLabelColor = AppMuted,)AlertDialog(onDismissRequest = onDismiss,- containerColor = Color(0xFF282828),- title = { Text(stringResource(R.string.playlist_edit_details), color = Color.White) },+ containerColor = tone(0xFF282828),+ title = { Text(stringResource(R.string.playlist_edit_details), color = AppText) },text = {Column {Row(verticalAlignment = Alignment.CenterVertically) {val c = cover- Box(Modifier.size(96.dp).clip(RoundedCornerShape(4.dp)).background(Color(0xFF3A3A3A))+ Box(Modifier.size(96.dp).clip(RoundedCornerShape(4.dp)).background(tone(0xFF3A3A3A)).clickable { picker.launch(PickVisualMediaRequest(ActivityResultContracts.PickVisualMedia.ImageOnly)) }) {when (c) {is CoverChange.New -> Image(c.preview.asImageBitmap(), null, contentScale = ContentScale.Crop, modifier = Modifier.size(96.dp))@@ -352,10 +388,10 @@ private fun EditDetailsDialog(page: ContextPageModel, onDismiss: () -> Unit, onSSpacer(Modifier.width(12.dp))Column {TextButton(onClick = { picker.launch(PickVisualMediaRequest(ActivityResultContracts.PickVisualMedia.ImageOnly)) }) {- Text(stringResource(R.string.playlist_change_cover), color = Color.White)+ Text(stringResource(R.string.playlist_change_cover), color = AppText)}TextButton(onClick = { cover = CoverChange.Remove }) {- Text(stringResource(R.string.playlist_remove_cover), color = Color(0xFFB3B3B3))+ Text(stringResource(R.string.playlist_remove_cover), color = AppMuted)}}}@@ -372,7 +408,7 @@ private fun EditDetailsDialog(page: ContextPageModel, onDismiss: () -> Unit, onSText(stringResource(R.string.playlist_save), color = AppAccent, fontWeight = FontWeight.Bold)}},- dismissButton = { TextButton(onClick = onDismiss) { Text(stringResource(R.string.cancel), color = Color.White) } },+ dismissButton = { TextButton(onClick = onDismiss) { Text(stringResource(R.string.cancel), color = AppText) } },)}@@ -393,15 +429,15 @@ private fun coverJpeg(context: Context, uri: Uri): Pair<ByteArray, Bitmap> {}@Composable-private fun OptionRow(icon: ImageVector, label: String, enabled: Boolean = true, onClick: () -> Unit) {+internal fun OptionRow(icon: ImageVector, label: String, enabled: Boolean = true, onClick: () -> Unit) {Row(verticalAlignment = Alignment.CenterVertically,modifier = Modifier.fillMaxWidth().clickable(enabled = enabled, onClick = onClick).padding(horizontal = 20.dp, vertical = 14.dp).then(if (enabled) Modifier else Modifier.alpha(0.4f)),) {- Icon(icon, null, tint = Color.White, modifier = Modifier.size(24.dp))+ Icon(icon, null, tint = AppText, modifier = Modifier.size(24.dp))Spacer(Modifier.width(16.dp))- Text(label, color = Color.White, fontSize = 16.sp)+ Text(label, color = AppText, fontSize = 16.sp)}}diff --git a/base/app/src/main/java/com/music/spotui/ui/components/ProfileAvatar.kt b/base/app/src/main/java/com/music/spotui/ui/components/ProfileAvatar.ktindex 8ca0b9f1..1a81540d 100644--- a/base/app/src/main/java/com/music/spotui/ui/components/ProfileAvatar.kt+++ b/base/app/src/main/java/com/music/spotui/ui/components/ProfileAvatar.kt@@ -1,5 +1,7 @@package com.music.spotui.ui.components+import com.music.spotui.ui.theme.AppText+import androidx.compose.foundation.backgroundimport androidx.compose.foundation.layout.Boximport androidx.compose.foundation.layout.size@@ -46,7 +48,7 @@ fun ProfileAvatar(url: String?, name: String?, size: Dp, modifier: Modifier = Moval letter = label.firstOrNull()?.uppercaseChar()val color = Color(AVATAR_COLORS[(label.hashCode() and Int.MAX_VALUE) % AVATAR_COLORS.size])Box(modifier.size(size).clip(CircleShape).background(color), contentAlignment = Alignment.Center) {- if (letter != null) Text(letter.toString(), color = Color.White, fontSize = (size.value * 0.42f).sp, fontWeight = FontWeight.Bold)- else Icon(Icons.Filled.Person, contentDescription = null, tint = Color.White, modifier = Modifier.size(size * 0.55f))+ if (letter != null) Text(letter.toString(), color = AppText, fontSize = (size.value * 0.42f).sp, fontWeight = FontWeight.Bold)+ else Icon(Icons.Filled.Person, contentDescription = null, tint = AppText, modifier = Modifier.size(size * 0.55f))}}diff --git a/base/app/src/main/java/com/music/spotui/ui/components/QualityPickers.kt b/base/app/src/main/java/com/music/spotui/ui/components/QualityPickers.ktindex a216f2a5..13c1212f 100644--- a/base/app/src/main/java/com/music/spotui/ui/components/QualityPickers.kt+++ b/base/app/src/main/java/com/music/spotui/ui/components/QualityPickers.kt@@ -1,5 +1,9 @@package com.music.spotui.ui.components+import com.music.spotui.ui.theme.tone+import com.music.spotui.ui.theme.AppText+import com.music.spotui.ui.theme.AppMuted+import androidx.compose.foundation.layout.Columnimport androidx.compose.foundation.layout.Rowimport androidx.compose.foundation.layout.fillMaxWidth@@ -81,9 +85,9 @@ private fun <T> QualityGroup(onSelect: (T) -> Unit, modifier: Modifier = Modifier,) {Column(modifier.fillMaxWidth().selectableGroup()) {- Text(title, color = Color.White, fontSize = 17.sp, fontWeight = FontWeight.Bold,+ Text(title, color = AppText, fontSize = 17.sp, fontWeight = FontWeight.Bold,modifier = Modifier.padding(horizontal = 20.dp, vertical = 4.dp))- Text(detail, color = Color(0xFFB3B3B3), fontSize = 13.sp,+ Text(detail, color = AppMuted, fontSize = 13.sp,modifier = Modifier.padding(start = 20.dp, end = 20.dp, bottom = 4.dp))for (o in options) {val on = o.value == selected@@ -94,10 +98,10 @@ private fun <T> QualityGroup(.padding(horizontal = 8.dp, vertical = 4.dp),) {RadioButton(selected = on, onClick = null, modifier = Modifier.padding(horizontal = 8.dp),- colors = RadioButtonDefaults.colors(selectedColor = Color(0xFF1DB954), unselectedColor = Color(0xFFB3B3B3)))+ colors = RadioButtonDefaults.colors(selectedColor = Color(0xFF1DB954), unselectedColor = AppMuted))Column(Modifier.weight(1f).padding(end = 12.dp)) {- Text(stringResource(o.label), color = if (on) Color(0xFF1DB954) else Color.White, fontSize = 16.sp)- Text(stringResource(o.detail), color = Color(0xFFB3B3B3), fontSize = 12.sp)+ Text(stringResource(o.label), color = if (on) Color(0xFF1DB954) else AppText, fontSize = 16.sp)+ Text(stringResource(o.detail), color = AppMuted, fontSize = 12.sp)}}}@@ -128,8 +132,8 @@ fun DownloadAskHost() {)androidx.compose.material3.AlertDialog(onDismissRequest = { DownloadAsk.pending = null },- containerColor = Color(0xFF282828),- title = { Text(stringResource(R.string.quality_download_title), color = Color.White) },+ containerColor = tone(0xFF282828),+ title = { Text(stringResource(R.string.quality_download_title), color = AppText) },text = {Column {for (o in choices) {@@ -141,8 +145,8 @@ fun DownloadAskHost() {}).padding(vertical = 8.dp),) {- Text(stringResource(o.label), color = Color.White, fontSize = 16.sp)- Text(stringResource(o.detail), color = Color(0xFFB3B3B3), fontSize = 12.sp)+ Text(stringResource(o.label), color = AppText, fontSize = 16.sp)+ Text(stringResource(o.detail), color = AppMuted, fontSize = 12.sp)}}}@@ -150,7 +154,7 @@ fun DownloadAskHost() {confirmButton = {},dismissButton = {androidx.compose.material3.TextButton(onClick = { DownloadAsk.pending = null }) {- Text(stringResource(R.string.add_to_playlist_button_cancel), color = Color.White)+ Text(stringResource(R.string.add_to_playlist_button_cancel), color = AppText)}},)diff --git a/base/app/src/main/java/com/music/spotui/ui/components/SavedInSheet.kt b/base/app/src/main/java/com/music/spotui/ui/components/SavedInSheet.ktindex c0cb5940..1fdb9e8e 100644--- a/base/app/src/main/java/com/music/spotui/ui/components/SavedInSheet.kt+++ b/base/app/src/main/java/com/music/spotui/ui/components/SavedInSheet.kt@@ -1,5 +1,9 @@package com.music.spotui.ui.components+import com.music.spotui.ui.theme.tone+import com.music.spotui.ui.theme.AppText+import com.music.spotui.ui.theme.AppMuted+import androidx.compose.ui.res.stringResourceimport android.content.Context@@ -112,7 +116,7 @@ fun SavedInSheet(ModalBottomSheet(onDismissRequest = onDismiss,sheetState = sheetState,- containerColor = Color(0xFF1A1A1A),+ containerColor = tone(0xFF1A1A1A),) {Column(modifier = Modifier.navigationBarsPadding().imePadding()) {Row(@@ -124,10 +128,10 @@ fun SavedInSheet() {Row(verticalAlignment = Alignment.CenterVertically, modifier = Modifier.weight(1f, fill = false)) {if (folder != null) Icon(- Icons.AutoMirrored.Filled.ArrowBack, contentDescription = null, tint = Color.White,+ Icons.AutoMirrored.Filled.ArrowBack, contentDescription = null, tint = AppText,modifier = Modifier.padding(end = 12.dp).size(24.dp).clickable { folders.removeAt(folders.lastIndex) },)- Text(folder?.second ?: stringResource(R.string.add_to_playlist_saved_in_section_header), color = Color.White,+ Text(folder?.second ?: stringResource(R.string.add_to_playlist_saved_in_section_header), color = AppText,fontSize = 20.sp, fontWeight = FontWeight.Bold, maxLines = 1, overflow = TextOverflow.Ellipsis)}Text(@@ -151,10 +155,10 @@ fun SavedInSheet(keyboardOptions = KeyboardOptions(imeAction = ImeAction.Done),keyboardActions = KeyboardActions(onDone = { createNow() }),colors = TextFieldDefaults.colors(- focusedContainerColor = Color(0xFF2A2A2A),- unfocusedContainerColor = Color(0xFF2A2A2A),- focusedTextColor = Color.White,- unfocusedTextColor = Color.White,+ focusedContainerColor = tone(0xFF2A2A2A),+ unfocusedContainerColor = tone(0xFF2A2A2A),+ focusedTextColor = AppText,+ unfocusedTextColor = AppText,cursorColor = SpotifyGreen,focusedIndicatorColor = Color.Transparent,unfocusedIndicatorColor = Color.Transparent,@@ -203,7 +207,7 @@ fun SavedInSheet(Brush.linearGradient(listOf(Color(0xFF4A39EA), Color(0xFF868AE1)))),) {- Icon(Icons.Default.Favorite, contentDescription = null, tint = Color.White, modifier = Modifier.size(20.dp))+ Icon(Icons.Default.Favorite, contentDescription = null, tint = AppText, modifier = Modifier.size(20.dp))}},) {@@ -291,15 +295,15 @@ private fun FolderRow(name: String, subtitle: String, onOpen: () -> Unit) {) {Box(contentAlignment = Alignment.Center,- modifier = Modifier.size(48.dp).clip(RoundedCornerShape(4.dp)).background(Color(0xFF333333)),+ modifier = Modifier.size(48.dp).clip(RoundedCornerShape(4.dp)).background(tone(0xFF333333)),) {- Icon(Icons.Outlined.Folder, contentDescription = null, tint = Color(0xFFB3B3B3), modifier = Modifier.size(24.dp))+ Icon(Icons.Outlined.Folder, contentDescription = null, tint = AppMuted, modifier = Modifier.size(24.dp))}Column(Modifier.padding(start = 12.dp).weight(1f)) {- Text(name, color = Color.White, fontSize = 15.sp, maxLines = 1, overflow = TextOverflow.Ellipsis)- Text(subtitle, color = Color(0xFFB3B3B3), fontSize = 13.sp, maxLines = 1, overflow = androidx.compose.ui.text.style.TextOverflow.Ellipsis)+ Text(name, color = AppText, fontSize = 15.sp, maxLines = 1, overflow = TextOverflow.Ellipsis)+ Text(subtitle, color = AppMuted, fontSize = 13.sp, maxLines = 1, overflow = androidx.compose.ui.text.style.TextOverflow.Ellipsis)}- Icon(Icons.AutoMirrored.Filled.KeyboardArrowRight, contentDescription = null, tint = Color(0xFFB3B3B3))+ Icon(Icons.AutoMirrored.Filled.KeyboardArrowRight, contentDescription = null, tint = AppMuted)}}@@ -327,7 +331,7 @@ private fun SavedInRow(.weight(1f).padding(start = 14.dp, end = 8.dp),) {- Text(name, color = Color.White, fontSize = 15.sp, fontWeight = FontWeight.Medium, maxLines = 1, overflow = TextOverflow.Ellipsis)+ Text(name, color = AppText, fontSize = 15.sp, fontWeight = FontWeight.Medium, maxLines = 1, overflow = TextOverflow.Ellipsis)if (subtitle.isNotBlank()) {Text(subtitle, color = Color.Gray, fontSize = 13.sp, maxLines = 1, overflow = androidx.compose.ui.text.style.TextOverflow.Ellipsis)}@@ -335,7 +339,7 @@ private fun SavedInRow(if (saved) {Icon(Icons.Default.CheckCircle, contentDescription = stringResource(R.string.curation_button_saved_text), tint = SpotifyGreen, modifier = Modifier.size(26.dp))} else {- Icon(Icons.Default.Add, contentDescription = stringResource(R.string.add_to_playlist_new_playlist_button_text), tint = Color(0xFFB3B3B3), modifier = Modifier.size(26.dp))+ Icon(Icons.Default.Add, contentDescription = stringResource(R.string.add_to_playlist_new_playlist_button_text), tint = AppMuted, modifier = Modifier.size(26.dp))}}}diff --git a/base/app/src/main/java/com/music/spotui/ui/components/SongOptionsSheet.kt b/base/app/src/main/java/com/music/spotui/ui/components/SongOptionsSheet.ktindex 0464c9f2..10dac279 100644--- a/base/app/src/main/java/com/music/spotui/ui/components/SongOptionsSheet.kt+++ b/base/app/src/main/java/com/music/spotui/ui/components/SongOptionsSheet.kt@@ -1,5 +1,9 @@package com.music.spotui.ui.components+import com.music.spotui.ui.theme.tone+import com.music.spotui.ui.theme.AppText+import com.music.spotui.ui.theme.AppMuted+import app.myspoti.engine.Rimport androidx.compose.ui.res.stringResource@@ -70,8 +74,8 @@ import com.music.spotui.data.entity.SongsModelimport com.music.spotui.di.SongPlayerimport com.music.spotui.ui.navigation.albumRoute-private val MenuSheetColor = Color(0xFF282828)-private val MenuIconColor = Color(0xFFB3B3B3)+private val MenuSheetColor: androidx.compose.ui.graphics.Color get() = tone(0xFF282828)+private val MenuIconColor: androidx.compose.ui.graphics.Color get() = AppMutedprivate val MenuGreen: Color get() = com.music.spotui.ui.theme.AppAccent/**@@ -150,11 +154,11 @@ fun SongOptionsSheet()Spacer(modifier = Modifier.width(12.dp))Column {- Text(song.title, color = Color.White, fontSize = 16.sp, fontWeight = FontWeight.Bold, maxLines = 1, overflow = TextOverflow.Ellipsis)+ Text(song.title, color = AppText, fontSize = 16.sp, fontWeight = FontWeight.Bold, maxLines = 1, overflow = TextOverflow.Ellipsis)Text(song.singer, color = MenuIconColor, fontSize = 14.sp, maxLines = 1, overflow = TextOverflow.Ellipsis)}}- HorizontalDivider(color = Color(0xFF3E3E3E), thickness = 0.5.dp)+ HorizontalDivider(color = tone(0xFF3E3E3E), thickness = 0.5.dp)Spacer(Modifier.height(8.dp))MenuRow(@@ -315,6 +319,10 @@ fun SongOptionsSheet(tint = if (active) MenuGreen else MenuIconColor,) { showSleep = true }}+ // Entries from extensions (menu.items), after the app's own; each names its extension.+ if (hasId) com.music.spotui.extensions.ExtensionMenuEntries(+ app.myspoti.extensions.Surface.TRACK_MENU, "spotify:track:${song.spotifyTrackId}", song.title, song.singer, onDone = onDismiss,+ )Spacer(Modifier.height(12.dp))}}@@ -355,7 +363,7 @@ private fun MenuRow(}}Spacer(modifier = Modifier.width(16.dp))- Text(label, color = Color.White.copy(alpha = alpha), fontSize = 16.sp, maxLines = 1, overflow = TextOverflow.Ellipsis)+ Text(label, color = AppText.copy(alpha = alpha), fontSize = 16.sp, maxLines = 1, overflow = TextOverflow.Ellipsis)}}@@ -368,19 +376,29 @@ private fun CreditsSheet(song: SongsModel, onDismiss: () -> Unit) {value = runCatching { app.myspoti.host.android.MyspotiRuntime.api.extras.credits("spotify:track:${song.spotifyTrackId}") }.getOrDefault(app.myspoti.api.Credits(emptyList()))}- ModalBottomSheet(onDismissRequest = onDismiss, containerColor = Color(0xFF282828), sheetState = rememberModalBottomSheetState(skipPartiallyExpanded = true)) {- Column(Modifier.fillMaxWidth().padding(bottom = 24.dp)) {- Text(stringResource(R.string.track_credits), color = Color.White, fontSize = 20.sp, fontWeight = androidx.compose.ui.text.font.FontWeight.Bold,+ ModalBottomSheet(onDismissRequest = onDismiss, containerColor = tone(0xFF282828), sheetState = rememberModalBottomSheetState(skipPartiallyExpanded = true)) {+ Column(Modifier.fillMaxWidth().verticalScroll(rememberScrollState()).padding(bottom = 24.dp)) {+ Text(stringResource(R.string.track_credits), color = AppText, fontSize = 20.sp, fontWeight = androidx.compose.ui.text.font.FontWeight.Bold,modifier = Modifier.padding(20.dp, 8.dp))- Text(song.title, color = Color(0xFFB3B3B3), fontSize = 14.sp, maxLines = 1, overflow = androidx.compose.ui.text.style.TextOverflow.Ellipsis, modifier = Modifier.padding(horizontal = 20.dp))+ Text(song.title, color = AppMuted, fontSize = 14.sp, maxLines = 1, overflow = androidx.compose.ui.text.style.TextOverflow.Ellipsis, modifier = Modifier.padding(horizontal = 20.dp))val roles = credits?.rolesif (roles == null) androidx.compose.material3.LinearProgressIndicator(Modifier.fillMaxWidth().padding(20.dp))else roles.forEach { role ->Column(Modifier.padding(20.dp, 10.dp)) {- Text(role.artists.joinToString(", ") { it.name }, color = Color.White, fontSize = 16.sp)- Text(role.role, color = Color(0xFFB3B3B3), fontSize = 13.sp)+ Text(role.artists.joinToString(", ") { it.name }, color = AppText, fontSize = 16.sp)+ Text(role.role, color = AppMuted, fontSize = 13.sp)}}+ // What extensions add about the song (trackinfo.provide), under Spotify's credits.+ if (song.spotifyTrackId.isNotBlank()) {+ val info = androidx.compose.runtime.remember(song.spotifyTrackId) {+ com.music.spotui.extensions.Extensions.trackInfo(song.spotifyTrackId, song.title, song.singer, song.album, song.durationMs.toLong(), song.coverUri)+ }+ com.music.spotui.extensions.ExtensionBlocks(+ app.myspoti.extensions.Hook.TRACK_INFO, app.myspoti.extensions.Surface.TRACK_INFO, info.toJson(),+ context = com.music.spotui.extensions.placeJson("track", info.uri, info.title, info.artist),+ )+ }}}}@@ -389,12 +407,12 @@ private fun CreditsSheet(song: SongsModel, onDismiss: () -> Unit) {@OptIn(androidx.compose.material3.ExperimentalMaterial3Api::class)@Composableprivate fun SpeedSheet(onDismiss: () -> Unit) {- ModalBottomSheet(onDismissRequest = onDismiss, containerColor = Color(0xFF282828)) {+ ModalBottomSheet(onDismissRequest = onDismiss, containerColor = tone(0xFF282828)) {Column(Modifier.fillMaxWidth().padding(bottom = 24.dp)) {- Text(stringResource(R.string.playback_speed), color = Color.White, fontSize = 20.sp, fontWeight = androidx.compose.ui.text.font.FontWeight.Bold,+ Text(stringResource(R.string.playback_speed), color = AppText, fontSize = 20.sp, fontWeight = androidx.compose.ui.text.font.FontWeight.Bold,modifier = Modifier.padding(20.dp, 8.dp))listOf(0.5, 0.8, 1.0, 1.2, 1.5, 1.8, 2.0, 3.0).forEach { speed ->- Text("${speed}×", color = Color.White, fontSize = 16.sp,+ Text("${speed}×", color = AppText, fontSize = 16.sp,modifier = Modifier.fillMaxWidth().clickable { SongPlayer.setSpeed(speed); onDismiss() }.padding(20.dp, 12.dp))}}diff --git a/base/app/src/main/java/com/music/spotui/ui/components/SpotifyCodeSheet.kt b/base/app/src/main/java/com/music/spotui/ui/components/SpotifyCodeSheet.ktindex 57112159..87c3e598 100644--- a/base/app/src/main/java/com/music/spotui/ui/components/SpotifyCodeSheet.kt+++ b/base/app/src/main/java/com/music/spotui/ui/components/SpotifyCodeSheet.kt@@ -1,5 +1,9 @@package com.music.spotui.ui.components+import com.music.spotui.ui.theme.tone+import com.music.spotui.ui.theme.AppText+import com.music.spotui.ui.theme.AppMuted+import android.content.ClipDataimport android.content.ClipboardManagerimport android.content.Context@@ -147,8 +151,8 @@ fun SpotifyCodeSheet(target: ShareTarget, onDismiss: () -> Unit) {if (target.coverUri.isNotBlank()) Palette().extractSecondColorFromCoverUrl(context, target.coverUri) { background = it }}val bars = SpotifyCode.barsOn(background)- val text = if (bars == "black") Color.Black else Color.White- ModalBottomSheet(onDismissRequest = onDismiss, sheetState = sheetState, containerColor = Color(0xFF121212)) {+ val text = if (bars == "black") Color.Black else AppText+ ModalBottomSheet(onDismissRequest = onDismiss, sheetState = sheetState, containerColor = tone(0xFF121212)) {Column(Modifier.fillMaxWidth().navigationBarsPadding().padding(horizontal = 24.dp), horizontalAlignment = Alignment.CenterHorizontally) {// The card: cover, name, and the code under them, all on the cover's colour.Column(@@ -170,11 +174,11 @@ fun SpotifyCodeSheet(target: ShareTarget, onDismiss: () -> Unit) {modifier = Modifier.padding(top = 14.dp).fillMaxWidth().aspectRatio(4f),)}- Text(stringResource(R.string.spotify_code_hint), color = Color(0xFFB3B3B3), fontSize = 13.sp, textAlign = TextAlign.Center,+ Text(stringResource(R.string.spotify_code_hint), color = AppMuted, fontSize = 13.sp, textAlign = TextAlign.Center,modifier = Modifier.padding(top = 12.dp))// The link itself, under the code.- Text(target.link, color = Color.White.copy(alpha = 0.85f), fontSize = 13.sp, maxLines = 1, overflow = TextOverflow.Ellipsis,- modifier = Modifier.padding(top = 14.dp).fillMaxWidth().clip(RoundedCornerShape(8.dp)).background(Color(0xFF2A2A2A))+ Text(target.link, color = AppText.copy(alpha = 0.85f), fontSize = 13.sp, maxLines = 1, overflow = TextOverflow.Ellipsis,+ modifier = Modifier.padding(top = 14.dp).fillMaxWidth().clip(RoundedCornerShape(8.dp)).background(tone(0xFF2A2A2A)).clickable { copy(context, target.link) }.padding(horizontal = 14.dp, vertical = 12.dp))Row(Modifier.fillMaxWidth().padding(top = 18.dp, bottom = 16.dp), horizontalArrangement = Arrangement.SpaceEvenly) {ShareAction(Icons.Outlined.ContentCopy, stringResource(R.string.copy_link)) { copy(context, target.link); onDismiss() }@@ -198,10 +202,10 @@ private fun copy(context: Context, link: String) {@Composableprivate fun ShareAction(icon: ImageVector, label: String, onClick: () -> Unit) {Column(horizontalAlignment = Alignment.CenterHorizontally, modifier = Modifier.width(96.dp).clip(RoundedCornerShape(8.dp)).clickable(onClick = onClick).padding(vertical = 6.dp)) {- Box(contentAlignment = Alignment.Center, modifier = Modifier.size(52.dp).clip(CircleShape).background(Color(0xFF2A2A2A))) {- Icon(icon, contentDescription = null, tint = Color.White, modifier = Modifier.size(24.dp))+ Box(contentAlignment = Alignment.Center, modifier = Modifier.size(52.dp).clip(CircleShape).background(tone(0xFF2A2A2A))) {+ Icon(icon, contentDescription = null, tint = AppText, modifier = Modifier.size(24.dp))}Spacer(Modifier.height(6.dp))- Text(label, color = Color.White, fontSize = 12.sp, textAlign = TextAlign.Center, maxLines = 2)+ Text(label, color = AppText, fontSize = 12.sp, textAlign = TextAlign.Center, maxLines = 2)}}diff --git a/base/app/src/main/java/com/music/spotui/ui/components/SupporterSheet.kt b/base/app/src/main/java/com/music/spotui/ui/components/SupporterSheet.ktindex ac625ef2..ab2a5436 100644--- a/base/app/src/main/java/com/music/spotui/ui/components/SupporterSheet.kt+++ b/base/app/src/main/java/com/music/spotui/ui/components/SupporterSheet.kt@@ -1,5 +1,9 @@package com.music.spotui.ui.components+import com.music.spotui.ui.theme.tone+import com.music.spotui.ui.theme.AppText+import com.music.spotui.ui.theme.AppMuted+import androidx.compose.foundation.Imageimport androidx.compose.foundation.backgroundimport androidx.compose.foundation.border@@ -75,14 +79,14 @@ private fun iconMark(a: Accent) = when (a) {/** "I've supported": on trust, a donation or a monthly support. */@Composablefun SupportChoice(onChosen: (Level) -> Unit) {- Text(stringResource(R.string.supporter_how), color = Color.White, fontSize = 15.sp, fontWeight = FontWeight.Bold)+ Text(stringResource(R.string.supporter_how), color = AppText, fontSize = 15.sp, fontWeight = FontWeight.Bold)Row(horizontalArrangement = Arrangement.spacedBy(10.dp), modifier = Modifier.padding(top = 10.dp)) {for ((level, label) in listOf(Level.ONCE to R.string.supporter_once, Level.MONTHLY to R.string.supporter_monthly)) {Box(contentAlignment = Alignment.Center,- modifier = Modifier.height(40.dp).clip(RoundedCornerShape(50)).background(Color(0xFF3A3A3A))+ modifier = Modifier.height(40.dp).clip(RoundedCornerShape(50)).background(tone(0xFF3A3A3A)).pressable(0.96f) { onChosen(level) }.padding(horizontal = 18.dp),- ) { Text(stringResource(label), color = Color.White, fontSize = 14.sp, fontWeight = FontWeight.SemiBold) }+ ) { Text(stringResource(label), color = AppText, fontSize = 14.sp, fontWeight = FontWeight.SemiBold) }}}}@@ -92,21 +96,22 @@ fun SupportChoice(onChosen: (Level) -> Unit) {@Composablefun SupporterSheet(onDismiss: () -> Unit) {val context = LocalContext.current+ com.music.spotui.extensions.ProtectedSurfaceEffect(app.myspoti.extensions.ProtectedSurface.SUPPORT)var choosing by remember { mutableStateOf(false) }val level = SupportReminder.level// Opened in full: half open, it hid the support buttons at the bottom.ModalBottomSheet(onDismissRequest = onDismiss,sheetState = androidx.compose.material3.rememberModalBottomSheetState(skipPartiallyExpanded = true),- containerColor = Color(0xFF282828),+ containerColor = tone(0xFF282828),) {Column(Modifier.navigationBarsPadding().verticalScroll(rememberScrollState()).padding(start = 20.dp, end = 20.dp, bottom = 20.dp)) {Row(verticalAlignment = Alignment.CenterVertically) {- Text(stringResource(R.string.supporter_perks_title), color = Color.White, fontSize = 20.sp, fontWeight = FontWeight.Bold)+ Text(stringResource(R.string.supporter_perks_title), color = AppText, fontSize = 20.sp, fontWeight = FontWeight.Bold)if (level != Level.NONE) { Spacer(Modifier.width(10.dp)); SupporterBadge() }}if (level == Level.NONE) {- Text(stringResource(R.string.supporter_perks_locked), color = Color(0xFFB3B3B3), fontSize = 14.sp,+ Text(stringResource(R.string.supporter_perks_locked), color = AppMuted, fontSize = 14.sp,modifier = Modifier.padding(top = 8.dp, bottom = 16.dp))if (choosing) SupportChoice { SupportReminder.setLevel(context, it); choosing = false }else {@@ -116,41 +121,41 @@ fun SupporterSheet(onDismiss: () -> Unit) {.pressable(0.96f) { SupportReminder.open(context) },) { Text(stringResource(R.string.support_action), color = Color.Black, fontSize = 16.sp, fontWeight = FontWeight.Bold) }GitHubSponsorButton(Modifier.padding(top = 10.dp))- Text(stringResource(R.string.supporter_i_supported), color = Color.White, fontSize = 15.sp, fontWeight = FontWeight.Bold,+ Text(stringResource(R.string.supporter_i_supported), color = AppText, fontSize = 15.sp, fontWeight = FontWeight.Bold,modifier = Modifier.align(Alignment.CenterHorizontally).padding(top = 8.dp).pressable(0.96f) { choosing = true }.padding(horizontal = 24.dp, vertical = 12.dp))}return@Column}- Text(stringResource(R.string.supporter_thanks_title), color = Color(0xFFB3B3B3), fontSize = 14.sp, modifier = Modifier.padding(top = 6.dp))+ Text(stringResource(R.string.supporter_thanks_title), color = AppMuted, fontSize = 14.sp, modifier = Modifier.padding(top = 6.dp))- Text(stringResource(R.string.supporter_accent), color = Color.White, fontSize = 16.sp, modifier = Modifier.padding(top = 20.dp, bottom = 10.dp))+ Text(stringResource(R.string.supporter_accent), color = AppText, fontSize = 16.sp, modifier = Modifier.padding(top = 20.dp, bottom = 10.dp))Row(horizontalArrangement = Arrangement.spacedBy(14.dp)) {for (a in Accent.entries) {val selected = SupportReminder.accent == aval name = stringResource(accentName(a))Box(Modifier.size(40.dp).semantics { contentDescription = name }.clip(CircleShape).background(a.color)- .then(if (selected) Modifier.border(3.dp, Color.White, CircleShape) else Modifier)+ .then(if (selected) Modifier.border(3.dp, AppText, CircleShape) else Modifier).pressable(0.92f) { SupportReminder.setAccent(context, a) },)}}- Text(stringResource(R.string.supporter_icon), color = Color.White, fontSize = 16.sp, modifier = Modifier.padding(top = 22.dp, bottom = 10.dp))+ Text(stringResource(R.string.supporter_icon), color = AppText, fontSize = 16.sp, modifier = Modifier.padding(top = 22.dp, bottom = 10.dp))Row(horizontalArrangement = Arrangement.spacedBy(12.dp)) {for (a in Accent.entries) {val selected = SupportReminder.icon == aval name = stringResource(accentName(a))Image(painterResource(iconMark(a)), contentDescription = name,- modifier = Modifier.size(52.dp).clip(RoundedCornerShape(14.dp)).background(Color(0xFF121212))- .then(if (selected) Modifier.border(3.dp, Color.White, RoundedCornerShape(14.dp)) else Modifier)+ modifier = Modifier.size(52.dp).clip(RoundedCornerShape(14.dp)).background(tone(0xFF121212))+ .then(if (selected) Modifier.border(3.dp, AppText, RoundedCornerShape(14.dp)) else Modifier).pressable(0.92f) { SupportReminder.setIcon(context, a) },)}}- Text(stringResource(R.string.supporter_icon_note), color = Color(0xFFB3B3B3), fontSize = 12.sp, modifier = Modifier.padding(top = 8.dp))+ Text(stringResource(R.string.supporter_icon_note), color = AppMuted, fontSize = 12.sp, modifier = Modifier.padding(top = 8.dp))Row(verticalAlignment = Alignment.CenterVertically,@@ -158,7 +163,7 @@ fun SupporterSheet(onDismiss: () -> Unit) {SupportReminder.setLevel(context, if (on) Level.MONTHLY else Level.ONCE)},) {- Text(stringResource(R.string.supporter_monthly_switch), color = Color.White, fontSize = 15.sp, modifier = Modifier.weight(1f))+ Text(stringResource(R.string.supporter_monthly_switch), color = AppText, fontSize = 15.sp, modifier = Modifier.weight(1f))Switch(checked = level == Level.MONTHLY, onCheckedChange = null)}}diff --git a/base/app/src/main/java/com/music/spotui/ui/components/SwipeToRemove.kt b/base/app/src/main/java/com/music/spotui/ui/components/SwipeToRemove.ktindex e7bd4020..7e6b7cb2 100644--- a/base/app/src/main/java/com/music/spotui/ui/components/SwipeToRemove.kt+++ b/base/app/src/main/java/com/music/spotui/ui/components/SwipeToRemove.kt@@ -1,5 +1,7 @@package com.music.spotui.ui.components+import com.music.spotui.ui.theme.AppText+import androidx.compose.animation.core.Animatableimport androidx.compose.animation.core.springimport androidx.compose.animation.core.tween@@ -55,7 +57,7 @@ fun SwipeToRemove(key: Any, onRemove: () -> Unit, content: @Composable () -> Unimodifier = Modifier.matchParentSize().background(if (armed) Color(0xFFE22134) else Color(0xFFE22134).copy(alpha = 0.6f)),) {- Icon(Icons.Outlined.DeleteOutline, stringResource(R.string.context_menu_undownload), tint = Color.White,+ Icon(Icons.Outlined.DeleteOutline, stringResource(R.string.context_menu_undownload), tint = AppText,modifier = Modifier.padding(horizontal = 24.dp).size(26.dp))}}diff --git a/base/app/src/main/java/com/music/spotui/ui/navigation/MainBottomNavigation.kt b/base/app/src/main/java/com/music/spotui/ui/navigation/MainBottomNavigation.ktindex ae33acb5..996c9da9 100644--- a/base/app/src/main/java/com/music/spotui/ui/navigation/MainBottomNavigation.kt+++ b/base/app/src/main/java/com/music/spotui/ui/navigation/MainBottomNavigation.kt@@ -1,5 +1,9 @@package com.music.spotui.ui.navigation+import com.music.spotui.ui.theme.AppText+import com.music.spotui.ui.theme.AppMuted+import com.music.spotui.ui.theme.AppShade+import androidx.navigation.NavGraph.Companion.findStartDestinationimport androidx.compose.ui.res.stringResourceimport app.myspoti.engine.R@@ -100,8 +104,7 @@ fun MainBottomNavigation(navController: NavHostController, bottomBarState: Mutab// Visibility follows the screen actually shown (not flags each screen sets,// which raced during transitions and left the mini player over the full one).val shownRoute = navController.currentBackStackEntryAsState().value?.destination?.route- // The SpotiFLAC verification too: under the bar its retry and skip buttons were out of reach.- val fullScreen = shownRoute == Routes.Player.route || shownRoute == Routes.Queue.route || shownRoute == Routes.Spotiflac.route+ val fullScreen = shownRoute == Routes.Player.route || shownRoute == Routes.Queue.routeval hasTrack = com.music.spotui.di.Graph.currentSongState.title.value.isNotBlank()// No motion of its own: the bar sits above the pages, so sliding it while the// player rises (or collapses behind it) made one gesture look like two.@@ -116,14 +119,14 @@ fun MainBottomNavigation(navController: NavHostController, bottomBarState: Mutab.fillMaxWidth()// Settings, Display: the fade over the list (the default), or solid black (from #15)..then(- if (com.music.spotui.data.preferences.SolidNavBar.on) Modifier.background(Color.Black)+ if (com.music.spotui.data.preferences.SolidNavBar.on) Modifier.background(AppShade)// Like the official bar: clear above the mini player, near-opaque by the tab icons,// so covers scrolling underneath never compete with the labels.else Modifier.background(Brush.verticalGradient(0f to Color.Transparent,- 0.3f to Color.Black.copy(alpha = 0.7f),- 0.6f to Color.Black.copy(alpha = 0.92f),- 1f to Color.Black,+ 0.3f to AppShade.copy(alpha = 0.7f),+ 0.6f to AppShade.copy(alpha = 0.92f),+ 1f to AppShade,)))) {@@ -217,7 +220,7 @@ private fun RowScope.NavBarTab(onClick: () -> Unit,) {// Spotify's idle grey, lighter than Color.Gray which read as "disabled".- val tint = if (selected) Color.White else Color(0xFFB3B3B3)+ val tint = if (selected) AppText else AppMutedBox(modifier = Modifier.weight(1f)diff --git a/base/app/src/main/java/com/music/spotui/ui/navigation/MyNavHost.kt b/base/app/src/main/java/com/music/spotui/ui/navigation/MyNavHost.ktindex f96f62ce..090d2b02 100644--- a/base/app/src/main/java/com/music/spotui/ui/navigation/MyNavHost.kt+++ b/base/app/src/main/java/com/music/spotui/ui/navigation/MyNavHost.kt@@ -63,12 +63,6 @@ fun MyNavHost(val context = LocalContext.currentval startDestination = Routes.Home.route- // A download asked for without a verified SpotiFLAC server opens the verification.- LaunchedEffect(navHostController) {- com.music.spotui.data.offline.SpotiflacGate.open.collect {- if (navHostController.currentDestination?.route != Routes.Spotiflac.route) navHostController.navigate(Routes.Spotiflac.route)- }- }com.music.spotui.ui.components.ArtistChooserHost(navHostController)NavHost(navController = navHostController,@@ -131,15 +125,6 @@ fun MyNavHost(bottomBarState.value = truebottomBarPlayerState.value = playerState != ""}- // Not verified with SpotiFLAC (or it lapsed): the verification first, once per visit.- var askedVerify by androidx.compose.runtime.saveable.rememberSaveable { androidx.compose.runtime.mutableStateOf(false) }- val context = androidx.compose.ui.platform.LocalContext.current- LaunchedEffect(Unit) {- if (!askedVerify && !com.music.spotui.data.preferences.hasSpotiflacSession(context)) {- askedVerify = true- navHostController.navigate(Routes.Spotiflac.route)- }- }com.music.spotui.ui.screens.DownloadsScreen(navHostController)}@@ -167,6 +152,14 @@ fun MyNavHost(com.music.spotui.ui.screens.RecapScreen(navHostController)}+ page(Routes.Friends.route) {+ LaunchedEffect(playerState) {+ bottomBarState.value = true+ bottomBarPlayerState.value = playerState != ""+ }+ com.music.spotui.ui.screens.FriendActivityScreen(navHostController)+ }+// Spotify's own list for the account (every device), not this phone's counter.page(Routes.Recent.route) {LaunchedEffect(playerState) {@@ -193,13 +186,37 @@ fun MyNavHost(com.music.spotui.ui.screens.SettingsScreen(navHostController)}- // SpotiFLAC: the verification that gives the lossless downloads their best source.- page(Routes.Spotiflac.route){- com.music.spotui.ui.screens.SpotiflacScreen(onClose = {- navHostController.popBackStack()- com.music.spotui.data.offline.SpotiflacGate.resume()- })+ // Extensions: the Store and Installed tabs; one installed extension's page; a repository's extension before install.+ page(Routes.Extensions.route){+ LaunchedEffect(playerState) {+ bottomBarState.value = true+ bottomBarPlayerState.value = playerState != ""+ }+ com.music.spotui.ui.screens.ExtensionsScreen(navHostController)}+ page("${Routes.Extension.route}/{id}", arguments = listOf(navArgument("id") { defaultValue = "" })){ entry ->+ LaunchedEffect(playerState) {+ bottomBarState.value = true+ bottomBarPlayerState.value = playerState != ""+ }+ com.music.spotui.ui.screens.ExtensionScreen(navHostController, entry.arguments?.getString("id").orEmpty())+ }+ page("${Routes.ExtensionEntry.route}/{id}", arguments = listOf(navArgument("id") { defaultValue = "" })){ entry ->+ LaunchedEffect(playerState) {+ bottomBarState.value = true+ bottomBarPlayerState.value = playerState != ""+ }+ com.music.spotui.ui.screens.ExtensionEntryScreen(navHostController, entry.arguments?.getString("id").orEmpty())+ }+ // An extension's own page (webview.page), sandboxed.+ page("extension-page/{id}", arguments = listOf(navArgument("id") { defaultValue = "" })){ entry ->+ LaunchedEffect(playerState) {+ bottomBarState.value = true+ bottomBarPlayerState.value = playerState != ""+ }+ com.music.spotui.ui.screens.ExtensionPageScreen(navHostController, entry.arguments?.getString("id").orEmpty())+ }+diff --git a/base/app/src/main/java/com/music/spotui/ui/navigation/PlayerSheet.kt b/base/app/src/main/java/com/music/spotui/ui/navigation/PlayerSheet.ktindex 4a2386d5..aea625d9 100644--- a/base/app/src/main/java/com/music/spotui/ui/navigation/PlayerSheet.kt+++ b/base/app/src/main/java/com/music/spotui/ui/navigation/PlayerSheet.kt@@ -103,10 +103,13 @@ fun PlayerOverlay(navController: NavController) {CompositionLocalProvider(LocalPageSettled provides settled, LocalPlayerReveal provides reveal) {// A podcast episode gets the podcast player (±15 s, speed, sleep timer, no shuffle);// everything else keeps the music player.- if (com.music.spotui.di.SongPlayer.isEpisode) {- com.music.spotui.ui.screens.PodcastPlayerScreen(navController)- } else {- PlayerScreen(navController)+ // The player's bare texts use the body style as it is (no app-wide letter spacing).+ androidx.compose.material3.ProvideTextStyle(com.music.spotui.ui.theme.Typography.bodyLarge) {+ if (com.music.spotui.di.SongPlayer.isEpisode) {+ com.music.spotui.ui.screens.PodcastPlayerScreen(navController)+ } else {+ PlayerScreen(navController)+ }}}}diff --git a/base/app/src/main/java/com/music/spotui/ui/navigation/Routes.kt b/base/app/src/main/java/com/music/spotui/ui/navigation/Routes.ktindex e3925925..466b6fef 100644--- a/base/app/src/main/java/com/music/spotui/ui/navigation/Routes.kt+++ b/base/app/src/main/java/com/music/spotui/ui/navigation/Routes.kt@@ -31,8 +31,12 @@ sealed class Routes(object Episodes : Routes(0, "Episodes", "episodes")object Recap : Routes(0, "Recap", "recap")object Recent : Routes(0, "Recent", "recent")- object Spotiflac : Routes(0, "SpotiFLAC", "spotiflac")+ object Friends : Routes(0, "Friends", "friends")object Settings : Routes(0, "Settings", "settings")+ object Extensions : Routes(0, "Extensions", "extensions")+ object Extension : Routes(0, "Extension", "extension")+ /** A repository's extension, before it is installed (by id). */+ object ExtensionEntry : Routes(0, "ExtensionEntry", "extension-store")object Profile : Routes(0, "Profile", "profile")}diff --git a/base/app/src/main/java/com/music/spotui/ui/screens/AlbumByIdScreen.kt b/base/app/src/main/java/com/music/spotui/ui/screens/AlbumByIdScreen.ktindex 46deeec9..8131c59a 100644--- a/base/app/src/main/java/com/music/spotui/ui/screens/AlbumByIdScreen.kt+++ b/base/app/src/main/java/com/music/spotui/ui/screens/AlbumByIdScreen.kt@@ -1,5 +1,7 @@package com.music.spotui.ui.screens+import com.music.spotui.ui.theme.AppText+import app.myspoti.engine.Rimport androidx.compose.ui.res.stringResource@@ -31,7 +33,7 @@ fun AlbumByIdScreen(navController: NavController, name: String, artist: String,val albumId = resolvedwhen {albumId != null -> ContextScreen(navController, type = "album", id = albumId)- failed -> Text(stringResource(R.string.album_not_found), color = Color.White)+ failed -> Text(stringResource(R.string.album_not_found), color = AppText)else -> Loader(SkeletonKind.Header)}}diff --git a/base/app/src/main/java/com/music/spotui/ui/screens/ArtistScreen.kt b/base/app/src/main/java/com/music/spotui/ui/screens/ArtistScreen.ktindex e43e0a9e..349624f7 100644--- a/base/app/src/main/java/com/music/spotui/ui/screens/ArtistScreen.kt+++ b/base/app/src/main/java/com/music/spotui/ui/screens/ArtistScreen.kt@@ -1,5 +1,8 @@package com.music.spotui.ui.screens+import com.music.spotui.ui.theme.tone+import com.music.spotui.ui.theme.AppText+import com.music.spotui.ui.components.SkeletonKindimport com.music.spotui.ui.components.pressableimport androidx.compose.ui.res.stringResource@@ -106,7 +109,7 @@ fun ArtistScreen(navController: NavController, artistName: String, artistId: Stris Response.Error -> androidx.compose.foundation.layout.Column(Modifier.fillMaxSize().statusBarsPadding()) {androidx.compose.material3.Icon(androidx.compose.material.icons.Icons.AutoMirrored.Filled.ArrowBack,- stringResource(R.string.accessibility_navigate_back), tint = Color.White,+ stringResource(R.string.accessibility_navigate_back), tint = AppText,modifier = Modifier.pressable(0.96f) { navController.navigateUp() }.padding(16.dp).size(26.dp),)com.music.spotui.ui.components.ErrorRetry(stringResource(R.string.page_load_failed)) {@@ -185,7 +188,7 @@ private fun ArtistOverviewContent(val songs = tracks.map { it.song }artistViewModel.updateQueue(songs)val s = songs[index]- SongPlayer.playSong(s.url, context)+ SongPlayer.playSong(s.url, context, songs = songs)artistViewModel.updateSongState(s.coverUri, s.title, s.singer, true, s.id, index)}@@ -256,7 +259,7 @@ private fun ArtistOverviewContent(Icon(Icons.Default.Check, contentDescription = null, tint = Color.Black, modifier = Modifier.size(13.dp))}Spacer(Modifier.width(6.dp))- Text(stringResource(R.string.verified_artist), color = Color.White, fontSize = 14.sp, fontWeight = FontWeight.Bold)+ Text(stringResource(R.string.verified_artist), color = AppText, fontSize = 14.sp, fontWeight = FontWeight.Bold)}}}@@ -270,13 +273,16 @@ private fun ArtistOverviewContent(.format(it)Text(text = stringResource(R.string.monthly_listeners_text, compact),- color = Color.White.copy(alpha = 0.7f),+ color = AppText.copy(alpha = 0.7f),fontSize = 14.sp,modifier = Modifier.padding(16.dp, 12.dp, 16.dp, 0.dp),)}}+ // ── "Your #3 artist of the past 4 weeks", from the account's Spotify top artists ──+ item { ArtistTopBadge(overview.id) }+// ── Action row: Follow + shuffle + play ──item {Row(@@ -313,7 +319,7 @@ private fun ArtistOverviewContent() {Text(text = stringResource(if (SongPlayer.library["spotify:artist:${overview.id}"] ?: following) R.string.curation_button_following_state_text else R.string.curation_button_follow_state_text),- color = Color.White,+ color = AppText,fontSize = 13.sp,fontWeight = FontWeight.SemiBold,)@@ -324,7 +330,7 @@ private fun ArtistOverviewContent(Icon(Icons.Default.MoreVert,contentDescription = stringResource(R.string.content_description_context_menu),- tint = Color.White.copy(alpha = 0.7f),+ tint = AppText.copy(alpha = 0.7f),modifier = Modifier.pressable(0.96f) { showArtistMenu = true }.size(24.dp),@@ -335,7 +341,7 @@ private fun ArtistOverviewContent(Icon(painter = painterResource(id = R.drawable.ic_player_shuffle),contentDescription = stringResource(R.string.play_mode_item_shuffle_title),- tint = if (isThisArtist && com.music.spotui.di.Graph.currentSongState.shuffle.value) SpotifyGreen else Color.White,+ tint = if (isThisArtist && com.music.spotui.di.Graph.currentSongState.shuffle.value) SpotifyGreen else AppText,modifier = Modifier.pressable(0.96f) {if (tracks.isNotEmpty()) {com.music.spotui.di.Graph.currentSongState.startShuffled(tracks.map { it.song })@@ -383,14 +389,14 @@ private fun ArtistOverviewContent(modifier = Modifier.size(52.dp).clip(RoundedCornerShape(4.dp)).background(Brush.linearGradient(listOf(Color(0xFF450AF5), Color(0xFF8E8EE5), Color(0xFFC4EFD9)))),) {- androidx.compose.material3.Icon(Icons.Default.Favorite, contentDescription = null, tint = Color.White, modifier = Modifier.size(22.dp))+ androidx.compose.material3.Icon(Icons.Default.Favorite, contentDescription = null, tint = AppText, modifier = Modifier.size(22.dp))}Spacer(Modifier.width(12.dp))Column(Modifier.weight(1f)) {- Text(stringResource(R.string.artist_liked_songs), color = Color.White, fontSize = 16.sp, fontWeight = FontWeight.Bold)+ Text(stringResource(R.string.artist_liked_songs), color = AppText, fontSize = 16.sp, fontWeight = FontWeight.Bold)Text(androidx.compose.ui.res.pluralStringResource(R.plurals.artist_liked_songs_count, likedByArtist.size, likedByArtist.size, displayName),- color = Color.White.copy(alpha = 0.7f), fontSize = 14.sp, maxLines = 1, overflow = TextOverflow.Ellipsis,+ color = AppText.copy(alpha = 0.7f), fontSize = 14.sp, maxLines = 1, overflow = TextOverflow.Ellipsis,)}}@@ -402,7 +408,7 @@ private fun ArtistOverviewContent(item {Text(text = stringResource(R.string.artist_popular_tracks),- color = Color.White,+ color = AppText,fontSize = 20.sp,fontWeight = FontWeight.Bold,modifier = Modifier.padding(16.dp, 8.dp, 16.dp, 4.dp),@@ -426,11 +432,11 @@ private fun ArtistOverviewContent(Box(modifier = Modifier.clip(RoundedCornerShape(50))- .border(1.dp, Color.White.copy(alpha = 0.5f), RoundedCornerShape(50))+ .border(1.dp, AppText.copy(alpha = 0.5f), RoundedCornerShape(50)).clickable { showAllPopular = !showAllPopular }.padding(horizontal = 20.dp, vertical = 8.dp),) {- Text(if (showAllPopular) stringResource(R.string.profile_bio_show_less) else stringResource(R.string.audiobook_series_see_more_button), color = Color.White, fontSize = 14.sp, fontWeight = FontWeight.Bold)+ Text(if (showAllPopular) stringResource(R.string.profile_bio_show_less) else stringResource(R.string.audiobook_series_see_more_button), color = AppText, fontSize = 14.sp, fontWeight = FontWeight.Bold)}}}@@ -461,7 +467,7 @@ private fun ArtistOverviewContent(.fillMaxWidth().padding(16.dp, 4.dp).clip(RoundedCornerShape(10.dp))- .background(Color.White.copy(alpha = 0.06f))+ .background(AppText.copy(alpha = 0.06f))) {Column {if (overview.avatarImage.isNotBlank()) {@@ -479,7 +485,7 @@ private fun ArtistOverviewContent(overview.monthlyListeners?.let {Text(text = stringResource(R.string.monthly_listeners_text, grouped(it)),- color = Color.White,+ color = AppText,fontSize = 15.sp,fontWeight = FontWeight.Bold,modifier = Modifier.padding(14.dp, 12.dp, 14.dp, 4.dp),@@ -539,17 +545,17 @@ private fun ArtistOverviewContent(verticalAlignment = Alignment.CenterVertically,modifier = Modifier.fillMaxWidth()- .background(Color(0xFF2A2A2A))+ .background(tone(0xFF2A2A2A)).statusBarsPadding().height(56.dp).padding(horizontal = 12.dp),) {Icon(- Icons.AutoMirrored.Filled.ArrowBack, contentDescription = stringResource(R.string.accessibility_navigate_back), tint = Color.White,+ Icons.AutoMirrored.Filled.ArrowBack, contentDescription = stringResource(R.string.accessibility_navigate_back), tint = AppText,modifier = Modifier.size(26.dp).clickable { navController.navigateUp() },)Text(- displayName, color = Color.White, fontSize = 18.sp, fontWeight = FontWeight.Bold,+ displayName, color = AppText, fontSize = 18.sp, fontWeight = FontWeight.Bold,maxLines = 1, overflow = androidx.compose.ui.text.style.TextOverflow.Ellipsis,textAlign = androidx.compose.ui.text.style.TextAlign.Center,modifier = Modifier.weight(1f).padding(end = 26.dp),@@ -572,7 +578,7 @@ private fun PopularTrackRow() {val song = item.songval titleColor =- if (song.id == artistViewModel.currentSongId.value) SpotifyGreen else Color.White+ if (song.id == artistViewModel.currentSongId.value) SpotifyGreen else AppTextRow(verticalAlignment = Alignment.CenterVertically,@@ -588,7 +594,7 @@ private fun PopularTrackRow() {Text(text = "${index + 1}",- color = Color.White.copy(alpha = 0.7f),+ color = AppText.copy(alpha = 0.7f),fontSize = 15.sp,modifier = Modifier.width(24.dp),)@@ -608,7 +614,7 @@ private fun PopularTrackRow(Text(text = song.title, color = titleColor, fontSize = 16.sp, maxLines = 1, overflow = androidx.compose.ui.text.style.TextOverflow.Ellipsis)Row(verticalAlignment = Alignment.CenterVertically) {if (song.explicit) { ExplicitBadge(); Spacer(Modifier.width(6.dp)) }- Text(text = item.playcount?.let { grouped(it) } ?: song.singer, color = Color.White.copy(alpha = 0.7f), fontSize = 13.sp, maxLines = 1, overflow = androidx.compose.ui.text.style.TextOverflow.Ellipsis)+ Text(text = item.playcount?.let { grouped(it) } ?: song.singer, color = AppText.copy(alpha = 0.7f), fontSize = 13.sp, maxLines = 1, overflow = androidx.compose.ui.text.style.TextOverflow.Ellipsis)}}if (saved) {@@ -618,7 +624,7 @@ private fun PopularTrackRow(Icon(Icons.Default.MoreVert,contentDescription = stringResource(R.string.content_description_context_menu),- tint = Color.White.copy(alpha = 0.7f),+ tint = AppText.copy(alpha = 0.7f),modifier = Modifier.pressable(0.96f) { onMore() }.size(24.dp),@@ -630,7 +636,7 @@ private fun PopularTrackRow(private fun SectionHeader(title: String) {Text(text = title,- color = Color.White,+ color = AppText,fontSize = 20.sp,fontWeight = FontWeight.Bold,modifier = Modifier.padding(16.dp, 20.dp, 16.dp, 8.dp),@@ -658,7 +664,7 @@ private fun ReleaseCard(album: AlbumsModel, onClick: () -> Unit) {contentDescription = "",)Spacer(Modifier.height(6.dp))- Text(text = album.name, color = Color.White, fontSize = 13.sp, fontWeight = FontWeight.Medium, maxLines = 1, overflow = androidx.compose.ui.text.style.TextOverflow.Ellipsis)+ Text(text = album.name, color = AppText, fontSize = 13.sp, fontWeight = FontWeight.Medium, maxLines = 1, overflow = androidx.compose.ui.text.style.TextOverflow.Ellipsis)Text(text = album.time.ifBlank { album.artists }.let { if (album.time.isNotBlank()) "${album.time} • Album" else it },color = Color.Gray,@@ -691,7 +697,7 @@ private fun ReleaseRow(album: AlbumsModel, onClick: () -> Unit) {)Spacer(Modifier.width(14.dp))Column(modifier = Modifier.weight(1f)) {- Text(text = album.name, color = Color.White, fontSize = 17.sp, fontWeight = FontWeight.Bold, maxLines = 1, overflow = androidx.compose.ui.text.style.TextOverflow.Ellipsis)+ Text(text = album.name, color = AppText, fontSize = 17.sp, fontWeight = FontWeight.Bold, maxLines = 1, overflow = androidx.compose.ui.text.style.TextOverflow.Ellipsis)val kind = when (album.type.uppercase()) {"SINGLE" -> stringResource(R.string.album_type_single); "EP" -> stringResource(R.string.album_type_ep)"COMPILATION" -> stringResource(R.string.album_type_compilation); "" -> ""@@ -718,7 +724,7 @@ private fun ShowAllButton(onClick: () -> Unit) {.padding(20.dp, 8.dp),) {- Text(text = stringResource(R.string.composer_section_button_show_all), color = Color.White, fontSize = 13.sp, fontWeight = FontWeight.SemiBold)+ Text(text = stringResource(R.string.composer_section_button_show_all), color = AppText, fontSize = 13.sp, fontWeight = FontWeight.SemiBold)}}@@ -771,7 +777,7 @@ fun ArtistReleasesScreen(navController: NavController, artistName: String, artisIcon(imageVector = Icons.AutoMirrored.Filled.ArrowBack,contentDescription = "",- tint = Color.White,+ tint = AppText,modifier = Modifier.pressable(0.96f) { navController.navigateUp() }.size(26.dp),@@ -779,7 +785,7 @@ fun ArtistReleasesScreen(navController: NavController, artistName: String, artisSpacer(Modifier.width(16.dp))Text(text = stringResource(R.string.releases_title),- color = Color.White,+ color = AppText,fontSize = 20.sp,fontWeight = FontWeight.Bold,)@@ -838,7 +844,7 @@ fun ArtistReleasesScreen(navController: NavController, artistName: String, artisprivate fun ReleaseSectionHeader(title: String) {Text(text = title,- color = Color.White,+ color = AppText,fontSize = 22.sp,fontWeight = FontWeight.Bold,modifier = Modifier.padding(16.dp, 18.dp, 16.dp, 8.dp),@@ -850,13 +856,13 @@ private fun ReleaseFilterChip(label: String, selected: Boolean, onClick: () -> UBox(modifier = Modifier.pressable(0.96f) { onClick() }.clip(RoundedCornerShape(20.dp))- .background(if (selected) Color.White else Color(0xFF2A2A2A))+ .background(if (selected) AppText else tone(0xFF2A2A2A)).padding(14.dp, 8.dp),) {Text(text = label,- color = if (selected) Color.Black else Color.White,+ color = if (selected) Color.Black else AppText,fontSize = 13.sp,fontWeight = FontWeight.SemiBold,)@@ -885,7 +891,7 @@ private fun RelatedArtistCard(artist: ArtistsModel, onClick: () -> Unit) {contentDescription = "",)Spacer(Modifier.height(6.dp))- Text(text = artist.name, color = Color.White, fontSize = 13.sp, fontWeight = FontWeight.Medium, maxLines = 1, overflow = androidx.compose.ui.text.style.TextOverflow.Ellipsis)+ Text(text = artist.name, color = AppText, fontSize = 13.sp, fontWeight = FontWeight.Medium, maxLines = 1, overflow = androidx.compose.ui.text.style.TextOverflow.Ellipsis)Text(text = stringResource(R.string.artist_subtitle), color = Color.Gray, fontSize = 11.sp)}}diff --git a/base/app/src/main/java/com/music/spotui/ui/screens/CategoryScreen.kt b/base/app/src/main/java/com/music/spotui/ui/screens/CategoryScreen.ktindex 5f58fce4..4351b622 100644--- a/base/app/src/main/java/com/music/spotui/ui/screens/CategoryScreen.kt+++ b/base/app/src/main/java/com/music/spotui/ui/screens/CategoryScreen.kt@@ -1,5 +1,7 @@package com.music.spotui.ui.screens+import com.music.spotui.ui.theme.AppText+import androidx.compose.ui.res.stringResourceimport com.music.spotui.ui.components.pressable@@ -74,7 +76,7 @@ fun CategoryScreen(navController: NavController, genre: String, title: String) {Icon(imageVector = Icons.AutoMirrored.Filled.ArrowBack,contentDescription = stringResource(R.string.accessibility_navigate_back),- tint = Color.White,+ tint = AppText,modifier = Modifier.size(40.dp).clip(RoundedCornerShape(20.dp))@@ -84,7 +86,7 @@ fun CategoryScreen(navController: NavController, genre: String, title: String) {Text(text = title,fontWeight = FontWeight.Bold,- color = Color.White,+ color = AppText,fontSize = 22.sp,maxLines = 1,overflow = TextOverflow.Ellipsis,@@ -135,7 +137,7 @@ private fun CategoryGrid(entries: List<LibraryEntry>, navController: NavControll)Text(text = entry.name,- color = Color.White,+ color = AppText,fontSize = 13.sp,fontWeight = FontWeight.Bold,lineHeight = 16.sp,diff --git a/base/app/src/main/java/com/music/spotui/ui/screens/ContextScreen.kt b/base/app/src/main/java/com/music/spotui/ui/screens/ContextScreen.ktindex b6bfd645..b4ed3433 100644--- a/base/app/src/main/java/com/music/spotui/ui/screens/ContextScreen.kt+++ b/base/app/src/main/java/com/music/spotui/ui/screens/ContextScreen.kt@@ -1,5 +1,11 @@package com.music.spotui.ui.screens+import com.music.spotui.ui.theme.tone+import com.music.spotui.ui.theme.AppText+import com.music.spotui.ui.theme.headerTint++import com.music.spotui.ui.theme.AppMuted+import androidx.compose.material.icons.filled.SwapVertimport androidx.compose.material.icons.filled.ArrowUpwardimport androidx.compose.material.icons.filled.ArrowDownward@@ -226,6 +232,8 @@ class ContextViewModel(load(lastType, lastId)}+ private var warmedFor = ""+fun load(type: String, id: String) {lastType = type; lastId = idif (key == "$type:$id") return@@ -242,6 +250,10 @@ class ContextViewModel(}// Fetched ahead (PagePrefetch) or opened before, on storage: shown whole at once.var fromDisk = false+ // A list downloaded as a whole opens offline: its kept page, the network refreshing it behind.+ val offlineUri = when (type) { "album", "playlist" -> "spotify:$type:$id"; "liked" -> "spotify:collection:tracks"; else -> null }+ if (_page.value !is Response.Success && offlineUri != null)+ com.music.spotui.data.offline.OfflineCollections.offlinePage(offlineUri)?.let { fromDisk = true; _page.value = Response.Success(it) }if (_page.value !is Response.Success && type == "playlist")com.music.spotui.data.api.ScreenCache.page(id).read()?.let { fromDisk = true; _page.value = Response.Success(it) }val flow = when (type) {@@ -292,6 +304,8 @@ class ContextViewModel(if (r is Response.Success) {recent[key!!] = rval p = r.data+ // Its first songs are made ready, so a tap plays at once (an audio-source extension).+ if (warmedFor != p.uri) { warmedFor = p.uri; viewModelScope.launch { runCatching { com.music.spotui.extensions.ExtensionAudio.warm(p.tracks) } } }if (type == "playlist" && p.complete) com.music.spotui.data.api.PagePrefetch.refreshed(id, p)// Check saved state on the first page and again once complete.if ((savedChecked == 0 && p.tracks.isNotEmpty()) || (p.complete && savedChecked < 2)) {@@ -346,6 +360,28 @@ class ContextViewModel(}}+ /**+ * Owner, from the "Shared with" list: a member becomes a collaborator or a listener, or leaves+ * the playlist ([collaborator] null). The list answers at once; a refusal puts back what Spotify has.+ */+ fun changeMember(p: ContextPageModel, m: app.myspoti.api.PlaylistMember, collaborator: Boolean?, onDone: (Boolean) -> Unit) {+ val before = members.value+ members.value = if (collaborator == null) before.filter { it.username != m.username }+ else before.map { if (it.username == m.username) it.copy(isCollaborator = collaborator) else it }+ viewModelScope.launch {+ val ok = withContext(Dispatchers.IO) {+ runCatching {+ if (collaborator == null) MyspotiRuntime.api.playlists.removeMember(p.uri, m.username)+ else MyspotiRuntime.api.playlists.setMemberCollaborator(p.uri, m.username, collaborator)+ }.isSuccess+ }+ if (!ok) members.value = withContext(Dispatchers.IO) {+ runCatching { MyspotiRuntime.api.playlists.members(p.uri) }.getOrDefault(before)+ }+ onDone(ok)+ }+ }+fun toggleContextSaved(p: ContextPageModel) {val on = !(SongPlayer.library[p.uri] ?: contextSaved.value)com.music.spotui.di.Haptics.toggle(on)@@ -403,9 +439,22 @@ class ContextViewModel(val at = local.indexOfFirst { it.trackId == song.spotifyTrackId }.coerceAtLeast(0)if (limited && local.size < p.tracks.size)android.widget.Toast.makeText(app, app.getString(R.string.offline_only_downloaded, local.size, p.tracks.size), android.widget.Toast.LENGTH_SHORT).show()- com.music.spotui.di.LocalPlayer.play(local.map(store::toLocalTrack), at, shuffle = state.shuffle.value, context = p.name)+ com.music.spotui.di.LocalPlayer.play(local.map(store::toLocalTrack), at, shuffle = state.shuffle.value, context = p.name, contextUri = p.uri)+ return+ }+ // An extension that gives songs' audio (audio-source): the list plays in the local+ // player from there, like downloads; it has nothing for the picked song, Spotify plays.+ if (!limited && com.music.spotui.extensions.Extensions.hasAudioSource()) {+ val shuffle = state.shuffle.value+ SongPlayer.playThroughExtensions(song.spotifyTrackId, song, p.name, { playOnSpotify(p, song, sort) }) { isLatest, _ ->+ com.music.spotui.extensions.ExtensionAudio.playList(sort.apply(p.tracks), song, p.name, shuffle, p.uri, isLatest)+ }return}+ playOnSpotify(p, song, sort)+ }++ private fun playOnSpotify(p: ContextPageModel, song: SongsModel, sort: TrackOrder) {state.updateQueue(p.tracks)// B26: keep the list's own name — the player header falls back to it when Spotify's// context label comes back blank (it then showed the album's name).@@ -415,7 +464,8 @@ class ContextViewModel(// artist's liked songs are a part of Liked Songs: always given, so only they play.val order = if (sort.isCustom && p.type != "liked-artist") null else sort.apply(p.tracks).map { "spotify:track:${it.spotifyTrackId}" }if (order != null) state.updateQueue(sort.apply(p.tracks))- SongPlayer.playSong(song.url, contextUri = p.uri, order = order)+ // The audio-source extensions were asked already (or the phone is offline): Spotify plays.+ SongPlayer.playSong(song.url, contextUri = p.uri, order = order, askExtensions = false)state.updateSongState(song.coverUri, song.title, song.singer, true, song.id, 0, song.album)}}@@ -432,7 +482,7 @@ fun ContextScreen(navController: NavController, type: String, id: String) {is Response.Loading -> Loader(SkeletonKind.Header)is Response.Error -> Text(r.error,- color = Color.White,+ color = AppText,modifier = Modifier.align(Alignment.Center).padding(24.dp),)is Response.Success -> ContextContent(navController, vm, r.data)@@ -453,7 +503,7 @@ private fun ContextContent(navController: NavController, vm: ContextViewModel, pval saved by vm.savedUrisval contextSaved by vm.contextSaved- var tintTarget by remember { mutableStateOf(Palette.cachedSecond(p.coverUri) ?: Color(0xFF3A3A3A)) }+ var tintTarget by remember { mutableStateOf(Palette.cachedSecond(p.coverUri) ?: tone(0xFF3A3A3A)) }LaunchedEffect(p.coverUri) {if (p.coverUri.isNotBlank()) Palette().extractSecondColorFromCoverUrl(context, p.coverUri) { tintTarget = it }}@@ -466,7 +516,16 @@ private fun ContextContent(navController: NavController, vm: ContextViewModel, pvar sort by remember(p.uri) { mutableStateOf(TrackOrder.load(ctx, p.uri)) }var askRemoveDownloads by remember { mutableStateOf(false) }var playlistMenu by remember { mutableStateOf(false) }+ var albumMenu by remember { mutableStateOf(false) }var addingSongs by remember { mutableStateOf(false) }+ var leaveAsk by remember { mutableStateOf(false) }+ // The profile id comes once per session (and is no Compose state): `name` is set just before it,+ // so reading it here redraws the page when the id is there.+ LaunchedEffect(Unit) { com.music.spotui.data.api.ProfileCache.ensure(context) }+ val ownPlaylist = com.music.spotui.data.api.ProfileCache.let { cache ->+ cache.name+ cache.id?.let { id -> p.ownerUri == "spotify:user:$id" } == true+ }// A11: confirmations (and their Undo) float above the list, not inside a menu that closes.val snackbar = remember { androidx.compose.material3.SnackbarHostState() }val scope = androidx.compose.runtime.rememberCoroutineScope()@@ -498,7 +557,25 @@ private fun ContextContent(navController: NavController, vm: ContextViewModel, p}}+ if (leaveAsk) androidx.compose.material3.AlertDialog(+ onDismissRequest = { leaveAsk = false },+ containerColor = tone(0xFF282828),+ title = { Text(stringResource(R.string.playlist_leave), color = AppText) },+ text = { Text(stringResource(R.string.playlist_leave_confirm, p.name), color = AppMuted) },+ confirmButton = {+ androidx.compose.material3.TextButton(onClick = {+ leaveAsk = false+ // As from the playlist menu: the page closes now; a refusal says so and the library is read again.+ com.music.spotui.data.api.LibraryEdits.run(context, null,+ write = { MyspotiRuntime.api.playlists.leave(p.uri) },+ onDone = { ok -> if (ok) com.music.spotui.data.api.LibraryEdits.reloadSoon() })+ navController.navigateUp()+ }) { Text(stringResource(R.string.playlist_leave_button), color = Color(0xFFF15E6C)) }+ },+ dismissButton = { androidx.compose.material3.TextButton(onClick = { leaveAsk = false }) { Text(stringResource(R.string.cancel), color = AppText) } },+ )if (addingSongs) com.music.spotui.ui.components.AddSongsScreen(p) { added -> addingSongs = false; if (added) vm.reload() }+ if (albumMenu) com.music.spotui.ui.components.AlbumOptionsSheet(p.uri, p.name) { albumMenu = false }if (playlistMenu) com.music.spotui.ui.components.PlaylistOptionsSheet(page = p,onAddSongs = if (p.type == "playlist" && vm.editableContext.value && !p.isBlend) ({ addingSongs = true }) else null,@@ -510,9 +587,9 @@ private fun ContextContent(navController: NavController, vm: ContextViewModel, p)if (askRemoveDownloads) androidx.compose.material3.AlertDialog(onDismissRequest = { askRemoveDownloads = false },- containerColor = Color(0xFF282828),- title = { Text(stringResource(R.string.playlist_entity_remove_download_dialog_title), color = Color.White) },- text = { Text(stringResource(R.string.playlist_entity_remove_download_dialog_description), color = Color(0xFFB3B3B3)) },+ containerColor = tone(0xFF282828),+ title = { Text(stringResource(R.string.playlist_entity_remove_download_dialog_title), color = AppText) },+ text = { Text(stringResource(R.string.playlist_entity_remove_download_dialog_description), color = AppMuted) },confirmButton = {androidx.compose.material3.TextButton(onClick = {askRemoveDownloads = false@@ -522,7 +599,7 @@ private fun ContextContent(navController: NavController, vm: ContextViewModel, p},dismissButton = {androidx.compose.material3.TextButton(onClick = { askRemoveDownloads = false }) {- Text(stringResource(R.string.add_to_playlist_button_cancel), color = Color.White)+ Text(stringResource(R.string.add_to_playlist_button_cancel), color = AppText)}},)@@ -599,7 +676,7 @@ private fun ContextContent(navController: NavController, vm: ContextViewModel, pandroidx.compose.material3.pulltorefresh.PullToRefreshDefaults.Indicator(state = pullState, isRefreshing = refreshing,modifier = Modifier.align(Alignment.TopCenter).statusBarsPadding(),- containerColor = Color(0xFF282828), color = SpotifyGreen,+ containerColor = tone(0xFF282828), color = SpotifyGreen,)},) {@@ -608,7 +685,7 @@ private fun ContextContent(navController: NavController, vm: ContextViewModel, pColumn(modifier = Modifier.fillMaxWidth()- .background(Brush.verticalGradient(listOf(lerp(tint, Color.Black, 0.25f), PageBackground)))+ .background(Brush.verticalGradient(listOf(headerTint(tint, 0.25f), PageBackground))).statusBarsPadding()) {Box(@@ -620,7 +697,7 @@ private fun ContextContent(navController: NavController, vm: ContextViewModel, p.background(Color.Black.copy(alpha = 0.35f)).clickable { navController.navigateUp() }) {- Icon(Icons.AutoMirrored.Filled.ArrowBack, contentDescription = stringResource(R.string.accessibility_navigate_back), tint = Color.White)+ Icon(Icons.AutoMirrored.Filled.ArrowBack, contentDescription = stringResource(R.string.accessibility_navigate_back), tint = AppText)}Box(contentAlignment = Alignment.Center, modifier = Modifier.fillMaxWidth()) {if (p.type == "liked" || p.type == "liked-artist") LikedCover(Modifier.fillMaxWidth(0.66f).aspectRatio(1f).shadow(16.dp, RoundedCornerShape(4.dp))) else@@ -643,18 +720,28 @@ private fun ContextContent(navController: NavController, vm: ContextViewModel, pcom.music.spotui.ui.components.FitText(p.name, fontSize = 26.sp, minSize = 18.sp, fontWeight = FontWeight.Bold, maxLines = 2)if (p.description.isNotBlank()) {Spacer(Modifier.height(8.dp))- Text(p.description, color = Color.White.copy(alpha = 0.7f), fontSize = 14.sp, maxLines = 3, overflow = TextOverflow.Ellipsis)+ Text(p.description, color = AppText.copy(alpha = 0.7f), fontSize = 14.sp, maxLines = 3, overflow = TextOverflow.Ellipsis)}val crew = vm.members.valueif (crew.size > 1) {// Collaborative: everyone who adds to it, as the official app shows them.Spacer(Modifier.height(10.dp))var showMembers by remember { mutableStateOf(false) }- if (showMembers) MembersSheet(crew, navController) { showMembers = false }+ if (showMembers) MembersSheet(+ members = crew, navController = navController,+ // The owner manages everyone; a guest only has "Leave playlist" on their own row.+ ownPlaylist = ownPlaylist, me = com.music.spotui.data.api.ProfileCache.id, canLeave = p.canLeave,+ onChange = { m, collaborator ->+ vm.changeMember(p, m, collaborator) { ok ->+ if (!ok) android.widget.Toast.makeText(context, R.string.playlist_change_refused, android.widget.Toast.LENGTH_SHORT).show()+ }+ },+ onLeave = { showMembers = false; leaveAsk = true },+ ) { showMembers = false }Row(verticalAlignment = Alignment.CenterVertically, modifier = Modifier.pressable(0.96f) { showMembers = true }) {Box(Modifier.width((24 + 16 * (crew.size.coerceAtMost(4) - 1)).dp).height(24.dp)) {crew.take(4).forEachIndexed { n, m ->- Box(Modifier.padding(start = (16 * n).dp).size(24.dp).clip(CircleShape).background(Color(0xFF121212)).padding(1.dp)) {+ Box(Modifier.padding(start = (16 * n).dp).size(24.dp).clip(CircleShape).background(tone(0xFF121212)).padding(1.dp)) {com.music.spotui.ui.components.ProfileAvatar(m.imageUrl, m.name, 22.dp)}}@@ -663,7 +750,7 @@ private fun ContextContent(navController: NavController, vm: ContextViewModel, pText(if (crew.size <= 2) crew.joinToString(", ") { it.name }else stringResource(R.string.playlist_members_more, crew.first().name, crew.size - 1),- color = Color.White, fontSize = 14.sp, fontWeight = FontWeight.Bold, maxLines = 1, overflow = TextOverflow.Ellipsis,+ color = AppText, fontSize = 14.sp, fontWeight = FontWeight.Bold, maxLines = 1, overflow = TextOverflow.Ellipsis,)}} else if (p.ownerName.isNotBlank()) {@@ -688,7 +775,7 @@ private fun ContextContent(navController: NavController, vm: ContextViewModel, p)Spacer(Modifier.width(8.dp))}- Text(p.ownerName, color = Color.White, fontSize = 14.sp, fontWeight = FontWeight.Bold, maxLines = 1, overflow = TextOverflow.Ellipsis)+ Text(p.ownerName, color = AppText, fontSize = 14.sp, fontWeight = FontWeight.Bold, maxLines = 1, overflow = TextOverflow.Ellipsis)}}if (p.metaLine.isNotBlank() || p.explicit) {@@ -698,7 +785,7 @@ private fun ContextContent(navController: NavController, vm: ContextViewModel, pExplicitBadge()Spacer(Modifier.width(6.dp))}- Text(p.metaLine, color = Color.White.copy(alpha = 0.7f), fontSize = 13.sp)+ Text(p.metaLine, color = AppText.copy(alpha = 0.7f), fontSize = 13.sp)}}}@@ -713,13 +800,14 @@ private fun ContextContent(navController: NavController, vm: ContextViewModel, pif (p.type == "playlist" && vm.editableContext.value && !p.isBlend) {Box(contentAlignment = Alignment.Center,- modifier = Modifier.size(36.dp).clip(CircleShape).background(Color.White.copy(alpha = 0.12f)).pressable(0.9f) { addingSongs = true },+ modifier = Modifier.size(36.dp).clip(CircleShape).background(AppText.copy(alpha = 0.12f)).pressable(0.9f) { addingSongs = true },) {- Icon(Icons.Default.Add, contentDescription = stringResource(R.string.add_songs_title), tint = Color.White, modifier = Modifier.size(24.dp))+ Icon(Icons.Default.Add, contentDescription = stringResource(R.string.add_songs_title), tint = AppText, modifier = Modifier.size(24.dp))}Spacer(Modifier.width(20.dp))}- if (p.type != "liked") {+ // Saving is for other people's playlists: the user's own are in the library already.+ if (p.type != "liked" && !(p.type == "playlist" && ownPlaylist)) {LikeButton(liked = SongPlayer.library[p.uri] ?: contextSaved, size = 28.dp) { vm.toggleContextSaved(p) }Spacer(Modifier.width(20.dp))}@@ -747,10 +835,10 @@ private fun ContextContent(navController: NavController, vm: ContextViewModel, p}}}- if (p.type == "playlist") {+ if (p.type == "playlist" || p.type == "album") {Spacer(Modifier.width(16.dp))- Icon(Icons.Default.MoreVert, stringResource(R.string.content_description_context_menu), tint = Color.White.copy(alpha = 0.8f),- modifier = Modifier.size(26.dp).pressable(0.9f) { playlistMenu = true })+ Icon(Icons.Default.MoreVert, stringResource(R.string.content_description_context_menu), tint = AppText.copy(alpha = 0.8f),+ modifier = Modifier.size(26.dp).pressable(0.9f) { if (p.type == "playlist") playlistMenu = true else albumMenu = true })}// Sorting stays in reach in the header (the search field above the songs is folded).if (findable && all.isNotEmpty()) {@@ -763,7 +851,7 @@ private fun ContextContent(navController: NavController, vm: ContextViewModel, pIcon(painter = painterResource(id = R.drawable.ic_player_shuffle),contentDescription = stringResource(if (smart) R.string.smart_shuffle_title else R.string.play_mode_item_shuffle_title),- tint = if (shuffle || smart) SpotifyGreen else Color.White.copy(alpha = 0.8f),+ tint = if (shuffle || smart) SpotifyGreen else AppText.copy(alpha = 0.8f),modifier = Modifier.size(26.dp).drawWithContent {@@ -823,11 +911,11 @@ private fun ContextContent(navController: NavController, vm: ContextViewModel, pRow(verticalAlignment = Alignment.CenterVertically,modifier = Modifier.padding(horizontal = 16.dp, vertical = 4.dp).fillMaxWidth()- .clip(RoundedCornerShape(10.dp)).background(Color.White.copy(alpha = 0.06f)).padding(12.dp),+ .clip(RoundedCornerShape(10.dp)).background(AppText.copy(alpha = 0.06f)).padding(12.dp),) {- Icon(Icons.Outlined.Group, contentDescription = null, tint = Color(0xFFB3B3B3), modifier = Modifier.size(20.dp))+ Icon(Icons.Outlined.Group, contentDescription = null, tint = AppMuted, modifier = Modifier.size(20.dp))Text(stringResource(R.string.playlist_collab_locked, p.ownerName.ifBlank { stringResource(R.string.playlist_collab_owner) }),- color = Color(0xFFB3B3B3), fontSize = 13.sp, modifier = Modifier.padding(start = 10.dp))+ color = AppMuted, fontSize = 13.sp, modifier = Modifier.padding(start = 10.dp))}}if (p.isBlend) item(key = "blend") {@@ -870,7 +958,7 @@ private fun ContextContent(navController: NavController, vm: ContextViewModel, pval additions = com.music.spotui.data.local.LocalPlaylists.additions[playlistId].orEmpty()if (additions.isNotEmpty()) {item {- Text(stringResource(R.string.local_added_section), color = Color.White, fontSize = 18.sp, fontWeight = FontWeight.Bold,+ Text(stringResource(R.string.local_added_section), color = AppText, fontSize = 18.sp, fontWeight = FontWeight.Bold,modifier = Modifier.padding(16.dp, 20.dp, 16.dp, 4.dp))}localItems(additions, p.name) { com.music.spotui.data.local.LocalPlaylists.removeFromSpotify(playlistId, it.key) }@@ -899,7 +987,7 @@ private fun ContextContent(navController: NavController, vm: ContextViewModel, pmodifier = Modifier.fillMaxWidth().graphicsLayer { alpha = barAlpha.value }- .background(lerp(tint, Color.Black, 0.45f))+ .background(headerTint(tint, 0.45f)).statusBarsPadding().height(56.dp),) {@@ -907,10 +995,10 @@ private fun ContextContent(navController: NavController, vm: ContextViewModel, pcontentAlignment = Alignment.Center,modifier = Modifier.padding(horizontal = 8.dp).size(40.dp).clip(CircleShape).clickable { navController.navigateUp() },) {- Icon(Icons.AutoMirrored.Filled.ArrowBack, contentDescription = stringResource(R.string.accessibility_navigate_back), tint = Color.White)+ Icon(Icons.AutoMirrored.Filled.ArrowBack, contentDescription = stringResource(R.string.accessibility_navigate_back), tint = AppText)}// Centred, as on the artist page.- Text(p.name, color = Color.White, fontSize = 18.sp, fontWeight = FontWeight.Bold, maxLines = 1, overflow = TextOverflow.Ellipsis,+ Text(p.name, color = AppText, fontSize = 18.sp, fontWeight = FontWeight.Bold, maxLines = 1, overflow = TextOverflow.Ellipsis,textAlign = androidx.compose.ui.text.style.TextAlign.Center, modifier = Modifier.weight(1f).padding(end = 56.dp))}// Opened from a collaborative-playlist invitation (…?pt=): the playlist is joined from here.@@ -923,10 +1011,10 @@ private fun ContextContent(navController: NavController, vm: ContextViewModel, p.align(Alignment.BottomCenter).padding(start = 16.dp, end = 16.dp, bottom = com.music.spotui.ui.components.bottomBarsSpace()).clip(RoundedCornerShape(12.dp))- .background(Color(0xFF282828))+ .background(tone(0xFF282828)).padding(start = 16.dp, end = 8.dp, top = 8.dp, bottom = 8.dp),) {- Text(stringResource(R.string.playlist_invite_banner), color = Color.White, fontSize = 14.sp, modifier = Modifier.weight(1f).padding(end = 12.dp))+ Text(stringResource(R.string.playlist_invite_banner), color = AppText, fontSize = 14.sp, modifier = Modifier.weight(1f).padding(end = 12.dp))androidx.compose.material3.Button(enabled = !joining,colors = androidx.compose.material3.ButtonDefaults.buttonColors(containerColor = SpotifyGreen, contentColor = Color.Black),@@ -951,8 +1039,8 @@ private fun ContextContent(navController: NavController, vm: ContextViewModel, p) { data ->androidx.compose.material3.Snackbar(snackbarData = data,- containerColor = Color(0xFF282828),- contentColor = Color.White,+ containerColor = tone(0xFF282828),+ contentColor = AppText,actionContentColor = SpotifyGreen,)}@@ -997,12 +1085,12 @@ private fun androidx.compose.foundation.lazy.LazyListScope.recommendedItems(vm:LaunchedEffect(p.uri) { vm.loadRecs(p) }Row(verticalAlignment = Alignment.CenterVertically, modifier = Modifier.fillMaxWidth().padding(16.dp, 28.dp, 8.dp, 4.dp)) {Column(Modifier.weight(1f)) {- Text(stringResource(R.string.recommended_songs), color = Color.White, fontSize = 20.sp, fontWeight = FontWeight.Bold)+ Text(stringResource(R.string.recommended_songs), color = AppText, fontSize = 20.sp, fontWeight = FontWeight.Bold)Text(stringResource(if (p.tracks.isEmpty()) R.string.recommended_songs_from_name else R.string.recommended_songs_from_songs),- color = Color(0xFFB3B3B3), fontSize = 13.sp)+ color = AppMuted, fontSize = 13.sp)}androidx.compose.material3.TextButton(onClick = { vm.loadRecs(p, refresh = true) }) {- Text(stringResource(R.string.recommended_songs_refresh), color = Color.White, fontWeight = FontWeight.Bold)+ Text(stringResource(R.string.recommended_songs_refresh), color = AppText, fontWeight = FontWeight.Bold)}}}@@ -1012,7 +1100,7 @@ private fun androidx.compose.foundation.lazy.LazyListScope.recommendedItems(vm:RecommendedRow(song,isCurrent = song.id == currentSongId,- onPlay = { SongPlayer.playSong(song.url, context) },+ onPlay = { SongPlayer.playSong(song.url, context, songs = listOf(song)) },onAdd = {vm.takeRec(p, song)com.music.spotui.data.api.SpotifySync.addTrackToPlaylist(context, p.uri.substringAfterLast(':'), song.spotifyTrackId) { ok ->@@ -1036,11 +1124,11 @@ private fun RecommendedRow(song: SongsModel, isCurrent: Boolean, onPlay: () -> Umodifier = Modifier.size(48.dp).clip(RoundedCornerShape(4.dp)))Column(Modifier.weight(1f).padding(start = 12.dp, end = 8.dp)) {// The song playing is green, as in the playlist above.- Text(song.title, color = if (isCurrent) SpotifyGreen else Color.White, fontSize = 15.sp, maxLines = 1, overflow = TextOverflow.Ellipsis)- Text(song.singer, color = Color(0xFFB3B3B3), fontSize = 13.sp, maxLines = 1, overflow = TextOverflow.Ellipsis)+ Text(song.title, color = if (isCurrent) SpotifyGreen else AppText, fontSize = 15.sp, maxLines = 1, overflow = TextOverflow.Ellipsis)+ Text(song.singer, color = AppMuted, fontSize = 13.sp, maxLines = 1, overflow = TextOverflow.Ellipsis)}androidx.compose.material3.IconButton(onClick = onAdd) {- Icon(androidx.compose.material.icons.Icons.Outlined.AddCircleOutline, contentDescription = stringResource(R.string.recommended_songs_add), tint = Color.White)+ Icon(androidx.compose.material.icons.Icons.Outlined.AddCircleOutline, contentDescription = stringResource(R.string.recommended_songs_add), tint = AppText)}}}@@ -1048,10 +1136,20 @@ private fun RecommendedRow(song: SongsModel, isCurrent: Boolean, onPlay: () -> U/** The people of a collaborative playlist: owner first, then collaborators; a tap opens a profile. */@OptIn(androidx.compose.material3.ExperimentalMaterial3Api::class)@Composable-private fun MembersSheet(members: List<app.myspoti.api.PlaylistMember>, navController: NavController, onDismiss: () -> Unit) {- androidx.compose.material3.ModalBottomSheet(onDismissRequest = onDismiss, containerColor = Color(0xFF282828)) {+private fun MembersSheet(+ members: List<app.myspoti.api.PlaylistMember>,+ navController: NavController,+ ownPlaylist: Boolean,+ me: String?,+ canLeave: Boolean,+ /** Owner: [collaborator] true/false changes the member's level, null removes the member. */+ onChange: (app.myspoti.api.PlaylistMember, Boolean?) -> Unit,+ onLeave: () -> Unit,+ onDismiss: () -> Unit,+) {+ androidx.compose.material3.ModalBottomSheet(onDismissRequest = onDismiss, containerColor = tone(0xFF282828)) {Column(Modifier.navigationBarsPadding().padding(bottom = 12.dp)) {- Text(stringResource(R.string.playlist_members_title), color = Color.White, fontSize = 18.sp, fontWeight = FontWeight.Bold,+ Text(stringResource(R.string.playlist_members_title), color = AppText, fontSize = 18.sp, fontWeight = FontWeight.Bold,modifier = Modifier.padding(20.dp, 0.dp, 20.dp, 12.dp))members.forEach { m ->Row(@@ -1062,8 +1160,31 @@ private fun MembersSheet(members: List<app.myspoti.api.PlaylistMember>, navContr) {com.music.spotui.ui.components.ProfileAvatar(m.imageUrl, m.name, 44.dp)Column(Modifier.weight(1f).padding(start = 14.dp)) {- Text(m.name, color = Color.White, fontSize = 16.sp, maxLines = 1, overflow = TextOverflow.Ellipsis)- Text(stringResource(if (m.isOwner) R.string.playlist_member_owner else R.string.playlist_member_collab), color = Color(0xFFB3B3B3), fontSize = 13.sp)+ Text(m.name, color = AppText, fontSize = 16.sp, maxLines = 1, overflow = TextOverflow.Ellipsis)+ Text(stringResource(when {+ m.isOwner -> R.string.playlist_member_owner+ m.isCollaborator -> R.string.playlist_member_collab+ else -> R.string.playlist_member_listener+ }), color = AppMuted, fontSize = 13.sp)+ }+ // As the Web Player's "Shared with": the owner's menu per member, "Leave playlist" on a guest's own row.+ val ownRow = canLeave && me != null && m.username == me+ if (!m.isOwner && (ownPlaylist || ownRow)) {+ var open by remember { mutableStateOf(false) }+ Box {+ Icon(Icons.Default.MoreVert, contentDescription = null, tint = AppText,+ modifier = Modifier.size(40.dp).clip(CircleShape).clickable { open = true }.padding(8.dp))+ androidx.compose.material3.DropdownMenu(expanded = open, onDismissRequest = { open = false }, containerColor = tone(0xFF282828)) {+ @Composable fun item(label: Int, action: () -> Unit) = androidx.compose.material3.DropdownMenuItem(+ text = { Text(stringResource(label), color = AppText) },+ onClick = { open = false; action() })+ if (ownPlaylist) {+ if (m.isCollaborator) item(R.string.playlist_member_remove_collab) { onChange(m, false) }+ else item(R.string.playlist_member_make_collab) { onChange(m, true) }+ item(R.string.playlist_member_remove) { onChange(m, null) }+ } else item(R.string.playlist_leave) { onLeave() }+ }+ }}}}@@ -1128,7 +1249,7 @@ private fun TrackRow(Column(modifier = Modifier.weight(1f)) {Text(song.title,- color = if (isCurrent) SpotifyGreen else Color.White,+ color = if (isCurrent) SpotifyGreen else AppText,fontSize = 16.sp,maxLines = 1,overflow = TextOverflow.Ellipsis,@@ -1142,7 +1263,7 @@ private fun TrackRow(ExplicitBadge()Spacer(Modifier.width(6.dp))}- Text(song.singer, color = Color.White.copy(alpha = 0.7f), fontSize = 14.sp, maxLines = 1, overflow = TextOverflow.Ellipsis)+ Text(song.singer, color = AppText.copy(alpha = 0.7f), fontSize = 14.sp, maxLines = 1, overflow = TextOverflow.Ellipsis)}}// Collaborative playlist: who added this song.@@ -1162,7 +1283,7 @@ private fun TrackRow(Icon(Icons.Default.MoreVert,contentDescription = stringResource(R.string.content_description_context_menu),- tint = Color.White.copy(alpha = 0.7f),+ tint = AppText.copy(alpha = 0.7f),modifier = Modifier.pressable(0.96f) { onMore() }.size(24.dp),@@ -1179,7 +1300,7 @@ private fun LikedCover(modifier: Modifier) {.clip(RoundedCornerShape(4.dp)).background(Brush.linearGradient(listOf(Color(0xFF450AF5), Color(0xFF8E8EE5), Color(0xFFC4EFD9)))),) {- Icon(Icons.Default.Favorite, contentDescription = null, tint = Color.White, modifier = Modifier.fillMaxWidth(0.4f).aspectRatio(1f))+ Icon(Icons.Default.Favorite, contentDescription = null, tint = AppText, modifier = Modifier.fillMaxWidth(0.4f).aspectRatio(1f))}}@@ -1258,7 +1379,9 @@ object SmartShuffle {val startSong = mixed.first()// Turned on from the player: the song playing goes on where it is, not from its start.val position = fromPositionMs?.takeIf { first != null && it > 0 }- SongPlayer.playSong(startSong.url, contextUri = p.uri, order = mixed.map { "spotify:track:${it.spotifyTrackId}" }, positionMs = position)+ // The song playing going on where it is stays on Spotify; a new play asks the audio-source extensions first.+ SongPlayer.playSong(startSong.url, contextUri = p.uri, order = mixed.map { "spotify:track:${it.spotifyTrackId}" }, positionMs = position,+ songs = mixed, askExtensions = position == null)state.updateSongState(startSong.coverUri, startSong.title, startSong.singer, true, startSong.id, 0, startSong.album)}@@ -1342,14 +1465,14 @@ private fun TrackSortButton(sort: TrackOrder, onSort: (TrackOrder) -> Unit) {Box {Icon(androidx.compose.material.icons.Icons.Default.SwapVert,contentDescription = stringResource(R.string.filter_and_sort_sort_section_title),- tint = if (sort.isCustom) Color.White.copy(alpha = 0.8f) else SpotifyGreen,+ tint = if (sort.isCustom) AppText.copy(alpha = 0.8f) else SpotifyGreen,modifier = Modifier.size(26.dp).pressable(0.9f) { open = true })- androidx.compose.material3.DropdownMenu(expanded = open, onDismissRequest = { open = false }, containerColor = Color(0xFF282828)) {- Text(stringResource(R.string.filter_and_sort_sort_section_title), color = Color(0xFFB3B3B3), fontSize = 13.sp,+ androidx.compose.material3.DropdownMenu(expanded = open, onDismissRequest = { open = false }, containerColor = tone(0xFF282828)) {+ Text(stringResource(R.string.filter_and_sort_sort_section_title), color = AppMuted, fontSize = 13.sp,modifier = Modifier.padding(horizontal = 16.dp, vertical = 6.dp))TrackSort.entries.forEach { option ->androidx.compose.material3.DropdownMenuItem(- text = { Text(stringResource(option.label), color = if (option == sort.sort) SpotifyGreen else Color.White) },+ text = { Text(stringResource(option.label), color = if (option == sort.sort) SpotifyGreen else AppText) },trailingIcon = if (option == sort.sort) { {Icon(if (sort.reversed) Icons.Default.ArrowUpward else Icons.Default.ArrowDownward,contentDescription = null, tint = SpotifyGreen, modifier = Modifier.size(18.dp))@@ -1373,7 +1496,7 @@ private fun SimilarAlbums(navController: NavController, firstTrackId: String, al}if (albums.isEmpty()) returnColumn(Modifier.padding(top = 24.dp)) {- Text(stringResource(R.string.more_like_this), color = Color.White, fontSize = 20.sp, fontWeight = FontWeight.Bold,+ Text(stringResource(R.string.more_like_this), color = AppText, fontSize = 20.sp, fontWeight = FontWeight.Bold,modifier = Modifier.padding(horizontal = 16.dp, vertical = 8.dp))androidx.compose.foundation.lazy.LazyRow(contentPadding = androidx.compose.foundation.layout.PaddingValues(horizontal = 16.dp),@@ -1387,8 +1510,8 @@ private fun SimilarAlbums(navController: NavController, firstTrackId: String, al}) {GlideImage(transition = CrossFade, model = a.images.maxByOrNull { it.width ?: 0 }?.url, contentDescription = null, contentScale = ContentScale.Crop,modifier = Modifier.size(140.dp).clip(RoundedCornerShape(4.dp)))- Text(a.name, color = Color.White, fontSize = 13.sp, maxLines = 1, overflow = TextOverflow.Ellipsis, modifier = Modifier.padding(top = 6.dp))- Text(artists, color = Color(0xFFB3B3B3), fontSize = 12.sp, maxLines = 1, overflow = TextOverflow.Ellipsis)+ Text(a.name, color = AppText, fontSize = 13.sp, maxLines = 1, overflow = TextOverflow.Ellipsis, modifier = Modifier.padding(top = 6.dp))+ Text(artists, color = AppMuted, fontSize = 12.sp, maxLines = 1, overflow = TextOverflow.Ellipsis)}}}diff --git a/base/app/src/main/java/com/music/spotui/ui/screens/DiscoverScreens.kt b/base/app/src/main/java/com/music/spotui/ui/screens/DiscoverScreens.ktindex cd499ee0..81eb01ff 100644--- a/base/app/src/main/java/com/music/spotui/ui/screens/DiscoverScreens.kt+++ b/base/app/src/main/java/com/music/spotui/ui/screens/DiscoverScreens.kt@@ -1,5 +1,9 @@package com.music.spotui.ui.screens+import com.music.spotui.ui.theme.tone+import com.music.spotui.ui.theme.AppText+import com.music.spotui.ui.theme.AppMuted+import androidx.compose.foundation.backgroundimport androidx.compose.foundation.clickableimport androidx.compose.foundation.layout.Arrangement@@ -60,7 +64,7 @@ import com.music.spotui.ui.navigation.albumRouteimport com.music.spotui.ui.theme.AppAccentprivate val Background: Color get() = com.music.spotui.ui.theme.AppBackground-private val Subtle = Color(0xFFB3B3B3)+private val Subtle: androidx.compose.ui.graphics.Color get() = AppMuted@Composableprivate fun ScreenHeader(title: String, navController: NavController) {@@ -71,10 +75,10 @@ private fun ScreenHeader(title: String, navController: NavController) {Icon(imageVector = Icons.AutoMirrored.Filled.ArrowBack,contentDescription = stringResource(R.string.accessibility_navigate_back),- tint = Color.White,+ tint = AppText,modifier = Modifier.size(40.dp).clip(RoundedCornerShape(20.dp)).clickable { navController.popBackStack() }.padding(8.dp),)- Text(title, fontWeight = FontWeight.Bold, color = Color.White, fontSize = 22.sp, maxLines = 1,+ Text(title, fontWeight = FontWeight.Bold, color = AppText, fontSize = 22.sp, maxLines = 1,overflow = TextOverflow.Ellipsis, modifier = Modifier.padding(start = 6.dp))}}@@ -84,7 +88,7 @@ private fun Loading() = com.music.spotui.ui.components.SkeletonList(count = 7)@Composableprivate fun SectionTitle(text: String) =- Text(text, color = Color.White, fontSize = 20.sp, fontWeight = FontWeight.Bold, modifier = Modifier.padding(16.dp, 18.dp, 16.dp, 8.dp))+ Text(text, color = AppText, fontSize = 20.sp, fontWeight = FontWeight.Bold, modifier = Modifier.padding(16.dp, 18.dp, 16.dp, 8.dp))private data class ReleaseTile(val id: String, val name: String, val artists: String, val cover: String, val detail: String)@@ -125,7 +129,7 @@ fun NewReleasesScreen(navController: NavController) {Column(Modifier.clickable { navController.navigate(albumRoute(t.name, t.artists, t.id)) }) {GlideImage(transition = CrossFade, model = t.cover, contentDescription = null, contentScale = ContentScale.Crop,modifier = Modifier.fillMaxWidth().aspectRatio(1f).clip(RoundedCornerShape(6.dp)))- Text(t.name, color = Color.White, fontSize = 13.sp, fontWeight = FontWeight.Bold, lineHeight = 16.sp, minLines = 2, maxLines = 2,+ Text(t.name, color = AppText, fontSize = 13.sp, fontWeight = FontWeight.Bold, lineHeight = 16.sp, minLines = 2, maxLines = 2,overflow = TextOverflow.Ellipsis, modifier = Modifier.padding(top = 6.dp))Text(t.detail.ifBlank { t.artists }, color = Color.Gray, fontSize = 11.sp, maxLines = 1, overflow = TextOverflow.Ellipsis)}@@ -160,7 +164,7 @@ fun EpisodesScreen(navController: NavController) {GlideImage(transition = CrossFade, model = e.coverUri, contentDescription = null, contentScale = ContentScale.Crop,modifier = Modifier.size(56.dp).clip(RoundedCornerShape(6.dp)))Column(Modifier.padding(start = 12.dp).weight(1f)) {- Text(e.title, color = Color.White, fontSize = 15.sp, maxLines = 2, overflow = TextOverflow.Ellipsis)+ Text(e.title, color = AppText, fontSize = 15.sp, maxLines = 2, overflow = TextOverflow.Ellipsis)Text(e.singer + " • " + formatMinutes(e.durationMs / 60_000L), color = Subtle, fontSize = 12.sp, maxLines = 1, overflow = androidx.compose.ui.text.style.TextOverflow.Ellipsis)}}@@ -190,21 +194,24 @@ fun RecapScreen(navController: NavController) {}}val recap = loaded ?: ListenHistory.Recap(0, 0, emptyMap(), emptyList(), emptyList(), emptyList())+ // Spotify's ranking of the account first (the official "Listening stats"), then this phone's counter.+ var tab by androidx.compose.runtime.saveable.rememberSaveable { mutableStateOf(0) }Column(Modifier.fillMaxSize().background(Background).statusBarsPadding()) {ScreenHeader(stringResource(R.string.recap_title), navController)- LazyColumn(contentPadding = PaddingValues(bottom = com.music.spotui.ui.components.bottomBarsSpace())) {+ StatsTabs(tab) { tab = it }+ if (tab == 0) SpotifyStatsTab(navController) else LazyColumn(contentPadding = PaddingValues(bottom = com.music.spotui.ui.components.bottomBarsSpace())) {item {- Row(Modifier.padding(horizontal = 16.dp), horizontalArrangement = Arrangement.spacedBy(8.dp)) {+ Row(Modifier.padding(16.dp, 12.dp, 16.dp, 0.dp), horizontalArrangement = Arrangement.spacedBy(8.dp)) {periods.forEachIndexed { i, (label, _) ->FilterChip(selected = i == period, onClick = { period = i }, label = { Text(stringResource(label)) },colors = FilterChipDefaults.filterChipColors(selectedContainerColor = AppAccent, selectedLabelColor = Color.Black,- labelColor = Color.White, containerColor = Color(0xFF2A2A2A)))+ labelColor = AppText, containerColor = tone(0xFF2A2A2A)))}}}item {Column(Modifier.padding(16.dp, 20.dp)) {- Text(stringResource(R.string.recap_minutes, recap.minutes), color = Color.White, fontSize = 30.sp, fontWeight = FontWeight.Bold)+ Text(stringResource(R.string.recap_minutes, recap.minutes), color = AppText, fontSize = 30.sp, fontWeight = FontWeight.Bold)Text(stringResource(R.string.recap_listens, recap.listens), color = Subtle, fontSize = 14.sp)Spacer(Modifier.height(10.dp))val src = recap.bySource@@ -213,6 +220,7 @@ fun RecapScreen(navController: NavController) {color = Subtle, fontSize = 13.sp)}}+ item { WeeklyMinutesChart() }if (recap.listens == 0) item {Text(stringResource(R.string.recap_empty), color = Subtle, fontSize = 14.sp, modifier = Modifier.padding(16.dp))}@@ -226,7 +234,7 @@ fun RecapScreen(navController: NavController) {GlideImage(transition = CrossFade, model = r.cover, contentDescription = null, contentScale = ContentScale.Crop,modifier = Modifier.size(48.dp).clip(RoundedCornerShape(4.dp)))Column(Modifier.padding(start = 12.dp).weight(1f)) {- Text(r.name, color = Color.White, fontSize = 15.sp, maxLines = 1, overflow = TextOverflow.Ellipsis)+ Text(r.name, color = AppText, fontSize = 15.sp, maxLines = 1, overflow = TextOverflow.Ellipsis)Text(listOf(r.subtitle, stringResource(R.string.recap_plays, r.count)).filter { it.isNotBlank() }.joinToString(" • "),color = Subtle, fontSize = 12.sp, maxLines = 1, overflow = androidx.compose.ui.text.style.TextOverflow.Ellipsis)}diff --git a/base/app/src/main/java/com/music/spotui/ui/screens/DownloadsScreen.kt b/base/app/src/main/java/com/music/spotui/ui/screens/DownloadsScreen.ktindex 933a227f..1ba17fb0 100644--- a/base/app/src/main/java/com/music/spotui/ui/screens/DownloadsScreen.kt+++ b/base/app/src/main/java/com/music/spotui/ui/screens/DownloadsScreen.kt@@ -1,5 +1,10 @@package com.music.spotui.ui.screens+import com.music.spotui.ui.theme.headerTint+import com.music.spotui.ui.theme.tone+import com.music.spotui.ui.theme.AppText+import com.music.spotui.ui.theme.AppMuted+import android.text.format.Formatterimport androidx.compose.foundation.Imageimport androidx.compose.foundation.background@@ -70,6 +75,14 @@ fun DownloadsScreen(navController: NavController) {val title = stringResource(R.string.collection_downloaded)// Snapshot reads: the list follows downloads as they finish.val tracks = OfflineStore.tracks.values.sortedByDescending { it.addedAt }+ // Shown by where they were downloaded from: each album or playlist downloaded as a whole is one+ // row (its songs are on its own page), newest first; the songs downloaded on their own follow.+ val lists = com.music.spotui.data.offline.OfflineCollections.collections.values.mapNotNull { c ->+ val mine = tracks.filter { it.trackId in c.trackIds }+ if (mine.isEmpty()) null else c to mine+ }.sortedByDescending { (_, mine) -> mine.maxOf { it.addedAt } }+ val inLists = lists.flatMapTo(HashSet()) { (_, mine) -> mine.map { it.trackId } }+ val singles = tracks.filter { it.trackId !in inLists }val waiting = OfflineDownloader.requests.values.filter { !OfflineStore.isDownloaded(it.trackId) }// A25: only queued or running songs can be stopped; a failed one has nothing left to cancel.val stoppable = waiting.count {@@ -94,14 +107,14 @@ fun DownloadsScreen(navController: NavController) {modifier = Modifier.fillMaxSize().padding(horizontal = 32.dp),) {Image(painterResource(R.drawable.downloads_cover), null, modifier = Modifier.size(120.dp).clip(RoundedCornerShape(6.dp)))- Text(stringResource(R.string.downloads_empty_title), color = Color.White, fontSize = 22.sp, fontWeight = FontWeight.Bold,+ Text(stringResource(R.string.downloads_empty_title), color = AppText, fontSize = 22.sp, fontWeight = FontWeight.Bold,textAlign = TextAlign.Center, modifier = Modifier.padding(top = 24.dp))- Text(stringResource(R.string.downloads_empty_subtitle), color = Color(0xFFB3B3B3), fontSize = 14.sp,+ Text(stringResource(R.string.downloads_empty_subtitle), color = AppMuted, fontSize = 14.sp,textAlign = TextAlign.Center, modifier = Modifier.padding(top = 8.dp))} else LazyColumn(Modifier.fillMaxSize()) {item {Column(- Modifier.fillMaxWidth().background(Brush.verticalGradient(listOf(Color(0xFF1D6B45), AppBackground)))+ Modifier.fillMaxWidth().background(Brush.verticalGradient(listOf(headerTint(Color(0xFF1D6B45), 0f), AppBackground))).statusBarsPadding().padding(horizontal = 16.dp),) {Spacer(Modifier.height(56.dp))@@ -109,15 +122,15 @@ fun DownloadsScreen(navController: NavController) {painterResource(R.drawable.downloads_cover), null,modifier = Modifier.align(Alignment.CenterHorizontally).size(200.dp).clip(RoundedCornerShape(6.dp)),)- Text(title, color = Color.White, fontSize = 26.sp, fontWeight = FontWeight.Bold, modifier = Modifier.padding(top = 20.dp))+ Text(title, color = AppText, fontSize = 26.sp, fontWeight = FontWeight.Bold, modifier = Modifier.padding(top = 20.dp))val n = tracks.sizeval size = Formatter.formatShortFileSize(context, OfflineStore.totalBytes())Text(pluralStringResource(R.plurals.local_files_count, n, n) + " · " + stringResource(R.string.downloads_size, size),- color = Color(0xFFB3B3B3), fontSize = 14.sp, modifier = Modifier.padding(top = 4.dp))- Text(stringResource(R.string.downloads_source), color = Color(0xFFB3B3B3), fontSize = 12.sp, modifier = Modifier.padding(top = 4.dp))+ color = AppMuted, fontSize = 14.sp, modifier = Modifier.padding(top = 4.dp))+ Text(stringResource(R.string.downloads_source), color = AppMuted, fontSize = 12.sp, modifier = Modifier.padding(top = 4.dp))Row(Modifier.fillMaxWidth().padding(vertical = 12.dp), verticalAlignment = Alignment.CenterVertically) {Spacer(Modifier.weight(1f))- Icon(painterResource(R.drawable.ic_player_shuffle), stringResource(R.string.play_mode_item_shuffle_title), tint = Color.White,+ Icon(painterResource(R.drawable.ic_player_shuffle), stringResource(R.string.play_mode_item_shuffle_title), tint = AppText,modifier = Modifier.size(28.dp).pressable { if (tracks.isNotEmpty()) play(tracks.indices.random(), shuffle = true) })Spacer(Modifier.width(20.dp))Box(@@ -138,14 +151,14 @@ fun DownloadsScreen(navController: NavController) {}}}- // No SpotiFLAC verification: the reliable source is off, say it where downloads fail.- if (!com.music.spotui.data.preferences.hasSpotiflacSession(context)) item(key = "verify") {+ // No extension gives download files: say it where downloads would fail.+ if (!com.music.spotui.extensions.Extensions.hasDownloadSource()) item(key = "source") {Text(- stringResource(R.string.downloads_verify_banner),- color = Color.White, fontSize = 14.sp, lineHeight = 19.sp,+ stringResource(R.string.downloads_need_source),+ color = AppText, fontSize = 14.sp, lineHeight = 19.sp,modifier = Modifier.padding(horizontal = 16.dp, vertical = 8.dp).fillMaxWidth()- .clip(RoundedCornerShape(8.dp)).background(Color(0xFF2A2A2A))- .pressable(0.98f) { navController.navigate(com.music.spotui.ui.navigation.Routes.Spotiflac.route) }+ .clip(RoundedCornerShape(8.dp)).background(tone(0xFF2A2A2A))+ .pressable(0.98f) { navController.navigate(com.music.spotui.ui.navigation.Routes.Extensions.route) }.padding(14.dp),)}@@ -154,17 +167,17 @@ fun DownloadsScreen(navController: NavController) {Row(verticalAlignment = Alignment.CenterVertically,modifier = Modifier.fillMaxWidth().padding(horizontal = 16.dp, vertical = 8.dp)- .clip(RoundedCornerShape(8.dp)).background(Color(0xFF2A2A2A))+ .clip(RoundedCornerShape(8.dp)).background(tone(0xFF2A2A2A)).pressable(0.98f) { OfflineDownloader.stopAll() }.padding(horizontal = 14.dp, vertical = 10.dp),) {Column(Modifier.weight(1f)) {- Text(stringResource(R.string.downloads_stop_all_title), color = Color.White, fontSize = 14.sp)- Text(stringResource(R.string.downloads_stop_all_detail), color = Color(0xFFB3B3B3), fontSize = 12.sp)+ Text(stringResource(R.string.downloads_stop_all_title), color = AppText, fontSize = 14.sp)+ Text(stringResource(R.string.downloads_stop_all_detail), color = AppMuted, fontSize = 12.sp)}Spacer(Modifier.width(12.dp))Icon(Icons.Default.Close, stringResource(R.string.downloads_stop_all_title),- tint = Color.White.copy(alpha = 0.7f), modifier = Modifier.size(20.dp))+ tint = AppText.copy(alpha = 0.7f), modifier = Modifier.size(20.dp))}}// Songs still on their way (or that could not be downloaded).@@ -184,22 +197,61 @@ fun DownloadsScreen(navController: NavController) {modifier = Modifier.size(48.dp).clip(RoundedCornerShape(4.dp)),)Column(Modifier.padding(start = 12.dp).weight(1f)) {- Text(r.title, color = Color.White.copy(alpha = 0.6f), fontSize = 15.sp, maxLines = 1, overflow = TextOverflow.Ellipsis)+ Text(r.title, color = AppText.copy(alpha = 0.6f), fontSize = 15.sp, maxLines = 1, overflow = TextOverflow.Ellipsis)val line = when (status) {OfflineStatus.Unavailable -> stringResource(R.string.download_unavailable)OfflineStatus.Failed -> stringResource(R.string.download_badge_error_content_description) + " · " + stringResource(R.string.download_retry)else -> stringResource(R.string.download_notification_downloading)}- Text(line, color = if (problem) Color(0xFFE22134) else Color(0xFFB3B3B3), fontSize = 13.sp, maxLines = 1, overflow = TextOverflow.Ellipsis)+ Text(line, color = if (problem) Color(0xFFE22134) else AppMuted, fontSize = 13.sp, maxLines = 1, overflow = TextOverflow.Ellipsis)}DownloadBadge(status, size = 20.dp)Spacer(Modifier.width(16.dp))- Icon(Icons.Default.Close, stringResource(R.string.download_cancel), tint = Color.White.copy(alpha = 0.7f),+ Icon(Icons.Default.Close, stringResource(R.string.download_cancel), tint = AppText.copy(alpha = 0.7f),modifier = Modifier.size(24.dp).pressable(0.96f) { OfflineDownloader.cancel(r.trackId) })}}- itemsIndexed(tracks, key = { _, t -> t.trackId }) { i, t ->- val current = LocalPlayer.active.value && np.uri == "local:${OfflineStore.localIdOf(t.trackId)}"+ if (lists.isNotEmpty()) item(key = "lists_title") { SectionTitle(stringResource(R.string.downloads_lists)) }+ items(lists, key = { "l:" + it.first.uri }) { (c, mine) ->+ val kind = when (c.type) {+ "album" -> stringResource(R.string.downloads_kind_album)+ "liked" -> stringResource(R.string.downloads_kind_liked)+ else -> stringResource(R.string.downloads_kind_playlist)+ }+ Row(+ verticalAlignment = Alignment.CenterVertically,+ modifier = Modifier.fillMaxWidth().pressable(0.97f) {+ val id = c.uri.substringAfterLast(":")+ navController.navigate(when (c.type) {+ "album" -> com.music.spotui.ui.navigation.albumRoute(c.name, mine.first().artist, id)+ "liked" -> com.music.spotui.ui.navigation.Routes.Liked.route+ else -> com.music.spotui.ui.navigation.playlistRoute(id, c.name)+ })+ }.padding(horizontal = 16.dp, vertical = 8.dp),+ ) {+ val first = mine.first()+ GlideImage(+ transition = CrossFade,+ model = if (c.type == "album") OfflineStore.coverFile(first) ?: first.coverUrl else first.coverUrl,+ contentDescription = null, contentScale = ContentScale.Crop,+ loading = placeholder(R.drawable.placeholder), failure = placeholder(R.drawable.downloads_cover),+ modifier = Modifier.size(56.dp).clip(RoundedCornerShape(4.dp)),+ )+ Column(Modifier.padding(start = 12.dp).weight(1f)) {+ Text(c.name, color = AppText, fontSize = 15.sp, maxLines = 1, overflow = TextOverflow.Ellipsis)+ Row(verticalAlignment = Alignment.CenterVertically) {+ DownloadBadge(OfflineStatus.Done, size = 14.dp)+ Spacer(Modifier.width(6.dp))+ Text(kind + " · " + pluralStringResource(R.plurals.local_files_count, mine.size, mine.size),+ color = AppMuted, fontSize = 13.sp, maxLines = 1, overflow = TextOverflow.Ellipsis)+ }+ }+ }+ }+ if (lists.isNotEmpty() && singles.isNotEmpty()) item(key = "singles_title") { SectionTitle(stringResource(R.string.downloads_singles)) }+ itemsIndexed(singles, key = { _, t -> t.trackId }) { _, t ->+ val i = tracks.indexOf(t)+ val current = LocalPlayer.active.value && np.uri == "spotify:track:${t.trackId}"com.music.spotui.ui.components.SwipeToRemove(t.trackId, onRemove = {val gone = com.music.spotui.data.offline.OfflineCollections.removeSong(t.trackId)android.widget.Toast.makeText(context, context.getString(if (gone) R.string.toast_undownload else R.string.download_kept_by_list), android.widget.Toast.LENGTH_SHORT).show()@@ -214,14 +266,14 @@ fun DownloadsScreen(navController: NavController) {modifier = Modifier.size(48.dp).clip(RoundedCornerShape(4.dp)),)Column(Modifier.padding(start = 12.dp).weight(1f)) {- Text(t.title, color = if (current) com.music.spotui.ui.theme.AppAccent else Color.White, fontSize = 15.sp, maxLines = 1, overflow = TextOverflow.Ellipsis)+ Text(t.title, color = if (current) com.music.spotui.ui.theme.AppAccent else AppText, fontSize = 15.sp, maxLines = 1, overflow = TextOverflow.Ellipsis)Row(verticalAlignment = Alignment.CenterVertically) {DownloadBadge(OfflineStatus.Done, size = 14.dp)Spacer(Modifier.width(6.dp))- Text(t.artist, color = Color(0xFFB3B3B3), fontSize = 13.sp, maxLines = 1, overflow = TextOverflow.Ellipsis)+ Text(t.artist, color = AppMuted, fontSize = 13.sp, maxLines = 1, overflow = TextOverflow.Ellipsis)}}- Icon(Icons.Default.MoreVert, stringResource(R.string.content_description_context_menu), tint = Color.White.copy(alpha = 0.7f),+ Icon(Icons.Default.MoreVert, stringResource(R.string.content_description_context_menu), tint = AppText.copy(alpha = 0.7f),modifier = Modifier.size(24.dp).pressable(0.96f) { menuSong = OfflineStore.toSong(t) })} }}@@ -230,9 +282,15 @@ fun DownloadsScreen(navController: NavController) {Box(contentAlignment = Alignment.Center,modifier = Modifier.statusBarsPadding().padding(12.dp).size(40.dp).clip(CircleShape)- .background(Color(0x66000000)).pressable { navController.navigateUp() },+ .background(AppBackground.copy(alpha = 0.4f)).pressable { navController.navigateUp() },) {- Icon(Icons.AutoMirrored.Filled.ArrowBack, stringResource(R.string.accessibility_navigate_back), tint = Color.White)+ Icon(Icons.AutoMirrored.Filled.ArrowBack, stringResource(R.string.accessibility_navigate_back), tint = AppText)}}}++@Composable+private fun SectionTitle(text: String) {+ Text(text, color = AppText, fontSize = 18.sp, fontWeight = FontWeight.Bold,+ modifier = Modifier.padding(start = 16.dp, end = 16.dp, top = 16.dp, bottom = 4.dp))+}diff --git a/base/app/src/main/java/com/music/spotui/ui/screens/EpisodeScreen.kt b/base/app/src/main/java/com/music/spotui/ui/screens/EpisodeScreen.ktindex 519805ad..273610b7 100644--- a/base/app/src/main/java/com/music/spotui/ui/screens/EpisodeScreen.kt+++ b/base/app/src/main/java/com/music/spotui/ui/screens/EpisodeScreen.kt@@ -1,5 +1,8 @@package com.music.spotui.ui.screens+import com.music.spotui.ui.theme.headerTint+import com.music.spotui.ui.theme.AppText+import androidx.compose.animation.animateContentSizeimport androidx.compose.foundation.backgroundimport androidx.compose.foundation.clickable@@ -117,7 +120,7 @@ fun EpisodeScreen(navController: NavController, episodeId: String, fallbackName:Column(Modifier.fillMaxWidth()- .background(Brush.verticalGradient(listOf(Color(0xFF34302B), AppBackground)))+ .background(Brush.verticalGradient(listOf(headerTint(Color(0xFF34302B), 0f), AppBackground))).statusBarsPadding(),) {Box(@@ -146,7 +149,7 @@ fun EpisodeScreen(navController: NavController, episodeId: String, fallbackName:Spacer(Modifier.height(18.dp))Text(text = episode?.title?.takeIf { it.isNotBlank() } ?: fallbackName,- color = Color.White,+ color = AppText,fontSize = 24.sp,fontWeight = FontWeight.Bold,maxLines = 3,@@ -172,7 +175,7 @@ fun EpisodeScreen(navController: NavController, episodeId: String, fallbackName:Spacer(Modifier.width(8.dp))Text(text = episode?.singer.orEmpty(),- color = Color.White,+ color = AppText,fontSize = 13.sp,fontWeight = FontWeight.Bold,maxLines = 1,@@ -184,7 +187,7 @@ fun EpisodeScreen(navController: NavController, episodeId: String, fallbackName:val minutes = episodeMinutes(episode?.durationMs ?: 0)Text(text = if (date.isBlank()) minutes else "$date • $minutes",- color = Color.White.copy(alpha = 0.65f),+ color = AppText.copy(alpha = 0.65f),fontSize = 13.sp,modifier = Modifier.padding(horizontal = 16.dp),)@@ -201,14 +204,14 @@ fun EpisodeScreen(navController: NavController, episodeId: String, fallbackName:Icon(Icons.Default.Share,contentDescription = stringResource(R.string.a11y_share),- tint = Color.White.copy(alpha = 0.85f),+ tint = AppText.copy(alpha = 0.85f),modifier = Modifier.size(26.dp).pressable(0.9f) { episode?.let { shareEpisode(context, it) } },)Spacer(Modifier.width(20.dp))Icon(Icons.Default.MoreVert,contentDescription = stringResource(R.string.episode_options),- tint = Color.White.copy(alpha = 0.85f),+ tint = AppText.copy(alpha = 0.85f),modifier = Modifier.size(26.dp).pressable(0.9f) { menuOpen = true },)Spacer(Modifier.weight(1f))@@ -239,7 +242,7 @@ fun EpisodeScreen(navController: NavController, episodeId: String, fallbackName:if (vm.failed.value) item {Text(stringResource(R.string.episode_not_found),- color = Color.White.copy(alpha = 0.7f),+ color = AppText.copy(alpha = 0.7f),fontSize = 14.sp,modifier = Modifier.padding(16.dp),)@@ -261,7 +264,7 @@ fun EpisodeScreen(navController: NavController, episodeId: String, fallbackName:Column(Modifier.fillMaxWidth().animateContentSize(androidx.compose.animation.core.tween(250)).padding(16.dp)) {Text(text = ep.description,- color = Color.White.copy(alpha = 0.78f),+ color = AppText.copy(alpha = 0.78f),fontSize = 14.sp,maxLines = if (expanded) Int.MAX_VALUE else 4,overflow = TextOverflow.Ellipsis,@@ -269,7 +272,7 @@ fun EpisodeScreen(navController: NavController, episodeId: String, fallbackName:Spacer(Modifier.height(6.dp))Text(text = stringResource(if (expanded) R.string.episode_show_less else R.string.episode_show_more),- color = Color.White,+ color = AppText,fontSize = 13.sp,fontWeight = FontWeight.Bold,modifier = Modifier.clickable { expanded = !expanded },@@ -299,7 +302,7 @@ private fun SaveEpisodeButton(saved: Boolean, onClick: () -> Unit) {Icon(Icons.Outlined.Add,contentDescription = stringResource(R.string.episode_save),- tint = Color.White.copy(alpha = 0.85f),+ tint = AppText.copy(alpha = 0.85f),modifier = Modifier.size(28.dp).pressable(0.9f, onClick = onClick),)}diff --git a/base/app/src/main/java/com/music/spotui/ui/screens/ExtensionDetail.kt b/base/app/src/main/java/com/music/spotui/ui/screens/ExtensionDetail.ktnew file mode 100644index 00000000..711c0abf--- /dev/null+++ b/base/app/src/main/java/com/music/spotui/ui/screens/ExtensionDetail.kt@@ -0,0 +1,524 @@+package com.music.spotui.ui.screens++import android.content.Intent+import android.net.Uri+import androidx.compose.foundation.BorderStroke+import androidx.compose.foundation.background+import androidx.compose.foundation.layout.Arrangement+import androidx.compose.foundation.layout.Column+import androidx.compose.foundation.layout.ExperimentalLayoutApi+import androidx.compose.foundation.layout.FlowRow+import androidx.compose.foundation.layout.Row+import androidx.compose.foundation.layout.Spacer+import androidx.compose.foundation.layout.fillMaxWidth+import androidx.compose.foundation.layout.height+import androidx.compose.foundation.layout.padding+import androidx.compose.foundation.layout.width+import androidx.compose.foundation.selection.toggleable+import androidx.compose.foundation.shape.RoundedCornerShape+import androidx.compose.foundation.text.KeyboardOptions+import androidx.compose.material3.AlertDialog+import androidx.compose.material3.OutlinedButton+import androidx.compose.material3.OutlinedTextField+import androidx.compose.material3.RadioButton+import androidx.compose.material3.Text+import androidx.compose.material3.TextButton+import androidx.compose.runtime.Composable+import androidx.compose.runtime.LaunchedEffect+import androidx.compose.runtime.collectAsState+import androidx.compose.runtime.getValue+import androidx.compose.runtime.mutableStateOf+import androidx.compose.runtime.remember+import androidx.compose.runtime.rememberCoroutineScope+import androidx.compose.runtime.setValue+import androidx.compose.ui.Alignment+import androidx.compose.ui.Modifier+import androidx.compose.ui.draw.clip+import androidx.compose.ui.graphics.Color+import androidx.compose.ui.platform.LocalContext+import androidx.compose.ui.res.stringResource+import androidx.compose.ui.semantics.Role+import androidx.compose.ui.text.font.FontFamily+import androidx.compose.ui.text.font.FontWeight+import androidx.compose.ui.text.input.KeyboardType+import androidx.compose.ui.text.input.PasswordVisualTransformation+import androidx.compose.ui.unit.dp+import androidx.compose.ui.unit.sp+import androidx.navigation.NavController+import app.myspoti.engine.R+import app.myspoti.extensions.Ask+import app.myspoti.extensions.Setting+import app.myspoti.extensions.Store+import app.myspoti.extensions.StoreAction+import com.music.spotui.extensions.ExtensionStore+import com.music.spotui.extensions.ExtensionUpdates+import com.music.spotui.extensions.Extensions+import com.music.spotui.extensions.Grants+import com.music.spotui.ui.theme.AppAccent+import com.music.spotui.ui.theme.AppMuted+import com.music.spotui.ui.theme.AppText+import com.music.spotui.ui.theme.tone+import kotlinx.coroutines.launch+import kotlinx.serialization.json.JsonPrimitive+import kotlinx.serialization.json.contentOrNull+import kotlinx.serialization.json.jsonPrimitive++/** Icon, name, author, version and category: the top of both detail pages. */+@Composable+private fun Header(id: String, name: String, author: String, version: String, category: app.myspoti.extensions.Category, iconUrl: String?, iconBytes: ByteArray?) {+ Row(verticalAlignment = Alignment.CenterVertically, modifier = Modifier.fillMaxWidth().padding(horizontal = 20.dp, vertical = 8.dp)) {+ ExtIcon(id, name, iconUrl, iconBytes, 72.dp)+ Column(Modifier.padding(start = 16.dp)) {+ Text(name, color = AppText, fontSize = 22.sp, fontWeight = FontWeight.Bold, maxLines = 2)+ Text(stringResource(R.string.extension_by, author), color = AppMuted, fontSize = 13.sp, maxLines = 1)+ Row(Modifier.padding(top = 4.dp), horizontalArrangement = Arrangement.spacedBy(6.dp)) {+ VersionPill(version)+ ExtPill(stringResource(categoryLabel(category)), AppAccent, AppAccent.copy(alpha = 0.15f))+ }+ }+ }+}++/** Its actions as icons with the author's reasons, critical ones first and highlighted; the warning when there is one. */+@Composable+private fun ActionsList(asks: List<Ask>) {+ ExtSection(R.string.actions_title)+ Column(Modifier.padding(horizontal = 20.dp)) { asks.sortedByDescending { it.critical }.forEach { ActionRow(it) } }+ if (asks.any { it.critical }) Text(stringResource(R.string.actions_critical_warning), color = Warning, fontSize = 12.sp,+ modifier = Modifier.fillMaxWidth().padding(horizontal = 16.dp, vertical = 8.dp).clip(RoundedCornerShape(10.dp)).background(Warning.copy(alpha = 0.10f)).padding(12.dp))+}++@Composable+private fun Line(title: String, detail: String, color: Color) {+ Column(Modifier.fillMaxWidth().padding(horizontal = 20.dp, vertical = 4.dp)) {+ Text(title, color = color, fontSize = 14.sp)+ if (detail.isNotBlank()) Text(detail, color = AppMuted, fontSize = 12.sp)+ }+}++@Composable+private fun Detail(label: Int, value: String, mono: Boolean = false) {+ Row(Modifier.fillMaxWidth().padding(horizontal = 20.dp, vertical = 3.dp)) {+ Text(stringResource(label), color = AppMuted, fontSize = 12.sp, modifier = Modifier.width(110.dp))+ Text(value, color = AppText, fontSize = 12.sp, fontFamily = if (mono) FontFamily.Monospace else FontFamily.Default)+ }+}++@OptIn(ExperimentalLayoutApi::class)+@Composable+private fun Tags(tags: List<String>) {+ if (tags.isEmpty()) return+ FlowRow(Modifier.padding(horizontal = 20.dp, vertical = 6.dp), horizontalArrangement = Arrangement.spacedBy(6.dp), verticalArrangement = Arrangement.spacedBy(6.dp)) {+ tags.forEach { ExtPill("#$it", AppMuted, tone(0xFF2A2A2A)) }+ }+}++@Composable+private fun HomepageButton(url: String?) {+ val ctx = LocalContext.current+ url?.takeIf { it.startsWith("https://") }?.let {+ TextButton(onClick = { runCatching { ctx.startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(it))) } }, modifier = Modifier.padding(horizontal = 8.dp)) {+ Text(stringResource(R.string.extension_homepage), color = AppAccent)+ }+ }+}++// ── A repository's extension, before it is installed ──++@Composable+fun ExtensionEntryScreen(navController: NavController, id: String) {+ val ctx = LocalContext.current+ val scope = rememberCoroutineScope()+ val registry by Extensions.registry.collectAsState()+ val repos by ExtensionStore.repos.collectAsState()+ val busy by ExtensionStore.busy.collectAsState()+ val ratings by ExtensionStore.ratings.collectAsState()+ val downloads by ExtensionStore.downloads.collectAsState()+ LaunchedEffect(registry.repositories) { ExtensionStore.refresh(registry.repositories) }+ val found = Store.newest(ExtensionStore.read())[id]++ Page(null, navController, title = found?.second?.name ?: id) {+ if (found == null) {+ Text(stringResource(R.string.extension_not_listed), color = AppMuted, modifier = Modifier.padding(20.dp))+ return@Page+ }+ val (repo, e) = found+ val installed = registry.find(id)+ val action = Store.action(e, installed?.versionCode, appVersion)+ val m = e.preview()+ Header(e.id, e.name, e.author, e.version, e.category(), iconOf(repo, e), installed?.let { Extensions.pkg(id)?.icon })+ if (e.repo != null) {+ LaunchedEffect(e.repo) { ExtensionStore.loadDownloads(e.repo!!) }+ Row(Modifier.padding(horizontal = 20.dp), verticalAlignment = Alignment.CenterVertically) {+ RatingLine(e.repo?.let { ratings[it] })+ e.repo?.let { downloads[it] }?.let { Text(" · " + stringResource(R.string.extension_downloads, it.toString()), color = AppMuted, fontSize = 11.sp) }+ }+ RateButtons(e.repo!!)+ }+ Column(Modifier.padding(horizontal = 20.dp, vertical = 8.dp)) {+ if (action == StoreAction.INCOMPATIBLE) Text(incompatibleLine(e), color = Warning, fontSize = 13.sp, modifier = Modifier.padding(bottom = 8.dp))+ if (action == StoreAction.UPDATE && installed != null) Text(stringResource(R.string.extension_update_from, installed.version, e.version), color = AppMuted, fontSize = 12.sp, modifier = Modifier.padding(bottom = 6.dp))+ StateButton(action, id in busy, large = true,+ onInstall = { scope.launch { installFromStore(ctx, repo, e) } },+ onOpen = { navController.navigate(installedRoute(id)) })+ }+ if (e.description.isNotBlank()) Text(e.description, color = AppText, fontSize = 14.sp, modifier = Modifier.padding(horizontal = 20.dp, vertical = 4.dp))+ Tags(e.tags)+ if (e.changelog.isNotBlank()) {+ ExtSection(R.string.extension_changelog)+ Text(e.changelog, color = AppText, fontSize = 13.sp, modifier = Modifier.padding(horizontal = 20.dp))+ }+ incompatibleWith(e, registry)?.let { Text(it, color = Warning, fontSize = 13.sp, modifier = Modifier.padding(horizontal = 20.dp, vertical = 4.dp)) }+ ActionsList(m.asks())+ ExtDivider()+ ExtSection(R.string.extension_details)+ e.updatedAt?.let { Detail(R.string.extension_detail_updated, it.take(10)) }+ e.minAppVersion?.let { Detail(R.string.extension_detail_min_app, it) }+ if (e.size > 0) Detail(R.string.extension_detail_size, "${(e.size + 1023) / 1024} KB")+ // What the package will be checked against when it is downloaded (the rest is on the store's list and, once installed, here).+ if (e.sha256.isNotBlank()) Detail(R.string.extension_detail_sha, e.sha256.take(16) + "…", mono = true)+ Row(Modifier.padding(horizontal = 12.dp)) {+ HomepageButton(e.homepage)+ ReportButton(e.id, e.version, e.repo, e.sha256.ifBlank { null })+ }+ Spacer(Modifier.height(com.music.spotui.ui.components.bottomBarsSpace()))+ }+ InstallPrompt()+}++// ── One installed extension's page ──++@Composable+fun ExtensionScreen(navController: NavController, id: String) {+ val ctx = LocalContext.current+ val scope = rememberCoroutineScope()+ val registry by Extensions.registry.collectAsState()+ val errors by Extensions.errors.collectAsState()+ val statuses by Extensions.statuses.collectAsState()+ val logTick by Extensions.logTick.collectAsState()+ val repos by ExtensionStore.repos.collectAsState()+ val busy by ExtensionStore.busy.collectAsState()+ val checking by ExtensionUpdates.checking.collectAsState()+ LaunchedEffect(registry.repositories) { ExtensionStore.refresh(registry.repositories) }+ val e = registry.find(id)+ val pkg = remember(id, e?.sha256) { Extensions.pkg(id) }+ val m = pkg?.manifest+ val pickFile = rememberPackagePicker()+ var uninstall by remember { mutableStateOf(false) }+ val enable = rememberEnabler()++ Page(null, navController, title = e?.name ?: id) {+ if (e == null || m == null) {+ Text(stringResource(R.string.extensions_none), color = AppMuted, modifier = Modifier.padding(20.dp))+ return@Page+ }+ Header(e.id, e.name, e.author, e.version, m.category(), null, pkg.icon)++ if (e.sourceGone) Text(stringResource(R.string.extension_source_gone), color = Warning, fontSize = 12.sp,+ modifier = Modifier.fillMaxWidth().padding(horizontal = 16.dp, vertical = 4.dp).clip(RoundedCornerShape(10.dp)).background(Warning.copy(alpha = 0.10f)).padding(12.dp))+ // A GitHub update that asks more than the user accepted: what it changes, Accept / Keep current.+ // Unticked actions left from before installs granted everything: paused until one OK.+ val refused = Grants.refused(e, m)+ if (refused.isNotEmpty()) RefusedNeedsOk(m.asks().filter { it.key in refused }) {+ scope.launch { Extensions.acceptAll(id); enable(id, true) }+ }+ e.pendingUpdate?.let { p -> UpdateNeedsOk(e.version, p, onAccept = { scope.launch { runCatching { ExtensionUpdates.accept(id) }.onFailure { toastError(ctx, it) } } },+ onKeep = { ExtensionUpdates.keepCurrent(id) }) }++ // An update in a repository: its button right here.+ val listed = Store.newest(ExtensionStore.read())[id]+ if (listed != null && listed.second.versionCode > e.versionCode && e.pendingUpdate == null && e.origin == null) {+ val (repo, entry) = listed+ val action = Store.action(entry, e.versionCode, appVersion)+ Column(+ Modifier.fillMaxWidth().padding(horizontal = 16.dp, vertical = 6.dp).clip(RoundedCornerShape(12.dp)).background(AppAccent.copy(alpha = 0.10f)).padding(12.dp),+ ) {+ Text(stringResource(R.string.extension_update_from, e.version, entry.version), color = AppText, fontSize = 14.sp, fontWeight = FontWeight.SemiBold)+ if (entry.changelog.isNotBlank()) Text(entry.changelog, color = AppMuted, fontSize = 12.sp, maxLines = 4, modifier = Modifier.padding(top = 2.dp))+ if (action == StoreAction.INCOMPATIBLE) Text(incompatibleLine(entry), color = Warning, fontSize = 12.sp, modifier = Modifier.padding(top = 4.dp))+ Spacer(Modifier.height(8.dp))+ StateButton(action, id in busy, onInstall = { scope.launch { installFromStore(ctx, repo, entry) } }, onOpen = {})+ }+ }++ // One state: why it is off, inactive, its last error, else whether it runs.+ val state = stateLine(e, errors[id], statuses[id])+ SwitchRow(+ stringResource(R.string.extension_enabled),+ state?.first ?: stringResource(if (Extensions.isRunning(id)) R.string.extension_running else R.string.extension_not_running),+ e.enabled,+ detailColor = state?.second ?: AppMuted,+ ) { enable(id, it) }+ if (m.description.isNotBlank()) Text(m.description, color = AppText, fontSize = 14.sp, modifier = Modifier.padding(horizontal = 20.dp, vertical = 6.dp))+ Tags(m.tags)+ if (m.changelog.isNotBlank()) {+ ExtSection(R.string.extension_changelog)+ Text(m.changelog, color = AppText, fontSize = 13.sp, modifier = Modifier.padding(horizontal = 20.dp))+ }+ ExtDivider()++ if (Extensions.hasPage(id)) OutlinedButton(onClick = { navController.navigate(extensionPageRoute(id)) }, border = BorderStroke(1.dp, AppAccent.copy(alpha = 0.6f)),+ modifier = Modifier.padding(horizontal = 20.dp, vertical = 4.dp)) { Text(stringResource(R.string.ext_open_page), color = AppAccent) }+ ExtSection(R.string.actions_title)+ Column(Modifier.padding(horizontal = 20.dp)) { m.asks().sortedByDescending { it.critical }.forEach { a -> ActionRow(a) } }+ // Writes allowed for good from a confirmation ("Always"): each one revocable here.+ if (e.rawGrants.isNotEmpty()) {+ Text(stringResource(R.string.ext_grants_title), color = AppText, fontSize = 14.sp, modifier = Modifier.padding(start = 20.dp, end = 20.dp, top = 10.dp))+ Text(stringResource(R.string.ext_grants_note), color = AppMuted, fontSize = 12.sp, modifier = Modifier.padding(horizontal = 20.dp))+ e.rawGrants.forEach { g ->+ Row(Modifier.fillMaxWidth().padding(start = 20.dp, end = 8.dp), verticalAlignment = Alignment.CenterVertically) {+ Text(g.toString(), color = AppText, fontSize = 12.sp, fontFamily = FontFamily.Monospace, modifier = Modifier.weight(1f))+ TextButton(onClick = { Extensions.revokeRawGrant(id, g) }) { Text(stringResource(R.string.ext_grant_revoke), color = Warning) }+ }+ }+ }+ if (m.settings.isNotEmpty()) {+ ExtDivider()+ ExtSection(R.string.extension_settings)+ m.settings.forEach { s -> SettingEditor(id, s) }+ }+ ExtDivider()+ ExtSection(R.string.extension_details)+ Detail(R.string.extension_detail_id, e.id, mono = true)+ Detail(R.string.extension_detail_source, e.source)+ e.origin?.let { o ->+ Detail(R.string.extension_detail_github, o.repo, mono = true)+ Detail(R.string.extension_detail_ref, o.label(), mono = true)+ }+ Detail(R.string.extension_detail_sha, e.sha256.take(16) + "…", mono = true)+ Row(Modifier.padding(horizontal = 12.dp)) {+ if (e.origin != null) TextButton(enabled = id !in checking, onClick = {+ scope.launch {+ val r = ExtensionUpdates.check(id, manual = true)+ android.widget.Toast.makeText(ctx, ctx.getString(checkResult(r)), android.widget.Toast.LENGTH_SHORT).show()+ }+ }) { Text(stringResource(R.string.extension_check_updates), color = AppAccent) }+ e.previous?.let { prev ->+ TextButton(onClick = {+ scope.launch {+ runCatching { ExtensionUpdates.revert(id) }+ .onSuccess { android.widget.Toast.makeText(ctx, ctx.getString(R.string.extension_reverted, prev.version), android.widget.Toast.LENGTH_SHORT).show() }+ .onFailure { toastError(ctx, it) }+ }+ }) { Text(stringResource(R.string.extension_revert, prev.version), color = AppAccent) }+ }+ ReportButton(e.id, e.version, e.origin?.repo, e.sha256)+ }+ Row(Modifier.padding(horizontal = 12.dp)) {+ HomepageButton(m.homepage)+ if (listed != null) TextButton(onClick = { navController.navigate(storeRoute(id)) }) { Text(stringResource(R.string.extension_see_in_store), color = AppAccent) }+ TextButton(onClick = pickFile) { Text(stringResource(R.string.extension_update_file), color = AppAccent) }+ }+ OutlinedButton(onClick = { uninstall = true }, border = BorderStroke(1.dp, Warning.copy(alpha = 0.6f)), modifier = Modifier.padding(horizontal = 20.dp, vertical = 4.dp)) {+ Text(stringResource(R.string.extension_uninstall), color = Warning)+ }+ ExtDivider()++ ExtSection(R.string.extension_log)+ val lines = remember(id, logTick) { Extensions.logLines(id) }+ if (lines.isEmpty()) Text(stringResource(R.string.extension_log_empty), color = AppMuted, fontSize = 12.sp, modifier = Modifier.padding(horizontal = 20.dp))+ lines.takeLast(150).asReversed().forEach {+ Text(it, color = AppMuted, fontSize = 11.sp, fontFamily = FontFamily.Monospace, modifier = Modifier.padding(horizontal = 20.dp, vertical = 1.dp))+ }+ if (lines.isNotEmpty()) TextButton(onClick = { Extensions.clearLog(id) }, modifier = Modifier.padding(horizontal = 12.dp)) {+ Text(stringResource(R.string.extension_log_clear), color = AppAccent)+ }+ Spacer(Modifier.height(com.music.spotui.ui.components.bottomBarsSpace()))+ }++ if (uninstall && e != null) AlertDialog(+ onDismissRequest = { uninstall = false },+ containerColor = tone(0xFF282828),+ text = { Text(stringResource(R.string.extension_uninstall_confirm, e.name), color = AppText) },+ confirmButton = {+ TextButton(onClick = {+ uninstall = false+ scope.launch { Extensions.uninstall(id); navController.popBackStack() }+ }) { Text(stringResource(R.string.extension_uninstall), color = Warning) }+ },+ dismissButton = { TextButton(onClick = { uninstall = false }) { Text(stringResource(R.string.extensions_cancel), color = AppText) } },+ )+ InstallPrompt()+}++/** One of the extension's options (manifest `settings`), saved as JSON as it changes. */+@Composable+private fun SettingEditor(id: String, s: Setting) {+ val stored = remember(id, s.key) { Extensions.settingValues(id)[s.key] }+ val initial = (stored?.let { runCatching { kotlinx.serialization.json.Json.parseToJsonElement(it) }.getOrNull() } ?: s.default)+ ?.let { runCatching { it.jsonPrimitive.contentOrNull }.getOrNull() }.orEmpty()+ var value by remember(id, s.key) { mutableStateOf(initial) }+ fun save(v: String) {+ value = v+ val json = when (s.type) {+ "toggle" -> JsonPrimitive(v == "true").toString()+ "number" -> v.toLongOrNull()?.let { JsonPrimitive(it).toString() } ?: v.toDoubleOrNull()?.let { JsonPrimitive(it).toString() }+ else -> JsonPrimitive(v).toString()+ }+ Extensions.setSetting(id, s.key, json)+ }+ when (s.type) {+ "toggle" -> SwitchRow(s.label, s.description, value == "true") { save(it.toString()) }+ "button" -> Column(Modifier.padding(horizontal = 20.dp, vertical = 6.dp)) {+ OutlinedButton(onClick = { Extensions.pressSetting(id, s.key) }, border = BorderStroke(1.dp, AppAccent.copy(alpha = 0.6f))) { Text(s.label, color = AppAccent) }+ if (s.description.isNotBlank()) Text(s.description, color = AppMuted, fontSize = 12.sp)+ }+ "choice" -> Column(Modifier.padding(horizontal = 20.dp, vertical = 6.dp)) {+ Text(s.label, color = AppText, fontSize = 16.sp)+ if (s.description.isNotBlank()) Text(s.description, color = AppMuted, fontSize = 12.sp)+ s.options.forEach { o ->+ Row(verticalAlignment = Alignment.CenterVertically, modifier = Modifier.fillMaxWidth().toggleable(value == o, role = Role.RadioButton) { save(o) }) {+ RadioButton(selected = value == o, onClick = null)+ Text(o, color = AppText, modifier = Modifier.padding(start = 8.dp))+ }+ }+ }+ else -> Column(Modifier.padding(horizontal = 20.dp, vertical = 6.dp)) {+ OutlinedTextField(+ value = value,+ onValueChange = ::save,+ label = { Text(s.label) },+ singleLine = true,+ visualTransformation = if (s.type == "secret") PasswordVisualTransformation() else androidx.compose.ui.text.input.VisualTransformation.None,+ keyboardOptions = KeyboardOptions(keyboardType = when (s.type) { "number" -> KeyboardType.Number; "secret" -> KeyboardType.Password; else -> KeyboardType.Text }),+ modifier = Modifier.fillMaxWidth(),+ )+ if (s.description.isNotBlank()) Text(s.description, color = AppMuted, fontSize = 12.sp)+ }+ }+}++// ── GitHub: the update card, report, rating ──++/** The toast after "Check for updates". */+private fun checkResult(r: ExtensionUpdates.Result): Int = when (r) {+ ExtensionUpdates.Result.UP_TO_DATE, ExtensionUpdates.Result.NOT_FROM_GITHUB -> R.string.extension_check_up_to_date+ ExtensionUpdates.Result.APPLIED -> R.string.extension_check_applied+ ExtensionUpdates.Result.NEEDS_OK -> R.string.extension_check_needs_ok+ ExtensionUpdates.Result.DECLINED -> R.string.extension_check_declined+ ExtensionUpdates.Result.SOURCE_GONE -> R.string.extension_source_gone+ ExtensionUpdates.Result.INCOMPATIBLE -> R.string.extension_check_incompatible+ ExtensionUpdates.Result.BLOCKED -> R.string.extension_check_blocked+ ExtensionUpdates.Result.FAILED -> R.string.extension_check_failed+}++/**+ * "Update needs your OK": a newer version asks what the user has not accepted. Only what changes+ * is listed, with its icon and the author's (new) reason, then the one tick before Accept; the+ * old version runs until then.+ * A protected surface, like the install prompt.+ */+@Composable+private fun UpdateNeedsOk(from: String, p: com.music.spotui.extensions.PendingUpdate, onAccept: () -> Unit, onKeep: () -> Unit) {+ com.music.spotui.extensions.ProtectedSurfaceEffect(app.myspoti.extensions.ProtectedSurface.INSTALL)+ val critical = p.changes.any { it.critical }+ val tint = if (critical) Warning else AppAccent+ Column(Modifier.fillMaxWidth().padding(horizontal = 16.dp, vertical = 6.dp).clip(RoundedCornerShape(12.dp)).background(tint.copy(alpha = 0.10f)).padding(12.dp)) {+ Text(stringResource(R.string.extension_update_needs_ok, from, p.kept.version), color = AppText, fontSize = 14.sp, fontWeight = FontWeight.SemiBold)+ Text(stringResource(R.string.extension_update_needs_ok_body), color = AppMuted, fontSize = 12.sp, modifier = Modifier.padding(top = 2.dp, bottom = 6.dp))+ p.changes.forEach { c -> ChangeRow(c) }+ if (p.changelog.isNotBlank()) Text(p.changelog, color = AppMuted, fontSize = 12.sp, maxLines = 4, modifier = Modifier.padding(top = 4.dp))+ if (critical) Text(stringResource(R.string.actions_critical_warning), color = Warning, fontSize = 12.sp, modifier = Modifier.padding(top = 6.dp))+ var risk by remember(p) { mutableStateOf(false) }+ RiskBox(risk) { risk = it }+ Row(Modifier.padding(top = 6.dp)) {+ TextButton(enabled = risk, onClick = onAccept) { Text(stringResource(R.string.extension_update_accept), color = if (risk) tint else AppMuted) }+ TextButton(onClick = onKeep) { Text(stringResource(R.string.extension_update_keep), color = AppText) }+ }+ }+}++/**+ * An extension installed when the prompt let the user untick actions, and some were: it is paused+ * until the user accepts all it lists, once, with the same tick as the install prompt.+ */+@Composable+private fun RefusedNeedsOk(refused: List<Ask>, onAccept: () -> Unit) {+ com.music.spotui.extensions.ProtectedSurfaceEffect(app.myspoti.extensions.ProtectedSurface.INSTALL)+ Column(Modifier.fillMaxWidth().padding(horizontal = 16.dp, vertical = 6.dp).clip(RoundedCornerShape(12.dp)).background(Warning.copy(alpha = 0.10f)).padding(12.dp)) {+ Text(stringResource(R.string.extension_refused_title), color = AppText, fontSize = 14.sp, fontWeight = FontWeight.SemiBold)+ Text(stringResource(R.string.extension_refused_body), color = AppMuted, fontSize = 12.sp, modifier = Modifier.padding(top = 2.dp, bottom = 6.dp))+ refused.sortedByDescending { it.critical }.forEach { ActionRow(it) }+ if (refused.any { it.critical }) Text(stringResource(R.string.actions_critical_warning), color = Warning, fontSize = 12.sp, modifier = Modifier.padding(top = 6.dp))+ var risk by remember { mutableStateOf(false) }+ RiskBox(risk) { risk = it }+ TextButton(enabled = risk, onClick = onAccept, modifier = Modifier.padding(top = 6.dp)) {+ Text(stringResource(R.string.extension_update_accept), color = if (risk) Warning else AppMuted)+ }+ }+}++@Composable+private fun ChangeRow(c: app.myspoti.extensions.Change) {+ val action = c.action+ val ask = app.myspoti.extensions.Ask(if (c.kind == app.myspoti.extensions.Change.Kind.HOST && c.key == "*") app.myspoti.extensions.Action.NETWORK_ANY else action?.key ?: c.key,+ if (c.critical) app.myspoti.extensions.Level.CRITICAL else app.myspoti.extensions.Level.NORMAL, c.why, action = action)+ val label = action?.let { stringResource(com.music.spotui.extensions.askLabel(ask)) } ?: c.key+ val title = when (c.kind) {+ app.myspoti.extensions.Change.Kind.ACTION -> stringResource(R.string.extension_change_action, label)+ app.myspoti.extensions.Change.Kind.HOST -> stringResource(R.string.extension_change_host, if (c.key == "*") stringResource(R.string.extension_change_any_host) else c.key)+ app.myspoti.extensions.Change.Kind.WRITE -> stringResource(R.string.extension_change_write, c.key)+ app.myspoti.extensions.Change.Kind.EXCLUSIVE -> stringResource(R.string.extension_change_exclusive, label)+ app.myspoti.extensions.Change.Kind.WHY -> stringResource(R.string.extension_change_why, label)+ app.myspoti.extensions.Change.Kind.REPO -> stringResource(R.string.extension_change_repo, c.key, c.before)+ app.myspoti.extensions.Change.Kind.AUTHOR -> stringResource(R.string.extension_change_author, c.key, c.before)+ app.myspoti.extensions.Change.Kind.REPLACES -> stringResource(R.string.extension_change_replaces, c.key)+ app.myspoti.extensions.Change.Kind.CONFLICTS -> stringResource(R.string.extension_change_conflicts, c.key)+ }+ Row(verticalAlignment = Alignment.CenterVertically, modifier = Modifier.fillMaxWidth().padding(vertical = 4.dp)) {+ ActionTile(ask, 32.dp)+ Column(Modifier.padding(start = 10.dp)) {+ Text(title, color = if (c.critical) Warning else AppText, fontSize = 13.sp, fontWeight = FontWeight.SemiBold)+ if (c.why.isNotBlank()) Text("“${c.why}”", color = AppText, fontSize = 12.sp)+ if (c.kind == app.myspoti.extensions.Change.Kind.WHY && c.before.isNotBlank()) Text(stringResource(R.string.extension_change_was, c.before), color = AppMuted, fontSize = 11.sp)+ }+ }+}++/** Opens a prefilled report on the official repository in the browser (no account in the app). */+@Composable+private fun ReportButton(id: String, version: String, repo: String?, sha256: String?) {+ val ctx = LocalContext.current+ TextButton(onClick = { runCatching { ctx.startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(app.myspoti.extensions.GitHub.reportUrl(id, version, repo, sha256)))) } }) {+ Text(stringResource(R.string.extension_report), color = Warning)+ }+}++/** 👍 / 👎 on the extension's ratings issue; hidden while the GitHub OAuth app is not set ([app.myspoti.extensions.GitHubAuth.enabled]). */+@Composable+private fun RateButtons(repo: String) {+ if (!app.myspoti.extensions.GitHubAuth.enabled) return+ val ctx = LocalContext.current+ val scope = rememberCoroutineScope()+ val ratings by ExtensionStore.ratings.collectAsState()+ val signIn by ExtensionStore.signIn.collectAsState()+ if ((ratings[repo]?.issue ?: 0) <= 0) return+ fun rate(up: Boolean) = scope.launch {+ runCatching { ExtensionStore.rate(repo, up) }+ .onSuccess { android.widget.Toast.makeText(ctx, ctx.getString(R.string.extension_rated), android.widget.Toast.LENGTH_SHORT).show() }+ .onFailure { toastError(ctx, it) }+ }+ Row(Modifier.padding(horizontal = 12.dp)) {+ TextButton(onClick = { rate(true) }) { Text("👍 " + stringResource(R.string.extension_rate_up), color = AppAccent) }+ TextButton(onClick = { rate(false) }) { Text("👎 " + stringResource(R.string.extension_rate_down), color = AppMuted) }+ }+ signIn?.let { code ->+ AlertDialog(+ onDismissRequest = { ExtensionStore.signIn.value = null },+ containerColor = tone(0xFF282828),+ title = { Text(stringResource(R.string.extension_signin_title), color = AppText) },+ text = {+ Column {+ Text(stringResource(R.string.extension_signin_body, code.verificationUri), color = AppMuted, fontSize = 13.sp)+ Text(code.userCode, color = AppText, fontSize = 26.sp, fontWeight = FontWeight.Bold, fontFamily = FontFamily.Monospace, modifier = Modifier.padding(top = 10.dp))+ }+ },+ confirmButton = {+ TextButton(onClick = { runCatching { ctx.startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(code.verificationUri))) } }) {+ Text(stringResource(R.string.extension_signin_open), color = AppAccent)+ }+ },+ dismissButton = { TextButton(onClick = { ExtensionStore.signIn.value = null }) { Text(stringResource(R.string.extensions_cancel), color = AppText) } },+ )+ }+}diff --git a/base/app/src/main/java/com/music/spotui/ui/screens/ExtensionPage.kt b/base/app/src/main/java/com/music/spotui/ui/screens/ExtensionPage.ktnew file mode 100644index 00000000..33418764--- /dev/null+++ b/base/app/src/main/java/com/music/spotui/ui/screens/ExtensionPage.kt@@ -0,0 +1,169 @@+package com.music.spotui.ui.screens++import android.annotation.SuppressLint+import android.view.View+import android.webkit.CookieManager+import android.webkit.JavascriptInterface+import android.webkit.WebResourceRequest+import android.webkit.WebResourceResponse+import android.webkit.WebSettings+import android.webkit.WebView+import android.webkit.WebViewClient+import androidx.compose.foundation.background+import androidx.compose.foundation.layout.Box+import androidx.compose.foundation.layout.Column+import androidx.compose.foundation.layout.Row+import androidx.compose.foundation.layout.fillMaxSize+import androidx.compose.foundation.layout.fillMaxWidth+import androidx.compose.foundation.layout.navigationBarsPadding+import androidx.compose.foundation.layout.padding+import androidx.compose.foundation.layout.statusBarsPadding+import androidx.compose.material.icons.Icons+import androidx.compose.material.icons.automirrored.filled.ArrowBack+import androidx.compose.material3.CircularProgressIndicator+import androidx.compose.material3.Icon+import androidx.compose.material3.IconButton+import androidx.compose.material3.Text+import androidx.compose.runtime.Composable+import androidx.compose.runtime.DisposableEffect+import androidx.compose.runtime.collectAsState+import androidx.compose.runtime.getValue+import androidx.compose.runtime.produceState+import androidx.compose.runtime.remember+import androidx.compose.ui.Alignment+import androidx.compose.ui.Modifier+import androidx.compose.ui.res.stringResource+import androidx.compose.ui.text.font.FontWeight+import androidx.compose.ui.text.style.TextOverflow+import androidx.compose.ui.unit.dp+import androidx.compose.ui.unit.sp+import androidx.compose.ui.viewinterop.AndroidView+import androidx.navigation.NavController+import app.myspoti.engine.R+import app.myspoti.extensions.Action+import app.myspoti.extensions.PageContent+import app.myspoti.extensions.PageNetwork+import app.myspoti.extensions.SurfaceGuard+import com.music.spotui.extensions.Extensions+import com.music.spotui.ui.theme.AppAccent+import com.music.spotui.ui.theme.AppBackground+import com.music.spotui.ui.theme.AppMuted+import com.music.spotui.ui.theme.AppText+import java.io.ByteArrayInputStream+import java.net.HttpURLConnection+import java.net.URL++internal fun extensionPageRoute(id: String) = "extension-page/${android.net.Uri.encode(id)}"++/**+ * An extension's own page (webview.page, critical): its HTML in a WebView the app locks down.+ * No file or content access, no navigation, no new windows, no storage, no cookies: what the page+ * loads is fetched by the app, GET over https from the hosts its network action lists, never a+ * local or Spotify address ([PageNetwork]), with a content policy on top. The only bridge is+ * `MyspotiPage.postMessage(text)`, to its own extension; answers come back as `message` events.+ * It is drawn in the app's page (dialogs, the protected ones included, are above it) and hidden+ * while a protected surface is on screen.+ */+@SuppressLint("SetJavaScriptEnabled", "JavascriptInterface")+@Composable+fun ExtensionPageScreen(navController: NavController, id: String) {+ val registry by Extensions.registry.collectAsState()+ val e = registry.find(id)+ val m = remember(id, e?.sha256) { Extensions.manifest(id) }+ val loaded by produceState<Result<PageContent?>?>(null, id) { value = runCatching { Extensions.page(id) } }+ val shield by SurfaceGuard.app.state.collectAsState()+ val granted = e?.granted.orEmpty()+ val hosts = m?.hosts().orEmpty()+ val network = Action.NETWORK.key in granted+ val any = Action.NETWORK_ANY in granted++ Column(Modifier.fillMaxSize().background(AppBackground).statusBarsPadding()) {+ Row(verticalAlignment = Alignment.CenterVertically, modifier = Modifier.fillMaxWidth().padding(4.dp)) {+ IconButton(onClick = { navController.popBackStack() }) {+ Icon(Icons.AutoMirrored.Filled.ArrowBack, contentDescription = stringResource(R.string.accessibility_navigate_back), tint = AppText)+ }+ Column {+ Text(loaded?.getOrNull()?.title ?: e?.name ?: id, color = AppText, fontSize = 20.sp, fontWeight = FontWeight.Bold, maxLines = 1, overflow = TextOverflow.Ellipsis)+ Text(stringResource(R.string.ext_from, e?.name ?: id), color = AppMuted, fontSize = 12.sp, maxLines = 1)+ }+ }+ Box(Modifier.fillMaxWidth().weight(1f).navigationBarsPadding()) {+ val page = loaded?.getOrNull()+ when {+ loaded == null -> CircularProgressIndicator(Modifier.align(Alignment.Center), color = AppAccent)+ page == null -> Text(stringResource(R.string.ext_page_failed), color = AppMuted, modifier = Modifier.padding(20.dp))+ else -> {+ val html = remember(page) { PageNetwork.wrap(page.html, PageNetwork.csp(hosts, network, any)) }+ val web = remember { arrayOfNulls<WebView>(1) }+ AndroidView(+ modifier = Modifier.fillMaxSize(),+ factory = { ctx ->+ WebView(ctx).apply {+ web[0] = this+ settings.javaScriptEnabled = true+ settings.allowFileAccess = false+ settings.allowContentAccess = false+ settings.domStorageEnabled = false+ settings.setGeolocationEnabled(false)+ settings.javaScriptCanOpenWindowsAutomatically = false+ settings.setSupportMultipleWindows(false)+ settings.mediaPlaybackRequiresUserGesture = true+ settings.mixedContentMode = WebSettings.MIXED_CONTENT_NEVER_ALLOW+ settings.cacheMode = WebSettings.LOAD_NO_CACHE+ CookieManager.getInstance().setAcceptThirdPartyCookies(this, false)+ setBackgroundColor(android.graphics.Color.BLACK)+ webViewClient = SandboxClient(hosts, network, any)+ addJavascriptInterface(PageBridge(id), "MyspotiPage")+ Extensions.attachPage(id) { json -> evaluateJavascript("window.dispatchEvent(new MessageEvent('message', { data: $json }));", null) }+ loadDataWithBaseURL(null, html, "text/html", "utf-8", null)+ }+ },+ update = { wv ->+ if (shield.isNotEmpty()) { wv.onPause(); wv.visibility = View.INVISIBLE } else { wv.onResume(); wv.visibility = View.VISIBLE }+ },+ )+ DisposableEffect(id) {+ onDispose {+ Extensions.attachPage(id, null)+ web[0]?.destroy()+ }+ }+ }+ }+ }+ }+}++/** The page's one door: a message to its own extension. */+private class PageBridge(private val id: String) {+ @JavascriptInterface+ fun postMessage(data: String) = Extensions.pageMessage(id, data)+}++/** No navigation; every load checked by [PageNetwork] and fetched here, without cookies. */+private class SandboxClient(private val hosts: List<String>, private val network: Boolean, private val any: Boolean) : WebViewClient() {+ override fun shouldOverrideUrlLoading(view: WebView, request: WebResourceRequest): Boolean = true++ override fun shouldInterceptRequest(view: WebView, request: WebResourceRequest): WebResourceResponse? {+ val url = request.url.toString()+ if (url.startsWith("data:") || url.startsWith("about:")) return null+ if (com.music.spotui.data.DataSaver.active || !PageNetwork.allows(url, request.method, hosts, network, any)) return refused()+ return runCatching {+ val c = URL(url).openConnection() as HttpURLConnection+ c.instanceFollowRedirects = false+ c.useCaches = false+ c.connectTimeout = 10_000; c.readTimeout = 15_000+ c.setRequestProperty("User-Agent", "Myspoti-Extension-Page/1")+ val status = c.responseCode+ if (status !in 200..299) { c.disconnect(); return refused() }+ val type = c.contentType?.substringBefore(';')?.trim() ?: "application/octet-stream"+ val charset = c.contentType?.substringAfter("charset=", "")?.trim()?.ifBlank { null }+ if (c.contentLengthLong > 8L * 1024 * 1024) { c.disconnect(); return refused() }+ val bytes = c.inputStream.use { s -> s.readBytes() }+ c.disconnect()+ WebResourceResponse(type, charset, status, "OK", mapOf("Access-Control-Allow-Origin" to "*"), ByteArrayInputStream(bytes))+ }.getOrElse { refused() }+ }++ private fun refused() = WebResourceResponse("text/plain", "utf-8", 403, "Refused", emptyMap(), ByteArrayInputStream(ByteArray(0)))+}diff --git a/base/app/src/main/java/com/music/spotui/ui/screens/ExtensionParts.kt b/base/app/src/main/java/com/music/spotui/ui/screens/ExtensionParts.ktnew file mode 100644index 00000000..d16f19cd--- /dev/null+++ b/base/app/src/main/java/com/music/spotui/ui/screens/ExtensionParts.kt@@ -0,0 +1,522 @@+package com.music.spotui.ui.screens++import android.content.Context+import android.graphics.BitmapFactory+import android.net.Uri+import android.widget.Toast+import androidx.activity.compose.rememberLauncherForActivityResult+import androidx.activity.result.contract.ActivityResultContracts+import androidx.compose.foundation.BorderStroke+import androidx.compose.foundation.Image+import androidx.compose.foundation.background+import androidx.compose.foundation.border+import androidx.compose.foundation.layout.Arrangement+import androidx.compose.foundation.layout.Box+import androidx.compose.foundation.layout.Column+import androidx.compose.foundation.layout.ExperimentalLayoutApi+import androidx.compose.foundation.layout.FlowRow+import androidx.compose.foundation.layout.PaddingValues+import androidx.compose.foundation.layout.Row+import androidx.compose.foundation.layout.fillMaxSize+import androidx.compose.foundation.layout.fillMaxWidth+import androidx.compose.foundation.layout.height+import androidx.compose.foundation.layout.heightIn+import androidx.compose.foundation.layout.navigationBarsPadding+import androidx.compose.foundation.layout.padding+import androidx.compose.foundation.layout.size+import androidx.compose.foundation.layout.statusBarsPadding+import androidx.compose.foundation.layout.widthIn+import androidx.compose.foundation.rememberScrollState+import androidx.compose.foundation.selection.toggleable+import androidx.compose.foundation.shape.CircleShape+import androidx.compose.foundation.shape.RoundedCornerShape+import androidx.compose.foundation.text.KeyboardOptions+import androidx.compose.foundation.verticalScroll+import androidx.compose.material.icons.Icons+import androidx.compose.material.icons.automirrored.filled.ArrowBack+import androidx.compose.material3.AlertDialog+import androidx.compose.material3.Button+import androidx.compose.material3.ButtonDefaults+import androidx.compose.material3.Checkbox+import androidx.compose.material3.CheckboxDefaults+import androidx.compose.material3.CircularProgressIndicator+import androidx.compose.material3.FilledTonalButton+import androidx.compose.material3.HorizontalDivider+import androidx.compose.material3.Icon+import androidx.compose.material3.IconButton+import androidx.compose.material3.OutlinedButton+import androidx.compose.material3.OutlinedTextField+import androidx.compose.material3.Switch+import androidx.compose.material3.Text+import androidx.compose.material3.TextButton+import androidx.compose.runtime.Composable+import androidx.compose.runtime.collectAsState+import androidx.compose.runtime.getValue+import androidx.compose.runtime.mutableStateMapOf+import androidx.compose.runtime.mutableStateOf+import androidx.compose.runtime.remember+import androidx.compose.runtime.rememberCoroutineScope+import androidx.compose.runtime.setValue+import androidx.compose.ui.Alignment+import androidx.compose.ui.Modifier+import androidx.compose.ui.draw.clip+import androidx.compose.ui.graphics.Color+import androidx.compose.ui.graphics.asImageBitmap+import androidx.compose.ui.layout.ContentScale+import androidx.compose.ui.platform.LocalContext+import androidx.compose.ui.res.stringResource+import androidx.compose.ui.semantics.Role+import androidx.compose.ui.text.font.FontFamily+import androidx.compose.ui.text.font.FontWeight+import androidx.compose.ui.text.input.KeyboardType+import androidx.compose.ui.text.style.TextOverflow+import androidx.compose.ui.unit.Dp+import androidx.compose.ui.unit.dp+import androidx.compose.ui.unit.sp+import androidx.navigation.NavController+import app.myspoti.engine.R+import app.myspoti.extensions.Ask+import app.myspoti.extensions.Catalog+import app.myspoti.extensions.Category+import app.myspoti.extensions.ExtensionPackage+import app.myspoti.extensions.Clash+import app.myspoti.extensions.Manifest+import app.myspoti.extensions.ProtectedSurface+import com.music.spotui.extensions.ProtectedSurfaceEffect+import com.music.spotui.extensions.actionIcon+import com.music.spotui.extensions.actionLabel+import com.music.spotui.extensions.askLabel+import app.myspoti.extensions.StoreAction+import com.bumptech.glide.integration.compose.ExperimentalGlideComposeApi+import com.bumptech.glide.integration.compose.GlideImage+import com.music.spotui.extensions.ExtensionStore+import com.music.spotui.extensions.Extensions+import com.music.spotui.extensions.Grants+import com.music.spotui.extensions.InstallPlan+import com.music.spotui.ui.theme.AppAccent+import com.music.spotui.ui.theme.AppBackground+import com.music.spotui.ui.theme.AppMuted+import com.music.spotui.ui.theme.AppText+import com.music.spotui.ui.theme.tone+import kotlinx.coroutines.Dispatchers+import kotlinx.coroutines.flow.MutableStateFlow+import kotlinx.coroutines.launch+import kotlinx.coroutines.withContext++// The pieces the extension screens share: the install prompt (the trust model: what it asks, the+// clashes, the third-party notice and the one tick that the user installs at their own risk), the+// store row's icon, pill, action icons and button.++/** The colour of a critical action: the user reads it before ticking that they accept the risk. */+internal val Warning = Color(0xFFFFA42B)++/** This Myspoti's version name, compared with an extension's `minAppVersion`. */+internal val appVersion: String get() = app.myspoti.engine.BuildConfig.VERSION_NAME++/** A package read and waiting for the user's answer in the install prompt; [origin]: its GitHub source. */+internal class PendingInstall(val zip: ByteArray, val pkg: ExtensionPackage, val source: String, val plan: InstallPlan, val origin: app.myspoti.extensions.Origin? = null)++internal val pending = MutableStateFlow<PendingInstall?>(null)++internal fun toastError(ctx: Context, t: Throwable) =+ Toast.makeText(ctx, ctx.getString(R.string.extensions_error, t.message ?: t.toString()), Toast.LENGTH_LONG).show()++/** Reads [zip] and opens the install prompt; a refused package says why. */+internal fun offer(ctx: Context, zip: ByteArray, source: String, origin: app.myspoti.extensions.Origin? = null) {+ runCatching { ExtensionPackage.read(zip) }+ .onSuccess { p -> pending.value = PendingInstall(zip, p, source, Extensions.plan(p), origin) }+ .onFailure { toastError(ctx, it) }+}++/** Downloads a repository's package for [entry] (a spinner on its button meanwhile), then the prompt. */+internal suspend fun installFromStore(ctx: Context, repo: String, entry: Catalog.Entry) {+ ExtensionStore.busy.value = ExtensionStore.busy.value + entry.id+ runCatching { Extensions.fetch(repo, entry) }+ .onSuccess { f -> offer(ctx, f.zip, f.origin?.let { "https://github.com/${it.repo}" } ?: repo, f.origin) }+ .onFailure { toastError(ctx, it) }+ ExtensionStore.busy.value = ExtensionStore.busy.value - entry.id+}++/** The system file picker, for a package (.zip). */+@Composable+internal fun rememberPackagePicker(): () -> Unit {+ val ctx = LocalContext.current+ val scope = rememberCoroutineScope()+ val launcher = rememberLauncherForActivityResult(ActivityResultContracts.OpenDocument()) { uri: Uri? ->+ if (uri == null) return@rememberLauncherForActivityResult+ scope.launch {+ val bytes = withContext(Dispatchers.IO) {+ runCatching {+ ctx.contentResolver.openInputStream(uri)?.use { s ->+ val out = java.io.ByteArrayOutputStream()+ val buf = ByteArray(16 * 1024)+ while (out.size() <= ExtensionPackage.MAX_ZIP) { val n = s.read(buf); if (n < 0) break; out.write(buf, 0, n) }+ out.toByteArray()+ }+ }.getOrNull()+ }+ if (bytes == null) Toast.makeText(ctx, ctx.getString(R.string.extensions_error, "unreadable file"), Toast.LENGTH_LONG).show()+ else offer(ctx, bytes, "file")+ }+ }+ return { launcher.launch(arrayOf("application/zip", "application/x-zip-compressed", "application/octet-stream")) }+}++// ── The install prompt ──++/**+ * What the user accepts before an extension is installed or updated (docs/extensions/API.md §4):+ * its name, author and source, every action it lists with the author's reason (critical ones+ * marked; an update lists only what changes), what it would collide with, the third-party notice+ * and one tick: all or nothing, there is no action to untick. An update that asks nothing new of+ * an extension already accepted is applied with the same tap.+ * A protected surface: no extension draws or acts over it.+ */+@Composable+internal fun InstallPrompt() {+ val p = pending.collectAsState().value ?: return+ ProtectedSurfaceEffect(ProtectedSurface.INSTALL)+ val ctx = LocalContext.current+ val scope = rememberCoroutineScope()+ val registry by Extensions.registry.collectAsState()+ val m = p.pkg.manifest+ val plan = p.plan+ var risk by remember(p) { mutableStateOf(false) }+ val clashes = remember(p) { Extensions.clashes(m) }+ val keepNew = remember(p) { mutableStateMapOf<Clash, Boolean>().apply { clashes.forEach { put(it, true) } } }+ val newKeys = (plan as? InstallPlan.Update)?.newAsks?.map { it.key }?.toSet().orEmpty()+ val silentUpdate = plan is InstallPlan.Update && !plan.reAsk+ // An update asking nothing new of an extension whose notice was accepted needs no tick.+ val askRisk = plan !is InstallPlan.NotNewer && (!silentUpdate || m.id !in registry.noticeAccepted)+ val dismiss = { pending.value = null }++ AlertDialog(+ onDismissRequest = dismiss,+ containerColor = tone(0xFF282828),+ icon = { ExtIcon(m.id, m.name, null, p.pkg.icon, 48.dp) },+ title = {+ Text(stringResource(if (plan is InstallPlan.Fresh) R.string.extensions_prompt_title_install else R.string.extensions_prompt_title_update, m.name), color = AppText)+ },+ text = {+ Column(Modifier.verticalScroll(rememberScrollState())) {+ Text(stringResource(R.string.extensions_prompt_by, m.author, m.version, m.id), color = AppMuted, fontSize = 12.sp)+ Text(stringResource(R.string.extensions_prompt_source, if (p.source == "file") stringResource(R.string.extensions_prompt_source_file) else p.source),+ color = AppMuted, fontSize = 12.sp, maxLines = 2, overflow = TextOverflow.Ellipsis)+ if (m.description.isNotBlank()) Text(m.description, color = AppText, fontSize = 14.sp, modifier = Modifier.padding(top = 6.dp))+ if (plan is InstallPlan.Update && m.changelog.isNotBlank()) {+ PromptHeader(R.string.extension_changelog)+ Text(m.changelog, color = AppText, fontSize = 13.sp)+ }+ Text(stringResource(R.string.extensions_prompt_sha, p.pkg.sha256.take(16) + "…"), color = AppMuted, fontSize = 11.sp, fontFamily = FontFamily.Monospace, modifier = Modifier.padding(top = 6.dp))+ when {+ plan is InstallPlan.NotNewer -> Text(stringResource(R.string.extensions_prompt_not_newer, plan.installed.version), color = Warning, modifier = Modifier.padding(top = 10.dp))+ silentUpdate -> Text(stringResource(R.string.extensions_prompt_update_same_rights, (plan as InstallPlan.Update).from.version, m.version), color = AppText, modifier = Modifier.padding(top = 10.dp))+ else -> {+ PromptHeader(R.string.actions_title)+ // An update lists only what changes: what it asks anew, and what was unticked before.+ val asks = m.asks().filter { plan !is InstallPlan.Update || it.key in newKeys || it.key in plan.refused }.sortedByDescending { it.critical }+ asks.forEach { a -> ActionRow(a, new = a.key in newKeys) }+ if (asks.any { it.critical }) Text(stringResource(R.string.actions_critical_warning), color = Warning, fontSize = 13.sp, modifier = Modifier.padding(top = 8.dp))+ }+ }+ if (plan !is InstallPlan.NotNewer) ClashChoices(m.name, clashes, keepNew)+ if (askRisk) RiskBox(risk) { risk = it }+ }+ },+ confirmButton = {+ if (plan !is InstallPlan.NotNewer) {+ TextButton(+ enabled = !askRisk || risk,+ onClick = {+ pending.value = null+ val choice = keepNew.toMap()+ scope.launch {+ runCatching { Extensions.install(p.zip, p.pkg, Grants.keys(m), p.source, clashes, { choice[it] != false }, noticeAccepted = true, origin = p.origin) }.onFailure { toastError(ctx, it) }+ }+ },+ ) { Text(stringResource(if (plan is InstallPlan.Fresh) R.string.extensions_install else R.string.extensions_update), color = AppAccent) }+ }+ },+ dismissButton = { TextButton(onClick = dismiss) { Text(stringResource(R.string.extensions_cancel), color = AppText) } },+ )+}++/**+ * "Third-party extension, not reviewed by Myspoti, under its author's responsibility", and the one+ * tick: "I understand this extension is made by a third party and I install it at my own risk".+ * Also on the cards that wait for the user's OK on an installed extension.+ */+@Composable+internal fun RiskBox(accepted: Boolean, onAccepted: (Boolean) -> Unit) {+ Column(Modifier.fillMaxWidth().padding(top = 10.dp).clip(RoundedCornerShape(10.dp)).background(Warning.copy(alpha = 0.10f)).padding(10.dp)) {+ Text(stringResource(R.string.ext_third_party_notice), color = AppText, fontSize = 13.sp)+ Row(verticalAlignment = Alignment.CenterVertically, modifier = Modifier.fillMaxWidth().padding(top = 4.dp).toggleable(accepted, role = Role.Checkbox, onValueChange = onAccepted)) {+ Checkbox(checked = accepted, onCheckedChange = null, colors = CheckboxDefaults.colors(checkedColor = Warning))+ Text(stringResource(R.string.ext_risk_accept), color = AppText, fontSize = 13.sp, modifier = Modifier.padding(start = 8.dp))+ }+ }+}++/** For each clash: what it is, and the user's pick (the new one acts, or the other is kept). */+@Composable+internal fun ClashChoices(newName: String, clashes: List<Clash>, keepNew: MutableMap<Clash, Boolean>) {+ if (clashes.isEmpty()) return+ val ctx = LocalContext.current+ PromptHeader(R.string.ext_clash_title)+ clashes.forEach { c ->+ val other = Extensions.registry.value.find(c.otherId)?.name ?: c.otherId+ val what = when (c.kind) {+ Clash.Kind.EXCLUSIVE -> stringResource(R.string.ext_clash_exclusive, ctx.getString(actionLabel(c.action)).lowercase(), other)+ Clash.Kind.CONFLICT -> stringResource(R.string.ext_clash_conflict, other)+ Clash.Kind.REPLACES -> stringResource(R.string.ext_clash_replaces, other)+ }+ Row(verticalAlignment = Alignment.CenterVertically, modifier = Modifier.padding(top = 6.dp)) {+ Icon(actionIcon(c.action), null, tint = Warning, modifier = Modifier.size(18.dp))+ Text(what, color = Warning, fontSize = 13.sp, modifier = Modifier.padding(start = 8.dp))+ }+ val state = if (c.kind == Clash.Kind.EXCLUSIVE) R.string.ext_clash_idle else R.string.ext_clash_off+ listOf(true, false).forEach { mine ->+ Row(verticalAlignment = Alignment.CenterVertically, modifier = Modifier.fillMaxWidth().toggleable(keepNew[c] == mine, role = Role.RadioButton) { keepNew[c] = mine }) {+ androidx.compose.material3.RadioButton(selected = keepNew[c] == mine, onClick = null)+ Text(+ if (mine) stringResource(R.string.ext_clash_keep_new, newName, stringResource(state)) else stringResource(R.string.ext_clash_keep_old, other),+ color = AppText, fontSize = 13.sp, modifier = Modifier.padding(start = 6.dp),+ )+ }+ }+ }+}++/** Turning on [m] would collide with what is on: the user picks first. */+@Composable+internal fun ClashDialog(m: Manifest, clashes: List<Clash>, onDismiss: () -> Unit, onDone: (Map<Clash, Boolean>) -> Unit) {+ val keepNew = remember(clashes) { mutableStateMapOf<Clash, Boolean>().apply { clashes.forEach { put(it, true) } } }+ AlertDialog(+ onDismissRequest = onDismiss,+ containerColor = tone(0xFF282828),+ title = { Text(m.name, color = AppText) },+ text = { Column(Modifier.verticalScroll(rememberScrollState())) { ClashChoices(m.name, clashes, keepNew) } },+ confirmButton = { TextButton(onClick = { onDone(keepNew.toMap()) }) { Text(stringResource(R.string.ext_clash_ok), color = AppAccent) } },+ dismissButton = { TextButton(onClick = onDismiss) { Text(stringResource(R.string.extensions_cancel), color = AppText) } },+ )+}++/** Turns [id] on, asking first which to keep when it collides with an extension that is on. */+@Composable+internal fun rememberEnabler(): (String, Boolean) -> Unit {+ var asking by remember { mutableStateOf<Pair<String, List<Clash>>?>(null) }+ asking?.let { (id, clashes) ->+ val m = Extensions.manifest(id)+ if (m == null) asking = null+ else ClashDialog(m, clashes, onDismiss = { asking = null }) { choice ->+ asking = null+ Extensions.setEnabled(id, true, clashes) { choice[it] != false }+ }+ }+ return { id, on ->+ val clashes = if (on) Extensions.manifest(id)?.let { Extensions.clashes(it) }.orEmpty() else emptyList()+ if (clashes.isEmpty()) Extensions.setEnabled(id, on) else asking = id to clashes+ }+}++@Composable+internal fun PromptHeader(text: Int) =+ Text(stringResource(text).uppercase(), color = AppAccent, fontSize = 11.sp, fontWeight = FontWeight.Bold, letterSpacing = 1.sp, modifier = Modifier.padding(top = 12.dp, bottom = 2.dp))++/** An action's icon on a small tile, in the warning colour when it is critical. */+@Composable+internal fun ActionTile(a: Ask, size: Dp = 36.dp) {+ val c = if (a.critical) Warning else AppAccent+ Box(Modifier.size(size).clip(RoundedCornerShape(size / 4)).background(c.copy(alpha = 0.15f)), contentAlignment = Alignment.Center) {+ Icon(actionIcon(a.action), contentDescription = stringResource(askLabel(a)), tint = c, modifier = Modifier.size(size * 0.58f))+ }+}++/** One action: icon, label, the author's reason (≤ 80 characters), hosts, "Critical", and "new in this version" when [new]. */+@Composable+internal fun ActionRow(a: Ask, new: Boolean = false) {+ Row(verticalAlignment = Alignment.CenterVertically, modifier = Modifier.fillMaxWidth().padding(vertical = 5.dp)) {+ ActionTile(a)+ Column(Modifier.weight(1f).padding(horizontal = 10.dp)) {+ Row(verticalAlignment = Alignment.CenterVertically) {+ Text(stringResource(askLabel(a)), color = if (a.critical) Warning else AppText, fontSize = 14.sp, fontWeight = FontWeight.SemiBold,+ maxLines = 1, overflow = TextOverflow.Ellipsis, modifier = Modifier.weight(1f, fill = false))+ if (a.critical) { androidx.compose.foundation.layout.Spacer(Modifier.size(6.dp)); ExtPill(stringResource(R.string.action_critical), Color.Black, Warning) }+ if (new) { androidx.compose.foundation.layout.Spacer(Modifier.size(6.dp)); ExtPill(stringResource(R.string.extensions_prompt_new), AppAccent, AppAccent.copy(alpha = 0.15f)) }+ }+ Text(a.why.ifBlank { stringResource(R.string.action_no_why) }, color = AppMuted, fontSize = 12.sp)+ if (a.hosts.isNotEmpty() && a.hosts != listOf("*")) Text(a.hosts.joinToString(), color = AppMuted, fontSize = 11.sp, fontFamily = FontFamily.Monospace)+ }+ }+}++internal fun categoryLabel(c: Category?): Int = when (c) {+ null -> R.string.extensions_cat_all+ Category.LYRICS -> R.string.extensions_cat_lyrics+ Category.PLAYBACK -> R.string.extensions_cat_playback+ Category.LIBRARY -> R.string.extensions_cat_library+ Category.DISCOVERY -> R.string.extensions_cat_discovery+ Category.STATS -> R.string.extensions_cat_stats+ Category.LOOK -> R.string.extensions_cat_look+ Category.SOCIAL -> R.string.extensions_cat_social+ Category.TOOLS -> R.string.extensions_cat_tools+ Category.OTHER -> R.string.extensions_cat_other+}++// ── Store widgets ──++/**+ * An extension's icon: its PNG (from the package, or the index's `icon_url` before download)+ * over a tile of a colour taken from its id, with its first letter (seen when there is no icon,+ * or it does not load).+ */+@OptIn(ExperimentalGlideComposeApi::class)+@Composable+internal fun ExtIcon(id: String, name: String, iconUrl: String?, bytes: ByteArray?, size: Dp = 44.dp) {+ val tint = remember(id) { Color.hsv(((id.hashCode() and 0x7fffffff) % 360).toFloat(), 0.45f, 0.58f) }+ val bitmap = remember(bytes) { bytes?.let { runCatching { BitmapFactory.decodeByteArray(it, 0, it.size)?.asImageBitmap() }.getOrNull() } }+ Box(Modifier.size(size).clip(RoundedCornerShape(size / 4)).background(tint), contentAlignment = Alignment.Center) {+ Text(name.firstOrNull { it.isLetterOrDigit() }?.uppercase() ?: "?", color = Color.White, fontWeight = FontWeight.Bold, fontSize = (size.value * 0.42f).sp)+ when {+ bitmap != null -> Image(bitmap, null, Modifier.fillMaxSize(), contentScale = ContentScale.Crop)+ iconUrl != null && iconUrl.startsWith("https://") && !com.music.spotui.data.DataSaver.active ->+ GlideImage(model = iconUrl, contentDescription = null, modifier = Modifier.fillMaxSize(), contentScale = ContentScale.Crop)+ }+ }+}++/** An entry's icon address, resolved against its index's. */+internal fun iconOf(repo: String, e: Catalog.Entry): String? =+ e.iconAddress()?.let { runCatching { Catalog.resolve(repo, it) }.getOrNull() }++/** `v1.2.0` in a small grey pill. */+/** "Inactive: <what its status said>": its source does not answer now, the app skips it for songs' audio and downloads. */+@Composable+internal fun inactiveLine(s: app.myspoti.extensions.ExtensionStatus): String =+ s.detail?.let { stringResource(R.string.extension_inactive_detail, it) } ?: stringResource(R.string.extension_inactive)++/**+ * An installed extension's one state message, with its colour: why it was turned off, else (on)+ * that it is inactive, else its last error; null when there is nothing to say.+ */+@Composable+internal fun stateLine(e: com.music.spotui.extensions.InstalledExtension, error: String?, status: app.myspoti.extensions.ExtensionStatus?): Pair<String, Color>? = when {+ e.disabledReason != null -> stringResource(R.string.extension_disabled_reason, e.disabledReason) to Problem+ !e.enabled -> null+ status != null -> inactiveLine(status) to Warning+ error != null -> stringResource(R.string.extension_last_error, error) to Problem+ else -> null+}++/** A failure: turned off, or the last error. */+internal val Problem = Color(0xFFE5534B)++@Composable+internal fun VersionPill(version: String) = ExtPill(if (version.startsWith("v")) version else "v$version", AppMuted, tone(0xFF2A2A2A))++@Composable+internal fun ExtPill(text: String, color: Color, background: Color) =+ Text(text, color = color, fontSize = 11.sp, maxLines = 1, fontWeight = FontWeight.Medium,+ modifier = Modifier.clip(RoundedCornerShape(50)).background(background).padding(horizontal = 7.dp, vertical = 1.dp))++/** The actions as small icons (the critical ones first, in the warning colour), [max] then "+n". */+@OptIn(ExperimentalLayoutApi::class)+@Composable+internal fun ActionIcons(asks: List<Ask>, max: Int = 6) {+ if (asks.isEmpty()) return+ val sorted = asks.sortedByDescending { it.critical }+ FlowRow(horizontalArrangement = Arrangement.spacedBy(4.dp), verticalArrangement = Arrangement.spacedBy(4.dp), modifier = Modifier.padding(top = 4.dp)) {+ sorted.take(max).forEach { a -> ActionTile(a, 22.dp) }+ if (sorted.size > max) Text("+${sorted.size - max}", color = AppMuted, fontSize = 11.sp, modifier = Modifier.padding(horizontal = 2.dp, vertical = 3.dp))+ }+}++/** The one state button of a store row: Install, Update (tonal), Installed (outlined), or a spinner. */+@Composable+internal fun StateButton(action: StoreAction, busy: Boolean, large: Boolean = false, onInstall: () -> Unit, onOpen: () -> Unit) {+ val h = if (large) 44.dp else 32.dp+ val pad = PaddingValues(horizontal = if (large) 24.dp else 14.dp)+ val mod = Modifier.height(h).let { if (large) it.fillMaxWidth() else it.widthIn(min = 92.dp) }+ val text = @Composable { id: Int -> Text(stringResource(id), fontSize = if (large) 15.sp else 13.sp, maxLines = 1) }+ when {+ busy -> Box(mod, contentAlignment = Alignment.Center) { CircularProgressIndicator(Modifier.size(20.dp), color = AppAccent, strokeWidth = 2.dp) }+ action == StoreAction.INSTALL -> Button(onInstall, mod, contentPadding = pad,+ colors = ButtonDefaults.buttonColors(containerColor = AppAccent, contentColor = Color.Black)) { text(R.string.extensions_install) }+ action == StoreAction.UPDATE -> FilledTonalButton(onInstall, mod, contentPadding = pad,+ colors = ButtonDefaults.filledTonalButtonColors(containerColor = AppAccent.copy(alpha = 0.22f), contentColor = AppAccent)) { text(R.string.extensions_update) }+ action == StoreAction.INSTALLED -> OutlinedButton(onOpen, mod, contentPadding = pad,+ border = BorderStroke(1.dp, AppMuted.copy(alpha = 0.6f)), colors = ButtonDefaults.outlinedButtonColors(contentColor = AppText)) { text(R.string.extensions_up_to_date) }+ else -> OutlinedButton({}, mod, enabled = false, contentPadding = pad,+ border = BorderStroke(1.dp, AppMuted.copy(alpha = 0.3f))) { text(R.string.extensions_install) }+ }+}++/** A small dot, for "failed to load" on an icon or "update" on a tab. */+@Composable+internal fun Dot(color: Color, size: Dp = 10.dp) =+ Box(Modifier.size(size).clip(CircleShape).background(color).border(1.5.dp, AppBackground, CircleShape))++// ── Small pieces, as on the settings page ──++@Composable+internal fun Page(titleRes: Int?, navController: NavController, title: String? = null, top: @Composable () -> Unit = {}, content: @Composable () -> Unit) {+ Column(Modifier.fillMaxSize().background(AppBackground).statusBarsPadding()) {+ Row(verticalAlignment = Alignment.CenterVertically, modifier = Modifier.fillMaxWidth().padding(4.dp)) {+ IconButton(onClick = { navController.popBackStack() }) {+ Icon(Icons.AutoMirrored.Filled.ArrowBack, contentDescription = stringResource(R.string.accessibility_navigate_back), tint = AppText)+ }+ Text(title ?: stringResource(titleRes!!), color = AppText, fontSize = 20.sp, fontWeight = FontWeight.Bold, maxLines = 1, overflow = TextOverflow.Ellipsis)+ }+ top()+ Column(Modifier.fillMaxWidth().weight(1f).verticalScroll(rememberScrollState()).navigationBarsPadding()) { content() }+ }+}++@Composable+internal fun ExtSection(title: Int) = ExtSection(stringResource(title))++@Composable+internal fun ExtSection(title: String) {+ Text(title.uppercase(), color = AppAccent, fontSize = 12.sp, fontWeight = FontWeight.Bold,+ letterSpacing = 1.sp, modifier = Modifier.padding(start = 20.dp, end = 20.dp, top = 16.dp, bottom = 8.dp))+}++@Composable+internal fun ExtDivider() = HorizontalDivider(color = tone(0xFF2A2A2A), modifier = Modifier.padding(top = 8.dp))++@Composable+internal fun SwitchRow(label: String, detail: String, checked: Boolean, detailColor: Color = AppMuted, onChecked: (Boolean) -> Unit) {+ Row(+ verticalAlignment = Alignment.CenterVertically,+ modifier = Modifier.fillMaxWidth().heightIn(min = 64.dp)+ .toggleable(checked, role = Role.Switch, onValueChange = onChecked)+ .padding(horizontal = 20.dp, vertical = 10.dp),+ ) {+ Column(Modifier.weight(1f)) {+ Text(label, color = AppText, fontSize = 16.sp)+ if (detail.isNotBlank()) Text(detail, color = detailColor, fontSize = 12.sp)+ }+ Switch(checked = checked, onCheckedChange = null)+ }+}++/** An https address typed by the user. */+@Composable+internal fun UrlDialog(title: Int, hint: Int, warning: Int? = null, onDismiss: () -> Unit, onOk: (String) -> Unit) {+ var text by remember { mutableStateOf("") }+ val ok = text.trim().startsWith("https://") && text.trim().length > 10+ AlertDialog(+ onDismissRequest = onDismiss,+ containerColor = tone(0xFF282828),+ title = { Text(stringResource(title), color = AppText) },+ text = {+ Column {+ OutlinedTextField(value = text, onValueChange = { text = it }, singleLine = true, placeholder = { Text(stringResource(hint)) },+ keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Uri), modifier = Modifier.fillMaxWidth())+ warning?.let { Text(stringResource(it), color = Warning, fontSize = 12.sp, modifier = Modifier.padding(top = 8.dp)) }+ }+ },+ confirmButton = { TextButton(enabled = ok, onClick = { onOk(text.trim()) }) { Text(stringResource(android.R.string.ok), color = AppAccent) } },+ dismissButton = { TextButton(onClick = onDismiss) { Text(stringResource(R.string.extensions_cancel), color = AppText) } },+ )+}diff --git a/base/app/src/main/java/com/music/spotui/ui/screens/ExtensionsScreen.kt b/base/app/src/main/java/com/music/spotui/ui/screens/ExtensionsScreen.ktnew file mode 100644index 00000000..8573b6c0--- /dev/null+++ b/base/app/src/main/java/com/music/spotui/ui/screens/ExtensionsScreen.kt@@ -0,0 +1,469 @@+package com.music.spotui.ui.screens++import android.net.Uri+import androidx.compose.foundation.BorderStroke+import androidx.compose.foundation.background+import androidx.compose.foundation.border+import androidx.compose.foundation.clickable+import androidx.compose.foundation.horizontalScroll+import androidx.compose.foundation.layout.Arrangement+import androidx.compose.foundation.layout.Box+import androidx.compose.foundation.layout.Column+import androidx.compose.foundation.layout.Row+import androidx.compose.foundation.layout.Spacer+import androidx.compose.foundation.layout.fillMaxWidth+import androidx.compose.foundation.layout.height+import androidx.compose.foundation.layout.heightIn+import androidx.compose.foundation.layout.padding+import androidx.compose.foundation.layout.size+import androidx.compose.foundation.layout.width+import androidx.compose.foundation.rememberScrollState+import androidx.compose.foundation.shape.RoundedCornerShape+import androidx.compose.material.icons.Icons+import androidx.compose.material.icons.filled.Clear+import androidx.compose.material.icons.filled.Delete+import androidx.compose.material.icons.filled.KeyboardArrowDown+import androidx.compose.material.icons.filled.KeyboardArrowUp+import androidx.compose.material.icons.filled.Refresh+import androidx.compose.material.icons.filled.Search+import androidx.compose.material3.CircularProgressIndicator+import androidx.compose.material3.TextButton+import androidx.compose.material3.Icon+import androidx.compose.material3.IconButton+import androidx.compose.material3.OutlinedButton+import androidx.compose.material3.OutlinedTextField+import androidx.compose.material3.OutlinedTextFieldDefaults+import androidx.compose.material3.Switch+import androidx.compose.material3.Text+import androidx.compose.runtime.Composable+import androidx.compose.runtime.LaunchedEffect+import androidx.compose.runtime.collectAsState+import androidx.compose.runtime.getValue+import androidx.compose.runtime.mutableStateOf+import androidx.compose.runtime.remember+import androidx.compose.runtime.rememberCoroutineScope+import androidx.compose.runtime.saveable.rememberSaveable+import androidx.compose.runtime.setValue+import androidx.compose.ui.Alignment+import androidx.compose.ui.Modifier+import androidx.compose.ui.draw.clip+import androidx.compose.ui.graphics.Color+import androidx.compose.ui.platform.LocalContext+import androidx.compose.ui.res.stringResource+import androidx.compose.ui.text.font.FontFamily+import androidx.compose.ui.text.font.FontWeight+import androidx.compose.ui.text.style.TextOverflow+import androidx.compose.ui.unit.dp+import androidx.compose.ui.unit.sp+import androidx.navigation.NavController+import app.myspoti.engine.R+import app.myspoti.extensions.Catalog+import app.myspoti.extensions.Category+import app.myspoti.extensions.Action+import app.myspoti.extensions.Area+import app.myspoti.extensions.mode+import com.music.spotui.extensions.actionIcon+import com.music.spotui.extensions.actionLabel+import com.music.spotui.extensions.areaIcon+import com.music.spotui.extensions.areaLabel+import app.myspoti.extensions.Store+import app.myspoti.extensions.StoreAction+import com.music.spotui.extensions.ExtensionStore+import com.music.spotui.extensions.Extensions+import com.music.spotui.extensions.InstalledExtension+import com.music.spotui.ui.navigation.Routes+import com.music.spotui.ui.theme.AppAccent+import com.music.spotui.ui.theme.AppMuted+import com.music.spotui.ui.theme.AppText+import com.music.spotui.ui.theme.tone+import kotlinx.coroutines.launch++internal fun installedRoute(id: String) = "${Routes.Extension.route}/${Uri.encode(id)}"+internal fun storeRoute(id: String) = "${Routes.ExtensionEntry.route}/${Uri.encode(id)}"++// ── The list: Store and Installed tabs, search, categories ──++@Composable+fun ExtensionsScreen(navController: NavController) {+ val ctx = LocalContext.current+ val scope = rememberCoroutineScope()+ val registry by Extensions.registry.collectAsState()+ val errors by Extensions.errors.collectAsState()+ val statuses by Extensions.statuses.collectAsState()+ val repos by ExtensionStore.repos.collectAsState()+ val busy by ExtensionStore.busy.collectAsState()+ val pickFile = rememberPackagePicker()+ val enable = rememberEnabler()+ var askUrl by remember { mutableStateOf(false) }+ var askRepo by remember { mutableStateOf(false) }+ var downloading by remember { mutableStateOf(false) }+ var tab by rememberSaveable { mutableStateOf(if (registry.extensions.isEmpty()) 0 else 1) }+ var query by rememberSaveable { mutableStateOf("") }+ var categoryKey by rememberSaveable { mutableStateOf<String?>(null) }+ val category = categoryKey?.let { Category.of(it) }++ LaunchedEffect(registry.repositories) { ExtensionStore.refresh(registry.repositories) }+ val catalogs = repos.values.mapNotNull { r -> r.catalog?.let { r.url to it } }+ val installedCodes = registry.extensions.associate { it.id to it.versionCode }+ // Updates in a repository, and GitHub updates waiting for the user's OK.+ val updates = Store.updates(catalogs, installedCodes, appVersion) + registry.extensions.filter { it.pendingUpdate != null }.map { it.id }+ var showAll by rememberSaveable { mutableStateOf(false) }+ val ratings by ExtensionStore.ratings.collectAsState()+ val blocks by com.music.spotui.extensions.ExtensionUpdates.blocks.collectAsState()++ // The store's lists as the tab shows them, and the categories that have something in them.+ val officialShown = remember(repos) { ExtensionStore.officialShown() }+ val storeSources = ExtensionStore.sources(registry.repositories).filter { !ExtensionStore.isOfficial(it) || officialShown }+ val discovered = remember(repos, ratings, blocks, showAll) { ExtensionStore.discovered(showAll) }+ val present = if (tab == 0) (storeSources.flatMap { repos[it]?.catalog?.extensions.orEmpty() } + discovered.map { it.item }).map { it.category() }.toSet()+ else registry.extensions.mapNotNull { Extensions.manifest(it.id)?.category() }.toSet()++ Page(R.string.extensions_title, navController, top = {+ Tabs(tab, updates.size) { tab = it }+ }) {+ SearchField(query) { query = it }+ CategoryChips(Category.entries.filter { it in present || it == category }, category) { categoryKey = it?.key }+ if (downloading) Text(stringResource(R.string.extensions_loading), color = AppMuted, fontSize = 12.sp, modifier = Modifier.padding(horizontal = 20.dp))++ if (tab == 0) {+ if (registry.repositories.none { !ExtensionStore.isOfficial(it) } && !officialShown) EmptyState()+ var shown = 0+ storeSources.forEach { url ->+ val repo = repos[url] ?: ExtensionStore.Repo(url, loading = true)+ RepoHeader(repo, onRefresh = { ExtensionStore.refresh(registry.repositories, force = true) }, onRemove = { Extensions.removeRepository(url) })+ repo.catalog?.extensions?.filter { Store.matches(it, query, category) }?.forEach { entry ->+ shown+++ StoreRow(url, entry, Store.action(entry, installedCodes[entry.id], appVersion), entry.id in busy, registry,+ onOpen = { navController.navigate(storeRoute(entry.id)) },+ onInstall = { scope.launch { installFromStore(ctx, url, entry) } },+ onInstalled = { navController.navigate(installedRoute(entry.id)) })+ }+ }+ // Discovered on GitHub: by score, then the most recently updated; the hidden ones behind "Show all".+ val github = repos[app.myspoti.extensions.Discovery.SOURCE]+ if (github != null) {+ GitHubHeader(github, onRefresh = { ExtensionStore.discover(force = true) })+ discovered.filter { Store.matches(it.item, query, category) }.forEach { r ->+ val entry = r.item+ shown+++ StoreRow(app.myspoti.extensions.Discovery.SOURCE, entry, Store.action(entry, installedCodes[entry.id], appVersion), entry.id in busy, registry,+ onOpen = { navController.navigate(storeRoute(entry.id)) },+ onInstall = { scope.launch { installFromStore(ctx, app.myspoti.extensions.Discovery.SOURCE, entry) } },+ onInstalled = { navController.navigate(installedRoute(entry.id)) },+ rating = r.rating, hidden = app.myspoti.extensions.Ranking.hidden(r, blocks, System.currentTimeMillis()) != null)+ }+ val hidden = remember(repos, ratings, blocks) { ExtensionStore.hiddenCount() }+ if (hidden > 0 || showAll) TextButton(onClick = { showAll = !showAll }, modifier = Modifier.padding(horizontal = 12.dp)) {+ Text(if (showAll) stringResource(R.string.extensions_show_less) else stringResource(R.string.extensions_show_all, hidden), color = AppAccent)+ }+ }+ if (shown == 0 && catalogs.any { it.second.extensions.isNotEmpty() }) Text(stringResource(R.string.extensions_no_match), color = AppMuted, fontSize = 14.sp, modifier = Modifier.padding(20.dp))+ ExtDivider()+ ExtSection(R.string.extensions_other_ways)+ Text(stringResource(R.string.extensions_repository_warning), color = AppMuted, fontSize = 12.sp, modifier = Modifier.padding(horizontal = 20.dp))+ InstallButtons(onRepo = { askRepo = true }, onFile = pickFile, onUrl = { askUrl = true })+ } else {+ val matches = { e: InstalledExtension ->+ val m = Extensions.manifest(e.id)+ (category == null || m?.category() == category) &&+ query.lowercase().split(' ').filter { it.isNotBlank() }.all { w -> listOf(e.name, e.author, m?.description.orEmpty(), e.id, m?.tags.orEmpty().joinToString(" ")).any { it.lowercase().contains(w) } }+ }+ if (registry.extensions.isEmpty()) {+ Text(stringResource(R.string.extensions_none), color = AppMuted, fontSize = 14.sp, modifier = Modifier.padding(horizontal = 20.dp, vertical = 8.dp))+ OutlinedButton(onClick = { tab = 0 }, modifier = Modifier.padding(horizontal = 20.dp), border = BorderStroke(1.dp, AppMuted.copy(alpha = 0.6f))) {+ Text(stringResource(R.string.extensions_browse_store), color = AppText)+ }+ }+ // By area: the extensions acting there, in order; an area without any is not listed.+ val grouped = remember(registry) { Extensions.byArea() }+ grouped.forEach { (area, list) ->+ val shown = list.filter(matches)+ if (shown.isNotEmpty()) AreaSection(area, shown, errors, statuses, updates, enable,+ onOpen = { navController.navigate(installedRoute(it)) })+ }+ ExtDivider()+ ExtSection(R.string.extensions_other_ways)+ InstallButtons(onRepo = null, onFile = pickFile, onUrl = { askUrl = true })+ }+ Spacer(Modifier.height(com.music.spotui.ui.components.bottomBarsSpace()))+ }++ if (askUrl) UrlDialog(R.string.extensions_install_url, R.string.extensions_url_hint, onDismiss = { askUrl = false }) { url ->+ askUrl = false+ downloading = true+ scope.launch {+ // A GitHub repository's address: its newest release (or default branch), kept on the phone and updated from there.+ val gitHub = app.myspoti.extensions.GitHubRepo.parse(url)?.takeIf { !url.endsWith(".zip") && (url.contains("github.com/") || !url.contains("://")) }+ runCatching {+ if (gitHub != null) com.music.spotui.extensions.ExtensionUpdates.fromGitHub(gitHub)+ else Extensions.downloadPackage(url).let { (zip, p) -> com.music.spotui.extensions.ExtensionUpdates.Fetched(zip, p, null) }+ }+ .onSuccess { f -> offer(ctx, f.zip, f.origin?.let { "https://github.com/${it.repo}" } ?: url, f.origin) }+ .onFailure { toastError(ctx, it) }+ downloading = false+ }+ }+ if (askRepo) UrlDialog(R.string.extensions_repository_add, R.string.extensions_repository_hint, warning = R.string.extensions_repository_warning, onDismiss = { askRepo = false }) { url ->+ askRepo = false+ Extensions.addRepository(url)+ tab = 0+ }+ InstallPrompt()+}++/** "Store" and "Installed", the latter with the number of updates waiting. */+@Composable+private fun Tabs(selected: Int, updates: Int, onSelect: (Int) -> Unit) {+ Row(Modifier.fillMaxWidth().padding(horizontal = 12.dp)) {+ listOf(R.string.extensions_tab_store, R.string.extensions_installed).forEachIndexed { i, label ->+ Column(+ horizontalAlignment = Alignment.CenterHorizontally,+ modifier = Modifier.weight(1f).clip(RoundedCornerShape(8.dp)).clickable { onSelect(i) }.padding(top = 10.dp),+ ) {+ Row(verticalAlignment = Alignment.CenterVertically) {+ Text(stringResource(label), color = if (i == selected) AppText else AppMuted, fontSize = 15.sp, fontWeight = if (i == selected) FontWeight.Bold else FontWeight.Normal)+ if (i == 1 && updates > 0) {+ Spacer(Modifier.width(6.dp))+ Text(updates.toString(), color = Color.Black, fontSize = 11.sp, fontWeight = FontWeight.Bold,+ modifier = Modifier.clip(RoundedCornerShape(50)).background(AppAccent).padding(horizontal = 6.dp))+ }+ }+ Spacer(Modifier.height(8.dp))+ Box(Modifier.fillMaxWidth(0.5f).height(2.dp).background(if (i == selected) AppAccent else Color.Transparent))+ }+ }+ }+ Box(Modifier.fillMaxWidth().height(1.dp).background(tone(0xFF2A2A2A)))+}++@Composable+private fun SearchField(query: String, onChange: (String) -> Unit) {+ OutlinedTextField(+ value = query, onValueChange = onChange, singleLine = true,+ placeholder = { Text(stringResource(R.string.extensions_search), color = AppMuted) },+ leadingIcon = { Icon(Icons.Default.Search, null, tint = AppMuted) },+ trailingIcon = { if (query.isNotEmpty()) IconButton(onClick = { onChange("") }) { Icon(Icons.Default.Clear, stringResource(R.string.extensions_cancel), tint = AppMuted) } },+ shape = RoundedCornerShape(24.dp),+ colors = OutlinedTextFieldDefaults.colors(+ focusedTextColor = AppText, unfocusedTextColor = AppText, focusedBorderColor = AppAccent, unfocusedBorderColor = tone(0xFF3E3E3E),+ focusedContainerColor = tone(0xFF1E1E1E), unfocusedContainerColor = tone(0xFF1E1E1E), cursorColor = AppAccent,+ ),+ modifier = Modifier.fillMaxWidth().padding(start = 16.dp, end = 16.dp, top = 12.dp).heightIn(min = 48.dp),+ )+}++/** "All" and the [categories] that have an extension in the tab. */+@Composable+private fun CategoryChips(categories: List<Category>, selected: Category?, onSelect: (Category?) -> Unit) {+ if (categories.isEmpty()) return+ Row(Modifier.fillMaxWidth().horizontalScroll(rememberScrollState()).padding(horizontal = 16.dp, vertical = 10.dp), horizontalArrangement = Arrangement.spacedBy(8.dp)) {+ (listOf<Category?>(null) + categories).forEach { c ->+ val on = c == selected+ Text(stringResource(categoryLabel(c)), color = if (on) Color.Black else AppText, fontSize = 13.sp, maxLines = 1,+ modifier = Modifier.clip(RoundedCornerShape(50)).background(if (on) AppAccent else tone(0xFF2A2A2A))+ .clickable { onSelect(if (on) null else c) }.padding(horizontal = 14.dp, vertical = 7.dp))+ }+ }+}++/** No repository yet: what extensions are, before anything is added. */+@Composable+private fun EmptyState() {+ Column(Modifier.fillMaxWidth().padding(horizontal = 20.dp, vertical = 8.dp)) {+ Text(stringResource(R.string.extensions_empty_title), color = AppText, fontSize = 17.sp, fontWeight = FontWeight.Bold)+ Text(stringResource(R.string.extensions_empty_body), color = AppMuted, fontSize = 13.sp, modifier = Modifier.padding(top = 4.dp))+ }+}++/** A repository: its name, address and how much it is trusted; refresh and remove. */+@Composable+private fun RepoHeader(repo: ExtensionStore.Repo, onRefresh: () -> Unit, onRemove: () -> Unit) {+ val official = ExtensionStore.isOfficial(repo.url)+ Column(Modifier.fillMaxWidth().padding(start = 20.dp, end = 8.dp, top = 16.dp, bottom = 4.dp)) {+ Row(verticalAlignment = Alignment.CenterVertically) {+ Column(Modifier.weight(1f)) {+ Row(verticalAlignment = Alignment.CenterVertically) {+ Text(repo.catalog?.name ?: runCatching { java.net.URI(repo.url).host }.getOrNull() ?: repo.url, color = AppText, fontSize = 16.sp,+ fontWeight = FontWeight.Bold, maxLines = 1, overflow = TextOverflow.Ellipsis, modifier = Modifier.weight(1f, fill = false))+ Spacer(Modifier.width(8.dp))+ if (official) ExtPill(stringResource(R.string.extensions_official_badge), Color.Black, AppAccent)+ else ExtPill(stringResource(R.string.extensions_repo_yours), Warning, Warning.copy(alpha = 0.15f))+ }+ Text(repo.url, color = AppMuted, fontSize = 10.sp, fontFamily = FontFamily.Monospace, maxLines = 1, overflow = TextOverflow.Ellipsis)+ Text(stringResource(if (official) R.string.extensions_repo_official_note else R.string.extensions_repo_yours_note), color = if (official) AppMuted else Warning, fontSize = 11.sp)+ }+ if (repo.loading) CircularProgressIndicator(Modifier.padding(12.dp).size(20.dp), color = AppAccent, strokeWidth = 2.dp)+ else IconButton(onClick = onRefresh) { Icon(Icons.Default.Refresh, stringResource(R.string.extensions_repository_refresh), tint = AppMuted) }+ if (!official) IconButton(onClick = onRemove) { Icon(Icons.Default.Delete, stringResource(R.string.extensions_repository_remove), tint = AppMuted) }+ }+ repo.error?.let { Text(stringResource(R.string.extensions_repo_error, it), color = Warning, fontSize = 12.sp) }+ if (repo.catalog?.extensions?.isEmpty() == true) Text(stringResource(R.string.extensions_repo_empty), color = AppMuted, fontSize = 12.sp)+ }+}++/** The GitHub discovery's header: what it is (not reviewed), refresh. */+@Composable+private fun GitHubHeader(repo: ExtensionStore.Repo, onRefresh: () -> Unit) {+ Column(Modifier.fillMaxWidth().padding(start = 20.dp, end = 8.dp, top = 16.dp, bottom = 4.dp)) {+ Row(verticalAlignment = Alignment.CenterVertically) {+ Column(Modifier.weight(1f)) {+ Row(verticalAlignment = Alignment.CenterVertically) {+ Text(stringResource(R.string.extensions_github_title), color = AppText, fontSize = 16.sp, fontWeight = FontWeight.Bold)+ Spacer(Modifier.width(8.dp))+ ExtPill(stringResource(R.string.extensions_repo_community), Warning, Warning.copy(alpha = 0.15f))+ }+ Text(stringResource(R.string.extensions_github_note), color = Warning, fontSize = 11.sp)+ }+ if (repo.loading) CircularProgressIndicator(Modifier.padding(12.dp).size(20.dp), color = AppAccent, strokeWidth = 2.dp)+ else IconButton(onClick = onRefresh) { Icon(Icons.Default.Refresh, stringResource(R.string.extensions_repository_refresh), tint = AppMuted) }+ }+ repo.error?.let { Text(stringResource(R.string.extensions_repo_error, it), color = Warning, fontSize = 12.sp) }+ }+}++/** "★ 4.2 · 35 votes" (a Bayesian score: see [app.myspoti.extensions.Ranking]); greyed when hidden behind "Show all". */+@Composable+internal fun RatingLine(rating: app.myspoti.extensions.Rating?, hidden: Boolean = false) {+ val text = if (rating == null || rating.votes == 0) stringResource(R.string.extension_rating_none)+ else stringResource(R.string.extension_rating, "%.1f".format(app.myspoti.extensions.Ranking.stars(rating)), rating.votes)+ Text(text, color = if (hidden) Warning else AppMuted, fontSize = 11.sp, maxLines = 1)+}++/** A store row: icon, name, version, one line, the rights, and the one state button. */+@Composable+private fun StoreRow(+ repo: String, e: Catalog.Entry, action: StoreAction, busy: Boolean, registry: com.music.spotui.extensions.Registry,+ onOpen: () -> Unit, onInstall: () -> Unit, onInstalled: () -> Unit, rating: app.myspoti.extensions.Rating? = null, hidden: Boolean = false,+) {+ Row(+ verticalAlignment = Alignment.CenterVertically,+ modifier = Modifier.fillMaxWidth().clickable(onClick = onOpen).padding(horizontal = 20.dp, vertical = 10.dp),+ ) {+ ExtIcon(e.id, e.name, iconOf(repo, e), null)+ Column(Modifier.weight(1f).padding(horizontal = 12.dp)) {+ Row(verticalAlignment = Alignment.CenterVertically) {+ Text(e.name, color = AppText, fontSize = 15.sp, fontWeight = FontWeight.SemiBold, maxLines = 1, overflow = TextOverflow.Ellipsis, modifier = Modifier.weight(1f, fill = false))+ Spacer(Modifier.width(6.dp))+ VersionPill(e.version)+ }+ if (action == StoreAction.INCOMPATIBLE) Text(incompatibleLine(e), color = Warning, fontSize = 12.sp, maxLines = 1, overflow = TextOverflow.Ellipsis)+ else Text(e.description.ifBlank { e.author }, color = AppMuted, fontSize = 12.sp, maxLines = 1, overflow = TextOverflow.Ellipsis)+ incompatibleWith(e, registry)?.let { Text(it, color = Warning, fontSize = 12.sp, maxLines = 1, overflow = TextOverflow.Ellipsis) }+ if (e.repo != null) RatingLine(rating, hidden)+ ActionIcons(e.preview().asks())+ }+ StateButton(action, busy, onInstall = onInstall, onOpen = onInstalled)+ }+}++@Composable+internal fun incompatibleLine(e: Catalog.Entry): String =+ if (e.apiVersion > app.myspoti.extensions.API_VERSION) stringResource(R.string.extensions_requires_api, e.apiVersion)+ else stringResource(R.string.extensions_requires, e.minAppVersion.orEmpty())++/** "Incompatible with X (installed)": the entry, or an installed extension, lists the other in conflictsWith or replaces. */+@Composable+internal fun incompatibleWith(e: Catalog.Entry, registry: com.music.spotui.extensions.Registry): String? {+ val other = registry.extensions.firstOrNull { i ->+ i.id != e.id && (i.id in e.conflictsWith || i.id in e.replaces || Extensions.manifest(i.id)?.conflictsWith?.contains(e.id) == true)+ } ?: return null+ return stringResource(if (other.id in e.replaces) R.string.ext_clash_replaces else R.string.ext_clash_conflict, other.name)+}++/**+ * One area of the Installed tab: its icon and name, the extensions acting there in the user's+ * order (arrows to reorder, "Active" / "Idle" for an exclusive action), and who did what lately,+ * with one-tap turn off.+ */+@Composable+private fun AreaSection(+ area: Area, list: List<InstalledExtension>, errors: Map<String, String>, statuses: Map<String, app.myspoti.extensions.ExtensionStatus>, updates: Set<String>, enable: (String, Boolean) -> Unit, onOpen: (String) -> Unit) {+ val activity by Extensions.activity.state.collectAsState()+ Row(verticalAlignment = Alignment.CenterVertically, modifier = Modifier.fillMaxWidth().padding(start = 20.dp, end = 20.dp, top = 18.dp, bottom = 4.dp)) {+ Icon(areaIcon(area), null, tint = AppAccent, modifier = Modifier.size(20.dp))+ Spacer(Modifier.width(10.dp))+ Text(stringResource(areaLabel(area)), color = AppText, fontSize = 17.sp, fontWeight = FontWeight.Bold)+ }+ // The exclusive actions of this area: who acts now.+ val exclusive = Action.entries.filter { it.area == area && it.mode == app.myspoti.extensions.Mode.EXCLUSIVE }+ list.forEachIndexed { i, e ->+ val m = remember(e.id, e.sha256) { Extensions.manifest(e.id) }+ InstalledRow(e, errors[e.id], statuses[e.id], e.id in updates, enable, onOpen = { onOpen(e.id) }) {+ exclusive.filter { m?.actionSet()?.contains(it) == true }.forEach { a ->+ val active = Extensions.activeFor(a) == e.id+ Row(verticalAlignment = Alignment.CenterVertically, modifier = Modifier.padding(top = 2.dp)+ .clickable(enabled = !active && e.enabled) { Extensions.setActive(a, e.id) }) {+ Icon(actionIcon(a), null, tint = if (active) AppAccent else AppMuted, modifier = Modifier.size(14.dp))+ Spacer(Modifier.width(4.dp))+ Text(if (active) stringResource(R.string.area_active) else stringResource(R.string.area_idle) + " · " + stringResource(R.string.area_make_active, stringResource(actionLabel(a)).lowercase()),+ color = if (active) AppAccent else AppMuted, fontSize = 11.sp, maxLines = 1, overflow = TextOverflow.Ellipsis)+ }+ }+ if (list.size >= 2) Row {+ IconButton(onClick = { Extensions.movePriority(area, e.id, -1) }, enabled = i > 0, modifier = Modifier.size(28.dp)) {+ Icon(Icons.Default.KeyboardArrowUp, stringResource(R.string.extensions_move_up), tint = if (i > 0) AppText else AppMuted.copy(alpha = 0.3f))+ }+ IconButton(onClick = { Extensions.movePriority(area, e.id, 1) }, enabled = i < list.lastIndex, modifier = Modifier.size(28.dp)) {+ Icon(Icons.Default.KeyboardArrowDown, stringResource(R.string.extensions_move_down), tint = if (i < list.lastIndex) AppText else AppMuted.copy(alpha = 0.3f))+ }+ }+ }+ }+ // Who did what here lately.+ val recent = remember(activity, area) { activity.filter { it.area == area }.takeLast(3).asReversed() }+ if (recent.isNotEmpty()) {+ Text(stringResource(R.string.area_activity), color = AppMuted, fontSize = 11.sp, fontWeight = FontWeight.Bold, modifier = Modifier.padding(start = 20.dp, top = 6.dp))+ recent.forEach { a ->+ val on = Extensions.registry.value.find(a.extensionId)?.enabled == true+ Row(verticalAlignment = Alignment.CenterVertically, modifier = Modifier.fillMaxWidth().padding(start = 20.dp, end = 8.dp)) {+ Text(a.text, color = AppMuted, fontSize = 12.sp, maxLines = 1, overflow = TextOverflow.Ellipsis, modifier = Modifier.weight(1f))+ Text(android.text.format.DateUtils.getRelativeTimeSpanString(a.at, System.currentTimeMillis(), android.text.format.DateUtils.MINUTE_IN_MILLIS).toString(),+ color = AppMuted.copy(alpha = 0.7f), fontSize = 11.sp, modifier = Modifier.padding(horizontal = 6.dp))+ if (on) androidx.compose.material3.TextButton(onClick = { enable(a.extensionId, false) }) { Text(stringResource(R.string.area_turn_off), color = Warning, fontSize = 12.sp) }+ }+ }+ }+}++/** An installed row: icon (a dot when it failed), name, version, its state or description, its action icons, the switch; [extra] under it. */+@Composable+private fun InstalledRow(e: InstalledExtension, error: String?, status: app.myspoti.extensions.ExtensionStatus?, update: Boolean, enable: (String, Boolean) -> Unit, onOpen: () -> Unit, extra: @Composable () -> Unit = {}) {+ val pkg = remember(e.id, e.sha256) { Extensions.pkg(e.id) }+ val m = pkg?.manifest+ val state = stateLine(e, error, status)+ Row(+ verticalAlignment = Alignment.CenterVertically,+ modifier = Modifier.fillMaxWidth().clickable(onClick = onOpen).padding(horizontal = 20.dp, vertical = 10.dp),+ ) {+ Box {+ ExtIcon(e.id, e.name, null, pkg?.icon)+ if (state != null) Box(Modifier.align(Alignment.TopEnd).padding(0.dp)) { Dot(state.second) }+ }+ Column(Modifier.weight(1f).padding(horizontal = 12.dp)) {+ Row(verticalAlignment = Alignment.CenterVertically) {+ Text(e.name, color = if (e.enabled) AppText else AppMuted, fontSize = 15.sp, fontWeight = FontWeight.SemiBold, maxLines = 1, overflow = TextOverflow.Ellipsis, modifier = Modifier.weight(1f, fill = false))+ Spacer(Modifier.width(6.dp))+ VersionPill(e.version)+ if (update) { Spacer(Modifier.width(4.dp)); ExtPill(stringResource(R.string.extensions_update_badge), AppAccent, AppAccent.copy(alpha = 0.18f)) }+ }+ when {+ state != null -> Text(state.first, color = state.second, fontSize = 12.sp, maxLines = 2, overflow = TextOverflow.Ellipsis)+ !e.enabled -> Text(stringResource(R.string.extension_off), color = AppMuted, fontSize = 12.sp)+ else -> Text(m?.description?.ifBlank { null } ?: e.author, color = AppMuted, fontSize = 12.sp, maxLines = 1, overflow = TextOverflow.Ellipsis)+ }+ m?.let { ActionIcons(it.asks().filter { a -> a.key in e.granted }) }+ extra()+ }+ Switch(checked = e.enabled, onCheckedChange = { enable(e.id, it) })+ }+}++@Composable+private fun InstallButtons(onRepo: (() -> Unit)?, onFile: () -> Unit, onUrl: () -> Unit) {+ Row(Modifier.fillMaxWidth().horizontalScroll(rememberScrollState()).padding(horizontal = 16.dp, vertical = 8.dp), horizontalArrangement = Arrangement.spacedBy(8.dp)) {+ val border = BorderStroke(1.dp, AppMuted.copy(alpha = 0.5f))+ onRepo?.let { OutlinedButton(onClick = it, border = border) { Text(stringResource(R.string.extensions_repository_add), color = AppText, fontSize = 13.sp) } }+ OutlinedButton(onClick = onFile, border = border) { Text(stringResource(R.string.extensions_install_file), color = AppText, fontSize = 13.sp) }+ OutlinedButton(onClick = onUrl, border = border) { Text(stringResource(R.string.extensions_install_url), color = AppText, fontSize = 13.sp) }+ }+}diff --git a/base/app/src/main/java/com/music/spotui/ui/screens/FollowListScreen.kt b/base/app/src/main/java/com/music/spotui/ui/screens/FollowListScreen.ktindex 0f4ace7c..2a42193a 100644--- a/base/app/src/main/java/com/music/spotui/ui/screens/FollowListScreen.kt+++ b/base/app/src/main/java/com/music/spotui/ui/screens/FollowListScreen.kt@@ -1,5 +1,8 @@package com.music.spotui.ui.screens+import com.music.spotui.ui.theme.AppText+import com.music.spotui.ui.theme.AppMuted+import androidx.compose.foundation.backgroundimport androidx.compose.foundation.layout.Arrangementimport androidx.compose.foundation.layout.Box@@ -73,19 +76,19 @@ fun FollowListScreen(navController: NavController, userId: String, followers: Boitem {Row(verticalAlignment = Alignment.CenterVertically) {Icon(- Icons.AutoMirrored.Filled.ArrowBack, stringResource(R.string.accessibility_navigate_back), tint = Color.White,+ Icons.AutoMirrored.Filled.ArrowBack, stringResource(R.string.accessibility_navigate_back), tint = AppText,modifier = Modifier.pressable(0.96f) { navController.navigateUp() }.padding(16.dp).size(26.dp),)Text(stringResource(if (followers) R.string.profile_followers_title else R.string.profile_following_title),- color = Color.White, fontSize = 22.sp, fontWeight = FontWeight.Bold,+ color = AppText, fontSize = 22.sp, fontWeight = FontWeight.Bold,)}}when {list == null -> item { com.music.spotui.ui.components.SkeletonList(count = 8, round = true) }list.isEmpty() -> item {- Text(stringResource(R.string.profile_list_empty), color = Color(0xFFB3B3B3), fontSize = 15.sp,+ Text(stringResource(R.string.profile_list_empty), color = AppMuted, fontSize = 15.sp,modifier = Modifier.padding(16.dp))}else -> items(list, key = { it.uri }) { u ->@@ -103,7 +106,7 @@ fun FollowListScreen(navController: NavController, userId: String, followers: Bomodifier = Modifier.size(52.dp).clip(CircleShape),)Spacer(Modifier.width(12.dp))- Text(u.name, color = Color.White, fontSize = 16.sp, maxLines = 1, overflow = TextOverflow.Ellipsis)+ Text(u.name, color = AppText, fontSize = 16.sp, maxLines = 1, overflow = TextOverflow.Ellipsis)}}}diff --git a/base/app/src/main/java/com/music/spotui/ui/screens/HomeScreen.kt b/base/app/src/main/java/com/music/spotui/ui/screens/HomeScreen.ktindex f8bfbfe3..21d99d2f 100644--- a/base/app/src/main/java/com/music/spotui/ui/screens/HomeScreen.kt+++ b/base/app/src/main/java/com/music/spotui/ui/screens/HomeScreen.kt@@ -1,5 +1,9 @@package com.music.spotui.ui.screens+import com.music.spotui.ui.theme.tone+import com.music.spotui.ui.theme.AppText+import com.music.spotui.ui.theme.AppMuted+import com.music.spotui.ui.components.SkeletonKindimport com.music.spotui.ui.components.pressable@@ -58,7 +62,9 @@ import androidx.compose.ui.graphics.Colorimport androidx.compose.ui.graphics.toArgbimport androidx.compose.ui.layout.ContentScaleimport androidx.compose.ui.res.painterResource+import androidx.compose.material.icons.Iconsimport androidx.compose.material.icons.filled.Check+import androidx.compose.material.icons.filled.Extensionimport androidx.compose.ui.text.TextStyleimport androidx.compose.ui.text.font.FontWeightimport androidx.compose.ui.text.style.TextAlign@@ -119,7 +125,7 @@ fun HomeScreen(navController: NavController){else -> androidx.compose.foundation.layout.Column(horizontalAlignment = Alignment.CenterHorizontally) {Text(text = if (home is Response.Error) stringResource(R.string.home_error) else stringResource(R.string.home_empty),- color = Color.White,+ color = AppText,textAlign = TextAlign.Center,)if (home is Response.Error) androidx.compose.material3.TextButton(onClick = { homeViewModel.retry() }) {@@ -227,6 +233,8 @@ fun HomeFeedContent(navController: NavController, feed: HomeFeedModel, facet: Stitems(carousels.size) { i ->HomeFeedSection(navController, carousels[i])}+ // Sections from extensions (home.sections), after Spotify's own, each under its extension's name.+ item { com.music.spotui.extensions.ExtensionBlocks(app.myspoti.extensions.Hook.HOME, app.myspoti.extensions.Surface.HOME, "{}") }}}@@ -282,7 +290,7 @@ private fun HomeHeaderRow(navController: NavController, facet: String, onFacet:modifier = Modifier.padding(start = 10.dp).size(width = 1.dp, height = 22.dp)- .background(Color(0xFF3E3E3E)),+ .background(tone(0xFF3E3E3E)),)// Scrolls sideways if the pills don't fit, like Spotify's.Row(@@ -310,11 +318,11 @@ private fun HomePill(label: String, selected: Boolean = false, onClick: () -> UncontentAlignment = Alignment.Center,modifier = Modifier.clip(RoundedCornerShape(50))- .background(if (selected) com.music.spotui.ui.theme.AppAccent else Color(0xFF2A2A2A))+ .background(if (selected) com.music.spotui.ui.theme.AppAccent else tone(0xFF2A2A2A)).clickable(onClick = onClick).padding(horizontal = 16.dp, vertical = 8.dp),) {- Text(text = label, color = if (selected) Color.Black else Color.White, fontSize = 14.sp, fontWeight = FontWeight.Bold)+ Text(text = label, color = if (selected) Color.Black else AppText, fontSize = 14.sp, fontWeight = FontWeight.Bold)}}@@ -350,7 +358,7 @@ private fun HomeShortcutGrid(navController: NavController, items: List<HomeItem>)Text(text = item.name,- color = Color.White,+ color = AppText,fontSize = 12.sp,lineHeight = 14.sp,fontWeight = FontWeight.Bold,@@ -369,7 +377,7 @@ private fun HomeShortcutGrid(navController: NavController, items: List<HomeItem>private fun HomeFeedSection(navController: NavController, section: HomeSection) {Text(text = section.title,- color = Color.White,+ color = AppText,fontSize = 21.sp,fontWeight = FontWeight.Bold,maxLines = 2,@@ -414,7 +422,7 @@ private fun HomeFeedCard(item: HomeItem, onClick: () -> Unit) {Spacer(modifier = Modifier.height(6.dp))Text(text = item.name,- color = Color.White,+ color = AppText,fontSize = 13.sp,fontWeight = FontWeight.SemiBold,maxLines = 1, overflow = androidx.compose.ui.text.style.TextOverflow.Ellipsis,@@ -423,7 +431,7 @@ private fun HomeFeedCard(item: HomeItem, onClick: () -> Unit) {// Always two lines tall: a long artist mix no longer makes one card taller than its row.Text(text = subtitle,- color = Color(0xFFB3B3B3),+ color = AppMuted,fontSize = 11.sp,lineHeight = 14.sp,minLines = 2,@@ -440,7 +448,7 @@ private fun ProfileSheet(onOpen: (route: String) -> Unit = {}, onDismiss: () ->val name = com.music.spotui.data.api.ProfileCache.name.orEmpty()val avatar = com.music.spotui.data.api.ProfileCache.imageUrl// Opened in full: half-open, the sheet and its list both moved under the finger.- androidx.compose.material3.ModalBottomSheet(onDismissRequest = onDismiss, containerColor = Color(0xFF282828),+ androidx.compose.material3.ModalBottomSheet(onDismissRequest = onDismiss, containerColor = tone(0xFF282828),sheetState = androidx.compose.material3.rememberModalBottomSheetState(skipPartiallyExpanded = true)) {androidx.compose.foundation.layout.Column(modifier = Modifier.fillMaxWidth().then(Modifier.windowInsetsPadding(androidx.compose.foundation.layout.WindowInsets.navigationBars))@@ -452,29 +460,29 @@ private fun ProfileSheet(onOpen: (route: String) -> Unit = {}, onDismiss: () ->.clickable(enabled = myId != null) { myId?.let { onOpen(com.music.spotui.ui.navigation.profileRoute(it, name)) } }.padding(horizontal = 20.dp, vertical = 8.dp)) {com.music.spotui.ui.components.ProfileAvatar(url = avatar, name = name, size = 48.dp)- Text(name.ifBlank { stringResource(R.string.spotify_account) }, color = Color.White, fontSize = 18.sp, fontWeight = FontWeight.Bold,+ Text(name.ifBlank { stringResource(R.string.spotify_account) }, color = AppText, fontSize = 18.sp, fontWeight = FontWeight.Bold,modifier = Modifier.padding(start = 14.dp))if (com.music.spotui.data.api.SupportReminder.level != com.music.spotui.data.api.SupportReminder.Level.NONE)com.music.spotui.ui.components.SupporterBadge(Modifier.padding(start = 10.dp))}- if (myId != null) Text(stringResource(R.string.view_profile), color = Color(0xFFB3B3B3), fontSize = 13.sp,+ if (myId != null) Text(stringResource(R.string.view_profile), color = AppMuted, fontSize = 13.sp,modifier = Modifier.padding(start = 82.dp, bottom = 4.dp))- androidx.compose.material3.HorizontalDivider(color = Color(0xFF3E3E3E), modifier = Modifier.padding(vertical = 8.dp))+ androidx.compose.material3.HorizontalDivider(color = tone(0xFF3E3E3E), modifier = Modifier.padding(vertical = 8.dp))// Sound quality, downloads, data, battery, display: one page.androidx.compose.foundation.layout.Column(Modifier.fillMaxWidth().clickable { onOpen(com.music.spotui.ui.navigation.Routes.Settings.route) }.padding(horizontal = 20.dp, vertical = 10.dp),) {- Text(stringResource(R.string.settings_title), color = Color.White, fontSize = 16.sp)- Text(stringResource(R.string.settings_detail), color = Color(0xFFB3B3B3), fontSize = 12.sp)+ Text(stringResource(R.string.settings_title), color = AppText, fontSize = 16.sp)+ Text(stringResource(R.string.settings_detail), color = AppMuted, fontSize = 12.sp)}// In-app recap: every listen on this phone, Spotify, downloads and local files.androidx.compose.foundation.layout.Column(Modifier.fillMaxWidth().clickable { onOpen(com.music.spotui.ui.navigation.Routes.Recap.route) }.padding(horizontal = 20.dp, vertical = 10.dp),) {- Text(stringResource(R.string.recap_title), color = Color.White, fontSize = 16.sp)- Text(stringResource(R.string.recap_detail), color = Color(0xFFB3B3B3), fontSize = 12.sp)+ Text(stringResource(R.string.recap_title), color = AppText, fontSize = 16.sp)+ Text(stringResource(R.string.recap_detail), color = AppMuted, fontSize = 12.sp)}// The account's own listening history, as Spotify keeps it: it belongs beside the// recap (the local counter) because both answer "what did I listen to".@@ -482,8 +490,35 @@ private fun ProfileSheet(onOpen: (route: String) -> Unit = {}, onDismiss: () ->Modifier.fillMaxWidth().clickable { onOpen(com.music.spotui.ui.navigation.Routes.Recent.route) }.padding(horizontal = 20.dp, vertical = 10.dp),) {- Text(stringResource(R.string.recents_title), color = Color.White, fontSize = 16.sp)- Text(stringResource(R.string.recents_detail), color = Color(0xFFB3B3B3), fontSize = 12.sp)+ Text(stringResource(R.string.recents_title), color = AppText, fontSize = 16.sp)+ Text(stringResource(R.string.recents_detail), color = AppMuted, fontSize = 12.sp)+ }+ // What the followed people are listening to (the official Friend Activity feed).+ androidx.compose.foundation.layout.Column(+ Modifier.fillMaxWidth().clickable { onOpen(com.music.spotui.ui.navigation.Routes.Friends.route) }+ .padding(horizontal = 20.dp, vertical = 10.dp),+ ) {+ Text(stringResource(R.string.friends_title), color = AppText, fontSize = 16.sp)+ Text(stringResource(R.string.friends_detail), color = AppMuted, fontSize = 12.sp)+ }+ // Third-party extensions (lyrics, audio, scripts): installed, enabled, repositories.+ val extRegistry by com.music.spotui.extensions.Extensions.registry.collectAsState()+ Row(+ Modifier.fillMaxWidth().clickable { onOpen(com.music.spotui.ui.navigation.Routes.Extensions.route) }+ .padding(horizontal = 20.dp, vertical = 10.dp),+ verticalAlignment = Alignment.CenterVertically,+ ) {+ androidx.compose.foundation.layout.Column(Modifier.weight(1f)) {+ Text(stringResource(R.string.extensions_title), color = AppText, fontSize = 16.sp)+ val installed = extRegistry.extensions+ Text(+ if (installed.isEmpty()) stringResource(R.string.extensions_row_detail)+ else stringResource(R.string.extensions_row_count, installed.size, installed.count { it.enabled }),+ color = AppMuted, fontSize = 12.sp,+ )+ }+ androidx.compose.material3.Icon(Icons.Filled.Extension, null, tint = AppMuted,+ modifier = Modifier.padding(start = 12.dp).size(22.dp))}// The Spotify account page (plan, privacy, devices), in the app's signed-in browser.androidx.compose.foundation.layout.Column(@@ -492,8 +527,8 @@ private fun ProfileSheet(onOpen: (route: String) -> Unit = {}, onDismiss: () ->com.music.spotui.ui.screens.AccountBrowser.open(com.music.spotui.di.Graph.app, com.music.spotui.ui.screens.AccountBrowser.ACCOUNT_URL)}.padding(horizontal = 20.dp, vertical = 10.dp),) {- Text(stringResource(R.string.account_page_title), color = Color.White, fontSize = 16.sp)- Text(stringResource(R.string.account_page_detail), color = Color(0xFFB3B3B3), fontSize = 12.sp)+ Text(stringResource(R.string.account_page_title), color = AppText, fontSize = 16.sp)+ Text(stringResource(R.string.account_page_detail), color = AppMuted, fontSize = 12.sp)}val ctx = androidx.compose.ui.platform.LocalContext.current// Donations (Ko-fi or GitHub Sponsors): always here, never in the way.@@ -504,7 +539,7 @@ private fun ProfileSheet(onOpen: (route: String) -> Unit = {}, onDismiss: () ->.padding(horizontal = 20.dp, vertical = 10.dp),) {Text(stringResource(R.string.support_title), color = com.music.spotui.ui.theme.AppAccent, fontSize = 16.sp)- Text(stringResource(R.string.support_row_detail), color = Color(0xFFB3B3B3), fontSize = 12.sp)+ Text(stringResource(R.string.support_row_detail), color = AppMuted, fontSize = 12.sp)}// About: version, Discord, source code and Ko-fi.var about by remember { androidx.compose.runtime.mutableStateOf(false) }@@ -512,20 +547,20 @@ private fun ProfileSheet(onOpen: (route: String) -> Unit = {}, onDismiss: () ->androidx.compose.foundation.layout.Column(Modifier.fillMaxWidth().clickable { about = true }.padding(horizontal = 20.dp, vertical = 10.dp),) {- Text(stringResource(R.string.creator_biography_section_title), color = Color.White, fontSize = 16.sp)- Text(stringResource(R.string.about_detail), color = Color(0xFFB3B3B3), fontSize = 12.sp)+ Text(stringResource(R.string.creator_biography_section_title), color = AppText, fontSize = 16.sp)+ Text(stringResource(R.string.about_detail), color = AppMuted, fontSize = 12.sp)}var perks by remember { androidx.compose.runtime.mutableStateOf(false) }if (perks) com.music.spotui.ui.components.SupporterSheet(onDismiss = { perks = false })if (com.music.spotui.data.api.SupportReminder.PERKS_ENABLED) androidx.compose.foundation.layout.Column(Modifier.fillMaxWidth().clickable { perks = true }.padding(horizontal = 20.dp, vertical = 10.dp),) {- Text(stringResource(R.string.supporter_perks_title), color = Color.White, fontSize = 16.sp)- Text(stringResource(R.string.supporter_perks_detail), color = Color(0xFFB3B3B3), fontSize = 12.sp)+ Text(stringResource(R.string.supporter_perks_title), color = AppText, fontSize = 16.sp)+ Text(stringResource(R.string.supporter_perks_detail), color = AppMuted, fontSize = 12.sp)}Text(stringResource(R.string.connect_device_menu_logout),- color = Color.White, fontSize = 16.sp,+ color = AppText, fontSize = 16.sp,modifier = Modifier.fillMaxWidth().clickable {diff --git a/base/app/src/main/java/com/music/spotui/ui/screens/LibraryExtras.kt b/base/app/src/main/java/com/music/spotui/ui/screens/LibraryExtras.ktindex acb9733a..c61c7bb9 100644--- a/base/app/src/main/java/com/music/spotui/ui/screens/LibraryExtras.kt+++ b/base/app/src/main/java/com/music/spotui/ui/screens/LibraryExtras.kt@@ -1,5 +1,9 @@package com.music.spotui.ui.screens+import com.music.spotui.ui.theme.tone+import com.music.spotui.ui.theme.AppText+import com.music.spotui.ui.theme.AppMuted+import androidx.compose.material.icons.outlined.Folderimport androidx.compose.material.icons.outlined.Homeimport androidx.compose.material.icons.outlined.DriveFileMove@@ -100,7 +104,7 @@ import kotlinx.coroutines.launchimport kotlinx.coroutines.withContextprivate val Green: Color get() = com.music.spotui.ui.theme.AppAccent-private val SheetColor = Color(0xFF282828)+private val SheetColor: androidx.compose.ui.graphics.Color get() = tone(0xFF282828)/** A name prompt (new playlist / folder, rename). */@Composable@@ -109,13 +113,13 @@ fun NameDialog(title: String, initial: String, confirm: String, onDismiss: () ->AlertDialog(onDismissRequest = onDismiss,containerColor = SheetColor,- title = { Text(title, color = Color.White) },+ title = { Text(title, color = AppText) },text = {TextField(value = text, onValueChange = { text = it }, singleLine = true,colors = TextFieldDefaults.colors(- focusedContainerColor = Color(0xFF3A3A3A), unfocusedContainerColor = Color(0xFF3A3A3A),- focusedTextColor = Color.White, unfocusedTextColor = Color.White, cursorColor = Green,+ focusedContainerColor = tone(0xFF3A3A3A), unfocusedContainerColor = tone(0xFF3A3A3A),+ focusedTextColor = AppText, unfocusedTextColor = AppText, cursorColor = Green,focusedIndicatorColor = Green, unfocusedIndicatorColor = Color.Transparent,),)@@ -124,7 +128,7 @@ fun NameDialog(title: String, initial: String, confirm: String, onDismiss: () ->TextButton(enabled = text.isNotBlank(), onClick = { onConfirm(text.trim()) }) { Text(confirm, color = Green) }},dismissButton = {- TextButton(onClick = onDismiss) { Text(stringResource(R.string.add_to_playlist_button_cancel), color = Color.White) }+ TextButton(onClick = onDismiss) { Text(stringResource(R.string.add_to_playlist_button_cancel), color = AppText) }},)}@@ -135,11 +139,11 @@ private fun SheetRow(icon: ImageVector, label: String, detail: String? = null, overticalAlignment = Alignment.CenterVertically,modifier = Modifier.fillMaxWidth().heightIn(min = 60.dp).clickable(onClick = onClick).padding(horizontal = 20.dp, vertical = 8.dp),) {- Icon(icon, null, tint = Color(0xFFB3B3B3), modifier = Modifier.size(26.dp))+ Icon(icon, null, tint = AppMuted, modifier = Modifier.size(26.dp))Spacer(Modifier.width(16.dp))Column {- Text(label, color = Color.White, fontSize = 16.sp)- if (detail != null) Text(detail, color = Color(0xFFB3B3B3), fontSize = 12.sp)+ Text(label, color = AppText, fontSize = 16.sp)+ if (detail != null) Text(detail, color = AppMuted, fontSize = 12.sp)}}}@@ -218,9 +222,9 @@ private fun BlendSheet(navController: NavController, onDismiss: () -> Unit) {}ModalBottomSheet(onDismissRequest = onDismiss, containerColor = SheetColor) {Column(Modifier.navigationBarsPadding().padding(bottom = 12.dp)) {- Text(stringResource(R.string.blend_title), color = Color.White, fontSize = 18.sp, fontWeight = FontWeight.Bold,+ Text(stringResource(R.string.blend_title), color = AppText, fontSize = 18.sp, fontWeight = FontWeight.Bold,modifier = Modifier.padding(20.dp, 0.dp, 20.dp, 8.dp))- if (busy) Text(stringResource(R.string.blend_working), color = Color(0xFFB3B3B3), fontSize = 14.sp, modifier = Modifier.padding(20.dp, 12.dp))+ if (busy) Text(stringResource(R.string.blend_working), color = AppMuted, fontSize = 14.sp, modifier = Modifier.padding(20.dp, 12.dp))else {SheetRow(Icons.Outlined.Share, stringResource(R.string.blend_invite)) {busy = true@@ -282,14 +286,14 @@ fun BlendInviteSheet(link: com.music.spotui.data.api.InviteLinks.BlendLink, navCjoinable && inviter != null -> stringResource(R.string.blend_invited_by, inviter.name)else -> v.title ?: stringResource(R.string.blend_title)}- Text(title, color = Color.White, fontSize = 20.sp, fontWeight = FontWeight.Bold, textAlign = androidx.compose.ui.text.style.TextAlign.Center)+ Text(title, color = AppText, fontSize = 20.sp, fontWeight = FontWeight.Bold, textAlign = androidx.compose.ui.text.style.TextAlign.Center)val detail = when {v == null && !failed -> stringResource(R.string.blend_working)v == null -> nulljoinable -> stringResource(R.string.blend_detail)else -> v.subtitle}- if (detail != null) Text(detail, color = Color(0xFFB3B3B3), fontSize = 14.sp, textAlign = androidx.compose.ui.text.style.TextAlign.Center,+ if (detail != null) Text(detail, color = AppMuted, fontSize = 14.sp, textAlign = androidx.compose.ui.text.style.TextAlign.Center,modifier = Modifier.padding(top = 6.dp))Spacer(Modifier.height(24.dp))if (joinable) androidx.compose.material3.Button(@@ -317,11 +321,11 @@ fun BlendInviteSheet(link: com.music.spotui.data.api.InviteLinks.BlendLink, navCcontext.startActivity(android.content.Intent.createChooser(send, null).addFlags(android.content.Intent.FLAG_ACTIVITY_NEW_TASK))onDismiss()},- colors = androidx.compose.material3.ButtonDefaults.buttonColors(containerColor = Color.White, contentColor = Color.Black),+ colors = androidx.compose.material3.ButtonDefaults.buttonColors(containerColor = AppText, contentColor = com.music.spotui.ui.theme.AppBackground),modifier = Modifier.fillMaxWidth().height(48.dp),) { Text(stringResource(R.string.blend_invite), fontWeight = FontWeight.Bold, fontSize = 16.sp) }TextButton(onClick = onDismiss, modifier = Modifier.padding(top = 4.dp)) {- Text(stringResource(R.string.blend_later), color = Color.White)+ Text(stringResource(R.string.blend_later), color = AppText)}}}@@ -336,15 +340,15 @@ private fun PageHeader(title: String, subtitle: String?, navController: NavContrBox(contentAlignment = Alignment.Center,modifier = Modifier.size(44.dp).clip(CircleShape).pressable { navController.navigateUp() },- ) { Icon(Icons.AutoMirrored.Filled.ArrowBack, stringResource(R.string.accessibility_navigate_back), tint = Color.White) }+ ) { Icon(Icons.AutoMirrored.Filled.ArrowBack, stringResource(R.string.accessibility_navigate_back), tint = AppText) }Column(Modifier.weight(1f).padding(start = 4.dp)) {- Text(title, color = Color.White, fontSize = 20.sp, fontWeight = FontWeight.Bold, maxLines = 1, overflow = TextOverflow.Ellipsis)- if (subtitle != null) Text(subtitle, color = Color(0xFFB3B3B3), fontSize = 13.sp)+ Text(title, color = AppText, fontSize = 20.sp, fontWeight = FontWeight.Bold, maxLines = 1, overflow = TextOverflow.Ellipsis)+ if (subtitle != null) Text(subtitle, color = AppMuted, fontSize = 13.sp)}if (onMenu != null) Box(contentAlignment = Alignment.Center,modifier = Modifier.size(44.dp).clip(CircleShape).pressable { onMenu() },- ) { Icon(Icons.Default.MoreVert, stringResource(R.string.content_description_context_menu), tint = Color.White) }+ ) { Icon(Icons.Default.MoreVert, stringResource(R.string.content_description_context_menu), tint = AppText) }}}@@ -382,7 +386,7 @@ fun FolderScreen(navController: NavController, uri: String, initialName: String)if (deletingFolder) androidx.compose.material3.AlertDialog(onDismissRequest = { deletingFolder = false },containerColor = SheetColor,- text = { Text(stringResource(R.string.folder_delete_confirm, name), color = Color.White) },+ text = { Text(stringResource(R.string.folder_delete_confirm, name), color = AppText) },confirmButton = {androidx.compose.material3.TextButton(onClick = {deletingFolder = false@@ -391,7 +395,7 @@ fun FolderScreen(navController: NavController, uri: String, initialName: String)navController.navigateUp()}) { Text(stringResource(R.string.actions_picker_delete), color = Color(0xFFF15E6C)) }},- dismissButton = { androidx.compose.material3.TextButton(onClick = { deletingFolder = false }) { Text(stringResource(R.string.cancel), color = Color.White) } },+ dismissButton = { androidx.compose.material3.TextButton(onClick = { deletingFolder = false }) { Text(stringResource(R.string.cancel), color = AppText) } },)// A Spotify playlist created straight inside this folder.if (newPlaylist) NameDialog(stringResource(R.string.create_playlist_content_description), context.getString(R.string.my_playlist),@@ -438,8 +442,8 @@ private fun LocalItemRow(item: LocalItem, current: Boolean, onClick: () -> Unit)modifier = Modifier.size(48.dp).clip(RoundedCornerShape(4.dp)),)Column(Modifier.padding(start = 12.dp).weight(1f)) {- Text(item.title, color = if (current) Green else Color.White, fontSize = 15.sp, maxLines = 1, overflow = TextOverflow.Ellipsis)- if (item.artist.isNotBlank()) Text(item.artist, color = Color(0xFFB3B3B3), fontSize = 13.sp, maxLines = 1, overflow = TextOverflow.Ellipsis)+ Text(item.title, color = if (current) Green else AppText, fontSize = 15.sp, maxLines = 1, overflow = TextOverflow.Ellipsis)+ if (item.artist.isNotBlank()) Text(item.artist, color = AppMuted, fontSize = 13.sp, maxLines = 1, overflow = TextOverflow.Ellipsis)}}}@@ -484,7 +488,7 @@ fun LocalPlaylistScreen(navController: NavController, id: String) {PageHeader(playlist.name, stringResource(R.string.local_playlist_subtitle) + " • " +pluralStringResource(R.plurals.add_to_playlist_subtitle_songs_count, playlist.items.size, playlist.items.size.toString()),navController) { menu = true }- if (playlist.items.isEmpty()) Text(stringResource(R.string.local_playlist_empty), color = Color(0xFFB3B3B3), fontSize = 14.sp,+ if (playlist.items.isEmpty()) Text(stringResource(R.string.local_playlist_empty), color = AppMuted, fontSize = 14.sp,modifier = Modifier.padding(20.dp))else LazyColumn(contentPadding = PaddingValues(bottom = com.music.spotui.ui.components.bottomBarsSpace()), modifier = Modifier.fillMaxSize()) {item {@@ -535,9 +539,9 @@ fun AddLocalToPlaylistSheet(track: LocalTrack, onDismiss: () -> Unit) {ModalBottomSheet(onDismissRequest = onDismiss, containerColor = SheetColor) {LazyColumn(Modifier.navigationBarsPadding().heightIn(max = 560.dp)) {item {- Text(stringResource(R.string.context_menu_add_to_playlist), color = Color.White, fontSize = 20.sp, fontWeight = FontWeight.Bold,+ Text(stringResource(R.string.context_menu_add_to_playlist), color = AppText, fontSize = 20.sp, fontWeight = FontWeight.Bold,modifier = Modifier.padding(20.dp, 4.dp, 20.dp, 4.dp))- Text(stringResource(R.string.local_add_note), color = Color(0xFFB3B3B3), fontSize = 12.sp,+ Text(stringResource(R.string.local_add_note), color = AppMuted, fontSize = 12.sp,modifier = Modifier.padding(20.dp, 0.dp, 20.dp, 8.dp))SheetRow(Icons.AutoMirrored.Filled.PlaylistAdd, stringResource(R.string.add_to_playlist_new_playlist_button_text),stringResource(R.string.local_playlist_subtitle)) { creating = true }@@ -572,8 +576,8 @@ private fun PickRow(name: String, detail: String, cover: String?, onClick: () ->loading = placeholder(R.drawable.placeholder), failure = placeholder(R.drawable.placeholder),modifier = Modifier.size(48.dp).clip(RoundedCornerShape(4.dp)))Column(Modifier.padding(start = 12.dp)) {- Text(name, color = Color.White, fontSize = 15.sp, maxLines = 1, overflow = TextOverflow.Ellipsis)- Text(detail, color = Color(0xFFB3B3B3), fontSize = 12.sp, maxLines = 1, overflow = androidx.compose.ui.text.style.TextOverflow.Ellipsis)+ Text(name, color = AppText, fontSize = 15.sp, maxLines = 1, overflow = TextOverflow.Ellipsis)+ Text(detail, color = AppMuted, fontSize = 12.sp, maxLines = 1, overflow = androidx.compose.ui.text.style.TextOverflow.Ellipsis)}}}@@ -590,6 +594,7 @@ fun LibraryItemSheet(entry: LibraryEntry, onDismiss: () -> Unit, onChanged: () -val context = LocalContext.currentvar moving by remember { mutableStateOf(false) }var deleting by remember { mutableStateOf(false) }+ var merging by remember { mutableStateOf(false) }// The change shows in the list at once and is written in the app's own scope (the sheet is// closed by then); a refusal puts the list back and says so.fun act(edit: LibraryEdits.Edit, block: suspend () -> Unit) {@@ -599,13 +604,16 @@ fun LibraryItemSheet(entry: LibraryEntry, onDismiss: () -> Unit, onChanged: () -val api = app.myspoti.host.android.MyspotiRuntime.apiModalBottomSheet(onDismissRequest = onDismiss, containerColor = SheetColor) {Column(Modifier.navigationBarsPadding().padding(bottom = 12.dp)) {- Text(entry.name, color = Color.White, fontSize = 18.sp, fontWeight = FontWeight.Bold, maxLines = 1, overflow = androidx.compose.ui.text.style.TextOverflow.Ellipsis,+ Text(entry.name, color = AppText, fontSize = 18.sp, fontWeight = FontWeight.Bold, maxLines = 1, overflow = androidx.compose.ui.text.style.TextOverflow.Ellipsis,modifier = Modifier.padding(20.dp, 0.dp, 20.dp, 8.dp))if (!moving) {SheetRow(Icons.Outlined.PushPin, stringResource(if (entry.pinned) R.string.library_unpin else R.string.library_pin)) {act(LibraryEdits.Pin(entry.uri, !entry.pinned)) { if (entry.pinned) api.library.unpin(entry.uri) else api.library.pin(entry.uri) }}if (entry.isPlaylist || entry.isFolder) SheetRow(Icons.Outlined.DriveFileMove, stringResource(R.string.library_move_to_folder)) { moving = true }+ // A saved playlist or album: all its songs into another playlist of yours.+ if (entry.uri.startsWith("spotify:playlist:") || entry.uri.startsWith("spotify:album:"))+ SheetRow(Icons.AutoMirrored.Filled.PlaylistAdd, stringResource(R.string.context_menu_add_to_playlist)) { merging = true }if (entry.isFolder) SheetRow(Icons.Outlined.Delete, stringResource(R.string.folder_delete)) { deleting = true }} else {val folders by androidx.compose.runtime.produceState<List<app.myspoti.api.LibraryItem>?>(null) {@@ -619,15 +627,16 @@ fun LibraryItemSheet(entry: LibraryEntry, onDismiss: () -> Unit, onChanged: () -}}}+ if (merging) com.music.spotui.ui.components.AddCollectionToPlaylistSheet(entry.uri, entry.name) { merging = false; onDismiss() }if (deleting) androidx.compose.material3.AlertDialog(onDismissRequest = { deleting = false },containerColor = SheetColor,- text = { Text(stringResource(R.string.folder_delete_confirm, entry.name), color = Color.White) },+ text = { Text(stringResource(R.string.folder_delete_confirm, entry.name), color = AppText) },confirmButton = {androidx.compose.material3.TextButton(onClick = { deleting = false; act(LibraryEdits.Remove(entry.uri)) { api.library.deleteFolder(entry.uri) } }) {Text(stringResource(R.string.actions_picker_delete), color = Color(0xFFF15E6C))}},- dismissButton = { androidx.compose.material3.TextButton(onClick = { deleting = false }) { Text(stringResource(R.string.cancel), color = Color.White) } },+ dismissButton = { androidx.compose.material3.TextButton(onClick = { deleting = false }) { Text(stringResource(R.string.cancel), color = AppText) } },)}diff --git a/base/app/src/main/java/com/music/spotui/ui/screens/LibraryScreeen.kt b/base/app/src/main/java/com/music/spotui/ui/screens/LibraryScreeen.ktindex ff6b7172..3815cd62 100644--- a/base/app/src/main/java/com/music/spotui/ui/screens/LibraryScreeen.kt+++ b/base/app/src/main/java/com/music/spotui/ui/screens/LibraryScreeen.kt@@ -1,11 +1,16 @@package com.music.spotui.ui.screens+import com.music.spotui.ui.theme.tone+import com.music.spotui.ui.theme.AppText+import com.music.spotui.ui.theme.AppMuted+import androidx.compose.material.icons.filled.MoreVertimport androidx.compose.material.icons.filled.PushPinimport com.music.spotui.ui.components.pressableimport androidx.compose.ui.res.stringResourceimport androidx.compose.foundation.background+import androidx.compose.foundation.horizontalScrollimport androidx.compose.foundation.clickableimport androidx.compose.foundation.interaction.MutableInteractionSourceimport androidx.compose.foundation.layout.Arrangement@@ -129,6 +134,8 @@ fun LibraryScreen(navController: NavController) {var gridView by remember { mutableStateOf(isLibraryGridView(context)) }var searchActive by remember { mutableStateOf(false) }var searchQuery by remember { mutableStateOf("") }+ // The filter chips under the title; the chosen one is kept while the screen is open.+ var chip by androidx.compose.runtime.saveable.rememberSaveable { mutableStateOf(com.music.spotui.data.local.LibraryChip.ALL) }if (showAccount) {AccountSheet(@@ -155,7 +162,7 @@ fun LibraryScreen(navController: NavController) {Text(text = stringResource(R.string.navigationbar_musicappitems_yourlibrary_title),fontWeight = FontWeight.Bold,- color = Color.White,+ color = AppText,fontSize = 22.sp,// The title itself scrolls the list to its top in the official app// ("Appuyez pour faire défiler jusqu'en haut de la liste").@@ -171,13 +178,13 @@ fun LibraryScreen(navController: NavController) {Icon(painter = painterResource(R.drawable.ic_add),contentDescription = stringResource(R.string.create_playlist_content_description),- tint = Color.White,+ tint = AppText,modifier = Modifier.pressable(0.96f) { creating = true }.padding(end = 14.dp).size(22.dp),)Icon(imageVector = Icons.Default.Search,contentDescription = stringResource(R.string.library_search_text_hint),- tint = if (searchActive) Color(AppPalette.toArgb()) else Color.White,+ tint = if (searchActive) Color(AppPalette.toArgb()) else AppText,modifier = Modifier.pressable(0.96f) {searchActive = !searchActiveif (!searchActive) searchQuery = ""@@ -190,7 +197,7 @@ fun LibraryScreen(navController: NavController) {modifier = Modifier.size(34.dp).clip(CircleShape)- .background(Color(0xFF3A3A3A))+ .background(tone(0xFF3A3A3A)).clickable { showAccount = true },contentAlignment = Alignment.Center) {@@ -198,11 +205,13 @@ fun LibraryScreen(navController: NavController) {if (avatar.isNotBlank()) {AccountAvatar(avatar, 34.dp)} else {- Icon(Icons.Default.Person, contentDescription = stringResource(R.string.account_title), tint = Color.White, modifier = Modifier.size(20.dp))+ Icon(Icons.Default.Person, contentDescription = stringResource(R.string.account_title), tint = AppText, modifier = Modifier.size(20.dp))}}}+ LibraryChipRow(chip) { chip = com.music.spotui.data.local.LibraryChips.toggle(chip, it) }+// Grid/list switch, like the icon at the top-right of Spotify's library.Row(verticalAlignment = Alignment.CenterVertically,@@ -216,15 +225,15 @@ fun LibraryScreen(navController: NavController) {verticalAlignment = Alignment.CenterVertically,modifier = Modifier.pressable(0.96f) { sorting = true }.padding(vertical = 4.dp),) {- Icon(Icons.Default.SwapVert, contentDescription = null, tint = Color.White, modifier = Modifier.size(18.dp))- Text(stringResource(sortLabel(LibraryOrder.sort)), color = Color.White, fontSize = 13.sp, fontWeight = FontWeight.SemiBold,+ Icon(Icons.Default.SwapVert, contentDescription = null, tint = AppText, modifier = Modifier.size(18.dp))+ Text(stringResource(sortLabel(LibraryOrder.sort)), color = AppText, fontSize = 13.sp, fontWeight = FontWeight.SemiBold,modifier = Modifier.padding(start = 6.dp))}Spacer(modifier = Modifier.weight(1f))Icon(painter = painterResource(if (gridView) R.drawable.ic_view_list else R.drawable.ic_view_grid),contentDescription = if (gridView) stringResource(R.string.list_view) else stringResource(R.string.grid_view),- tint = Color.White,+ tint = AppText,modifier = Modifier.pressable(0.96f) {gridView = !gridViewsetLibraryGridView(context, gridView)@@ -241,7 +250,7 @@ fun LibraryScreen(navController: NavController) {.fillMaxWidth().padding(16.dp, 0.dp, 16.dp, 6.dp).clip(RoundedCornerShape(8.dp))- .background(Color(0xFF252525))+ .background(tone(0xFF252525)).padding(horizontal = 12.dp),) {Icon(Icons.Default.Search, contentDescription = null, tint = Color(0xFF888888), modifier = Modifier.size(18.dp))@@ -249,7 +258,7 @@ fun LibraryScreen(navController: NavController) {value = searchQuery,onValueChange = { searchQuery = it },singleLine = true,- textStyle = TextStyle(color = Color.White, fontSize = 15.sp),+ textStyle = TextStyle(color = AppText, fontSize = 15.sp),modifier = Modifier.weight(1f).padding(8.dp, 10.dp),@@ -319,17 +328,23 @@ fun LibraryScreen(navController: NavController) {LibraryOrder.versionLibraryOrder.arrange(list, LibraryOrder.sort, LibraryOrder.custom(LibraryOrder.ROOT), rootPinned)}- val filteredEntries = if (searchQuery.isBlank()) allEntries- else allEntries.filter {+ val (chipEntries, chipArtists) = com.music.spotui.data.local.LibraryChips.apply(+ chip, allEntries, followedArtists,+ setOf(Api.HomeCache.LIKED_SONGS_ID, Api.HomeCache.LOCAL_FILES_ID, Api.HomeCache.DOWNLOADS_ID),+ )+ val filteredEntries = if (searchQuery.isBlank()) chipEntries+ else chipEntries.filter {it.name.contains(searchQuery, ignoreCase = true) ||it.subtitle.contains(searchQuery, ignoreCase = true)}- val filteredArtists = if (searchQuery.isBlank()) followedArtists- else followedArtists.filter { it.name.contains(searchQuery, ignoreCase = true) }+ val filteredArtists = if (searchQuery.isBlank()) chipArtists+ else chipArtists.filter { it.name.contains(searchQuery, ignoreCase = true) }+ // Moving rows only makes sense on the whole list.+ val movable = searchQuery.isBlank() && chip == com.music.spotui.data.local.LibraryChip.ALLif (gridView) LibraryGridScreen(PaddingValues(0.dp), filteredEntries, filteredArtists, navController,- reorderLevel = if (searchQuery.isBlank()) LibraryOrder.ROOT else null, pinned = rootPinned)+ reorderLevel = if (movable) LibraryOrder.ROOT else null, pinned = rootPinned)else SumUpLibraryScreen(PaddingValues(0.dp), filteredEntries, filteredArtists, navController,- reorderLevel = if (searchQuery.isBlank()) LibraryOrder.ROOT else null, pinned = rootPinned,+ reorderLevel = if (movable) LibraryOrder.ROOT else null, pinned = rootPinned,onChanged = { libraryViewModel.load() })if (entries !is Response.Success) Box(modifier = Modifier.padding(20.dp, 100.dp)) { Snackbar(showMessage = stringResource(R.string.library_error)) }}@@ -337,6 +352,39 @@ fun LibraryScreen(navController: NavController) {}}+/** Playlists / Artists / Albums / Songs: one chip chosen at a time; the chosen one again clears it. */+@Composable+private fun LibraryChipRow(chosen: com.music.spotui.data.local.LibraryChip, onTap: (com.music.spotui.data.local.LibraryChip) -> Unit) {+ val chips = listOf(+ com.music.spotui.data.local.LibraryChip.PLAYLISTS to R.string.library_chip_playlists,+ com.music.spotui.data.local.LibraryChip.ARTISTS to R.string.library_chip_artists,+ com.music.spotui.data.local.LibraryChip.ALBUMS to R.string.library_chip_albums,+ com.music.spotui.data.local.LibraryChip.SONGS to R.string.library_chip_songs,+ )+ Row(+ horizontalArrangement = Arrangement.spacedBy(8.dp),+ modifier = Modifier+ .fillMaxWidth()+ .horizontalScroll(androidx.compose.foundation.rememberScrollState())+ .padding(16.dp, 0.dp, 16.dp, 6.dp),+ ) {+ for ((chip, label) in chips) {+ val on = chip == chosen+ Text(+ stringResource(label),+ color = if (on) Color.Black else AppText,+ fontSize = 13.sp,+ fontWeight = FontWeight.SemiBold,+ modifier = Modifier+ .clip(RoundedCornerShape(50))+ .background(if (on) com.music.spotui.ui.theme.AppAccent else tone(0xFF2A2A2A))+ .clickable { onTap(chip) }+ .padding(horizontal = 14.dp, vertical = 7.dp),+ )+ }+ }+}+@OptIn(ExperimentalGlideComposeApi::class)@Composableprivate fun AccountAvatar(url: String, size: androidx.compose.ui.unit.Dp) {@@ -468,7 +516,7 @@ fun SumUpLibraryScreen(translationY = if (dragged) dragOffset else 0fif (dragged) { scaleX = 1.03f; scaleY = 1.03f }}- .background(if (dragged) Color(0xFF2A2A2A) else Color.Transparent, RoundedCornerShape(8.dp))+ .background(if (dragged) tone(0xFF2A2A2A) else Color.Transparent, RoundedCornerShape(8.dp)).pressable(0.96f, onPressHint = { prefetchLibraryEntry(entry) }) { openLibraryEntry(entry, navController) }// Inside the clickable, so a long press that ends without moving opens nothing..then(if (!movable) Modifier else Modifier.pointerInput(key) {@@ -491,15 +539,15 @@ fun SumUpLibraryScreen(.clip(RoundedCornerShape(if (entry.isPlaylist) 6.dp else 4.dp)),)Column(modifier = Modifier.padding(start = 12.dp).weight(1f)) {- Text(text = entry.name, color = Color.White, fontSize = 15.sp, fontWeight = FontWeight.Bold, maxLines = 1, overflow = TextOverflow.Ellipsis)+ Text(text = entry.name, color = AppText, fontSize = 15.sp, fontWeight = FontWeight.Bold, maxLines = 1, overflow = TextOverflow.Ellipsis)Row(verticalAlignment = Alignment.CenterVertically) {if (entry.pinned) Icon(Icons.Default.PushPin, null, tint = com.music.spotui.ui.theme.AppAccent,modifier = Modifier.padding(end = 4.dp).size(12.dp))- Text(text = entry.subtitle, color = Color.Gray, fontSize = 12.sp, fontWeight = FontWeight.Medium, maxLines = 1, overflow = TextOverflow.Ellipsis)+ Text(text = entry.subtitle, color = AppMuted, fontSize = 12.sp, fontWeight = FontWeight.Medium, maxLines = 1, overflow = TextOverflow.Ellipsis)}}if (entry.uri.isNotBlank() && !LibraryEdits.isPending(entry.spotifyId)) Icon(Icons.Default.MoreVert, stringResource(R.string.content_description_context_menu),- tint = Color(0xFFB3B3B3), modifier = Modifier.size(36.dp).clip(CircleShape).clickable { itemMenu = entry }.padding(6.dp))+ tint = AppMuted, modifier = Modifier.size(36.dp).clip(CircleShape).clickable { itemMenu = entry }.padding(6.dp))}}// ── Artists the user follows on Spotify ──@@ -507,7 +555,7 @@ fun SumUpLibraryScreen(item {Text(text = stringResource(R.string.song_dna_search_chip_followed_artists),- color = Color.White,+ color = AppText,fontSize = 17.sp,fontWeight = FontWeight.Bold,modifier = Modifier.padding(20.dp, 16.dp, 20.dp, 4.dp),@@ -531,8 +579,8 @@ fun SumUpLibraryScreen(contentDescription = "")Column(modifier = Modifier.padding(start = 12.dp)) {- Text(text = artist.name, color = Color.White, fontSize = 15.sp, fontWeight = FontWeight.Bold, maxLines = 1, overflow = TextOverflow.Ellipsis)- Text(text = stringResource(R.string.artist_subtitle), color = Color.Gray, fontSize = 12.sp, fontWeight = FontWeight.Medium)+ Text(text = artist.name, color = AppText, fontSize = 15.sp, fontWeight = FontWeight.Bold, maxLines = 1, overflow = TextOverflow.Ellipsis)+ Text(text = stringResource(R.string.artist_subtitle), color = AppMuted, fontSize = 12.sp, fontWeight = FontWeight.Medium)}}}@@ -724,15 +772,15 @@ fun LibraryGridScreen(.clip(RoundedCornerShape(if (entry.isPlaylist) 6.dp else 4.dp)),)Spacer(modifier = Modifier.height(6.dp))- Text(text = entry.name, color = Color.White, fontSize = 13.sp, fontWeight = FontWeight.Bold, maxLines = 1, overflow = TextOverflow.Ellipsis)- Text(text = entry.subtitle, color = Color.Gray, fontSize = 11.sp, fontWeight = FontWeight.Medium, maxLines = 1, overflow = TextOverflow.Ellipsis)+ Text(text = entry.name, color = AppText, fontSize = 13.sp, fontWeight = FontWeight.Bold, maxLines = 1, overflow = TextOverflow.Ellipsis)+ Text(text = entry.subtitle, color = AppMuted, fontSize = 11.sp, fontWeight = FontWeight.Medium, maxLines = 1, overflow = TextOverflow.Ellipsis)}}if (followedArtists.isNotEmpty()) {item(span = { GridItemSpan(maxLineSpan) }) {Text(text = stringResource(R.string.song_dna_search_chip_followed_artists),- color = Color.White,+ color = AppText,fontSize = 17.sp,fontWeight = FontWeight.Bold,modifier = Modifier.padding(top = 6.dp),@@ -754,8 +802,8 @@ fun LibraryGridScreen(contentDescription = "")Spacer(modifier = Modifier.height(6.dp))- Text(text = artist.name, color = Color.White, fontSize = 13.sp, fontWeight = FontWeight.Bold, maxLines = 1, overflow = TextOverflow.Ellipsis, textAlign = TextAlign.Center)- Text(text = stringResource(R.string.artist_subtitle), color = Color.Gray, fontSize = 11.sp, fontWeight = FontWeight.Medium, textAlign = TextAlign.Center)+ Text(text = artist.name, color = AppText, fontSize = 13.sp, fontWeight = FontWeight.Bold, maxLines = 1, overflow = TextOverflow.Ellipsis, textAlign = TextAlign.Center)+ Text(text = stringResource(R.string.artist_subtitle), color = AppMuted, fontSize = 11.sp, fontWeight = FontWeight.Medium, textAlign = TextAlign.Center)}}}@@ -778,11 +826,11 @@ private fun LibrarySkeleton(padding: PaddingValues) {.fillMaxWidth().padding(20.dp, 6.dp)) {- Box(modifier = Modifier.size(55.dp).clip(RoundedCornerShape(4.dp)).background(Color(0xFF1E1E1E)))+ Box(modifier = Modifier.size(55.dp).clip(RoundedCornerShape(4.dp)).background(tone(0xFF1E1E1E)))Column(modifier = Modifier.padding(start = 12.dp)) {- Box(modifier = Modifier.height(14.dp).width(160.dp).clip(RoundedCornerShape(3.dp)).background(Color(0xFF1E1E1E)))+ Box(modifier = Modifier.height(14.dp).width(160.dp).clip(RoundedCornerShape(3.dp)).background(tone(0xFF1E1E1E)))Spacer(modifier = Modifier.height(6.dp))- Box(modifier = Modifier.height(11.dp).width(90.dp).clip(RoundedCornerShape(3.dp)).background(Color(0xFF1E1E1E)))+ Box(modifier = Modifier.height(11.dp).width(90.dp).clip(RoundedCornerShape(3.dp)).background(tone(0xFF1E1E1E)))}}}@@ -801,7 +849,7 @@ private fun AccountSheet(ModalBottomSheet(onDismissRequest = onDismiss,sheetState = sheetState,- containerColor = Color(0xFF1A1A1A),+ containerColor = tone(0xFF1A1A1A),) {Column(modifier = Modifier.navigationBarsPadding()) {Row(@@ -809,20 +857,20 @@ private fun AccountSheet(modifier = Modifier.fillMaxWidth().padding(16.dp, 4.dp, 16.dp, 16.dp)) {Box(- modifier = Modifier.size(56.dp).clip(CircleShape).background(Color(0xFF3A3A3A)),+ modifier = Modifier.size(56.dp).clip(CircleShape).background(tone(0xFF3A3A3A)),contentAlignment = Alignment.Center) {if (account.imageUrl.isNotBlank()) AccountAvatar(account.imageUrl, 56.dp)- else Icon(Icons.Default.Person, contentDescription = null, tint = Color.White, modifier = Modifier.size(30.dp))+ else Icon(Icons.Default.Person, contentDescription = null, tint = AppText, modifier = Modifier.size(30.dp))}Spacer(modifier = Modifier.width(14.dp))Column {- Text(account.name.ifBlank { stringResource(R.string.spotify_user) }, color = Color.White, fontSize = 18.sp, fontWeight = FontWeight.Bold, maxLines = 1, overflow = TextOverflow.Ellipsis)- if (account.email.isNotBlank()) Text(account.email, color = Color.Gray, fontSize = 13.sp, maxLines = 1, overflow = TextOverflow.Ellipsis)+ Text(account.name.ifBlank { stringResource(R.string.spotify_user) }, color = AppText, fontSize = 18.sp, fontWeight = FontWeight.Bold, maxLines = 1, overflow = TextOverflow.Ellipsis)+ if (account.email.isNotBlank()) Text(account.email, color = AppMuted, fontSize = 13.sp, maxLines = 1, overflow = TextOverflow.Ellipsis)if (account.plan.isNotBlank()) Text("Spotify ${account.plan}", color = Color(0xFF1DB954), fontSize = 12.sp, fontWeight = FontWeight.Medium)}}- HorizontalDivider(color = Color(0xFF2A2A2A))+ HorizontalDivider(color = tone(0xFF2A2A2A))// Spotify's own account pages (plan, privacy, devices), signed in, in the app.val context = androidx.compose.ui.platform.LocalContext.current@@ -840,14 +888,14 @@ private fun AccountSheet(onDismiss()AccountBrowser.open(context, AccountBrowser.ACCOUNT_URL)}- HorizontalDivider(color = Color(0xFF2A2A2A))+ HorizontalDivider(color = tone(0xFF2A2A2A))Spacer(modifier = Modifier.height(8.dp))}}}@Composable-private fun AccountRow(label: String, tint: Color = Color.White, onClick: () -> Unit) {+private fun AccountRow(label: String, tint: Color = AppText, onClick: () -> Unit) {Text(text = label,color = tint,@@ -871,9 +919,9 @@ private fun sortLabel(sort: LibraryOrder.Sort) = when (sort) {@OptIn(ExperimentalMaterial3Api::class)@Composableprivate fun LibrarySortSheet(onDismiss: () -> Unit) {- ModalBottomSheet(onDismissRequest = onDismiss, containerColor = Color(0xFF282828)) {+ ModalBottomSheet(onDismissRequest = onDismiss, containerColor = tone(0xFF282828)) {Column(Modifier.navigationBarsPadding().padding(bottom = 16.dp)) {- Text(stringResource(R.string.filter_and_sort_sort_section_title), color = Color.White, fontSize = 18.sp,+ Text(stringResource(R.string.filter_and_sort_sort_section_title), color = AppText, fontSize = 18.sp,fontWeight = FontWeight.Bold, modifier = Modifier.padding(horizontal = 20.dp, vertical = 8.dp))for (sort in LibraryOrder.Sort.entries) {Row(@@ -882,14 +930,14 @@ private fun LibrarySortSheet(onDismiss: () -> Unit) {.padding(horizontal = 20.dp, vertical = 14.dp),) {val selected = LibraryOrder.sort == sort- Text(stringResource(sortLabel(sort)), color = if (selected) com.music.spotui.ui.theme.AppAccent else Color.White,+ Text(stringResource(sortLabel(sort)), color = if (selected) com.music.spotui.ui.theme.AppAccent else AppText,fontSize = 16.sp, modifier = Modifier.weight(1f))if (selected) Icon(Icons.Default.Check, contentDescription = null, tint = com.music.spotui.ui.theme.AppAccent, modifier = Modifier.size(20.dp))}}- Text(stringResource(R.string.library_reorder_hint), color = Color(0xFFB3B3B3), fontSize = 13.sp,+ Text(stringResource(R.string.library_reorder_hint), color = AppMuted, fontSize = 13.sp,modifier = Modifier.padding(horizontal = 20.dp, vertical = 8.dp))- Text(stringResource(R.string.library_reorder_reset), color = Color.White, fontSize = 15.sp, fontWeight = FontWeight.SemiBold,+ Text(stringResource(R.string.library_reorder_reset), color = AppText, fontSize = 15.sp, fontWeight = FontWeight.SemiBold,modifier = Modifier.fillMaxWidth().clickable { LibraryOrder.reset(); onDismiss() }.padding(horizontal = 20.dp, vertical = 14.dp))}}diff --git a/base/app/src/main/java/com/music/spotui/ui/screens/LocalFilesScreen.kt b/base/app/src/main/java/com/music/spotui/ui/screens/LocalFilesScreen.ktindex dbeadbde..c4016dba 100644--- a/base/app/src/main/java/com/music/spotui/ui/screens/LocalFilesScreen.kt+++ b/base/app/src/main/java/com/music/spotui/ui/screens/LocalFilesScreen.kt@@ -1,5 +1,10 @@package com.music.spotui.ui.screens+import com.music.spotui.ui.theme.headerTint+import com.music.spotui.ui.theme.tone+import com.music.spotui.ui.theme.AppText+import com.music.spotui.ui.theme.AppMuted+import kotlinx.coroutines.launchimport androidx.compose.foundation.layout.navigationBarsPaddingimport android.content.Intent@@ -109,7 +114,7 @@ fun LocalFilesScreen(navController: NavController) {else -> LazyColumn(Modifier.fillMaxSize()) {item {Column(- Modifier.fillMaxWidth().background(Brush.verticalGradient(listOf(Color(0xFF2E5C46), AppBackground)))+ Modifier.fillMaxWidth().background(Brush.verticalGradient(listOf(headerTint(Color(0xFF2E5C46), 0f), AppBackground))).statusBarsPadding().padding(horizontal = 16.dp),) {Spacer(Modifier.height(56.dp))@@ -117,18 +122,18 @@ fun LocalFilesScreen(navController: NavController) {painterResource(R.drawable.local_files_cover), null,modifier = Modifier.align(Alignment.CenterHorizontally).size(200.dp).clip(RoundedCornerShape(6.dp)),)- Text(stringResource(R.string.local_files_title), color = Color.White, fontSize = 26.sp, fontWeight = FontWeight.Bold,+ Text(stringResource(R.string.local_files_title), color = AppText, fontSize = 26.sp, fontWeight = FontWeight.Bold,modifier = Modifier.padding(top = 20.dp))val n = tracks?.size ?: 0- Text(pluralStringResource(R.plurals.local_files_count, n, n), color = Color(0xFFB3B3B3), fontSize = 14.sp,+ Text(pluralStringResource(R.plurals.local_files_count, n, n), color = AppMuted, fontSize = 14.sp,modifier = Modifier.padding(top = 4.dp))Row(Modifier.fillMaxWidth().padding(vertical = 12.dp), verticalAlignment = Alignment.CenterVertically) {androidx.compose.material3.OutlinedButton(onClick = { choosingFolders = true },border = androidx.compose.foundation.BorderStroke(1.dp, Color(0xFF7F7F7F)),- ) { Text(stringResource(R.string.local_folders_button), color = Color.White, fontSize = 13.sp) }+ ) { Text(stringResource(R.string.local_folders_button), color = AppText, fontSize = 13.sp) }Spacer(Modifier.weight(1f))- Icon(painterResource(R.drawable.ic_player_shuffle), stringResource(R.string.play_mode_item_shuffle_title), tint = Color.White,+ Icon(painterResource(R.drawable.ic_player_shuffle), stringResource(R.string.play_mode_item_shuffle_title), tint = AppText,modifier = Modifier.size(28.dp).pressable { tracks?.let { if (it.isNotEmpty()) LocalPlayer.play(it, it.indices.random(), shuffle = true) } })Spacer(Modifier.width(20.dp))Box(@@ -172,10 +177,10 @@ fun LocalFilesScreen(navController: NavController) {modifier = Modifier.size(48.dp).clip(RoundedCornerShape(4.dp)),)Column(Modifier.padding(start = 12.dp).weight(1f)) {- Text(t.title, color = if (current) com.music.spotui.ui.theme.AppAccent else Color.White, fontSize = 15.sp, maxLines = 1, overflow = TextOverflow.Ellipsis)- if (t.artist.isNotBlank()) Text(t.artist, color = Color(0xFFB3B3B3), fontSize = 13.sp, maxLines = 1, overflow = TextOverflow.Ellipsis)+ Text(t.title, color = if (current) com.music.spotui.ui.theme.AppAccent else AppText, fontSize = 15.sp, maxLines = 1, overflow = TextOverflow.Ellipsis)+ if (t.artist.isNotBlank()) Text(t.artist, color = AppMuted, fontSize = 13.sp, maxLines = 1, overflow = TextOverflow.Ellipsis)}- Icon(painterResource(R.drawable.ic_add), stringResource(R.string.context_menu_add_to_playlist), tint = Color.White,+ Icon(painterResource(R.drawable.ic_add), stringResource(R.string.context_menu_add_to_playlist), tint = AppText,modifier = Modifier.size(24.dp).pressable(0.92f) { adding = t })}}@@ -185,9 +190,9 @@ fun LocalFilesScreen(navController: NavController) {Box(contentAlignment = Alignment.Center,modifier = Modifier.statusBarsPadding().padding(12.dp).size(40.dp).clip(CircleShape)- .background(Color(0x66000000)).pressable { navController.navigateUp() },+ .background(AppBackground.copy(alpha = 0.4f)).pressable { navController.navigateUp() },) {- Icon(Icons.AutoMirrored.Filled.ArrowBack, stringResource(R.string.accessibility_navigate_back), tint = Color.White)+ Icon(Icons.AutoMirrored.Filled.ArrowBack, stringResource(R.string.accessibility_navigate_back), tint = AppText)}}}@@ -200,15 +205,15 @@ private fun EmptyState(title: String, subtitle: String, button: String?, onClickmodifier = Modifier.fillMaxSize().padding(horizontal = 32.dp),) {Image(painterResource(R.drawable.local_files_cover), null, modifier = Modifier.size(120.dp).clip(RoundedCornerShape(6.dp)))- Text(title, color = Color.White, fontSize = 22.sp, fontWeight = FontWeight.Bold, textAlign = TextAlign.Center,+ Text(title, color = AppText, fontSize = 22.sp, fontWeight = FontWeight.Bold, textAlign = TextAlign.Center,modifier = Modifier.padding(top = 24.dp))- Text(subtitle, color = Color(0xFFB3B3B3), fontSize = 14.sp, textAlign = TextAlign.Center, modifier = Modifier.padding(top = 8.dp))+ Text(subtitle, color = AppMuted, fontSize = 14.sp, textAlign = TextAlign.Center, modifier = Modifier.padding(top = 8.dp))if (button != null) Box(contentAlignment = Alignment.Center,modifier = Modifier.padding(top = 24.dp).height(48.dp).pressable(0.96f, onClick = onClick)- .clip(RoundedCornerShape(50)).background(Color.White).padding(horizontal = 28.dp),+ .clip(RoundedCornerShape(50)).background(AppText).padding(horizontal = 28.dp),) {- Text(button, color = Color.Black, fontSize = 15.sp, fontWeight = FontWeight.Bold)+ Text(button, color = com.music.spotui.ui.theme.AppBackground, fontSize = 15.sp, fontWeight = FontWeight.Bold)}}}@@ -222,11 +227,11 @@ private fun LocalFoldersSheet(onChanged: () -> Unit, onDismiss: () -> Unit) {var folders by remember { mutableStateOf<List<Pair<String, Int>>>(emptyList()) }var version by remember { mutableStateOf(0) }LaunchedEffect(Unit) { folders = LocalMusic.folders(context) }- androidx.compose.material3.ModalBottomSheet(onDismissRequest = onDismiss, containerColor = Color(0xFF282828)) {+ androidx.compose.material3.ModalBottomSheet(onDismissRequest = onDismiss, containerColor = tone(0xFF282828)) {Column(Modifier.navigationBarsPadding().padding(bottom = 16.dp)) {- Text(stringResource(R.string.local_folders_title), color = Color.White, fontSize = 18.sp, fontWeight = FontWeight.Bold,+ Text(stringResource(R.string.local_folders_title), color = AppText, fontSize = 18.sp, fontWeight = FontWeight.Bold,modifier = Modifier.padding(horizontal = 20.dp))- Text(stringResource(R.string.local_folders_detail), color = Color(0xFFB3B3B3), fontSize = 13.sp,+ Text(stringResource(R.string.local_folders_detail), color = AppMuted, fontSize = 13.sp,modifier = Modifier.padding(horizontal = 20.dp, vertical = 6.dp))LazyColumn {items(folders.size) { i ->@@ -239,7 +244,7 @@ private fun LocalFoldersSheet(onChanged: () -> Unit, onDismiss: () -> Unit) {) {Column(Modifier.weight(1f)) {val name = folder.trimEnd('/').substringAfterLast('/').ifBlank { folder.ifBlank { "/" } }- Text(name, color = Color.White, fontSize = 15.sp, maxLines = 1, overflow = androidx.compose.ui.text.style.TextOverflow.Ellipsis)+ Text(name, color = AppText, fontSize = 15.sp, maxLines = 1, overflow = androidx.compose.ui.text.style.TextOverflow.Ellipsis)Text("$folder · ${pluralStringResource(R.plurals.local_files_count, count, count)}", color = Color(0xFF9A9A9A),fontSize = 12.sp, maxLines = 1, overflow = androidx.compose.ui.text.style.TextOverflow.Ellipsis)}diff --git a/base/app/src/main/java/com/music/spotui/ui/screens/LyricsScreen.kt b/base/app/src/main/java/com/music/spotui/ui/screens/LyricsScreen.ktindex 3dd53068..897778bb 100644--- a/base/app/src/main/java/com/music/spotui/ui/screens/LyricsScreen.kt+++ b/base/app/src/main/java/com/music/spotui/ui/screens/LyricsScreen.kt@@ -838,7 +838,7 @@ private val CARD_CORNER = 12.dp* revealed through a window that grows from the inline card's bounds (position, size, corner* radius, same colour) to the whole page, while its lines rise in staggered; closing plays* it backwards into the card. Only graphicsLayer / draw state moves per frame, no recomposition.- * Without a visible card (swipe-up open, card scrolled away) it slides up as it always did.+ * Without a visible card (scrolled away) it slides up as it always did.*/@Composablefun LyricsOverlay(diff --git a/base/app/src/main/java/com/music/spotui/ui/screens/PlayerScreen.kt b/base/app/src/main/java/com/music/spotui/ui/screens/PlayerScreen.ktindex f865b7a6..eb28ddf0 100644--- a/base/app/src/main/java/com/music/spotui/ui/screens/PlayerScreen.kt+++ b/base/app/src/main/java/com/music/spotui/ui/screens/PlayerScreen.kt@@ -211,7 +211,7 @@ fun PlayerScreen(navController: NavController) {// Known cover (warmed by the mini player): the colour is there from the first frame.var coverColor by remember {- mutableStateOf(Palette.cachedSecond(songCoverUri) ?: Color(AppBackground.toArgb()))+ mutableStateOf(Palette.cachedSecond(songCoverUri) ?: Color(0xFF121212))}LaunchedEffect(songCoverUri) {// Known: kept as it is (extracted again it could come out a shade off, and the background@@ -342,17 +342,19 @@ fun PlayerScreen(navController: NavController) {onDispose { mv.detachPlayerScreen() }}LaunchedEffect(actualTrackId, songTitle, audioBuffering) {- if (!audioBuffering) mv.prepare(actualTrackId, songTitle, songSinger, SongPlayer.getDuration())+ // Settings, "Music videos" off: no lookup, no button, no clip.+ if (!audioBuffering && com.music.spotui.data.preferences.MusicVideoPref.on) mv.prepare(actualTrackId, songTitle, songSinger, SongPlayer.getDuration())}val remote = SongPlayer.activeDevice.value != nullval readyVideo = mv.state.value as? com.music.spotui.video.MusicVideoController.State.Readyval videoMatchesTrack = displayedTrackId.isNotBlank() && actualTrackId == displayedTrackId && readyVideo?.trackId == actualTrackId- val videoReady = videoMatchesTrack && !remote && !audioBuffering && !com.music.spotui.data.DataSaver.active+ val videoReady = videoMatchesTrack && !remote && !audioBuffering && !com.music.spotui.data.DataSaver.active &&+ com.music.spotui.data.preferences.MusicVideoPref.on// Switching to mobile data with the data saver on stops a clip that is playing.LaunchedEffect(com.music.spotui.data.DataSaver.active) {if (com.music.spotui.data.DataSaver.active && mv.on.value) mv.setOn(false)}- val videoOn = mv.on.value && videoMatchesTrack && !remote+ val videoOn = mv.on.value && videoMatchesTrack && !remote && com.music.spotui.data.preferences.MusicVideoPref.on// Canvas / clip players are built once the sheet has finished rising (then kept):// creating them in the first frame stalled it and the slide jumped.val settled by com.music.spotui.ui.navigation.LocalPageSettled.current@@ -654,6 +656,9 @@ fun PlayerScreen(navController: NavController) {onDevices = { showDevices = true },onQueue = { showQueue = true },)+ // Buttons from extensions (player.buttons), under the player's own controls.+ val extTrack = androidx.compose.runtime.remember(songTitle, songSinger) { com.music.spotui.extensions.Extensions.currentTrack() }+ com.music.spotui.extensions.ExtensionPlayerButtons(extTrack)// 8dp card margin + this = the official 37dp from the buttons' centre to the card.Spacer(modifier = Modifier.height(12.dp))}@@ -1048,9 +1053,9 @@ fun PlayerInfo()}}- // No like for a local file (not in the Spotify library), and none during an ad break:- // the + would save the song from before the break.- if (!adPlaying && !com.music.spotui.di.LocalPlayer.active.value) {+ // No like for a file of the device (not in the Spotify library; an extension's stream or a+ // download is), and none during an ad break: the + would save the song from before the break.+ if (!adPlaying && SongPlayer.canLike) {if (likeSong != null) AddButton(song = likeSong, liked = liked, onLike = onLikeClick)else LikeButton(liked = liked, onClick = onLikeClick)}@@ -1339,16 +1344,31 @@ fun PlayerConnectRow(modifier = Modifier.size(24.dp),contentDescription = stringResource(R.string.mr_user_route_category_name),)- Text(- text = com.music.spotui.ui.components.activeDeviceLabel(),- color = com.music.spotui.ui.theme.AppAccent,- fontSize = 12.sp,- maxLines = 1,- overflow = androidx.compose.ui.text.style.TextOverflow.Ellipsis,- modifier = Modifier- .padding(start = 6.dp)- .widthIn(max = 200.dp),- )+ Column(modifier = Modifier.padding(start = 6.dp).widthIn(max = 220.dp)) {+ Text(+ text = com.music.spotui.ui.components.activeDeviceLabel(),+ color = com.music.spotui.ui.theme.AppAccent,+ fontSize = 12.sp,+ maxLines = 1,+ overflow = androidx.compose.ui.text.style.TextOverflow.Ellipsis,+ )+ // What the sound is when Myspoti's own player plays it (an extension's stream, a+ // download); a tap opens what plays and its quality.+ val source = com.music.spotui.ui.components.playingSourceLabel()+ var quality by remember { mutableStateOf(false) }+ if (quality) com.music.spotui.ui.components.QualitySheet { quality = false }+ if (source.isNotBlank()) Text(+ text = source,+ color = com.music.spotui.ui.theme.AppMuted,+ fontSize = 11.sp,+ maxLines = 1,+ overflow = androidx.compose.ui.text.style.TextOverflow.Ellipsis,+ modifier = Modifier.clickable(+ interactionSource = remember { MutableInteractionSource() },+ indication = null,+ ) { quality = true },+ )+ }}Row(verticalAlignment = Alignment.CenterVertically) {var shareMenu by remember { mutableStateOf(false) }diff --git a/base/app/src/main/java/com/music/spotui/ui/screens/PodcastPlayerScreen.kt b/base/app/src/main/java/com/music/spotui/ui/screens/PodcastPlayerScreen.ktindex bdc50cc1..bd8fa3fc 100644--- a/base/app/src/main/java/com/music/spotui/ui/screens/PodcastPlayerScreen.kt+++ b/base/app/src/main/java/com/music/spotui/ui/screens/PodcastPlayerScreen.kt@@ -151,7 +151,7 @@ fun PodcastPlayerScreen(navController: NavController) {Box(Modifier.fillMaxSize()- .background(Brush.verticalGradient(listOf(tint, AppBackground))),+ .background(Brush.verticalGradient(listOf(tint, Color(0xFF121212)))),) {Column(Modifier.fillMaxSize().statusBarsPadding()) {// Top bar: down chevron, "playing from the podcast", the episode's own menu.diff --git a/base/app/src/main/java/com/music/spotui/ui/screens/ProfileScreen.kt b/base/app/src/main/java/com/music/spotui/ui/screens/ProfileScreen.ktindex da3cdd08..bb6a6a72 100644--- a/base/app/src/main/java/com/music/spotui/ui/screens/ProfileScreen.kt+++ b/base/app/src/main/java/com/music/spotui/ui/screens/ProfileScreen.kt@@ -1,5 +1,9 @@package com.music.spotui.ui.screens+import com.music.spotui.ui.theme.AppText+import com.music.spotui.ui.theme.AppMuted+import com.music.spotui.ui.theme.tone+import androidx.compose.foundation.backgroundimport androidx.compose.foundation.borderimport androidx.compose.foundation.layout.Arrangement@@ -19,6 +23,7 @@ import androidx.compose.foundation.lazy.itemsimport androidx.compose.foundation.shape.CircleShapeimport androidx.compose.foundation.shape.RoundedCornerShapeimport androidx.compose.material.icons.Icons+import androidx.compose.material.icons.filled.MoreVertimport androidx.compose.material.icons.automirrored.filled.ArrowBackimport androidx.compose.material3.CircularProgressIndicatorimport androidx.compose.material3.Icon@@ -68,6 +73,9 @@ fun ProfileScreen(navController: NavController, userId: String, userName: Stringvar profile by remember(userId) { mutableStateOf<UserProfile?>(null) }var failed by remember(userId) { mutableStateOf(false) }var following by remember(userId) { mutableStateOf<Boolean?>(null) }+ var blocked by remember(userId) { mutableStateOf<Boolean?>(null) }+ var blockAsk by remember(userId) { mutableStateOf(false) }+ val context = androidx.compose.ui.platform.LocalContext.currentval me = com.music.spotui.data.api.ProfileCache.id == userIdval scope = rememberCoroutineScope()var attempt by remember(userId) { mutableStateOf(0) }@@ -76,17 +84,68 @@ fun ProfileScreen(navController: NavController, userId: String, userName: StringrunCatching { MyspotiRuntime.api.users.profile(uri) }.onSuccess { profile = it }.onFailure { failed = true }if (!me) following = runCatching { MyspotiRuntime.api.users.isFollowing(listOf(uri)).single() }.getOrNull()+ if (!me) blocked = runCatching { MyspotiRuntime.api.users.isBlocked(uri) }.getOrNull()}val p = profile+ if (blockAsk) {+ val name = p?.name ?: userName.ifEmpty { userId }+ androidx.compose.material3.AlertDialog(+ onDismissRequest = { blockAsk = false },+ containerColor = tone(0xFF282828),+ title = { Text(stringResource(R.string.profile_block_title, name), color = AppText) },+ text = { Text(stringResource(R.string.profile_block_confirm, name), color = AppMuted) },+ confirmButton = {+ androidx.compose.material3.TextButton(onClick = {+ blockAsk = false+ com.music.spotui.di.Haptics.confirm()+ scope.launch {+ runCatching { MyspotiRuntime.api.users.blockUser(uri) }+ .onSuccess { blocked = true; following = false }+ .onFailure { android.widget.Toast.makeText(context, R.string.profile_block_failed, android.widget.Toast.LENGTH_SHORT).show() }+ }+ }) { Text(stringResource(R.string.profile_block), color = androidx.compose.ui.graphics.Color(0xFFF15E6C)) }+ },+ dismissButton = { androidx.compose.material3.TextButton(onClick = { blockAsk = false }) { Text(stringResource(R.string.cancel), color = AppText) } },+ )+ }LazyColumn(contentPadding = androidx.compose.foundation.layout.PaddingValues(bottom = com.music.spotui.ui.components.bottomBarsSpace()),modifier = Modifier.fillMaxSize().background(AppBackground).statusBarsPadding(),) {item {- Icon(- Icons.AutoMirrored.Filled.ArrowBack, stringResource(R.string.accessibility_navigate_back), tint = Color.White,- modifier = Modifier.pressable(0.96f) { navController.navigateUp() }.padding(16.dp).size(26.dp),- )+ Row(Modifier.fillMaxWidth(), verticalAlignment = Alignment.CenterVertically) {+ Icon(+ Icons.AutoMirrored.Filled.ArrowBack, stringResource(R.string.accessibility_navigate_back), tint = AppText,+ modifier = Modifier.pressable(0.96f) { navController.navigateUp() }.padding(16.dp).size(26.dp),+ )+ Spacer(Modifier.weight(1f))+ // The Web Player's profile menu: Block / Unblock (only once the block state is known).+ val b = blocked+ if (!me && b != null) {+ var menu by remember { mutableStateOf(false) }+ Box {+ Icon(+ Icons.Default.MoreVert, stringResource(R.string.profile_more_options), tint = AppText,+ modifier = Modifier.pressable(0.96f) { menu = true }.padding(16.dp).size(26.dp),+ )+ androidx.compose.material3.DropdownMenu(expanded = menu, onDismissRequest = { menu = false }, containerColor = tone(0xFF282828)) {+ androidx.compose.material3.DropdownMenuItem(+ text = { Text(stringResource(if (b) R.string.profile_unblock else R.string.profile_block), color = AppText) },+ onClick = {+ menu = false+ if (b) scope.launch {+ blocked = false+ runCatching { MyspotiRuntime.api.users.unblockUser(uri) }.onFailure {+ blocked = true+ android.widget.Toast.makeText(context, R.string.profile_block_failed, android.widget.Toast.LENGTH_SHORT).show()+ }+ } else blockAsk = true+ },+ )+ }+ }+ }+ }}item {Column(horizontalAlignment = Alignment.CenterHorizontally, modifier = Modifier.fillMaxWidth().padding(16.dp)) {@@ -100,28 +159,53 @@ fun ProfileScreen(navController: NavController, userId: String, userName: Stringif (p != null) {Row(Modifier.padding(top = 6.dp), verticalAlignment = Alignment.CenterVertically) {p.followers?.let {- Text(pluralStringResource(R.plurals.profile_followers, it, it), color = Color(0xFFB3B3B3), fontSize = 14.sp,+ Text(pluralStringResource(R.plurals.profile_followers, it, it), color = AppMuted, fontSize = 14.sp,modifier = Modifier.clip(RoundedCornerShape(6.dp)).pressable(0.96f) { navController.navigate(followListRoute(userId, followers = true)) }.padding(horizontal = 6.dp, vertical = 4.dp))}- if (p.followers != null && p.following != null) Text("•", color = Color(0xFFB3B3B3), fontSize = 14.sp)+ if (p.followers != null && p.following != null) Text("•", color = AppMuted, fontSize = 14.sp)p.following?.let {- Text(stringResource(R.string.profile_following_count, it), color = Color(0xFFB3B3B3), fontSize = 14.sp,+ Text(stringResource(R.string.profile_following_count, it), color = AppMuted, fontSize = 14.sp,modifier = Modifier.clip(RoundedCornerShape(6.dp)).pressable(0.96f) { navController.navigate(followListRoute(userId, followers = false)) }.padding(horizontal = 6.dp, vertical = 4.dp))}}}+ // Your own profile leads to your listening stats, like the official app's.+ if (me) {+ Spacer(Modifier.height(14.dp))+ Text(+ stringResource(R.string.stats_listening_stats),+ color = AppText, fontSize = 14.sp, fontWeight = FontWeight.Bold,+ modifier = Modifier.clip(RoundedCornerShape(50))+ .border(1.dp, AppMuted, RoundedCornerShape(50))+ .pressable(0.96f) { navController.navigate(com.music.spotui.ui.navigation.Routes.Recap.route) }+ .padding(horizontal = 20.dp, vertical = 8.dp),+ )+ Spacer(Modifier.height(10.dp))+ Text(+ stringResource(R.string.extensions_title),+ color = AppText, fontSize = 14.sp, fontWeight = FontWeight.Bold,+ modifier = Modifier.clip(RoundedCornerShape(50))+ .border(1.dp, AppMuted, RoundedCornerShape(50))+ .pressable(0.96f) { navController.navigate(com.music.spotui.ui.navigation.Routes.Extensions.route) }+ .padding(horizontal = 20.dp, vertical = 8.dp),+ )+ }+ if (blocked == true) {+ Spacer(Modifier.height(10.dp))+ Text(stringResource(R.string.profile_blocked), color = AppMuted, fontSize = 14.sp)+ }val f = following- if (!me && f != null) {+ if (!me && f != null && blocked != true) {Spacer(Modifier.height(14.dp))Text(stringResource(if (f) R.string.curation_button_following_state_text else R.string.curation_button_follow_state_text),- color = Color.White, fontSize = 14.sp, fontWeight = FontWeight.Bold,+ color = AppText, fontSize = 14.sp, fontWeight = FontWeight.Bold,modifier = Modifier.clip(RoundedCornerShape(50))- .border(1.dp, if (f) Color.White else Color(0xFF878787), RoundedCornerShape(50))+ .border(1.dp, if (f) AppText else AppMuted, RoundedCornerShape(50)).pressable(0.96f) {com.music.spotui.di.Haptics.confirm()following = !f@@ -143,7 +227,7 @@ fun ProfileScreen(navController: NavController, userId: String, userName: String}p.publicPlaylists.isNotEmpty() -> {item {- Text(stringResource(R.string.profile_public_playlists), color = Color.White, fontSize = 20.sp,+ Text(stringResource(R.string.profile_public_playlists), color = AppText, fontSize = 20.sp,fontWeight = FontWeight.Bold, modifier = Modifier.padding(16.dp, 12.dp))}items(p.publicPlaylists, key = { it.uri }) { pl ->@@ -162,10 +246,10 @@ fun ProfileScreen(navController: NavController, userId: String, userName: String)Spacer(Modifier.width(12.dp))Column(Modifier.weight(1f)) {- Text(pl.name, color = Color.White, fontSize = 15.sp, maxLines = 1, overflow = TextOverflow.Ellipsis)+ Text(pl.name, color = AppText, fontSize = 15.sp, maxLines = 1, overflow = TextOverflow.Ellipsis)pl.followers?.let {Text(pluralStringResource(R.plurals.profile_followers, it.toInt(), it.toInt()),- color = Color(0xFFB3B3B3), fontSize = 13.sp, maxLines = 1, overflow = androidx.compose.ui.text.style.TextOverflow.Ellipsis)+ color = AppMuted, fontSize = 13.sp, maxLines = 1, overflow = androidx.compose.ui.text.style.TextOverflow.Ellipsis)}}}diff --git a/base/app/src/main/java/com/music/spotui/ui/screens/QueueScreen.kt b/base/app/src/main/java/com/music/spotui/ui/screens/QueueScreen.ktindex d7814d96..9bca7036 100644--- a/base/app/src/main/java/com/music/spotui/ui/screens/QueueScreen.kt+++ b/base/app/src/main/java/com/music/spotui/ui/screens/QueueScreen.kt@@ -1,5 +1,7 @@package com.music.spotui.ui.screens+import com.music.spotui.ui.theme.AppText+import androidx.compose.ui.res.stringResourceimport androidx.compose.foundation.background@@ -92,7 +94,7 @@ fun QueueScreen(navController: NavController) {Icon(imageVector = Icons.Default.KeyboardArrowDown,contentDescription = stringResource(R.string.bottom_actions_close),- tint = Color.White,+ tint = AppText,modifier = Modifier.size(28.dp).clickable(@@ -101,7 +103,7 @@ fun QueueScreen(navController: NavController) {) { navController.navigateUp() })Spacer(modifier = Modifier.width(12.dp))- Text(stringResource(R.string.action_queue_label), color = Color.White, fontSize = 18.sp, fontWeight = FontWeight.Bold)+ Text(stringResource(R.string.action_queue_label), color = AppText, fontSize = 18.sp, fontWeight = FontWeight.Bold)}LazyColumn(@@ -136,7 +138,7 @@ fun QueueScreen(navController: NavController) {private fun QueueHeader(text: String) {Text(text,- color = Color.White,+ color = AppText,fontSize = 16.sp,fontWeight = FontWeight.Bold,modifier = Modifier.padding(16.dp, 18.dp, 16.dp, 6.dp)@@ -164,7 +166,7 @@ private fun SwipeRemove(item: SongPlayer.QueueItem, content: @Composable () -> U.background(Color(0xFF7A1F1F)).padding(horizontal = 24.dp),) {- Icon(Icons.Default.Delete, contentDescription = stringResource(R.string.aligned_curation_first_save_default_row_remove_action_description), tint = Color.White)+ Icon(Icons.Default.Delete, contentDescription = stringResource(R.string.aligned_curation_first_save_default_row_remove_action_description), tint = AppText)}},content = { content() }@@ -189,7 +191,7 @@ private fun QueueRow(modifier = Modifier.fillMaxWidth().graphicsLayer { translationY = dragOffsetY }- .background(if (isDragging) Color(0xFF1E1E24) else com.music.spotui.ui.theme.AppBackground)+ .background(if (isDragging) com.music.spotui.ui.theme.headerTint(Color(0xFF1E1E24), 0f) else com.music.spotui.ui.theme.AppBackground).clickable(interactionSource = remember { MutableInteractionSource() },indication = null,@@ -211,7 +213,7 @@ private fun QueueRow(Column(modifier = Modifier.weight(1f)) {Text(text = song.title,- color = if (highlight) Color(AppPalette.toArgb()) else Color.White,+ color = if (highlight) Color(AppPalette.toArgb()) else AppText,fontSize = 16.sp,fontWeight = FontWeight.Medium,maxLines = 1,diff --git a/base/app/src/main/java/com/music/spotui/ui/screens/RecentlyPlayedScreen.kt b/base/app/src/main/java/com/music/spotui/ui/screens/RecentlyPlayedScreen.ktindex 7cdb4951..d3bf1721 100644--- a/base/app/src/main/java/com/music/spotui/ui/screens/RecentlyPlayedScreen.kt+++ b/base/app/src/main/java/com/music/spotui/ui/screens/RecentlyPlayedScreen.kt@@ -1,5 +1,9 @@package com.music.spotui.ui.screens+import com.music.spotui.ui.theme.tone+import com.music.spotui.ui.theme.AppText+import com.music.spotui.ui.theme.AppMuted+import androidx.compose.animation.core.animateFloatAsStateimport androidx.compose.foundation.backgroundimport androidx.compose.foundation.border@@ -72,9 +76,9 @@ import java.time.format.DateTimeFormatterimport java.util.Localeprivate val Background: Color get() = com.music.spotui.ui.theme.AppBackground-private val Subtle = Color(0xFFB3B3B3)+private val Subtle: androidx.compose.ui.graphics.Color get() = AppMuted/** The pill and chevron greys of Spotify's own page. */-private val ChipIdle = Color(0xFF282828)+private val ChipIdle: androidx.compose.ui.graphics.Color get() = tone(0xFF282828)private val ChevronRing = Color(0xFF8A8A8A)/** Rows per request: what the Web Player asks for its own list page. */@@ -146,13 +150,13 @@ fun RecentlyPlayedScreen(navController: NavController) {Icon(imageVector = Icons.AutoMirrored.Filled.ArrowBack,contentDescription = stringResource(R.string.accessibility_navigate_back),- tint = Color.White,+ tint = AppText,modifier = Modifier.size(40.dp).clip(RoundedCornerShape(20.dp)).clickable { navController.popBackStack() }.padding(8.dp),)Text(stringResource(R.string.recents_title),- fontWeight = FontWeight.Bold, color = Color.White, fontSize = 24.sp, maxLines = 1,+ fontWeight = FontWeight.Bold, color = AppText, fontSize = 24.sp, maxLines = 1,overflow = TextOverflow.Ellipsis, modifier = Modifier.padding(start = 4.dp),)}@@ -214,7 +218,7 @@ fun RecentlyPlayedScreen(navController: NavController) {private fun DayHeader(dayMs: Long?) {Text(dayLabel(dayMs),- color = Color.White, fontSize = 18.sp, fontWeight = FontWeight.Bold,+ color = AppText, fontSize = 18.sp, fontWeight = FontWeight.Bold,modifier = Modifier.fillMaxWidth().padding(start = 16.dp, end = 16.dp, top = 20.dp, bottom = 6.dp),)}@@ -223,13 +227,13 @@ private fun DayHeader(dayMs: Long?) {private fun Pill(label: String, selected: Boolean, onClick: () -> Unit) {Box(Modifier.clip(RoundedCornerShape(50))- .background(if (selected) Color.White else ChipIdle)+ .background(if (selected) AppText else ChipIdle).clickable(onClick = onClick).padding(horizontal = 14.dp, vertical = 7.dp),) {Text(label,- color = if (selected) Color.Black else Color.White,+ color = if (selected) Color.Black else AppText,fontSize = 13.sp, fontWeight = FontWeight.Medium, maxLines = 1,)}@@ -256,7 +260,7 @@ private fun GroupRow(group: RecentGroup, expanded: Boolean, onToggle: () -> Unitval count = countLabel(group.count, group.saved)Text(group.context.title.ifBlank { count },- color = Color.White, fontSize = 16.sp, fontWeight = FontWeight.Bold,+ color = AppText, fontSize = 16.sp, fontWeight = FontWeight.Bold,maxLines = 1, overflow = TextOverflow.Ellipsis,)if (group.context.title.isNotBlank()) {@@ -277,7 +281,7 @@ private fun GroupRow(group: RecentGroup, expanded: Boolean, onToggle: () -> UnitcontentDescription = stringResource(if (expanded) R.string.recents_collapse else R.string.recents_expand,),- tint = Color.White,+ tint = AppText,modifier = Modifier.size(18.dp).rotate(rotation),)}@@ -301,7 +305,7 @@ private fun PlayRow(item: RecentItem, modifier: Modifier = Modifier, onClick: ()modifier = Modifier.size(40.dp).clip(RoundedCornerShape(3.dp)),)Column(Modifier.padding(start = 12.dp).weight(1f)) {- Text(item.title, color = Color.White, fontSize = 14.sp, maxLines = 1, overflow = TextOverflow.Ellipsis)+ Text(item.title, color = AppText, fontSize = 14.sp, maxLines = 1, overflow = TextOverflow.Ellipsis)item.subtitle?.let {Text(it, color = Subtle, fontSize = 12.sp, maxLines = 1, overflow = TextOverflow.Ellipsis)}@@ -335,7 +339,7 @@ private fun RecentCover(context: RecentItem, size: Dp) {Icon(Icons.Filled.Favorite,contentDescription = stringResource(R.string.collection_liked_songs_title),- tint = Color.White,+ tint = AppText,modifier = Modifier.size(13.dp),)}diff --git a/base/app/src/main/java/com/music/spotui/ui/screens/SearchScreen.kt b/base/app/src/main/java/com/music/spotui/ui/screens/SearchScreen.ktindex 6cc79bdb..03f6c840 100644--- a/base/app/src/main/java/com/music/spotui/ui/screens/SearchScreen.kt+++ b/base/app/src/main/java/com/music/spotui/ui/screens/SearchScreen.kt@@ -1,5 +1,9 @@package com.music.spotui.ui.screens+import com.music.spotui.ui.theme.tone+import com.music.spotui.ui.theme.AppText+import com.music.spotui.ui.theme.AppMuted+import kotlinx.coroutines.launchimport com.music.spotui.ui.components.pressableimport androidx.compose.ui.res.stringResource@@ -210,13 +214,13 @@ fun SumUpSearchScreen() {Text(stringResource(R.string.assisted_curation_search_search_history_title),- color = Color.White,+ color = AppText,fontSize = 18.sp,fontWeight = FontWeight.Bold,)Text(stringResource(R.string.chat_content_picker_clear_recent_searches),- color = Color(0xFFB3B3B3),+ color = AppMuted,fontSize = 13.sp,fontWeight = FontWeight.SemiBold,modifier = Modifier.pressable(0.96f) {@@ -254,7 +258,7 @@ fun SumUpSearchScreen(durationMs = item.durationMs,)searchViewModel.startRadioFromSong(song)- SongPlayer.playSong(song.url, context)+ SongPlayer.playSong(song.url, context, songs = listOf(song))searchViewModel.updateSongState(song.coverUri, song.title, song.singer, true, song.id, 0, song.album)}@@ -293,13 +297,13 @@ fun SumUpSearchScreen(val q = suggestions[i]Row(verticalAlignment = Alignment.CenterVertically,- modifier = Modifier.clip(RoundedCornerShape(50)).background(Color(0xFF2A2A2A))+ modifier = Modifier.clip(RoundedCornerShape(50)).background(tone(0xFF2A2A2A)).pressable(0.96f) { searchViewModel.search(q) }.padding(horizontal = 12.dp, vertical = 7.dp),) {- Icon(androidx.compose.material.icons.Icons.Default.Search, null, tint = Color(0xFFB3B3B3), modifier = Modifier.size(14.dp))+ Icon(androidx.compose.material.icons.Icons.Default.Search, null, tint = AppMuted, modifier = Modifier.size(14.dp))Spacer(Modifier.width(6.dp))- Text(q, color = Color.White, fontSize = 13.sp, maxLines = 1, overflow = androidx.compose.ui.text.style.TextOverflow.Ellipsis)+ Text(q, color = AppText, fontSize = 13.sp, maxLines = 1, overflow = androidx.compose.ui.text.style.TextOverflow.Ellipsis)}}}@@ -382,6 +386,14 @@ fun SumUpSearchScreen(}, onLongClick = { menuSong = ep })}}+ // What extensions add for this search (search.provide), under Spotify's results.+ if (filter != SearchFilter.Profiles) item {+ com.music.spotui.extensions.ExtensionBlocks(+ app.myspoti.extensions.Hook.SEARCH, app.myspoti.extensions.Surface.SEARCH,+ kotlinx.serialization.json.buildJsonObject { put("query", kotlinx.serialization.json.JsonPrimitive(text.trim())) }.toString(),+ delayMs = 400,+ )+ }}}@@ -404,7 +416,7 @@ private fun SearchStatus(query: String, loading: Boolean, failed: Boolean, onRetloading -> com.music.spotui.ui.components.SkeletonList(count = 7, modifier = Modifier.padding(top = 0.dp))failed -> com.music.spotui.ui.components.ErrorRetry(stringResource(R.string.search_failed), Modifier.padding(0.dp), onRetry)else -> Text(stringResource(R.string.assisted_curation_search_empty_view_no_result_title, query.trim()),- color = Color.White, fontSize = 16.sp, fontWeight = FontWeight.Bold,+ color = AppText, fontSize = 16.sp, fontWeight = FontWeight.Bold,textAlign = androidx.compose.ui.text.style.TextAlign.Center)}}@@ -443,11 +455,11 @@ private fun SearchFilterChips(selected: SearchFilter, onSelect: (SearchFilter) -Box(contentAlignment = Alignment.Center,modifier = Modifier.height(32.dp).clip(RoundedCornerShape(16.dp))- .background(if (on) com.music.spotui.ui.theme.AppAccent else Color(0xFF2A2A2A))+ .background(if (on) com.music.spotui.ui.theme.AppAccent else tone(0xFF2A2A2A)).pressable(0.96f) { onSelect(if (on && f != SearchFilter.Top) SearchFilter.Top else f) }.padding(horizontal = 14.dp),) {- Text(stringResource(f.label), color = if (on) Color.Black else Color.White, fontSize = 14.sp, fontWeight = FontWeight.Medium)+ Text(stringResource(f.label), color = if (on) Color.Black else AppText, fontSize = 14.sp, fontWeight = FontWeight.Medium)}}}@@ -520,7 +532,7 @@ fun RecentItemRow(.weight(1f).padding(start = 10.dp, end = 8.dp),) {- Text(text = item.name, color = Color.White, fontSize = 14.sp, fontWeight = FontWeight.Medium, maxLines = 1, overflow = androidx.compose.ui.text.style.TextOverflow.Ellipsis)+ Text(text = item.name, color = AppText, fontSize = 14.sp, fontWeight = FontWeight.Medium, maxLines = 1, overflow = androidx.compose.ui.text.style.TextOverflow.Ellipsis)val subtitle = when (item.type) {"song" -> stringResource(R.string.assisted_curation_search_song) + " • ${item.singer}""artist" -> stringResource(R.string.artist_subtitle)@@ -533,7 +545,7 @@ fun RecentItemRow(}Icon(imageVector = Icons.Default.Close,- tint = Color(0xFFB3B3B3),+ tint = AppMuted,modifier = Modifier.pressable(0.96f) { onRemove() }.size(20.dp),@@ -554,7 +566,7 @@ fun SearchSongRow(val context = LocalContext.currentval isLiked = com.music.spotui.di.rememberTrackSaved(song.spotifyTrackId)val currentPlayingIndicatorColor =- if (song.id == searchViewModel.currentSongId.value) Color(AppPalette.toArgb()) else Color.White+ if (song.id == searchViewModel.currentSongId.value) Color(AppPalette.toArgb()) else AppTextRow(horizontalArrangement = Arrangement.SpaceBetween,@@ -571,7 +583,7 @@ fun SearchSongRow(// Start a radio from the tapped track (queue = this song + Spotify// recommendations) rather than queuing the whole search list.searchViewModel.startRadioFromSong(song)- SongPlayer.playSong(song.url, context)+ SongPlayer.playSong(song.url, context, songs = listOf(song))searchViewModel.updateSongState(song.coverUri,song.title,@@ -621,7 +633,7 @@ com.music.spotui.ui.screens.AddButton(song = { song }, liked = isLiked, size = 2fun SearchSectionHeader(title: String) {Text(text = title,- color = Color.White,+ color = AppText,fontSize = 18.sp,fontWeight = FontWeight.Bold,modifier = Modifier.padding(16.dp, 18.dp, 16.dp, 4.dp),@@ -651,7 +663,7 @@ fun SearchShowRow(show: com.music.spotui.data.entity.PodcastModel, onClick: () -contentDescription = "",)Column {- Text(text = show.name, color = Color.White, fontSize = 14.sp, fontWeight = FontWeight.Medium, maxLines = 1, overflow = androidx.compose.ui.text.style.TextOverflow.Ellipsis)+ Text(text = show.name, color = AppText, fontSize = 14.sp, fontWeight = FontWeight.Medium, maxLines = 1, overflow = androidx.compose.ui.text.style.TextOverflow.Ellipsis)Text(text = stringResource(R.string.album_type_podcast) + (if (show.publisher.isNotBlank()) " • ${show.publisher}" else ""),color = Color.Gray, fontSize = 12.sp, fontWeight = FontWeight.Medium, maxLines = 1, overflow = androidx.compose.ui.text.style.TextOverflow.Ellipsis,@@ -683,7 +695,7 @@ fun SearchArtistRow(artist: com.music.spotui.data.entity.ArtistsModel, onClick:contentDescription = "",)Column {- Text(text = artist.name, color = Color.White, fontSize = 14.sp, fontWeight = FontWeight.Medium, maxLines = 1, overflow = androidx.compose.ui.text.style.TextOverflow.Ellipsis)+ Text(text = artist.name, color = AppText, fontSize = 14.sp, fontWeight = FontWeight.Medium, maxLines = 1, overflow = androidx.compose.ui.text.style.TextOverflow.Ellipsis)Text(text = stringResource(R.string.artist_subtitle), color = Color.Gray, fontSize = 12.sp, fontWeight = FontWeight.Medium)}}@@ -712,7 +724,7 @@ fun SearchAlbumRow(album: com.music.spotui.data.entity.AlbumsModel, onClick: ()contentDescription = "",)Column {- Text(text = album.name, color = Color.White, fontSize = 14.sp, fontWeight = FontWeight.Medium, maxLines = 1, overflow = androidx.compose.ui.text.style.TextOverflow.Ellipsis)+ Text(text = album.name, color = AppText, fontSize = 14.sp, fontWeight = FontWeight.Medium, maxLines = 1, overflow = androidx.compose.ui.text.style.TextOverflow.Ellipsis)Text(text = stringResource(R.string.album) + " • ${album.artists}", color = Color.Gray, fontSize = 12.sp, fontWeight = FontWeight.Medium, maxLines = 1, overflow = androidx.compose.ui.text.style.TextOverflow.Ellipsis)}}@@ -735,7 +747,7 @@ fun SearchPlaylistRow(playlist: com.music.spotui.data.entity.LibraryEntry, onClicontentDescription = "",)Column {- Text(text = playlist.name, color = Color.White, fontSize = 14.sp, fontWeight = FontWeight.Medium, maxLines = 1, overflow = androidx.compose.ui.text.style.TextOverflow.Ellipsis)+ Text(text = playlist.name, color = AppText, fontSize = 14.sp, fontWeight = FontWeight.Medium, maxLines = 1, overflow = androidx.compose.ui.text.style.TextOverflow.Ellipsis)Text(text = stringResource(R.string.assisted_curation_search_playlist) +(if (playlist.subtitle.isNotBlank()) " • ${playlist.subtitle}" else ""),color = Color.Gray, fontSize = 12.sp, fontWeight = FontWeight.Medium, maxLines = 1, overflow = androidx.compose.ui.text.style.TextOverflow.Ellipsis)@@ -757,14 +769,14 @@ fun BrowseAllSection(onCategoryClick: (genre: String, title: String) -> Unit) {val categories = runCatching { app.myspoti.host.android.MyspotiRuntime.api.home.categories() }.getOrDefault(emptyList())value = listOf(BrowseTile(NEW_RELEASES_GENRE, newReleases, Color(0xFFE8115B), "")) +categories.filter { com.music.spotui.data.api.Features.PODCASTS || !it.title.contains("odcast", ignoreCase = true) }.map { c ->- val color = runCatching { Color(android.graphics.Color.parseColor(c.color ?: "#333333")) }.getOrDefault(Color(0xFF333333))+ val color = runCatching { Color(android.graphics.Color.parseColor(c.color ?: "#333333")) }.getOrDefault(tone(0xFF333333))BrowseTile(c.uri, c.title, color, c.images.firstOrNull()?.url.orEmpty())}}Column(modifier = Modifier.fillMaxWidth()) {Text(text = stringResource(R.string.browse_all),- color = Color.White,+ color = AppText,fontSize = 22.sp,fontWeight = FontWeight.Bold,modifier = Modifier.padding(16.dp, 12.dp, 16.dp, 8.dp),@@ -821,7 +833,7 @@ private fun BrowseCategoryTile(}Text(text = name,- color = Color.White,+ color = AppText,fontSize = 16.sp,fontWeight = FontWeight.Bold,maxLines = 2, overflow = androidx.compose.ui.text.style.TextOverflow.Ellipsis,@@ -838,7 +850,7 @@ fun SearchTopBar() {.fillMaxWidth().padding(16.dp)) {- Text(text = stringResource(R.string.navigationbar_musicappitems_search_title), color = Color.White, fontSize = 22.sp, fontWeight = FontWeight.Bold)+ Text(text = stringResource(R.string.navigationbar_musicappitems_search_title), color = AppText, fontSize = 22.sp, fontWeight = FontWeight.Bold)//Icon(imageVector = Icons.Default.Person, contentDescription = "", tint = Color.White)}@@ -915,8 +927,8 @@ private fun SearchProfileRow(name: String, image: String?, onClick: () -> Unit))Spacer(Modifier.width(12.dp))Column {- Text(name, color = Color.White, fontSize = 15.sp, maxLines = 1, overflow = androidx.compose.ui.text.style.TextOverflow.Ellipsis)- Text(stringResource(R.string.recently_played_user_profile), color = Color(0xFFB3B3B3), fontSize = 13.sp)+ Text(name, color = AppText, fontSize = 15.sp, maxLines = 1, overflow = androidx.compose.ui.text.style.TextOverflow.Ellipsis)+ Text(stringResource(R.string.recently_played_user_profile), color = AppMuted, fontSize = 13.sp)}}}diff --git a/base/app/src/main/java/com/music/spotui/ui/screens/SettingsScreen.kt b/base/app/src/main/java/com/music/spotui/ui/screens/SettingsScreen.ktindex c62fae57..f1d98816 100644--- a/base/app/src/main/java/com/music/spotui/ui/screens/SettingsScreen.kt+++ b/base/app/src/main/java/com/music/spotui/ui/screens/SettingsScreen.kt@@ -1,5 +1,9 @@package com.music.spotui.ui.screens+import com.music.spotui.ui.theme.tone+import com.music.spotui.ui.theme.AppText+import com.music.spotui.ui.theme.AppMuted+import androidx.compose.foundation.backgroundimport androidx.compose.foundation.clickableimport androidx.compose.foundation.border@@ -52,7 +56,7 @@ import com.music.spotui.ui.components.StreamingQualityPickerimport com.music.spotui.ui.theme.AppBackground/**- * Settings, on one page: sound quality (streaming and downloads), the lossless source,+ * Settings, on one page: sound quality (streaming and downloads), the download source,* data and battery, display, language, and the player's own repair tools.*/@Composable@@ -62,9 +66,9 @@ fun SettingsScreen(navController: NavController) {Column(Modifier.fillMaxSize().background(AppBackground).statusBarsPadding()) {Row(verticalAlignment = Alignment.CenterVertically, modifier = Modifier.fillMaxWidth().padding(4.dp)) {IconButton(onClick = { navController.popBackStack() }) {- Icon(Icons.AutoMirrored.Filled.ArrowBack, contentDescription = stringResource(R.string.accessibility_navigate_back), tint = Color.White)+ Icon(Icons.AutoMirrored.Filled.ArrowBack, contentDescription = stringResource(R.string.accessibility_navigate_back), tint = AppText)}- Text(stringResource(R.string.settings_title), color = Color.White, fontSize = 20.sp, fontWeight = FontWeight.Bold)+ Text(stringResource(R.string.settings_title), color = AppText, fontSize = 20.sp, fontWeight = FontWeight.Bold)}Column(Modifier.fillMaxWidth().weight(1f).verticalScroll(rememberScrollState()).navigationBarsPadding()) {Section(R.string.settings_section_playback)@@ -108,18 +112,18 @@ fun SettingsScreen(navController: NavController) {Section(R.string.settings_section_downloads)DownloadQualityPicker()- // The lossless source: SpotiFLAC's own servers once verified.+ // Where downloads come from: a download-source extension.Column(- Modifier.fillMaxWidth().clickable { navController.navigate(com.music.spotui.ui.navigation.Routes.Spotiflac.route) }+ Modifier.fillMaxWidth().clickable { navController.navigate(com.music.spotui.ui.navigation.Routes.Extensions.route) }.padding(horizontal = 20.dp, vertical = 10.dp),) {- Text(stringResource(R.string.spotiflac_row_title), color = Color.White, fontSize = 16.sp)+ Text(stringResource(R.string.downloads_source_row_title), color = AppText, fontSize = 16.sp)Text(stringResource(- if (com.music.spotui.data.preferences.hasSpotiflacSession(ctx)) R.string.spotiflac_row_on- else R.string.spotiflac_row_off,+ if (com.music.spotui.extensions.Extensions.hasDownloadSource()) R.string.downloads_source_row_on+ else R.string.downloads_source_row_off,),- color = Color(0xFFB3B3B3), fontSize = 12.sp,+ color = AppMuted, fontSize = 12.sp,)}if (com.music.spotui.data.offline.OfflineStore.tracks.isNotEmpty()) RemoveDownloadsRow()@@ -168,6 +172,12 @@ fun SettingsScreen(navController: NavController) {enabled = !energy.policy.saverEnabled,onChecked = app.myspoti.power.EnergySettings::setCanvasEnabled,)+ OptionRow(+ label = stringResource(R.string.settings_music_video_title),+ detail = stringResource(R.string.settings_music_video_detail),+ checked = com.music.spotui.data.preferences.MusicVideoPref.on,+ onChecked = { com.music.spotui.data.preferences.MusicVideoPref.set(ctx, it) },+ )OptionRow(label = stringResource(R.string.settings_solid_nav_title),detail = stringResource(R.string.settings_solid_nav_detail),@@ -179,6 +189,8 @@ fun SettingsScreen(navController: NavController) {LanguageRow()Divider()+ ExtensionSettingsRows(navController)+Section(R.string.settings_section_app)// A18: the launch check can be turned off; the manual check below keeps working.OptionRow(@@ -188,6 +200,14 @@ fun SettingsScreen(navController: NavController) {onChecked = { com.music.spotui.data.preferences.AutoUpdateCheckPref.set(ctx, it) },)CheckUpdateRow()+ // Third-party extensions: lyrics, a song's audio, scripts reacting to the music.+ Column(+ Modifier.fillMaxWidth().clickable { navController.navigate(com.music.spotui.ui.navigation.Routes.Extensions.route) }+ .padding(horizontal = 20.dp, vertical = 10.dp),+ ) {+ Text(stringResource(R.string.extensions_title), color = AppText, fontSize = 16.sp)+ Text(stringResource(R.string.extensions_row_detail), color = AppMuted, fontSize = 12.sp)+ }// The hidden Web Player stuck or crashed: rebuild it without leaving the app.Column(Modifier.fillMaxWidth().clickable {@@ -197,8 +217,8 @@ fun SettingsScreen(navController: NavController) {}.padding(horizontal = 20.dp, vertical = 10.dp),) {- Text(stringResource(R.string.restart_player_title), color = Color.White, fontSize = 16.sp)- Text(stringResource(R.string.restart_player_detail), color = Color(0xFFB3B3B3), fontSize = 12.sp)+ Text(stringResource(R.string.restart_player_title), color = AppText, fontSize = 16.sp)+ Text(stringResource(R.string.restart_player_detail), color = AppMuted, fontSize = 12.sp)}// The report a tester hands us. The engine's log is otherwise reachable only through// adb logcat, which the person reporting the bug cannot run: the label is a literal@@ -210,8 +230,8 @@ fun SettingsScreen(navController: NavController) {else android.widget.Toast.makeText(ctx, ctx.getString(R.string.diagnostic_export_failed), android.widget.Toast.LENGTH_SHORT).show()}.padding(horizontal = 20.dp, vertical = 10.dp),) {- Text(stringResource(R.string.diagnostic_export_title), color = Color.White, fontSize = 16.sp)- Text(stringResource(R.string.diagnostic_export_detail), color = Color(0xFFB3B3B3), fontSize = 12.sp)+ Text(stringResource(R.string.diagnostic_export_title), color = AppText, fontSize = 16.sp)+ Text(stringResource(R.string.diagnostic_export_detail), color = AppMuted, fontSize = 12.sp)}// Clear of the mini player and the navigation bar, as every other page (96 dp left the// last rows, "Restart the player" among them, under the mini player).@@ -220,6 +240,30 @@ fun SettingsScreen(navController: NavController) {}}+/**+ * The installed extensions that declare settings (manifest `settings`), each one opening its page,+ * where they are edited. Nothing when none has any.+ */+@Composable+private fun ExtensionSettingsRows(navController: NavController) {+ val registry by com.music.spotui.extensions.Extensions.registry.collectAsStateWithLifecycle()+ val withSettings = registry.extensions.mapNotNull { e ->+ com.music.spotui.extensions.Extensions.manifest(e.id)?.settings?.takeIf { it.isNotEmpty() }?.let { e to it }+ }+ if (withSettings.isEmpty()) return+ Section(R.string.extensions_title)+ withSettings.forEach { (e, settings) ->+ Column(+ Modifier.fillMaxWidth().clickable { navController.navigate(installedRoute(e.id)) }+ .padding(horizontal = 20.dp, vertical = 10.dp),+ ) {+ Text(e.name, color = AppText, fontSize = 16.sp)+ Text(settings.joinToString { it.label }, color = AppMuted, fontSize = 12.sp, maxLines = 2, overflow = androidx.compose.ui.text.style.TextOverflow.Ellipsis)+ }+ }+ Divider()+}+@Composableprivate fun Section(title: Int) {Text(stringResource(title).uppercase(), color = com.music.spotui.ui.theme.AppAccent, fontSize = 12.sp, fontWeight = FontWeight.Bold,@@ -227,14 +271,14 @@ private fun Section(title: Int) {}@Composable-private fun Divider() = HorizontalDivider(color = Color(0xFF2A2A2A), modifier = Modifier.padding(top = 8.dp))+private fun Divider() = HorizontalDivider(color = tone(0xFF2A2A2A), modifier = Modifier.padding(top = 8.dp))/** The app's accent colour, for everyone (the same palette the supporter sheet uses). */@Composableprivate fun AccentRow() {val ctx = androidx.compose.ui.platform.LocalContext.currentColumn(Modifier.fillMaxWidth().padding(horizontal = 20.dp, vertical = 10.dp)) {- Text(stringResource(R.string.supporter_accent), color = Color.White, fontSize = 16.sp)+ Text(stringResource(R.string.supporter_accent), color = AppText, fontSize = 16.sp)Row(horizontalArrangement = androidx.compose.foundation.layout.Arrangement.spacedBy(14.dp), modifier = Modifier.padding(top = 10.dp)) {for (a in com.music.spotui.data.api.SupportReminder.Accent.entries) {val selected = com.music.spotui.data.api.SupportReminder.accent == a@@ -249,7 +293,7 @@ private fun AccentRow() {Modifier.size(40.dp).semantics { contentDescription = name; role = Role.RadioButton }.clip(CircleShape).background(a.color)- .then(if (selected) Modifier.border(3.dp, Color.White, CircleShape) else Modifier)+ .then(if (selected) Modifier.border(3.dp, AppText, CircleShape) else Modifier).clickable { com.music.spotui.data.api.SupportReminder.setAccent(ctx, a) },)}@@ -267,10 +311,10 @@ private fun CrossfadeRow() {val ctx = androidx.compose.ui.platform.LocalContext.currentval pref = com.music.spotui.data.preferences.CrossfadePrefandroidx.compose.foundation.layout.Column(Modifier.fillMaxWidth().padding(horizontal = 20.dp, vertical = 10.dp)) {- Text(stringResource(R.string.settings_crossfade_title), color = Color.White, fontSize = 16.sp)+ Text(stringResource(R.string.settings_crossfade_title), color = AppText, fontSize = 16.sp)Text(stringResource(R.string.settings_crossfade_detail),- color = Color(0xFFB3B3B3), fontSize = 12.sp,+ color = AppMuted, fontSize = 12.sp,modifier = Modifier.padding(top = 2.dp),)Row(@@ -282,9 +326,9 @@ private fun CrossfadeRow() {Text(if (v == 0) stringResource(R.string.settings_crossfade_off)else stringResource(R.string.settings_crossfade_seconds, v),- color = if (selected) Color.Black else Color.White, fontSize = 14.sp,+ color = if (selected) Color.Black else AppText, fontSize = 14.sp,modifier = Modifier.clip(androidx.compose.foundation.shape.RoundedCornerShape(50))- .background(if (selected) com.music.spotui.ui.theme.AppAccent else Color(0xFF2A2A2A))+ .background(if (selected) com.music.spotui.ui.theme.AppAccent else tone(0xFF2A2A2A)).clickable { pref.set(ctx, v) }.padding(horizontal = 14.dp, vertical = 8.dp),)@@ -299,7 +343,7 @@ private fun OrientationRow() {val ctx = androidx.compose.ui.platform.LocalContext.currentval pref = com.music.spotui.data.preferences.OrientationPrefColumn(Modifier.fillMaxWidth().padding(horizontal = 20.dp, vertical = 10.dp)) {- Text(stringResource(R.string.settings_rotation_title), color = Color.White, fontSize = 16.sp)+ Text(stringResource(R.string.settings_rotation_title), color = AppText, fontSize = 16.sp)Row(horizontalArrangement = androidx.compose.foundation.layout.Arrangement.spacedBy(8.dp), modifier = Modifier.padding(top = 10.dp)) {for ((value, label) in listOf(pref.PORTRAIT to R.string.settings_rotation_portrait,@@ -309,9 +353,9 @@ private fun OrientationRow() {val selected = pref.mode == valueText(stringResource(label),- color = if (selected) Color.Black else Color.White, fontSize = 14.sp,+ color = if (selected) Color.Black else AppText, fontSize = 14.sp,modifier = Modifier.clip(androidx.compose.foundation.shape.RoundedCornerShape(50))- .background(if (selected) com.music.spotui.ui.theme.AppAccent else Color(0xFF2A2A2A))+ .background(if (selected) com.music.spotui.ui.theme.AppAccent else tone(0xFF2A2A2A)).clickable { pref.set(ctx, value) }.padding(horizontal = 16.dp, vertical = 8.dp),)@@ -332,18 +376,18 @@ private fun LanguageRow() {androidx.compose.foundation.layout.Column(Modifier.fillMaxWidth().clickable { picking = true }.padding(horizontal = 20.dp, vertical = 10.dp),) {- Text(stringResource(R.string.settings_item_app_language_title), color = Color.White, fontSize = 16.sp)- Text(label(current), color = Color(0xFFB3B3B3), fontSize = 12.sp)+ Text(stringResource(R.string.settings_item_app_language_title), color = AppText, fontSize = 16.sp)+ Text(label(current), color = AppMuted, fontSize = 12.sp)}if (picking) androidx.compose.material3.ModalBottomSheet(onDismissRequest = { picking = false },- containerColor = Color(0xFF282828),+ containerColor = tone(0xFF282828),) {androidx.compose.foundation.lazy.LazyColumn(Modifier.fillMaxWidth().padding(bottom = 16.dp)) {item {- Text(stringResource(R.string.settings_item_app_language_title), color = Color.White, fontSize = 18.sp,+ Text(stringResource(R.string.settings_item_app_language_title), color = AppText, fontSize = 18.sp,fontWeight = FontWeight.Bold, modifier = Modifier.padding(horizontal = 20.dp, vertical = 8.dp))- Text(stringResource(R.string.language_partial_note), color = Color(0xFFB3B3B3), fontSize = 12.sp,+ Text(stringResource(R.string.language_partial_note), color = AppMuted, fontSize = 12.sp,modifier = Modifier.padding(start = 20.dp, end = 20.dp, bottom = 8.dp))}items(com.music.spotui.data.AppLanguage.AVAILABLE.size) { i ->@@ -362,9 +406,9 @@ private fun LanguageRow() {}.padding(horizontal = 20.dp, vertical = 8.dp),) {androidx.compose.foundation.layout.Column(Modifier.weight(1f)) {- Text(label(tag), color = if (selected) com.music.spotui.ui.theme.AppAccent else Color.White, fontSize = 16.sp)+ Text(label(tag), color = if (selected) com.music.spotui.ui.theme.AppAccent else AppText, fontSize = 16.sp)if (tag == com.music.spotui.data.AppLanguage.SYSTEM)- Text(stringResource(R.string.language_auto_detail), color = Color(0xFFB3B3B3), fontSize = 12.sp)+ Text(stringResource(R.string.language_auto_detail), color = AppMuted, fontSize = 12.sp)}if (selected) androidx.compose.material3.Icon(androidx.compose.material.icons.Icons.Default.Check, null, tint = com.music.spotui.ui.theme.AppAccent)}@@ -382,14 +426,14 @@ private fun RemoveDownloadsRow() {androidx.compose.foundation.layout.Column(Modifier.fillMaxWidth().clickable { ask = true }.padding(horizontal = 20.dp, vertical = 10.dp),) {- Text(stringResource(R.string.settings_item_remove_downloads_title), color = Color.White, fontSize = 16.sp)- Text(stringResource(R.string.downloads_size, size), color = Color(0xFFB3B3B3), fontSize = 12.sp)+ Text(stringResource(R.string.settings_item_remove_downloads_title), color = AppText, fontSize = 16.sp)+ Text(stringResource(R.string.downloads_size, size), color = AppMuted, fontSize = 12.sp)}if (ask) androidx.compose.material3.AlertDialog(onDismissRequest = { ask = false },- containerColor = Color(0xFF282828),- title = { Text(stringResource(R.string.settings_storage_remove_downloads_dialog_title), color = Color.White) },- text = { Text(stringResource(R.string.playlist_entity_remove_download_dialog_description), color = Color(0xFFB3B3B3)) },+ containerColor = tone(0xFF282828),+ title = { Text(stringResource(R.string.settings_storage_remove_downloads_dialog_title), color = AppText) },+ text = { Text(stringResource(R.string.playlist_entity_remove_download_dialog_description), color = AppMuted) },confirmButton = {androidx.compose.material3.TextButton(onClick = {ask = false@@ -398,7 +442,7 @@ private fun RemoveDownloadsRow() {},dismissButton = {androidx.compose.material3.TextButton(onClick = { ask = false }) {- Text(stringResource(R.string.add_to_playlist_button_cancel), color = Color.White)+ Text(stringResource(R.string.add_to_playlist_button_cancel), color = AppText)}},)@@ -414,8 +458,8 @@ private fun OptionRow(label: String, detail: String, checked: Boolean,.toggleable(checked, enabled = enabled, role = Role.Switch, onValueChange = onChecked).padding(horizontal = 20.dp, vertical = 10.dp)) {androidx.compose.foundation.layout.Column(Modifier.weight(1f)) {- Text(label, color = Color.White, fontSize = 16.sp)- Text(detail, color = Color(0xFFB3B3B3), fontSize = 12.sp)+ Text(label, color = AppText, fontSize = 16.sp)+ Text(detail, color = AppMuted, fontSize = 12.sp)}androidx.compose.material3.Switch(checked = checked, enabled = enabled, onCheckedChange = null)}@@ -442,9 +486,9 @@ private fun CheckUpdateRow() {) {Text(stringResource(if (checking) R.string.settings_update_checking else R.string.settings_check_update_title),- color = Color.White, fontSize = 16.sp,+ color = AppText, fontSize = 16.sp,)- Text(stringResource(R.string.settings_check_update_detail), color = Color(0xFFB3B3B3), fontSize = 12.sp)+ Text(stringResource(R.string.settings_check_update_detail), color = AppMuted, fontSize = 12.sp)}}diff --git a/base/app/src/main/java/com/music/spotui/ui/screens/SetupScreen.kt b/base/app/src/main/java/com/music/spotui/ui/screens/SetupScreen.ktindex ad9aa6d9..fecfd15c 100644--- a/base/app/src/main/java/com/music/spotui/ui/screens/SetupScreen.kt+++ b/base/app/src/main/java/com/music/spotui/ui/screens/SetupScreen.kt@@ -1,5 +1,9 @@package com.music.spotui.ui.screens+import com.music.spotui.ui.theme.tone+import com.music.spotui.ui.theme.AppText+import com.music.spotui.ui.theme.AppMuted+import android.Manifestimport android.content.Contextimport android.content.pm.PackageManager@@ -83,7 +87,7 @@ private fun granted(context: Context, permission: String) =context.checkSelfPermission(permission) == PackageManager.PERMISSION_GRANTED@Composable-fun SetupScreen(onDone: () -> Unit, onSpotiflac: () -> Unit = {}) {+fun SetupScreen(onDone: () -> Unit) {val context = LocalContext.current// First the sound quality, then the permissions (skipped when done before an update).var qualityStep by remember { mutableStateOf(!com.music.spotui.data.preferences.isQualityChosen(context)) }@@ -106,7 +110,7 @@ fun SetupScreen(onDone: () -> Unit, onSpotiflac: () -> Unit = {}) {if (quality) QualityStep(onNext = {com.music.spotui.data.preferences.setQualityChosen(context)if (Setup.permissionsDone(context)) onDone() else qualityStep = false- }) else PermissionsStep(onDone, onSpotiflac)+ }) else PermissionsStep(onDone)}}}@@ -118,7 +122,7 @@ private fun StepDots(current: Int, modifier: Modifier = Modifier) {Row(horizontalArrangement = Arrangement.spacedBy(6.dp), modifier = modifier) {for (i in 0..1) {val w by animateDpAsState(if (i == current) 22.dp else 8.dp, tween(350), label = "dot")- val c by animateColorAsState(if (i == current) Color(0xFF1DB954) else Color.White.copy(alpha = 0.25f), tween(350), label = "dotColor")+ val c by animateColorAsState(if (i == current) Color(0xFF1DB954) else AppText.copy(alpha = 0.25f), tween(350), label = "dotColor")Box(Modifier.height(6.dp).width(w).clip(RoundedCornerShape(50)).background(c))}}@@ -133,7 +137,7 @@ private fun Modifier.riseIn(index: Int): Modifier {}@Composable-private fun PermissionsStep(onDone: () -> Unit, onSpotiflac: () -> Unit) {+private fun PermissionsStep(onDone: () -> Unit) {val context = LocalContext.current// Re-read when coming back from a system dialog or the settings.var tick by remember { mutableIntStateOf(0) }@@ -144,8 +148,8 @@ private fun PermissionsStep(onDone: () -> Unit, onSpotiflac: () -> Unit) {verticalArrangement = Arrangement.spacedBy(12.dp),) {var row = 0- Text(stringResource(R.string.setup_title), color = Color.White, fontSize = 26.sp, fontWeight = FontWeight.Bold, modifier = Modifier.riseIn(row++))- Text(stringResource(R.string.setup_subtitle), color = Color(0xFFB3B3B3), fontSize = 14.sp, modifier = Modifier.riseIn(row++))+ Text(stringResource(R.string.setup_title), color = AppText, fontSize = 26.sp, fontWeight = FontWeight.Bold, modifier = Modifier.riseIn(row++))+ Text(stringResource(R.string.setup_subtitle), color = AppMuted, fontSize = 14.sp, modifier = Modifier.riseIn(row++))Spacer(Modifier.height(8.dp))@Suppress("UNUSED_EXPRESSION") tickif (Build.VERSION.SDK_INT >= 33) SetupRow(@@ -164,12 +168,6 @@ private fun PermissionsStep(onDone: () -> Unit, onSpotiflac: () -> Unit) {stringResource(R.string.setup_battery_title), stringResource(R.string.setup_battery_detail),BatteryExemption.isExempt(context), Modifier.riseIn(row++),) { BatteryExemption.request(context) }- // Lossless downloads need SpotiFLAC's one-off verification (the quality toggle- // lives in Settings); not verified yet, the lossless source stays OFF.- if (com.music.spotui.data.preferences.getDownloadQuality(context) != com.music.spotui.data.preferences.DownloadQuality.OFF) SetupRow(- stringResource(R.string.setup_spotiflac_title), stringResource(R.string.setup_spotiflac_detail),- com.music.spotui.data.preferences.hasSpotiflacSession(context), Modifier.riseIn(row++),- ) { onSpotiflac() }Spacer(Modifier.height(12.dp))Box(Modifier.riseIn(row)) {Button(@@ -188,9 +186,9 @@ private fun QualityStep(onNext: () -> Unit) {Modifier.fillMaxSize().verticalScroll(rememberScrollState()).padding(vertical = 24.dp),verticalArrangement = Arrangement.spacedBy(12.dp),) {- Text(stringResource(R.string.setup_quality_title), color = Color.White, fontSize = 26.sp, fontWeight = FontWeight.Bold,+ Text(stringResource(R.string.setup_quality_title), color = AppText, fontSize = 26.sp, fontWeight = FontWeight.Bold,modifier = Modifier.padding(horizontal = 20.dp).riseIn(0))- Text(stringResource(R.string.setup_quality_subtitle), color = Color(0xFFB3B3B3), fontSize = 14.sp,+ Text(stringResource(R.string.setup_quality_subtitle), color = AppMuted, fontSize = 14.sp,modifier = Modifier.padding(horizontal = 20.dp).riseIn(1))Box(Modifier.riseIn(2)) { com.music.spotui.ui.components.StreamingQualityPicker(Modifier.padding(top = 8.dp)) }Box(Modifier.riseIn(3)) { com.music.spotui.ui.components.DownloadQualityPicker() }@@ -206,11 +204,11 @@ private fun QualityStep(onNext: () -> Unit) {private fun SetupRow(title: String, detail: String, on: Boolean, modifier: Modifier = Modifier, onEnable: () -> Unit) {Row(verticalAlignment = Alignment.CenterVertically,- modifier = modifier.fillMaxWidth().background(Color(0xFF1E1E1E), RoundedCornerShape(12.dp)).padding(16.dp),+ modifier = modifier.fillMaxWidth().background(tone(0xFF1E1E1E), RoundedCornerShape(12.dp)).padding(16.dp),) {Column(Modifier.weight(1f)) {- Text(title, color = Color.White, fontSize = 16.sp, fontWeight = FontWeight.SemiBold)- Text(detail, color = Color(0xFFB3B3B3), fontSize = 13.sp)+ Text(title, color = AppText, fontSize = 16.sp, fontWeight = FontWeight.SemiBold)+ Text(detail, color = AppMuted, fontSize = 13.sp)}// Allowed: the button gives way to a green check that pops in.AnimatedContent(diff --git a/base/app/src/main/java/com/music/spotui/ui/screens/ShowScreen.kt b/base/app/src/main/java/com/music/spotui/ui/screens/ShowScreen.ktindex cc031bb6..067c3f61 100644--- a/base/app/src/main/java/com/music/spotui/ui/screens/ShowScreen.kt+++ b/base/app/src/main/java/com/music/spotui/ui/screens/ShowScreen.kt@@ -1,5 +1,8 @@package com.music.spotui.ui.screens+import com.music.spotui.ui.theme.headerTint+import com.music.spotui.ui.theme.AppText+import androidx.compose.foundation.backgroundimport androidx.compose.foundation.clickableimport androidx.compose.foundation.layout.Arrangement@@ -157,7 +160,7 @@ fun ShowScreen(navController: NavController, showId: String, showName: String =.clickable { oldestFirst = !oldestFirst }.padding(horizontal = 16.dp, vertical = 12.dp),) {- Icon(Icons.Default.Tune, contentDescription = null, tint = Color.White.copy(alpha = 0.8f), modifier = Modifier.size(18.dp))+ Icon(Icons.Default.Tune, contentDescription = null, tint = AppText.copy(alpha = 0.8f), modifier = Modifier.size(18.dp))Spacer(Modifier.width(10.dp))Text(text = stringResource(@@ -168,7 +171,7 @@ fun ShowScreen(navController: NavController, showId: String, showName: String =else -> R.string.show_sort_newest},),- color = Color.White.copy(alpha = 0.8f),+ color = AppText.copy(alpha = 0.8f),fontSize = 13.sp,)}@@ -178,7 +181,7 @@ fun ShowScreen(navController: NavController, showId: String, showName: String =if (pageState is Response.Error && items.isEmpty()) item {Text((pageState as Response.Error).error,- color = Color.White.copy(alpha = 0.7f),+ color = AppText.copy(alpha = 0.7f),fontSize = 14.sp,modifier = Modifier.padding(16.dp),)@@ -187,7 +190,7 @@ fun ShowScreen(navController: NavController, showId: String, showName: String =if (tab == 0 && page != null && items.isEmpty() && pageState !is Response.Loading) item {Text(stringResource(R.string.show_empty),- color = Color.White.copy(alpha = 0.6f),+ color = AppText.copy(alpha = 0.6f),fontSize = 14.sp,modifier = Modifier.padding(16.dp),)@@ -223,7 +226,7 @@ private fun Header(Column(modifier = Modifier.fillMaxWidth()- .background(Brush.verticalGradient(listOf(Color(0xFF33322F), AppBackground)))+ .background(Brush.verticalGradient(listOf(headerTint(Color(0xFF33322F), 0f), AppBackground))).statusBarsPadding(),) {Box(@@ -251,7 +254,7 @@ private fun Header(Column(Modifier.weight(1f).padding(start = 16.dp)) {Text(text = show?.name?.takeIf { it.isNotBlank() } ?: fallbackName,- color = Color.White,+ color = AppText,fontSize = 24.sp,fontWeight = FontWeight.Bold,maxLines = 3,@@ -261,15 +264,15 @@ private fun Header(val narrators = show?.narrators.orEmpty().joinToString(", ")if (authors.isNotBlank()) {Spacer(Modifier.height(6.dp))- Text(stringResource(R.string.show_authors, authors), color = Color.White.copy(alpha = 0.8f), fontSize = 13.sp, maxLines = 2, overflow = TextOverflow.Ellipsis)+ Text(stringResource(R.string.show_authors, authors), color = AppText.copy(alpha = 0.8f), fontSize = 13.sp, maxLines = 2, overflow = TextOverflow.Ellipsis)}if (narrators.isNotBlank()) {Spacer(Modifier.height(2.dp))- Text(stringResource(R.string.show_narrators, narrators), color = Color.White.copy(alpha = 0.65f), fontSize = 12.sp, maxLines = 2, overflow = TextOverflow.Ellipsis)+ Text(stringResource(R.string.show_narrators, narrators), color = AppText.copy(alpha = 0.65f), fontSize = 12.sp, maxLines = 2, overflow = TextOverflow.Ellipsis)}if (authors.isBlank() && show != null && show.publisher.isNotBlank()) {Spacer(Modifier.height(6.dp))- Text(show.publisher, color = Color.White.copy(alpha = 0.8f), fontSize = 13.sp, maxLines = 2, overflow = TextOverflow.Ellipsis)+ Text(show.publisher, color = AppText.copy(alpha = 0.8f), fontSize = 13.sp, maxLines = 2, overflow = TextOverflow.Ellipsis)}}}@@ -280,11 +283,11 @@ private fun Header(verticalAlignment = Alignment.CenterVertically,modifier = Modifier.padding(start = 16.dp, top = 12.dp),) {- Icon(Icons.Default.Star, contentDescription = null, tint = Color.White.copy(alpha = 0.8f), modifier = Modifier.size(16.dp))+ Icon(Icons.Default.Star, contentDescription = null, tint = AppText.copy(alpha = 0.8f), modifier = Modifier.size(16.dp))Spacer(Modifier.width(6.dp))Text(text = String.format(java.util.Locale.getDefault(), "%.1f", rating),- color = Color.White.copy(alpha = 0.8f),+ color = AppText.copy(alpha = 0.8f),fontSize = 13.sp,)}@@ -305,18 +308,18 @@ private fun FollowPill(following: Boolean, onClick: () -> Unit) {modifier = Modifier.height(32.dp).clip(RoundedCornerShape(16.dp))- .background(if (following) Color.White.copy(alpha = 0.12f) else Color.Transparent)+ .background(if (following) AppText.copy(alpha = 0.12f) else Color.Transparent).pressable(0.96f, onClick = onClick).padding(horizontal = 16.dp),) {Row(verticalAlignment = Alignment.CenterVertically) {if (following) {- Icon(Icons.Default.Check, contentDescription = null, tint = Color.White, modifier = Modifier.size(16.dp))+ Icon(Icons.Default.Check, contentDescription = null, tint = AppText, modifier = Modifier.size(16.dp))Spacer(Modifier.width(6.dp))}Text(text = stringResource(if (following) R.string.show_following else R.string.show_follow),- color = Color.White,+ color = AppText,fontSize = 13.sp,fontWeight = FontWeight.Bold,)@@ -332,7 +335,7 @@ private fun TabLabel(text: String, selected: Boolean, modifier: Modifier = Modif) {Text(text = text,- color = if (selected) Color.White else Color.White.copy(alpha = 0.6f),+ color = if (selected) AppText else AppText.copy(alpha = 0.6f),fontSize = 14.sp,fontWeight = if (selected) FontWeight.Bold else FontWeight.Normal,)@@ -353,16 +356,16 @@ private fun About(show: PodcastModel?) {Column(Modifier.fillMaxWidth().padding(16.dp)) {Text(text = show?.description.orEmpty(),- color = Color.White.copy(alpha = 0.75f),+ color = AppText.copy(alpha = 0.75f),fontSize = 14.sp,)if (authors.isNotBlank()) {Spacer(Modifier.height(12.dp))- Text(stringResource(R.string.show_authors, authors), color = Color.White.copy(alpha = 0.6f), fontSize = 13.sp)+ Text(stringResource(R.string.show_authors, authors), color = AppText.copy(alpha = 0.6f), fontSize = 13.sp)}if (narrators.isNotBlank()) {Spacer(Modifier.height(4.dp))- Text(stringResource(R.string.show_narrators, narrators), color = Color.White.copy(alpha = 0.6f), fontSize = 13.sp)+ Text(stringResource(R.string.show_narrators, narrators), color = AppText.copy(alpha = 0.6f), fontSize = 13.sp)}}}@@ -393,7 +396,7 @@ private fun EpisodeRow(Column(Modifier.weight(1f).padding(start = 12.dp)) {Text(text = episode.title,- color = if (playing) AppAccent else Color.White,+ color = if (playing) AppAccent else AppText,fontSize = 15.sp,fontWeight = FontWeight.SemiBold,maxLines = 2,@@ -403,7 +406,7 @@ private fun EpisodeRow(Spacer(Modifier.height(4.dp))Text(text = episode.description,- color = Color.White.copy(alpha = 0.65f),+ color = AppText.copy(alpha = 0.65f),fontSize = 12.sp,maxLines = 2,overflow = TextOverflow.Ellipsis,@@ -412,9 +415,9 @@ private fun EpisodeRow(Spacer(Modifier.height(4.dp))Row(verticalAlignment = Alignment.CenterVertically) {if (finished) {- Text(stringResource(R.string.episode_marked_played), color = Color.White.copy(alpha = 0.6f), fontSize = 12.sp)+ Text(stringResource(R.string.episode_marked_played), color = AppText.copy(alpha = 0.6f), fontSize = 12.sp)Spacer(Modifier.width(6.dp))- Text("•", color = Color.White.copy(alpha = 0.4f), fontSize = 12.sp)+ Text("•", color = AppText.copy(alpha = 0.4f), fontSize = 12.sp)Spacer(Modifier.width(6.dp))}val started = episode.playedPositionMs > 0 && !finished@@ -423,7 +426,7 @@ private fun EpisodeRow(date.isBlank() -> minuteselse -> "$date • $minutes"},- color = Color.White.copy(alpha = 0.6f),+ color = AppText.copy(alpha = 0.6f),fontSize = 12.sp,)if (started) {@@ -445,7 +448,7 @@ private fun EpisodeRow(Icon(Icons.Default.MoreVert,contentDescription = stringResource(R.string.episode_options),- tint = Color.White.copy(alpha = 0.8f),+ tint = AppText.copy(alpha = 0.8f),modifier = Modifier.size(22.dp).pressable(0.9f, onClick = onMenu),)Spacer(Modifier.weight(1f))@@ -453,12 +456,12 @@ private fun EpisodeRow(Spacer(Modifier.width(6.dp))Box(contentAlignment = Alignment.Center,- modifier = Modifier.size(40.dp).clip(CircleShape).background(Color.White).pressable(0.92f, onClick = onPlay),+ modifier = Modifier.size(40.dp).clip(CircleShape).background(AppText).pressable(0.92f, onClick = onPlay),) {com.music.spotui.ui.components.PlayPauseIcon(playing = playing,contentDescription = stringResource(R.string.episode_play),- tint = Color.Black,+ tint = com.music.spotui.ui.theme.AppBackground,modifier = Modifier.size(20.dp),)}diff --git a/base/app/src/main/java/com/music/spotui/ui/screens/SpotiflacScreen.kt b/base/app/src/main/java/com/music/spotui/ui/screens/SpotiflacScreen.ktdeleted file mode 100644index 911bc3fb..00000000--- a/base/app/src/main/java/com/music/spotui/ui/screens/SpotiflacScreen.kt+++ /dev/null@@ -1,218 +0,0 @@-package com.music.spotui.ui.screens--/*- * Ported from Spotui's SpotiflacVerifyScreen (https://github.com/Spotui/Spotui), GPL-3.0,- * and adapted to Myspoti (own theme, strings, navigation).- */--import android.content.Context-import androidx.compose.foundation.background-import androidx.compose.foundation.layout.Arrangement-import androidx.compose.foundation.layout.Box-import androidx.compose.foundation.layout.Column-import androidx.compose.foundation.layout.Row-import androidx.compose.foundation.layout.fillMaxSize-import androidx.compose.foundation.layout.fillMaxWidth-import androidx.compose.foundation.layout.height-import androidx.compose.foundation.layout.navigationBarsPadding-import androidx.compose.foundation.layout.padding-import androidx.compose.foundation.layout.statusBarsPadding-import androidx.compose.foundation.shape.RoundedCornerShape-import androidx.compose.material3.Button-import androidx.compose.material3.ButtonDefaults-import androidx.compose.material3.Text-import androidx.compose.material3.TextButton-import androidx.compose.runtime.Composable-import androidx.compose.runtime.LaunchedEffect-import androidx.compose.runtime.getValue-import androidx.compose.runtime.mutableStateOf-import androidx.compose.runtime.remember-import androidx.compose.runtime.rememberCoroutineScope-import androidx.compose.runtime.setValue-import androidx.compose.ui.Alignment-import androidx.compose.ui.Modifier-import androidx.compose.ui.graphics.Color-import androidx.compose.ui.platform.LocalContext-import androidx.compose.ui.res.stringResource-import androidx.compose.ui.text.font.FontWeight-import androidx.compose.ui.text.style.TextAlign-import androidx.compose.ui.unit.dp-import androidx.compose.ui.unit.sp-import app.myspoti.engine.R-import com.music.spotui.ui.theme.AppBackground-import kotlinx.coroutines.Dispatchers-import kotlinx.coroutines.delay-import kotlinx.coroutines.launch-import kotlinx.coroutines.withContext--/**- * SpotiFLAC verification, the way SpotiFLAC Mobile's extensions do it: bootstrap → the- * service's own hosted challenge page (the user solves the Turnstile themselves)- * → redirect with a grant → exchange the grant for a signing session.- *- * The app only loads the page and catches the redirect. The session is what gives- * the lossless (FLAC) downloads their most reliable source. With a session the- * screen shows the status; without it the verification opens in a browser tab.- */-@Composable-fun SpotiflacScreen(onClose: () -> Unit) {- val context = LocalContext.current- val scope = rememberCoroutineScope()- var attempt by remember { mutableStateOf(0) }- // One session per download server (Tidal, then Qobuz); verified once none is missing.- // Tidal only: the best source, and a single page to solve (Qobuz would need its own).- fun missing() = listOf(com.music.spotui.lossless.ZarzSession.Ext.TIDAL)- .firstOrNull { com.music.spotui.data.preferences.getSpotiflacSession(context, it.appVersion) == null }- var ext by remember { mutableStateOf(missing()) }- var verified by remember { mutableStateOf(ext == null) }- var message by remember { mutableStateOf("") }- var done by remember { mutableStateOf(false) }- val leave: () -> Unit = onClose-- fun res(id: Int): String = context.getString(id)-- // Reused so a retry keeps the same install; the service binds the session to it.- val installId = remember { com.music.spotui.lossless.ZarzSession.installId(context) }- // The state the challenge page must send back with its grant. Saveable: a- // rotation while the browser is open must not lose it (the grant is then rejected).- var state by androidx.compose.runtime.saveable.rememberSaveable { mutableStateOf("") }-- fun finish(grant: String) = scope.launch {- message = res(R.string.spotiflac_session_creating)- val current = ext ?: return@launch- val ok = withContext(Dispatchers.IO) {- runCatching { com.music.spotui.lossless.ZarzSession.exchange(context, current, installId, grant) }- .onFailure { android.util.Log.w("Spotiflac", "exchange: ${it.message}") }.isSuccess- }- if (ok) {- // The next server, if one is still missing (often given at once to a verified install).- ext = missing()- if (ext == null) {- verified = true- done = true- android.widget.Toast.makeText(context, R.string.spotiflac_session_ok, android.widget.Toast.LENGTH_LONG).show()- }- } else {- message = res(R.string.spotiflac_session_failed)- }- }-- LaunchedEffect(attempt, ext) {- val current = ext- if (verified || current == null) return@LaunchedEffect- message = ""- val boot = withContext(Dispatchers.IO) {- runCatching { com.music.spotui.lossless.ZarzSession.bootstrap(context, current, installId) }- .onFailure { android.util.Log.w("Spotiflac", "bootstrap: ${it.message}") }.getOrNull()- }- if (boot == null) {- message = res(R.string.spotiflac_verify_start_failed)- return@LaunchedEffect- }- if (boot.challengeUrl == null) {- // The servers gave a session straight away: nothing to solve for this one.- ext = missing()- if (ext == null) { verified = true; done = true }- return@LaunchedEffect- }- message = res(R.string.spotiflac_verify_in_browser)- state = boot.state- // A browser tab, as SpotiFLAC Mobile opens it: Cloudflare's check runs in a real browser,- // and the page hands the grant back through spotiflac://session-grant (ZarzSession.grants).- runCatching {- androidx.browser.customtabs.CustomTabsIntent.Builder().setShowTitle(true).build()- .launchUrl(context, android.net.Uri.parse(boot.challengeUrl))- }.onFailure {- context.startActivity(android.content.Intent(android.content.Intent.ACTION_VIEW, android.net.Uri.parse(boot.challengeUrl))- .addFlags(android.content.Intent.FLAG_ACTIVITY_NEW_TASK))- }- // Never leave the user on a page that silently stalled.- delay(180_000)- if (!done && !verified) message = res(R.string.spotiflac_verify_timeout)- }-- // The grant coming back from the browser tab.- LaunchedEffect(Unit) {- com.music.spotui.lossless.ZarzSession.grants.collect { link ->- if (link == null) return@collect- com.music.spotui.lossless.ZarzSession.grants.value = null // take it, once- val back = com.music.spotui.lossless.ZarzSession.parseGrant(link)- if (back == null || state.isBlank() || back.second != state) {- message = res(R.string.spotiflac_verify_rejected)- } else finish(back.first)- }- }-- if (verified) {- SpotiflacStatusScreen(leave)- return- }-- Box(modifier = Modifier.fillMaxSize().background(Color.Black)) {- if (message.isNotEmpty()) {- Text(- message,- color = Color.White,- textAlign = TextAlign.Center,- modifier = Modifier.align(Alignment.Center).padding(24.dp),- )- }-- Row(- modifier = Modifier.align(Alignment.BottomCenter).fillMaxWidth()- .navigationBarsPadding().height(56.dp).background(Color.Black),- horizontalArrangement = Arrangement.SpaceEvenly,- ) {- TextButton(onClick = { attempt++ }) { Text(stringResource(R.string.retry), color = Color.White) }- TextButton(onClick = leave) { Text(stringResource(R.string.spotiflac_skip), color = Color.White) }- }-- Box(- modifier = Modifier.fillMaxWidth().statusBarsPadding().height(40.dp).background(Color.Black),- contentAlignment = Alignment.Center,- ) {- Text(- stringResource(R.string.spotiflac_verify_title),- color = Color(0xFF00C7B7),- fontWeight = FontWeight.Bold,- fontSize = 14.sp,- )- }- }-}--/** The status page when a session exists: state, expiry, forget. */-@Composable-private fun SpotiflacStatusScreen(onClose: () -> Unit) {- val context = LocalContext.current- Column(- Modifier.fillMaxSize().statusBarsPadding().navigationBarsPadding().padding(20.dp),- verticalArrangement = Arrangement.spacedBy(14.dp),- ) {- Text(stringResource(R.string.spotiflac_status_title), color = Color.White, fontSize = 22.sp, fontWeight = FontWeight.Bold)- Text(stringResource(R.string.spotiflac_status_verified), color = Color(0xFFB3B3B3), fontSize = 14.sp)- for (e in com.music.spotui.lossless.ZarzSession.Ext.entries) {- val session = com.music.spotui.data.preferences.getSpotiflacSession(context, e.appVersion) ?: continue- Text(- e.name.lowercase().replaceFirstChar { it.uppercase() } + " — " +- stringResource(R.string.spotiflac_session_expires, session.expiresAt.take(19).replace('T', ' ')),- color = Color(0xFF00C7B7), fontSize = 13.sp,- )- }- Button(- onClick = {- com.music.spotui.data.preferences.clearSpotiflacSessions(context)- onClose()- },- colors = ButtonDefaults.buttonColors(containerColor = Color(0xFF1E1E1E), contentColor = Color.White),- shape = RoundedCornerShape(24.dp),- ) { Text(stringResource(R.string.spotiflac_forget)) }- Button(- onClick = onClose,- colors = ButtonDefaults.buttonColors(containerColor = Color(0xFF1DB954), contentColor = Color.Black),- modifier = Modifier.fillMaxWidth().height(50.dp),- ) { Text(stringResource(R.string.setup_continue), fontWeight = FontWeight.Bold, fontSize = 16.sp) }- }-}--private const val CALLBACK = com.music.spotui.lossless.ZarzSession.CALLBACKdiff --git a/base/app/src/main/java/com/music/spotui/ui/screens/StatsScreens.kt b/base/app/src/main/java/com/music/spotui/ui/screens/StatsScreens.ktnew file mode 100644index 00000000..ac54efa9--- /dev/null+++ b/base/app/src/main/java/com/music/spotui/ui/screens/StatsScreens.kt@@ -0,0 +1,344 @@+package com.music.spotui.ui.screens++import androidx.compose.foundation.background+import androidx.compose.foundation.clickable+import androidx.compose.foundation.layout.Arrangement+import androidx.compose.foundation.layout.Box+import androidx.compose.foundation.layout.Column+import androidx.compose.foundation.layout.PaddingValues+import androidx.compose.foundation.layout.Row+import androidx.compose.foundation.layout.Spacer+import androidx.compose.foundation.layout.fillMaxHeight+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.foundation.layout.size+import androidx.compose.foundation.layout.statusBarsPadding+import androidx.compose.foundation.layout.width+import androidx.compose.foundation.lazy.LazyColumn+import androidx.compose.foundation.lazy.LazyRow+import androidx.compose.foundation.lazy.items+import androidx.compose.foundation.lazy.itemsIndexed+import androidx.compose.foundation.shape.CircleShape+import androidx.compose.foundation.shape.RoundedCornerShape+import androidx.compose.material.icons.Icons+import androidx.compose.material.icons.automirrored.filled.ArrowBack+import androidx.compose.material.icons.filled.EmojiEvents+import androidx.compose.material.icons.filled.Refresh+import androidx.compose.material.icons.outlined.QueueMusic+import androidx.compose.material3.FilterChip+import androidx.compose.material3.FilterChipDefaults+import androidx.compose.material3.Icon+import androidx.compose.material3.Text+import androidx.compose.runtime.Composable+import androidx.compose.runtime.LaunchedEffect+import androidx.compose.runtime.getValue+import androidx.compose.runtime.mutableIntStateOf+import androidx.compose.runtime.mutableStateOf+import androidx.compose.runtime.produceState+import androidx.compose.runtime.remember+import androidx.compose.runtime.saveable.rememberSaveable+import androidx.compose.runtime.setValue+import androidx.compose.ui.Alignment+import androidx.compose.ui.Modifier+import androidx.compose.ui.draw.clip+import androidx.compose.ui.graphics.Color+import androidx.compose.ui.layout.ContentScale+import androidx.compose.ui.res.stringResource+import androidx.compose.ui.text.font.FontWeight+import androidx.compose.ui.text.style.TextAlign+import androidx.compose.ui.text.style.TextOverflow+import androidx.compose.ui.unit.dp+import androidx.compose.ui.unit.sp+import androidx.navigation.NavController+import app.myspoti.api.FriendActivity+import app.myspoti.api.TimeRange+import app.myspoti.api.TopContent+import app.myspoti.api.best+import app.myspoti.engine.R+import app.myspoti.host.android.MyspotiRuntime+import com.bumptech.glide.integration.compose.CrossFade+import com.bumptech.glide.integration.compose.ExperimentalGlideComposeApi+import com.bumptech.glide.integration.compose.GlideImage+import com.music.spotui.data.api.TopStats+import com.music.spotui.data.local.ListenHistory+import com.music.spotui.di.SongPlayer+import com.music.spotui.ui.components.spotifyImageUrl+import com.music.spotui.ui.navigation.artistRoute+import com.music.spotui.ui.navigation.profileRoute+import com.music.spotui.ui.theme.AppAccent+import com.music.spotui.ui.theme.AppBackground+import com.music.spotui.ui.theme.AppMuted+import com.music.spotui.ui.theme.AppText+import com.music.spotui.ui.theme.tone+import kotlinx.coroutines.Dispatchers+import kotlinx.coroutines.withContext++private val StatsSubtle: Color get() = AppMuted++private val rangeLabels = listOf(+ TimeRange.SHORT_TERM to R.string.stats_range_short,+ TimeRange.MEDIUM_TERM to R.string.stats_range_medium,+ TimeRange.LONG_TERM to R.string.stats_range_long,+)++@Composable+private fun StatsChip(label: String, selected: Boolean, onClick: () -> Unit) =+ FilterChip(selected = selected, onClick = onClick, label = { Text(label) },+ colors = FilterChipDefaults.filterChipColors(selectedContainerColor = AppAccent, selectedLabelColor = Color.Black,+ labelColor = AppText, containerColor = tone(0xFF2A2A2A)))++/** The tab switch at the top of the recap: Spotify's ranking of the account, or this phone's own counter. */+@Composable+internal fun StatsTabs(tab: Int, onTab: (Int) -> Unit) {+ Row(Modifier.padding(horizontal = 16.dp), horizontalArrangement = Arrangement.spacedBy(8.dp)) {+ listOf(R.string.stats_tab_spotify, R.string.stats_tab_phone).forEachIndexed { i, label ->+ StatsChip(stringResource(label), i == tab) { onTab(i) }+ }+ }+}++/**+ * The account's listening stats as Spotify ranks them (the official app's "Listening stats" and+ * the profile's top artists and tracks): top artists and tracks over the past 4 weeks, 6 months+ * or year, from `userTopContent`. Spotify sends ranks only, no play counts or minutes.+ */+@OptIn(ExperimentalGlideComposeApi::class)+@Composable+internal fun SpotifyStatsTab(navController: NavController) {+ var range by rememberSaveable { mutableIntStateOf(0) }+ var attempt by remember { mutableIntStateOf(0) }+ val timeRange = rangeLabels[range].first+ val state by produceState<Result<TopContent>?>(TopStats.cached(timeRange)?.let { Result.success(it) }, timeRange, attempt) {+ value = runCatching { TopStats.get(timeRange, force = attempt > 0) }+ }+ val top = state?.getOrNull()+ LazyColumn(contentPadding = PaddingValues(bottom = com.music.spotui.ui.components.bottomBarsSpace())) {+ item {+ Row(Modifier.padding(16.dp, 12.dp, 16.dp, 0.dp), horizontalArrangement = Arrangement.spacedBy(8.dp)) {+ rangeLabels.forEachIndexed { i, (_, label) -> StatsChip(stringResource(label), i == range) { range = i } }+ }+ }+ when {+ state == null -> item { com.music.spotui.ui.components.SkeletonList(count = 6) }+ top == null -> item {+ com.music.spotui.ui.components.ErrorRetry(stringResource(R.string.stats_failed)) { attempt++ }+ }+ top.artists.isEmpty() && top.tracks.isEmpty() -> item {+ Text(stringResource(R.string.stats_empty), color = StatsSubtle, fontSize = 14.sp, modifier = Modifier.padding(16.dp))+ }+ else -> {+ top.artistTotal?.takeIf { it > 0 }?.let { total ->+ item {+ Text(stringResource(R.string.stats_artists_ranked, total), color = StatsSubtle, fontSize = 14.sp,+ modifier = Modifier.padding(16.dp, 14.dp, 16.dp, 0.dp))+ }+ }+ if (top.artists.isNotEmpty()) {+ item { StatsSectionTitle(stringResource(R.string.recap_top_artists)) }+ item {+ LazyRow(contentPadding = PaddingValues(horizontal = 16.dp), horizontalArrangement = Arrangement.spacedBy(14.dp)) {+ itemsIndexed(top.artists, key = { _, a -> a.uri }) { i, a ->+ Column(+ horizontalAlignment = Alignment.CenterHorizontally,+ modifier = Modifier.width(120.dp).clip(RoundedCornerShape(8.dp))+ .clickable { navController.navigate(artistRoute(a.name, a.uri.substringAfterLast(':'))) },+ ) {+ com.music.spotui.ui.components.ProfileAvatar(+ url = spotifyImageUrl(a.images.best(300)?.url), name = a.name, size = 120.dp)+ Spacer(Modifier.height(8.dp))+ Text("${i + 1}. ${a.name}", color = AppText, fontSize = 14.sp, fontWeight = FontWeight.Bold,+ maxLines = 1, overflow = TextOverflow.Ellipsis, textAlign = TextAlign.Center)+ }+ }+ }+ }+ }+ if (top.tracks.isNotEmpty()) {+ item { StatsSectionTitle(stringResource(R.string.recap_top_tracks)) }+ itemsIndexed(top.tracks, key = { _, t -> t.uri }) { i, t ->+ Row(+ verticalAlignment = Alignment.CenterVertically,+ modifier = Modifier.fillMaxWidth().clickable { SongPlayer.playSong(t.uri) }.padding(16.dp, 6.dp),+ ) {+ Text("${i + 1}", color = StatsSubtle, fontSize = 16.sp, modifier = Modifier.width(32.dp))+ GlideImage(transition = CrossFade, model = spotifyImageUrl(t.album?.images?.best(160)?.url), contentDescription = null,+ contentScale = ContentScale.Crop, modifier = Modifier.size(48.dp).clip(RoundedCornerShape(4.dp)))+ Column(Modifier.padding(start = 12.dp).weight(1f)) {+ Text(t.name, color = AppText, fontSize = 15.sp, maxLines = 1, overflow = TextOverflow.Ellipsis)+ Text(t.artists.joinToString(", ") { it.name }, color = StatsSubtle, fontSize = 12.sp,+ maxLines = 1, overflow = TextOverflow.Ellipsis)+ }+ }+ }+ }+ }+ }+ item {+ Text(stringResource(R.string.stats_spotify_note), color = AppMuted, fontSize = 12.sp, modifier = Modifier.padding(16.dp, 24.dp))+ }+ }+}++@Composable+private fun StatsSectionTitle(text: String) =+ Text(text, color = AppText, fontSize = 20.sp, fontWeight = FontWeight.Bold, modifier = Modifier.padding(16.dp, 18.dp, 16.dp, 10.dp))++/** Minutes played per calendar week on this phone (the recap's own counter), the current week last and highlighted. */+@Composable+internal fun WeeklyMinutesChart(modifier: Modifier = Modifier) {+ val weeks by produceState<List<ListenHistory.Week>?>(null) {+ value = withContext(Dispatchers.IO) { ListenHistory.weekly(8) }+ }+ val w = weeks ?: return+ if (w.all { it.minutes == 0L }) return+ val max = w.maxOf { it.minutes }.coerceAtLeast(1)+ val pattern = android.text.format.DateFormat.getBestDateTimePattern(java.util.Locale.getDefault(), "dMMM")+ val format = remember(pattern) { java.text.SimpleDateFormat(pattern, java.util.Locale.getDefault()) }+ Column(modifier.padding(16.dp, 8.dp)) {+ Text(stringResource(R.string.stats_weekly_minutes), color = AppText, fontSize = 20.sp, fontWeight = FontWeight.Bold)+ Text(stringResource(R.string.stats_this_week, w.last().minutes), color = StatsSubtle, fontSize = 13.sp,+ modifier = Modifier.padding(top = 2.dp, bottom = 12.dp))+ Row(Modifier.fillMaxWidth().height(120.dp), horizontalArrangement = Arrangement.spacedBy(6.dp), verticalAlignment = Alignment.Bottom) {+ w.forEachIndexed { i, week ->+ Column(Modifier.weight(1f).fillMaxHeight(), verticalArrangement = Arrangement.Bottom, horizontalAlignment = Alignment.CenterHorizontally) {+ if (week.minutes > 0) Text("${week.minutes}", color = StatsSubtle, fontSize = 10.sp, maxLines = 1)+ Box(+ Modifier.fillMaxWidth()+ .height((96f * week.minutes / max).coerceAtLeast(2f).dp)+ .clip(RoundedCornerShape(topStart = 4.dp, topEnd = 4.dp))+ .background(if (i == w.lastIndex) AppAccent else tone(0xFF535353)),+ )+ }+ }+ }+ Row(Modifier.fillMaxWidth().padding(top = 4.dp), horizontalArrangement = Arrangement.spacedBy(6.dp)) {+ w.forEach { week ->+ Text(format.format(java.util.Date(week.startMs)), color = StatsSubtle, fontSize = 10.sp, maxLines = 1,+ textAlign = TextAlign.Center, modifier = Modifier.weight(1f))+ }+ }+ }+}++/**+ * "Your #3 artist of the past 4 weeks" under an artist's name, when the account's Spotify top+ * artists hold them (the closest the Web Player's data comes to the official app's fan badges:+ * Spotify sends no top-listener rank or "early listener" date for an artist).+ */+@Composable+fun ArtistTopBadge(artistId: String, modifier: Modifier = Modifier) {+ if (artistId.isBlank()) return+ val uri = if (artistId.startsWith("spotify:")) artistId else "spotify:artist:$artistId"+ val rank by produceState<Pair<TimeRange, Int>?>(null, uri) {+ value = runCatching {+ TopStats.rankOf(uri, TimeRange.entries.associateWith { r -> TopStats.get(r).artists.map { it.uri } })+ }.getOrNull()+ }+ val (range, n) = rank ?: return+ val text = when (range) {+ TimeRange.SHORT_TERM -> R.string.artist_top_short+ TimeRange.MEDIUM_TERM -> R.string.artist_top_medium+ TimeRange.LONG_TERM -> R.string.artist_top_long+ }+ Row(+ verticalAlignment = Alignment.CenterVertically,+ modifier = modifier.padding(16.dp, 10.dp, 16.dp, 0.dp)+ .clip(RoundedCornerShape(50)).background(AppText.copy(alpha = 0.12f))+ .padding(horizontal = 10.dp, vertical = 5.dp),+ ) {+ Icon(Icons.Filled.EmojiEvents, contentDescription = null, tint = AppAccent, modifier = Modifier.size(16.dp))+ Spacer(Modifier.width(6.dp))+ Text(stringResource(text, n), color = AppText, fontSize = 13.sp, fontWeight = FontWeight.Bold)+ }+}++/**+ * Friend activity, as the official feed shows it: each followed person sharing their listening,+ * their latest track and where it was played from, "Now" for the past 15 minutes. Tapping the+ * person opens their profile, tapping the row plays the track in its context.+ */+@OptIn(ExperimentalGlideComposeApi::class)+@Composable+fun FriendActivityScreen(navController: NavController) {+ var attempt by remember { mutableIntStateOf(0) }+ var state by remember { mutableStateOf<Result<List<FriendActivity>>?>(null) }+ LaunchedEffect(attempt) {+ state = runCatching { MyspotiRuntime.api.users.friendActivity() }+ }+ val now = remember(state) { System.currentTimeMillis() }+ Column(Modifier.fillMaxSize().background(AppBackground).statusBarsPadding()) {+ Row(verticalAlignment = Alignment.CenterVertically, modifier = Modifier.fillMaxWidth().padding(8.dp, 12.dp, 8.dp, 8.dp)) {+ Icon(Icons.AutoMirrored.Filled.ArrowBack, stringResource(R.string.accessibility_navigate_back), tint = AppText,+ modifier = Modifier.size(40.dp).clip(CircleShape).clickable { navController.popBackStack() }.padding(8.dp))+ Text(stringResource(R.string.friends_title), fontWeight = FontWeight.Bold, color = AppText, fontSize = 22.sp, maxLines = 1,+ overflow = TextOverflow.Ellipsis, modifier = Modifier.padding(start = 6.dp).weight(1f))+ Icon(Icons.Filled.Refresh, stringResource(R.string.friends_refresh), tint = AppText,+ modifier = Modifier.size(40.dp).clip(CircleShape).clickable { state = null; attempt++ }.padding(8.dp))+ }+ val s = state+ val friends = s?.getOrNull()+ LazyColumn(contentPadding = PaddingValues(bottom = com.music.spotui.ui.components.bottomBarsSpace())) {+ when {+ s == null -> item { com.music.spotui.ui.components.SkeletonList(count = 6, round = true) }+ friends == null -> item {+ com.music.spotui.ui.components.ErrorRetry(stringResource(R.string.friends_failed)) { state = null; attempt++ }+ }+ friends.isEmpty() -> item {+ Text(stringResource(R.string.friends_empty), color = StatsSubtle, fontSize = 14.sp, modifier = Modifier.padding(16.dp))+ }+ else -> items(friends, key = { it.user.uri }) { f -> FriendRow(f, now, navController) }+ }+ }+ }+}++@OptIn(ExperimentalGlideComposeApi::class)+@Composable+private fun FriendRow(f: FriendActivity, now: Long, navController: NavController) {+ val track = f.track+ val openProfile = { navController.navigate(profileRoute(f.user.uri.substringAfterLast(':'), f.user.name)) }+ Row(+ verticalAlignment = Alignment.Top,+ modifier = Modifier.fillMaxWidth()+ .clickable { if (track != null) SongPlayer.playSong(track.uri, contextUri = f.contextUri) else openProfile() }+ .padding(16.dp, 10.dp),+ ) {+ Box(Modifier.clip(CircleShape).clickable(onClick = openProfile)) {+ com.music.spotui.ui.components.ProfileAvatar(url = f.user.imageUrl, name = f.user.name, size = 48.dp)+ }+ Column(Modifier.padding(start = 12.dp).weight(1f)) {+ Row(verticalAlignment = Alignment.CenterVertically) {+ Text(f.user.name, color = AppText, fontSize = 15.sp, fontWeight = FontWeight.Bold, maxLines = 1,+ overflow = TextOverflow.Ellipsis, modifier = Modifier.weight(1f, fill = false).clickable(onClick = openProfile))+ Spacer(Modifier.weight(1f))+ if (f.isNowPlaying(now)) {+ Box(Modifier.size(8.dp).clip(CircleShape).background(AppAccent))+ Spacer(Modifier.width(6.dp))+ Text(stringResource(R.string.friends_now), color = AppAccent, fontSize = 12.sp, maxLines = 1)+ } else if (f.timestampMs > 0) {+ Text(+ android.text.format.DateUtils.getRelativeTimeSpanString(f.timestampMs, now,+ android.text.format.DateUtils.MINUTE_IN_MILLIS, android.text.format.DateUtils.FORMAT_ABBREV_RELATIVE).toString(),+ color = StatsSubtle, fontSize = 12.sp, maxLines = 1,+ )+ }+ }+ if (track != null) {+ Text(listOf(track.name, track.artists.joinToString(", ") { it.name }).filter { it.isNotBlank() }.joinToString(" • "),+ color = AppText, fontSize = 13.sp, maxLines = 1, overflow = TextOverflow.Ellipsis, modifier = Modifier.padding(top = 2.dp))+ val where = f.contextName ?: track.album?.name+ if (!where.isNullOrBlank()) Row(verticalAlignment = Alignment.CenterVertically, modifier = Modifier.padding(top = 2.dp)) {+ Icon(Icons.Outlined.QueueMusic, contentDescription = null, tint = StatsSubtle, modifier = Modifier.size(14.dp))+ Spacer(Modifier.width(4.dp))+ Text(where, color = StatsSubtle, fontSize = 12.sp, maxLines = 1, overflow = TextOverflow.Ellipsis)+ }+ }+ }+ f.trackImageUrl?.let { cover ->+ GlideImage(transition = CrossFade, model = spotifyImageUrl(cover.replaceFirst("http://", "https://")), contentDescription = null,+ contentScale = ContentScale.Crop, modifier = Modifier.padding(start = 10.dp).size(44.dp).clip(RoundedCornerShape(4.dp)))+ }+ }+}diff --git a/base/app/src/main/java/com/music/spotui/ui/screens/WelcomeScreen.kt b/base/app/src/main/java/com/music/spotui/ui/screens/WelcomeScreen.ktindex c82875f0..d5f6fb6d 100644--- a/base/app/src/main/java/com/music/spotui/ui/screens/WelcomeScreen.kt+++ b/base/app/src/main/java/com/music/spotui/ui/screens/WelcomeScreen.kt@@ -1,5 +1,8 @@package com.music.spotui.ui.screens+import com.music.spotui.ui.theme.tone+import com.music.spotui.ui.theme.AppText+import androidx.compose.animation.AnimatedContentimport androidx.compose.animation.core.Animatableimport androidx.compose.animation.core.FastOutSlowInEasing@@ -95,10 +98,10 @@ fun WelcomeScreen(onLogin: () -> Unit) {scaleX = s; scaleY = s}.clip(RoundedCornerShape(32.dp))- .background(Color(0xFF181818)),+ .background(tone(0xFF181818)),)Spacer(Modifier.height(28.dp))- Text("Myspoti", color = Color.White, fontFamily = AppSans, fontWeight = FontWeight.ExtraBold, fontSize = 40.sp,+ Text("Myspoti", color = AppText, fontFamily = AppSans, fontWeight = FontWeight.ExtraBold, fontSize = 40.sp,modifier = Modifier.rise(1))Spacer(Modifier.height(12.dp))Box(Modifier.rise(2)) { Features() }@@ -121,7 +124,7 @@ fun WelcomeScreen(onLogin: () -> Unit) {}Text(stringResource(R.string.welcome_privacy),- color = Color.White.copy(alpha = 0.5f), fontFamily = AppSans, fontSize = 13.sp, lineHeight = 18.sp,+ color = AppText.copy(alpha = 0.5f), fontFamily = AppSans, fontSize = 13.sp, lineHeight = 18.sp,textAlign = TextAlign.Center, modifier = Modifier.padding(top = 14.dp),)}@@ -148,7 +151,6 @@ private fun Features() {stringResource(R.string.welcome_rotate_ads),stringResource(R.string.welcome_rotate_lyrics),stringResource(R.string.welcome_rotate_clips),- stringResource(R.string.welcome_rotate_lossless),stringResource(R.string.welcome_rotate_offline),)var index by remember { mutableIntStateOf(0) }@@ -157,7 +159,7 @@ private fun Features() {while (true) { delay(2_400); index = (index + 1) % features.size }}Column(horizontalAlignment = Alignment.CenterHorizontally) {- Text(stringResource(R.string.welcome_lead), color = Color.White.copy(alpha = 0.7f), fontFamily = AppSans,+ Text(stringResource(R.string.welcome_lead), color = AppText.copy(alpha = 0.7f), fontFamily = AppSans,fontSize = 17.sp, textAlign = TextAlign.Center)AnimatedContent(targetState = index,@@ -167,7 +169,7 @@ private fun Features() {},label = "feature",) { i ->- Text(features[i], color = Color.White, fontFamily = AppSans, fontWeight = FontWeight.Bold, fontSize = 19.sp,+ Text(features[i], color = AppText, fontFamily = AppSans, fontWeight = FontWeight.Bold, fontSize = 19.sp,textAlign = TextAlign.Center, modifier = Modifier.fillMaxWidth().padding(top = 2.dp))}}diff --git a/base/app/src/main/java/com/music/spotui/ui/theme/Color.kt b/base/app/src/main/java/com/music/spotui/ui/theme/Color.ktindex 22b7db59..3ba4e509 100644--- a/base/app/src/main/java/com/music/spotui/ui/theme/Color.kt+++ b/base/app/src/main/java/com/music/spotui/ui/theme/Color.kt@@ -1,9 +1,24 @@package com.music.spotui.ui.themeimport androidx.compose.ui.graphics.Color+import androidx.compose.ui.graphics.lerp-val AppBackground: Color get() = if (app.myspoti.power.EnergySettings.oledBlack) Color.Black else Color(0xFF121212)-val GridBackground = Color(0xFF2A2A2A)+val AppBackground: Color get() =+ if (app.myspoti.power.EnergySettings.oledBlack) Color.Black else Color(0xFF121212)+val GridBackground: Color get() = tone(0xFF2A2A2A)/** The accent (Spotify green, or the colour a supporter chose). */-val AppPalette: Color get() = com.music.spotui.data.api.SupportReminder.accentColor-val AppAccent: Color get() = com.music.spotui.data.api.SupportReminder.accentColor\ No newline at end of file+val AppPalette: Color get() = AppAccent+val AppAccent: Color get() = com.music.spotui.data.api.SupportReminder.accentColor++/** Primary text and icons. */+val AppText: Color = Color.White+/** Secondary text and icons. */+val AppMuted: Color = Color(0xFFB3B3B3)+/** What a tint is mixed with to make a header. */+val AppShade: Color = Color.Black++/** One of the palette's raised greys (#181818 ... #3E3E3E): "a bit raised from the page". */+fun tone(argb: Long): Color = Color(argb)++/** The cover's colour as a page header: darkened toward black, so the title stays readable. */+fun headerTint(tint: Color, amount: Float): Color = lerp(tint, Color.Black, amount)diff --git a/base/app/src/main/java/com/music/spotui/ui/theme/Theme.kt b/base/app/src/main/java/com/music/spotui/ui/theme/Theme.ktindex efa11a7a..af886978 100644--- a/base/app/src/main/java/com/music/spotui/ui/theme/Theme.kt+++ b/base/app/src/main/java/com/music/spotui/ui/theme/Theme.kt@@ -1,8 +1,7 @@package com.music.spotui.ui.themeimport android.app.Activity-import android.graphics.Color.toArgb-import androidx.compose.foundation.isSystemInDarkTheme+import androidx.compose.material3.ColorSchemeimport androidx.compose.material3.MaterialThemeimport androidx.compose.material3.darkColorSchemeimport androidx.compose.runtime.Composable@@ -58,7 +57,6 @@ private fun spotifyColorScheme(accent: Color) = darkColorScheme(@Composablefun SpotuiTheme(- darkTheme: Boolean = isSystemInDarkTheme(),content: @Composable () -> Unit) {val energy by app.myspoti.power.EnergySettings.state.collectAsStateWithLifecycle()@@ -66,16 +64,16 @@ fun SpotuiTheme(androidx.compose.runtime.LaunchedEffect(policy.videoMaxHeight, policy.allowBackgroundLookups) {com.music.spotui.video.MusicVideoController.onEnergyPolicyChanged()}- // The app is always dark, like Spotify: a phone in light mode must not turn the- // surfaces white (an empty or failed page then showed white text on white).- val visualScheme = spotifyColorScheme(AppAccent)+ // Dark only, like Spotify: a saved choice from the withdrawn light palette is ignored.+ val visualScheme: ColorScheme = spotifyColorScheme(AppAccent)val view = LocalView.currentif (!view.isInEditMode) {SideEffect {val window = (view.context as Activity).windowwindow.attributes = window.attributes.apply { preferredRefreshRate = policy.displayRefreshCap }window.statusBarColor = Color.Transparent.toArgb()- WindowCompat.getInsetsController(window, view).isAppearanceLightStatusBars = false // always-dark app: white status bar icons+ // White icons on the dark palette.+ WindowCompat.getInsetsController(window, view).isAppearanceLightStatusBars = false// B19: the navigation bar was left to the system — a white band under the always-dark// UI (reported in the modal sheets, where the bar was opaque) with dark icons on it.window.navigationBarColor = Color.Transparent.toArgb()@@ -83,6 +81,8 @@ fun SpotuiTheme(// which showed as a differently coloured strip under the full-screen Canvas.window.isNavigationBarContrastEnforced = falseWindowCompat.getInsetsController(window, view).isAppearanceLightNavigationBars = false+ // Behind the first frame and under overscroll: the palette's page colour.+ window.setBackgroundDrawable(android.graphics.drawable.ColorDrawable(AppBackground.toArgb()))}}@@ -101,4 +101,4 @@ fun SpotuiTheme(content = content,)}-}\ No newline at end of file+}diff --git a/base/app/src/main/java/com/music/spotui/ui/viewmodel/PlayerViewModel.kt b/base/app/src/main/java/com/music/spotui/ui/viewmodel/PlayerViewModel.ktindex cb32820d..4d848a48 100644--- a/base/app/src/main/java/com/music/spotui/ui/viewmodel/PlayerViewModel.kt+++ b/base/app/src/main/java/com/music/spotui/ui/viewmodel/PlayerViewModel.kt@@ -140,7 +140,7 @@ class PlayerViewModel constructor(private val currentSongState: CurrentSongStateval song = queueSongs[index]if (song.id == currentSongId.value) returnupdateSongState(song.coverUri, song.title, song.singer, true, song.id, index, song.album)- SongPlayer.playSong(song.url, context)+ SongPlayer.playSong(song.url, context, songs = queueSongs)}fun playPreviousSong(queueSongs : List<SongsModel>, context: Context) {diff --git a/base/app/src/main/java/com/music/spotui/video/MusicVideoController.kt b/base/app/src/main/java/com/music/spotui/video/MusicVideoController.ktindex 69bd2924..a4fa70bf 100644--- a/base/app/src/main/java/com/music/spotui/video/MusicVideoController.kt+++ b/base/app/src/main/java/com/music/spotui/video/MusicVideoController.kt@@ -72,6 +72,8 @@ object MusicVideoController {/** The user switched to the video for this track. */val on = mutableStateOf(false)val fullscreen = mutableStateOf(false)+ /** The activity is in its picture-in-picture window: the clip's surface is the window's own. */+ val inPip = mutableStateOf(false)/** width / height of the playing video. */val aspect = mutableFloatStateOf(16f / 9f)@@ -235,7 +237,7 @@ object MusicVideoController {/** Resolve and cache a track's video in the background, without touching the UI state. */fun prefetch(trackId: String, title: String, artist: String, durationMs: Long) {- if (com.music.spotui.data.DataSaver.active || !appVisible || !EnergySettings.state.value.policy.allowBackgroundLookups || trackId.isBlank() || trackId == currentTrackId) return+ if (com.music.spotui.data.DataSaver.active || !com.music.spotui.data.preferences.MusicVideoPref.on || !appVisible || !EnergySettings.state.value.policy.allowBackgroundLookups || trackId.isBlank() || trackId == currentTrackId) returnif (trackId == settledId && SystemClock.elapsedRealtime() < settledUntil) return// Already answered (or failed a moment ago): nothing to look up, nothing to read.if (recentAnswer(trackId) != null || SystemClock.elapsedRealtime() < (failedUntil[trackId] ?: 0L)) return@@ -290,7 +292,7 @@ object MusicVideoController {/** Find (or load) the video of the track now playing. Disk access stays on IO. */fun prepare(trackId: String, title: String, artist: String, durationMs: Long) {// Data saver on mobile data: no look-up (it downloads audio) and no video stream.- if (trackId.isBlank() || !appVisible || com.music.spotui.data.DataSaver.active) return+ if (trackId.isBlank() || !appVisible || com.music.spotui.data.DataSaver.active || !com.music.spotui.data.preferences.MusicVideoPref.on) returncurrentTitle = title; currentArtist = artist; currentDuration = durationMsif (trackId == currentTrackId && (state.value !is State.Idle || SystemClock.elapsedRealtime() < nextPrepareAt)) returnif (currentTrackId != trackId) { errorRetryUsedFor = null; nextPrepareAt = 0L }@@ -866,7 +868,9 @@ object MusicVideoController {// Clip sound: the song goes unheard only while the clip is really playing with its// sound; buffering, paused, an ad or anything else, the song is heard again at once.val sounding = shown && clipSound.value && warmedFor?.endsWith(SOUND_KEY) == true &&- p.isPlaying && SongPlayer.currentTrackId == currentTrackId && !SongPlayer.adPlaying+ p.isPlaying && SongPlayer.currentTrackId == currentTrackId && !SongPlayer.adPlaying &&+ // The extension's own sound plays, not the engine's: nothing to hush.+ !com.music.spotui.di.LocalPlayer.active.valuehush(sounding)p.volume = if (hushed) 1f else 0fif (!shown) {diff --git a/base/app/src/main/java/com/music/spotui/widget/NowPlayingWidget.kt b/base/app/src/main/java/com/music/spotui/widget/NowPlayingWidget.ktindex 2e1a79b8..3295e5e3 100644--- a/base/app/src/main/java/com/music/spotui/widget/NowPlayingWidget.kt+++ b/base/app/src/main/java/com/music/spotui/widget/NowPlayingWidget.kt@@ -30,7 +30,7 @@ class NowPlayingWidget : AppWidgetProvider() {override fun onReceive(context: Context, intent: Intent) {when (intent.action) {ACTION_PREVIOUS -> SongPlayer.previous()- ACTION_TOGGLE -> if (SongPlayer.isPlaying()) SongPlayer.pause() else SongPlayer.play()+ ACTION_TOGGLE -> if (SongPlayer.isPlaying()) SongPlayer.pause(by = "widget") else SongPlayer.play(by = "widget")ACTION_NEXT -> SongPlayer.next()else -> super.onReceive(context, intent)}diff --git a/base/app/src/main/res/values-af/spotify_strings.xml b/base/app/src/main/res/values-af/spotify_strings.xmlindex 95691c63..3681e594 100644--- a/base/app/src/main/res/values-af/spotify_strings.xml+++ b/base/app/src/main/res/values-af/spotify_strings.xml@@ -17,7 +17,6 @@<string name="snackbar_added_to_liked_songs" formatted="false">Bygevoeg by Liedjie-laaiks.</string><string name="snackbar_removed_from_liked_songs" formatted="false">Uit Liedjie-laaiks verwyder.</string><string name="content_description_context_menu" formatted="false">Meer opsies</string>- <string name="close_button_content_description" formatted="false">Maak toe</string><string name="add_to_playlist_saved_in_section_header" formatted="false">Gestoor in</string><string name="add_to_playlist_new_playlist_button_text" formatted="false">Nuwe speellys</string><string name="add_to_playlist_button_cancel" formatted="false">Kanselleer</string>@@ -25,8 +24,6 @@<string name="lyrics_card_title" formatted="false">Lirieke</string><string name="lyrics_card_title_preview" formatted="false">Liriekevoorskou</string><string name="lyrics_card_show_lyrics_button" formatted="false">Wys lirieke</string>- <string name="lyrics_card_expand_button_content_description" formatted="false">Maak volskerm-lirieke oop</string>- <string name="lyrics_card_share_button_content_description" formatted="false">Deel lirieke</string><string name="lyrics_credential_note" formatted="false">Lirieke voorsien deur %1$s</string><string name="lyrics_fullscreen_chip_label_share" formatted="false">Deel</string><string name="lyrics_fullscreen_chip_label_translate" formatted="false">Vertaal</string>@@ -49,7 +46,6 @@<string name="artist_popular_tracks" formatted="false">Gewild</string><string name="curation_button_follow_state_text" formatted="false">Volg</string><string name="curation_button_following_state_text" formatted="false">Volg tans</string>- <string name="search_main_entity_subtitle_artist" formatted="false">Kunstenaar</string><string name="connect_phone_is_self" formatted="false">Hierdie foon</string><string name="settings_item_canvas_title" formatted="false">Canvas</string><string name="video_settings_canvas_subtitle" formatted="false">Kort, herhalende patrone wanneer ’n liedjie speel.</string>@@ -107,8 +103,6 @@<string name="library_search_text_hint" formatted="false">Soek in jou biblioteek</string><string name="account_title" formatted="false">Rekening</string><string name="song_dna_search_chip_followed_artists" formatted="false">Gevolgde kunstenaars</string>- <string name="settings_item_crossfade_title" formatted="false">Kruisverdowing</string>- <string name="playback_settings_crossfade_slider_seconds" formatted="false">%1$d s</string><string name="local_files_title" formatted="false">Plaaslike lêers</string><string name="local_files_empty_section_title" formatted="false">Voeg jou eie klanklêers by Jou biblioteek</string><string name="local_files_empty_section_subtitle" formatted="false">Het jy \'n liedjie of persoonlike podsending wat nie op Spotify is nie?</string>@@ -138,14 +132,10 @@<string name="assisted_curation_search_filter_artists" formatted="false">Kunstenaars</string><string name="assisted_curation_search_filter_albums" formatted="false">Albums</string><string name="assisted_curation_search_filter_playlists" formatted="false">Speellyste</string>- <string name="assisted_curation_search_filter_clear_content_description" formatted="false">Vee filter uit</string>- <string name="ad_category_title_music" formatted="false">Musiek</string>- <string name="made_for_you_hub_title" formatted="false">Vir jou geskep</string><string name="settings_item_app_language_title" formatted="false">Toep-taal</string><string name="create_menu_item_folder_title" formatted="false">Vouer</string><string name="create_folder_name_suggested_folder_name" formatted="false">Nuwe vouer</string><string name="context_menu_rename_folder" formatted="false">Hernoem vouer</string>- <string name="your_library_messaging_folder_rename_hint" formatted="false">Vouer naam</string><string name="create_playlist_content_description" formatted="false">Maak speel lys</string><string name="actions_picker_delete" formatted="false">Vee uit</string><string name="filter_and_sort_sort_section_title" formatted="false">Sorteer volgens</string>diff --git a/base/app/src/main/res/values-am/spotify_strings.xml b/base/app/src/main/res/values-am/spotify_strings.xmlindex 983b1956..6225bb5f 100644--- a/base/app/src/main/res/values-am/spotify_strings.xml+++ b/base/app/src/main/res/values-am/spotify_strings.xml@@ -17,7 +17,6 @@<string name="snackbar_added_to_liked_songs" formatted="false">ወደ ተወደዱ ሙዚቃዎች ታክሏል።</string><string name="snackbar_removed_from_liked_songs" formatted="false">ከተወደዱ ሙዚቃዎች ተወግደዋል።</string><string name="content_description_context_menu" formatted="false">ተጨማሪ አማራጮች</string>- <string name="close_button_content_description" formatted="false">ዝጋ</string><string name="add_to_playlist_saved_in_section_header" formatted="false">በሚከተለው ውስጥ ተቀምጧል</string><string name="add_to_playlist_new_playlist_button_text" formatted="false">አዲስ አጫዋች ዝርዝር</string><string name="add_to_playlist_button_cancel" formatted="false">ሰርዝ</string>@@ -25,8 +24,6 @@<string name="lyrics_card_title" formatted="false">የሙዚቃ ግጥሞች</string><string name="lyrics_card_title_preview" formatted="false">የሙዚቃ ግጥም ቅድመ ዕይታ</string><string name="lyrics_card_show_lyrics_button" formatted="false">የሙዚቃ ግጥም አሳይ</string>- <string name="lyrics_card_expand_button_content_description" formatted="false">የሙሉ ማያ ገጽ የሙዚቃ ግጥምን ይክፈቱ</string>- <string name="lyrics_card_share_button_content_description" formatted="false">የሙዚቃ ግጥም ያጋሩ</string><string name="lyrics_credential_note" formatted="false">የሙዚቃ ግጥም የቀረበው በ%1$s</string><string name="lyrics_fullscreen_chip_label_share" formatted="false">አጋራ</string><string name="lyrics_fullscreen_chip_label_translate" formatted="false">ተርጉም</string>@@ -49,7 +46,6 @@<string name="artist_popular_tracks" formatted="false">ታዋቂ</string><string name="curation_button_follow_state_text" formatted="false">ተከተል</string><string name="curation_button_following_state_text" formatted="false">በመከተል ላይ</string>- <string name="search_main_entity_subtitle_artist" formatted="false">አርቲስት</string><string name="connect_phone_is_self" formatted="false">ይህ ስልክ</string><string name="settings_item_canvas_title" formatted="false">Canvas</string><string name="video_settings_canvas_subtitle" formatted="false">አንድ ሙዚቃ ሲጫወት አጭር፣ የሚዘለሉ ምስሎች።</string>@@ -107,8 +103,6 @@<string name="library_search_text_hint" formatted="false">የእርስዎ ቤተ-ሙዚቃ ፈልግ</string><string name="account_title" formatted="false">መለያ</string><string name="song_dna_search_chip_followed_artists" formatted="false">የተከተሏቸው አርቲስቶች</string>- <string name="settings_item_crossfade_title" formatted="false">ሲሻገር አደብዝዝ</string>- <string name="playback_settings_crossfade_slider_seconds" formatted="false">%1$d ሰ</string><string name="local_files_title" formatted="false">አካባቢያዊ ፋይሎች</string><string name="local_files_empty_section_title" formatted="false">የራስዎን የኦዲዮ ፋይሎች ወደ የእርስዎ ቤተ-ሙዚቃ ያክሉ</string><string name="local_files_empty_section_subtitle" formatted="false">Spotify ላይ የሌለ ሙዚቃ ወይም የግል ፖድካስት አግኝተዋል?</string>@@ -138,14 +132,10 @@<string name="assisted_curation_search_filter_artists" formatted="false">አርቲስቶች</string><string name="assisted_curation_search_filter_albums" formatted="false">አልበሞች</string><string name="assisted_curation_search_filter_playlists" formatted="false">አጫዋች ዝርዝሮች</string>- <string name="assisted_curation_search_filter_clear_content_description" formatted="false">ማጣሪያን አጽዳ</string>- <string name="ad_category_title_music" formatted="false">ሙዚቃ</string>- <string name="made_for_you_hub_title" formatted="false">ለእርስዎ የተሰራ</string><string name="settings_item_app_language_title" formatted="false">የመተግበሪያ ቋንቋ</string><string name="create_menu_item_folder_title" formatted="false">አቃፊ</string><string name="create_folder_name_suggested_folder_name" formatted="false">አዲስ አቃፊ</string><string name="context_menu_rename_folder" formatted="false">አቃፊን እንደገና ይሰይሙ</string>- <string name="your_library_messaging_folder_rename_hint" formatted="false">የአቃፊ ስም</string><string name="create_playlist_content_description" formatted="false">አጫዋች ዝርዝር ይፍጠሩ</string><string name="actions_picker_delete" formatted="false">አጥፋ</string><string name="filter_and_sort_sort_section_title" formatted="false">ደርድር በ</string>diff --git a/base/app/src/main/res/values-ar-rEG/spotify_strings.xml b/base/app/src/main/res/values-ar-rEG/spotify_strings.xmlindex db70b630..a77bb879 100644--- a/base/app/src/main/res/values-ar-rEG/spotify_strings.xml+++ b/base/app/src/main/res/values-ar-rEG/spotify_strings.xml@@ -17,7 +17,6 @@<string name="snackbar_added_to_liked_songs" formatted="false">اتضافت للأغاني اللي عجبتني.</string><string name="snackbar_removed_from_liked_songs" formatted="false">الأغنية اتشالت من الأغاني اللي عجبتني.</string><string name="content_description_context_menu" formatted="false">خيارات أكتر</string>- <string name="close_button_content_description" formatted="false">قفل</string><string name="add_to_playlist_saved_in_section_header" formatted="false">مجلد الحفظ</string><string name="add_to_playlist_new_playlist_button_text" formatted="false">قايمة أغاني جديدة</string><string name="add_to_playlist_button_cancel" formatted="false">إلغاء</string>@@ -25,8 +24,6 @@<string name="lyrics_card_title" formatted="false">الكلمات</string><string name="lyrics_card_title_preview" formatted="false">معاينة الكلمات</string><string name="lyrics_card_show_lyrics_button" formatted="false">عرض الكلمات</string>- <string name="lyrics_card_expand_button_content_description" formatted="false">فتح الكلمات في شاشة كاملة</string>- <string name="lyrics_card_share_button_content_description" formatted="false">مشاركة الكلمات</string><string name="lyrics_credential_note" formatted="false">الكلمات قدمها %1$s</string><string name="lyrics_fullscreen_chip_label_share" formatted="false">مشاركة</string><string name="lyrics_fullscreen_chip_label_translate" formatted="false">ترجمة</string>@@ -49,7 +46,6 @@<string name="artist_popular_tracks" formatted="false">محتوى مشهور</string><string name="curation_button_follow_state_text" formatted="false">متابعة</string><string name="curation_button_following_state_text" formatted="false">بتتابعه</string>- <string name="search_main_entity_subtitle_artist" formatted="false">الفنان</string><string name="connect_phone_is_self" formatted="false">التليفون ده</string><string name="settings_item_canvas_title" formatted="false">Canvas</string><string name="video_settings_canvas_subtitle" formatted="false">مؤثرات بصرية قصيرة ومتكررة بتظهر والأغنية شغالة.</string>@@ -106,8 +102,6 @@<string name="library_search_text_hint" formatted="false">بحث في \"مكتبتك الموسيقية\"</string><string name="account_title" formatted="false">الحساب</string><string name="song_dna_search_chip_followed_artists" formatted="false">فنانين بتتابعهم</string>- <string name="settings_item_crossfade_title" formatted="false">مزج الأغاني</string>- <string name="playback_settings_crossfade_slider_seconds" formatted="false">%1$d ثانية</string><string name="local_files_title" formatted="false">الملفات</string><string name="local_files_empty_section_title" formatted="false">إضافة الملفات الصوتية بتاعتك لمكتبتك الموسيقية</string><string name="local_files_empty_section_subtitle" formatted="false">عندك أغنية أو بودكاست شخصي مش موجود على Spotify؟</string>@@ -137,14 +131,10 @@<string name="assisted_curation_search_filter_artists" formatted="false">الفنانين</string><string name="assisted_curation_search_filter_albums" formatted="false">الألبومات</string><string name="assisted_curation_search_filter_playlists" formatted="false">قوايم الأغاني</string>- <string name="assisted_curation_search_filter_clear_content_description" formatted="false">امسح التصنيف</string>- <string name="ad_category_title_music" formatted="false">الموسيقى</string>- <string name="made_for_you_hub_title" formatted="false">مخصوص علشانك</string><string name="settings_item_app_language_title" formatted="false">لغة التطبيق</string><string name="create_menu_item_folder_title" formatted="false">المجلد</string><string name="create_folder_name_suggested_folder_name" formatted="false">مجلد جديد</string><string name="context_menu_rename_folder" formatted="false">تغيير اسم المجلد</string>- <string name="your_library_messaging_folder_rename_hint" formatted="false">اسم المجلد</string><string name="create_playlist_content_description" formatted="false">عمل قايمة أغاني</string><string name="actions_picker_delete" formatted="false">مسح</string><string name="filter_and_sort_sort_section_title" formatted="false">ترتيب حسب</string>diff --git a/base/app/src/main/res/values-ar-rMA/spotify_strings.xml b/base/app/src/main/res/values-ar-rMA/spotify_strings.xmlindex b3aee3c6..e95ef193 100644--- a/base/app/src/main/res/values-ar-rMA/spotify_strings.xml+++ b/base/app/src/main/res/values-ar-rMA/spotify_strings.xml@@ -17,7 +17,6 @@<string name="snackbar_added_to_liked_songs" formatted="false">تزادت للأغاني اللي عاجباك.</string><string name="snackbar_removed_from_liked_songs" formatted="false">تمسحات من الأغاني اللي عاجباك.</string><string name="content_description_context_menu" formatted="false">اختيارات أخرى</string>- <string name="close_button_content_description" formatted="false">سد</string><string name="add_to_playlist_saved_in_section_header" formatted="false">مسجّل في</string><string name="add_to_playlist_new_playlist_button_text" formatted="false">قائمة أغاني جديدة</string><string name="add_to_playlist_button_cancel" formatted="false">الغي</string>@@ -25,8 +24,6 @@<string name="lyrics_card_title" formatted="false">كلمات الأغاني</string><string name="lyrics_card_title_preview" formatted="false">معاينة الكلمات</string><string name="lyrics_card_show_lyrics_button" formatted="false">اعرض الكلمات</string>- <string name="lyrics_card_expand_button_content_description" formatted="false">اعرض الكلمات فالشاشة كاملة</string>- <string name="lyrics_card_share_button_content_description" formatted="false">شارك كلمات الأغنية</string><string name="lyrics_credential_note" formatted="false">الكلمات من عند %1$s</string><string name="lyrics_fullscreen_chip_label_share" formatted="false">شارك</string><string name="lyrics_fullscreen_chip_label_translate" formatted="false">ترجم</string>@@ -49,7 +46,6 @@<string name="artist_popular_tracks" formatted="false">معروفة</string><string name="curation_button_follow_state_text" formatted="false">تبّع</string><string name="curation_button_following_state_text" formatted="false">متابع</string>- <string name="search_main_entity_subtitle_artist" formatted="false">فنان</string><string name="connect_phone_is_self" formatted="false">هاد التليفون</string><string name="settings_item_canvas_title" formatted="false">Canvas</string><string name="video_settings_canvas_subtitle" formatted="false">مؤثرات بصرية قصيرة ومتكررة كنبان فاش كتكون الأغنية خدّامة.</string>@@ -106,8 +102,6 @@<string name="library_search_text_hint" formatted="false">قلّب في مكتبتك</string><string name="account_title" formatted="false">الحساب</string><string name="song_dna_search_chip_followed_artists" formatted="false">فنانين متابعهم</string>- <string name="settings_item_crossfade_title" formatted="false">دمج</string>- <string name="playback_settings_crossfade_slider_seconds" formatted="false">%1$d ثانية</string><string name="local_files_title" formatted="false">الفيشيات ديالك</string><string name="local_files_empty_section_title" formatted="false">زيد الملفات الصوتية ديالك لمكتبتك الموسيقية</string><string name="local_files_empty_section_subtitle" formatted="false">واش عندك أغنية أو بودكاست شخصي مكاينش في Spotify؟</string>@@ -137,14 +131,10 @@<string name="assisted_curation_search_filter_artists" formatted="false">الفنانين</string><string name="assisted_curation_search_filter_albums" formatted="false">الألبومات</string><string name="assisted_curation_search_filter_playlists" formatted="false">قوائم الأغاني</string>- <string name="assisted_curation_search_filter_clear_content_description" formatted="false">امسح التصنيف</string>- <string name="ad_category_title_music" formatted="false">الموسيقى</string>- <string name="made_for_you_hub_title" formatted="false">مصممة على ودك</string><string name="settings_item_app_language_title" formatted="false">اللغة ديال التطبيق</string><string name="create_menu_item_folder_title" formatted="false">مجلّد</string><string name="create_folder_name_suggested_folder_name" formatted="false">مجلّد جديد</string><string name="context_menu_rename_folder" formatted="false">اعطي اسم جديد للمجلّد</string>- <string name="your_library_messaging_folder_rename_hint" formatted="false">اسم المجلّد</string><string name="create_playlist_content_description" formatted="false">دير قائمة أغاني جديدة</string><string name="actions_picker_delete" formatted="false">امسَح</string><string name="filter_and_sort_sort_section_title" formatted="false">رتب حسب</string>diff --git a/base/app/src/main/res/values-ar-rSA/spotify_strings.xml b/base/app/src/main/res/values-ar-rSA/spotify_strings.xmlindex 32316810..c3117130 100644--- a/base/app/src/main/res/values-ar-rSA/spotify_strings.xml+++ b/base/app/src/main/res/values-ar-rSA/spotify_strings.xml@@ -17,7 +17,6 @@<string name="snackbar_added_to_liked_songs" formatted="false">انضافت لقائمة \"أغاني عجبتني\".</string><string name="snackbar_removed_from_liked_songs" formatted="false">انشالت من قائمة :أغاني عجبتني\".</string><string name="content_description_context_menu" formatted="false">خيارات أكثر</string>- <string name="close_button_content_description" formatted="false">قفل</string><string name="add_to_playlist_saved_in_section_header" formatted="false">مجلد الحفظ</string><string name="add_to_playlist_new_playlist_button_text" formatted="false">قائمة أغاني جديدة</string><string name="add_to_playlist_button_cancel" formatted="false">إلغاء</string>@@ -25,8 +24,6 @@<string name="lyrics_card_title" formatted="false">الكلمات</string><string name="lyrics_card_title_preview" formatted="false">معاينة الكلمات</string><string name="lyrics_card_show_lyrics_button" formatted="false">عرض الكلمات</string>- <string name="lyrics_card_expand_button_content_description" formatted="false">فتح الكلمات بملء الشاشة</string>- <string name="lyrics_card_share_button_content_description" formatted="false">مشاركة الكلمات</string><string name="lyrics_credential_note" formatted="false">الكلمات مقدمة من %1$s</string><string name="lyrics_fullscreen_chip_label_share" formatted="false">مشاركة</string><string name="lyrics_fullscreen_chip_label_translate" formatted="false">ترجمة</string>@@ -49,7 +46,6 @@<string name="artist_popular_tracks" formatted="false">محتوى مشهور</string><string name="curation_button_follow_state_text" formatted="false">متابعة</string><string name="curation_button_following_state_text" formatted="false">المحتوى الي تتابعه</string>- <string name="search_main_entity_subtitle_artist" formatted="false">فنان</string><string name="connect_phone_is_self" formatted="false">هذا التليفون</string><string name="settings_item_canvas_title" formatted="false">Canvas</string><string name="video_settings_canvas_subtitle" formatted="false">مؤثرات مرئية قصيرة تكرر نفسها مع تشغيل الأغاني.</string>@@ -106,8 +102,6 @@<string name="library_search_text_hint" formatted="false">ابحث في \"مكتبتك الموسيقية\"</string><string name="account_title" formatted="false">الحساب</string><string name="song_dna_search_chip_followed_artists" formatted="false">الفنانين اللي تتابعهم</string>- <string name="settings_item_crossfade_title" formatted="false">مزج الأغاني</string>- <string name="playback_settings_crossfade_slider_seconds" formatted="false">%1$d ث</string><string name="local_files_title" formatted="false">الملفات</string><string name="local_files_empty_section_title" formatted="false">إضافة الملفات الصوتية حقتك إلى مكتبتك الموسيقية</string><string name="local_files_empty_section_subtitle" formatted="false">عندك أغنية أو بودكاست شخصي مو متوفر على Spotify؟</string>@@ -137,14 +131,10 @@<string name="assisted_curation_search_filter_artists" formatted="false">الفنانين</string><string name="assisted_curation_search_filter_albums" formatted="false">الألبومات</string><string name="assisted_curation_search_filter_playlists" formatted="false">قوائم الأغاني</string>- <string name="assisted_curation_search_filter_clear_content_description" formatted="false">مسح التصنيف</string>- <string name="ad_category_title_music" formatted="false">الموسيقى</string>- <string name="made_for_you_hub_title" formatted="false">مُصممة علشانك</string><string name="settings_item_app_language_title" formatted="false">لغة التطبيق</string><string name="create_menu_item_folder_title" formatted="false">المجلد</string><string name="create_folder_name_suggested_folder_name" formatted="false">مجلد جديد</string><string name="context_menu_rename_folder" formatted="false">إعادة تسمية المجلد</string>- <string name="your_library_messaging_folder_rename_hint" formatted="false">اسم المجلد</string><string name="create_playlist_content_description" formatted="false">إنشاء قائمة أغاني</string><string name="actions_picker_delete" formatted="false">حذف</string><string name="filter_and_sort_sort_section_title" formatted="false">تصنيف على حسب</string>diff --git a/base/app/src/main/res/values-ar/spotify_strings.xml b/base/app/src/main/res/values-ar/spotify_strings.xmlindex 20623795..39ca5462 100644--- a/base/app/src/main/res/values-ar/spotify_strings.xml+++ b/base/app/src/main/res/values-ar/spotify_strings.xml@@ -17,7 +17,6 @@<string name="snackbar_added_to_liked_songs" formatted="false">تمت الإضافة إلى قائمة \"أغانٍ أعجبتني\".</string><string name="snackbar_removed_from_liked_songs" formatted="false">تم الحذف من \"أغانٍ أعجبتني\"</string><string name="content_description_context_menu" formatted="false">خيارات إضافية</string>- <string name="close_button_content_description" formatted="false">إغلاق</string><string name="add_to_playlist_saved_in_section_header" formatted="false">تم الحفظ في</string><string name="add_to_playlist_new_playlist_button_text" formatted="false">قائمة للأغاني الجديدة</string><string name="add_to_playlist_button_cancel" formatted="false">إلغاء</string>@@ -25,8 +24,6 @@<string name="lyrics_card_title" formatted="false">كلمات الأغنية</string><string name="lyrics_card_title_preview" formatted="false">معاينة الكلمات</string><string name="lyrics_card_show_lyrics_button" formatted="false">عرض الكلمات</string>- <string name="lyrics_card_expand_button_content_description" formatted="false">عرض الكلمات بملء الشاشة</string>- <string name="lyrics_card_share_button_content_description" formatted="false">مشاركة كلمات الأغنية</string><string name="lyrics_credential_note" formatted="false">تم توفير الكلمات من قبل: %1$s</string><string name="lyrics_fullscreen_chip_label_share" formatted="false">مشاركة</string><string name="lyrics_fullscreen_chip_label_translate" formatted="false">ترجمة</string>@@ -49,7 +46,6 @@<string name="artist_popular_tracks" formatted="false">الأغاني الشعبية</string><string name="curation_button_follow_state_text" formatted="false">متابعة</string><string name="curation_button_following_state_text" formatted="false">تتم المتابعة</string>- <string name="search_main_entity_subtitle_artist" formatted="false">الفنان</string><string name="connect_phone_is_self" formatted="false">هذا الهاتف</string><string name="settings_item_canvas_title" formatted="false">Canvas</string><string name="video_settings_canvas_subtitle" formatted="false">مؤثِّرات بصرية قصيرة متكرِّرة تُعرض عند الاستماع إلى أغنية.</string>@@ -107,8 +103,6 @@<string name="library_search_text_hint" formatted="false">ابحث في مكتبتك الموسيقية</string><string name="account_title" formatted="false">حساب</string><string name="song_dna_search_chip_followed_artists" formatted="false">الفنانون الذين تابعتهم</string>- <string name="settings_item_crossfade_title" formatted="false">مزج الأغاني</string>- <string name="playback_settings_crossfade_slider_seconds" formatted="false">%1$d ثانية</string><string name="local_files_title" formatted="false">الملفات</string><string name="local_files_empty_section_title" formatted="false">إضافة ملفاتك الصوتية إلى \"مكتبتك الموسيقية\"</string><string name="local_files_empty_section_subtitle" formatted="false">هل لديك أغنية أو بودكاست شخصي غير متوفر على Spotify؟</string>@@ -138,14 +132,10 @@<string name="assisted_curation_search_filter_artists" formatted="false">الفنانون</string><string name="assisted_curation_search_filter_albums" formatted="false">الألبومات</string><string name="assisted_curation_search_filter_playlists" formatted="false">قوائم الأغاني</string>- <string name="assisted_curation_search_filter_clear_content_description" formatted="false">مسح الفلتر</string>- <string name="ad_category_title_music" formatted="false">الموسيقى</string>- <string name="made_for_you_hub_title" formatted="false">مُصممة من أجلك</string><string name="settings_item_app_language_title" formatted="false">لغة التطبيق</string><string name="create_menu_item_folder_title" formatted="false">المجلد</string><string name="create_folder_name_suggested_folder_name" formatted="false">مجلد جديد</string><string name="context_menu_rename_folder" formatted="false">إعادة تسمية المجلد</string>- <string name="your_library_messaging_folder_rename_hint" formatted="false">اسم المُجلّد</string><string name="create_playlist_content_description" formatted="false">إنشاء قائمة الأغاني</string><string name="actions_picker_delete" formatted="false">حذف</string><string name="filter_and_sort_sort_section_title" formatted="false">ترتيب حسب</string>diff --git a/base/app/src/main/res/values-az/spotify_strings.xml b/base/app/src/main/res/values-az/spotify_strings.xmlindex c477fe47..3feb6b49 100644--- a/base/app/src/main/res/values-az/spotify_strings.xml+++ b/base/app/src/main/res/values-az/spotify_strings.xml@@ -17,7 +17,6 @@<string name="snackbar_added_to_liked_songs" formatted="false">Bəyənilən Mahnılara əlavə edildi.</string><string name="snackbar_removed_from_liked_songs" formatted="false">Bəyənilən mahnılardan silindi.</string><string name="content_description_context_menu" formatted="false">Daha çox seçim</string>- <string name="close_button_content_description" formatted="false">Bağla</string><string name="add_to_playlist_saved_in_section_header" formatted="false">Burada saxlanılıb</string><string name="add_to_playlist_new_playlist_button_text" formatted="false">Yeni pleylist</string><string name="add_to_playlist_button_cancel" formatted="false">Ləğv et</string>@@ -25,8 +24,6 @@<string name="lyrics_card_title" formatted="false">Sözlər</string><string name="lyrics_card_title_preview" formatted="false">Mahnı sözlərinə baxış</string><string name="lyrics_card_show_lyrics_button" formatted="false">Mahnı sözlərini göstər</string>- <string name="lyrics_card_expand_button_content_description" formatted="false">Mahnı sözlərini tam ekranda aç</string>- <string name="lyrics_card_share_button_content_description" formatted="false">Mahnı sözlərini paylaş</string><string name="lyrics_credential_note" formatted="false">%1$s tərəfindən təqdim olunan mahnı sözləri</string><string name="lyrics_fullscreen_chip_label_share" formatted="false">Paylaş</string><string name="lyrics_fullscreen_chip_label_translate" formatted="false">Tərcümə et</string>@@ -49,7 +46,6 @@<string name="artist_popular_tracks" formatted="false">Populyar</string><string name="curation_button_follow_state_text" formatted="false">İzlə</string><string name="curation_button_following_state_text" formatted="false">İzlənilən</string>- <string name="search_main_entity_subtitle_artist" formatted="false">İfaçı</string><string name="connect_phone_is_self" formatted="false">Bu telefon</string><string name="settings_item_canvas_title" formatted="false">Canvas</string><string name="video_settings_canvas_subtitle" formatted="false">Mahnı oxudularkən qısa, təkrarlanan vizuallar.</string>@@ -107,8 +103,6 @@<string name="library_search_text_hint" formatted="false">Kitabxananı axtar</string><string name="account_title" formatted="false">Hesab</string><string name="song_dna_search_chip_followed_artists" formatted="false">İzlənilən ifaçılar</string>- <string name="settings_item_crossfade_title" formatted="false">Çarpaz keçid</string>- <string name="playback_settings_crossfade_slider_seconds" formatted="false">%1$d san</string><string name="local_files_title" formatted="false">Lokal Fayllar</string><string name="local_files_empty_section_title" formatted="false">Öz audiofayllarınızı Kitabxana bölməsinə əlavə edin</string><string name="local_files_empty_section_subtitle" formatted="false">Spotify-da olmayan mahnı və ya şəxsi podkastınız var?</string>@@ -138,14 +132,10 @@<string name="assisted_curation_search_filter_artists" formatted="false">İfaçılar</string><string name="assisted_curation_search_filter_albums" formatted="false">Albomlar</string><string name="assisted_curation_search_filter_playlists" formatted="false">Pleylistlər</string>- <string name="assisted_curation_search_filter_clear_content_description" formatted="false">Filtri təmizlə</string>- <string name="ad_category_title_music" formatted="false">Musiqi</string>- <string name="made_for_you_hub_title" formatted="false">Sənin üçün Hazırlanıb</string><string name="settings_item_app_language_title" formatted="false">Tətbiqin dili</string><string name="create_menu_item_folder_title" formatted="false">Qovluq</string><string name="create_folder_name_suggested_folder_name" formatted="false">Yeni qovluq</string><string name="context_menu_rename_folder" formatted="false">Qovluğun adını dəyiş</string>- <string name="your_library_messaging_folder_rename_hint" formatted="false">Qovluq adı</string><string name="create_playlist_content_description" formatted="false">Pleylist yarat</string><string name="actions_picker_delete" formatted="false">Sil</string><string name="filter_and_sort_sort_section_title" formatted="false">Çeşidlə:</string>diff --git a/base/app/src/main/res/values-bg/spotify_strings.xml b/base/app/src/main/res/values-bg/spotify_strings.xmlindex e4f9b2c3..9da12ac0 100644--- a/base/app/src/main/res/values-bg/spotify_strings.xml+++ b/base/app/src/main/res/values-bg/spotify_strings.xml@@ -17,7 +17,6 @@<string name="snackbar_added_to_liked_songs" formatted="false">Добавено в „Харесани песни“.</string><string name="snackbar_removed_from_liked_songs" formatted="false">Премахнато от „Харесани песни“.</string><string name="content_description_context_menu" formatted="false">Още опции</string>- <string name="close_button_content_description" formatted="false">Затваряне</string><string name="add_to_playlist_saved_in_section_header" formatted="false">Запазено в</string><string name="add_to_playlist_new_playlist_button_text" formatted="false">Нов плейлист</string><string name="add_to_playlist_button_cancel" formatted="false">Отмяна</string>@@ -25,8 +24,6 @@<string name="lyrics_card_title" formatted="false">Текст</string><string name="lyrics_card_title_preview" formatted="false">Преглед на текста</string><string name="lyrics_card_show_lyrics_button" formatted="false">Покажете текста</string>- <string name="lyrics_card_expand_button_content_description" formatted="false">Отворете текста на цял екран</string>- <string name="lyrics_card_share_button_content_description" formatted="false">Споделете текста</string><string name="lyrics_credential_note" formatted="false">Текст, предоставен от %1$s</string><string name="lyrics_fullscreen_chip_label_share" formatted="false">Споделете</string><string name="lyrics_fullscreen_chip_label_translate" formatted="false">Превод</string>@@ -49,7 +46,6 @@<string name="artist_popular_tracks" formatted="false">Популярни</string><string name="curation_button_follow_state_text" formatted="false">Последвайте</string><string name="curation_button_following_state_text" formatted="false">Следвате</string>- <string name="search_main_entity_subtitle_artist" formatted="false">Изпълнител</string><string name="connect_phone_is_self" formatted="false">Този телефон</string><string name="settings_item_canvas_title" formatted="false">Canvas</string><string name="video_settings_canvas_subtitle" formatted="false">Кратки, повтарящи се визуализации по време на възпроизвеждане на песен.</string>@@ -107,8 +103,6 @@<string name="library_search_text_hint" formatted="false">Търсете във „Вашата библиотека“</string><string name="account_title" formatted="false">Акаунт</string><string name="song_dna_search_chip_followed_artists" formatted="false">Последвани изпълнители</string>- <string name="settings_item_crossfade_title" formatted="false">Плавен преход</string>- <string name="playback_settings_crossfade_slider_seconds" formatted="false">%1$d сек</string><string name="local_files_title" formatted="false">Локални файлове</string><string name="local_files_empty_section_title" formatted="false">Добавете свои собствени аудиофайлове към „Вашата библиотека“</string><string name="local_files_empty_section_subtitle" formatted="false">Имате песен или личен подкаст, които не са в Spotify?</string>@@ -138,14 +132,10 @@<string name="assisted_curation_search_filter_artists" formatted="false">Изпълнители</string><string name="assisted_curation_search_filter_albums" formatted="false">Албуми</string><string name="assisted_curation_search_filter_playlists" formatted="false">Плейлисти</string>- <string name="assisted_curation_search_filter_clear_content_description" formatted="false">Изчистете филтъра</string>- <string name="ad_category_title_music" formatted="false">Музика</string>- <string name="made_for_you_hub_title" formatted="false">Подбрано за вас</string><string name="settings_item_app_language_title" formatted="false">Език на приложението</string><string name="create_menu_item_folder_title" formatted="false">Папка</string><string name="create_folder_name_suggested_folder_name" formatted="false">Нова папка</string><string name="context_menu_rename_folder" formatted="false">Преименувайте папката</string>- <string name="your_library_messaging_folder_rename_hint" formatted="false">Име на папката</string><string name="create_playlist_content_description" formatted="false">Създайте плейлист</string><string name="actions_picker_delete" formatted="false">Изтрийте</string><string name="filter_and_sort_sort_section_title" formatted="false">Сортирайте по</string>diff --git a/base/app/src/main/res/values-bn/spotify_strings.xml b/base/app/src/main/res/values-bn/spotify_strings.xmlindex b9ceefc5..d2bbfac9 100644--- a/base/app/src/main/res/values-bn/spotify_strings.xml+++ b/base/app/src/main/res/values-bn/spotify_strings.xml@@ -17,7 +17,6 @@<string name="snackbar_added_to_liked_songs" formatted="false">পছন্দ করা গানগুলিতে যোগ করা হয়েছে।</string><string name="snackbar_removed_from_liked_songs" formatted="false">পছন্দসই গানগুলি থেকে সরানো হয়েছে।</string><string name="content_description_context_menu" formatted="false">আরও বিকল্প</string>- <string name="close_button_content_description" formatted="false">বন্ধ করুন</string><string name="add_to_playlist_saved_in_section_header" formatted="false">এখানে সেভ করা হয়েছে</string><string name="add_to_playlist_new_playlist_button_text" formatted="false">নতুন প্লেলিস্ট</string><string name="add_to_playlist_button_cancel" formatted="false">বাতিল করুন</string>@@ -25,8 +24,6 @@<string name="lyrics_card_title" formatted="false">লিরিক্স</string><string name="lyrics_card_title_preview" formatted="false">লিরিক্সের প্রিভিউ</string><string name="lyrics_card_show_lyrics_button" formatted="false">লিরিক্স দেখান</string>- <string name="lyrics_card_expand_button_content_description" formatted="false">সম্পূর্ণ স্ক্রিন সহ লিরিক্স খোলে</string>- <string name="lyrics_card_share_button_content_description" formatted="false">লিরিক্স শেয়ার করুন</string><string name="lyrics_credential_note" formatted="false">লিরিক্স %1$s দ্বারা সরবরাহ করা</string><string name="lyrics_fullscreen_chip_label_share" formatted="false">শেয়ার করুন</string><string name="lyrics_fullscreen_chip_label_translate" formatted="false">অনুবাদ করুন</string>@@ -49,7 +46,6 @@<string name="artist_popular_tracks" formatted="false">জনপ্রিয়</string><string name="curation_button_follow_state_text" formatted="false">ফলো করুন</string><string name="curation_button_following_state_text" formatted="false">ফলো করছেন</string>- <string name="search_main_entity_subtitle_artist" formatted="false">শিল্পী</string><string name="connect_phone_is_self" formatted="false">এই ফোনে</string><string name="settings_item_canvas_title" formatted="false">Canvas</string><string name="video_settings_canvas_subtitle" formatted="false">কোনও গান চলাকালীন ছোট, লুপিং ভিজ্যুয়াল।</string>@@ -107,8 +103,6 @@<string name="library_search_text_hint" formatted="false">আপনার লাইব্রেরিতে অনুসন্ধান করুন</string><string name="account_title" formatted="false">অ্যাকাউন্ট</string><string name="song_dna_search_chip_followed_artists" formatted="false">শিল্পীকে ফলো করা হয়েছে</string>- <string name="settings_item_crossfade_title" formatted="false">পর পর চালান</string>- <string name="playback_settings_crossfade_slider_seconds" formatted="false">%1$d সেকেন্ড</string><string name="local_files_title" formatted="false">লোকাল ফাইল</string><string name="local_files_empty_section_title" formatted="false">আপনার নিজের অডিও ফাইল \'আপনার লাইব্রেরি\'-তে যোগ করুন</string><string name="local_files_empty_section_subtitle" formatted="false">এমন কোনও গান বা ব্যক্তিগত পডকাস্ট আছে যা Spotify-তে নেই?</string>@@ -138,14 +132,10 @@<string name="assisted_curation_search_filter_artists" formatted="false">শিল্পী</string><string name="assisted_curation_search_filter_albums" formatted="false">অ্যালবাম</string><string name="assisted_curation_search_filter_playlists" formatted="false">প্লেলিস্ট</string>- <string name="assisted_curation_search_filter_clear_content_description" formatted="false">ফিল্টার মুছে দিন</string>- <string name="ad_category_title_music" formatted="false">মিউজিক</string>- <string name="made_for_you_hub_title" formatted="false">আপনার জন্য তৈরি</string><string name="settings_item_app_language_title" formatted="false">অ্যাপের ভাষা</string><string name="create_menu_item_folder_title" formatted="false">ফোল্ডার</string><string name="create_folder_name_suggested_folder_name" formatted="false">নতুন ফোল্ডার</string><string name="context_menu_rename_folder" formatted="false">ফোল্ডারের নতুন নাম দিন</string>- <string name="your_library_messaging_folder_rename_hint" formatted="false">ফোল্ডারের নাম</string><string name="create_playlist_content_description" formatted="false">প্লেলিস্ট তৈরি করুন</string><string name="actions_picker_delete" formatted="false">মুছে ফেলুন</string><string name="filter_and_sort_sort_section_title" formatted="false">ক্রমানুসারে</string>diff --git a/base/app/src/main/res/values-bs/spotify_strings.xml b/base/app/src/main/res/values-bs/spotify_strings.xmlindex 8f9196c4..6e95f9ea 100644--- a/base/app/src/main/res/values-bs/spotify_strings.xml+++ b/base/app/src/main/res/values-bs/spotify_strings.xml@@ -17,7 +17,6 @@<string name="snackbar_added_to_liked_songs" formatted="false">Dodano u pjesme označene sa \"Sviđa mi se\".</string><string name="snackbar_removed_from_liked_songs" formatted="false">Uklonjeno iz pjesama označenih sa \"Sviđa mi se\".</string><string name="content_description_context_menu" formatted="false">Više opcija</string>- <string name="close_button_content_description" formatted="false">Zatvaranje</string><string name="add_to_playlist_saved_in_section_header" formatted="false">Sačuvano u odjeljku</string><string name="add_to_playlist_new_playlist_button_text" formatted="false">Nova plejlista</string><string name="add_to_playlist_button_cancel" formatted="false">Otkaži</string>@@ -25,8 +24,6 @@<string name="lyrics_card_title" formatted="false">Tekst pjesme</string><string name="lyrics_card_title_preview" formatted="false">Pregled teksta pjesme</string><string name="lyrics_card_show_lyrics_button" formatted="false">Prikaži tekst pjesme</string>- <string name="lyrics_card_expand_button_content_description" formatted="false">Otvaranje teksta pjesme preko cijelog ekrana</string>- <string name="lyrics_card_share_button_content_description" formatted="false">Dijeljenje teksta pjesme</string><string name="lyrics_credential_note" formatted="false">Tekst pjesme pruža: %1$s</string><string name="lyrics_fullscreen_chip_label_share" formatted="false">Podijeli</string><string name="lyrics_fullscreen_chip_label_translate" formatted="false">Prevedi</string>@@ -49,7 +46,6 @@<string name="artist_popular_tracks" formatted="false">Popularno</string><string name="curation_button_follow_state_text" formatted="false">Pratite</string><string name="curation_button_following_state_text" formatted="false">Već pratite</string>- <string name="search_main_entity_subtitle_artist" formatted="false">Izvođač</string><string name="connect_phone_is_self" formatted="false">Ovaj telefon</string><string name="settings_item_canvas_title" formatted="false">Canvas</string><string name="video_settings_canvas_subtitle" formatted="false">Kratki, ponavljajući vizuelni elementi kada se pjesma reproducira.</string>@@ -107,8 +103,6 @@<string name="library_search_text_hint" formatted="false">Pretraživanje Vaše biblioteke</string><string name="account_title" formatted="false">Račun</string><string name="song_dna_search_chip_followed_artists" formatted="false">Praćeni izvođači</string>- <string name="settings_item_crossfade_title" formatted="false">Unakrsno utišavanje i pojačavanje</string>- <string name="playback_settings_crossfade_slider_seconds" formatted="false">%1$d s</string><string name="local_files_title" formatted="false">Lokalni fajovi</string><string name="local_files_empty_section_title" formatted="false">Dodajte audio fajlove u odjeljak Vaša biblioteka</string><string name="local_files_empty_section_subtitle" formatted="false">Imate pjesmu ili lični podcast koji nisu na Spotifyu?</string>@@ -138,14 +132,10 @@<string name="assisted_curation_search_filter_artists" formatted="false">Izvođači</string><string name="assisted_curation_search_filter_albums" formatted="false">Albumi</string><string name="assisted_curation_search_filter_playlists" formatted="false">Plejliste</string>- <string name="assisted_curation_search_filter_clear_content_description" formatted="false">Brisanje filtera</string>- <string name="ad_category_title_music" formatted="false">Muzika</string>- <string name="made_for_you_hub_title" formatted="false">Napravljeno za vas</string><string name="settings_item_app_language_title" formatted="false">Jezik aplikacije</string><string name="create_menu_item_folder_title" formatted="false">Folder</string><string name="create_folder_name_suggested_folder_name" formatted="false">Novi folder</string><string name="context_menu_rename_folder" formatted="false">Preimenovanje foldera</string>- <string name="your_library_messaging_folder_rename_hint" formatted="false">Naziv foldera</string><string name="create_playlist_content_description" formatted="false">Kreiranje plejliste</string><string name="actions_picker_delete" formatted="false">Izbriši</string><string name="filter_and_sort_sort_section_title" formatted="false">Sortiraj prema</string>diff --git a/base/app/src/main/res/values-ca/spotify_strings.xml b/base/app/src/main/res/values-ca/spotify_strings.xmlindex 3a48edce..95723396 100644--- a/base/app/src/main/res/values-ca/spotify_strings.xml+++ b/base/app/src/main/res/values-ca/spotify_strings.xml@@ -15,7 +15,6 @@<string name="snackbar_added_to_liked_songs" formatted="false">S\'ha afegit a Cançons que m\'agraden.</string><string name="snackbar_removed_from_liked_songs" formatted="false">S\'ha tret de Cançons que m\'agraden.</string><string name="content_description_context_menu" formatted="false">Més opcions</string>- <string name="close_button_content_description" formatted="false">Tanca</string><string name="add_to_playlist_saved_in_section_header" formatted="false">Desat a</string><string name="add_to_playlist_new_playlist_button_text" formatted="false">Nova llista</string><string name="add_to_playlist_button_cancel" formatted="false">Cancel·la</string>@@ -23,8 +22,6 @@<string name="lyrics_card_title" formatted="false">Lletra</string><string name="lyrics_card_title_preview" formatted="false">Previsualització de la lletra</string><string name="lyrics_card_show_lyrics_button" formatted="false">Mostra la lletra</string>- <string name="lyrics_card_expand_button_content_description" formatted="false">Obre la lletra a pantalla completa</string>- <string name="lyrics_card_share_button_content_description" formatted="false">Comparteix les lletres</string><string name="lyrics_credential_note" formatted="false">Lletra proporcionada per %1$s</string><string name="lyrics_fullscreen_chip_label_share" formatted="false">Comparteix</string><string name="lyrics_fullscreen_chip_label_translate" formatted="false">Tradueix</string>@@ -47,7 +44,6 @@<string name="artist_popular_tracks" formatted="false">Popular</string><string name="curation_button_follow_state_text" formatted="false">Segueix</string><string name="curation_button_following_state_text" formatted="false">Seguint</string>- <string name="search_main_entity_subtitle_artist" formatted="false">Artista</string><string name="connect_phone_is_self" formatted="false">Aquest telèfon</string><string name="settings_item_canvas_title" formatted="false">Canvas</string><string name="video_settings_canvas_subtitle" formatted="false">Elements visuals curts i en bucle mentre sona una cançó.</string>@@ -105,8 +101,6 @@<string name="library_search_text_hint" formatted="false">Cerca a La teva biblioteca</string><string name="account_title" formatted="false">Compte</string><string name="song_dna_search_chip_followed_artists" formatted="false">Artistes que segueixes</string>- <string name="settings_item_crossfade_title" formatted="false">Fosa encadenada</string>- <string name="playback_settings_crossfade_slider_seconds" formatted="false">%1$d s</string><string name="local_files_empty_section_title" formatted="false">Afegeix els teus propis fitxers d\'àudio a La teva biblioteca</string><string name="local_files_empty_section_subtitle" formatted="false">Tens una cançó o un pòdcast personal que no és a Spotify?</string><string name="local_files_empty_section_no_files_title" formatted="false">Els teus fitxers d\'àudio es mostraran aquí</string>@@ -135,14 +129,10 @@<string name="assisted_curation_search_filter_artists" formatted="false">Artistes</string><string name="assisted_curation_search_filter_albums" formatted="false">Àlbums</string><string name="assisted_curation_search_filter_playlists" formatted="false">Llistes</string>- <string name="assisted_curation_search_filter_clear_content_description" formatted="false">Esborra el filtre</string>- <string name="ad_category_title_music" formatted="false">Música</string>- <string name="made_for_you_hub_title" formatted="false">Especialment per a tu</string><string name="settings_item_app_language_title" formatted="false">Idioma de l\'aplicació</string><string name="create_menu_item_folder_title" formatted="false">Carpeta</string><string name="create_folder_name_suggested_folder_name" formatted="false">Carpeta nova</string><string name="context_menu_rename_folder" formatted="false">Canvia el nom de la carpeta</string>- <string name="your_library_messaging_folder_rename_hint" formatted="false">Nom de la carpeta</string><string name="create_playlist_content_description" formatted="false">Crea una llista</string><string name="actions_picker_delete" formatted="false">Suprimeix</string><string name="filter_and_sort_sort_section_title" formatted="false">Ordena per</string>diff --git a/base/app/src/main/res/values-cs/spotify_strings.xml b/base/app/src/main/res/values-cs/spotify_strings.xmlindex e4bcde6c..bc8fa8b5 100644--- a/base/app/src/main/res/values-cs/spotify_strings.xml+++ b/base/app/src/main/res/values-cs/spotify_strings.xml@@ -17,7 +17,6 @@<string name="snackbar_added_to_liked_songs" formatted="false">Přidáno ke skladbám, které se ti líbí.</string><string name="snackbar_removed_from_liked_songs" formatted="false">Odstraněno ze sbírky Skladby, které se ti líbí.</string><string name="content_description_context_menu" formatted="false">Více možností</string>- <string name="close_button_content_description" formatted="false">Zavřít</string><string name="add_to_playlist_saved_in_section_header" formatted="false">Uloženo v </string><string name="add_to_playlist_new_playlist_button_text" formatted="false">Nový playlist</string><string name="add_to_playlist_button_cancel" formatted="false">Zrušit</string>@@ -25,8 +24,6 @@<string name="lyrics_card_title" formatted="false">Text skladby</string><string name="lyrics_card_title_preview" formatted="false">Náhled textu</string><string name="lyrics_card_show_lyrics_button" formatted="false">Zobrazit text</string>- <string name="lyrics_card_expand_button_content_description" formatted="false">Otevřít text na celou obrazovku</string>- <string name="lyrics_card_share_button_content_description" formatted="false">Sdílej text skladby</string><string name="lyrics_credential_note" formatted="false">Text ti přináší %1$s</string><string name="lyrics_fullscreen_chip_label_share" formatted="false">Sdílet</string><string name="lyrics_fullscreen_chip_label_translate" formatted="false">Přeložit</string>@@ -49,7 +46,6 @@<string name="artist_popular_tracks" formatted="false">Oblíbené</string><string name="curation_button_follow_state_text" formatted="false">Sledovat</string><string name="curation_button_following_state_text" formatted="false">Sleduješ</string>- <string name="search_main_entity_subtitle_artist" formatted="false">Umělec</string><string name="connect_phone_is_self" formatted="false">Tento telefon</string><string name="settings_item_canvas_title" formatted="false">Canvas</string><string name="video_settings_canvas_subtitle" formatted="false">Krátké videosmyčky při přehrávání skladby.</string>@@ -107,8 +103,6 @@<string name="library_search_text_hint" formatted="false">Hledat ve sbírce Tvoje knihovna</string><string name="account_title" formatted="false">Účet</string><string name="song_dna_search_chip_followed_artists" formatted="false">Sledovaní umělci</string>- <string name="settings_item_crossfade_title" formatted="false">Prolínání</string>- <string name="playback_settings_crossfade_slider_seconds" formatted="false">%1$d s</string><string name="local_files_title" formatted="false">Místní soubory</string><string name="local_files_empty_section_title" formatted="false">Přidej si do sbírky Tvoje knihovna vlastní zvukové soubory</string><string name="local_files_empty_section_subtitle" formatted="false">Máš skladbu nebo osobní podcast, které nejsou ve Spotify?</string>@@ -138,14 +132,10 @@<string name="assisted_curation_search_filter_artists" formatted="false">Umělci</string><string name="assisted_curation_search_filter_albums" formatted="false">Alba</string><string name="assisted_curation_search_filter_playlists" formatted="false">Playlisty</string>- <string name="assisted_curation_search_filter_clear_content_description" formatted="false">Vymazat filtr</string>- <string name="ad_category_title_music" formatted="false">Hudba</string>- <string name="made_for_you_hub_title" formatted="false">Vytvořeno pro tebe</string><string name="settings_item_app_language_title" formatted="false">Jazyk aplikace</string><string name="create_menu_item_folder_title" formatted="false">Složka</string><string name="create_folder_name_suggested_folder_name" formatted="false">Nová složka</string><string name="context_menu_rename_folder" formatted="false">Přejmenovat složku</string>- <string name="your_library_messaging_folder_rename_hint" formatted="false">Název složky</string><string name="create_playlist_content_description" formatted="false">Vytvořit playlist</string><string name="actions_picker_delete" formatted="false">Smazat</string><string name="filter_and_sort_sort_section_title" formatted="false">Řadit podle</string>diff --git a/base/app/src/main/res/values-da/spotify_strings.xml b/base/app/src/main/res/values-da/spotify_strings.xmlindex c1e2aa74..a5230b04 100644--- a/base/app/src/main/res/values-da/spotify_strings.xml+++ b/base/app/src/main/res/values-da/spotify_strings.xml@@ -17,7 +17,6 @@<string name="snackbar_added_to_liked_songs" formatted="false">Tilføjet til Sange, du synes godt om.</string><string name="snackbar_removed_from_liked_songs" formatted="false">Fjernet fra Sange, du synes godt om.</string><string name="content_description_context_menu" formatted="false">Flere indstillinger</string>- <string name="close_button_content_description" formatted="false">Luk</string><string name="add_to_playlist_saved_in_section_header" formatted="false">Gemt i</string><string name="add_to_playlist_new_playlist_button_text" formatted="false">Ny playliste</string><string name="add_to_playlist_button_cancel" formatted="false">Annuller</string>@@ -25,8 +24,6 @@<string name="lyrics_card_title" formatted="false">Sangtekster</string><string name="lyrics_card_title_preview" formatted="false">Forsmag på sangtekst</string><string name="lyrics_card_show_lyrics_button" formatted="false">Vis sangteksten</string>- <string name="lyrics_card_expand_button_content_description" formatted="false">Åbn sangteksten i fuld skærm</string>- <string name="lyrics_card_share_button_content_description" formatted="false">Del sangtekster</string><string name="lyrics_credential_note" formatted="false">Sangtekster leveret af %1$s</string><string name="lyrics_fullscreen_chip_label_share" formatted="false">Del</string><string name="lyrics_fullscreen_chip_label_translate" formatted="false">Oversæt</string>@@ -49,7 +46,6 @@<string name="artist_popular_tracks" formatted="false">Populær</string><string name="curation_button_follow_state_text" formatted="false">Følg</string><string name="curation_button_following_state_text" formatted="false">Følger</string>- <string name="search_main_entity_subtitle_artist" formatted="false">Kunstner</string><string name="connect_phone_is_self" formatted="false">Denne telefon</string><string name="settings_item_canvas_title" formatted="false">Canvas</string><string name="video_settings_canvas_subtitle" formatted="false">Korte, visuelle effekter, der vises, når en sang afspilles.</string>@@ -107,8 +103,6 @@<string name="library_search_text_hint" formatted="false">Søg i Dit bibliotek</string><string name="account_title" formatted="false">Konto</string><string name="song_dna_search_chip_followed_artists" formatted="false">Kunstnere, du følger</string>- <string name="settings_item_crossfade_title" formatted="false">Crossfade</string>- <string name="playback_settings_crossfade_slider_seconds" formatted="false">%1$d sek.</string><string name="local_files_title" formatted="false">Lokale filer</string><string name="local_files_empty_section_title" formatted="false">Føj dine egne lydfiler til Dit bibliotek</string><string name="local_files_empty_section_subtitle" formatted="false">Har du en sang eller personlig podcast, som ikke er tilgængelig på Spotify?</string>@@ -138,14 +132,10 @@<string name="assisted_curation_search_filter_artists" formatted="false">Kunstnere</string><string name="assisted_curation_search_filter_albums" formatted="false">Album</string><string name="assisted_curation_search_filter_playlists" formatted="false">Playlister</string>- <string name="assisted_curation_search_filter_clear_content_description" formatted="false">Ryd filteret</string>- <string name="ad_category_title_music" formatted="false">Musik</string>- <string name="made_for_you_hub_title" formatted="false">Specielt til dig</string><string name="settings_item_app_language_title" formatted="false">Appens sprog</string><string name="create_menu_item_folder_title" formatted="false">Mappe</string><string name="create_folder_name_suggested_folder_name" formatted="false">Ny mappe</string><string name="context_menu_rename_folder" formatted="false">Omdøb mappe</string>- <string name="your_library_messaging_folder_rename_hint" formatted="false">Mappenavn</string><string name="create_playlist_content_description" formatted="false">Opret playliste</string><string name="actions_picker_delete" formatted="false">Slet</string><string name="filter_and_sort_sort_section_title" formatted="false">Sortér efter</string>diff --git a/base/app/src/main/res/values-de/extensions_strings.xml b/base/app/src/main/res/values-de/extensions_strings.xmlnew file mode 100644index 00000000..28783bdb--- /dev/null+++ b/base/app/src/main/res/values-de/extensions_strings.xml@@ -0,0 +1,211 @@+<?xml version="1.0" encoding="utf-8"?>+<resources>+ <string name="extensions_title">Erweiterungen</string>+ <string name="extensions_row_detail">Songtexte, die Audioquelle eines Titels und Skripte von anderen, in einer Sandbox.</string>+ <string name="extensions_install_file">Aus einer Datei installieren</string>+ <string name="extensions_install_url">Von einer Adresse installieren</string>+ <string name="extensions_url_hint">https://…/extension.zip</string>+ <string name="extensions_none">Keine Erweiterung installiert.</string>+ <string name="extensions_installed">Installiert</string>+ <string name="extensions_repository_add">Repository hinzufügen</string>+ <string name="extensions_repository_hint">https://…/index.json</string>+ <string name="extensions_repository_warning">Myspoti prüft kein Repository, das du hinzufügst: Was du daraus installierst, geschieht auf eigenes Risiko.</string>+ <string name="extensions_repository_remove">Entfernen</string>+ <string name="extensions_repository_refresh">Aktualisieren</string>+ <string name="extensions_install">Installieren</string>+ <string name="extensions_update">Aktualisieren</string>+ <string name="extensions_up_to_date">Installiert</string>+ <string name="extensions_cancel">Abbrechen</string>+ <string name="extensions_loading">Wird gelesen…</string>+ <string name="extensions_error">Nicht installiert: %1$s</string>+ <string name="extensions_prompt_title_install">%1$s installieren?</string>+ <string name="extensions_prompt_title_update">%1$s aktualisieren?</string>+ <string name="extensions_prompt_by">%1$s · Version %2$s · %3$s</string>+ <string name="extensions_prompt_source">Von %1$s</string>+ <string name="extensions_prompt_source_file">eine Datei auf diesem Telefon</string>+ <string name="extensions_prompt_new">neu in dieser Version</string>+ <string name="extensions_prompt_update_same_rights">%1$s → %2$s, mit denselben Rechten.</string>+ <string name="extensions_prompt_not_newer">Version %1$s (oder eine neuere) ist bereits installiert.</string>+ <string name="extensions_prompt_sha">SHA-256 des Pakets: %1$s</string>+ <string name="extension_enabled">An</string>+ <string name="extension_running">Läuft</string>+ <string name="extension_not_running">Läuft nicht</string>+ <string name="extension_turned_off">%1$s ausgeschaltet: %2$s</string>+ <string name="extension_last_error">Letzter Fehler: %1$s</string>+ <string name="extension_disabled_reason">Ausgeschaltet: %1$s</string>+ <string name="extension_inactive">Inaktiv</string>+ <string name="extension_inactive_detail">Inaktiv: %1$s</string>+ <string name="extension_homepage">Webseite</string>+ <string name="extension_settings">Einstellungen</string>+ <string name="extension_log">Protokoll</string>+ <string name="extension_log_empty">Noch nichts protokolliert.</string>+ <string name="extension_log_clear">Protokoll leeren</string>+ <string name="extension_update_file">Aus einer Datei aktualisieren</string>+ <string name="extension_uninstall">Deinstallieren</string>+ <string name="extension_uninstall_confirm">%1$s deinstallieren? Die Einstellungen und gespeicherten Daten gehen damit verloren.</string>+ <string name="extension_confirm_title">Eine Erweiterung fragt</string>+ <string name="extension_confirm_detail">Nichts wird geändert, solange du es nicht erlaubst.</string>+ <string name="extension_confirm_allow">Erlauben</string>+ <string name="extension_confirm_refuse">Ablehnen</string>+ <string name="extensions_row_count">%1$d installiert, %2$d aktiviert</string>+ <string name="extensions_tab_store">Store</string>+ <string name="extensions_search">Erweiterungen suchen</string>+ <string name="extensions_cat_all">Alle</string>+ <string name="extensions_cat_lyrics">Songtexte</string>+ <string name="extensions_cat_playback">Wiedergabe & Audio</string>+ <string name="extensions_cat_library">Bibliothek</string>+ <string name="extensions_cat_discovery">Entdecken</string>+ <string name="extensions_cat_stats">Statistiken</string>+ <string name="extensions_cat_look">Aussehen</string>+ <string name="extensions_cat_social">Sozial</string>+ <string name="extensions_cat_tools">Werkzeuge</string>+ <string name="extensions_cat_other">Sonstiges</string>+ <string name="extensions_no_match">Keine passende Erweiterung.</string>+ <string name="extensions_browse_store">Den Store durchstöbern</string>+ <string name="extensions_other_ways">Weitere Wege zur Installation</string>+ <string name="extensions_empty_title">Was sind Erweiterungen?</string>+ <string name="extensions_empty_body">Erweiterungen ergänzen Myspoti um das, was die App selbst nicht kann: Songtexte aus anderen Quellen, woher das Audio oder der Download eines Songs kommt, Werkzeuge, die dein Spotify-Konto nutzen. Jede läuft in einer Sandbox und fragt, bevor sie auf etwas zugreift. Füge ein Repository hinzu, um sie zu durchstöbern, oder installiere ein Paket, dem du vertraust.</string>+ <string name="extensions_official_badge">Offiziell</string>+ <string name="extensions_repo_yours">Von dir hinzugefügt</string>+ <string name="extensions_repo_community">Community</string>+ <string name="extensions_repo_official_note">Jede Erweiterung wird vor der Aufnahme geprüft.</string>+ <string name="extensions_repo_yours_note">Nicht von Myspoti geprüft: Installation auf eigenes Risiko.</string>+ <string name="extensions_repo_error">Dieses Repository konnte nicht gelesen werden: %1$s</string>+ <string name="extensions_repo_empty">Dieses Repository enthält keine Erweiterung.</string>+ <string name="extensions_requires">Benötigt Myspoti %1$s oder neuer</string>+ <string name="extensions_requires_api">Für ein neueres Myspoti gemacht (Erweiterungs-API %1$d)</string>+ <string name="extensions_update_badge">Update</string>+ <string name="extensions_move_up">Nach oben</string>+ <string name="extensions_move_down">Nach unten</string>+ <string name="extension_off">Aus</string>+ <string name="extension_by">von %1$s</string>+ <string name="extension_changelog">Neuigkeiten</string>+ <string name="extension_update_from">Update verfügbar: %1$s → %2$s</string>+ <string name="extension_not_listed">Diese Erweiterung ist in deinen Repositories nicht enthalten (oder sie werden noch geladen).</string>+ <string name="extension_details">Details</string>+ <string name="extension_detail_updated">Aktualisiert</string>+ <string name="extension_detail_min_app">Benötigt Myspoti</string>+ <string name="extension_detail_size">Größe</string>+ <string name="extension_detail_id">ID</string>+ <string name="extension_detail_sha">SHA-256 des Pakets</string>+ <string name="extension_detail_source">Installiert von</string>+ <string name="extension_see_in_store">Im Store ansehen</string>++ <!-- Actions: the closed catalogue, as the user reads it -->+ <string name="action_playback_control">Wiedergabe steuern</string>+ <string name="action_playback_queue">Die Warteschlange bearbeiten</string>+ <string name="action_playback_events">Wissen, was du hörst</string>+ <string name="action_lyrics_provide">Songtexte liefern</string>+ <string name="action_trackinfo_provide">Song-Details ergänzen</string>+ <string name="action_audio_source">Audio von anderswo abspielen</string>+ <string name="action_download_source">Downloads liefern</string>+ <string name="action_home_sections">Bereiche auf der Startseite hinzufügen</string>+ <string name="action_search_provide">Suchergebnisse hinzufügen</string>+ <string name="action_menu_items">Menüeinträge hinzufügen</string>+ <string name="action_player_buttons">Player-Tasten hinzufügen</string>+ <string name="action_settings_page">Eigene Einstellungen</string>+ <string name="action_notify">Kurze Meldungen anzeigen</string>+ <string name="action_library_read">Deine Bibliothek lesen</string>+ <string name="action_library_write">Deine Bibliothek ändern</string>+ <string name="action_playlists_write">Deine Playlists bearbeiten</string>+ <string name="action_spotify_catalog">Spotify durchsuchen</string>+ <string name="action_spotify_raw">Voller Spotify-Zugriff</string>+ <string name="action_network">Das Internet nutzen</string>+ <string name="action_network_any">Jede Website nutzen</string>+ <string name="action_webview_page">Eine eigene Webseite</string>+ <string name="action_storage">Eigene Daten speichern</string>+ <string name="action_unknown">Dieser Myspoti-Version unbekannt</string>+ <string name="action_critical">Kritisch</string>+ <string name="action_no_why">(kein Grund angegeben)</string>+ <string name="actions_title">Was sie tut</string>+ <string name="actions_critical_warning">Kritische Aktionen können dein Konto ändern, die Herkunft von Songs ersetzen oder eine freie Webseite anzeigen. Erlaube sie nur, wenn du dem Autor vertraust: Myspoti fragt trotzdem nach, bevor etwas entfernt wird.</string>+ <!-- Areas of the Installed tab -->+ <string name="area_playback">Wiedergabe</string>+ <string name="area_lyrics">Songtexte & Song-Infos</string>+ <string name="area_audio">Audio & Downloads</string>+ <string name="area_home">Start & Suche</string>+ <string name="area_menus">Menüs & Player</string>+ <string name="area_library">Bibliothek & Spotify</string>+ <string name="area_other">Seiten & mehr</string>+ <string name="area_activity">Letzte Aktivität</string>+ <string name="area_turn_off">Ausschalten</string>+ <string name="area_active">Aktiv</string>+ <string name="area_idle">Inaktiv</string>+ <string name="area_make_active">Zur ersten Wahl für %1$s machen</string>+ <!-- Install prompt -->+ <string name="ext_third_party_notice">Erweiterung eines Dritten, nicht von Myspoti geprüft, auf Verantwortung ihres Autors.</string>+ <string name="ext_risk_accept">Ich verstehe, dass diese Erweiterung von einem Dritten stammt, und installiere sie auf eigene Verantwortung</string>+ <string name="ext_clash_exclusive">Ersetzt %1$s, derzeit bereitgestellt von %2$s</string>+ <string name="ext_clash_conflict">Nicht kompatibel mit %1$s (installiert)</string>+ <string name="ext_clash_replaces">Ersetzt %1$s (installiert)</string>+ <string name="ext_clash_keep_new">%1$s verwenden (die andere bleibt installiert, %2$s)</string>+ <string name="ext_clash_keep_old">%1$s behalten</string>+ <string name="ext_clash_idle">inaktiv</string>+ <string name="ext_clash_off">ausgeschaltet</string>+ <string name="ext_clash_title">Welche behalten?</string>+ <string name="ext_clash_ok">Fertig</string>+ <!-- Blocks and pages -->+ <string name="ext_from">Von %1$s</string>+ <string name="ext_overflow">Erweiterungen</string>+ <string name="ext_open_page">Seite der Erweiterung öffnen</string>+ <string name="ext_page_failed">Die Seite dieser Erweiterung konnte nicht angezeigt werden.</string>+ <string name="ext_suspended_title">%1$s pausiert</string>+ <string name="ext_suspended_body">Sie hat immer wieder rückgängig gemacht, was %1$s bei der Wiedergabe getan hat: die Wiedergabebefehle der Erweiterung sind ausgesetzt.</string>+ <string name="ext_suspended_keep">Weiterlaufen lassen</string>++ <!-- GitHub: discovery, ratings, reports -->+ <string name="extensions_github_title">Auf GitHub</string>+ <string name="extensions_github_note">Öffentliche Repositories mit dem Topic myspoti-extension, nicht geprüft: Jedes liegt in der Verantwortung seines Autors.</string>+ <string name="extensions_show_all">Alle anzeigen (%1$d ausgeblendet)</string>+ <string name="extensions_show_less">Blockierte, gemeldete, schlecht bewertete und verwaiste ausblenden</string>+ <string name="extension_rating">★ %1$s · %2$d Stimmen</string>+ <string name="extension_rating_none">Noch keine Stimmen</string>+ <string name="extension_downloads">%1$s Downloads</string>+ <string name="extension_rate_up">Als gut bewerten</string>+ <string name="extension_rate_down">Als schlecht bewerten</string>+ <string name="extension_rated">Danke: Deine Stimme ist auf GitHub</string>+ <string name="extension_signin_title">Bei GitHub anmelden</string>+ <string name="extension_signin_body">Öffne %1$s und gib diesen Code ein. Myspoti sieht dein Passwort nie.</string>+ <string name="extension_signin_open">GitHub öffnen</string>+ <string name="extension_report">Melden</string>+ <string name="extension_detail_github">GitHub</string>+ <string name="extension_detail_ref">Version auf GitHub</string>++ <!-- Updates from GitHub -->+ <string name="extension_check_updates">Nach Updates suchen</string>+ <string name="extension_check_up_to_date">Auf dem neuesten Stand</string>+ <string name="extension_check_applied">Aktualisiert: Sie fragt nichts Neues an</string>+ <string name="extension_check_needs_ok">Ein Update braucht dein OK</string>+ <string name="extension_check_declined">Du hast diese Version behalten</string>+ <string name="extension_check_incompatible">Die neue Version braucht ein neueres Myspoti</string>+ <string name="extension_check_blocked">Die neue Version ist von Myspoti blockiert</string>+ <string name="extension_check_failed">Prüfung fehlgeschlagen: siehe Protokoll</string>+ <string name="extension_source_gone">Quelle verschwunden: Das Repository existiert nicht mehr. Die Erweiterung läuft weiter mit der Kopie auf deinem Handy.</string>+ <string name="extension_revert">Zurück zu %1$s</string>+ <string name="extension_reverted">Zurück bei %1$s</string>+ <string name="extension_update_needs_ok">Update braucht dein OK: %1$s → %2$s</string>+ <string name="extension_update_needs_ok_body">Diese Version fordert mehr an, als du akzeptiert hast. Die aktuelle läuft weiter, bis du dich entscheidest.</string>+ <string name="extension_update_accept">Akzeptieren</string>+ <string name="extension_update_keep">Aktuelle behalten</string>+ <string name="extension_refused_title">Wartet auf Ihr OK</string>+ <string name="extension_refused_body">Sie wurde installiert, als sich Aktionen abwählen ließen, und einige wurden abgewählt. Erweiterungen erhalten jetzt alle Aktionen, die sie angeben: Sie bleibt aus, bis Sie sie annehmen.</string>+ <string name="extension_change_action">Neu: %1$s</string>+ <string name="extension_change_host">Neue Website: %1$s</string>+ <string name="extension_change_any_host">Jede Website</string>+ <string name="extension_change_exclusive">Jetzt exklusiv: %1$s</string>+ <string name="extension_change_why">Neuer Grund für %1$s</string>+ <string name="extension_change_was">Vorher: „%1$s“</string>+ <string name="extension_change_repo">Kommt jetzt von %1$s (vorher %2$s)</string>+ <string name="extension_change_author">Neuer Autor: %1$s (vorher %2$s)</string>+ <string name="extension_change_replaces">Schaltet %1$s aus, wenn installiert</string>+ <string name="extension_change_conflicts">Läuft nicht zusammen mit %1$s</string>+ <string name="action_webview_auth">Auf einer Website anmelden</string>+ <string name="extension_confirm_once">Einmal erlauben</string>+ <string name="extension_confirm_always">%1$s immer erlauben</string>+ <string name="ext_auth_title">%1$s: Anmeldung</string>+ <string name="ext_auth_close">Schließen</string>+ <string name="ext_auth_notice">Eine eigene Seite: Eingaben und Cookies bleiben in Myspoti. Die Erweiterung erhält nur die Endadresse der Seite.</string>+ <string name="ext_grants_title">Immer erlaubt</string>+ <string name="ext_grants_note">Spotify-Änderungen, die diese Erweiterung ohne Nachfrage vornimmt. Eine widerrufen, um erneut gefragt zu werden.</string>+ <string name="ext_grant_revoke">Widerrufen</string>+</resources>diff --git a/base/app/src/main/res/values-de/myspoti_strings.xml b/base/app/src/main/res/values-de/myspoti_strings.xmlindex d1300130..46d26f9b 100644--- a/base/app/src/main/res/values-de/myspoti_strings.xml+++ b/base/app/src/main/res/values-de/myspoti_strings.xml@@ -1,20 +1,13 @@<?xml version="1.0" encoding="utf-8"?><!-- Myspoti-eigene Texte (Englisch als Standard, Deutsch). --><resources>- <string name="welcome_tagline">Deine Musik, mit synchronisierten Songtexten und offiziellen Musikvideos.</string><string name="welcome_lead">Deine Musik,</string><string name="welcome_rotate_ads">ohne Werbung.</string><string name="welcome_rotate_lyrics">mit Lyrics Wort für Wort.</string><string name="welcome_rotate_clips">mit den offiziellen Videos.</string>- <string name="welcome_rotate_offline">sogar offline.</string>- <string name="welcome_rotate_lossless">in verlustfreier Qualität.</string>+ <string name="welcome_rotate_offline">offline, über Erweiterungen.</string><string name="welcome_login">Mit Spotify anmelden</string><string name="welcome_privacy">Du meldest dich auf Spotifys eigener Seite an. Myspoti sieht dein Passwort nie.</string>- <string name="crash_heading">Myspoti ist abgestürzt</string>- <string name="crash_explanation">Etwas ist schiefgelaufen. Starte die App neu; wenn es wieder passiert, kopiere den Bericht und teile ihn in einem GitHub-Issue.</string>- <string name="crash_restart_app">Myspoti neu starten</string>- <string name="crash_copy_report">Bericht kopieren</string>- <string name="crash_report_copied">Bericht kopiert</string><string name="remove_from_liked">Aus Lieblingssongs entfernen</string><string name="repeat_on">Wiederholen: an</string><string name="repeat_one">Titel wiederholen</string>@@ -54,7 +47,6 @@<string name="background_playback_title">Wiedergabe im Hintergrund</string><string name="background_playback_on">Akkuoptimierung ist aus: Musik und Spotify Connect laufen weiter, wenn der Bildschirm aus ist.</string><string name="background_playback_off">Schalte die Akkuoptimierung aus, damit Android die App im Hintergrund nicht pausiert.</string>- <string name="crossfade_summary">Blendet das Ende eines Titels aus und den nächsten ein (ohne Überlappung). Nur auf diesem Telefon.</string><plurals name="local_files_count"><item quantity="one">%d Titel</item><item quantity="other">%d Titel</item>@@ -71,11 +63,8 @@<string name="artist_not_found">Künstler*in nicht gefunden</string><string name="playlist_not_found">Playlist nicht gefunden</string><string name="browse_new_releases">Neuheiten</string>- <string name="browse_charts">Charts</string>- <string name="browse_workout">Workout</string>- <string name="browse_dance_electronic">Dance/Electronic</string><string name="language_auto">Automatisch</string>- <string name="language_auto_detail">Die Sprache deines Handys, wenn Myspoti sie hat (Deutsch, Englisch, Französisch, Griechisch, Italienisch, Portugiesisch, Spanisch), sonst Englisch</string>+ <string name="language_auto_detail">Die Sprache deines Handys, wenn Myspoti sie hat (Chinesisch, Deutsch, Englisch, Französisch, Griechisch, Italienisch, Polnisch, Portugiesisch, Russisch, Spanisch), sonst Englisch</string><string name="language_partial_note">Andere Sprachen: Die Bezeichnungen von Spotify sind übersetzt, die Texte von Myspoti bleiben auf Englisch.</string><string name="restart_player_title">Player neu starten</string><string name="restart_player_detail">Wenn die Musik nicht mehr reagiert: lädt den Spotify-Player neu</string>@@ -86,7 +75,6 @@<string name="local_rename">Umbenennen</string><string name="local_delete_playlist">Playlist löschen</string><string name="local_added_to">Zu %1$s hinzugefügt</string>- <string name="folder_create_failed">Ordner konnte nicht erstellt werden</string><string name="local_playlist_empty">Füge Songs aus Lokale Dateien mit ihrem +-Button hinzu.</string><string name="playlist_change_refused">Spotify hat die Änderung an dieser Playlist abgelehnt</string><string name="download_kept_by_list">Bleibt heruntergeladen: Eine heruntergeladene Playlist enthält ihn</string>@@ -124,6 +112,7 @@<string name="library_reorder_hint">Halte eine Playlist gedrückt und zieh sie, um sie zu verschieben</string><string name="library_reorder_reset">Zurück zur Reihenfolge von Spotify</string><string name="song_radio_failed">Das Radio zu diesem Song konnte nicht geöffnet werden</string>+ <string name="song_radio_name">%1$s-Radio</string><string name="local_files_find_hint">In Lokale Dateien suchen</string><string name="data_saver_title">Datensparmodus</string><string name="data_saver_summary">Im mobilen Netz verbraucht Myspoti keine Daten: Nur heruntergeladene Songs und lokale Dateien werden abgespielt</string>@@ -152,13 +141,8 @@<string name="playback_speed">Wiedergabegeschwindigkeit</string><string name="recommended_songs">Empfohlene Songs</string><string name="jam_title">Jam</string>- <string name="jam_restricted">Spotify erlaubt das Starten einer Jam nur Premium-Konten. Mit einem Link kannst du trotzdem beitreten.</string>- <string name="jam_join">Jam beitreten</string>- <string name="jam_join_hint">Füge den Einladungslink ein</string><string name="jam_leave">Jam verlassen</string><string name="jam_members">%1$d Personen hören mit</string>- <string name="pin">Anheften</string>- <string name="unpin">Loslösen</string><string name="jam_start">Jam starten</string><string name="jam_invite">Einladungslink teilen</string><string name="jam_failed">Spotify hat diese Jam abgelehnt</string>@@ -195,27 +179,6 @@<string name="smart_shuffle_title">Smart Shuffle</string><string name="smart_shuffle_on">Smart Shuffle: Spotify-Empfehlungen werden in die zufällige Playlist gemischt.</string><string name="track_sort_added">Hinzugefügt am</string>- <!-- Lossless-Downloads (SpotiFLAC) -->- <string name="spotiflac_row_title">Lossless-Downloads (FLAC)</string>- <string name="spotiflac_row_on">Verifiziert — Myspoti nutzt die Server von SpotiFLAC.</string>- <string name="spotiflac_row_off">Nicht verifiziert — tippe, um die einmalige Prüfung abzuschließen.</string>- <string name="spotiflac_verify_title">SpotiFLAC-Verifizierung</string>- <string name="spotiflac_verify_start_failed">Die Verifizierung konnte nicht gestartet werden. Tippe auf Erneut versuchen oder komm später wieder.</string>- <string name="spotiflac_verify_timeout">Die Verifizierung ist abgelaufen. Tippe auf Erneut versuchen oder auf Vorerst überspringen.</string>- <string name="spotiflac_verify_rejected">Die Verifizierung wurde abgelehnt. Tippe auf Erneut versuchen oder auf Vorerst überspringen.</string>- <string name="spotiflac_session_ok">SpotiFLAC-Sitzung gespeichert</string>- <string name="spotiflac_session_creating">Sichere Sitzung wird erstellt…</string>- <string name="spotiflac_session_failed">Die Verifizierung konnte nicht abgeschlossen werden. Tippe auf Erneut versuchen oder auf Vorerst überspringen.</string>- <string name="spotiflac_skip">Vorerst überspringen</string>- <string name="retry">Erneut versuchen</string>- <string name="spotiflac_status_title">SpotiFLAC</string>- <string name="spotiflac_status_verified">Du bist verifiziert: Downloads laufen über die Server von SpotiFLAC, die zuverlässigste verlustfreie Quelle. Es wird nur diese Sitzung genutzt — kein Konto, sonst nichts gespeichert.</string>- <string name="spotiflac_session_expires">Sitzung gültig bis %1$s</string>- <string name="spotiflac_forget">Diese Sitzung entfernen</string>- <string name="lossless_hires_title">Hi-Res-Downloads (24 Bit)</string>- <string name="lossless_hires_detail">Ein Titel wird in 24-Bit-Hi-Res gespeichert, wenn die Quelle sie hat. Die Dateien sind etwa dreimal so groß wie CD-Qualität.</string>- <string name="setup_spotiflac_title">Lossless-Downloads (FLAC)</string>- <string name="setup_spotiflac_detail">Einmal mit SpotiFLAC verifizieren, damit Downloads über seine verlustfreien Server laufen.</string><string name="settings_title">Einstellungen</string><string name="settings_detail">Klangqualität, Downloads, Daten, Akku und Sprache</string><string name="settings_section_playback">Wiedergabe</string>@@ -244,7 +207,6 @@<string name="setup_quality_subtitle">Wähle, wie Myspoti deine Musik abspielt und speichert. Du kannst es später in den Einstellungen ändern.</string><string name="downloads_off_toast">Downloads sind aus. Schalte sie in den Einstellungen ein.</string><string name="quality_streaming_high_detail">160 kbit/s, der beste Klang</string>- <string name="downloads_verify_hint">Keine verlustfreie Quelle hat geantwortet. Verifiziere SpotiFLAC einmal in den Einstellungen unter Downloads: Dessen Server sind die zuverlässigen.</string><string name="quality_download_small">Kleinste</string><string name="quality_download_small_detail">AAC 96 kbit/s, am leichtesten: etwa 3 MB pro Song</string><string name="settings_solid_nav_title">Feste untere Leiste</string>@@ -254,14 +216,12 @@<string name="quality_sheet_title">Klangqualität</string><string name="quality_now">Läuft gerade: %1$s</string><string name="quality_now_unknown">Noch nicht bekannt: Spiele einen Song ab</string>- <string name="spotiflac_verify_in_browser">Löse die Prüfung im Browser-Tab, der sich geöffnet hat, und komm dann hierher zurück.</string><string name="update_downloading">Wird heruntergeladen… %1$d%%</string><string name="update_installing">Wird installiert…</string><string name="update_needs_permission">Erlaube Myspoti, Apps zu installieren, um zu aktualisieren, und komm dann hierher zurück.</string><string name="update_allow">Erlauben</string><string name="update_failed">Das Update ist fehlgeschlagen: %1$s</string><string name="update_retry">Erneut versuchen</string>- <string name="downloads_verify_banner">Downloads brauchen einmal die SpotiFLAC-Verifizierung in dieser App. Tippe hier, um sie durchzuführen.</string><string name="removed_from">Aus %1$s entfernt</string><string name="done">Fertig</string><string name="playlist_edit_details">Details bearbeiten</string>@@ -271,14 +231,6 @@<string name="playlist_remove_cover">Cover entfernen</string><string name="playlist_save">Speichern</string><string name="playlist_access_title">Wer sie sehen kann</string>- <string name="playlist_access_public">Öffentlich</string>- <string name="playlist_access_public_detail">Alle können sie finden und abspielen</string>- <string name="playlist_access_private">Privat</string>- <string name="playlist_access_private_detail">Nur du kannst sie sehen</string>- <string name="playlist_access_collaborative">Gemeinsam</string>- <string name="playlist_access_collaborative_detail">Nur eingeladene Personen können Songs hinzufügen und entfernen</string>- <string name="playlist_on_profile">Auf deinem Profil</string>- <string name="playlist_on_profile_detail">Auf deinem Profil für andere sichtbar</string><string name="choose_artist">Künstler auswählen</string><string name="quality_streaming_wifi_title">Streaming über WLAN</string><string name="quality_streaming_cell_title">Streaming über mobile Daten</string>@@ -316,13 +268,13 @@<string name="library_sort_recently_added">Zuletzt hinzugefügt</string><string name="library_change_failed">Deine Bibliothek konnte nicht aktualisiert werden, versuch es erneut</string><string name="a11y_close_player">Player schließen</string>- <string name="a11y_devices">Geräte</string><string name="a11y_share">Teilen</string><string name="search_failed">Suche fehlgeschlagen. Prüfe deine Verbindung.</string><string name="retry_button">Erneut versuchen</string><string name="page_load_failed">Diese Seite konnte nicht geladen werden.\nPrüfe deine Verbindung und versuche es erneut.</string><string name="jam_paste_link">Mit kopiertem Link beitreten</string><string name="play_refused">Spotify hat die Wiedergabe mit deinem Konto abgelehnt. In manchen Ländern können kostenlose Konten nur zufällig abspielen: Probier die Zufallswiedergabe-Taste.</string>+ <string name="play_refused_all">Spotify lehnt gerade jeden Befehl dieses Players für dein Konto ab (Wiedergabe, Vorspulen, Gerätewechsel). Der Player wurde einmal neu geladen. Wenn nichts abgespielt wird, schließe die App komplett und öffne sie erneut oder wechsle zwischen WLAN und mobilen Daten.</string><string name="artist_liked_songs">Lieblingssongs</string><plurals name="artist_liked_songs_count"><item quantity="one">%1$d Song von %2$s</item>@@ -337,7 +289,6 @@<string name="settings_rotation_auto">Automatisch</string><string name="settings_rotation_landscape">Querformat</string><string name="support_github_action">Auf GitHub sponsern</string>- <string name="spotiflac_verify_again">Die SpotiFLAC-Bestätigung ist abgelaufen: Bestätige sie in den Einstellungen erneut, um verlustfrei herunterzuladen</string><string name="download_on_mobile_data">Download über mobile Daten: Er verbraucht dein Datenvolumen</string><string name="restart_player_done">Player neu gestartet</string><string name="spotify_limited">Spotify begrenzt die Wiedergabe gerade. Versuche es in einer Minute erneut.</string>@@ -356,7 +307,6 @@<string name="blend_deleted">Dieser Blend wurde gelöscht</string><string name="blend_working">Wird ausgeführt…</string><string name="blend_invited_by">%1$s lädt dich zu einem Blend ein</string>- <string name="blend_open">Blend öffnen</string><string name="blend_later">Später</string><string name="blend_members">Mitglieder</string><string name="blend_invite_more">Weitere Personen einladen</string>@@ -375,7 +325,6 @@<string name="diagnostic_export_title">Diagnosebericht exportieren</string><string name="diagnostic_export_detail">Teilt das aktuelle Protokoll der App und die Gerätedaten</string><string name="diagnostic_export_failed">Der Diagnosebericht konnte nicht geschrieben werden</string>- <string name="recently_played_title">Zuletzt gespielt</string><string name="recently_played_empty">Was du mit diesem Konto abspielst, erscheint hier.</string><string name="recently_played_failed">Die Liste der zuletzt gespielten Titel konnte nicht geladen werden (%1$s)</string><string name="recents_title">Zuletzt</string>@@ -418,11 +367,8 @@<string name="show_sort_chapters_newest">Alle Kapitel • Neueste</string><string name="show_sort_chapters_oldest">Alle Kapitel • Älteste</string><string name="show_empty">Hier gibt es noch nichts zum Abspielen</string>- <string name="show_rating">%1$s (%2$s)</string><string name="show_authors">Von %1$s</string><string name="show_narrators">Gelesen von %1$s</string>- <string name="show_followed">Du folgst diesem Podcast jetzt</string>- <string name="show_unfollowed">Du folgst diesem Podcast nicht mehr</string><string name="episode_duration_min">%1$d Min.</string><string name="episode_remaining">noch %1$s</string><string name="episode_mark_played">Als gehört markieren</string>@@ -435,20 +381,14 @@<string name="episode_show_more">mehr anzeigen</string><string name="episode_show_less">weniger anzeigen</string><string name="episode_download">Herunterladen</string>- <string name="episode_downloading">Wird heruntergeladen…</string>- <string name="episode_downloaded">Heruntergeladen</string><string name="episode_download_remove">Download entfernen</string><string name="episode_options">Episodenoptionen</string><string name="episode_not_found">Episode nicht gefunden</string>- <string name="show_not_found">Podcast nicht gefunden</string><string name="podcast_playing_from">Wird aus dem Podcast abgespielt</string><string name="player_speed_chip">%1$s×</string><string name="player_back_15">15 Sekunden zurück</string><string name="player_forward_15">15 Sekunden vor</string>- <string name="player_show_remaining">Verbleibende Zeit anzeigen</string>- <string name="player_show_elapsed">Vergangene Zeit anzeigen</string><string name="player_sleep_timer">Schlaftimer</string>- <string name="player_speed_a11y">Wiedergabegeschwindigkeit, %1$s×</string><string name="settings_keep_playing_title">Nach dem Schließen weiterspielen</string><string name="settings_keep_playing_detail">Aus: Myspoti in den letzten Apps schließen stoppt die Musik</string><string name="recommended_songs_from_name">Basierend auf dem Namen dieser Playlist</string>@@ -469,8 +409,6 @@<string name="link_copied">Link kopiert</string><string name="lyrics_meaning_title">Bedeutung</string><string name="lyrics_meaning_about">Info</string>- <string name="lyrics_meaning_lines">Zeilen erklärt</string>- <string name="lyrics_meaning_source">Von Genius · Song dort öffnen</string><string name="lyrics_meaning_translating">Wird übersetzt …</string><string name="lyrics_meaning_translate">Übersetzen</string><string name="lyrics_meaning_original">Original anzeigen</string>diff --git a/base/app/src/main/res/values-de/spotify_strings.xml b/base/app/src/main/res/values-de/spotify_strings.xmlindex 796faa7d..9121452d 100644--- a/base/app/src/main/res/values-de/spotify_strings.xml+++ b/base/app/src/main/res/values-de/spotify_strings.xml@@ -17,7 +17,6 @@<string name="snackbar_added_to_liked_songs" formatted="false">Zu „Lieblingssongs“ hinzugefügt</string><string name="snackbar_removed_from_liked_songs" formatted="false">Aus „Lieblingssongs“ entfernt</string><string name="content_description_context_menu" formatted="false">Weitere Optionen</string>- <string name="close_button_content_description" formatted="false">Schließen</string><string name="add_to_playlist_saved_in_section_header" formatted="false">Gespeichert in</string><string name="add_to_playlist_new_playlist_button_text" formatted="false">Neue Playlist</string><string name="add_to_playlist_button_cancel" formatted="false">Abbrechen</string>@@ -25,8 +24,6 @@<string name="lyrics_card_title" formatted="false">Songtexte</string><string name="lyrics_card_title_preview" formatted="false">Vorschau der Lyrics</string><string name="lyrics_card_show_lyrics_button" formatted="false">Lyrics anzeigen</string>- <string name="lyrics_card_expand_button_content_description" formatted="false">Lyrics im Vollbild öffnen</string>- <string name="lyrics_card_share_button_content_description" formatted="false">Lyrics teilen</string><string name="lyrics_credential_note" formatted="false">Songtext bereitgestellt von %1$s</string><string name="lyrics_fullscreen_chip_label_share" formatted="false">Teilen</string><string name="lyrics_fullscreen_chip_label_translate" formatted="false">Übersetzen</string>@@ -49,7 +46,6 @@<string name="artist_popular_tracks" formatted="false">Beliebt</string><string name="curation_button_follow_state_text" formatted="false">Folgen</string><string name="curation_button_following_state_text" formatted="false">Gefolgt</string>- <string name="search_main_entity_subtitle_artist" formatted="false">Künstler*in</string><string name="connect_phone_is_self" formatted="false">Dieses Smartphone</string><string name="settings_item_canvas_title" formatted="false">Canvas</string><string name="video_settings_canvas_subtitle" formatted="false">Kurzes, sich wiederholendes Bildmaterial während der Songwiedergabe</string>@@ -107,8 +103,6 @@<string name="library_search_text_hint" formatted="false">Bibliothek durchsuchen</string><string name="account_title" formatted="false">Konto</string><string name="song_dna_search_chip_followed_artists" formatted="false">Künstler*innen, denen du folgst</string>- <string name="settings_item_crossfade_title" formatted="false">Übergang</string>- <string name="playback_settings_crossfade_slider_seconds" formatted="false">%1$d Sek.</string><string name="local_files_title" formatted="false">Lokale Dateien</string><string name="local_files_empty_section_title" formatted="false">Eigene Audiodateien zur Bibliothek hinzufügen</string><string name="local_files_empty_section_subtitle" formatted="false">Hast du einen Song oder persönlichen Podcast, der nicht auf Spotify ist?</string>@@ -138,14 +132,10 @@<string name="assisted_curation_search_filter_artists" formatted="false">Künstler*innen</string><string name="assisted_curation_search_filter_albums" formatted="false">Alben</string><string name="assisted_curation_search_filter_playlists" formatted="false">Playlists</string>- <string name="assisted_curation_search_filter_clear_content_description" formatted="false">Filter löschen</string>- <string name="ad_category_title_music" formatted="false">Musik</string>- <string name="made_for_you_hub_title" formatted="false">Für dich erstellt</string><string name="settings_item_app_language_title" formatted="false">Sprache der App</string><string name="create_menu_item_folder_title" formatted="false">Ordner</string><string name="create_folder_name_suggested_folder_name" formatted="false">Neuer Ordner</string><string name="context_menu_rename_folder" formatted="false">Ordner umbenennen</string>- <string name="your_library_messaging_folder_rename_hint" formatted="false">Ordnername</string><string name="create_playlist_content_description" formatted="false">Playlist erstellen</string><string name="actions_picker_delete" formatted="false">Löschen</string><string name="filter_and_sort_sort_section_title" formatted="false">Sortieren nach</string>diff --git a/base/app/src/main/res/values-de/strings.xml b/base/app/src/main/res/values-de/strings.xmlindex 61371067..cd7a5971 100644--- a/base/app/src/main/res/values-de/strings.xml+++ b/base/app/src/main/res/values-de/strings.xml@@ -4,34 +4,14 @@<string name="aa_playlists">Playlists</string><string name="aa_albums">Alben</string><string name="aa_artists">Künstler</string>- <string name="aa_podcasts">Podcasts</string><string name="settings_amoled_theme">AMOLED-Design</string><string name="settings_amoled_theme_subtitle">Rein schwarzer Hintergrund zum Akkusparen</string>- <string name="settings_lyrics_style_spotify_default">Spotify-Standard</string>- <string name="settings_lyrics_style_fullscreen">Vollbild (Albumfarben)</string>- <string name="settings_lyrics_style_compact">Kompakt</string>- <string name="settings_lyrics_style_karaoke">Karaoke</string>- <string name="settings_lyrics_style_bold">Groß und fett</string><string name="main_update_available">Ein neues Update ist verfügbar</string>- <string name="notif_channel_media_name">Medienwiedergabe</string>- <string name="notif_channel_media_description">Steuerung der Medienwiedergabe von Myspoti</string>- <string name="notif_action_previous">Vorheriger</string>- <string name="notif_action_next">Nächster</string><string name="notif_action_play">Abspielen</string><string name="notif_action_pause">Pausieren</string><string name="notif_shuffle_enable">Zufallswiedergabe aktivieren</string><string name="notif_shuffle_disable">Zufallswiedergabe deaktivieren</string><string name="notif_shuffle_disable_smart">Smart-Shuffle deaktivieren</string>- <string name="notif_action_like">Gefällt mir</string>- <string name="notif_action_unlike">Gefällt mir nicht mehr</string>- <string name="notif_unknown_name">Unbekannt</string>- <string name="notif_by_artist">von %1$s</string>- <string name="notif_repeat_disable">Wiederholen deaktivieren</string>- <string name="notif_repeat_disable_one">Titel-Wiederholung deaktivieren</string>- <string name="notif_repeat_enable">Wiederholen aktivieren</string>- <string name="bridge_player_unlocked">Player entsperrt</string>- <string name="bridge_reloading">Wird neu geladen…</string>- <string name="service_disabled_message">Der Dienst ist nicht aktiviert</string><string name="energy_saver_title">Energiesparmodus</string><string name="energy_saver_summary">Canvas aus, leichtere Videos und Animationen</string><string name="video_fullscreen_enter">Vollbild öffnen</string>@@ -39,4 +19,5 @@<string name="playback_seek_description">Wiedergabeposition</string><string name="account_page_title">Spotify-Konto</string><string name="account_page_detail">Abo, Datenschutz und Geräte, auf spotify.com</string>+ <string name="player_source_downloaded">Heruntergeladen</string></resources>diff --git a/base/app/src/main/res/values-el/extensions_strings.xml b/base/app/src/main/res/values-el/extensions_strings.xmlnew file mode 100644index 00000000..aa4cb63e--- /dev/null+++ b/base/app/src/main/res/values-el/extensions_strings.xml@@ -0,0 +1,211 @@+<?xml version="1.0" encoding="utf-8"?>+<resources>+ <string name="extensions_title">Επεκτάσεις</string>+ <string name="extensions_row_detail">Στίχοι, ο ήχος ενός τραγουδιού και σενάρια γραμμένα από άλλους, σε απομονωμένο περιβάλλον.</string>+ <string name="extensions_install_file">Εγκατάσταση από αρχείο</string>+ <string name="extensions_install_url">Εγκατάσταση από διεύθυνση</string>+ <string name="extensions_url_hint">https://…/extension.zip</string>+ <string name="extensions_none">Δεν έχει εγκατασταθεί καμία επέκταση.</string>+ <string name="extensions_installed">Εγκατεστημένες</string>+ <string name="extensions_repository_add">Προσθήκη αποθετηρίου</string>+ <string name="extensions_repository_hint">https://…/index.json</string>+ <string name="extensions_repository_warning">Το Myspoti δεν ελέγχει ένα αποθετήριο που προσθέτεις: ό,τι εγκαθιστάς από αυτό γίνεται με δική σου ευθύνη.</string>+ <string name="extensions_repository_remove">Αφαίρεση</string>+ <string name="extensions_repository_refresh">Ανανέωση</string>+ <string name="extensions_install">Εγκατάσταση</string>+ <string name="extensions_update">Ενημέρωση</string>+ <string name="extensions_up_to_date">Εγκατεστημένη</string>+ <string name="extensions_cancel">Ακύρωση</string>+ <string name="extensions_loading">Ανάγνωση…</string>+ <string name="extensions_error">Δεν εγκαταστάθηκε: %1$s</string>+ <string name="extensions_prompt_title_install">Εγκατάσταση του %1$s;</string>+ <string name="extensions_prompt_title_update">Ενημέρωση του %1$s;</string>+ <string name="extensions_prompt_by">%1$s · έκδοση %2$s · %3$s</string>+ <string name="extensions_prompt_source">Από %1$s</string>+ <string name="extensions_prompt_source_file">ένα αρχείο σε αυτό το τηλέφωνο</string>+ <string name="extensions_prompt_new">νέο σε αυτή την έκδοση</string>+ <string name="extensions_prompt_update_same_rights">%1$s → %2$s, με τα ίδια δικαιώματα.</string>+ <string name="extensions_prompt_not_newer">Η έκδοση %1$s (ή νεότερη) είναι ήδη εγκατεστημένη.</string>+ <string name="extensions_prompt_sha">sha256 του πακέτου: %1$s</string>+ <string name="extension_enabled">Ενεργή</string>+ <string name="extension_running">Εκτελείται</string>+ <string name="extension_not_running">Δεν εκτελείται</string>+ <string name="extension_turned_off">Το %1$s απενεργοποιήθηκε: %2$s</string>+ <string name="extension_last_error">Τελευταίο σφάλμα: %1$s</string>+ <string name="extension_disabled_reason">Απενεργοποιήθηκε: %1$s</string>+ <string name="extension_inactive">Ανενεργή</string>+ <string name="extension_inactive_detail">Ανενεργή: %1$s</string>+ <string name="extension_homepage">Αρχική σελίδα</string>+ <string name="extension_settings">Ρυθμίσεις</string>+ <string name="extension_log">Αρχείο καταγραφής</string>+ <string name="extension_log_empty">Δεν έχει καταγραφεί τίποτα ακόμη.</string>+ <string name="extension_log_clear">Εκκαθάριση καταγραφής</string>+ <string name="extension_update_file">Ενημέρωση από αρχείο</string>+ <string name="extension_uninstall">Απεγκατάσταση</string>+ <string name="extension_uninstall_confirm">Απεγκατάσταση του %1$s; Οι ρυθμίσεις του και ό,τι αποθήκευσε θα χαθούν μαζί του.</string>+ <string name="extension_confirm_title">Μια επέκταση ρωτά</string>+ <string name="extension_confirm_detail">Τίποτα δεν αλλάζει αν δεν το επιτρέψεις.</string>+ <string name="extension_confirm_allow">Να επιτραπεί</string>+ <string name="extension_confirm_refuse">Άρνηση</string>+ <string name="extensions_row_count">%1$d εγκατεστημένες, %2$d ενεργές</string>+ <string name="extensions_tab_store">Κατάστημα</string>+ <string name="extensions_search">Αναζήτηση επεκτάσεων</string>+ <string name="extensions_cat_all">Όλες</string>+ <string name="extensions_cat_lyrics">Στίχοι</string>+ <string name="extensions_cat_playback">Αναπαραγωγή και ήχος</string>+ <string name="extensions_cat_library">Βιβλιοθήκη</string>+ <string name="extensions_cat_discovery">Ανακάλυψη</string>+ <string name="extensions_cat_stats">Στατιστικά</string>+ <string name="extensions_cat_look">Εμφάνιση</string>+ <string name="extensions_cat_social">Κοινωνικά</string>+ <string name="extensions_cat_tools">Εργαλεία</string>+ <string name="extensions_cat_other">Άλλες</string>+ <string name="extensions_no_match">Καμία επέκταση δεν ταιριάζει.</string>+ <string name="extensions_browse_store">Περιήγηση στο κατάστημα</string>+ <string name="extensions_other_ways">Άλλοι τρόποι εγκατάστασης</string>+ <string name="extensions_empty_title">Τι είναι οι επεκτάσεις;</string>+ <string name="extensions_empty_body">Οι επεκτάσεις προσθέτουν στο Myspoti ό,τι δεν κάνει από μόνο του: στίχους από άλλες πηγές, από πού προέρχεται ο ήχος ή η λήψη ενός τραγουδιού, εργαλεία που χρησιμοποιούν τον λογαριασμό σου στο Spotify. Η καθεμία τρέχει σε απομονωμένο περιβάλλον και ρωτά πριν φτάσει οπουδήποτε. Πρόσθεσε ένα αποθετήριο για να τις περιηγηθείς ή εγκατάστησε ένα πακέτο που εμπιστεύεσαι.</string>+ <string name="extensions_official_badge">Επίσημο</string>+ <string name="extensions_repo_yours">Προστέθηκε από εσένα</string>+ <string name="extensions_repo_community">Κοινότητα</string>+ <string name="extensions_repo_official_note">Κάθε επέκταση ελέγχεται πριν μπει στη λίστα.</string>+ <string name="extensions_repo_yours_note">Δεν ελέγχεται από το Myspoti: εγκατάσταση με δική σου ευθύνη.</string>+ <string name="extensions_repo_error">Δεν ήταν δυνατή η ανάγνωση αυτού του αποθετηρίου: %1$s</string>+ <string name="extensions_repo_empty">Αυτό το αποθετήριο δεν περιέχει καμία επέκταση.</string>+ <string name="extensions_requires">Απαιτεί Myspoti %1$s ή νεότερο</string>+ <string name="extensions_requires_api">Φτιαγμένη για νεότερο Myspoti (API επεκτάσεων %1$d)</string>+ <string name="extensions_update_badge">Ενημέρωση</string>+ <string name="extensions_move_up">Μετακίνηση πάνω</string>+ <string name="extensions_move_down">Μετακίνηση κάτω</string>+ <string name="extension_off">Ανενεργή</string>+ <string name="extension_by">από %1$s</string>+ <string name="extension_changelog">Τι νέο υπάρχει</string>+ <string name="extension_update_from">Διαθέσιμη ενημέρωση: %1$s → %2$s</string>+ <string name="extension_not_listed">Αυτή η επέκταση δεν υπάρχει στα αποθετήριά σου (ή φορτώνουν ακόμη).</string>+ <string name="extension_details">Λεπτομέρειες</string>+ <string name="extension_detail_updated">Ενημερώθηκε</string>+ <string name="extension_detail_min_app">Χρειάζεται Myspoti</string>+ <string name="extension_detail_size">Μέγεθος</string>+ <string name="extension_detail_id">Id</string>+ <string name="extension_detail_sha">sha256 του πακέτου</string>+ <string name="extension_detail_source">Εγκαταστάθηκε από</string>+ <string name="extension_see_in_store">Προβολή στο κατάστημα</string>++ <!-- Actions: the closed catalogue, as the user reads it -->+ <string name="action_playback_control">Έλεγχος της αναπαραγωγής</string>+ <string name="action_playback_queue">Επεξεργασία της ουράς</string>+ <string name="action_playback_events">Γνώση του τι ακούς</string>+ <string name="action_lyrics_provide">Παροχή στίχων</string>+ <string name="action_trackinfo_provide">Προσθήκη λεπτομερειών τραγουδιών</string>+ <string name="action_audio_source">Αναπαραγωγή ήχου από αλλού</string>+ <string name="action_download_source">Παροχή λήψεων</string>+ <string name="action_home_sections">Προσθήκη ενοτήτων στην Αρχική</string>+ <string name="action_search_provide">Προσθήκη αποτελεσμάτων αναζήτησης</string>+ <string name="action_menu_items">Προσθήκη επιλογών στα μενού</string>+ <string name="action_player_buttons">Προσθήκη κουμπιών στο player</string>+ <string name="action_settings_page">Δικές της ρυθμίσεις</string>+ <string name="action_notify">Εμφάνιση σύντομων μηνυμάτων</string>+ <string name="action_library_read">Ανάγνωση της βιβλιοθήκης σου</string>+ <string name="action_library_write">Αλλαγή της βιβλιοθήκης σου</string>+ <string name="action_playlists_write">Επεξεργασία των playlist σου</string>+ <string name="action_spotify_catalog">Περιήγηση στο Spotify</string>+ <string name="action_spotify_raw">Πλήρης πρόσβαση στο Spotify</string>+ <string name="action_network">Χρήση του διαδικτύου</string>+ <string name="action_network_any">Χρήση οποιουδήποτε ιστότοπου</string>+ <string name="action_webview_page">Δική της ιστοσελίδα</string>+ <string name="action_storage">Αποθήκευση δικών της δεδομένων</string>+ <string name="action_unknown">Άγνωστο σε αυτό το Myspoti</string>+ <string name="action_critical">Κρίσιμη</string>+ <string name="action_no_why">(δεν δόθηκε λόγος)</string>+ <string name="actions_title">Τι κάνει</string>+ <string name="actions_critical_warning">Οι κρίσιμες ενέργειες μπορούν να αλλάξουν τον λογαριασμό σου, να αντικαταστήσουν την προέλευση των τραγουδιών ή να εμφανίσουν μια ελεύθερη ιστοσελίδα. Επίτρεψέ τες μόνο αν εμπιστεύεσαι τον δημιουργό: το Myspoti ρωτά πάντα πριν αφαιρεθεί οτιδήποτε.</string>+ <!-- Areas of the Installed tab -->+ <string name="area_playback">Αναπαραγωγή</string>+ <string name="area_lyrics">Στίχοι και πληροφορίες τραγουδιών</string>+ <string name="area_audio">Ήχος και λήψεις</string>+ <string name="area_home">Αρχική και αναζήτηση</string>+ <string name="area_menus">Μενού και player</string>+ <string name="area_library">Βιβλιοθήκη και Spotify</string>+ <string name="area_other">Σελίδες και άλλα</string>+ <string name="area_activity">Πρόσφατη δραστηριότητα</string>+ <string name="area_turn_off">Απενεργοποίηση</string>+ <string name="area_active">Ενεργή</string>+ <string name="area_idle">Σε αναμονή</string>+ <string name="area_make_active">Να είναι η βασική για: %1$s</string>+ <!-- Install prompt -->+ <string name="ext_third_party_notice">Επέκταση τρίτου, χωρίς έλεγχο από το Myspoti, με ευθύνη του δημιουργού της.</string>+ <string name="ext_risk_accept">Κατανοώ ότι αυτή η επέκταση είναι από τρίτο και την εγκαθιστώ με δική μου ευθύνη</string>+ <string name="ext_clash_exclusive">Αντικαθιστά το %1$s, που παρέχεται τώρα από το %2$s</string>+ <string name="ext_clash_conflict">Ασύμβατη με το %1$s (εγκατεστημένο)</string>+ <string name="ext_clash_replaces">Αντικαθιστά το %1$s (εγκατεστημένο)</string>+ <string name="ext_clash_keep_new">Χρήση του %1$s (η άλλη μένει εγκατεστημένη, %2$s)</string>+ <string name="ext_clash_keep_old">Διατήρηση του %1$s</string>+ <string name="ext_clash_idle">σε αναμονή</string>+ <string name="ext_clash_off">απενεργοποιημένη</string>+ <string name="ext_clash_title">Ποια να κρατήσεις;</string>+ <string name="ext_clash_ok">Τέλος</string>+ <!-- Blocks and pages -->+ <string name="ext_from">Από %1$s</string>+ <string name="ext_overflow">Επεκτάσεις</string>+ <string name="ext_open_page">Άνοιγμα της σελίδας της</string>+ <string name="ext_page_failed">Δεν ήταν δυνατή η εμφάνιση της σελίδας αυτής της επέκτασης.</string>+ <string name="ext_suspended_title">Το %1$s σε παύση</string>+ <string name="ext_suspended_body">Ακύρωνε συνεχώς ό,τι έκανε το %1$s με την αναπαραγωγή: οι εντολές αναπαραγωγής της έχουν ανασταλεί.</string>+ <string name="ext_suspended_keep">Να συνεχίσει</string>++ <!-- GitHub: discovery, ratings, reports -->+ <string name="extensions_github_title">Στο GitHub</string>+ <string name="extensions_github_note">Δημόσια αποθετήρια με το θέμα myspoti-extension, χωρίς έλεγχο: το καθένα είναι με ευθύνη του δημιουργού του.</string>+ <string name="extensions_show_all">Εμφάνιση όλων (%1$d κρυφές)</string>+ <string name="extensions_show_less">Απόκρυψη των αποκλεισμένων, αναφερμένων, χαμηλά βαθμολογημένων και εγκαταλελειμμένων</string>+ <string name="extension_rating">★ %1$s · %2$d ψήφοι</string>+ <string name="extension_rating_none">Καμία ψήφος ακόμη</string>+ <string name="extension_downloads">%1$s λήψεις</string>+ <string name="extension_rate_up">Θετική βαθμολογία</string>+ <string name="extension_rate_down">Αρνητική βαθμολογία</string>+ <string name="extension_rated">Ευχαριστούμε: η ψήφος σου είναι στο GitHub</string>+ <string name="extension_signin_title">Σύνδεση στο GitHub</string>+ <string name="extension_signin_body">Άνοιξε το %1$s και πληκτρολόγησε αυτόν τον κωδικό. Το Myspoti δεν βλέπει ποτέ τον κωδικό πρόσβασής σου.</string>+ <string name="extension_signin_open">Άνοιγμα του GitHub</string>+ <string name="extension_report">Αναφορά</string>+ <string name="extension_detail_github">GitHub</string>+ <string name="extension_detail_ref">Έκδοση στο GitHub</string>++ <!-- Updates from GitHub -->+ <string name="extension_check_updates">Έλεγχος για ενημερώσεις</string>+ <string name="extension_check_up_to_date">Ενημερωμένη</string>+ <string name="extension_check_applied">Ενημερώθηκε: δεν ζητά τίποτα νέο</string>+ <string name="extension_check_needs_ok">Μια ενημέρωση χρειάζεται την έγκρισή σου</string>+ <string name="extension_check_declined">Κράτησες αυτή την έκδοση</string>+ <string name="extension_check_incompatible">Η νέα έκδοση χρειάζεται νεότερο Myspoti</string>+ <string name="extension_check_blocked">Η νέα έκδοση είναι αποκλεισμένη από το Myspoti</string>+ <string name="extension_check_failed">Ο έλεγχος απέτυχε: δες το αρχείο καταγραφής της</string>+ <string name="extension_source_gone">Η πηγή χάθηκε: το αποθετήριό της δεν υπάρχει πια. Συνεχίζει να λειτουργεί από το αντίγραφο στο τηλέφωνό σου.</string>+ <string name="extension_revert">Επιστροφή στο %1$s</string>+ <string name="extension_reverted">Επιστροφή στο %1$s</string>+ <string name="extension_update_needs_ok">Η ενημέρωση χρειάζεται την έγκρισή σου: %1$s → %2$s</string>+ <string name="extension_update_needs_ok_body">Αυτή η έκδοση ζητά περισσότερα από όσα αποδέχτηκες. Η τρέχουσα συνεχίζει να λειτουργεί μέχρι να αποφασίσεις.</string>+ <string name="extension_update_accept">Αποδοχή</string>+ <string name="extension_update_keep">Διατήρηση της τρέχουσας</string>+ <string name="extension_refused_title">Περιμένει την έγκρισή σας</string>+ <string name="extension_refused_body">Εγκαταστάθηκε όταν οι ενέργειες μπορούσαν να αποεπιλεγούν, και κάποιες αποεπιλέχθηκαν. Πλέον μια επέκταση λαμβάνει όλες τις ενέργειες που δηλώνει: μένει απενεργοποιημένη μέχρι να τις αποδεχτείτε.</string>+ <string name="extension_change_action">Νέο: %1$s</string>+ <string name="extension_change_host">Νέος ιστότοπος: %1$s</string>+ <string name="extension_change_any_host">Οποιοσδήποτε ιστότοπος</string>+ <string name="extension_change_exclusive">Πλέον αποκλειστική: %1$s</string>+ <string name="extension_change_why">Νέος λόγος για: %1$s</string>+ <string name="extension_change_was">Ήταν: «%1$s»</string>+ <string name="extension_change_repo">Πλέον προέρχεται από %1$s (ήταν %2$s)</string>+ <string name="extension_change_author">Νέος δημιουργός: %1$s (ήταν %2$s)</string>+ <string name="extension_change_replaces">Απενεργοποιεί το %1$s όταν εγκατασταθεί</string>+ <string name="extension_change_conflicts">Αρνείται να λειτουργήσει μαζί με το %1$s</string>+ <string name="action_webview_auth">Σύνδεση σε ιστότοπο</string>+ <string name="extension_confirm_once">Να επιτραπεί μία φορά</string>+ <string name="extension_confirm_always">Πάντα να επιτρέπεται το %1$s</string>+ <string name="ext_auth_title">%1$s: σύνδεση</string>+ <string name="ext_auth_close">Κλείσιμο</string>+ <string name="ext_auth_notice">Δική της σελίδα: όσα πληκτρολογείτε και τα cookies της μένουν στο Myspoti. Η επέκταση λαμβάνει μόνο τη διεύθυνση στην οποία καταλήγει η σελίδα.</string>+ <string name="ext_grants_title">Πάντα επιτρεπόμενα</string>+ <string name="ext_grants_note">Αλλαγές στο Spotify που κάνει αυτή η επέκταση χωρίς να ρωτήσει. Ανακαλέστε μία για να ερωτάστε ξανά.</string>+ <string name="ext_grant_revoke">Ανάκληση</string>+</resources>diff --git a/base/app/src/main/res/values-el/myspoti_strings.xml b/base/app/src/main/res/values-el/myspoti_strings.xmlindex 59d2c137..f3cd0670 100644--- a/base/app/src/main/res/values-el/myspoti_strings.xml+++ b/base/app/src/main/res/values-el/myspoti_strings.xml@@ -1,20 +1,13 @@<?xml version="1.0" encoding="utf-8"?><!-- Myspoti's own texts (English default, French, Italian, Greek). --><resources>- <string name="welcome_tagline">Η μουσική σου, με συγχρονισμένους στίχους και επίσημα μουσικά βίντεο.</string><string name="welcome_lead">Η μουσική σου,</string><string name="welcome_rotate_ads">χωρίς διαφημίσεις.</string><string name="welcome_rotate_lyrics">με στίχους λέξη προς λέξη.</string><string name="welcome_rotate_clips">με τα επίσημα βίντεο.</string>- <string name="welcome_rotate_offline">ακόμα και εκτός σύνδεσης.</string>- <string name="welcome_rotate_lossless">σε ποιότητα χωρίς απώλειες.</string>+ <string name="welcome_rotate_offline">εκτός σύνδεσης, μέσω επεκτάσεων.</string><string name="welcome_login">Σύνδεση με Spotify</string><string name="welcome_privacy">Συνδέεσαι στη σελίδα του Spotify. Το Myspoti δεν βλέπει ποτέ τον κωδικό σου.</string>- <string name="crash_heading">Το Myspoti σταμάτησε να λειτουργεί</string>- <string name="crash_explanation">Κάτι πήγε στραβά. Κάνε επανεκκίνηση της εφαρμογής· αν ξανασυμβεί, αντίγραψε την αναφορά και μοιράσου την σε ένα ζήτημα στο GitHub.</string>- <string name="crash_restart_app">Επανεκκίνηση του Myspoti</string>- <string name="crash_copy_report">Αντιγραφή αναφοράς</string>- <string name="crash_report_copied">Η αναφορά αντιγράφηκε</string><string name="remove_from_liked">Κατάργηση από τα τραγούδια που σου αρέσουν</string><string name="repeat_on">Επανάληψη: ενεργή</string><string name="repeat_one">Επανάληψη ενός τραγουδιού</string>@@ -54,7 +47,6 @@<string name="background_playback_title">Αναπαραγωγή στο παρασκήνιο</string><string name="background_playback_on">Η βελτιστοποίηση μπαταρίας είναι απενεργοποιημένη: η μουσική και το Spotify Connect συνεχίζουν με την οθόνη σβηστή.</string><string name="background_playback_off">Απενεργοποίησε τη βελτιστοποίηση μπαταρίας, ώστε το Android να μην σταματά την εφαρμογή στο παρασκήνιο.</string>- <string name="crossfade_summary">Εξασθενίζει το τέλος ενός κομματιού και εισάγει το επόμενο (χωρίς επικάλυψη). Μόνο σε αυτό το τηλέφωνο.</string><plurals name="local_files_count"><item quantity="one">%d κομμάτι</item><item quantity="other">%d κομμάτια</item>@@ -71,11 +63,8 @@<string name="artist_not_found">Ο καλλιτέχνης δεν βρέθηκε</string><string name="playlist_not_found">Η playlist δεν βρέθηκε</string><string name="browse_new_releases">Νέες κυκλοφορίες</string>- <string name="browse_charts">Κατάταξη</string>- <string name="browse_workout">Προπόνηση</string>- <string name="browse_dance_electronic">Χορός/Ηλεκτρονική</string><string name="language_auto">Αυτόματη</string>- <string name="language_auto_detail">Η γλώσσα του τηλεφώνου σου, όταν το Myspoti τη διαθέτει (αγγλικά, γαλλικά, γερμανικά, ελληνικά, ισπανικά, ιταλικά, πορτογαλικά), αλλιώς αγγλικά</string>+ <string name="language_auto_detail">Η γλώσσα του τηλεφώνου σου, όταν το Myspoti τη διαθέτει (αγγλικά, γαλλικά, γερμανικά, ελληνικά, ισπανικά, ιταλικά, κινεζικά, πολωνικά, πορτογαλικά, ρωσικά), αλλιώς αγγλικά</string><string name="language_partial_note">Άλλες γλώσσες: οι ετικέτες του ίδιου του Spotify μεταφράζονται, τα κείμενα του Myspoti μένουν στα αγγλικά.</string><string name="restart_player_title">Επανεκκίνηση του player</string><string name="restart_player_detail">Αν η μουσική σταματήσει να ανταποκρίνεται: φορτώνει ξανά το player του Spotify</string>@@ -86,7 +75,6 @@<string name="local_rename">Μετονομασία</string><string name="local_delete_playlist">Διαγραφή playlist</string><string name="local_added_to">Προστέθηκε στο %1$s</string>- <string name="folder_create_failed">Δεν ήταν δυνατή η δημιουργία του φακέλου</string><string name="local_playlist_empty">Πρόσθεσε τραγούδια από τα Τοπικά αρχεία με το κουμπί + τους.</string><string name="playlist_change_refused">Το Spotify απέρριψε την αλλαγή σε αυτή την playlist</string><string name="download_kept_by_list">Εξακολουθεί να έχει ληφθεί: τη διατηρεί μια playlist που έχει ληφθεί</string>@@ -124,6 +112,7 @@<string name="library_reorder_hint">Κράτα πατημένη μια playlist και σύρε την για να τη μετακινήσεις</string><string name="library_reorder_reset">Επιστροφή στη σειρά του Spotify</string><string name="song_radio_failed">Δεν ήταν δυνατό το άνοιγμα του ραδιοφώνου αυτού του τραγουδιού</string>+ <string name="song_radio_name">Ραδιόφωνο: %1$s</string><string name="local_files_find_hint">Αναζήτηση στα Τοπικά αρχεία</string><string name="data_saver_title">Εξοικονόμηση δεδομένων</string><string name="data_saver_summary">Με δεδομένα κινητής, το Myspoti δεν χρησιμοποιεί δεδομένα: παίζουν μόνο τα ληφθέντα τραγούδια και τα Τοπικά αρχεία</string>@@ -152,13 +141,8 @@<string name="playback_speed">Ταχύτητα αναπαραγωγής</string><string name="recommended_songs">Προτεινόμενα τραγούδια</string><string name="jam_title">Jam</string>- <string name="jam_restricted">Το Spotify συνεχίζει να ξεκινά Jam μόνο για λογαριασμούς Premium. Μπορείς όμως να συμμετάσχεις σε ένα με σύνδεσμο.</string>- <string name="jam_join">Συμμετοχή σε Jam</string>- <string name="jam_join_hint">Επικόλλησε τον σύνδεσμο πρόσκλησης</string><string name="jam_leave">Αποχώρηση από το Jam</string><string name="jam_members">%1$d άτομα ακούνε</string>- <string name="pin">Καρφίτσωμα</string>- <string name="unpin">Ξεκαρφίτσωμα</string><string name="jam_start">Έναρξη Jam</string><string name="jam_invite">Κοινοποίηση συνδέσμου πρόσκλησης</string><string name="jam_failed">Το Spotify απέρριψε αυτό το Jam</string>@@ -195,27 +179,6 @@<string name="smart_shuffle_title">Έξυπνη τυχαία σειρά</string><string name="smart_shuffle_on">Έξυπνη τυχαία σειρά: οι προτάσεις του Spotify προστίθενται στην playlist με τυχαία σειρά.</string><string name="track_sort_added">Ημερομηνία προσθήκης</string>- <!-- Lossless (SpotiFLAC) downloads -->- <string name="spotiflac_row_title">Lossless λήψεις (FLAC)</string>- <string name="spotiflac_row_on">Επαληθευμένο — το Myspoti χρησιμοποιεί τους δικούς τους διακομιστές του SpotiFLAC.</string>- <string name="spotiflac_row_off">Μη επαληθευμένο — πάτα για να λύσεις τον μοναδικό έλεγχο.</string>- <string name="spotiflac_verify_title">Επαλήθευση SpotiFLAC</string>- <string name="spotiflac_verify_start_failed">Δεν ήταν δυνατή η έναρξη της επαλήθευσης. Πάτα Δοκίμασε ξανά ή επέστρεψε αργότερα.</string>- <string name="spotiflac_verify_timeout">Η επαλήθευση έληξε. Πάτα Δοκίμασε ξανά ή Παράλειψη προς το παρόν.</string>- <string name="spotiflac_verify_rejected">Η επαλήθευση απορρίφθηκε. Πάτα Δοκίμασε ξανά ή Παράλειψη προς το παρόν.</string>- <string name="spotiflac_session_ok">Η συνεδρία SpotiFLAC αποθηκεύτηκε</string>- <string name="spotiflac_session_creating">Δημιουργία ασφαλούς συνεδρίας…</string>- <string name="spotiflac_session_failed">Δεν ήταν δυνατή η ολοκλήρωση της επαλήθευσης. Πάτα Δοκίμασε ξανά ή Παράλειψη προς το παρόν.</string>- <string name="spotiflac_skip">Παράλειψη προς το παρόν</string>- <string name="retry">Δοκίμασε ξανά</string>- <string name="spotiflac_status_title">SpotiFLAC</string>- <string name="spotiflac_status_verified">Είσαι επαληθευμένος: οι λήψεις περνούν από τους δικούς τους διακομιστές του SpotiFLAC, την πιο αξιόπιστη lossless πηγή. Χρησιμοποιείται μόνο αυτή η συνεδρία — κανένας λογαριασμός, τίποτε άλλο δεν αποθηκεύεται.</string>- <string name="spotiflac_session_expires">Συνεδρία έγκυρη έως %1$s</string>- <string name="spotiflac_forget">Ξέχασε αυτή τη συνεδρία</string>- <string name="lossless_hires_title">Λήψεις Hi-Res (24-bit)</string>- <string name="lossless_hires_detail">Ένα κομμάτι αποθηκεύεται σε 24-bit hi-res όταν η πηγή το έχει. Τα αρχεία είναι περίπου τρεις φορές μεγαλύτερα από την ποιότητα CD.</string>- <string name="setup_spotiflac_title">Lossless λήψεις (FLAC)</string>- <string name="setup_spotiflac_detail">Επαλήθευσε μία φορά με το SpotiFLAC, ώστε οι λήψεις να έρχονται από τους lossless διακομιστές του.</string><string name="settings_title">Ρυθμίσεις</string><string name="settings_detail">Ποιότητα ήχου, λήψεις, δεδομένα, μπαταρία και γλώσσα</string><string name="settings_section_playback">Αναπαραγωγή</string>@@ -244,7 +207,6 @@<string name="setup_quality_subtitle">Επίλεξε πώς παίζει και αποθηκεύει το Myspoti τη μουσική σου. Μπορείς να την αλλάξεις αργότερα στις Ρυθμίσεις.</string><string name="downloads_off_toast">Οι λήψεις είναι απενεργοποιημένες. Ενεργοποίησέ τες στις Ρυθμίσεις.</string><string name="quality_streaming_high_detail">160 kbit/s, ο καλύτερος ήχος</string>- <string name="downloads_verify_hint">Καμία lossless πηγή δεν απάντησε. Επαλήθευσε μία φορά το SpotiFLAC στις Ρυθμίσεις, Λήψεις: οι διακομιστές του είναι οι αξιόπιστοι.</string><string name="quality_download_small">Μικρότερη</string><string name="quality_download_small_detail">AAC 96 kbit/s, η ελαφρύτερη: περίπου 3 MB ανά τραγούδι</string><string name="settings_solid_nav_title">Συμπαγής κάτω μπάρα</string>@@ -254,14 +216,12 @@<string name="quality_sheet_title">Ποιότητα ήχου</string><string name="quality_now">Παίζει τώρα: %1$s</string><string name="quality_now_unknown">Ακόμα άγνωστο: ξεκίνα ένα τραγούδι</string>- <string name="spotiflac_verify_in_browser">Λύσε τον έλεγχο στην καρτέλα του προγράμματος περιήγησης που άνοιξε, και μετά επέστρεψε εδώ.</string><string name="update_downloading">Λήψη… %1$d%%</string><string name="update_installing">Εγκατάσταση…</string><string name="update_needs_permission">Για να ενημερωθείς, επίτρεψε στο Myspoti να εγκαθιστά εφαρμογές και μετά επέστρεψε εδώ.</string><string name="update_allow">Επίτρεψε</string><string name="update_failed">Η ενημέρωση απέτυχε: %1$s</string><string name="update_retry">Δοκίμασε ξανά</string>- <string name="downloads_verify_banner">Οι λήψεις χρειάζονται μία επαλήθευση SpotiFLAC σε αυτή την εφαρμογή. Πάτα εδώ για να την κάνεις.</string><string name="removed_from">Αφαιρέθηκε από το %1$s</string><string name="done">Τέλος</string><string name="playlist_edit_details">Επεξεργασία λεπτομερειών</string>@@ -271,14 +231,6 @@<string name="playlist_remove_cover">Κατάργηση εξωφύλλου</string><string name="playlist_save">Αποθήκευση</string><string name="playlist_access_title">Ποιος μπορεί να τη δει</string>- <string name="playlist_access_public">Δημόσια</string>- <string name="playlist_access_public_detail">Όποιος μπορεί να τη βρει και να την παίξει</string>- <string name="playlist_access_private">Ιδιωτική</string>- <string name="playlist_access_private_detail">Μόνο εσύ μπορείς να τη δεις</string>- <string name="playlist_access_collaborative">Συνεργατική</string>- <string name="playlist_access_collaborative_detail">Μόνο όσοι προσκαλείς μπορούν να προσθέτουν και να αφαιρούν τραγούδια</string>- <string name="playlist_on_profile">Στο προφίλ σου</string>- <string name="playlist_on_profile_detail">Εμφανίζεται στο προφίλ σου για τους άλλους</string><string name="choose_artist">Επίλεξε καλλιτέχνη</string><string name="quality_streaming_wifi_title">Ροή μέσω Wi-Fi</string><string name="quality_streaming_cell_title">Ροή με δεδομένα κινητής</string>@@ -316,13 +268,13 @@<string name="library_sort_recently_added">Πρόσφατα προστέθηκαν</string><string name="library_change_failed">Δεν ήταν δυνατή η ενημέρωση της Βιβλιοθήκης σου, δοκίμασε ξανά</string><string name="a11y_close_player">Κλείσιμο του player</string>- <string name="a11y_devices">Συσκευές</string><string name="a11y_share">Κοινοποίηση</string><string name="search_failed">Η αναζήτηση απέτυχε. Έλεγξε τη σύνδεσή σου.</string><string name="retry_button">Δοκίμασε ξανά</string><string name="page_load_failed">Δεν φορτώθηκε αυτή η σελίδα.\nΈλεγξε τη σύνδεσή σου και δοκίμασε ξανά.</string><string name="jam_paste_link">Συμμετοχή με αντιγραμμένο σύνδεσμο</string><string name="play_refused">Το Spotify απέρριψε την αναπαραγωγή αυτού στον λογαριασμό σου. Οι δωρεάν λογαριασμοί σε ορισμένες χώρες μπορούν να παίζουν μόνο με τυχαία σειρά: δοκίμασε το κουμπί τυχαίας σειράς.</string>+ <string name="play_refused_all">Το Spotify αρνείται αυτή τη στιγμή κάθε εντολή αυτού του player στον λογαριασμό σου (αναπαραγωγή, μετακίνηση, μεταφορά). Το player φορτώθηκε ξανά μία φορά. Αν δεν παίξει τίποτα, κλείσε εντελώς την εφαρμογή και άνοιξέ την ξανά ή εναλλάξε μεταξύ Wi-Fi και δεδομένων κινητής.</string><string name="artist_liked_songs">Τραγούδια που σου αρέσουν</string><plurals name="artist_liked_songs_count"><item quantity="one">%1$d τραγούδι από %2$s</item>@@ -337,7 +289,6 @@<string name="settings_rotation_auto">Αυτόματη</string><string name="settings_rotation_landscape">Οριζόντια</string><string name="support_github_action">Χορηγία στο GitHub</string>- <string name="spotiflac_verify_again">Η επαλήθευση του SpotiFLAC έληξε: κάν’ την ξανά στις Ρυθμίσεις για λήψη χωρίς απώλειες</string><string name="download_on_mobile_data">Λήψη με δεδομένα κινητής: χρησιμοποιεί το πακέτο δεδομένων σου</string><string name="restart_player_done">Η αναπαραγωγή ξεκίνησε ξανά</string><string name="spotify_limited">Το Spotify περιορίζει προσωρινά την αναπαραγωγή. Δοκιμάστε ξανά σε ένα λεπτό.</string>@@ -356,7 +307,6 @@<string name="blend_deleted">Αυτό το Blend διαγράφηκε</string><string name="blend_working">Σε εξέλιξη…</string><string name="blend_invited_by">Ο/Η %1$s σε προσκαλεί σε ένα Blend</string>- <string name="blend_open">Άνοιγμα του Blend</string><string name="blend_later">Όχι τώρα</string><string name="blend_members">Μέλη</string><string name="blend_invite_more">Πρόσκληση περισσότερων ατόμων</string>@@ -375,7 +325,6 @@<string name="diagnostic_export_title">Εξαγωγή αναφοράς διαγνωστικών</string><string name="diagnostic_export_detail">Μοιράζεται το πρόσφατο αρχείο καταγραφής της εφαρμογής και τα στοιχεία της συσκευής</string><string name="diagnostic_export_failed">Δεν ήταν δυνατή η εγγραφή της αναφοράς διαγνωστικών</string>- <string name="recently_played_title">Πρόσφατα αναπαραγωγής</string><string name="recently_played_empty">Ό,τι παίζεις σε αυτόν τον λογαριασμό εμφανίζεται εδώ.</string><string name="recently_played_failed">Δεν ήταν δυνατή η φόρτωση της λίστας πρόσφατων αναπαραγωγών (%1$s)</string><string name="recents_title">Πρόσφατα</string>@@ -418,11 +367,8 @@<string name="show_sort_chapters_newest">Όλα τα κεφάλαια • Νεότερα</string><string name="show_sort_chapters_oldest">Όλα τα κεφάλαια • Παλαιότερα</string><string name="show_empty">Δεν υπάρχει ακόμα τίποτα προς αναπαραγωγή εδώ</string>- <string name="show_rating">%1$s (%2$s)</string><string name="show_authors">Από %1$s</string><string name="show_narrators">Αφήγηση: %1$s</string>- <string name="show_followed">Ακολουθείς πλέον αυτό το podcast</string>- <string name="show_unfollowed">Δεν ακολουθείς πλέον αυτό το podcast</string><string name="episode_duration_min">%1$d λεπτ.</string><string name="episode_remaining">Απομένουν %1$s</string><string name="episode_mark_played">Σήμανση ως ακουσμένο</string>@@ -435,20 +381,14 @@<string name="episode_show_more">εμφάνιση περισσότερων</string><string name="episode_show_less">εμφάνιση λιγότερων</string><string name="episode_download">Λήψη</string>- <string name="episode_downloading">Λήψη…</string>- <string name="episode_downloaded">Ελήφθη</string><string name="episode_download_remove">Κατάργηση λήψης</string><string name="episode_options">Επιλογές επεισοδίου</string><string name="episode_not_found">Το επεισόδιο δεν βρέθηκε</string>- <string name="show_not_found">Το podcast δεν βρέθηκε</string><string name="podcast_playing_from">Αναπαραγωγή από το podcast</string><string name="player_speed_chip">%1$s×</string><string name="player_back_15">Πίσω 15 δευτερόλεπτα</string><string name="player_forward_15">Μπροστά 15 δευτερόλεπτα</string>- <string name="player_show_remaining">Εμφάνιση του υπολειπόμενου χρόνου</string>- <string name="player_show_elapsed">Εμφάνιση του χρόνου που πέρασε</string><string name="player_sleep_timer">Χρονοδιακόπτης ύπνου</string>- <string name="player_speed_a11y">Ταχύτητα αναπαραγωγής, %1$s×</string><string name="settings_keep_playing_title">Συνέχιση αναπαραγωγής μετά το κλείσιμο</string><string name="settings_keep_playing_detail">Απενεργοποιημένο: το κλείσιμο του Myspoti από τις πρόσφατες εφαρμογές σταματά τη μουσική</string><string name="recommended_songs_from_name">Με βάση το όνομα αυτής της playlist</string>@@ -469,8 +409,6 @@<string name="link_copied">Ο σύνδεσμος αντιγράφηκε</string><string name="lyrics_meaning_title">Σημασία</string><string name="lyrics_meaning_about">Σχετικά</string>- <string name="lyrics_meaning_lines">Οι στίχοι εξηγημένοι</string>- <string name="lyrics_meaning_source">Από το Genius · άνοιγμα του τραγουδιού εκεί</string><string name="lyrics_meaning_translating">Μετάφραση…</string><string name="lyrics_meaning_translate">Μετάφραση</string><string name="lyrics_meaning_original">Δες το πρωτότυπο</string>diff --git a/base/app/src/main/res/values-el/spotify_strings.xml b/base/app/src/main/res/values-el/spotify_strings.xmlindex 4f178174..c89f23d0 100644--- a/base/app/src/main/res/values-el/spotify_strings.xml+++ b/base/app/src/main/res/values-el/spotify_strings.xml@@ -17,7 +17,6 @@<string name="snackbar_added_to_liked_songs" formatted="false">Προστέθηκε στα τραγούδια που σου αρέσουν.</string><string name="snackbar_removed_from_liked_songs" formatted="false">Καταργήθηκε από τα τραγούδια που σου αρέσουν.</string><string name="content_description_context_menu" formatted="false">Περισσότερες επιλογές</string>- <string name="close_button_content_description" formatted="false">Κλείσιμο</string><string name="add_to_playlist_saved_in_section_header" formatted="false">Αποθηκευμένο σε</string><string name="add_to_playlist_new_playlist_button_text" formatted="false">Δημιουργία νέας playlist</string><string name="add_to_playlist_button_cancel" formatted="false">Ακύρωση</string>@@ -25,8 +24,6 @@<string name="lyrics_card_title" formatted="false">Στίχοι</string><string name="lyrics_card_title_preview" formatted="false">Προεπισκόπηση στίχων</string><string name="lyrics_card_show_lyrics_button" formatted="false">Εμφάνιση στίχων</string>- <string name="lyrics_card_expand_button_content_description" formatted="false">Προβολή στίχων σε πλήρη οθόνη</string>- <string name="lyrics_card_share_button_content_description" formatted="false">Κοινοποίηση στίχων</string><string name="lyrics_credential_note" formatted="false">Οι στίχοι παρέχονται από %1$s</string><string name="lyrics_fullscreen_chip_label_share" formatted="false">Κοινοποίηση</string><string name="lyrics_fullscreen_chip_label_translate" formatted="false">Μετάφραση</string>@@ -49,7 +46,6 @@<string name="artist_popular_tracks" formatted="false">Δημοφιλή</string><string name="curation_button_follow_state_text" formatted="false">Ακολούθησε</string><string name="curation_button_following_state_text" formatted="false">Ακολουθείς</string>- <string name="search_main_entity_subtitle_artist" formatted="false">Καλλιτέχνης</string><string name="connect_phone_is_self" formatted="false">Αυτό το τηλέφωνο</string><string name="settings_item_canvas_title" formatted="false">Canvas</string><string name="video_settings_canvas_subtitle" formatted="false">Σύντομα, επαναλαμβανόμενα οπτικά στοιχεία κατά την αναπαραγωγή ενός τραγουδιού.</string>@@ -107,8 +103,6 @@<string name="library_search_text_hint" formatted="false">Αναζήτηση στη Βιβλιοθήκη σου</string><string name="account_title" formatted="false">Λογαριασμός</string><string name="song_dna_search_chip_followed_artists" formatted="false">Καλλιτέχνες που ακολουθείς</string>- <string name="settings_item_crossfade_title" formatted="false">Crossfade</string>- <string name="playback_settings_crossfade_slider_seconds" formatted="false">%1$d δευτ.</string><string name="local_files_title" formatted="false">Τοπικά αρχεία</string><string name="local_files_empty_section_title" formatted="false">Πρόσθεσε τα δικά σου αρχεία ήχου στη Βιβλιοθήκη σου</string><string name="local_files_empty_section_subtitle" formatted="false">Έχεις ένα τραγούδι ή ένα προσωπικό podcast που δεν υπάρχει στο Spotify;</string>@@ -138,14 +132,10 @@<string name="assisted_curation_search_filter_artists" formatted="false">Καλλιτέχνες</string><string name="assisted_curation_search_filter_albums" formatted="false">Άλμπουμ</string><string name="assisted_curation_search_filter_playlists" formatted="false">Playlist</string>- <string name="assisted_curation_search_filter_clear_content_description" formatted="false">Διάγραψε το φίλτρο</string>- <string name="ad_category_title_music" formatted="false">Μουσική</string>- <string name="made_for_you_hub_title" formatted="false">Δημιουργήθηκε για εσένα</string><string name="settings_item_app_language_title" formatted="false">Γλώσσα εφαρμογής</string><string name="create_menu_item_folder_title" formatted="false">Φάκελος</string><string name="create_folder_name_suggested_folder_name" formatted="false">Νέος φάκελος</string><string name="context_menu_rename_folder" formatted="false">Μετονομασία φακέλου</string>- <string name="your_library_messaging_folder_rename_hint" formatted="false">Όνομα φακέλου</string><string name="create_playlist_content_description" formatted="false">Δημιουργία playlist</string><string name="actions_picker_delete" formatted="false">Διαγραφή</string><string name="filter_and_sort_sort_section_title" formatted="false">Ταξινόμηση κατά</string>diff --git a/base/app/src/main/res/values-el/strings.xml b/base/app/src/main/res/values-el/strings.xmlindex 7ffb5139..6248e256 100644--- a/base/app/src/main/res/values-el/strings.xml+++ b/base/app/src/main/res/values-el/strings.xml@@ -4,37 +4,17 @@<string name="aa_playlists">Playlist</string><string name="aa_albums">Άλμπουμ</string><string name="aa_artists">Καλλιτέχνες</string>- <string name="aa_podcasts">Podcast</string><string name="settings_amoled_theme">Θέμα AMOLED</string><string name="settings_amoled_theme_subtitle">Μαύρο φόντο για εξοικονόμηση μπαταρίας</string>- <string name="settings_lyrics_style_spotify_default">Προεπιλογή Spotify</string>- <string name="settings_lyrics_style_fullscreen">Πλήρης οθόνη (χρώματα άλμπουμ)</string>- <string name="settings_lyrics_style_compact">Συμπαγές</string>- <string name="settings_lyrics_style_karaoke">Καραόκε</string>- <string name="settings_lyrics_style_bold">Μεγάλο έντονο</string><string name="main_update_available">Υπάρχει νέα ενημέρωση</string>- <string name="notif_channel_media_name">Αναπαραγωγή πολυμέσων</string>- <string name="notif_channel_media_description">Χειριστήρια αναπαραγωγής πολυμέσων του Myspoti</string>- <string name="notif_action_previous">Προηγούμενο</string>- <string name="notif_action_next">Επόμενο</string><string name="notif_action_play">Αναπαραγωγή</string><string name="notif_action_pause">Παύση</string><string name="notif_shuffle_enable">Ενεργοποίηση τυχαίας σειράς</string><string name="notif_shuffle_disable">Απενεργοποίηση τυχαίας σειράς</string><string name="notif_shuffle_disable_smart">Απενεργοποίηση έξυπνης τυχαίας σειράς</string>- <string name="notif_action_like">Μου αρέσει</string>- <string name="notif_action_unlike">Δεν μου αρέσει πια</string>- <string name="notif_unknown_name">Άγνωστο</string>- <string name="notif_by_artist">από %1$s</string>- <string name="notif_repeat_disable">Απενεργοποίηση επανάληψης</string>- <string name="notif_repeat_disable_one">Απενεργοποίηση επανάληψης ενός τραγουδιού</string>- <string name="notif_repeat_enable">Ενεργοποίηση επανάληψης</string>- <string name="bridge_player_unlocked">Το player ξεκλειδώθηκε</string>- <string name="bridge_reloading">Επαναφόρτωση…</string>- <string name="service_disabled_message">Η υπηρεσία δεν είναι ενεργοποιημένη</string><string name="energy_saver_title" tools:ignore="MissingTranslation">Εξοικονόμηση ενέργειας</string><string name="energy_saver_summary" tools:ignore="MissingTranslation">Χωρίς Canvas, ελαφρύτερα βίντεο και κινούμενα σχέδια</string><string name="video_fullscreen_enter" tools:ignore="MissingTranslation">Μετάβαση σε πλήρη οθόνη</string>@@ -42,4 +22,5 @@<string name="playback_seek_description" tools:ignore="MissingTranslation">Θέση αναπαραγωγής</string><string name="account_page_title">Λογαριασμός Spotify</string><string name="account_page_detail">Πρόγραμμα, απόρρητο και συσκευές, στο spotify.com</string>+ <string name="player_source_downloaded">Έχει ληφθεί</string></resources>diff --git a/base/app/src/main/res/values-en-rGB/spotify_strings.xml b/base/app/src/main/res/values-en-rGB/spotify_strings.xmlindex f5d7e020..7f023585 100644--- a/base/app/src/main/res/values-en-rGB/spotify_strings.xml+++ b/base/app/src/main/res/values-en-rGB/spotify_strings.xml@@ -17,7 +17,6 @@<string name="snackbar_added_to_liked_songs" formatted="false">Added to Liked Songs.</string><string name="snackbar_removed_from_liked_songs" formatted="false">Removed from Liked Songs.</string><string name="content_description_context_menu" formatted="false">More options</string>- <string name="close_button_content_description" formatted="false">Close</string><string name="add_to_playlist_saved_in_section_header" formatted="false">Saved in</string><string name="add_to_playlist_new_playlist_button_text" formatted="false">New playlist</string><string name="add_to_playlist_button_cancel" formatted="false">Cancel</string>@@ -25,8 +24,6 @@<string name="lyrics_card_title" formatted="false">Lyrics</string><string name="lyrics_card_title_preview" formatted="false">Lyrics preview</string><string name="lyrics_card_show_lyrics_button" formatted="false">Show lyrics</string>- <string name="lyrics_card_expand_button_content_description" formatted="false">Open full screen lyrics</string>- <string name="lyrics_card_share_button_content_description" formatted="false">Share lyrics</string><string name="lyrics_credential_note" formatted="false">Lyrics provided by %1$s</string><string name="lyrics_fullscreen_chip_label_share" formatted="false">Share</string><string name="lyrics_fullscreen_chip_label_translate" formatted="false">Translate</string>@@ -49,7 +46,6 @@<string name="artist_popular_tracks" formatted="false">Popular</string><string name="curation_button_follow_state_text" formatted="false">Follow</string><string name="curation_button_following_state_text" formatted="false">Following</string>- <string name="search_main_entity_subtitle_artist" formatted="false">Artist</string><string name="connect_phone_is_self" formatted="false">This phone</string><string name="settings_item_canvas_title" formatted="false">Canvas</string><string name="video_settings_canvas_subtitle" formatted="false">Short, looping visuals when a song is playing.</string>@@ -107,8 +103,6 @@<string name="library_search_text_hint" formatted="false">Search Your Library</string><string name="account_title" formatted="false">Account</string><string name="song_dna_search_chip_followed_artists" formatted="false">Followed artists</string>- <string name="settings_item_crossfade_title" formatted="false">Crossfade</string>- <string name="playback_settings_crossfade_slider_seconds" formatted="false">%1$d s</string><string name="local_files_title" formatted="false">Local Files</string><string name="local_files_empty_section_title" formatted="false">Add your own audio files to Your Library</string><string name="local_files_empty_section_subtitle" formatted="false">Got a song or personal podcast that’s not on Spotify?</string>@@ -138,14 +132,10 @@<string name="assisted_curation_search_filter_artists" formatted="false">Artists</string><string name="assisted_curation_search_filter_albums" formatted="false">Albums</string><string name="assisted_curation_search_filter_playlists" formatted="false">Playlists</string>- <string name="assisted_curation_search_filter_clear_content_description" formatted="false">Clear filter</string>- <string name="ad_category_title_music" formatted="false">Music</string>- <string name="made_for_you_hub_title" formatted="false">Made for You</string><string name="settings_item_app_language_title" formatted="false">App language</string><string name="create_menu_item_folder_title" formatted="false">Folder</string><string name="create_folder_name_suggested_folder_name" formatted="false">New folder</string><string name="context_menu_rename_folder" formatted="false">Rename folder</string>- <string name="your_library_messaging_folder_rename_hint" formatted="false">Folder name</string><string name="create_playlist_content_description" formatted="false">Create playlist</string><string name="actions_picker_delete" formatted="false">Delete</string><string name="filter_and_sort_sort_section_title" formatted="false">Sort by</string>diff --git a/base/app/src/main/res/values-es-rAR/spotify_strings.xml b/base/app/src/main/res/values-es-rAR/spotify_strings.xmlindex 636d3c1e..83aa22e9 100644--- a/base/app/src/main/res/values-es-rAR/spotify_strings.xml+++ b/base/app/src/main/res/values-es-rAR/spotify_strings.xml@@ -13,7 +13,6 @@<string name="snackbar_added_to_liked_songs" formatted="false">Se agregó a Tus me gusta.</string><string name="snackbar_removed_from_liked_songs" formatted="false">Se eliminó de Tus me gusta.</string><string name="content_description_context_menu" formatted="false">Más opciones</string>- <string name="close_button_content_description" formatted="false">Cerrar</string><string name="add_to_playlist_saved_in_section_header" formatted="false">Guardado en</string><string name="add_to_playlist_new_playlist_button_text" formatted="false">Nueva playlist</string><string name="add_to_playlist_button_cancel" formatted="false">Cancelar</string>@@ -21,8 +20,6 @@<string name="lyrics_card_title" formatted="false">Letras</string><string name="lyrics_card_title_preview" formatted="false">Vista previa de la letra</string><string name="lyrics_card_show_lyrics_button" formatted="false">Mostrar la letra</string>- <string name="lyrics_card_expand_button_content_description" formatted="false">Abrir la letra en pantalla completa</string>- <string name="lyrics_card_share_button_content_description" formatted="false">Compartí la letra</string><string name="lyrics_credential_note" formatted="false">Letras proporcionadas por %1$s</string><string name="lyrics_fullscreen_chip_label_share" formatted="false">Compartir</string><string name="lyrics_fullscreen_chip_label_translate" formatted="false">Traducir</string>@@ -45,7 +42,6 @@<string name="artist_popular_tracks" formatted="false">Populares</string><string name="curation_button_follow_state_text" formatted="false">Seguir</string><string name="curation_button_following_state_text" formatted="false">Siguiendo</string>- <string name="search_main_entity_subtitle_artist" formatted="false">Artista</string><string name="connect_phone_is_self" formatted="false">Este teléfono</string><string name="settings_item_canvas_title" formatted="false">Canvas</string><string name="video_settings_canvas_subtitle" formatted="false">Efectos visuales breves y en repetición cuando se reproduce una canción.</string>@@ -95,8 +91,6 @@<string name="library_search_text_hint" formatted="false">Buscá en Tu biblioteca</string><string name="account_title" formatted="false">Cuenta</string><string name="song_dna_search_chip_followed_artists" formatted="false">Artistas que seguís</string>- <string name="settings_item_crossfade_title" formatted="false">Crossfade</string>- <string name="playback_settings_crossfade_slider_seconds" formatted="false">%1$d s</string><string name="local_files_empty_section_title" formatted="false">Agregá tus propios archivos de audio a Tu biblioteca</string><string name="local_files_empty_section_subtitle" formatted="false">¿Tenés una canción o un podcast personal que no está en Spotify?</string><string name="local_files_empty_section_no_files_title" formatted="false">Tus archivos de audio van a aparecer acá</string>@@ -125,14 +119,10 @@<string name="assisted_curation_search_filter_artists" formatted="false">Artistas</string><string name="assisted_curation_search_filter_albums" formatted="false">Álbumes</string><string name="assisted_curation_search_filter_playlists" formatted="false">Playlists</string>- <string name="assisted_curation_search_filter_clear_content_description" formatted="false">Eliminar filtro</string>- <string name="ad_category_title_music" formatted="false">Música</string>- <string name="made_for_you_hub_title" formatted="false">Creado para vos</string><string name="settings_item_app_language_title" formatted="false">Idioma de la aplicación</string><string name="create_menu_item_folder_title" formatted="false">Carpeta</string><string name="create_folder_name_suggested_folder_name" formatted="false">Nueva carpeta</string><string name="context_menu_rename_folder" formatted="false">Renombrar la carpeta</string>- <string name="your_library_messaging_folder_rename_hint" formatted="false">Nombre de la carpeta</string><string name="create_playlist_content_description" formatted="false">Crear una playlist</string><string name="actions_picker_delete" formatted="false">Eliminar</string><string name="filter_and_sort_sort_section_title" formatted="false">Ordenar por</string>diff --git a/base/app/src/main/res/values-es-rMX/spotify_strings.xml b/base/app/src/main/res/values-es-rMX/spotify_strings.xmlindex b28c0386..b5016ec9 100644--- a/base/app/src/main/res/values-es-rMX/spotify_strings.xml+++ b/base/app/src/main/res/values-es-rMX/spotify_strings.xml@@ -13,7 +13,6 @@<string name="snackbar_added_to_liked_songs" formatted="false">Se agregó a Tus me gusta.</string><string name="snackbar_removed_from_liked_songs" formatted="false">Se eliminó de Tus me gusta.</string><string name="content_description_context_menu" formatted="false">Más opciones</string>- <string name="close_button_content_description" formatted="false">Cerrar</string><string name="add_to_playlist_saved_in_section_header" formatted="false">Guardado en</string><string name="add_to_playlist_new_playlist_button_text" formatted="false">Nueva playlist</string><string name="add_to_playlist_button_cancel" formatted="false">Cancelar</string>@@ -21,8 +20,6 @@<string name="lyrics_card_title" formatted="false">Letra</string><string name="lyrics_card_title_preview" formatted="false">Muestra de la letra</string><string name="lyrics_card_show_lyrics_button" formatted="false">Mostrar la letra</string>- <string name="lyrics_card_expand_button_content_description" formatted="false">Abrir la letra en pantalla completa</string>- <string name="lyrics_card_share_button_content_description" formatted="false">Compartir la letra</string><string name="lyrics_credential_note" formatted="false">Letras proporcionadas por %1$s</string><string name="lyrics_fullscreen_chip_label_share" formatted="false">Compartir</string><string name="lyrics_fullscreen_chip_label_translate" formatted="false">Traducir</string>@@ -45,7 +42,6 @@<string name="artist_popular_tracks" formatted="false">Populares</string><string name="curation_button_follow_state_text" formatted="false">Seguir</string><string name="curation_button_following_state_text" formatted="false">Siguiendo</string>- <string name="search_main_entity_subtitle_artist" formatted="false">Artista</string><string name="connect_phone_is_self" formatted="false">Este teléfono</string><string name="settings_item_canvas_title" formatted="false">Canvas</string><string name="video_settings_canvas_subtitle" formatted="false">Efectos visuales breves y en repetición cuando se reproduce una canción.</string>@@ -95,8 +91,6 @@<string name="library_search_text_hint" formatted="false">Busca en Tu biblioteca</string><string name="account_title" formatted="false">Cuenta</string><string name="song_dna_search_chip_followed_artists" formatted="false">Artistas seguidos</string>- <string name="settings_item_crossfade_title" formatted="false">Crossfade</string>- <string name="playback_settings_crossfade_slider_seconds" formatted="false">%1$d s</string><string name="local_files_empty_section_title" formatted="false">Agrega tus propios archivos de audio a Tu biblioteca</string><string name="local_files_empty_section_subtitle" formatted="false">¿Tienes una canción o un podcast personal que no está en Spotify?</string><string name="local_files_empty_section_no_files_title" formatted="false">Tus archivos de audio aparecerán aquí</string>@@ -125,14 +119,10 @@<string name="assisted_curation_search_filter_artists" formatted="false">Artistas</string><string name="assisted_curation_search_filter_albums" formatted="false">Álbumes</string><string name="assisted_curation_search_filter_playlists" formatted="false">Playlists</string>- <string name="assisted_curation_search_filter_clear_content_description" formatted="false">Eliminar filtro</string>- <string name="ad_category_title_music" formatted="false">Música</string>- <string name="made_for_you_hub_title" formatted="false">Creado para ti</string><string name="settings_item_app_language_title" formatted="false">Idioma de la aplicación</string><string name="create_menu_item_folder_title" formatted="false">Carpeta</string><string name="create_folder_name_suggested_folder_name" formatted="false">Nueva carpeta</string><string name="context_menu_rename_folder" formatted="false">Renombrar la carpeta</string>- <string name="your_library_messaging_folder_rename_hint" formatted="false">Nombre de la carpeta</string><string name="create_playlist_content_description" formatted="false">Crear una playlist</string><string name="actions_picker_delete" formatted="false">Eliminar</string><string name="filter_and_sort_sort_section_title" formatted="false">Ordenar por</string>diff --git a/base/app/src/main/res/values-es/extensions_strings.xml b/base/app/src/main/res/values-es/extensions_strings.xmlnew file mode 100644index 00000000..aaedf9cc--- /dev/null+++ b/base/app/src/main/res/values-es/extensions_strings.xml@@ -0,0 +1,211 @@+<?xml version="1.0" encoding="utf-8"?>+<resources>+ <string name="extensions_title">Extensiones</string>+ <string name="extensions_row_detail">Letras, el audio de una canción y scripts escritos por otras personas, en un entorno aislado.</string>+ <string name="extensions_install_file">Instalar desde un archivo</string>+ <string name="extensions_install_url">Instalar desde una dirección</string>+ <string name="extensions_url_hint">https://…/extension.zip</string>+ <string name="extensions_none">Ninguna extensión instalada.</string>+ <string name="extensions_installed">Instaladas</string>+ <string name="extensions_repository_add">Añadir un repositorio</string>+ <string name="extensions_repository_hint">https://…/index.json</string>+ <string name="extensions_repository_warning">Myspoti no revisa un repositorio que añadas: lo que instales de él es bajo tu responsabilidad.</string>+ <string name="extensions_repository_remove">Quitar</string>+ <string name="extensions_repository_refresh">Actualizar</string>+ <string name="extensions_install">Instalar</string>+ <string name="extensions_update">Actualizar</string>+ <string name="extensions_up_to_date">Instalada</string>+ <string name="extensions_cancel">Cancelar</string>+ <string name="extensions_loading">Leyendo…</string>+ <string name="extensions_error">No instalada: %1$s</string>+ <string name="extensions_prompt_title_install">¿Instalar %1$s?</string>+ <string name="extensions_prompt_title_update">¿Actualizar %1$s?</string>+ <string name="extensions_prompt_by">%1$s · versión %2$s · %3$s</string>+ <string name="extensions_prompt_source">Desde %1$s</string>+ <string name="extensions_prompt_source_file">un archivo de este teléfono</string>+ <string name="extensions_prompt_new">nuevo en esta versión</string>+ <string name="extensions_prompt_update_same_rights">%1$s → %2$s, con los mismos permisos.</string>+ <string name="extensions_prompt_not_newer">La versión %1$s (o una más reciente) ya está instalada.</string>+ <string name="extensions_prompt_sha">sha256 del paquete: %1$s</string>+ <string name="extension_enabled">Activada</string>+ <string name="extension_running">En ejecución</string>+ <string name="extension_not_running">Detenida</string>+ <string name="extension_turned_off">%1$s desactivada: %2$s</string>+ <string name="extension_last_error">Último error: %1$s</string>+ <string name="extension_disabled_reason">Desactivada: %1$s</string>+ <string name="extension_inactive">Inactiva</string>+ <string name="extension_inactive_detail">Inactiva: %1$s</string>+ <string name="extension_homepage">Página web</string>+ <string name="extension_settings">Ajustes</string>+ <string name="extension_log">Registro</string>+ <string name="extension_log_empty">Aún no hay nada registrado.</string>+ <string name="extension_log_clear">Borrar el registro</string>+ <string name="extension_update_file">Actualizar desde un archivo</string>+ <string name="extension_uninstall">Desinstalar</string>+ <string name="extension_uninstall_confirm">¿Desinstalar %1$s? Sus ajustes y lo que haya guardado se irán con ella.</string>+ <string name="extension_confirm_title">Una extensión pregunta</string>+ <string name="extension_confirm_detail">No se cambia nada si no lo permites.</string>+ <string name="extension_confirm_allow">Permitir</string>+ <string name="extension_confirm_refuse">Rechazar</string>+ <string name="extensions_row_count">%1$d instaladas, %2$d activadas</string>+ <string name="extensions_tab_store">Tienda</string>+ <string name="extensions_search">Buscar extensiones</string>+ <string name="extensions_cat_all">Todas</string>+ <string name="extensions_cat_lyrics">Letras</string>+ <string name="extensions_cat_playback">Reproducción y audio</string>+ <string name="extensions_cat_library">Biblioteca</string>+ <string name="extensions_cat_discovery">Descubrir</string>+ <string name="extensions_cat_stats">Estadísticas</string>+ <string name="extensions_cat_look">Aspecto</string>+ <string name="extensions_cat_social">Social</string>+ <string name="extensions_cat_tools">Herramientas</string>+ <string name="extensions_cat_other">Otras</string>+ <string name="extensions_no_match">Ninguna extensión coincide.</string>+ <string name="extensions_browse_store">Explorar la tienda</string>+ <string name="extensions_other_ways">Otras formas de instalar</string>+ <string name="extensions_empty_title">¿Qué son las extensiones?</string>+ <string name="extensions_empty_body">Las extensiones añaden a Myspoti lo que no hace por sí mismo: letras de otras fuentes, de dónde viene el audio o la descarga de una canción, herramientas que usan tu cuenta de Spotify. Cada una se ejecuta en un entorno aislado y pregunta antes de acceder a nada. Añade un repositorio para explorarlas o instala un paquete en el que confíes.</string>+ <string name="extensions_official_badge">Oficial</string>+ <string name="extensions_repo_yours">Añadido por ti</string>+ <string name="extensions_repo_community">Comunidad</string>+ <string name="extensions_repo_official_note">Cada extensión se revisa antes de aparecer.</string>+ <string name="extensions_repo_yours_note">Sin revisar por Myspoti: instala bajo tu responsabilidad.</string>+ <string name="extensions_repo_error">No se pudo leer este repositorio: %1$s</string>+ <string name="extensions_repo_empty">Este repositorio no incluye ninguna extensión.</string>+ <string name="extensions_requires">Requiere Myspoti %1$s o posterior</string>+ <string name="extensions_requires_api">Hecha para un Myspoti más reciente (API de extensiones %1$d)</string>+ <string name="extensions_update_badge">Actualización</string>+ <string name="extensions_move_up">Subir</string>+ <string name="extensions_move_down">Bajar</string>+ <string name="extension_off">Desactivada</string>+ <string name="extension_by">de %1$s</string>+ <string name="extension_changelog">Novedades</string>+ <string name="extension_update_from">Actualización disponible: %1$s → %2$s</string>+ <string name="extension_not_listed">Esta extensión no está en tus repositorios (o todavía se están cargando).</string>+ <string name="extension_details">Detalles</string>+ <string name="extension_detail_updated">Actualizada</string>+ <string name="extension_detail_min_app">Requiere Myspoti</string>+ <string name="extension_detail_size">Tamaño</string>+ <string name="extension_detail_id">Id</string>+ <string name="extension_detail_sha">sha256 del paquete</string>+ <string name="extension_detail_source">Instalada desde</string>+ <string name="extension_see_in_store">Ver en la tienda</string>++ <!-- Actions: the closed catalogue, as the user reads it -->+ <string name="action_playback_control">Controlar la reproducción</string>+ <string name="action_playback_queue">Editar la cola</string>+ <string name="action_playback_events">Saber lo que reproduces</string>+ <string name="action_lyrics_provide">Proporcionar letras</string>+ <string name="action_trackinfo_provide">Añadir detalles de canciones</string>+ <string name="action_audio_source">Reproducir audio de otro origen</string>+ <string name="action_download_source">Proporcionar descargas</string>+ <string name="action_home_sections">Añadir secciones al Inicio</string>+ <string name="action_search_provide">Añadir resultados de búsqueda</string>+ <string name="action_menu_items">Añadir entradas a los menús</string>+ <string name="action_player_buttons">Añadir botones al reproductor</string>+ <string name="action_settings_page">Sus propios ajustes</string>+ <string name="action_notify">Mostrar mensajes cortos</string>+ <string name="action_library_read">Leer tu biblioteca</string>+ <string name="action_library_write">Modificar tu biblioteca</string>+ <string name="action_playlists_write">Editar tus listas</string>+ <string name="action_spotify_catalog">Explorar Spotify</string>+ <string name="action_spotify_raw">Acceso completo a Spotify</string>+ <string name="action_network">Usar internet</string>+ <string name="action_network_any">Usar cualquier sitio web</string>+ <string name="action_webview_page">Su propia página web</string>+ <string name="action_storage">Guardar sus propios datos</string>+ <string name="action_unknown">Desconocido para esta versión de Myspoti</string>+ <string name="action_critical">Crítica</string>+ <string name="action_no_why">(sin motivo indicado)</string>+ <string name="actions_title">Qué hace</string>+ <string name="actions_critical_warning">Las acciones críticas pueden modificar tu cuenta, sustituir el origen de las canciones o mostrar una página web libre. Permítelas solo si confías en el autor: Myspoti sigue preguntando antes de quitar nada.</string>+ <!-- Areas of the Installed tab -->+ <string name="area_playback">Reproducción</string>+ <string name="area_lyrics">Letras e info de canciones</string>+ <string name="area_audio">Audio y descargas</string>+ <string name="area_home">Inicio y búsqueda</string>+ <string name="area_menus">Menús y reproductor</string>+ <string name="area_library">Biblioteca y Spotify</string>+ <string name="area_other">Páginas y más</string>+ <string name="area_activity">Actividad reciente</string>+ <string name="area_turn_off">Desactivar</string>+ <string name="area_active">Activa</string>+ <string name="area_idle">Inactiva</string>+ <string name="area_make_active">Usarla para %1$s</string>+ <!-- Install prompt -->+ <string name="ext_third_party_notice">Extensión de terceros, sin revisar por Myspoti, bajo la responsabilidad de su autor.</string>+ <string name="ext_risk_accept">Entiendo que esta extensión la hace un tercero y la instalo bajo mi propia responsabilidad</string>+ <string name="ext_clash_exclusive">Sustituye a %1$s, que ahora proporciona %2$s</string>+ <string name="ext_clash_conflict">Incompatible con %1$s (instalada)</string>+ <string name="ext_clash_replaces">Sustituye a %1$s (instalada)</string>+ <string name="ext_clash_keep_new">Usar %1$s (la otra sigue instalada, %2$s)</string>+ <string name="ext_clash_keep_old">Conservar %1$s</string>+ <string name="ext_clash_idle">inactiva</string>+ <string name="ext_clash_off">desactivada</string>+ <string name="ext_clash_title">¿Cuál conservar?</string>+ <string name="ext_clash_ok">Hecho</string>+ <!-- Blocks and pages -->+ <string name="ext_from">De %1$s</string>+ <string name="ext_overflow">Extensiones</string>+ <string name="ext_open_page">Abrir su página</string>+ <string name="ext_page_failed">No se pudo mostrar la página de esta extensión.</string>+ <string name="ext_suspended_title">%1$s en pausa</string>+ <string name="ext_suspended_body">No dejaba de deshacer lo que hacía %1$s con la reproducción: sus comandos de reproducción están suspendidos.</string>+ <string name="ext_suspended_keep">Dejar que continúe</string>++ <!-- GitHub: discovery, ratings, reports -->+ <string name="extensions_github_title">En GitHub</string>+ <string name="extensions_github_note">Repositorios públicos con el tema myspoti-extension, sin revisar: cada uno es responsabilidad de su autor.</string>+ <string name="extensions_show_all">Mostrar todas (%1$d ocultas)</string>+ <string name="extensions_show_less">Ocultar las bloqueadas, denunciadas, mal valoradas y abandonadas</string>+ <string name="extension_rating">★ %1$s · %2$d votos</string>+ <string name="extension_rating_none">Aún no hay votos</string>+ <string name="extension_downloads">%1$s descargas</string>+ <string name="extension_rate_up">Valorarla bien</string>+ <string name="extension_rate_down">Valorarla mal</string>+ <string name="extension_rated">Gracias: tu voto está en GitHub</string>+ <string name="extension_signin_title">Iniciar sesión en GitHub</string>+ <string name="extension_signin_body">Abre %1$s e introduce este código. Myspoti nunca ve tu contraseña.</string>+ <string name="extension_signin_open">Abrir GitHub</string>+ <string name="extension_report">Denunciar</string>+ <string name="extension_detail_github">GitHub</string>+ <string name="extension_detail_ref">Versión en GitHub</string>++ <!-- Updates from GitHub -->+ <string name="extension_check_updates">Buscar actualizaciones</string>+ <string name="extension_check_up_to_date">Al día</string>+ <string name="extension_check_applied">Actualizada: no pide nada nuevo</string>+ <string name="extension_check_needs_ok">Una actualización necesita tu aprobación</string>+ <string name="extension_check_declined">Has conservado esta versión</string>+ <string name="extension_check_incompatible">La nueva versión requiere un Myspoti más reciente</string>+ <string name="extension_check_blocked">La nueva versión está bloqueada por Myspoti</string>+ <string name="extension_check_failed">No se pudo comprobar: mira su registro</string>+ <string name="extension_source_gone">Origen desaparecido: su repositorio ya no existe. Sigue funcionando con la copia de tu teléfono.</string>+ <string name="extension_revert">Volver a %1$s</string>+ <string name="extension_reverted">De vuelta a %1$s</string>+ <string name="extension_update_needs_ok">La actualización necesita tu aprobación: %1$s → %2$s</string>+ <string name="extension_update_needs_ok_body">Esta versión pide más de lo que aceptaste. La actual sigue funcionando hasta que decidas.</string>+ <string name="extension_update_accept">Aceptar</string>+ <string name="extension_update_keep">Conservar la actual</string>+ <string name="extension_refused_title">Espera tu aprobación</string>+ <string name="extension_refused_body">Se instaló cuando se podían desmarcar acciones, y se desmarcaron algunas. Ahora una extensión recibe todas las acciones que declara: queda desactivada hasta que las aceptes.</string>+ <string name="extension_change_action">Nuevo: %1$s</string>+ <string name="extension_change_host">Nuevo sitio web: %1$s</string>+ <string name="extension_change_any_host">Cualquier sitio web</string>+ <string name="extension_change_exclusive">Ahora exclusiva: %1$s</string>+ <string name="extension_change_why">Nuevo motivo para %1$s</string>+ <string name="extension_change_was">Antes: «%1$s»</string>+ <string name="extension_change_repo">Ahora viene de %1$s (antes %2$s)</string>+ <string name="extension_change_author">Nuevo autor: %1$s (antes %2$s)</string>+ <string name="extension_change_replaces">Desactiva %1$s al instalarse</string>+ <string name="extension_change_conflicts">Se niega a funcionar con %1$s</string>+ <string name="action_webview_auth">Iniciar sesión en un sitio web</string>+ <string name="extension_confirm_once">Permitir una vez</string>+ <string name="extension_confirm_always">Permitir siempre %1$s</string>+ <string name="ext_auth_title">%1$s: inicio de sesión</string>+ <string name="ext_auth_close">Cerrar</string>+ <string name="ext_auth_notice">Una página propia: lo que se escribe y sus cookies se quedan en Myspoti. La extensión solo recibe la dirección final de la página.</string>+ <string name="ext_grants_title">Siempre permitido</string>+ <string name="ext_grants_note">Cambios en Spotify que esta extensión hace sin preguntar. Revocar uno hace que vuelva a pedir confirmación.</string>+ <string name="ext_grant_revoke">Revocar</string>+</resources>diff --git a/base/app/src/main/res/values-es/myspoti_strings.xml b/base/app/src/main/res/values-es/myspoti_strings.xmlindex 00b3ee28..191a5a35 100644--- a/base/app/src/main/res/values-es/myspoti_strings.xml+++ b/base/app/src/main/res/values-es/myspoti_strings.xml@@ -1,20 +1,13 @@<?xml version="1.0" encoding="utf-8"?><!-- Myspoti's own texts (English default, French, Italian). --><resources>- <string name="welcome_tagline">Tu música, con letras sincronizadas y vídeos musicales oficiales.</string><string name="welcome_lead">Tu música,</string><string name="welcome_rotate_ads">sin anuncios.</string><string name="welcome_rotate_lyrics">con letras palabra por palabra.</string><string name="welcome_rotate_clips">con los videoclips oficiales.</string>- <string name="welcome_rotate_offline">incluso sin conexión.</string>- <string name="welcome_rotate_lossless">en calidad sin pérdida.</string>+ <string name="welcome_rotate_offline">sin conexión, con extensiones.</string><string name="welcome_login">Inicia sesión con Spotify</string><string name="welcome_privacy">Inicias sesión en la página oficial de Spotify. Myspoti nunca ve tu contraseña.</string>- <string name="crash_heading">Myspoti se ha detenido</string>- <string name="crash_explanation">Algo ha salido mal. Reinicia la app; si vuelve a pasar, copia el informe y compártelo en una incidencia de GitHub.</string>- <string name="crash_restart_app">Reiniciar Myspoti</string>- <string name="crash_copy_report">Copiar el informe</string>- <string name="crash_report_copied">Informe copiado</string><string name="remove_from_liked">Quitar de Canciones que te gustan</string><string name="repeat_on">Repetir: activado</string><string name="repeat_one">Repetir una canción</string>@@ -54,7 +47,6 @@<string name="background_playback_title">Reproducción en segundo plano</string><string name="background_playback_on">La optimización de batería está desactivada: la música y Spotify Connect siguen con la pantalla apagada.</string><string name="background_playback_off">Desactiva la optimización de batería para que Android no pause la app en segundo plano.</string>- <string name="crossfade_summary">Atenúa el final de una canción y sube la siguiente (sin superponerse). Solo en este teléfono.</string><plurals name="local_files_count"><item quantity="one">%d canción</item><item quantity="other">%d canciones</item>@@ -71,11 +63,8 @@<string name="artist_not_found">Artista no encontrado</string><string name="playlist_not_found">Playlist no encontrada</string><string name="browse_new_releases">Novedades</string>- <string name="browse_charts">Rankings</string>- <string name="browse_workout">Entrenamiento</string>- <string name="browse_dance_electronic">Dance/Electrónica</string><string name="language_auto">Automático</string>- <string name="language_auto_detail">El idioma de tu teléfono si Myspoti lo tiene (alemán, español, francés, griego, inglés, italiano, portugués); si no, inglés</string>+ <string name="language_auto_detail">El idioma de tu teléfono si Myspoti lo tiene (alemán, chino, español, francés, griego, inglés, italiano, polaco, portugués, ruso); si no, inglés</string><string name="language_partial_note">Otros idiomas: los textos de Spotify están traducidos, los de Myspoti siguen en inglés.</string><string name="restart_player_title">Reiniciar el reproductor</string><string name="restart_player_detail">Si la música deja de responder: recarga el reproductor de Spotify</string>@@ -86,7 +75,6 @@<string name="local_rename">Cambiar nombre</string><string name="local_delete_playlist">Eliminar playlist</string><string name="local_added_to">Añadida a %1$s</string>- <string name="folder_create_failed">No se pudo crear la carpeta</string><string name="local_playlist_empty">Añade canciones desde Archivos locales con su botón +.</string><string name="playlist_change_refused">Spotify ha rechazado el cambio en esta playlist</string><string name="download_kept_by_list">Sigue descargada: una playlist descargada la incluye</string>@@ -124,6 +112,7 @@<string name="library_reorder_hint">Mantén pulsada una playlist y arrástrala para moverla</string><string name="library_reorder_reset">Volver al orden de Spotify</string><string name="song_radio_failed">No se pudo abrir la radio de esta canción</string>+ <string name="song_radio_name">Radio de %1$s</string><string name="local_files_find_hint">Buscar en Archivos locales</string><string name="data_saver_title">Ahorro de datos</string><string name="data_saver_summary">En datos móviles, Myspoti no usa datos: solo se reproducen las canciones descargadas y los archivos locales</string>@@ -152,13 +141,8 @@<string name="playback_speed">Velocidad de reproducción</string><string name="recommended_songs">Canciones recomendadas</string><string name="jam_title">Jam</string>- <string name="jam_restricted">Spotify solo deja iniciar una Jam a cuentas Premium. Aun así puedes unirte a una con un enlace.</string>- <string name="jam_join">Unirse a una Jam</string>- <string name="jam_join_hint">Pega el enlace de invitación</string><string name="jam_leave">Salir de la Jam</string><string name="jam_members">%1$d personas escuchando</string>- <string name="pin">Fijar</string>- <string name="unpin">Desfijar</string><string name="jam_start">Iniciar una Jam</string><string name="jam_invite">Compartir enlace de invitación</string><string name="jam_failed">Spotify ha rechazado esta Jam</string>@@ -195,27 +179,6 @@<string name="smart_shuffle_title">Reproducción aleatoria inteligente</string><string name="smart_shuffle_on">Aleatorio inteligente: las recomendaciones de Spotify se mezclan en la playlist.</string><string name="track_sort_added">Fecha de adición</string>- <!-- Lossless (SpotiFLAC) downloads -->- <string name="spotiflac_row_title">Descargas sin pérdida (FLAC)</string>- <string name="spotiflac_row_on">Verificado — Myspoti usa los servidores propios de SpotiFLAC.</string>- <string name="spotiflac_row_off">No verificado — toca para completar la comprobación única.</string>- <string name="spotiflac_verify_title">Verificación de SpotiFLAC</string>- <string name="spotiflac_verify_start_failed">No se pudo iniciar la verificación. Toca Reintentar o vuelve más tarde.</string>- <string name="spotiflac_verify_timeout">La verificación ha caducado. Toca Reintentar u Omitir por ahora.</string>- <string name="spotiflac_verify_rejected">La verificación ha sido rechazada. Toca Reintentar u Omitir por ahora.</string>- <string name="spotiflac_session_ok">Sesión de SpotiFLAC guardada</string>- <string name="spotiflac_session_creating">Creando sesión segura…</string>- <string name="spotiflac_session_failed">No se pudo terminar la verificación. Toca Reintentar u Omitir por ahora.</string>- <string name="spotiflac_skip">Omitir por ahora</string>- <string name="retry">Reintentar</string>- <string name="spotiflac_status_title">SpotiFLAC</string>- <string name="spotiflac_status_verified">Estás verificado: las descargas pasan por los servidores de SpotiFLAC, la fuente sin pérdida más fiable. Solo se usa esta sesión: sin cuenta, sin guardar nada más.</string>- <string name="spotiflac_session_expires">Sesión válida hasta el %1$s</string>- <string name="spotiflac_forget">Olvidar esta sesión</string>- <string name="lossless_hires_title">Descargas hi-res (24 bits)</string>- <string name="lossless_hires_detail">Guarda una canción en 24 bits hi-res cuando la fuente lo permite. Los archivos pesan unas tres veces más que la calidad CD.</string>- <string name="setup_spotiflac_title">Descargas sin pérdida (FLAC)</string>- <string name="setup_spotiflac_detail">Verifica una vez con SpotiFLAC para que las descargas vengan de sus servidores sin pérdida.</string><string name="settings_title">Ajustes</string><string name="settings_detail">Calidad de sonido, descargas, datos, batería e idioma</string><string name="settings_section_playback">Reproducción</string>@@ -244,7 +207,6 @@<string name="setup_quality_subtitle">Elige cómo Myspoti reproduce y guarda tu música. Podrás cambiarlo más tarde en Ajustes.</string><string name="downloads_off_toast">Las descargas están desactivadas. Actívalas en Ajustes.</string><string name="quality_streaming_high_detail">160 kbit/s, el mejor sonido</string>- <string name="downloads_verify_hint">Ninguna fuente sin pérdida ha respondido. Verifica SpotiFLAC una vez en Ajustes, Descargas: sus servidores son los fiables.</string><string name="quality_download_small">La más ligera</string><string name="quality_download_small_detail">AAC 96 kbit/s, la más ligera: unos 3 MB por canción</string><string name="settings_solid_nav_title">Barra inferior sólida</string>@@ -254,14 +216,12 @@<string name="quality_sheet_title">Calidad de sonido</string><string name="quality_now">Reproduciendo ahora: %1$s</string><string name="quality_now_unknown">Aún no se sabe: reproduce una canción</string>- <string name="spotiflac_verify_in_browser">Resuelve la comprobación en la pestaña del navegador que se ha abierto y vuelve aquí.</string><string name="update_downloading">Descargando… %1$d%%</string><string name="update_installing">Instalando…</string><string name="update_needs_permission">Para actualizar, permite que Myspoti instale apps y vuelve aquí.</string><string name="update_allow">Permitir</string><string name="update_failed">La actualización ha fallado: %1$s</string><string name="update_retry">Reintentar</string>- <string name="downloads_verify_banner">Las descargas necesitan verificar SpotiFLAC una vez en esta app. Toca aquí para hacerlo.</string><string name="removed_from">Quitada de %1$s</string><string name="done">Hecho</string><string name="playlist_edit_details">Editar detalles</string>@@ -271,14 +231,6 @@<string name="playlist_remove_cover">Quitar portada</string><string name="playlist_save">Guardar</string><string name="playlist_access_title">Quién puede verla</string>- <string name="playlist_access_public">Pública</string>- <string name="playlist_access_public_detail">Cualquiera puede encontrarla y reproducirla</string>- <string name="playlist_access_private">Privada</string>- <string name="playlist_access_private_detail">Solo tú puedes verla</string>- <string name="playlist_access_collaborative">Colaborativa</string>- <string name="playlist_access_collaborative_detail">Solo las personas que invites pueden añadir y quitar canciones</string>- <string name="playlist_on_profile">En tu perfil</string>- <string name="playlist_on_profile_detail">Aparece en tu perfil para que otros la vean</string><string name="choose_artist">Elige un artista</string><string name="quality_streaming_wifi_title">Streaming por Wi-Fi</string><string name="quality_streaming_cell_title">Streaming con datos móviles</string>@@ -316,13 +268,13 @@<string name="library_sort_recently_added">Añadidas recientemente</string><string name="library_change_failed">No se pudo actualizar tu biblioteca, inténtalo de nuevo</string><string name="a11y_close_player">Cerrar el reproductor</string>- <string name="a11y_devices">Dispositivos</string><string name="a11y_share">Compartir</string><string name="search_failed">La búsqueda ha fallado. Comprueba tu conexión.</string><string name="retry_button">Reintentar</string><string name="page_load_failed">No se pudo cargar esta página.\nComprueba tu conexión e inténtalo de nuevo.</string><string name="jam_paste_link">Unirse con un enlace copiado</string><string name="play_refused">Spotify ha rechazado reproducir esto en tu cuenta. En algunos países, las cuentas gratuitas solo pueden reproducir en aleatorio: prueba el botón de aleatorio.</string>+ <string name="play_refused_all">Spotify rechaza ahora mismo todos los comandos de este reproductor en tu cuenta (reproducir, avanzar, transferir). El reproductor se recargó una vez; si no suena nada, cierra la app por completo y ábrela de nuevo, o cambia entre Wi-Fi y datos móviles.</string><string name="artist_liked_songs">Canciones que te gustan</string><plurals name="artist_liked_songs_count"><item quantity="one">%1$d canción de %2$s</item>@@ -337,7 +289,6 @@<string name="settings_rotation_auto">Automática</string><string name="settings_rotation_landscape">Horizontal</string><string name="support_github_action">Patrocinar en GitHub</string>- <string name="spotiflac_verify_again">La verificación de SpotiFLAC ha caducado: vuelve a hacerla en Ajustes para descargar sin pérdida</string><string name="download_on_mobile_data">Descarga con datos móviles: usa tu tarifa de datos</string><string name="restart_player_done">Reproductor reiniciado</string><string name="spotify_limited">Spotify está limitando la reproducción por ahora. Inténtalo de nuevo en un minuto.</string>@@ -356,7 +307,6 @@<string name="blend_deleted">Este Blend se eliminó</string><string name="blend_working">En curso…</string><string name="blend_invited_by">%1$s te invita a un Blend</string>- <string name="blend_open">Abrir el Blend</string><string name="blend_later">Ahora no</string><string name="blend_members">Miembros</string><string name="blend_invite_more">Invitar a más personas</string>@@ -375,7 +325,6 @@<string name="diagnostic_export_title">Exportar un informe de diagnóstico</string><string name="diagnostic_export_detail">Comparte el registro reciente de la app y los datos del dispositivo</string><string name="diagnostic_export_failed">No se pudo guardar el informe de diagnóstico</string>- <string name="recently_played_title">Reproducido recientemente</string><string name="recently_played_empty">Lo que reproduzcas con esta cuenta aparecerá aquí.</string><string name="recently_played_failed">No se pudo cargar la lista de reproducidos recientemente (%1$s)</string><string name="recents_title">Recientes</string>@@ -418,11 +367,8 @@<string name="show_sort_chapters_newest">Todos los capítulos • Más recientes</string><string name="show_sort_chapters_oldest">Todos los capítulos • Más antiguos</string><string name="show_empty">Todavía no hay nada que reproducir aquí</string>- <string name="show_rating">%1$s (%2$s)</string><string name="show_authors">Por %1$s</string><string name="show_narrators">Narrado por %1$s</string>- <string name="show_followed">Ahora sigues este podcast</string>- <string name="show_unfollowed">Has dejado de seguir este podcast</string><string name="episode_duration_min">%1$d min</string><string name="episode_remaining">Quedan %1$s</string><string name="episode_mark_played">Marcar como reproducido</string>@@ -435,20 +381,14 @@<string name="episode_show_more">mostrar más</string><string name="episode_show_less">mostrar menos</string><string name="episode_download">Descargar</string>- <string name="episode_downloading">Descargando…</string>- <string name="episode_downloaded">Descargado</string><string name="episode_download_remove">Quitar la descarga</string><string name="episode_options">Opciones del episodio</string><string name="episode_not_found">Episodio no encontrado</string>- <string name="show_not_found">Podcast no encontrado</string><string name="podcast_playing_from">Reproduciendo desde el podcast</string><string name="player_speed_chip">%1$s×</string><string name="player_back_15">Retroceder 15 segundos</string><string name="player_forward_15">Avanzar 15 segundos</string>- <string name="player_show_remaining">Mostrar el tiempo restante</string>- <string name="player_show_elapsed">Mostrar el tiempo transcurrido</string><string name="player_sleep_timer">Temporizador de apagado</string>- <string name="player_speed_a11y">Velocidad de reproducción, %1$s×</string><string name="settings_keep_playing_title">Seguir reproduciendo al cerrar la app</string><string name="settings_keep_playing_detail">Desactivado: cerrar Myspoti desde las apps recientes detiene la música</string><string name="recommended_songs_from_name">Según el nombre de esta playlist</string>@@ -469,8 +409,6 @@<string name="link_copied">Enlace copiado</string><string name="lyrics_meaning_title">Significado</string><string name="lyrics_meaning_about">Acerca de</string>- <string name="lyrics_meaning_lines">Versos explicados</string>- <string name="lyrics_meaning_source">De Genius · abrir la canción allí</string><string name="lyrics_meaning_translating">Traduciendo…</string><string name="lyrics_meaning_translate">Traducir</string><string name="lyrics_meaning_original">Ver original</string>diff --git a/base/app/src/main/res/values-es/spotify_strings.xml b/base/app/src/main/res/values-es/spotify_strings.xmlindex 732d1c25..20ad83c0 100644--- a/base/app/src/main/res/values-es/spotify_strings.xml+++ b/base/app/src/main/res/values-es/spotify_strings.xml@@ -17,7 +17,6 @@<string name="snackbar_added_to_liked_songs" formatted="false">Añadida a Canciones que te gustan.</string><string name="snackbar_removed_from_liked_songs" formatted="false">Quitada de Canciones que te gustan.</string><string name="content_description_context_menu" formatted="false">Más opciones</string>- <string name="close_button_content_description" formatted="false">Cerrar</string><string name="add_to_playlist_saved_in_section_header" formatted="false">Se ha guardado en</string><string name="add_to_playlist_new_playlist_button_text" formatted="false">Nueva lista</string><string name="add_to_playlist_button_cancel" formatted="false">Cancelar</string>@@ -25,8 +24,6 @@<string name="lyrics_card_title" formatted="false">Letra</string><string name="lyrics_card_title_preview" formatted="false">Vista previa de la letra</string><string name="lyrics_card_show_lyrics_button" formatted="false">Mostrar letra</string>- <string name="lyrics_card_expand_button_content_description" formatted="false">Abrir letra a pantalla completa</string>- <string name="lyrics_card_share_button_content_description" formatted="false">Compartir letra</string><string name="lyrics_credential_note" formatted="false">Letra remitida por %1$s</string><string name="lyrics_fullscreen_chip_label_share" formatted="false">Compartir</string><string name="lyrics_fullscreen_chip_label_translate" formatted="false">Traducir</string>@@ -49,7 +46,6 @@<string name="artist_popular_tracks" formatted="false">Populares</string><string name="curation_button_follow_state_text" formatted="false">Seguir</string><string name="curation_button_following_state_text" formatted="false">Siguiendo</string>- <string name="search_main_entity_subtitle_artist" formatted="false">Artista</string><string name="connect_phone_is_self" formatted="false">Este teléfono</string><string name="settings_item_canvas_title" formatted="false">Canvas</string><string name="video_settings_canvas_subtitle" formatted="false">Imágenes breves y en bucle mientras suena una canción.</string>@@ -107,8 +103,6 @@<string name="library_search_text_hint" formatted="false">Busca en Tu biblioteca</string><string name="account_title" formatted="false">Cuenta</string><string name="song_dna_search_chip_followed_artists" formatted="false">Artistas que sigues</string>- <string name="settings_item_crossfade_title" formatted="false">Crossfade</string>- <string name="playback_settings_crossfade_slider_seconds" formatted="false">%1$d s</string><string name="local_files_title" formatted="false">Archivos locales</string><string name="local_files_empty_section_title" formatted="false">Añade tus propios archivos de audio a Tu biblioteca</string><string name="local_files_empty_section_subtitle" formatted="false">¿Tienes una canción o un pódcast personal que no está en Spotify?</string>@@ -138,14 +132,10 @@<string name="assisted_curation_search_filter_artists" formatted="false">Artistas</string><string name="assisted_curation_search_filter_albums" formatted="false">Álbumes</string><string name="assisted_curation_search_filter_playlists" formatted="false">Listas</string>- <string name="assisted_curation_search_filter_clear_content_description" formatted="false">Borrar filtro</string>- <string name="ad_category_title_music" formatted="false">Música</string>- <string name="made_for_you_hub_title" formatted="false">Especialmente para ti</string><string name="settings_item_app_language_title" formatted="false">Idioma de la aplicación</string><string name="create_menu_item_folder_title" formatted="false">Carpeta</string><string name="create_folder_name_suggested_folder_name" formatted="false">Nueva carpeta</string><string name="context_menu_rename_folder" formatted="false">Cambiar nombre de carpeta</string>- <string name="your_library_messaging_folder_rename_hint" formatted="false">Nombre de la carpeta</string><string name="create_playlist_content_description" formatted="false">Crear lista</string><string name="actions_picker_delete" formatted="false">Eliminar</string><string name="filter_and_sort_sort_section_title" formatted="false">Ordenar por</string>diff --git a/base/app/src/main/res/values-es/strings.xml b/base/app/src/main/res/values-es/strings.xmlindex 56404d8f..410aa114 100644--- a/base/app/src/main/res/values-es/strings.xml+++ b/base/app/src/main/res/values-es/strings.xml@@ -4,34 +4,14 @@<string name="aa_playlists">Playlists</string><string name="aa_albums">Álbumes</string><string name="aa_artists">Artistas</string>- <string name="aa_podcasts">Podcasts</string><string name="settings_amoled_theme">Tema AMOLED</string><string name="settings_amoled_theme_subtitle">Fondo negro puro para ahorrar batería</string>- <string name="settings_lyrics_style_spotify_default">Spotify predeterminado</string>- <string name="settings_lyrics_style_fullscreen">Pantalla completa (colores del álbum)</string>- <string name="settings_lyrics_style_compact">Compacto</string>- <string name="settings_lyrics_style_karaoke">Karaoke</string>- <string name="settings_lyrics_style_bold">Grande y en negrita</string><string name="main_update_available">Hay una nueva actualización disponible</string>- <string name="notif_channel_media_name">Reproducción multimedia</string>- <string name="notif_channel_media_description">Controles de reproducción multimedia de Myspoti</string>- <string name="notif_action_previous">Anterior</string>- <string name="notif_action_next">Siguiente</string><string name="notif_action_play">Reproducir</string><string name="notif_action_pause">Pausar</string><string name="notif_shuffle_enable">Activar reproducción aleatoria</string><string name="notif_shuffle_disable">Desactivar reproducción aleatoria</string><string name="notif_shuffle_disable_smart">Desactivar la reproducción aleatoria inteligente</string>- <string name="notif_action_like">Me gusta</string>- <string name="notif_action_unlike">Quitar \'Me gusta\'</string>- <string name="notif_unknown_name">Desconocido</string>- <string name="notif_by_artist">por %1$s</string>- <string name="notif_repeat_disable">Desactivar repetición</string>- <string name="notif_repeat_disable_one">Desactivar repetir canción</string>- <string name="notif_repeat_enable">Activar repetición</string>- <string name="bridge_player_unlocked">Reproductor desbloqueado</string>- <string name="bridge_reloading">Recargando…</string>- <string name="service_disabled_message">El servicio no está activado</string><string name="energy_saver_title">Ahorro de batería</string><string name="energy_saver_summary">Canvas desactivado, vídeos y animaciones más ligeros</string><string name="video_fullscreen_enter">Entrar en pantalla completa</string>@@ -39,4 +19,5 @@<string name="playback_seek_description">Posición de reproducción</string><string name="account_page_title">Cuenta de Spotify</string><string name="account_page_detail">Plan, privacidad y dispositivos, en spotify.com</string>+ <string name="player_source_downloaded">Descargada</string></resources>diff --git a/base/app/src/main/res/values-et/spotify_strings.xml b/base/app/src/main/res/values-et/spotify_strings.xmlindex 8ca8eacf..2af529c5 100644--- a/base/app/src/main/res/values-et/spotify_strings.xml+++ b/base/app/src/main/res/values-et/spotify_strings.xml@@ -17,7 +17,6 @@<string name="snackbar_added_to_liked_songs" formatted="false">Lisatud meeldivaks märgitud laulude hulka.</string><string name="snackbar_removed_from_liked_songs" formatted="false">Eemaldatud meeldivaks märgitud laulude hulgast.</string><string name="content_description_context_menu" formatted="false">Rohkem valikuid</string>- <string name="close_button_content_description" formatted="false">Sulge</string><string name="add_to_playlist_saved_in_section_header" formatted="false">Salvestuskoht</string><string name="add_to_playlist_new_playlist_button_text" formatted="false">Uus esitusloend</string><string name="add_to_playlist_button_cancel" formatted="false">Tühista</string>@@ -25,8 +24,6 @@<string name="lyrics_card_title" formatted="false">Laulusõnad</string><string name="lyrics_card_title_preview" formatted="false">Laulusõnade eelvaade</string><string name="lyrics_card_show_lyrics_button" formatted="false">Kuva laulusõnad</string>- <string name="lyrics_card_expand_button_content_description" formatted="false">Ava laulusõnad täisekraanrežiimis</string>- <string name="lyrics_card_share_button_content_description" formatted="false">Laulusõnade jagamine</string><string name="lyrics_credential_note" formatted="false">Laulusõnade ametlik levitaja: %1$s</string><string name="lyrics_fullscreen_chip_label_share" formatted="false">Jaga</string><string name="lyrics_fullscreen_chip_label_translate" formatted="false">Tõlgi</string>@@ -49,7 +46,6 @@<string name="artist_popular_tracks" formatted="false">Populaarsed</string><string name="curation_button_follow_state_text" formatted="false">Jälgi</string><string name="curation_button_following_state_text" formatted="false">Jälgin</string>- <string name="search_main_entity_subtitle_artist" formatted="false">Artist</string><string name="connect_phone_is_self" formatted="false">See telefon</string><string name="settings_item_canvas_title" formatted="false">Canvas</string><string name="video_settings_canvas_subtitle" formatted="false">Lühikesed korduvad visuaalid laulu esitamise ajal.</string>@@ -107,8 +103,6 @@<string name="library_search_text_hint" formatted="false">Otsi oma teegist</string><string name="account_title" formatted="false">Konto</string><string name="song_dna_search_chip_followed_artists" formatted="false">Jälgiti artiste</string>- <string name="settings_item_crossfade_title" formatted="false">Üleminek</string>- <string name="playback_settings_crossfade_slider_seconds" formatted="false">%1$d s</string><string name="local_files_title" formatted="false">Kohalikud failid</string><string name="local_files_empty_section_title" formatted="false">Lisa enda helifailid oma teeki</string><string name="local_files_empty_section_subtitle" formatted="false">Kas sul on mõni laul või isiklik netisaade, mida Spotifys pole?</string>@@ -138,14 +132,10 @@<string name="assisted_curation_search_filter_artists" formatted="false">Artistid</string><string name="assisted_curation_search_filter_albums" formatted="false">Albumid</string><string name="assisted_curation_search_filter_playlists" formatted="false">Esitusloendid</string>- <string name="assisted_curation_search_filter_clear_content_description" formatted="false">Tühjenda filter</string>- <string name="ad_category_title_music" formatted="false">Muusika</string>- <string name="made_for_you_hub_title" formatted="false">Sulle koostatud</string><string name="settings_item_app_language_title" formatted="false">Rakenduse keel</string><string name="create_menu_item_folder_title" formatted="false">Kaust</string><string name="create_folder_name_suggested_folder_name" formatted="false">Uus kaust</string><string name="context_menu_rename_folder" formatted="false">Nimeta kaust ümber</string>- <string name="your_library_messaging_folder_rename_hint" formatted="false">Kausta nimi</string><string name="create_playlist_content_description" formatted="false">Loo esitusloend</string><string name="actions_picker_delete" formatted="false">Kustuta</string><string name="filter_and_sort_sort_section_title" formatted="false">Järjestamisalus</string>diff --git a/base/app/src/main/res/values-eu/spotify_strings.xml b/base/app/src/main/res/values-eu/spotify_strings.xmlindex bd585e1c..a41f2935 100644--- a/base/app/src/main/res/values-eu/spotify_strings.xml+++ b/base/app/src/main/res/values-eu/spotify_strings.xml@@ -17,7 +17,6 @@<string name="snackbar_added_to_liked_songs" formatted="false">Gehitu da Gustatu zaizkizun abestietan.</string><string name="snackbar_removed_from_liked_songs" formatted="false">Kendu da Gustatu zaizkizun abestietatik.</string><string name="content_description_context_menu" formatted="false">Aukera gehiago</string>- <string name="close_button_content_description" formatted="false">Itxi</string><string name="add_to_playlist_saved_in_section_header" formatted="false">Hemen dago gordeta:</string><string name="add_to_playlist_new_playlist_button_text" formatted="false">Zerrenda berria</string><string name="add_to_playlist_button_cancel" formatted="false">Utzi</string>@@ -25,8 +24,6 @@<string name="lyrics_card_title" formatted="false">Hitzak</string><string name="lyrics_card_title_preview" formatted="false">Hitzen aurrebista</string><string name="lyrics_card_show_lyrics_button" formatted="false">Erakutsi hitzak</string>- <string name="lyrics_card_expand_button_content_description" formatted="false">Ireki hitzak pantaila osoan</string>- <string name="lyrics_card_share_button_content_description" formatted="false">Partekatu hitzak</string><string name="lyrics_credential_note" formatted="false">Honek eskainitako hitzak: %1$s</string><string name="lyrics_fullscreen_chip_label_share" formatted="false">Partekatu</string><string name="lyrics_fullscreen_chip_label_translate" formatted="false">Itzuli</string>@@ -49,7 +46,6 @@<string name="artist_popular_tracks" formatted="false">Ezagunak</string><string name="curation_button_follow_state_text" formatted="false">Jarraitu</string><string name="curation_button_following_state_text" formatted="false">Jarraitzen</string>- <string name="search_main_entity_subtitle_artist" formatted="false">Artista</string><string name="connect_phone_is_self" formatted="false">Telefono hau</string><string name="settings_item_canvas_title" formatted="false">Canvas</string><string name="video_settings_canvas_subtitle" formatted="false">Irudi labur eta errepikakorrak abesti bat erreproduzitu bitartean.</string>@@ -107,8 +103,6 @@<string name="library_search_text_hint" formatted="false">Bilatu Liburutegian</string><string name="account_title" formatted="false">Kontua</string><string name="song_dna_search_chip_followed_artists" formatted="false">Jarraitutako artistak</string>- <string name="settings_item_crossfade_title" formatted="false">Gainjartze gurutzatua</string>- <string name="playback_settings_crossfade_slider_seconds" formatted="false">%1$d s</string><string name="local_files_title" formatted="false">Fitxategi lokalak</string><string name="local_files_empty_section_title" formatted="false">Gehitu gailuko audio-fitxategiak Liburutegian</string><string name="local_files_empty_section_subtitle" formatted="false">Spotify-n ez dauden abesti edo podcast pertsonalak dauzkazu?</string>@@ -138,14 +132,10 @@<string name="assisted_curation_search_filter_artists" formatted="false">Artistak</string><string name="assisted_curation_search_filter_albums" formatted="false">Albumak</string><string name="assisted_curation_search_filter_playlists" formatted="false">Zerrendak</string>- <string name="assisted_curation_search_filter_clear_content_description" formatted="false">Garbitu iragazkia</string>- <string name="ad_category_title_music" formatted="false">Musika</string>- <string name="made_for_you_hub_title" formatted="false">Zuretzat eginak</string><string name="settings_item_app_language_title" formatted="false">Aplikazioaren hizkuntza</string><string name="create_menu_item_folder_title" formatted="false">Karpeta</string><string name="create_folder_name_suggested_folder_name" formatted="false">Karpeta berria</string><string name="context_menu_rename_folder" formatted="false">Aldatu karpetaren izena</string>- <string name="your_library_messaging_folder_rename_hint" formatted="false">Karpetaren izena</string><string name="create_playlist_content_description" formatted="false">Sortu zerrenda bat</string><string name="actions_picker_delete" formatted="false">Ezabatu</string><string name="filter_and_sort_sort_section_title" formatted="false">Ordenatzeko irizpidea</string>diff --git a/base/app/src/main/res/values-fa/spotify_strings.xml b/base/app/src/main/res/values-fa/spotify_strings.xmlindex e805632e..31180015 100644--- a/base/app/src/main/res/values-fa/spotify_strings.xml+++ b/base/app/src/main/res/values-fa/spotify_strings.xml@@ -17,7 +17,6 @@<string name="snackbar_added_to_liked_songs" formatted="false">به آهنگهای پسندیده اضافه شد.</string><string name="snackbar_removed_from_liked_songs" formatted="false">از آهنگهای پسندیده حذف شد.</string><string name="content_description_context_menu" formatted="false">گزینههای بیشتر</string>- <string name="close_button_content_description" formatted="false">بستن</string><string name="add_to_playlist_saved_in_section_header" formatted="false">ذخیرهشده در</string><string name="add_to_playlist_new_playlist_button_text" formatted="false">فهرست پخش جدید</string><string name="add_to_playlist_button_cancel" formatted="false">لغو</string>@@ -25,8 +24,6 @@<string name="lyrics_card_title" formatted="false">متن ترانهها</string><string name="lyrics_card_title_preview" formatted="false">پیشنمایش متن ترانه</string><string name="lyrics_card_show_lyrics_button" formatted="false">نمایش متن ترانه</string>- <string name="lyrics_card_expand_button_content_description" formatted="false">باز کردن تمامصفحه متن ترانه</string>- <string name="lyrics_card_share_button_content_description" formatted="false">همرسانی متن ترانه</string><string name="lyrics_credential_note" formatted="false">متن ترانه از %1$s</string><string name="lyrics_fullscreen_chip_label_share" formatted="false">همرسانی</string><string name="lyrics_fullscreen_chip_label_translate" formatted="false">ترجمه</string>@@ -49,7 +46,6 @@<string name="artist_popular_tracks" formatted="false">پرطرفدار</string><string name="curation_button_follow_state_text" formatted="false">دنبال کردن</string><string name="curation_button_following_state_text" formatted="false">دنبال میکنید</string>- <string name="search_main_entity_subtitle_artist" formatted="false">هنرمند</string><string name="connect_phone_is_self" formatted="false">این تلفن</string><string name="settings_item_canvas_title" formatted="false">Canvas</string><string name="video_settings_canvas_subtitle" formatted="false">تصاویر کوتاه و تکرارشونده هنگام پخش آهنگ.</string>@@ -107,8 +103,6 @@<string name="library_search_text_hint" formatted="false">جستجو در «کتابخانه شما»</string><string name="account_title" formatted="false">حساب</string><string name="song_dna_search_chip_followed_artists" formatted="false">هنرمند دنبالشده</string>- <string name="settings_item_crossfade_title" formatted="false">پخش محوشدنی</string>- <string name="playback_settings_crossfade_slider_seconds" formatted="false">%1$d ثانیه</string><string name="local_files_title" formatted="false">فایلهای محلی</string><string name="local_files_empty_section_title" formatted="false">فایلهای صوتی را به «کتابخانه شما» اضافه کنید</string><string name="local_files_empty_section_subtitle" formatted="false">آهنگ یا پادکستی شخصی دارید که در اسپاتیفای نیست؟</string>@@ -138,14 +132,10 @@<string name="assisted_curation_search_filter_artists" formatted="false">هنرمندان</string><string name="assisted_curation_search_filter_albums" formatted="false">آلبومها</string><string name="assisted_curation_search_filter_playlists" formatted="false">فهرستهای پخش</string>- <string name="assisted_curation_search_filter_clear_content_description" formatted="false">پاک کردن فیلترها</string>- <string name="ad_category_title_music" formatted="false">موسیقی</string>- <string name="made_for_you_hub_title" formatted="false">سفارشی برای شما</string><string name="settings_item_app_language_title" formatted="false">زبان برنامه</string><string name="create_menu_item_folder_title" formatted="false">پوشه</string><string name="create_folder_name_suggested_folder_name" formatted="false">پوشه جدید</string><string name="context_menu_rename_folder" formatted="false">تغییر نام پوشه</string>- <string name="your_library_messaging_folder_rename_hint" formatted="false">نام پوشه</string><string name="create_playlist_content_description" formatted="false">ایجاد فهرست پخش</string><string name="actions_picker_delete" formatted="false">حذف کردن</string><string name="filter_and_sort_sort_section_title" formatted="false">بهترتیب</string>diff --git a/base/app/src/main/res/values-fi/spotify_strings.xml b/base/app/src/main/res/values-fi/spotify_strings.xmlindex 1c89b4cc..b9b3dbc2 100644--- a/base/app/src/main/res/values-fi/spotify_strings.xml+++ b/base/app/src/main/res/values-fi/spotify_strings.xml@@ -17,7 +17,6 @@<string name="snackbar_added_to_liked_songs" formatted="false">Lisätty tykättyihin kappaleisiin.</string><string name="snackbar_removed_from_liked_songs" formatted="false">Poistettu tykätyistä kappaleista.</string><string name="content_description_context_menu" formatted="false">Lisää vaihtoehtoja</string>- <string name="close_button_content_description" formatted="false">Sulje</string><string name="add_to_playlist_saved_in_section_header" formatted="false">Tallennuspaikka</string><string name="add_to_playlist_new_playlist_button_text" formatted="false">Uusi soittolista</string><string name="add_to_playlist_button_cancel" formatted="false">Peruuta</string>@@ -25,8 +24,6 @@<string name="lyrics_card_title" formatted="false">Sanat</string><string name="lyrics_card_title_preview" formatted="false">Sanojen esikatselu</string><string name="lyrics_card_show_lyrics_button" formatted="false">Näytä sanat</string>- <string name="lyrics_card_expand_button_content_description" formatted="false">Avaa sanat koko näytön tilassa</string>- <string name="lyrics_card_share_button_content_description" formatted="false">Jaa sanat</string><string name="lyrics_credential_note" formatted="false">Sanat tarjoaa %1$s</string><string name="lyrics_fullscreen_chip_label_share" formatted="false">Jaa</string><string name="lyrics_fullscreen_chip_label_translate" formatted="false">Käännä</string>@@ -49,7 +46,6 @@<string name="artist_popular_tracks" formatted="false">Suositut</string><string name="curation_button_follow_state_text" formatted="false">Seuraa</string><string name="curation_button_following_state_text" formatted="false">Seurataan</string>- <string name="search_main_entity_subtitle_artist" formatted="false">Artisti</string><string name="connect_phone_is_self" formatted="false">Tämä puhelin</string><string name="settings_item_canvas_title" formatted="false">Canvas</string><string name="video_settings_canvas_subtitle" formatted="false">Lyhyet videosilmukat kappaleen soidessa.</string>@@ -107,8 +103,6 @@<string name="library_search_text_hint" formatted="false">Hae omasta kirjastosta</string><string name="account_title" formatted="false">Tili</string><string name="song_dna_search_chip_followed_artists" formatted="false">Seuratut artistit</string>- <string name="settings_item_crossfade_title" formatted="false">Ristihäivytys</string>- <string name="playback_settings_crossfade_slider_seconds" formatted="false">%1$d s</string><string name="local_files_title" formatted="false">Paikalliset tiedostot</string><string name="local_files_empty_section_title" formatted="false">Lisää omia äänitiedostoja Omaan kirjastoon</string><string name="local_files_empty_section_subtitle" formatted="false">Onko sinulla kappale tai henkilökohtainen podcast, jota ei ole Spotifyssa?</string>@@ -138,14 +132,10 @@<string name="assisted_curation_search_filter_artists" formatted="false">Artistit</string><string name="assisted_curation_search_filter_albums" formatted="false">Albumit</string><string name="assisted_curation_search_filter_playlists" formatted="false">Soittolistat</string>- <string name="assisted_curation_search_filter_clear_content_description" formatted="false">Poista suodatin</string>- <string name="ad_category_title_music" formatted="false">Musiikki</string>- <string name="made_for_you_hub_title" formatted="false">Luotu sinulle</string><string name="settings_item_app_language_title" formatted="false">Sovelluksen kieli</string><string name="create_menu_item_folder_title" formatted="false">Kansio</string><string name="create_folder_name_suggested_folder_name" formatted="false">Uusi kansio</string><string name="context_menu_rename_folder" formatted="false">Nimeä kansio uudelleen</string>- <string name="your_library_messaging_folder_rename_hint" formatted="false">Kansion nimi</string><string name="create_playlist_content_description" formatted="false">Luo soittolista</string><string name="actions_picker_delete" formatted="false">Poista</string><string name="filter_and_sort_sort_section_title" formatted="false">Lajitteluperuste:</string>diff --git a/base/app/src/main/res/values-fr-rCA/spotify_strings.xml b/base/app/src/main/res/values-fr-rCA/spotify_strings.xmlindex 2f8dab97..fdf2e66f 100644--- a/base/app/src/main/res/values-fr-rCA/spotify_strings.xml+++ b/base/app/src/main/res/values-fr-rCA/spotify_strings.xml@@ -17,7 +17,6 @@<string name="snackbar_added_to_liked_songs" formatted="false">Ajoutée aux Chansons aimées.</string><string name="snackbar_removed_from_liked_songs" formatted="false">Supprimée des Chansons aimées.</string><string name="content_description_context_menu" formatted="false">Plus d\'options</string>- <string name="close_button_content_description" formatted="false">Fermer</string><string name="add_to_playlist_saved_in_section_header" formatted="false">Enregistrées dans</string><string name="add_to_playlist_new_playlist_button_text" formatted="false">Nouvelle liste de lecture</string><string name="add_to_playlist_button_cancel" formatted="false">Annuler</string>@@ -25,8 +24,6 @@<string name="lyrics_card_title" formatted="false">Paroles</string><string name="lyrics_card_title_preview" formatted="false">Aperçu des paroles</string><string name="lyrics_card_show_lyrics_button" formatted="false">Afficher les paroles</string>- <string name="lyrics_card_expand_button_content_description" formatted="false">Afficher les paroles en plein écran</string>- <string name="lyrics_card_share_button_content_description" formatted="false">Partager les paroles</string><string name="lyrics_credential_note" formatted="false">Paroles fournies par %1$s</string><string name="lyrics_fullscreen_chip_label_share" formatted="false">Partager</string><string name="lyrics_fullscreen_chip_label_translate" formatted="false">Traduire</string>@@ -49,7 +46,6 @@<string name="artist_popular_tracks" formatted="false">Populaire</string><string name="curation_button_follow_state_text" formatted="false">Suivre</string><string name="curation_button_following_state_text" formatted="false">Suivi</string>- <string name="search_main_entity_subtitle_artist" formatted="false">Artiste</string><string name="connect_phone_is_self" formatted="false">Ce téléphone</string><string name="settings_item_canvas_title" formatted="false">Canvas</string><string name="video_settings_canvas_subtitle" formatted="false">Courts contenus visuels en boucle pendant la lecture d\'une chanson.</string>@@ -107,8 +103,6 @@<string name="library_search_text_hint" formatted="false">Recherche dans votre bibliothèque</string><string name="account_title" formatted="false">Compte</string><string name="song_dna_search_chip_followed_artists" formatted="false">Artistes suivis</string>- <string name="settings_item_crossfade_title" formatted="false">Fondu enchaîné</string>- <string name="playback_settings_crossfade_slider_seconds" formatted="false">%1$d s</string><string name="local_files_title" formatted="false">Fichiers locaux</string><string name="local_files_empty_section_title" formatted="false">Ajoutez vos propres fichiers audio à votre Bibliothèque</string><string name="local_files_empty_section_subtitle" formatted="false">Vous avez une chanson ou un balado personnel qui n\'est pas sur Spotify?</string>@@ -138,14 +132,10 @@<string name="assisted_curation_search_filter_artists" formatted="false">Artistes</string><string name="assisted_curation_search_filter_albums" formatted="false">Albums</string><string name="assisted_curation_search_filter_playlists" formatted="false">Listes de lecture</string>- <string name="assisted_curation_search_filter_clear_content_description" formatted="false">Effacer le filtre</string>- <string name="ad_category_title_music" formatted="false">Musique</string>- <string name="made_for_you_hub_title" formatted="false">Juste pour vous</string><string name="settings_item_app_language_title" formatted="false">Langue de l\'appli</string><string name="create_menu_item_folder_title" formatted="false">Dossier</string><string name="create_folder_name_suggested_folder_name" formatted="false">Nouveau dossier</string><string name="context_menu_rename_folder" formatted="false">Renommer le dossier</string>- <string name="your_library_messaging_folder_rename_hint" formatted="false">Nom du dossier</string><string name="create_playlist_content_description" formatted="false">Créer une liste de lecture</string><string name="actions_picker_delete" formatted="false">Supprimer</string><string name="filter_and_sort_sort_section_title" formatted="false">Trier par</string>diff --git a/base/app/src/main/res/values-fr/extensions_strings.xml b/base/app/src/main/res/values-fr/extensions_strings.xmlnew file mode 100644index 00000000..4c9879c1--- /dev/null+++ b/base/app/src/main/res/values-fr/extensions_strings.xml@@ -0,0 +1,215 @@+<?xml version="1.0" encoding="utf-8"?>+<resources>+ <string name="extensions_title">Extensions</string>+ <string name="extensions_row_detail">Paroles, audio d\'un titre et scripts écrits par d\'autres, dans un bac à sable.</string>+ <string name="extensions_install_file">Installer depuis un fichier</string>+ <string name="extensions_install_url">Installer depuis une adresse</string>+ <string name="extensions_url_hint">https://…/extension.zip</string>+ <string name="extensions_none">Aucune extension installée.</string>+ <string name="extensions_installed">Installées</string>+ <string name="extensions_repository_add">Ajouter un dépôt</string>+ <string name="extensions_repository_hint">https://…/index.json</string>+ <string name="extensions_repository_warning">Myspoti ne vérifie pas un dépôt que vous ajoutez : ce que vous en installez est à vos risques.</string>+ <string name="extensions_repository_remove">Retirer</string>+ <string name="extensions_repository_refresh">Actualiser</string>+ <string name="extensions_install">Installer</string>+ <string name="extensions_update">Mettre à jour</string>+ <string name="extensions_up_to_date">Installée</string>+ <string name="extensions_cancel">Annuler</string>+ <string name="extensions_loading">Lecture…</string>+ <string name="extensions_error">Non installée : %1$s</string>+ <string name="extensions_prompt_title_install">Installer %1$s ?</string>+ <string name="extensions_prompt_title_update">Mettre à jour %1$s ?</string>+ <string name="extensions_prompt_by">%1$s · version %2$s · %3$s</string>+ <string name="extensions_prompt_source">Provenance : %1$s</string>+ <string name="extensions_prompt_source_file">un fichier de ce téléphone</string>+ <string name="extensions_prompt_new">nouveau dans cette version</string>+ <string name="extensions_prompt_update_same_rights">%1$s → %2$s, avec les mêmes droits.</string>+ <string name="extensions_prompt_not_newer">La version %1$s (ou une plus récente) est déjà installée.</string>+ <string name="extensions_prompt_sha">sha256 du paquet : %1$s</string>+ <string name="extension_enabled">Activée</string>+ <string name="extension_running">En marche</string>+ <string name="extension_not_running">À l\'arrêt</string>+ <string name="extension_turned_off">%1$s désactivée : %2$s</string>+ <string name="extension_last_error">Dernière erreur : %1$s</string>+ <string name="extension_disabled_reason">Désactivée : %1$s</string>+ <string name="extension_inactive">Inactive</string>+ <string name="extension_inactive_detail">Inactive : %1$s</string>+ <string name="extension_homepage">Site web</string>+ <string name="extension_settings">Réglages</string>+ <string name="extension_log">Journal</string>+ <string name="extension_log_empty">Rien dans le journal pour l\'instant.</string>+ <string name="extension_log_clear">Vider le journal</string>+ <string name="extension_update_file">Mettre à jour depuis un fichier</string>+ <string name="extension_uninstall">Désinstaller</string>+ <string name="extension_uninstall_confirm">Désinstaller %1$s ? Ses réglages et ses données partent avec elle.</string>+ <string name="extension_confirm_title">Une extension demande</string>+ <string name="extension_confirm_detail">Rien n\'est modifié sans votre accord.</string>+ <string name="extension_confirm_allow">Autoriser</string>+ <string name="extension_confirm_refuse">Refuser</string>+ <string name="extensions_row_count">%1$d installée(s), %2$d activée(s)</string>+ <string name="extensions_tab_store">Boutique</string>+ <string name="extensions_search">Rechercher des extensions</string>+ <string name="extensions_cat_all">Toutes</string>+ <string name="extensions_cat_lyrics">Paroles</string>+ <string name="extensions_cat_playback">Lecture et audio</string>+ <string name="extensions_cat_library">Bibliothèque</string>+ <string name="extensions_cat_discovery">Découverte</string>+ <string name="extensions_cat_stats">Statistiques</string>+ <string name="extensions_cat_look">Apparence</string>+ <string name="extensions_cat_social">Social</string>+ <string name="extensions_cat_tools">Outils</string>+ <string name="extensions_cat_other">Autres</string>+ <string name="extensions_no_match">Aucune extension ne correspond.</string>+ <string name="extensions_browse_store">Parcourir la boutique</string>+ <string name="extensions_other_ways">Autres façons d\'installer</string>+ <string name="extensions_empty_title">Les extensions, c\'est quoi ?</string>+ <string name="extensions_empty_body">Les extensions ajoutent à Myspoti ce qu\'il ne fait pas lui-même : des paroles d\'autres sources, d\'où vient l\'audio ou le téléchargement d\'un titre, des outils qui utilisent votre compte Spotify. Chacune tourne dans un bac à sable et demande avant d\'atteindre quoi que ce soit. Ajoutez un dépôt pour les parcourir, ou installez un paquet de confiance.</string>+ <string name="extensions_official_badge">Officiel</string>+ <string name="extensions_repo_yours">Ajouté par vous</string>+ <string name="extensions_repo_community">Communauté</string>+ <string name="extensions_repo_official_note">Chaque extension est vérifiée avant d\'être listée.</string>+ <string name="extensions_repo_yours_note">Non vérifié par Myspoti : installation à vos risques.</string>+ <string name="extensions_repo_error">Lecture du dépôt impossible : %1$s</string>+ <string name="extensions_repo_empty">Ce dépôt ne liste aucune extension.</string>+ <string name="extensions_requires">Nécessite Myspoti %1$s ou plus récent</string>+ <string name="extensions_requires_api">Faite pour un Myspoti plus récent (API d\'extension %1$d)</string>+ <string name="extensions_update_badge">Mise à jour</string>+ <string name="extensions_move_up">Monter</string>+ <string name="extensions_move_down">Descendre</string>+ <string name="extension_off">Désactivée</string>+ <string name="extension_by">par %1$s</string>+ <string name="extension_changelog">Nouveautés</string>+ <string name="extension_update_from">Mise à jour disponible : %1$s → %2$s</string>+ <string name="extension_not_listed">Cette extension n\'est pas dans vos dépôts (ou ils sont encore en chargement).</string>+ <string name="extension_details">Détails</string>+ <string name="extension_detail_updated">Mise à jour</string>+ <string name="extension_detail_min_app">Nécessite Myspoti</string>+ <string name="extension_detail_size">Taille</string>+ <string name="extension_detail_id">Id</string>+ <string name="extension_detail_sha">sha256 du paquet</string>+ <string name="extension_detail_source">Installée depuis</string>+ <string name="extension_see_in_store">Voir dans la boutique</string>++ <!-- Actions -->+ <string name="action_playback_control">Contrôler la lecture</string>+ <string name="action_playback_queue">Modifier la file d\'attente</string>+ <string name="action_playback_events">Savoir ce que vous écoutez</string>+ <string name="action_lyrics_provide">Fournir des paroles</string>+ <string name="action_trackinfo_provide">Ajouter des infos sur le titre</string>+ <string name="action_audio_source">Lire l\'audio d\'ailleurs</string>+ <string name="action_download_source">Fournir les téléchargements</string>+ <string name="action_home_sections">Ajouter des sections à l\'accueil</string>+ <string name="action_search_provide">Ajouter des résultats de recherche</string>+ <string name="action_menu_items">Ajouter des entrées de menu</string>+ <string name="action_player_buttons">Ajouter des boutons au lecteur</string>+ <string name="action_settings_page">Ses propres réglages</string>+ <string name="action_notify">Afficher de courts messages</string>+ <string name="action_library_read">Lire votre bibliothèque</string>+ <string name="action_library_write">Modifier votre bibliothèque</string>+ <string name="action_playlists_write">Modifier vos playlists</string>+ <string name="action_spotify_catalog">Parcourir Spotify</string>+ <string name="action_spotify_raw">Accès complet à Spotify</string>+ <string name="action_network">Utiliser Internet</string>+ <string name="action_network_any">Utiliser n\'importe quel site</string>+ <string name="action_webview_page">Sa propre page web</string>+ <string name="action_storage">Garder ses propres données</string>+ <string name="action_unknown">Inconnu de ce Myspoti</string>+ <string name="action_critical">Critique</string>+ <string name="action_no_why">(aucune raison donnée)</string>+ <string name="actions_title">Ce qu\'elle fait</string>+ <string name="actions_critical_warning">Les actions critiques peuvent modifier votre compte, remplacer la provenance des titres ou afficher une page web libre. Ne les autorisez que si vous faites confiance à l\'auteur : Myspoti demande toujours avant toute suppression.</string>+ <!-- Domaines -->+ <string name="area_playback">Lecture</string>+ <string name="area_lyrics">Paroles et infos</string>+ <string name="area_audio">Audio et téléchargements</string>+ <string name="area_home">Accueil et recherche</string>+ <string name="area_menus">Menus et lecteur</string>+ <string name="area_library">Bibliothèque et Spotify</string>+ <string name="area_other">Pages et autres</string>+ <string name="area_activity">Activité récente</string>+ <string name="area_turn_off">Désactiver</string>+ <string name="area_active">Active</string>+ <string name="area_idle">En attente</string>+ <string name="area_make_active">En faire celle pour %1$s</string>+ <!-- Installation -->+ <string name="ext_third_party_notice">Extension tierce, non vérifiée par Myspoti, sous la responsabilité de son auteur.</string>+ <string name="ext_risk_accept">Je comprends que cette extension est faite par un tiers et je l\'installe sous ma propre responsabilité</string>+ <string name="ext_clash_exclusive">Remplace %1$s, actuellement fourni par %2$s</string>+ <string name="ext_clash_conflict">Incompatible avec %1$s (installée)</string>+ <string name="ext_clash_replaces">Remplace %1$s (installée)</string>+ <string name="ext_clash_keep_new">Utiliser %1$s (l\'autre reste installée, %2$s)</string>+ <string name="ext_clash_keep_old">Garder %1$s</string>+ <string name="ext_clash_idle">en attente</string>+ <string name="ext_clash_off">désactivée</string>+ <string name="ext_clash_title">Laquelle garder ?</string>+ <string name="ext_clash_ok">OK</string>+ <!-- Blocs et pages -->+ <string name="ext_from">De %1$s</string>+ <string name="ext_overflow">Extensions</string>+ <string name="ext_open_page">Ouvrir sa page</string>+ <string name="ext_page_failed">La page de cette extension n\'a pas pu s\'afficher.</string>+ <string name="ext_suspended_title">%1$s mise en pause</string>+ <string name="ext_suspended_body">Elle défaisait sans cesse ce que %1$s faisait avec la lecture : ses commandes de lecture sont suspendues.</string>+ <string name="ext_suspended_keep">La laisser continuer</string>+ <string name="ext_welcome_title">%1$s est installée</string>+ <string name="ext_welcome_steps">Pour finir</string>+ <string name="ext_welcome_from">Écrit par l’extension.</string>+ <string name="ext_welcome_ok">Compris</string>++ <!-- GitHub : découverte, notes, signalements -->+ <string name="extensions_github_title">Sur GitHub</string>+ <string name="extensions_github_note">Publiées par la communauté, non vérifiées par Myspoti. Chaque auteur est responsable de son extension.</string>+ <string name="extensions_show_all">Tout afficher (%1$d masquées)</string>+ <string name="extensions_show_less">Masquer les bloquées, signalées, mal notées et abandonnées</string>+ <string name="extension_rating">★ %1$s · %2$d votes</string>+ <string name="extension_rating_none">Pas encore de vote</string>+ <string name="extension_downloads">%1$s téléchargements</string>+ <string name="extension_rate_up">La noter bien</string>+ <string name="extension_rate_down">La noter mal</string>+ <string name="extension_rated">Merci : votre vote est sur GitHub</string>+ <string name="extension_signin_title">Connexion à GitHub</string>+ <string name="extension_signin_body">Ouvrez %1$s et tapez ce code. Myspoti ne voit jamais votre mot de passe.</string>+ <string name="extension_signin_open">Ouvrir GitHub</string>+ <string name="extension_report">Signaler</string>+ <string name="extension_detail_github">GitHub</string>+ <string name="extension_detail_ref">Version sur GitHub</string>++ <!-- Mises à jour depuis GitHub -->+ <string name="extension_check_updates">Rechercher des mises à jour</string>+ <string name="extension_check_up_to_date">À jour</string>+ <string name="extension_check_applied">Mise à jour : elle ne demande rien de nouveau</string>+ <string name="extension_check_needs_ok">Une mise à jour attend votre accord</string>+ <string name="extension_check_declined">Vous avez gardé cette version</string>+ <string name="extension_check_incompatible">La nouvelle version demande un Myspoti plus récent</string>+ <string name="extension_check_blocked">La nouvelle version est bloquée par Myspoti</string>+ <string name="extension_check_failed">Vérification impossible : voir son journal</string>+ <string name="extension_source_gone">Source disparue : son dépôt n\'existe plus. Elle continue de tourner depuis la copie sur votre téléphone.</string>+ <string name="extension_revert">Revenir à %1$s</string>+ <string name="extension_reverted">Retour à %1$s</string>+ <string name="extension_update_needs_ok">Mise à jour à valider : %1$s → %2$s</string>+ <string name="extension_update_needs_ok_body">Cette version demande plus que ce que vous avez accepté. L\'actuelle continue de tourner jusqu\'à votre choix.</string>+ <string name="extension_update_accept">Accepter</string>+ <string name="extension_update_keep">Garder l\'actuelle</string>+ <string name="extension_refused_title">Attend votre accord</string>+ <string name="extension_refused_body">Elle a été installée quand on pouvait décocher des actions, et vous en avez décoché. Une extension reçoit désormais toutes les actions qu\'elle demande : elle reste éteinte tant que vous ne les acceptez pas.</string>+ <string name="extension_change_action">Nouveau : %1$s</string>+ <string name="extension_change_host">Nouveau site : %1$s</string>+ <string name="extension_change_any_host">N\'importe quel site</string>+ <string name="extension_change_exclusive">Désormais exclusive : %1$s</string>+ <string name="extension_change_why">Nouvelle raison pour %1$s</string>+ <string name="extension_change_was">Avant : « %1$s »</string>+ <string name="extension_change_repo">Vient désormais de %1$s (avant %2$s)</string>+ <string name="extension_change_author">Nouvel auteur : %1$s (avant %2$s)</string>+ <string name="extension_change_replaces">Désactive %1$s à l\'installation</string>+ <string name="extension_change_conflicts">Refuse de tourner avec %1$s</string>+ <string name="action_webview_auth">Se connecter sur un site web</string>+ <string name="extension_confirm_once">Autoriser une fois</string>+ <string name="extension_confirm_always">Toujours autoriser %1$s</string>+ <string name="ext_auth_title">%1$s : connexion</string>+ <string name="ext_auth_close">Fermer</string>+ <string name="ext_auth_notice">Une page à part : ce que vous saisissez et ses cookies restent dans Myspoti. L\'extension ne reçoit que l\'adresse finale de la page.</string>+ <string name="ext_grants_title">Toujours autorisé</string>+ <string name="ext_grants_note">Modifications Spotify que cette extension effectue sans vous demander. Révoquez-en une pour être à nouveau interrogé.</string>+ <string name="ext_grant_revoke">Révoquer</string>+</resources>diff --git a/base/app/src/main/res/values-fr/myspoti_strings.xml b/base/app/src/main/res/values-fr/myspoti_strings.xmlindex 57bedd48..c8a2521f 100644--- a/base/app/src/main/res/values-fr/myspoti_strings.xml+++ b/base/app/src/main/res/values-fr/myspoti_strings.xml@@ -1,20 +1,13 @@<?xml version="1.0" encoding="utf-8"?><!-- Myspoti's own texts (English default, French). --><resources>- <string name="welcome_tagline">Ta musique, avec les paroles synchronisées et les clips officiels.</string><string name="welcome_lead">Ta musique,</string><string name="welcome_rotate_ads">sans pubs.</string><string name="welcome_rotate_lyrics">avec les paroles mot par mot.</string><string name="welcome_rotate_clips">avec les clips officiels.</string>- <string name="welcome_rotate_offline">même hors ligne.</string>- <string name="welcome_rotate_lossless">en qualité sans perte.</string>+ <string name="welcome_rotate_offline">hors ligne, grâce aux extensions.</string><string name="welcome_login">Se connecter avec Spotify</string><string name="welcome_privacy">Vous vous connectez sur la page officielle de Spotify. Myspoti ne voit jamais votre mot de passe.</string>- <string name="crash_heading">Myspoti s\'est arrêté</string>- <string name="crash_explanation">Un problème est survenu. Relance l\'app ; si ça recommence, copie le rapport et partage-le dans une issue GitHub.</string>- <string name="crash_restart_app">Relancer Myspoti</string>- <string name="crash_copy_report">Copier le rapport</string>- <string name="crash_report_copied">Rapport copié</string><string name="remove_from_liked">Retirer des Titres likés</string><string name="repeat_on">Répéter : activé</string><string name="repeat_one">Répéter le titre</string>@@ -54,7 +47,6 @@<string name="background_playback_title">Lecture en arrière-plan</string><string name="background_playback_on">L\'optimisation de la batterie est désactivée : la musique et Spotify Connect continuent écran éteint.</string><string name="background_playback_off">Désactive l\'optimisation de la batterie pour qu\'Android ne mette pas l\'app en pause en arrière-plan.</string>- <string name="crossfade_summary">Fondu en fin de titre puis en début du suivant (sans superposition). Sur ce téléphone uniquement.</string><plurals name="local_files_count"><item quantity="one">%d titre</item><item quantity="other">%d titres</item>@@ -62,8 +54,13 @@<string name="local_files_none_subtitle">Aucun fichier audio lisible n\'a été trouvé sur cet appareil. Ils apparaîtront ici dès qu\'il y en aura.</string><string name="downloads_empty_title">Téléchargez pour écouter hors connexion</string><string name="downloads_empty_subtitle">Touchez Télécharger dans le menu d\'un titre, ou le bouton de téléchargement d\'un album ou d\'une playlist.</string>- <string name="downloads_source">FLAC sans perte, vérifié avec l\'enregistrement original. Gardé dans Myspoti uniquement.</string>+ <string name="downloads_source">Depuis votre extension de source de téléchargement, vérifié avec l\'enregistrement original. Gardé dans Myspoti uniquement.</string><string name="downloads_size">%1$s sur ce téléphone</string>+ <string name="downloads_lists">Albums et playlists</string>+ <string name="downloads_singles">Titres</string>+ <string name="downloads_kind_album">Album</string>+ <string name="downloads_kind_playlist">Playlist</string>+ <string name="downloads_kind_liked">Titres likés</string><string name="download_unavailable">Aucun enregistrement correspondant trouvé</string><string name="download_retry">Réessayer</string><string name="download_cancel">Annuler le téléchargement</string>@@ -74,11 +71,8 @@<string name="artist_not_found">Artiste introuvable</string><string name="playlist_not_found">Playlist introuvable</string><string name="browse_new_releases">Nouveautés</string>- <string name="browse_charts">Classements</string>- <string name="browse_workout">Sport</string>- <string name="browse_dance_electronic">Dance/Électro</string><string name="language_auto">Automatique</string>- <string name="language_auto_detail">La langue du téléphone quand Myspoti l\'a (allemand, anglais, espagnol, français, grec, italien, portugais), sinon l\'anglais</string>+ <string name="language_auto_detail">La langue du téléphone quand Myspoti l\'a (allemand, anglais, chinois, espagnol, français, grec, italien, polonais, portugais, russe), sinon l\'anglais</string><string name="language_partial_note">Autres langues : les libellés de Spotify sont traduits, les textes de Myspoti restent en anglais.</string><string name="restart_player_title">Redémarrer le lecteur</string><string name="restart_player_detail">Si la musique ne répond plus : recharge le lecteur Spotify</string>@@ -94,7 +88,6 @@<string name="local_rename">Renommer</string><string name="local_delete_playlist">Supprimer la playlist</string><string name="local_added_to">Ajouté à %1$s</string>- <string name="folder_create_failed">Impossible de créer le dossier</string><string name="local_playlist_empty">Ajoutez des titres depuis Fichiers locaux avec leur bouton +.</string><string name="playlist_change_refused">Spotify a refusé la modification de cette playlist</string><string name="download_kept_by_list">Reste téléchargé : une playlist téléchargée le contient</string>@@ -132,6 +125,7 @@<string name="library_reorder_hint">Maintenez une playlist, puis faites-la glisser pour la déplacer</string><string name="library_reorder_reset">Revenir à l\'ordre de Spotify</string><string name="song_radio_failed">Impossible d\'ouvrir la radio de ce titre</string>+ <string name="song_radio_name">Radio de %1$s</string><string name="local_files_find_hint">Rechercher dans les fichiers locaux</string><string name="data_saver_title">Économiseur de données</string><string name="data_saver_summary">En données mobiles, Myspoti n\'utilise aucune donnée : seuls les sons téléchargés et les fichiers locaux sont lus</string>@@ -148,7 +142,6 @@<string name="recap_listens">%1$d écoutes</string><string name="recap_sources">Spotify %1$d min • Téléchargements %2$d min • Fichiers locaux %3$d min</string><string name="recap_empty">Écoutez un peu : vos titres et artistes préférés apparaîtront ici.</string>- <string name="recently_played_title">Écoutés récemment</string><string name="recently_played_empty">Ce que vous écoutez sur ce compte apparaît ici.</string><string name="recently_played_failed">Impossible de charger les écoutes récentes (%1$s)</string><string name="recents_title">Récents</string>@@ -175,13 +168,8 @@<string name="playback_speed">Vitesse de lecture</string><string name="recommended_songs">Titres recommandés</string><string name="jam_title">Jam</string>- <string name="jam_restricted">Spotify réserve le lancement d\'une Jam aux comptes Premium. Vous pouvez quand même en rejoindre une avec un lien.</string>- <string name="jam_join">Rejoindre une Jam</string>- <string name="jam_join_hint">Collez le lien d\'invitation</string><string name="jam_leave">Quitter la Jam</string><string name="jam_members">%1$d personnes écoutent</string>- <string name="pin">Épingler</string>- <string name="unpin">Désépingler</string><string name="jam_start">Lancer une Jam</string><string name="jam_invite">Partager le lien d\'invitation</string><string name="jam_failed">Spotify a refusé cette Jam</string>@@ -218,27 +206,6 @@<string name="smart_shuffle_title">Lecture aléatoire intelligente</string><string name="smart_shuffle_on">Aléatoire intelligent : des recommandations Spotify se glissent dans la playlist mélangée.</string><string name="track_sort_added">Date d\'ajout</string>- <!-- Téléchargements lossless (SpotiFLAC) -->- <string name="spotiflac_row_title">Téléchargements lossless (FLAC)</string>- <string name="spotiflac_row_on">Vérifié — Myspoti passe par les serveurs de SpotiFLAC.</string>- <string name="spotiflac_row_off">Non vérifié — appuie pour faire la vérification unique.</string>- <string name="spotiflac_verify_title">Vérification SpotiFLAC</string>- <string name="spotiflac_verify_start_failed">Impossible de démarrer la vérification. Appuie sur Réessayer ou reviens plus tard.</string>- <string name="spotiflac_verify_timeout">La vérification a expiré. Appuie sur Réessayer ou Passer pour le moment.</string>- <string name="spotiflac_verify_rejected">La vérification a été refusée. Appuie sur Réessayer ou Passer pour le moment.</string>- <string name="spotiflac_session_ok">Session SpotiFLAC enregistrée</string>- <string name="spotiflac_session_creating">Création de la session sécurisée…</string>- <string name="spotiflac_session_failed">Impossible de finir la vérification. Appuie sur Réessayer ou Passer pour le moment.</string>- <string name="spotiflac_skip">Passer pour le moment</string>- <string name="retry">Réessayer</string>- <string name="spotiflac_status_title">SpotiFLAC</string>- <string name="spotiflac_status_verified">Tu es vérifié : les téléchargements passent par les serveurs de SpotiFLAC, la source lossless la plus fiable. Seule cette session est utilisée — pas de compte, rien d\'autre gardé.</string>- <string name="spotiflac_session_expires">Session valide jusqu\'au %1$s</string>- <string name="spotiflac_forget">Oublier cette session</string>- <string name="lossless_hires_title">Téléchargements hi-res (24 bits)</string>- <string name="lossless_hires_detail">Un titre gardé en 24 bits hi-res quand la source l\'a. Les fichiers font environ trois fois la taille d\'un CD qualité.</string>- <string name="setup_spotiflac_title">Téléchargements lossless (FLAC)</string>- <string name="setup_spotiflac_detail">Vérifie une fois avec SpotiFLAC pour que les téléchargements passent par ses serveurs lossless.</string><string name="settings_title">Réglages</string><string name="settings_detail">Qualité du son, téléchargements, données, batterie et langue</string><string name="settings_section_playback">Lecture</string>@@ -267,7 +234,6 @@<string name="setup_quality_subtitle">Choisissez comment Myspoti lit et enregistre votre musique. Vous pourrez le changer plus tard dans les Réglages.</string><string name="downloads_off_toast">Les téléchargements sont désactivés. Activez-les dans les Réglages.</string><string name="quality_streaming_high_detail">160 kbit/s, le meilleur son</string>- <string name="downloads_verify_hint">Aucune source sans perte n\'a répondu. Faites une fois la vérification SpotiFLAC dans Réglages, Téléchargements : ses serveurs sont les plus fiables.</string><string name="quality_download_small">La plus légère</string><string name="quality_download_small_detail">AAC 96 kbit/s, le minimum : environ 3 Mo par titre</string><string name="settings_solid_nav_title">Barre du bas opaque</string>@@ -277,7 +243,6 @@<string name="quality_sheet_title">Qualité du son</string><string name="quality_now">En cours : %1$s</string><string name="quality_now_unknown">Pas encore connue : lancez un titre</string>- <string name="spotiflac_verify_in_browser">Résolvez la vérification dans l\'onglet du navigateur qui s\'est ouvert, puis revenez ici.</string><string name="update_downloading">Téléchargement… %1$d%%</string><string name="update_installing">Installation…</string><string name="update_needs_permission">Pour mettre à jour, autorisez Myspoti à installer des applications, puis revenez ici.</string>@@ -294,7 +259,6 @@<!-- A25 : arrêter la file, garder les titres déjà téléchargés. --><string name="downloads_stop_all_title">Arrêter tous les téléchargements</string><string name="downloads_stop_all_detail">Annule ce qui reste ; les titres déjà téléchargés sont conservés</string>- <string name="downloads_verify_banner">Les téléchargements demandent la vérification SpotiFLAC une fois dans cette app. Touchez ici pour la faire.</string><string name="removed_from">Retiré de %1$s</string><!-- Options d'un titre dans une playlist (A11/A12). --><string name="context_menu_remove_from_playlist">Retirer de cette playlist</string>@@ -311,14 +275,6 @@<string name="playlist_remove_cover">Retirer la pochette</string><string name="playlist_save">Enregistrer</string><string name="playlist_access_title">Qui peut la voir</string>- <string name="playlist_access_public">Publique</string>- <string name="playlist_access_public_detail">Tout le monde peut la trouver et l\'écouter</string>- <string name="playlist_access_private">Privée</string>- <string name="playlist_access_private_detail">Vous seul pouvez la voir</string>- <string name="playlist_access_collaborative">Collaborative</string>- <string name="playlist_access_collaborative_detail">Seules les personnes que vous invitez peuvent ajouter et retirer des titres</string>- <string name="playlist_on_profile">Sur votre profil</string>- <string name="playlist_on_profile_detail">Affichée sur votre profil, visible par les autres</string><string name="choose_artist">Choisir un artiste</string><string name="quality_streaming_wifi_title">Streaming en Wi-Fi</string><string name="quality_streaming_cell_title">Streaming en données mobiles</string>@@ -356,13 +312,13 @@<string name="library_sort_recently_added">Ajoutés récemment</string><string name="library_change_failed">Impossible de mettre à jour votre bibliothèque, réessayez</string><string name="a11y_close_player">Fermer le lecteur</string>- <string name="a11y_devices">Appareils</string><string name="a11y_share">Partager</string><string name="search_failed">La recherche a échoué. Vérifiez votre connexion.</string><string name="retry_button">Réessayer</string><string name="page_load_failed">Impossible de charger cette page.\nVérifiez votre connexion et réessayez.</string><string name="jam_paste_link">Rejoindre avec un lien copié</string><string name="play_refused">Spotify a refusé cette lecture sur votre compte. Dans certains pays, un compte gratuit ne joue qu’en aléatoire : essayez le bouton aléatoire.</string>+ <string name="play_refused_all">Spotify refuse en ce moment toutes les commandes de ce lecteur sur votre compte (lecture, déplacement, transfert). Le lecteur a été rechargé une fois ; si rien ne joue, fermez complètement l’application et rouvrez-la, ou basculez entre le Wi-Fi et les données mobiles.</string><string name="drm_missing">Lecture impossible ici : l’Android System WebView de ce téléphone n’a pas de DRM Widevine fonctionnel, dont Spotify a besoin. Mettez à jour Android System WebView et Chrome dans le Play Store, puis choisissez-le dans Paramètres > Options pour les développeurs > Implémentation WebView.</string><string name="artist_liked_songs">Titres likés</string><plurals name="artist_liked_songs_count">@@ -382,7 +338,6 @@<string name="settings_rotation_auto">Automatique</string><string name="settings_rotation_landscape">Paysage</string><string name="support_github_action">Sponsor sur GitHub</string>- <string name="spotiflac_verify_again">La vérification SpotiFLAC a expiré : refais-la dans les Réglages pour télécharger en lossless</string><string name="download_on_mobile_data">Téléchargement en données mobiles : il utilise votre forfait</string><!-- Page émission, page épisode et lecteur de podcast -->@@ -396,11 +351,8 @@<string name="show_sort_chapters_newest">Tous les chapitres • Plus récents</string><string name="show_sort_chapters_oldest">Tous les chapitres • Plus anciens</string><string name="show_empty">Rien à écouter pour le moment</string>- <string name="show_rating">%1$s (%2$s)</string><string name="show_authors">De %1$s</string><string name="show_narrators">Lu par %1$s</string>- <string name="show_followed">Abonnement ajouté</string>- <string name="show_unfollowed">Abonnement retiré</string><string name="episode_duration_min">%1$d min</string><string name="episode_remaining">encore %1$s</string><string name="episode_mark_played">Marquer comme terminé</string>@@ -413,20 +365,14 @@<string name="episode_show_more">afficher plus</string><string name="episode_show_less">afficher moins</string><string name="episode_download">Télécharger</string>- <string name="episode_downloading">Téléchargement…</string>- <string name="episode_downloaded">Téléchargé</string><string name="episode_download_remove">Supprimer le téléchargement</string><string name="episode_options">Options de l\'épisode</string><string name="episode_not_found">Épisode introuvable</string>- <string name="show_not_found">Émission introuvable</string><string name="podcast_playing_from">Lecture à partir du podcast</string><string name="player_speed_chip">%1$s×</string><string name="player_back_15">Reculer de 15 secondes</string><string name="player_forward_15">Avancer de 15 secondes</string>- <string name="player_show_remaining">Afficher le temps restant</string>- <string name="player_show_elapsed">Afficher le temps écoulé</string><string name="player_sleep_timer">Minuteur de veille</string>- <string name="player_speed_a11y">Vitesse de lecture, %1$s×</string><string name="restart_player_done">Lecteur redémarré</string><string name="spotify_limited">Spotify limite la lecture pour le moment. Réessayez dans une minute.</string><string name="library_change_undone">Spotify a refusé la modification, votre bibliothèque est revenue comme avant</string>@@ -444,7 +390,6 @@<string name="blend_deleted">Ce Blend a été supprimé</string><string name="blend_working">En cours…</string><string name="blend_invited_by">%1$s t\'invite à un Blend</string>- <string name="blend_open">Ouvrir le Blend</string><string name="blend_later">Plus tard</string><string name="blend_members">Membres</string><string name="blend_invite_more">Inviter d\'autres personnes</string>@@ -475,8 +420,6 @@<string name="link_copied">Lien copié</string><string name="lyrics_meaning_title">Signification</string><string name="lyrics_meaning_about">À propos</string>- <string name="lyrics_meaning_lines">Les paroles expliquées</string>- <string name="lyrics_meaning_source">Source : Genius · ouvrir le titre sur Genius</string><string name="lyrics_meaning_translating">Traduction…</string><string name="lyrics_meaning_translate">Traduire</string><string name="lyrics_meaning_original">Voir l’original</string>@@ -510,5 +453,40 @@<string name="playlist_members_title">Collaborateurs</string><string name="playlist_member_owner">Créateur</string><string name="playlist_member_collab">Collaborateur</string>+ <string name="playlist_member_listener">Auditeur</string>+ <string name="playlist_member_remove_collab">Retirer des collaborateurs</string>+ <string name="playlist_member_make_collab">Passer en collaborateur</string>+ <string name="playlist_member_remove">Retirer de la playlist</string>+ <string name="playlist_stop_collab_private">Arrêter la collaboration sur %1$s ? Ses collaborateurs deviennent de simples auditeurs : ils peuvent toujours l’écouter, mais plus ajouter ni retirer de titres. Les liens d’invitation déjà partagés restent valables jusqu’à leur expiration (7 jours maximum) et ne peuvent pas être annulés.</string>+ <string name="playlist_stop_collab_public">Arrêter la collaboration sur %1$s ? Ses collaborateurs sont retirés de la playlist. Les liens d’invitation déjà partagés restent valables jusqu’à leur expiration (7 jours maximum) et ne peuvent pas être annulés.</string><string name="playlist_members_more">%1$s et %2$d autres</string>+ <string name="library_chip_playlists">Playlists</string>+ <string name="library_chip_artists">Artistes</string>+ <string name="library_chip_albums">Albums</string>+ <string name="library_chip_songs">Titres</string>+ <string name="add_playlist_to_playlist">Ajouter la playlist à une autre playlist</string>+ <string name="add_collection_reading">Lecture des titres…</string>+ <string name="add_collection_nothing">Rien à ajouter</string>+ <string name="add_collection_done">%1$d titres ajoutés à %2$s</string>+ <string name="duplicate_title_some">Certains titres sont déjà ajoutés</string>+ <string name="duplicate_title_all">Déjà ajoutés</string>+ <string name="duplicate_text_some">Certains de ces titres sont déjà dans %1$s.</string>+ <string name="duplicate_text_all">Ces titres sont déjà dans %1$s.</string>+ <string name="duplicate_add_all">Tout ajouter</string>+ <string name="duplicate_add_new">Ajouter les nouveaux</string>+ <string name="duplicate_add_anyway">Ajouter quand même</string>+ <string name="duplicate_dont_add">Ne pas ajouter</string>+ <string name="settings_music_video_title">Clips vidéo</string>+ <string name="settings_music_video_detail">Le bouton vidéo du lecteur et les clips qui démarrent seuls. Désactivé : audio et Canvas uniquement.</string>+ <string name="downloads_need_source">Les téléchargements ont besoin d\'une extension source. Installez-en une dans Réglages, Extensions.</string>+ <string name="downloads_source_row_title">Source des téléchargements</string>+ <string name="downloads_source_row_on">Une extension fournit les fichiers. Touchez pour gérer les extensions.</string>+ <string name="downloads_source_row_off">Aucune pour l\'instant : installez une extension de source de téléchargement.</string>+ <string name="profile_block">Bloquer</string>+ <string name="profile_unblock">Débloquer</string>+ <string name="profile_block_title">Bloquer %1$s ?</string>+ <string name="profile_block_confirm">%1$s ne pourra plus vous suivre ni voir votre profil et vos playlists publiques. Vous pourrez le débloquer à tout moment depuis son profil.</string>+ <string name="profile_blocked">Vous avez bloqué cet utilisateur</string>+ <string name="profile_block_failed">Impossible de modifier le blocage, réessayez</string>+ <string name="profile_more_options">Plus d’options</string></resources>diff --git a/base/app/src/main/res/values-fr/spotify_strings.xml b/base/app/src/main/res/values-fr/spotify_strings.xmlindex 376ce73d..365bcc38 100644--- a/base/app/src/main/res/values-fr/spotify_strings.xml+++ b/base/app/src/main/res/values-fr/spotify_strings.xml@@ -17,7 +17,6 @@<string name="snackbar_added_to_liked_songs" formatted="false">Ajouté aux Titres likés.</string><string name="snackbar_removed_from_liked_songs" formatted="false">Supprimé de Titres likés.</string><string name="content_description_context_menu" formatted="false">Plus d\'options</string>- <string name="close_button_content_description" formatted="false">Fermer</string><string name="add_to_playlist_saved_in_section_header" formatted="false">Enregistrée dans</string><string name="add_to_playlist_new_playlist_button_text" formatted="false">Nouvelle playlist</string><string name="add_to_playlist_button_cancel" formatted="false">Annuler</string>@@ -25,8 +24,6 @@<string name="lyrics_card_title" formatted="false">Paroles</string><string name="lyrics_card_title_preview" formatted="false">Aperçu des paroles</string><string name="lyrics_card_show_lyrics_button" formatted="false">Afficher les paroles</string>- <string name="lyrics_card_expand_button_content_description" formatted="false">Ouvrir les paroles en plein écran</string>- <string name="lyrics_card_share_button_content_description" formatted="false">Partager des paroles</string><string name="lyrics_credential_note" formatted="false">Paroles fournies par %1$s</string><string name="lyrics_fullscreen_chip_label_share" formatted="false">Partager</string><string name="lyrics_fullscreen_chip_label_translate" formatted="false">Traduire</string>@@ -49,7 +46,6 @@<string name="artist_popular_tracks" formatted="false">Populaires</string><string name="curation_button_follow_state_text" formatted="false">S\'abonner</string><string name="curation_button_following_state_text" formatted="false">Abonné</string>- <string name="search_main_entity_subtitle_artist" formatted="false">Artiste</string><string name="connect_phone_is_self" formatted="false">Ce téléphone</string><string name="settings_item_canvas_title" formatted="false">Canvas</string><string name="video_settings_canvas_subtitle" formatted="false">De courts visuels diffusés en boucle pendant la lecture d\'un titre.</string>@@ -107,8 +103,6 @@<string name="library_search_text_hint" formatted="false">Rechercher dans la Bibliothèque</string><string name="account_title" formatted="false">Compte</string><string name="song_dna_search_chip_followed_artists" formatted="false">Artistes suivi·e·s</string>- <string name="settings_item_crossfade_title" formatted="false">Fondu enchaîné</string>- <string name="playback_settings_crossfade_slider_seconds" formatted="false">%1$d s</string><string name="local_files_title" formatted="false">Fichiers locaux</string><string name="local_files_empty_section_title" formatted="false">Ajoutez vos propres fichiers audio à la Bibliothèque</string><string name="local_files_empty_section_subtitle" formatted="false">Vous avez un titre ou un podcast personnel qui n\'est pas disponible sur Spotify ?</string>@@ -138,14 +132,10 @@<string name="assisted_curation_search_filter_artists" formatted="false">Artistes</string><string name="assisted_curation_search_filter_albums" formatted="false">Albums</string><string name="assisted_curation_search_filter_playlists" formatted="false">Playlists</string>- <string name="assisted_curation_search_filter_clear_content_description" formatted="false">Effacer le filtre</string>- <string name="ad_category_title_music" formatted="false">Musique</string>- <string name="made_for_you_hub_title" formatted="false">Suggestions personnalisées</string><string name="settings_item_app_language_title" formatted="false">Langue de l\'appli</string><string name="create_menu_item_folder_title" formatted="false">Dossier</string><string name="create_folder_name_suggested_folder_name" formatted="false">Nouveau dossier</string><string name="context_menu_rename_folder" formatted="false">Renommer le dossier</string>- <string name="your_library_messaging_folder_rename_hint" formatted="false">Nom du dossier</string><string name="create_playlist_content_description" formatted="false">Créer une playlist</string><string name="actions_picker_delete" formatted="false">Supprimer</string><string name="filter_and_sort_sort_section_title" formatted="false">Trier par</string>diff --git a/base/app/src/main/res/values-fr/stats_strings.xml b/base/app/src/main/res/values-fr/stats_strings.xmlnew file mode 100644index 00000000..d0cc3330--- /dev/null+++ b/base/app/src/main/res/values-fr/stats_strings.xml@@ -0,0 +1,24 @@+<?xml version="1.0" encoding="utf-8"?>+<resources>+ <string name="stats_tab_spotify">Sur Spotify</string>+ <string name="stats_tab_phone">Sur ce téléphone</string>+ <string name="stats_range_short">4 dernières semaines</string>+ <string name="stats_range_medium">6 derniers mois</string>+ <string name="stats_range_long">Dernière année</string>+ <string name="stats_artists_ranked">%1$d artistes dans vos écoutes</string>+ <string name="stats_empty">Spotify n\'a pas encore d\'artistes ni de titres pour cette période. Continuez d\'écouter et revenez plus tard.</string>+ <string name="stats_failed">Spotify n\'a pas envoyé vos statistiques.</string>+ <string name="stats_spotify_note">Classement établi par Spotify à partir de tout ce que ce compte a écouté, sur tous vos appareils. Spotify ne communique ni le nombre d\'écoutes ni les minutes : les minutes de « Sur ce téléphone » sont le décompte de Myspoti.</string>+ <string name="stats_weekly_minutes">Minutes par semaine</string>+ <string name="stats_this_week">Cette semaine : %1$d min</string>+ <string name="stats_listening_stats">Statistiques d\'écoute</string>+ <string name="friends_title">Activité des amis</string>+ <string name="friends_detail">Ce qu\'écoutent les personnes que vous suivez</string>+ <string name="friends_now">En ce moment</string>+ <string name="friends_empty">Aucune activité pour l\'instant. Les amis que vous suivez et qui partagent leur activité d\'écoute sur Spotify apparaissent ici.</string>+ <string name="friends_failed">Spotify n\'a pas envoyé l\'activité des amis.</string>+ <string name="friends_refresh">Actualiser</string>+ <string name="artist_top_short">Votre artiste n° %1$d des 4 dernières semaines</string>+ <string name="artist_top_medium">Votre artiste n° %1$d des 6 derniers mois</string>+ <string name="artist_top_long">Votre artiste n° %1$d de la dernière année</string>+</resources>diff --git a/base/app/src/main/res/values-fr/strings.xml b/base/app/src/main/res/values-fr/strings.xmlindex 050abe03..5bbc2cbe 100644--- a/base/app/src/main/res/values-fr/strings.xml+++ b/base/app/src/main/res/values-fr/strings.xml@@ -4,37 +4,17 @@<string name="aa_playlists">Playlists</string><string name="aa_albums">Albums</string><string name="aa_artists">Artistes</string>- <string name="aa_podcasts">Podcasts</string><string name="settings_amoled_theme">Thème AMOLED</string><string name="settings_amoled_theme_subtitle">Arrière-plan noir pur pour économiser la batterie</string>- <string name="settings_lyrics_style_spotify_default">Spotify par défaut</string>- <string name="settings_lyrics_style_fullscreen">Plein écran (Couleurs de l\'album)</string>- <string name="settings_lyrics_style_compact">Compact</string>- <string name="settings_lyrics_style_karaoke">Karaoké</string>- <string name="settings_lyrics_style_bold">Grand texte en gras</string><string name="main_update_available">Une nouvelle mise à jour est disponible</string>- <string name="notif_channel_media_name">Lecture média</string>- <string name="notif_channel_media_description">Commandes de lecture média Myspoti</string>- <string name="notif_action_previous">Précédent</string>- <string name="notif_action_next">Suivant</string><string name="notif_action_play">Lecture</string><string name="notif_action_pause">Pause</string><string name="notif_shuffle_enable">Activer la lecture aléatoire</string><string name="notif_shuffle_disable">Désactiver la lecture aléatoire</string><string name="notif_shuffle_disable_smart">Désactiver la lecture aléatoire intelligente</string>- <string name="notif_action_like">J\'aime</string>- <string name="notif_action_unlike">Je n\'aime plus</string>- <string name="notif_unknown_name">Inconnu</string>- <string name="notif_by_artist">par %1$s</string>- <string name="notif_repeat_disable">Désactiver la répétition</string>- <string name="notif_repeat_disable_one">Désactiver la répétition du titre</string>- <string name="notif_repeat_enable">Activer la répétition</string>- <string name="bridge_player_unlocked">Lecteur déverrouillé</string>- <string name="bridge_reloading">Rechargement…</string>- <string name="service_disabled_message">Le service n\'est pas activé</string><string name="energy_saver_title" tools:ignore="MissingTranslation">Économie d’énergie</string><string name="energy_saver_summary" tools:ignore="MissingTranslation">Canvas désactivés, vidéos et animations allégées</string><string name="video_fullscreen_enter" tools:ignore="MissingTranslation">Plein écran</string>@@ -42,4 +22,6 @@<string name="playback_seek_description" tools:ignore="MissingTranslation">Position de lecture</string><string name="account_page_title">Compte Spotify</string><string name="account_page_detail">Abonnement, confidentialité et appareils, sur spotify.com</string>+ <string name="player_source_downloaded">Téléchargé</string>+ <string name="extension_change_write">Peut aussi envoyer à Spotify : %1$s</string></resources>diff --git a/base/app/src/main/res/values-gl/spotify_strings.xml b/base/app/src/main/res/values-gl/spotify_strings.xmlindex 500a2b8f..b5ee390f 100644--- a/base/app/src/main/res/values-gl/spotify_strings.xml+++ b/base/app/src/main/res/values-gl/spotify_strings.xml@@ -17,7 +17,6 @@<string name="snackbar_added_to_liked_songs" formatted="false">Engadiuse a Cancións que che gustan.</string><string name="snackbar_removed_from_liked_songs" formatted="false">Quitouse de Cancións que che gustan.</string><string name="content_description_context_menu" formatted="false">Máis opcións</string>- <string name="close_button_content_description" formatted="false">Pechar</string><string name="add_to_playlist_saved_in_section_header" formatted="false">Gardouse en</string><string name="add_to_playlist_new_playlist_button_text" formatted="false">Nova lista</string><string name="add_to_playlist_button_cancel" formatted="false">Cancelar</string>@@ -25,8 +24,6 @@<string name="lyrics_card_title" formatted="false">Letra</string><string name="lyrics_card_title_preview" formatted="false">Vista previa da letra</string><string name="lyrics_card_show_lyrics_button" formatted="false">Mostrar letra</string>- <string name="lyrics_card_expand_button_content_description" formatted="false">Abrir a letra en pantalla completa</string>- <string name="lyrics_card_share_button_content_description" formatted="false">Compartir letra</string><string name="lyrics_credential_note" formatted="false">Letra proporcionada por %1$s</string><string name="lyrics_fullscreen_chip_label_share" formatted="false">Compartir</string><string name="lyrics_fullscreen_chip_label_translate" formatted="false">Traducir</string>@@ -49,7 +46,6 @@<string name="artist_popular_tracks" formatted="false">Popular</string><string name="curation_button_follow_state_text" formatted="false">Seguir</string><string name="curation_button_following_state_text" formatted="false">Seguindo</string>- <string name="search_main_entity_subtitle_artist" formatted="false">Artista</string><string name="connect_phone_is_self" formatted="false">Este teléfono</string><string name="settings_item_canvas_title" formatted="false">Canvas</string><string name="video_settings_canvas_subtitle" formatted="false">Elementos visuais breves e en bucle mentres se reproduce unha canción.</string>@@ -107,8 +103,6 @@<string name="library_search_text_hint" formatted="false">Fai buscas na túa mediateca</string><string name="account_title" formatted="false">Conta</string><string name="song_dna_search_chip_followed_artists" formatted="false">Artistas que segues</string>- <string name="settings_item_crossfade_title" formatted="false">Transición gradual</string>- <string name="playback_settings_crossfade_slider_seconds" formatted="false">%1$d s</string><string name="local_files_title" formatted="false">Ficheiros locais</string><string name="local_files_empty_section_title" formatted="false">Engade os teus propios ficheiros de audio á túa mediateca</string><string name="local_files_empty_section_subtitle" formatted="false">Tes unha canción ou un podcast persoal que non estea en Spotify?</string>@@ -138,14 +132,10 @@<string name="assisted_curation_search_filter_artists" formatted="false">Artistas</string><string name="assisted_curation_search_filter_albums" formatted="false">Álbums</string><string name="assisted_curation_search_filter_playlists" formatted="false">Listas</string>- <string name="assisted_curation_search_filter_clear_content_description" formatted="false">Borrar o filtro</string>- <string name="ad_category_title_music" formatted="false">Música</string>- <string name="made_for_you_hub_title" formatted="false">Especialmente para ti</string><string name="settings_item_app_language_title" formatted="false">Idioma da aplicación</string><string name="create_menu_item_folder_title" formatted="false">Cartafol</string><string name="create_folder_name_suggested_folder_name" formatted="false">Novo cartafol</string><string name="context_menu_rename_folder" formatted="false">Cambiar nome do cartafol</string>- <string name="your_library_messaging_folder_rename_hint" formatted="false">Nome do cartafol</string><string name="create_playlist_content_description" formatted="false">Crear a lista</string><string name="actions_picker_delete" formatted="false">Eliminar</string><string name="filter_and_sort_sort_section_title" formatted="false">Ordenar por</string>diff --git a/base/app/src/main/res/values-gu/spotify_strings.xml b/base/app/src/main/res/values-gu/spotify_strings.xmlindex d446893b..1aced0c1 100644--- a/base/app/src/main/res/values-gu/spotify_strings.xml+++ b/base/app/src/main/res/values-gu/spotify_strings.xml@@ -17,7 +17,6 @@<string name="snackbar_added_to_liked_songs" formatted="false">પસંદ કરેલા ગીતોમાં ઉમેર્યું.</string><string name="snackbar_removed_from_liked_songs" formatted="false">પસંદ કરેલા ગીતોમાંથી દૂર કર્યું.</string><string name="content_description_context_menu" formatted="false">વધુ વિકલ્પો</string>- <string name="close_button_content_description" formatted="false">બંધ કરો</string><string name="add_to_playlist_saved_in_section_header" formatted="false">આમાં સેવ કર્યું</string><string name="add_to_playlist_new_playlist_button_text" formatted="false">નવું પ્લેલિસ્ટ</string><string name="add_to_playlist_button_cancel" formatted="false">રદ કરો</string>@@ -25,8 +24,6 @@<string name="lyrics_card_title" formatted="false">ગીતના બોલ</string><string name="lyrics_card_title_preview" formatted="false">ગીતના બોલનું પ્રિવ્યૂ</string><string name="lyrics_card_show_lyrics_button" formatted="false">ગીતના બોલ બતાવો</string>- <string name="lyrics_card_expand_button_content_description" formatted="false">ગીતના બોલ સંપૂર્ણ સ્ક્રીનમાં ખોલો</string>- <string name="lyrics_card_share_button_content_description" formatted="false">ગીતનાં બોલ શેર કરો</string><string name="lyrics_credential_note" formatted="false">%1$s દ્વારા પ્રદાન કરાયેલ ગીતના બોલ</string><string name="lyrics_fullscreen_chip_label_share" formatted="false">શેર કરો</string><string name="lyrics_fullscreen_chip_label_translate" formatted="false">અનુવાદ કરો</string>@@ -49,7 +46,6 @@<string name="artist_popular_tracks" formatted="false">લોકપ્રિય</string><string name="curation_button_follow_state_text" formatted="false">ફોલો કરો</string><string name="curation_button_following_state_text" formatted="false">ફોલો કરો છો</string>- <string name="search_main_entity_subtitle_artist" formatted="false">આર્ટિસ્ટ</string><string name="connect_phone_is_self" formatted="false">આ ફોન</string><string name="settings_item_canvas_title" formatted="false">Canvas</string><string name="video_settings_canvas_subtitle" formatted="false">જ્યારે ગીત વાગી રહ્યું હોય ત્યારે ટૂંકા, લૂપિંગ વિઝ્યુઅલ.</string>@@ -107,8 +103,6 @@<string name="library_search_text_hint" formatted="false">તમારી લાઇબ્રેરી શોધો</string><string name="account_title" formatted="false">એકાઉન્ટ</string><string name="song_dna_search_chip_followed_artists" formatted="false">આર્ટિસ્ટને ફોલો કર્યું</string>- <string name="settings_item_crossfade_title" formatted="false">ક્રોસફેડ</string>- <string name="playback_settings_crossfade_slider_seconds" formatted="false">%1$d સે</string><string name="local_files_title" formatted="false">સ્થાનિક ફાઇલો</string><string name="local_files_empty_section_title" formatted="false">તમારી પોતાની ઓડિયો ફાઇલ તમારી લાઇબ્રેરીમાં ઉમેરો</string><string name="local_files_empty_section_subtitle" formatted="false">એવું કોઈ ગીત કે પર્સનલ પોડકાસ્ટ મળ્યું છે જે Spotify પર ન હોય?</string>@@ -138,14 +132,10 @@<string name="assisted_curation_search_filter_artists" formatted="false">આર્ટિસ્ટ</string><string name="assisted_curation_search_filter_albums" formatted="false">આલ્બમ</string><string name="assisted_curation_search_filter_playlists" formatted="false">પ્લેલિસ્ટ</string>- <string name="assisted_curation_search_filter_clear_content_description" formatted="false">ફિલ્ટર દૂર કરો</string>- <string name="ad_category_title_music" formatted="false">મ્યુઝિક</string>- <string name="made_for_you_hub_title" formatted="false">ખાસ તમારા માટે</string><string name="settings_item_app_language_title" formatted="false">ઍપની ભાષા</string><string name="create_menu_item_folder_title" formatted="false">ફોલ્ડર</string><string name="create_folder_name_suggested_folder_name" formatted="false">નવું ફોલ્ડર</string><string name="context_menu_rename_folder" formatted="false">ફોલ્ડરનું નામ બદલો</string>- <string name="your_library_messaging_folder_rename_hint" formatted="false">ફોલ્ડરનું નામ</string><string name="create_playlist_content_description" formatted="false">પ્લેલિસ્ટ બનાવો</string><string name="actions_picker_delete" formatted="false">ડિલીટ કરો</string><string name="filter_and_sort_sort_section_title" formatted="false">આ મુજબ ગોઠવો</string>diff --git a/base/app/src/main/res/values-hi/spotify_strings.xml b/base/app/src/main/res/values-hi/spotify_strings.xmlindex 86936a2d..a71973a6 100644--- a/base/app/src/main/res/values-hi/spotify_strings.xml+++ b/base/app/src/main/res/values-hi/spotify_strings.xml@@ -17,7 +17,6 @@<string name="snackbar_added_to_liked_songs" formatted="false">लाइक किए गए गानों में जोड़ा गया.</string><string name="snackbar_removed_from_liked_songs" formatted="false">लाइक किए गए गानों से हटाया गया.</string><string name="content_description_context_menu" formatted="false">और विकल्प</string>- <string name="close_button_content_description" formatted="false">बंद करें</string><string name="add_to_playlist_saved_in_section_header" formatted="false">यहाँ सेव किया गया है</string><string name="add_to_playlist_new_playlist_button_text" formatted="false">नई प्लेलिस्ट</string><string name="add_to_playlist_button_cancel" formatted="false">कैंसिल करें</string>@@ -25,8 +24,6 @@<string name="lyrics_card_title" formatted="false">गाने के बोल</string><string name="lyrics_card_title_preview" formatted="false">गाने के बोल का प्रीव्यू</string><string name="lyrics_card_show_lyrics_button" formatted="false">गाने के बोल दिखाएँ</string>- <string name="lyrics_card_expand_button_content_description" formatted="false">फ़ुलस्क्रीन पर गाने के बोल दिखाएँ</string>- <string name="lyrics_card_share_button_content_description" formatted="false">गाने के बोल शेयर करें</string><string name="lyrics_credential_note" formatted="false">गाने के बोल %1$s उपलब्ध कराए गए हैं</string><string name="lyrics_fullscreen_chip_label_share" formatted="false">शेयर करें</string><string name="lyrics_fullscreen_chip_label_translate" formatted="false">अनुवाद करें</string>@@ -49,7 +46,6 @@<string name="artist_popular_tracks" formatted="false">लोकप्रिय</string><string name="curation_button_follow_state_text" formatted="false">फ़ॉलो करें</string><string name="curation_button_following_state_text" formatted="false">फ़ॉलो कर रहे हैं</string>- <string name="search_main_entity_subtitle_artist" formatted="false">कलाकार</string><string name="connect_phone_is_self" formatted="false">इस फ़ोन पर</string><string name="settings_item_canvas_title" formatted="false">Canvas</string><string name="video_settings_canvas_subtitle" formatted="false">जब कोई गाना चल रहा हो, तब छोटे और लूपिंग विज़ुअल.</string>@@ -107,8 +103,6 @@<string name="library_search_text_hint" formatted="false">\'आपकी लाइब्रेरी\' में खोजें</string><string name="account_title" formatted="false">अकाउंट</string><string name="song_dna_search_chip_followed_artists" formatted="false">फ़ॉलो किए गए आर्टिस्ट</string>- <string name="settings_item_crossfade_title" formatted="false">क्रॉसफ़ेड</string>- <string name="playback_settings_crossfade_slider_seconds" formatted="false">%1$d सेकंड</string><string name="local_files_title" formatted="false">लोकल फ़ाइलें</string><string name="local_files_empty_section_title" formatted="false">\'आपकी लाइब्रेरी\' में अपनी खुद की ऑडियो फ़ाइलें जोड़ें</string><string name="local_files_empty_section_subtitle" formatted="false">क्या आपके पास ऐसा कोई गाना या निजी पॉडकास्ट है जो Spotify पर उपलब्ध नहीं है?</string>@@ -138,14 +132,10 @@<string name="assisted_curation_search_filter_artists" formatted="false">आर्टिस्ट</string><string name="assisted_curation_search_filter_albums" formatted="false">एल्बम</string><string name="assisted_curation_search_filter_playlists" formatted="false">प्लेलिस्ट</string>- <string name="assisted_curation_search_filter_clear_content_description" formatted="false">फ़िल्टर क्लियर करें</string>- <string name="ad_category_title_music" formatted="false">म्यूज़िक</string>- <string name="made_for_you_hub_title" formatted="false">खास आपके लिए</string><string name="settings_item_app_language_title" formatted="false">ऐप की भाषा</string><string name="create_menu_item_folder_title" formatted="false">फ़ोल्डर</string><string name="create_folder_name_suggested_folder_name" formatted="false">नया फ़ोल्डर</string><string name="context_menu_rename_folder" formatted="false">फ़ोल्डर का नाम बदलें</string>- <string name="your_library_messaging_folder_rename_hint" formatted="false">फ़ोल्डर का नाम</string><string name="create_playlist_content_description" formatted="false">प्लेलिस्ट बनाएँ</string><string name="actions_picker_delete" formatted="false">मिटाएँ</string><string name="filter_and_sort_sort_section_title" formatted="false">इसके अनुसार क्रम से लगाएँ</string>diff --git a/base/app/src/main/res/values-hr/spotify_strings.xml b/base/app/src/main/res/values-hr/spotify_strings.xmlindex dcba2659..32fa037a 100644--- a/base/app/src/main/res/values-hr/spotify_strings.xml+++ b/base/app/src/main/res/values-hr/spotify_strings.xml@@ -17,7 +17,6 @@<string name="snackbar_added_to_liked_songs" formatted="false">Dodana Pjesmama koje vam se sviđaju.</string><string name="snackbar_removed_from_liked_songs" formatted="false">Uklonjena iz Pjesama koje vam se sviđaju.</string><string name="content_description_context_menu" formatted="false">Više mogućnosti</string>- <string name="close_button_content_description" formatted="false">Zatvori</string><string name="add_to_playlist_saved_in_section_header" formatted="false">Spremljeno u</string><string name="add_to_playlist_new_playlist_button_text" formatted="false">Novi popis za reprodukciju</string><string name="add_to_playlist_button_cancel" formatted="false">Odustani</string>@@ -25,8 +24,6 @@<string name="lyrics_card_title" formatted="false">Tekst</string><string name="lyrics_card_title_preview" formatted="false">Pregled teksta</string><string name="lyrics_card_show_lyrics_button" formatted="false">Prikaži tekst</string>- <string name="lyrics_card_expand_button_content_description" formatted="false">Otvorite tekst preko punog zaslona</string>- <string name="lyrics_card_share_button_content_description" formatted="false">Podijelite tekst</string><string name="lyrics_credential_note" formatted="false">Tekst pjesme omogućio %1$s</string><string name="lyrics_fullscreen_chip_label_share" formatted="false">Podijeli</string><string name="lyrics_fullscreen_chip_label_translate" formatted="false">Prevedi</string>@@ -49,7 +46,6 @@<string name="artist_popular_tracks" formatted="false">Popularna</string><string name="curation_button_follow_state_text" formatted="false">Prati</string><string name="curation_button_following_state_text" formatted="false">Pratite</string>- <string name="search_main_entity_subtitle_artist" formatted="false">Izvođač</string><string name="connect_phone_is_self" formatted="false">Ovaj telefon</string><string name="settings_item_canvas_title" formatted="false">Canvas</string><string name="video_settings_canvas_subtitle" formatted="false">Kratki, ponavljajući vizuali tijekom reprodukcije pjesme.</string>@@ -107,8 +103,6 @@<string name="library_search_text_hint" formatted="false">Pretražite svoju zbirku</string><string name="account_title" formatted="false">Račun</string><string name="song_dna_search_chip_followed_artists" formatted="false">Izvođači koje pratite</string>- <string name="settings_item_crossfade_title" formatted="false">Križno utišavanje</string>- <string name="playback_settings_crossfade_slider_seconds" formatted="false">%1$d s</string><string name="local_files_title" formatted="false">Lokalne datoteke</string><string name="local_files_empty_section_title" formatted="false">Dodajte vlastite audiodatoteke na popis Moja zbirka</string><string name="local_files_empty_section_subtitle" formatted="false">Imate pjesmu ili osobni podcast koji nisu na Spotifyu?</string>@@ -138,14 +132,10 @@<string name="assisted_curation_search_filter_artists" formatted="false">Izvođači</string><string name="assisted_curation_search_filter_albums" formatted="false">Albumi</string><string name="assisted_curation_search_filter_playlists" formatted="false">Popisi za reprodukciju</string>- <string name="assisted_curation_search_filter_clear_content_description" formatted="false">Brisanje filtra</string>- <string name="ad_category_title_music" formatted="false">Glazba</string>- <string name="made_for_you_hub_title" formatted="false">Za vas</string><string name="settings_item_app_language_title" formatted="false">Jezik aplikacije</string><string name="create_menu_item_folder_title" formatted="false">Mapa</string><string name="create_folder_name_suggested_folder_name" formatted="false">Nova mapa</string><string name="context_menu_rename_folder" formatted="false">Preimenovanje mape</string>- <string name="your_library_messaging_folder_rename_hint" formatted="false">Naziv mape</string><string name="create_playlist_content_description" formatted="false">Izradi popis za reprodukciju</string><string name="actions_picker_delete" formatted="false">Izbriši</string><string name="filter_and_sort_sort_section_title" formatted="false">Sortiraj po</string>diff --git a/base/app/src/main/res/values-hu/spotify_strings.xml b/base/app/src/main/res/values-hu/spotify_strings.xmlindex 99dc3bf7..13249bcd 100644--- a/base/app/src/main/res/values-hu/spotify_strings.xml+++ b/base/app/src/main/res/values-hu/spotify_strings.xml@@ -17,7 +17,6 @@<string name="snackbar_added_to_liked_songs" formatted="false">Hozzáadva a Kedvelt dalokhoz.</string><string name="snackbar_removed_from_liked_songs" formatted="false">Eltávolítva a Kedvelt dalok közül.</string><string name="content_description_context_menu" formatted="false">További lehetőségek</string>- <string name="close_button_content_description" formatted="false">Bezárás</string><string name="add_to_playlist_saved_in_section_header" formatted="false">Elmentve itt:</string><string name="add_to_playlist_new_playlist_button_text" formatted="false">Új műsorlista</string><string name="add_to_playlist_button_cancel" formatted="false">Mégse</string>@@ -25,8 +24,6 @@<string name="lyrics_card_title" formatted="false">Dalszöveg</string><string name="lyrics_card_title_preview" formatted="false">Dalszöveg előnézete</string><string name="lyrics_card_show_lyrics_button" formatted="false">Dalszöveg megjelenítése</string>- <string name="lyrics_card_expand_button_content_description" formatted="false">Dalszöveg megjelenítése teljes képernyőn</string>- <string name="lyrics_card_share_button_content_description" formatted="false">Dalszöveg megosztása</string><string name="lyrics_credential_note" formatted="false">Dalszöveg tőle: %1$s</string><string name="lyrics_fullscreen_chip_label_share" formatted="false">Megosztás</string><string name="lyrics_fullscreen_chip_label_translate" formatted="false">Fordítás</string>@@ -49,7 +46,6 @@<string name="artist_popular_tracks" formatted="false">Népszerű</string><string name="curation_button_follow_state_text" formatted="false">Követés</string><string name="curation_button_following_state_text" formatted="false">Követem</string>- <string name="search_main_entity_subtitle_artist" formatted="false">Előadó</string><string name="connect_phone_is_self" formatted="false">Ez a telefon</string><string name="settings_item_canvas_title" formatted="false">Canvas</string><string name="video_settings_canvas_subtitle" formatted="false">Rövid, ismétlődő vizuálok megjelenítése dalok lejátszása közben.</string>@@ -107,8 +103,6 @@<string name="library_search_text_hint" formatted="false">Keresés a Gyűjteményemben</string><string name="account_title" formatted="false">Fiók</string><string name="song_dna_search_chip_followed_artists" formatted="false">Követett előadók</string>- <string name="settings_item_crossfade_title" formatted="false">Áttűnés</string>- <string name="playback_settings_crossfade_slider_seconds" formatted="false">%1$d mp</string><string name="local_files_title" formatted="false">Helyi fájlok</string><string name="local_files_empty_section_title" formatted="false">Add hozzá a saját hangfájljaidat a Gyűjteményedhez</string><string name="local_files_empty_section_subtitle" formatted="false">Van egy olyan dalod vagy személyes podcastod, amely még nem található meg a Spotifyon?</string>@@ -138,14 +132,10 @@<string name="assisted_curation_search_filter_artists" formatted="false">Előadók</string><string name="assisted_curation_search_filter_albums" formatted="false">Albumok</string><string name="assisted_curation_search_filter_playlists" formatted="false">Műsorlisták</string>- <string name="assisted_curation_search_filter_clear_content_description" formatted="false">Szűrő eltávolítása</string>- <string name="ad_category_title_music" formatted="false">Zene</string>- <string name="made_for_you_hub_title" formatted="false">Neked készítettük</string><string name="settings_item_app_language_title" formatted="false">Alkalmazás nyelve</string><string name="create_menu_item_folder_title" formatted="false">Mappa</string><string name="create_folder_name_suggested_folder_name" formatted="false">Új mappa</string><string name="context_menu_rename_folder" formatted="false">Mappa átnevezése</string>- <string name="your_library_messaging_folder_rename_hint" formatted="false">Mappa neve</string><string name="create_playlist_content_description" formatted="false">Műsorlista létrehozása</string><string name="actions_picker_delete" formatted="false">Törlés</string><string name="filter_and_sort_sort_section_title" formatted="false">Rendezési szempont</string>diff --git a/base/app/src/main/res/values-in/spotify_strings.xml b/base/app/src/main/res/values-in/spotify_strings.xmlindex 20bc561f..6d6cb857 100644--- a/base/app/src/main/res/values-in/spotify_strings.xml+++ b/base/app/src/main/res/values-in/spotify_strings.xml@@ -17,7 +17,6 @@<string name="snackbar_added_to_liked_songs" formatted="false">Ditambahkan ke Lagu yang Disukai</string><string name="snackbar_removed_from_liked_songs" formatted="false">Dihapus dari Lagu yang Disukai.</string><string name="content_description_context_menu" formatted="false">Opsi lainnya</string>- <string name="close_button_content_description" formatted="false">Tutup</string><string name="add_to_playlist_saved_in_section_header" formatted="false">Tersimpan di</string><string name="add_to_playlist_new_playlist_button_text" formatted="false">Playlist baru</string><string name="add_to_playlist_button_cancel" formatted="false">Batalkan</string>@@ -25,8 +24,6 @@<string name="lyrics_card_title" formatted="false">Lirik</string><string name="lyrics_card_title_preview" formatted="false">Pratinjau lirik</string><string name="lyrics_card_show_lyrics_button" formatted="false">Tampilkan lirik</string>- <string name="lyrics_card_expand_button_content_description" formatted="false">Buka lirik di layar penuh</string>- <string name="lyrics_card_share_button_content_description" formatted="false">Bagikan lirik</string><string name="lyrics_credential_note" formatted="false">Lirik disediakan oleh %1$s</string><string name="lyrics_fullscreen_chip_label_share" formatted="false">Bagikan</string><string name="lyrics_fullscreen_chip_label_translate" formatted="false">Terjemahkan</string>@@ -49,7 +46,6 @@<string name="artist_popular_tracks" formatted="false">Populer</string><string name="curation_button_follow_state_text" formatted="false">Ikuti</string><string name="curation_button_following_state_text" formatted="false">Mengikuti</string>- <string name="search_main_entity_subtitle_artist" formatted="false">Artis</string><string name="connect_phone_is_self" formatted="false">Ponsel ini</string><string name="settings_item_canvas_title" formatted="false">Canvas</string><string name="video_settings_canvas_subtitle" formatted="false">Visual pendek dan berulang saat lagu diputar.</string>@@ -107,8 +103,6 @@<string name="library_search_text_hint" formatted="false">Cari Koleksi Kamu</string><string name="account_title" formatted="false">Akun</string><string name="song_dna_search_chip_followed_artists" formatted="false">Artis yang diikuti</string>- <string name="settings_item_crossfade_title" formatted="false">Crossfade</string>- <string name="playback_settings_crossfade_slider_seconds" formatted="false">%1$d dtk</string><string name="local_files_title" formatted="false">File Lokal</string><string name="local_files_empty_section_title" formatted="false">Tambahkan file audiomu sendiri ke Koleksi Kamu</string><string name="local_files_empty_section_subtitle" formatted="false">Punya lagu atau podcast pribadi yang tidak ada di Spotify?</string>@@ -138,14 +132,10 @@<string name="assisted_curation_search_filter_artists" formatted="false">Artis</string><string name="assisted_curation_search_filter_albums" formatted="false">Album</string><string name="assisted_curation_search_filter_playlists" formatted="false">Playlist</string>- <string name="assisted_curation_search_filter_clear_content_description" formatted="false">Hapus filter</string>- <string name="ad_category_title_music" formatted="false">Musik</string>- <string name="made_for_you_hub_title" formatted="false">Dibuat untuk Kamu</string><string name="settings_item_app_language_title" formatted="false">Bahasa app</string><string name="create_menu_item_folder_title" formatted="false">Folder</string><string name="create_folder_name_suggested_folder_name" formatted="false">Folder baru</string><string name="context_menu_rename_folder" formatted="false">Ganti nama folder</string>- <string name="your_library_messaging_folder_rename_hint" formatted="false">Nama folder</string><string name="create_playlist_content_description" formatted="false">Buat playlist</string><string name="actions_picker_delete" formatted="false">Hapus</string><string name="filter_and_sort_sort_section_title" formatted="false">Urutkan menurut</string>diff --git a/base/app/src/main/res/values-in/strings.xml b/base/app/src/main/res/values-in/strings.xmlindex f57c022d..93683590 100644--- a/base/app/src/main/res/values-in/strings.xml+++ b/base/app/src/main/res/values-in/strings.xml@@ -4,32 +4,13 @@<string name="aa_playlists">Playlist</string><string name="aa_albums">Album</string><string name="aa_artists">Artis</string>- <string name="aa_podcasts">Podcast</string><string name="settings_amoled_theme">Tema AMOLED</string><string name="settings_amoled_theme_subtitle">Latar belakang hitam pekat untuk menghemat baterai</string>- <string name="settings_lyrics_style_spotify_default">Default Spotify</string>- <string name="settings_lyrics_style_fullscreen">Layar penuh (warna album)</string>- <string name="settings_lyrics_style_compact">Ringkas</string>- <string name="settings_lyrics_style_karaoke">Karaoke</string>- <string name="settings_lyrics_style_bold">Besar dan tebal</string><string name="main_update_available">Pembaruan baru tersedia</string>- <string name="notif_channel_media_name">Pemutaran media</string>- <string name="notif_channel_media_description">Kontrol pemutaran media Myspoti</string>- <string name="notif_action_previous">Sebelumnya</string>- <string name="notif_action_next">Berikutnya</string><string name="notif_action_play">Putar</string><string name="notif_action_pause">Jeda</string><string name="notif_shuffle_enable">Aktifkan pemutaran acak</string><string name="notif_shuffle_disable">Nonaktifkan pemutaran acak</string><string name="notif_shuffle_disable_smart">Nonaktifkan pemutaran acak pintar</string>- <string name="notif_action_like">Suka</string>- <string name="notif_action_unlike">Batal suka</string>- <string name="notif_unknown_name">Tidak dikenal</string>- <string name="notif_by_artist">oleh %1$s</string>- <string name="notif_repeat_disable">Nonaktifkan pengulangan</string>- <string name="notif_repeat_disable_one">Nonaktifkan ulangi satu lagu</string>- <string name="notif_repeat_enable">Aktifkan pengulangan</string>- <string name="bridge_player_unlocked">Pemutar tidak terkunci</string>- <string name="bridge_reloading">Memuat ulang...</string>- <string name="service_disabled_message">Layanan tidak aktif</string>+ <string name="player_source_downloaded">Diunduh</string></resources>diff --git a/base/app/src/main/res/values-is/spotify_strings.xml b/base/app/src/main/res/values-is/spotify_strings.xmlindex 1eae79f5..bacc7470 100644--- a/base/app/src/main/res/values-is/spotify_strings.xml+++ b/base/app/src/main/res/values-is/spotify_strings.xml@@ -17,7 +17,6 @@<string name="snackbar_added_to_liked_songs" formatted="false">Bætt við lækuð lög.</string><string name="snackbar_removed_from_liked_songs" formatted="false">Fjarlægt úr lækuðum lögum.</string><string name="content_description_context_menu" formatted="false">Fleiri valkostir</string>- <string name="close_button_content_description" formatted="false">Loka</string><string name="add_to_playlist_saved_in_section_header" formatted="false">Vistað á</string><string name="add_to_playlist_new_playlist_button_text" formatted="false">Nýr spilunarlisti</string><string name="add_to_playlist_button_cancel" formatted="false">Hætta við</string>@@ -25,8 +24,6 @@<string name="lyrics_card_title" formatted="false">Texti</string><string name="lyrics_card_title_preview" formatted="false">Textasýnishorn</string><string name="lyrics_card_show_lyrics_button" formatted="false">Sýna texta</string>- <string name="lyrics_card_expand_button_content_description" formatted="false">Opna texta á öllum skjánum</string>- <string name="lyrics_card_share_button_content_description" formatted="false">Deila texta</string><string name="lyrics_credential_note" formatted="false">Textar frá %1$s</string><string name="lyrics_fullscreen_chip_label_share" formatted="false">Deila</string><string name="lyrics_fullscreen_chip_label_translate" formatted="false">Þýða</string>@@ -49,7 +46,6 @@<string name="artist_popular_tracks" formatted="false">Vinsælt</string><string name="curation_button_follow_state_text" formatted="false">Fylgjast með</string><string name="curation_button_following_state_text" formatted="false">Vaktin</string>- <string name="search_main_entity_subtitle_artist" formatted="false">Listamaður</string><string name="connect_phone_is_self" formatted="false">Þessum síma</string><string name="settings_item_canvas_title" formatted="false">Canvas</string><string name="video_settings_canvas_subtitle" formatted="false">Stuttar myndlykkjur þegar lag er spilað.</string>@@ -107,8 +103,6 @@<string name="library_search_text_hint" formatted="false">Leita í Safninu þínu</string><string name="account_title" formatted="false">Reikningur</string><string name="song_dna_search_chip_followed_artists" formatted="false">Flytjendur sem þú fylgist með</string>- <string name="settings_item_crossfade_title" formatted="false">Flæðispilun</string>- <string name="playback_settings_crossfade_slider_seconds" formatted="false">%1$d s.</string><string name="local_files_title" formatted="false">Staðbundnar skrár</string><string name="local_files_empty_section_title" formatted="false">Bættu eigin hljóðskrám í safnið þitt</string><string name="local_files_empty_section_subtitle" formatted="false">Ertu með lag eða eigið hlaðvarp sem er ekki á Spotify?</string>@@ -138,14 +132,10 @@<string name="assisted_curation_search_filter_artists" formatted="false">Listamenn</string><string name="assisted_curation_search_filter_albums" formatted="false">Plötur</string><string name="assisted_curation_search_filter_playlists" formatted="false">Spilunarlistar</string>- <string name="assisted_curation_search_filter_clear_content_description" formatted="false">Hreinsa síu</string>- <string name="ad_category_title_music" formatted="false">Tónlist</string>- <string name="made_for_you_hub_title" formatted="false">Fyrir þig</string><string name="settings_item_app_language_title" formatted="false">Tungumál forrits</string><string name="create_menu_item_folder_title" formatted="false">Mappa</string><string name="create_folder_name_suggested_folder_name" formatted="false">Ný mappa</string><string name="context_menu_rename_folder" formatted="false">Endurnefna möppu</string>- <string name="your_library_messaging_folder_rename_hint" formatted="false">Heiti möppu</string><string name="create_playlist_content_description" formatted="false">Búa til spilunarlista</string><string name="actions_picker_delete" formatted="false">Eyða</string><string name="filter_and_sort_sort_section_title" formatted="false">Raða eftir</string>diff --git a/base/app/src/main/res/values-it/extensions_strings.xml b/base/app/src/main/res/values-it/extensions_strings.xmlnew file mode 100644index 00000000..8b46b8ac--- /dev/null+++ b/base/app/src/main/res/values-it/extensions_strings.xml@@ -0,0 +1,211 @@+<?xml version="1.0" encoding="utf-8"?>+<resources>+ <string name="extensions_title">Estensioni</string>+ <string name="extensions_row_detail">Testi, l\'audio di un brano e script scritti da altri, in una sandbox.</string>+ <string name="extensions_install_file">Installa da un file</string>+ <string name="extensions_install_url">Installa da un indirizzo</string>+ <string name="extensions_url_hint">https://…/extension.zip</string>+ <string name="extensions_none">Nessuna estensione installata.</string>+ <string name="extensions_installed">Installate</string>+ <string name="extensions_repository_add">Aggiungi un repository</string>+ <string name="extensions_repository_hint">https://…/index.json</string>+ <string name="extensions_repository_warning">Myspoti non controlla un repository che aggiungi: ciò che ne installi è a tuo rischio.</string>+ <string name="extensions_repository_remove">Rimuovi</string>+ <string name="extensions_repository_refresh">Aggiorna</string>+ <string name="extensions_install">Installa</string>+ <string name="extensions_update">Aggiorna</string>+ <string name="extensions_up_to_date">Installata</string>+ <string name="extensions_cancel">Annulla</string>+ <string name="extensions_loading">Lettura…</string>+ <string name="extensions_error">Non installata: %1$s</string>+ <string name="extensions_prompt_title_install">Installare %1$s?</string>+ <string name="extensions_prompt_title_update">Aggiornare %1$s?</string>+ <string name="extensions_prompt_by">%1$s · versione %2$s · %3$s</string>+ <string name="extensions_prompt_source">Da %1$s</string>+ <string name="extensions_prompt_source_file">un file su questo telefono</string>+ <string name="extensions_prompt_new">novità di questa versione</string>+ <string name="extensions_prompt_update_same_rights">%1$s → %2$s, con gli stessi permessi.</string>+ <string name="extensions_prompt_not_newer">La versione %1$s (o una più recente) è già installata.</string>+ <string name="extensions_prompt_sha">sha256 del pacchetto: %1$s</string>+ <string name="extension_enabled">Attiva</string>+ <string name="extension_running">In esecuzione</string>+ <string name="extension_not_running">Non in esecuzione</string>+ <string name="extension_turned_off">%1$s disattivata: %2$s</string>+ <string name="extension_last_error">Ultimo errore: %1$s</string>+ <string name="extension_disabled_reason">Disattivata: %1$s</string>+ <string name="extension_inactive">Inattiva</string>+ <string name="extension_inactive_detail">Inattiva: %1$s</string>+ <string name="extension_homepage">Sito web</string>+ <string name="extension_settings">Impostazioni</string>+ <string name="extension_log">Registro</string>+ <string name="extension_log_empty">Ancora niente nel registro.</string>+ <string name="extension_log_clear">Svuota il registro</string>+ <string name="extension_update_file">Aggiorna da un file</string>+ <string name="extension_uninstall">Disinstalla</string>+ <string name="extension_uninstall_confirm">Disinstallare %1$s? Le sue impostazioni e ciò che ha salvato vanno via con lei.</string>+ <string name="extension_confirm_title">Un\'estensione chiede</string>+ <string name="extension_confirm_detail">Non cambia nulla se non lo consenti.</string>+ <string name="extension_confirm_allow">Consenti</string>+ <string name="extension_confirm_refuse">Rifiuta</string>+ <string name="extensions_row_count">%1$d installate, %2$d attive</string>+ <string name="extensions_tab_store">Store</string>+ <string name="extensions_search">Cerca estensioni</string>+ <string name="extensions_cat_all">Tutte</string>+ <string name="extensions_cat_lyrics">Testi</string>+ <string name="extensions_cat_playback">Riproduzione e audio</string>+ <string name="extensions_cat_library">Libreria</string>+ <string name="extensions_cat_discovery">Scoperta</string>+ <string name="extensions_cat_stats">Statistiche</string>+ <string name="extensions_cat_look">Aspetto</string>+ <string name="extensions_cat_social">Social</string>+ <string name="extensions_cat_tools">Strumenti</string>+ <string name="extensions_cat_other">Altro</string>+ <string name="extensions_no_match">Nessuna estensione corrisponde.</string>+ <string name="extensions_browse_store">Sfoglia lo store</string>+ <string name="extensions_other_ways">Altri modi per installare</string>+ <string name="extensions_empty_title">Cosa sono le estensioni?</string>+ <string name="extensions_empty_body">Le estensioni aggiungono a Myspoti ciò che non fa da sé: testi da altre fonti, da dove arriva l\'audio o il download di un brano, strumenti che usano il tuo account Spotify. Ognuna gira in una sandbox e chiede prima di raggiungere qualsiasi cosa. Aggiungi un repository per sfogliarle, o installa un pacchetto di cui ti fidi.</string>+ <string name="extensions_official_badge">Ufficiale</string>+ <string name="extensions_repo_yours">Aggiunto da te</string>+ <string name="extensions_repo_community">Comunità</string>+ <string name="extensions_repo_official_note">Ogni estensione viene controllata prima di essere elencata.</string>+ <string name="extensions_repo_yours_note">Non controllato da Myspoti: installa a tuo rischio.</string>+ <string name="extensions_repo_error">Impossibile leggere questo repository: %1$s</string>+ <string name="extensions_repo_empty">Questo repository non elenca nessuna estensione.</string>+ <string name="extensions_requires">Richiede Myspoti %1$s o successivo</string>+ <string name="extensions_requires_api">Creata per un Myspoti più recente (API delle estensioni %1$d)</string>+ <string name="extensions_update_badge">Aggiornamento</string>+ <string name="extensions_move_up">Sposta su</string>+ <string name="extensions_move_down">Sposta giù</string>+ <string name="extension_off">Disattivata</string>+ <string name="extension_by">di %1$s</string>+ <string name="extension_changelog">Novità</string>+ <string name="extension_update_from">Aggiornamento disponibile: %1$s → %2$s</string>+ <string name="extension_not_listed">Questa estensione non è nei tuoi repository (o sono ancora in caricamento).</string>+ <string name="extension_details">Dettagli</string>+ <string name="extension_detail_updated">Aggiornata</string>+ <string name="extension_detail_min_app">Richiede Myspoti</string>+ <string name="extension_detail_size">Dimensione</string>+ <string name="extension_detail_id">Id</string>+ <string name="extension_detail_sha">sha256 del pacchetto</string>+ <string name="extension_detail_source">Installata da</string>+ <string name="extension_see_in_store">Vedi nello store</string>++ <!-- Actions: the closed catalogue, as the user reads it -->+ <string name="action_playback_control">Controllare la riproduzione</string>+ <string name="action_playback_queue">Modificare la coda</string>+ <string name="action_playback_events">Sapere cosa ascolti</string>+ <string name="action_lyrics_provide">Fornire testi</string>+ <string name="action_trackinfo_provide">Aggiungere dettagli sui brani</string>+ <string name="action_audio_source">Riprodurre audio da altrove</string>+ <string name="action_download_source">Fornire download</string>+ <string name="action_home_sections">Aggiungere sezioni alla Home</string>+ <string name="action_search_provide">Aggiungere risultati di ricerca</string>+ <string name="action_menu_items">Aggiungere voci ai menu</string>+ <string name="action_player_buttons">Aggiungere pulsanti al lettore</string>+ <string name="action_settings_page">Impostazioni proprie</string>+ <string name="action_notify">Mostrare brevi messaggi</string>+ <string name="action_library_read">Leggere la tua libreria</string>+ <string name="action_library_write">Modificare la tua libreria</string>+ <string name="action_playlists_write">Modificare le tue playlist</string>+ <string name="action_spotify_catalog">Esplorare Spotify</string>+ <string name="action_spotify_raw">Accesso completo a Spotify</string>+ <string name="action_network">Usare internet</string>+ <string name="action_network_any">Usare qualsiasi sito web</string>+ <string name="action_webview_page">Una pagina web propria</string>+ <string name="action_storage">Conservare i propri dati</string>+ <string name="action_unknown">Sconosciuto a questo Myspoti</string>+ <string name="action_critical">Critica</string>+ <string name="action_no_why">(nessun motivo indicato)</string>+ <string name="actions_title">Cosa fa</string>+ <string name="actions_critical_warning">Le azioni critiche possono modificare il tuo account, sostituire l\'origine dei brani o mostrare una pagina web libera. Consentile solo se ti fidi dell\'autore: Myspoti chiede comunque prima di rimuovere qualcosa.</string>+ <!-- Areas of the Installed tab -->+ <string name="area_playback">Riproduzione</string>+ <string name="area_lyrics">Testi e info sui brani</string>+ <string name="area_audio">Audio e download</string>+ <string name="area_home">Home e ricerca</string>+ <string name="area_menus">Menu e lettore</string>+ <string name="area_library">Libreria e Spotify</string>+ <string name="area_other">Pagine e altro</string>+ <string name="area_activity">Attività recente</string>+ <string name="area_turn_off">Disattiva</string>+ <string name="area_active">Attiva</string>+ <string name="area_idle">Inattiva</string>+ <string name="area_make_active">Usala per %1$s</string>+ <!-- Install prompt -->+ <string name="ext_third_party_notice">Estensione di terze parti, non controllata da Myspoti, sotto la responsabilità del suo autore.</string>+ <string name="ext_risk_accept">Capisco che questa estensione è fatta da terzi e la installo sotto la mia responsabilità</string>+ <string name="ext_clash_exclusive">Sostituisce %1$s, ora fornito da %2$s</string>+ <string name="ext_clash_conflict">Incompatibile con %1$s (installata)</string>+ <string name="ext_clash_replaces">Sostituisce %1$s (installata)</string>+ <string name="ext_clash_keep_new">Usa %1$s (l\'altra resta installata, %2$s)</string>+ <string name="ext_clash_keep_old">Mantieni %1$s</string>+ <string name="ext_clash_idle">inattiva</string>+ <string name="ext_clash_off">disattivata</string>+ <string name="ext_clash_title">Quale mantenere?</string>+ <string name="ext_clash_ok">Fatto</string>+ <!-- Blocks and pages -->+ <string name="ext_from">Da %1$s</string>+ <string name="ext_overflow">Estensioni</string>+ <string name="ext_open_page">Apri la sua pagina</string>+ <string name="ext_page_failed">Impossibile mostrare la pagina di questa estensione.</string>+ <string name="ext_suspended_title">%1$s in pausa</string>+ <string name="ext_suspended_body">Continuava ad annullare ciò che %1$s faceva con la riproduzione: i suoi comandi di riproduzione sono sospesi.</string>+ <string name="ext_suspended_keep">Lascia continuare</string>++ <!-- GitHub: discovery, ratings, reports -->+ <string name="extensions_github_title">Su GitHub</string>+ <string name="extensions_github_note">Repository pubblici con l\'argomento myspoti-extension, non controllati: ognuno è sotto la responsabilità del suo autore.</string>+ <string name="extensions_show_all">Mostra tutte (%1$d nascoste)</string>+ <string name="extensions_show_less">Nascondi quelle bloccate, segnalate, con voti bassi e abbandonate</string>+ <string name="extension_rating">★ %1$s · %2$d voti</string>+ <string name="extension_rating_none">Ancora nessun voto</string>+ <string name="extension_downloads">%1$s download</string>+ <string name="extension_rate_up">Valutala bene</string>+ <string name="extension_rate_down">Valutala male</string>+ <string name="extension_rated">Grazie: il tuo voto è su GitHub</string>+ <string name="extension_signin_title">Accedi a GitHub</string>+ <string name="extension_signin_body">Apri %1$s e digita questo codice. Myspoti non vede mai la tua password.</string>+ <string name="extension_signin_open">Apri GitHub</string>+ <string name="extension_report">Segnala</string>+ <string name="extension_detail_github">GitHub</string>+ <string name="extension_detail_ref">Versione su GitHub</string>++ <!-- Updates from GitHub -->+ <string name="extension_check_updates">Cerca aggiornamenti</string>+ <string name="extension_check_up_to_date">Aggiornata</string>+ <string name="extension_check_applied">Aggiornata: non chiede nulla di nuovo</string>+ <string name="extension_check_needs_ok">Un aggiornamento richiede il tuo OK</string>+ <string name="extension_check_declined">Hai mantenuto questa versione</string>+ <string name="extension_check_incompatible">La nuova versione richiede un Myspoti più recente</string>+ <string name="extension_check_blocked">La nuova versione è bloccata da Myspoti</string>+ <string name="extension_check_failed">Controllo non riuscito: vedi il registro</string>+ <string name="extension_source_gone">Origine scomparsa: il suo repository non esiste più. Continua a funzionare con la copia sul tuo telefono.</string>+ <string name="extension_revert">Torna a %1$s</string>+ <string name="extension_reverted">Tornata a %1$s</string>+ <string name="extension_update_needs_ok">L\'aggiornamento richiede il tuo OK: %1$s → %2$s</string>+ <string name="extension_update_needs_ok_body">Questa versione chiede più di quanto hai accettato. Quella attuale continua a funzionare finché non scegli.</string>+ <string name="extension_update_accept">Accetta</string>+ <string name="extension_update_keep">Mantieni l\'attuale</string>+ <string name="extension_refused_title">Attende il tuo OK</string>+ <string name="extension_refused_body">È stata installata quando si potevano deselezionare azioni, e alcune lo sono state. Ora un\'estensione riceve tutte le azioni che dichiara: resta spenta finché non le accetti.</string>+ <string name="extension_change_action">Nuovo: %1$s</string>+ <string name="extension_change_host">Nuovo sito web: %1$s</string>+ <string name="extension_change_any_host">Qualsiasi sito web</string>+ <string name="extension_change_exclusive">Ora esclusiva: %1$s</string>+ <string name="extension_change_why">Nuovo motivo per %1$s</string>+ <string name="extension_change_was">Era: «%1$s»</string>+ <string name="extension_change_repo">Ora arriva da %1$s (prima %2$s)</string>+ <string name="extension_change_author">Nuovo autore: %1$s (prima %2$s)</string>+ <string name="extension_change_replaces">Disattiva %1$s quando installata</string>+ <string name="extension_change_conflicts">Rifiuta di funzionare con %1$s</string>+ <string name="action_webview_auth">Accedi su un sito web</string>+ <string name="extension_confirm_once">Consenti una volta</string>+ <string name="extension_confirm_always">Consenti sempre %1$s</string>+ <string name="ext_auth_title">%1$s: accesso</string>+ <string name="ext_auth_close">Chiudi</string>+ <string name="ext_auth_notice">Una pagina a sé: ciò che digiti e i suoi cookie restano in Myspoti. L\'estensione riceve solo l\'indirizzo finale della pagina.</string>+ <string name="ext_grants_title">Sempre consentiti</string>+ <string name="ext_grants_note">Modifiche a Spotify che questa estensione apporta senza chiedere. Revocane una per essere di nuovo interpellato.</string>+ <string name="ext_grant_revoke">Revoca</string>+</resources>diff --git a/base/app/src/main/res/values-it/myspoti_strings.xml b/base/app/src/main/res/values-it/myspoti_strings.xmlindex b5774cdd..7d77338d 100644--- a/base/app/src/main/res/values-it/myspoti_strings.xml+++ b/base/app/src/main/res/values-it/myspoti_strings.xml@@ -1,20 +1,13 @@<?xml version="1.0" encoding="utf-8"?><!-- Myspoti's own texts, Italian. --><resources>- <string name="welcome_tagline">La tua musica, con testi sincronizzati e video musicali ufficiali.</string><string name="welcome_lead">La tua musica,</string><string name="welcome_rotate_ads">senza pubblicità.</string><string name="welcome_rotate_lyrics">con i testi parola per parola.</string><string name="welcome_rotate_clips">con i video ufficiali.</string>- <string name="welcome_rotate_offline">anche offline.</string>- <string name="welcome_rotate_lossless">in qualità lossless.</string>+ <string name="welcome_rotate_offline">offline, con le estensioni.</string><string name="welcome_login">Accedi con Spotify</string><string name="welcome_privacy">Accedi dalla pagina di Spotify. Myspoti non vede mai la tua password.</string>- <string name="crash_heading">Myspoti ha smesso di funzionare</string>- <string name="crash_explanation">Qualcosa è andato storto. Riavvia l\'app; se succede di nuovo, copia il rapporto e condividilo in una issue su GitHub.</string>- <string name="crash_restart_app">Riavvia Myspoti</string>- <string name="crash_copy_report">Copia il rapporto</string>- <string name="crash_report_copied">Rapporto copiato</string><string name="remove_from_liked">Rimuovi dai Brani che ti piacciono</string><string name="repeat_on">Ripeti: attivo</string><string name="repeat_one">Ripeti brano</string>@@ -54,7 +47,6 @@<string name="background_playback_title">Riproduzione in background</string><string name="background_playback_on">L\'ottimizzazione della batteria è disattivata: la musica e Spotify Connect continuano a schermo spento.</string><string name="background_playback_off">Disattiva l\'ottimizzazione della batteria così Android non mette in pausa l\'app in background.</string>- <string name="crossfade_summary">Sfuma la fine di un brano e l\'inizio del successivo (senza sovrapposizione). Solo su questo telefono.</string><plurals name="local_files_count"><item quantity="one">%d brano</item><item quantity="other">%d brani</item>@@ -71,11 +63,8 @@<string name="artist_not_found">Artista non trovato</string><string name="playlist_not_found">Playlist non trovata</string><string name="browse_new_releases">Nuove uscite</string>- <string name="browse_charts">Classifiche</string>- <string name="browse_workout">Allenamento</string>- <string name="browse_dance_electronic">Dance/Elettronica</string><string name="language_auto">Automatica</string>- <string name="language_auto_detail">La lingua del telefono se Myspoti la ha (francese, greco, inglese, italiano, portoghese, spagnolo, tedesco), altrimenti l\'inglese</string>+ <string name="language_auto_detail">La lingua del telefono se Myspoti la ha (cinese, francese, greco, inglese, italiano, polacco, portoghese, russo, spagnolo, tedesco), altrimenti l\'inglese</string><string name="language_partial_note">Altre lingue: le etichette di Spotify sono tradotte, i testi di Myspoti restano in inglese.</string><string name="restart_player_title">Riavvia il lettore</string><string name="restart_player_detail">Se la musica non risponde più: ricarica il lettore di Spotify</string>@@ -86,7 +75,6 @@<string name="local_rename">Rinomina</string><string name="local_delete_playlist">Elimina la playlist</string><string name="local_added_to">Aggiunto a %1$s</string>- <string name="folder_create_failed">Impossibile creare la cartella</string><string name="local_playlist_empty">Aggiungi brani dai File locali con il loro pulsante +.</string><string name="playlist_change_refused">Spotify ha rifiutato la modifica a questa playlist</string><string name="download_kept_by_list">Ancora scaricato: una playlist scaricata lo contiene</string>@@ -124,6 +112,7 @@<string name="library_reorder_hint">Tieni premuta una playlist, poi trascinala per spostarla</string><string name="library_reorder_reset">Torna all\'ordine di Spotify</string><string name="song_radio_failed">Impossibile aprire la radio di questo brano</string>+ <string name="song_radio_name">Radio di %1$s</string><string name="local_files_find_hint">Cerca nei File locali</string><string name="data_saver_title">Risparmio dati</string><string name="data_saver_summary">Con i dati mobili, Myspoti non usa dati: si riproducono solo i brani scaricati e i File locali</string>@@ -152,13 +141,8 @@<string name="playback_speed">Velocità di riproduzione</string><string name="recommended_songs">Brani consigliati</string><string name="jam_title">Jam</string>- <string name="jam_restricted">Spotify riserva l\'avvio di una Jam agli account Premium. Puoi comunque unirti a una con un link.</string>- <string name="jam_join">Unisciti a una Jam</string>- <string name="jam_join_hint">Incolla il link di invito</string><string name="jam_leave">Esci dalla Jam</string><string name="jam_members">%1$d persone in ascolto</string>- <string name="pin">Fissa</string>- <string name="unpin">Rimuovi dai fissati</string><string name="jam_start">Avvia una Jam</string><string name="jam_invite">Condividi il link di invito</string><string name="jam_failed">Spotify ha rifiutato questa Jam</string>@@ -195,27 +179,6 @@<string name="smart_shuffle_title">Riproduzione casuale smart</string><string name="smart_shuffle_on">Riproduzione casuale smart: i consigli di Spotify si uniscono alla playlist in ordine casuale.</string><string name="track_sort_added">Data di aggiunta</string>- <!-- Lossless (SpotiFLAC) downloads -->- <string name="spotiflac_row_title">Download senza perdita (FLAC)</string>- <string name="spotiflac_row_on">Verificato — Myspoti usa i server di SpotiFLAC.</string>- <string name="spotiflac_row_off">Non verificato — tocca per completare il controllo una tantum.</string>- <string name="spotiflac_verify_title">Verifica SpotiFLAC</string>- <string name="spotiflac_verify_start_failed">Impossibile avviare la verifica. Tocca Riprova o torna più tardi.</string>- <string name="spotiflac_verify_timeout">Verifica scaduta. Tocca Riprova o Salta per ora.</string>- <string name="spotiflac_verify_rejected">La verifica è stata rifiutata. Tocca Riprova o Salta per ora.</string>- <string name="spotiflac_session_ok">Sessione SpotiFLAC salvata</string>- <string name="spotiflac_session_creating">Creazione della sessione sicura…</string>- <string name="spotiflac_session_failed">Impossibile completare la verifica. Tocca Riprova o Salta per ora.</string>- <string name="spotiflac_skip">Salta per ora</string>- <string name="retry">Riprova</string>- <string name="spotiflac_status_title">SpotiFLAC</string>- <string name="spotiflac_status_verified">Sei verificato: i download passano dai server di SpotiFLAC, la fonte senza perdita più affidabile. Viene usata solo questa sessione — nessun account, nient\'altro salvato.</string>- <string name="spotiflac_session_expires">Sessione valida fino al %1$s</string>- <string name="spotiflac_forget">Dimentica questa sessione</string>- <string name="lossless_hires_title">Download hi-res (24 bit)</string>- <string name="lossless_hires_detail">Un brano salvato in hi-res a 24 bit quando la fonte lo ha. I file sono circa tre volte più grandi della qualità CD.</string>- <string name="setup_spotiflac_title">Download senza perdita (FLAC)</string>- <string name="setup_spotiflac_detail">Verifica una volta con SpotiFLAC così i download arrivano dai suoi server senza perdita.</string><string name="settings_title">Impostazioni</string><string name="settings_detail">Qualità audio, download, dati, batteria e lingua</string><string name="settings_section_playback">Riproduzione</string>@@ -244,7 +207,6 @@<string name="setup_quality_subtitle">Scegli come Myspoti riproduce e salva la tua musica. Potrai cambiarlo più tardi nelle Impostazioni.</string><string name="downloads_off_toast">I download sono disattivati. Attivali nelle Impostazioni.</string><string name="quality_streaming_high_detail">160 kbit/s, il suono migliore</string>- <string name="downloads_verify_hint">Nessuna fonte senza perdita ha risposto. Verifica SpotiFLAC una volta in Impostazioni, Download: i suoi server sono i più affidabili.</string><string name="quality_download_small">La più leggera</string><string name="quality_download_small_detail">AAC 96 kbit/s, la minima: circa 3 MB per brano</string><string name="settings_solid_nav_title">Barra in basso opaca</string>@@ -254,14 +216,12 @@<string name="quality_sheet_title">Qualità audio</string><string name="quality_now">In riproduzione: %1$s</string><string name="quality_now_unknown">Non ancora nota: avvia un brano</string>- <string name="spotiflac_verify_in_browser">Completa la verifica nella scheda del browser che si è aperta, poi torna qui.</string><string name="update_downloading">Download… %1$d%%</string><string name="update_installing">Installazione…</string><string name="update_needs_permission">Per aggiornare, consenti a Myspoti di installare app, poi torna qui.</string><string name="update_allow">Consenti</string><string name="update_failed">Aggiornamento non riuscito: %1$s</string><string name="update_retry">Riprova</string>- <string name="downloads_verify_banner">I download richiedono la verifica SpotiFLAC una volta in questa app. Tocca qui per farla.</string><string name="removed_from">Rimosso da %1$s</string><string name="done">Fine</string><string name="playlist_edit_details">Modifica dettagli</string>@@ -271,14 +231,6 @@<string name="playlist_remove_cover">Rimuovi copertina</string><string name="playlist_save">Salva</string><string name="playlist_access_title">Chi può vederla</string>- <string name="playlist_access_public">Pubblica</string>- <string name="playlist_access_public_detail">Chiunque può trovarla e ascoltarla</string>- <string name="playlist_access_private">Privata</string>- <string name="playlist_access_private_detail">Solo tu puoi vederla</string>- <string name="playlist_access_collaborative">Collaborativa</string>- <string name="playlist_access_collaborative_detail">Solo le persone che inviti possono aggiungere e rimuovere brani</string>- <string name="playlist_on_profile">Sul tuo profilo</string>- <string name="playlist_on_profile_detail">Mostrata sul tuo profilo, visibile agli altri</string><string name="choose_artist">Scegli un artista</string><string name="quality_streaming_wifi_title">Streaming in Wi-Fi</string><string name="quality_streaming_cell_title">Streaming con dati mobili</string>@@ -316,13 +268,13 @@<string name="library_sort_recently_added">Aggiunti di recente</string><string name="library_change_failed">Impossibile aggiornare la libreria, riprova</string><string name="a11y_close_player">Chiudi il lettore</string>- <string name="a11y_devices">Dispositivi</string><string name="a11y_share">Condividi</string><string name="search_failed">Ricerca non riuscita. Controlla la connessione.</string><string name="retry_button">Riprova</string><string name="page_load_failed">Impossibile caricare questa pagina.\nControlla la connessione e riprova.</string><string name="jam_paste_link">Partecipa con un link copiato</string><string name="play_refused">Spotify ha rifiutato questa riproduzione sul tuo account. In alcuni paesi gli account gratuiti riproducono solo in ordine casuale: prova il pulsante casuale.</string>+ <string name="play_refused_all">Spotify sta rifiutando ogni comando di questo lettore sul tuo account (riproduzione, spostamento, trasferimento). Il lettore è stato ricaricato una volta; se non si sente nulla, chiudi completamente l\'app e riaprila, oppure passa dal Wi-Fi ai dati mobili o viceversa.</string><string name="artist_liked_songs">Brani che ti piacciono</string><plurals name="artist_liked_songs_count"><item quantity="one">%1$d brano di %2$s</item>@@ -337,7 +289,6 @@<string name="settings_rotation_auto">Automatica</string><string name="settings_rotation_landscape">Orizzontale</string><string name="support_github_action">Sponsor su GitHub</string>- <string name="spotiflac_verify_again">La verifica SpotiFLAC è scaduta: ripetila nelle Impostazioni per scaricare in lossless</string><string name="download_on_mobile_data">Download con i dati mobili: usa il tuo piano dati</string><string name="library_change_undone">Spotify ha rifiutato la modifica, la tua libreria è tornata com\'era</string><string name="blend_title">Blend</string>@@ -354,7 +305,6 @@<string name="blend_deleted">Questo Blend è stato eliminato</string><string name="blend_working">In corso…</string><string name="blend_invited_by">%1$s ti invita a un Blend</string>- <string name="blend_open">Apri il Blend</string><string name="blend_later">Non ora</string><string name="blend_members">Membri</string><string name="blend_invite_more">Invita altre persone</string>@@ -373,7 +323,6 @@<string name="diagnostic_export_title">Esporta un report diagnostico</string><string name="diagnostic_export_detail">Condivide il registro recente dell\'app e i dati del dispositivo</string><string name="diagnostic_export_failed">Impossibile scrivere il report diagnostico</string>- <string name="recently_played_title">Riprodotti di recente</string><string name="recently_played_empty">Quello che riproduci con questo account appare qui.</string><string name="recently_played_failed">Impossibile caricare l\'elenco dei riprodotti di recente (%1$s)</string><string name="recents_title">Recenti</string>@@ -416,11 +365,8 @@<string name="show_sort_chapters_newest">Tutti i capitoli • Più recenti</string><string name="show_sort_chapters_oldest">Tutti i capitoli • Meno recenti</string><string name="show_empty">Non c\'è ancora nulla da riprodurre qui</string>- <string name="show_rating">%1$s (%2$s)</string><string name="show_authors">Di %1$s</string><string name="show_narrators">Letto da %1$s</string>- <string name="show_followed">Ora segui questo podcast</string>- <string name="show_unfollowed">Non segui più questo podcast</string><string name="episode_duration_min">%1$d min</string><string name="episode_remaining">%1$s rimanenti</string><string name="episode_mark_played">Segna come riprodotto</string>@@ -433,20 +379,14 @@<string name="episode_show_more">mostra di più</string><string name="episode_show_less">mostra meno</string><string name="episode_download">Scarica</string>- <string name="episode_downloading">Download in corso…</string>- <string name="episode_downloaded">Scaricato</string><string name="episode_download_remove">Rimuovi download</string><string name="episode_options">Opzioni episodio</string><string name="episode_not_found">Episodio non trovato</string>- <string name="show_not_found">Podcast non trovato</string><string name="podcast_playing_from">In riproduzione dal podcast</string><string name="player_speed_chip">%1$s×</string><string name="player_back_15">Indietro di 15 secondi</string><string name="player_forward_15">Avanti di 15 secondi</string>- <string name="player_show_remaining">Mostra il tempo rimanente</string>- <string name="player_show_elapsed">Mostra il tempo trascorso</string><string name="player_sleep_timer">Timer di spegnimento</string>- <string name="player_speed_a11y">Velocità di riproduzione, %1$s×</string><string name="restart_player_done">Player riavviato</string><string name="spotify_limited">Spotify sta limitando la riproduzione per il momento. Riprova tra un minuto.</string><string name="settings_keep_playing_title">Continua la riproduzione dopo la chiusura</string>@@ -469,8 +409,6 @@<string name="link_copied">Link copiato</string><string name="lyrics_meaning_title">Significato</string><string name="lyrics_meaning_about">Info</string>- <string name="lyrics_meaning_lines">Versi spiegati</string>- <string name="lyrics_meaning_source">Da Genius · apri il brano lì</string><string name="lyrics_meaning_translating">Traduzione…</string><string name="lyrics_meaning_translate">Traduci</string><string name="lyrics_meaning_original">Vedi originale</string>diff --git a/base/app/src/main/res/values-it/spotify_strings.xml b/base/app/src/main/res/values-it/spotify_strings.xmlindex f7612811..f161f346 100644--- a/base/app/src/main/res/values-it/spotify_strings.xml+++ b/base/app/src/main/res/values-it/spotify_strings.xml@@ -17,7 +17,6 @@<string name="snackbar_added_to_liked_songs" formatted="false">Aggiunto ai Brani che ti piacciono.</string><string name="snackbar_removed_from_liked_songs" formatted="false">Rimosso dai brani che ti piacciono.</string><string name="content_description_context_menu" formatted="false">Altre opzioni</string>- <string name="close_button_content_description" formatted="false">Chiudi</string><string name="add_to_playlist_saved_in_section_header" formatted="false">Salvato in</string><string name="add_to_playlist_new_playlist_button_text" formatted="false">Nuova playlist</string><string name="add_to_playlist_button_cancel" formatted="false">Annulla</string>@@ -25,8 +24,6 @@<string name="lyrics_card_title" formatted="false">Testi</string><string name="lyrics_card_title_preview" formatted="false">Anteprima del testo</string><string name="lyrics_card_show_lyrics_button" formatted="false">Mostra testo</string>- <string name="lyrics_card_expand_button_content_description" formatted="false">Visualizza il testo a schermo intero</string>- <string name="lyrics_card_share_button_content_description" formatted="false">Condividi il testo</string><string name="lyrics_credential_note" formatted="false">Testo fornito da %1$s</string><string name="lyrics_fullscreen_chip_label_share" formatted="false">Condividi</string><string name="lyrics_fullscreen_chip_label_translate" formatted="false">Traduci</string>@@ -49,7 +46,6 @@<string name="artist_popular_tracks" formatted="false">Popolare</string><string name="curation_button_follow_state_text" formatted="false">Segui</string><string name="curation_button_following_state_text" formatted="false">Segui già</string>- <string name="search_main_entity_subtitle_artist" formatted="false">Artista</string><string name="connect_phone_is_self" formatted="false">Questo smartphone</string><string name="settings_item_canvas_title" formatted="false">Canvas</string><string name="video_settings_canvas_subtitle" formatted="false">Brevi immagini a ciclo continuo durante la riproduzione di un brano.</string>@@ -107,8 +103,6 @@<string name="library_search_text_hint" formatted="false">Cerca in La tua libreria</string><string name="account_title" formatted="false">Account</string><string name="song_dna_search_chip_followed_artists" formatted="false">Artisti seguiti</string>- <string name="settings_item_crossfade_title" formatted="false">Dissolvenza</string>- <string name="playback_settings_crossfade_slider_seconds" formatted="false">%1$d s</string><string name="local_files_title" formatted="false">File locali</string><string name="local_files_empty_section_title" formatted="false">Aggiungi i tuoi file audio a La tua libreria</string><string name="local_files_empty_section_subtitle" formatted="false">Hai un brano o un podcast personale che non è su Spotify?</string>@@ -138,14 +132,10 @@<string name="assisted_curation_search_filter_artists" formatted="false">Artisti</string><string name="assisted_curation_search_filter_albums" formatted="false">Album</string><string name="assisted_curation_search_filter_playlists" formatted="false">Playlist</string>- <string name="assisted_curation_search_filter_clear_content_description" formatted="false">Cancella filtro</string>- <string name="ad_category_title_music" formatted="false">Musica</string>- <string name="made_for_you_hub_title" formatted="false">Realizzata per te</string><string name="settings_item_app_language_title" formatted="false">Lingua app</string><string name="create_menu_item_folder_title" formatted="false">Cartella</string><string name="create_folder_name_suggested_folder_name" formatted="false">Nuova cartella</string><string name="context_menu_rename_folder" formatted="false">Rinomina cartella</string>- <string name="your_library_messaging_folder_rename_hint" formatted="false">Nome cartella</string><string name="create_playlist_content_description" formatted="false">Crea playlist</string><string name="actions_picker_delete" formatted="false">Elimina</string><string name="filter_and_sort_sort_section_title" formatted="false">Ordina per</string>diff --git a/base/app/src/main/res/values-it/strings.xml b/base/app/src/main/res/values-it/strings.xmlindex 50717953..70c7e6d3 100644--- a/base/app/src/main/res/values-it/strings.xml+++ b/base/app/src/main/res/values-it/strings.xml@@ -4,34 +4,14 @@<string name="aa_playlists">Playlists</string><string name="aa_albums">Album</string><string name="aa_artists">Artisti</string>- <string name="aa_podcasts">Podcast</string><string name="settings_amoled_theme">Tema AMOLED</string><string name="settings_amoled_theme_subtitle">Sfondo nero puro per risparmiare batteria</string>- <string name="settings_lyrics_style_spotify_default">Spotify predefinito</string>- <string name="settings_lyrics_style_fullscreen">Schermo intero (colori dell\'album)</string>- <string name="settings_lyrics_style_compact">Compatto</string>- <string name="settings_lyrics_style_karaoke">Karaoke</string>- <string name="settings_lyrics_style_bold">Grande e in grassetto</string><string name="main_update_available">È disponibile un nuovo aggiornamento</string>- <string name="notif_channel_media_name">Riproduzione multimediale</string>- <string name="notif_channel_media_description">Controlli di riproduzione multimediale di Myspoti</string>- <string name="notif_action_previous">Precedente</string>- <string name="notif_action_next">Successivo</string><string name="notif_action_play">Riproduci</string><string name="notif_action_pause">Pausa</string><string name="notif_shuffle_enable">Attiva riproduzione casuale</string><string name="notif_shuffle_disable">Disattiva riproduzione casuale</string><string name="notif_shuffle_disable_smart">Disattiva riproduzione casuale intelligente</string>- <string name="notif_action_like">Mi piace</string>- <string name="notif_action_unlike">Rimuovi \'Mi piace\'</string>- <string name="notif_unknown_name">Sconosciuto</string>- <string name="notif_by_artist">di %1$s</string>- <string name="notif_repeat_disable">Disattiva ripetizione</string>- <string name="notif_repeat_disable_one">Disattiva ripetizione del brano</string>- <string name="notif_repeat_enable">Attiva ripetizione</string>- <string name="bridge_player_unlocked">Lettore sbloccato</string>- <string name="bridge_reloading">Ricaricamento…</string>- <string name="service_disabled_message">Il servizio non è attivo</string><string name="account_page_title">Account Spotify</string><string name="account_page_detail">Abbonamento, privacy e dispositivi, su spotify.com</string><string name="energy_saver_title">Risparmio energetico</string>@@ -39,4 +19,5 @@<string name="playback_seek_description">Posizione di riproduzione</string><string name="video_fullscreen_enter">Schermo intero</string><string name="video_fullscreen_exit">Esci dallo schermo intero</string>+ <string name="player_source_downloaded">Scaricato</string></resources>diff --git a/base/app/src/main/res/values-iw/spotify_strings.xml b/base/app/src/main/res/values-iw/spotify_strings.xmlindex 586dbced..5f38530f 100644--- a/base/app/src/main/res/values-iw/spotify_strings.xml+++ b/base/app/src/main/res/values-iw/spotify_strings.xml@@ -17,7 +17,6 @@<string name="snackbar_added_to_liked_songs" formatted="false">נוסף לרשימת השירים שאהבתם.</string><string name="snackbar_removed_from_liked_songs" formatted="false">הוסר מרשימת השירים שאהבתם.</string><string name="content_description_context_menu" formatted="false">אפשרויות נוספות</string>- <string name="close_button_content_description" formatted="false">סגירה</string><string name="add_to_playlist_saved_in_section_header" formatted="false">נשמר בתיקייה</string><string name="add_to_playlist_new_playlist_button_text" formatted="false">פלייליסט חדש</string><string name="add_to_playlist_button_cancel" formatted="false">ביטול</string>@@ -25,8 +24,6 @@<string name="lyrics_card_title" formatted="false">מילות השיר</string><string name="lyrics_card_title_preview" formatted="false">תצוגה מקדימה של מילות השיר</string><string name="lyrics_card_show_lyrics_button" formatted="false">הצגת מילות השיר</string>- <string name="lyrics_card_expand_button_content_description" formatted="false">לפתיחת מילות השיר במסך מלא</string>- <string name="lyrics_card_share_button_content_description" formatted="false">שיתוף מילות השיר</string><string name="lyrics_credential_note" formatted="false">מילות השיר סופקו על ידי %1$s</string><string name="lyrics_fullscreen_chip_label_share" formatted="false">שיתוף</string><string name="lyrics_fullscreen_chip_label_translate" formatted="false">תרגום</string>@@ -49,7 +46,6 @@<string name="artist_popular_tracks" formatted="false">פופולריים</string><string name="curation_button_follow_state_text" formatted="false">מעקב</string><string name="curation_button_following_state_text" formatted="false">במעקב</string>- <string name="search_main_entity_subtitle_artist" formatted="false">אמן</string><string name="connect_phone_is_self" formatted="false">טלפון זה</string><string name="settings_item_canvas_title" formatted="false">Canvas</string><string name="video_settings_canvas_subtitle" formatted="false">דימויים חזותיים קצרים שחוזרים על עצמם כששיר מתנגן.</string>@@ -107,8 +103,6 @@<string name="library_search_text_hint" formatted="false">חיפוש בספרייה</string><string name="account_title" formatted="false">חשבון</string><string name="song_dna_search_chip_followed_artists" formatted="false">אמנים במעקב</string>- <string name="settings_item_crossfade_title" formatted="false">קרוספייד</string>- <string name="playback_settings_crossfade_slider_seconds" formatted="false">%1$d שנ\'</string><string name="local_files_title" formatted="false">קבצים מקומיים</string><string name="local_files_empty_section_title" formatted="false">הוסיפו לספרייה קובצי אודיו משלכם</string><string name="local_files_empty_section_subtitle" formatted="false">יש לכם שיר או פודקאסט אישי שלא מופיע ב-Spotify?</string>@@ -138,14 +132,10 @@<string name="assisted_curation_search_filter_artists" formatted="false">אמנים</string><string name="assisted_curation_search_filter_albums" formatted="false">אלבומים</string><string name="assisted_curation_search_filter_playlists" formatted="false">פלייליסטים</string>- <string name="assisted_curation_search_filter_clear_content_description" formatted="false">ביטול הסינון</string>- <string name="ad_category_title_music" formatted="false">מוזיקה</string>- <string name="made_for_you_hub_title" formatted="false">במיוחד בשבילך</string><string name="settings_item_app_language_title" formatted="false">שפת האפליקציה</string><string name="create_menu_item_folder_title" formatted="false">תיקייה</string><string name="create_folder_name_suggested_folder_name" formatted="false">תיקייה חדשה</string><string name="context_menu_rename_folder" formatted="false">שינוי שם התיקייה</string>- <string name="your_library_messaging_folder_rename_hint" formatted="false">שם התיקייה</string><string name="create_playlist_content_description" formatted="false">יצירת פלייליסט</string><string name="actions_picker_delete" formatted="false">מחיקה</string><string name="filter_and_sort_sort_section_title" formatted="false">מיון לפי</string>diff --git a/base/app/src/main/res/values-ja/spotify_strings.xml b/base/app/src/main/res/values-ja/spotify_strings.xmlindex d8f583be..d2e44ef9 100644--- a/base/app/src/main/res/values-ja/spotify_strings.xml+++ b/base/app/src/main/res/values-ja/spotify_strings.xml@@ -17,7 +17,6 @@<string name="snackbar_added_to_liked_songs" formatted="false">お気に入りの曲に追加しました。</string><string name="snackbar_removed_from_liked_songs" formatted="false">お気に入りの曲から削除しました。</string><string name="content_description_context_menu" formatted="false">その他のオプション</string>- <string name="close_button_content_description" formatted="false">閉じる</string><string name="add_to_playlist_saved_in_section_header" formatted="false">保存先</string><string name="add_to_playlist_new_playlist_button_text" formatted="false">新規プレイリスト</string><string name="add_to_playlist_button_cancel" formatted="false">キャンセル</string>@@ -25,8 +24,6 @@<string name="lyrics_card_title" formatted="false">歌詞</string><string name="lyrics_card_title_preview" formatted="false">歌詞のプレビュー</string><string name="lyrics_card_show_lyrics_button" formatted="false">歌詞を表示</string>- <string name="lyrics_card_expand_button_content_description" formatted="false">歌詞を全画面表示します</string>- <string name="lyrics_card_share_button_content_description" formatted="false">歌詞をシェアします</string><string name="lyrics_credential_note" formatted="false">歌詞提供:%1$s</string><string name="lyrics_fullscreen_chip_label_share" formatted="false">シェアします</string><string name="lyrics_fullscreen_chip_label_translate" formatted="false">翻訳</string>@@ -49,7 +46,6 @@<string name="artist_popular_tracks" formatted="false">人気の曲</string><string name="curation_button_follow_state_text" formatted="false">フォローする</string><string name="curation_button_following_state_text" formatted="false">フォロー中</string>- <string name="search_main_entity_subtitle_artist" formatted="false">アーティスト</string><string name="connect_phone_is_self" formatted="false">このスマホ</string><string name="settings_item_canvas_title" formatted="false">Canvas</string><string name="video_settings_canvas_subtitle" formatted="false">楽曲の再生中に表示される短いループ動画。</string>@@ -107,8 +103,6 @@<string name="library_search_text_hint" formatted="false">マイライブラリを検索</string><string name="account_title" formatted="false">アカウント</string><string name="song_dna_search_chip_followed_artists" formatted="false">フォローしているアーティスト</string>- <string name="settings_item_crossfade_title" formatted="false">クロスフェード</string>- <string name="playback_settings_crossfade_slider_seconds" formatted="false">%1$d秒</string><string name="local_files_title" formatted="false">ローカルファイル</string><string name="local_files_empty_section_title" formatted="false">マイライブラリに独自のオーディオファイルを追加しましょう</string><string name="local_files_empty_section_subtitle" formatted="false">Spotifyにない楽曲や個人のポッドキャストがおありですか?</string>@@ -138,14 +132,10 @@<string name="assisted_curation_search_filter_artists" formatted="false">アーティスト</string><string name="assisted_curation_search_filter_albums" formatted="false">アルバム</string><string name="assisted_curation_search_filter_playlists" formatted="false">プレイリスト</string>- <string name="assisted_curation_search_filter_clear_content_description" formatted="false">検索条件をクリアします</string>- <string name="ad_category_title_music" formatted="false">音楽</string>- <string name="made_for_you_hub_title" formatted="false">メイド・フォー・ユー</string><string name="settings_item_app_language_title" formatted="false">アプリの言語</string><string name="create_menu_item_folder_title" formatted="false">フォルダ</string><string name="create_folder_name_suggested_folder_name" formatted="false">新しいフォルダ</string><string name="context_menu_rename_folder" formatted="false">フォルダ名を変更</string>- <string name="your_library_messaging_folder_rename_hint" formatted="false">フォルダ名</string><string name="create_playlist_content_description" formatted="false">プレイリストを作成します</string><string name="actions_picker_delete" formatted="false">削除</string><string name="filter_and_sort_sort_section_title" formatted="false">並べ替え</string>diff --git a/base/app/src/main/res/values-kn/spotify_strings.xml b/base/app/src/main/res/values-kn/spotify_strings.xmlindex e844a7fc..c66aa4e7 100644--- a/base/app/src/main/res/values-kn/spotify_strings.xml+++ b/base/app/src/main/res/values-kn/spotify_strings.xml@@ -17,7 +17,6 @@<string name="snackbar_added_to_liked_songs" formatted="false">ಇಷ್ಟವಾದ ಹಾಡುಗಳಿಗೆ ಸೇರಿಸಲಾಗಿದೆ.</string><string name="snackbar_removed_from_liked_songs" formatted="false">ಲೈಕ್ ಮಾಡಿದ ಹಾಡುಗಳಿಂದ ತೆಗೆದುಹಾಕಲಾಗಿದೆ.</string><string name="content_description_context_menu" formatted="false">ಮತ್ತಷ್ಟು ಆಯ್ಕೆಗಳು</string>- <string name="close_button_content_description" formatted="false">ಮುಚ್ಚಿ</string><string name="add_to_playlist_saved_in_section_header" formatted="false">ಸೇವ್ ಆಗಿದೆ:</string><string name="add_to_playlist_new_playlist_button_text" formatted="false">ಹೊಸ ಪ್ಲೇಲಿಸ್ಟ್</string><string name="add_to_playlist_button_cancel" formatted="false">ರದ್ದುಮಾಡಿ</string>@@ -25,8 +24,6 @@<string name="lyrics_card_title" formatted="false">ಸಾಹಿತ್ಯ</string><string name="lyrics_card_title_preview" formatted="false">ಸಾಹಿತ್ಯ ಪ್ರಿವ್ಯೂ</string><string name="lyrics_card_show_lyrics_button" formatted="false">ಸಾಹಿತ್ಯವನ್ನು ತೋರಿಸು</string>- <string name="lyrics_card_expand_button_content_description" formatted="false">ಫುಲ್ಸ್ಕ್ರೀನ್ ಸಾಹಿತ್ಯವನ್ನು ತೆರೆಯಿರಿ</string>- <string name="lyrics_card_share_button_content_description" formatted="false">ಸಾಹಿತ್ಯವನ್ನು ಹಂಚಿಕೊಳ್ಳಿ</string><string name="lyrics_credential_note" formatted="false">%1$s ಒದಗಿಸಿದ ಗೀತಸಾಹಿತ್ಯ</string><string name="lyrics_fullscreen_chip_label_share" formatted="false">ಶೇರ್ ಮಾಡಿ</string><string name="lyrics_fullscreen_chip_label_translate" formatted="false">ಅನುವಾದಿಸಿ</string>@@ -49,7 +46,6 @@<string name="artist_popular_tracks" formatted="false">ಜನಪ್ರಿಯ</string><string name="curation_button_follow_state_text" formatted="false">ಫಾಲೋ</string><string name="curation_button_following_state_text" formatted="false">ಫಾಲೋಯಿಂಗ್</string>- <string name="search_main_entity_subtitle_artist" formatted="false">ಕಲಾವಿದರು</string><string name="connect_phone_is_self" formatted="false">ಈ ಫೋನ್ನಲ್ಲಿ</string><string name="settings_item_canvas_title" formatted="false">Canvas</string><string name="video_settings_canvas_subtitle" formatted="false">ಹಾಡು ಪ್ಲೇ ಆಗುತ್ತಿರುವಾಗ ಸಣ್ಣ, ಲೂಪಿಂಗ್ ದೃಶ್ಯಗಳು.</string>@@ -107,8 +103,6 @@<string name="library_search_text_hint" formatted="false">ನಿಮ್ಮ ಲೈಬ್ರರಿಯನ್ನು ಹುಡುಕಿ</string><string name="account_title" formatted="false">ಖಾತೆ</string><string name="song_dna_search_chip_followed_artists" formatted="false">ಕಲಾವಿದರನ್ನು ಫಾಲೋ ಮಾಡಲಾಗಿದೆ</string>- <string name="settings_item_crossfade_title" formatted="false">ಕ್ರಾಸ್ಫೇಡ್</string>- <string name="playback_settings_crossfade_slider_seconds" formatted="false">%1$d ಸೆ</string><string name="local_files_title" formatted="false">ಲೋಕಲ್ ಫೈಲ್ಗಳು</string><string name="local_files_empty_section_title" formatted="false">ನಿಮ್ಮ ಸ್ವಂತ ಆಡಿಯೋ ಫೈಲ್ಗಳನ್ನು ನಿಮ್ಮ ಲೈಬ್ರರಿಗೆ ಸೇರಿಸಿ</string><string name="local_files_empty_section_subtitle" formatted="false">Spotify ನಲ್ಲಿ ಇಲ್ಲದ ಹಾಡು ಅಥವಾ ವೈಯಕ್ತಿಕ ಪಾಡ್ಕಾಸ್ಟ್ ಯಾವುದಾದರೂ ಇದೆಯೇ?</string>@@ -138,14 +132,10 @@<string name="assisted_curation_search_filter_artists" formatted="false">ಕಲಾವಿದರು</string><string name="assisted_curation_search_filter_albums" formatted="false">ಆಲ್ಬಂಗಳು</string><string name="assisted_curation_search_filter_playlists" formatted="false">ಪ್ಲೇಲಿಸ್ಟ್ಗಳು</string>- <string name="assisted_curation_search_filter_clear_content_description" formatted="false">ಫಿಲ್ಟರ್ಗಳನ್ನು ಅಳಿಸಿ</string>- <string name="ad_category_title_music" formatted="false">ಸಂಗೀತ</string>- <string name="made_for_you_hub_title" formatted="false">ನಿಮಗಾಗಿ ಸಿದ್ಧವಾಗಿರುವುದು</string><string name="settings_item_app_language_title" formatted="false">ಆ್ಯಪ್ ಭಾಷೆ</string><string name="create_menu_item_folder_title" formatted="false">ಫೋಲ್ಡರ್</string><string name="create_folder_name_suggested_folder_name" formatted="false">ಹೊಸ ಫೋಲ್ಡರ್</string><string name="context_menu_rename_folder" formatted="false">ಫೋಲ್ಡರ್ ಅನ್ನು ಮರುಹೆಸರಿಸಿ</string>- <string name="your_library_messaging_folder_rename_hint" formatted="false">ಫೋಲ್ಡರ್ ಹೆಸರು</string><string name="create_playlist_content_description" formatted="false">ಪ್ಲೇಲಿಸ್ಟ್ ರಚಿಸಿ</string><string name="actions_picker_delete" formatted="false">ಅಳಿಸಿ</string><string name="filter_and_sort_sort_section_title" formatted="false">ವಿಂಗಡಿಸಿ:</string>diff --git a/base/app/src/main/res/values-ko/spotify_strings.xml b/base/app/src/main/res/values-ko/spotify_strings.xmlindex 9af0923d..654a630f 100644--- a/base/app/src/main/res/values-ko/spotify_strings.xml+++ b/base/app/src/main/res/values-ko/spotify_strings.xml@@ -17,7 +17,6 @@<string name="snackbar_added_to_liked_songs" formatted="false">좋아요 표시한 곡에 추가되었습니다.</string><string name="snackbar_removed_from_liked_songs" formatted="false">좋아요 표시한 곡에서 삭제되었습니다.</string><string name="content_description_context_menu" formatted="false">옵션 더보기</string>- <string name="close_button_content_description" formatted="false">닫기</string><string name="add_to_playlist_saved_in_section_header" formatted="false">저장된 플레이리스트</string><string name="add_to_playlist_new_playlist_button_text" formatted="false">새 플레이리스트</string><string name="add_to_playlist_button_cancel" formatted="false">취소</string>@@ -25,8 +24,6 @@<string name="lyrics_card_title" formatted="false">가사</string><string name="lyrics_card_title_preview" formatted="false">가사 미리 보기</string><string name="lyrics_card_show_lyrics_button" formatted="false">가사 표시하기</string>- <string name="lyrics_card_expand_button_content_description" formatted="false">전체화면으로 가사 보기</string>- <string name="lyrics_card_share_button_content_description" formatted="false">가사 공유</string><string name="lyrics_credential_note" formatted="false">가사 제공: %1$s</string><string name="lyrics_fullscreen_chip_label_share" formatted="false">공유</string><string name="lyrics_fullscreen_chip_label_translate" formatted="false">번역</string>@@ -49,7 +46,6 @@<string name="artist_popular_tracks" formatted="false">인기</string><string name="curation_button_follow_state_text" formatted="false">팔로우</string><string name="curation_button_following_state_text" formatted="false">팔로잉</string>- <string name="search_main_entity_subtitle_artist" formatted="false">아티스트</string><string name="connect_phone_is_self" formatted="false">이 휴대폰</string><string name="settings_item_canvas_title" formatted="false">Canvas</string><string name="video_settings_canvas_subtitle" formatted="false">곡이 재생될 때 표시되는 짧고 반복되는 시각 자료입니다.</string>@@ -107,8 +103,6 @@<string name="library_search_text_hint" formatted="false">내 라이브러리 검색하기</string><string name="account_title" formatted="false">계정</string><string name="song_dna_search_chip_followed_artists" formatted="false">팔로우한 아티스트</string>- <string name="settings_item_crossfade_title" formatted="false">크로스페이드</string>- <string name="playback_settings_crossfade_slider_seconds" formatted="false">%1$d초</string><string name="local_files_title" formatted="false">로컬 파일</string><string name="local_files_empty_section_title" formatted="false">갖고 있는 오디오 파일을 내 라이브러리에 추가하세요</string><string name="local_files_empty_section_subtitle" formatted="false">Spotify에서 제공하지 않는 곡 또는 개인 팟캐스트를 가지고 계신가요?</string>@@ -138,14 +132,10 @@<string name="assisted_curation_search_filter_artists" formatted="false">아티스트</string><string name="assisted_curation_search_filter_albums" formatted="false">앨범</string><string name="assisted_curation_search_filter_playlists" formatted="false">플레이리스트</string>- <string name="assisted_curation_search_filter_clear_content_description" formatted="false">필터 지우기</string>- <string name="ad_category_title_music" formatted="false">음악</string>- <string name="made_for_you_hub_title" formatted="false">나만의 플레이리스트</string><string name="settings_item_app_language_title" formatted="false">앱에서 사용할 언어</string><string name="create_menu_item_folder_title" formatted="false">폴더</string><string name="create_folder_name_suggested_folder_name" formatted="false">새 폴더</string><string name="context_menu_rename_folder" formatted="false">폴더 이름 바꾸기</string>- <string name="your_library_messaging_folder_rename_hint" formatted="false">폴더 이름</string><string name="create_playlist_content_description" formatted="false">플레이리스트 만들기</string><string name="actions_picker_delete" formatted="false">삭제</string><string name="filter_and_sort_sort_section_title" formatted="false">정렬 기준</string>diff --git a/base/app/src/main/res/values-lt/spotify_strings.xml b/base/app/src/main/res/values-lt/spotify_strings.xmlindex da89b100..e64e3e5d 100644--- a/base/app/src/main/res/values-lt/spotify_strings.xml+++ b/base/app/src/main/res/values-lt/spotify_strings.xml@@ -17,7 +17,6 @@<string name="snackbar_added_to_liked_songs" formatted="false">Įtraukta į grojaraštį „Patinkančios dainos“.</string><string name="snackbar_removed_from_liked_songs" formatted="false">Pašalinta iš aplanko „Patinkančios dainos“.</string><string name="content_description_context_menu" formatted="false">Daugiau parinkčių</string>- <string name="close_button_content_description" formatted="false">Uždaryti</string><string name="add_to_playlist_saved_in_section_header" formatted="false">Įrašyta</string><string name="add_to_playlist_new_playlist_button_text" formatted="false">Naujas grojaraštis</string><string name="add_to_playlist_button_cancel" formatted="false">Atšaukti</string>@@ -25,8 +24,6 @@<string name="lyrics_card_title" formatted="false">Dainų tekstai</string><string name="lyrics_card_title_preview" formatted="false">Dainos teksto peržiūra</string><string name="lyrics_card_show_lyrics_button" formatted="false">Rodyti dainos tekstą</string>- <string name="lyrics_card_expand_button_content_description" formatted="false">Atidaryti dainos tekstą per visą ekraną</string>- <string name="lyrics_card_share_button_content_description" formatted="false">Bendrinti dainos tekstą</string><string name="lyrics_credential_note" formatted="false">Dainos tekstą pateikė %1$s</string><string name="lyrics_fullscreen_chip_label_share" formatted="false">Dalintis</string><string name="lyrics_fullscreen_chip_label_translate" formatted="false">Išversti</string>@@ -49,7 +46,6 @@<string name="artist_popular_tracks" formatted="false">Populiarūs</string><string name="curation_button_follow_state_text" formatted="false">Stebėti</string><string name="curation_button_following_state_text" formatted="false">Stebi</string>- <string name="search_main_entity_subtitle_artist" formatted="false">Atlikėjas</string><string name="connect_phone_is_self" formatted="false">šiame telefone</string><string name="settings_item_canvas_title" formatted="false">„Canvas“</string><string name="video_settings_canvas_subtitle" formatted="false">Trumpos pasikartojančios vizualizacijos, rodomos klausantis dainos.</string>@@ -107,8 +103,6 @@<string name="library_search_text_hint" formatted="false">Ieškok aplanke „Mano biblioteka“</string><string name="account_title" formatted="false">Paskyra</string><string name="song_dna_search_chip_followed_artists" formatted="false">Stebimi atlikėjai</string>- <string name="settings_item_crossfade_title" formatted="false">Leisti sujungiant</string>- <string name="playback_settings_crossfade_slider_seconds" formatted="false">%1$d sek.</string><string name="local_files_title" formatted="false">Failai šiame įrenginyje</string><string name="local_files_empty_section_title" formatted="false">Įtrauk savo garso failus į aplanką „Mano biblioteka“</string><string name="local_files_empty_section_subtitle" formatted="false">Turi dainą ar asmeninę tinklalaidę, kurios nėra „Spotify“?</string>@@ -138,14 +132,10 @@<string name="assisted_curation_search_filter_artists" formatted="false">Atlikėjai</string><string name="assisted_curation_search_filter_albums" formatted="false">Albumai</string><string name="assisted_curation_search_filter_playlists" formatted="false">Grojaraščiai</string>- <string name="assisted_curation_search_filter_clear_content_description" formatted="false">Išvalyti filtrą</string>- <string name="ad_category_title_music" formatted="false">Muzika</string>- <string name="made_for_you_hub_title" formatted="false">Sukurta tau</string><string name="settings_item_app_language_title" formatted="false">Programėlės kalba</string><string name="create_menu_item_folder_title" formatted="false">Aplankas</string><string name="create_folder_name_suggested_folder_name" formatted="false">Naujas aplankas</string><string name="context_menu_rename_folder" formatted="false">Pervardinti aplanką</string>- <string name="your_library_messaging_folder_rename_hint" formatted="false">Aplanko pavadinimas</string><string name="create_playlist_content_description" formatted="false">Kurti grojaraštį</string><string name="actions_picker_delete" formatted="false">Naikinti</string><string name="filter_and_sort_sort_section_title" formatted="false">Rikiuoti pagal</string>diff --git a/base/app/src/main/res/values-lv/spotify_strings.xml b/base/app/src/main/res/values-lv/spotify_strings.xmlindex 4b4b13d3..27fbc1d4 100644--- a/base/app/src/main/res/values-lv/spotify_strings.xml+++ b/base/app/src/main/res/values-lv/spotify_strings.xml@@ -17,7 +17,6 @@<string name="snackbar_added_to_liked_songs" formatted="false">Pievienota dziesmām ar atzīmi “Patīk”.</string><string name="snackbar_removed_from_liked_songs" formatted="false">Noņemta no dziesmām, kas atzīmētas ar “Patīk”.</string><string name="content_description_context_menu" formatted="false">Citas opcijas</string>- <string name="close_button_content_description" formatted="false">Aizvērt</string><string name="add_to_playlist_saved_in_section_header" formatted="false">Saglabāts pie</string><string name="add_to_playlist_new_playlist_button_text" formatted="false">Jauns mūzikas saraksts</string><string name="add_to_playlist_button_cancel" formatted="false">Atcelt</string>@@ -25,8 +24,6 @@<string name="lyrics_card_title" formatted="false">Dziesmu vārdi</string><string name="lyrics_card_title_preview" formatted="false">Dziesmu vārdu priekšskatījums</string><string name="lyrics_card_show_lyrics_button" formatted="false">Rādīt dziesmas vārdus</string>- <string name="lyrics_card_expand_button_content_description" formatted="false">Atvērt dziesmu vārdus pilnekrāna skatā</string>- <string name="lyrics_card_share_button_content_description" formatted="false">Dziesmu vārdu kopīgošana</string><string name="lyrics_credential_note" formatted="false">Dziesmas vārdus nodrošina %1$s</string><string name="lyrics_fullscreen_chip_label_share" formatted="false">Kopīgot</string><string name="lyrics_fullscreen_chip_label_translate" formatted="false">Tulkot</string>@@ -49,7 +46,6 @@<string name="artist_popular_tracks" formatted="false">Populāras</string><string name="curation_button_follow_state_text" formatted="false">Sekot</string><string name="curation_button_following_state_text" formatted="false">Sekoju</string>- <string name="search_main_entity_subtitle_artist" formatted="false">Izpildītājs</string><string name="connect_phone_is_self" formatted="false">Šajā tālrunī</string><string name="settings_item_canvas_title" formatted="false">Canvas</string><string name="video_settings_canvas_subtitle" formatted="false">Īsa, cikliska vizualizācija dziesmas atskaņošanas laikā.</string>@@ -107,8 +103,6 @@<string name="library_search_text_hint" formatted="false">Meklēt sadaļā Mana bibliotēka</string><string name="account_title" formatted="false">Konts</string><string name="song_dna_search_chip_followed_artists" formatted="false">Izpildītāji, kam sekoju</string>- <string name="settings_item_crossfade_title" formatted="false">Sapludināšana</string>- <string name="playback_settings_crossfade_slider_seconds" formatted="false">%1$d s</string><string name="local_files_title" formatted="false">Vietējie faili</string><string name="local_files_empty_section_title" formatted="false">Pievieno savus audio failus mapē Tava bibliotēka</string><string name="local_files_empty_section_subtitle" formatted="false">Vai tev ir dziesma vai personīgais raidieraksts, kas nav pieejams Spotify?</string>@@ -138,14 +132,10 @@<string name="assisted_curation_search_filter_artists" formatted="false">Izpildītāji</string><string name="assisted_curation_search_filter_albums" formatted="false">Albumi</string><string name="assisted_curation_search_filter_playlists" formatted="false">Mūzikas saraksti</string>- <string name="assisted_curation_search_filter_clear_content_description" formatted="false">Notīrīt filtru</string>- <string name="ad_category_title_music" formatted="false">Mūzika</string>- <string name="made_for_you_hub_title" formatted="false">Izveidots tev</string><string name="settings_item_app_language_title" formatted="false">Lietotnes valoda</string><string name="create_menu_item_folder_title" formatted="false">Mape</string><string name="create_folder_name_suggested_folder_name" formatted="false">Jauna mape</string><string name="context_menu_rename_folder" formatted="false">Pārdēvēt mapi</string>- <string name="your_library_messaging_folder_rename_hint" formatted="false">Mapes nosaukums</string><string name="create_playlist_content_description" formatted="false">Izveidot mūzikas sarakstu</string><string name="actions_picker_delete" formatted="false">Dzēst</string><string name="filter_and_sort_sort_section_title" formatted="false">Kārtot pēc</string>diff --git a/base/app/src/main/res/values-mk/spotify_strings.xml b/base/app/src/main/res/values-mk/spotify_strings.xmlindex aa39c8f0..c5193ea5 100644--- a/base/app/src/main/res/values-mk/spotify_strings.xml+++ b/base/app/src/main/res/values-mk/spotify_strings.xml@@ -17,7 +17,6 @@<string name="snackbar_added_to_liked_songs" formatted="false">Додадено во „Песни што ти се допаѓаат“.</string><string name="snackbar_removed_from_liked_songs" formatted="false">Отстрането од „Песни што ти се допаѓаат“.</string><string name="content_description_context_menu" formatted="false">Повеќе опции</string>- <string name="close_button_content_description" formatted="false">Затвори</string><string name="add_to_playlist_saved_in_section_header" formatted="false">Зачувано во</string><string name="add_to_playlist_new_playlist_button_text" formatted="false">Нова плејлиста</string><string name="add_to_playlist_button_cancel" formatted="false">Откажи</string>@@ -25,8 +24,6 @@<string name="lyrics_card_title" formatted="false">Текст</string><string name="lyrics_card_title_preview" formatted="false">Преглед на текстот</string><string name="lyrics_card_show_lyrics_button" formatted="false">Прикажи текст</string>- <string name="lyrics_card_expand_button_content_description" formatted="false">Отвори го текстот на цел екран</string>- <string name="lyrics_card_share_button_content_description" formatted="false">Сподели текст</string><string name="lyrics_credential_note" formatted="false">Текстот е обезбеден од %1$s</string><string name="lyrics_fullscreen_chip_label_share" formatted="false">Сподели</string><string name="lyrics_fullscreen_chip_label_translate" formatted="false">Преведи</string>@@ -49,7 +46,6 @@<string name="artist_popular_tracks" formatted="false">Популарни</string><string name="curation_button_follow_state_text" formatted="false">Следи</string><string name="curation_button_following_state_text" formatted="false">Следиш</string>- <string name="search_main_entity_subtitle_artist" formatted="false">Изведувач</string><string name="connect_phone_is_self" formatted="false">Телефонов</string><string name="settings_item_canvas_title" formatted="false">Canvas</string><string name="video_settings_canvas_subtitle" formatted="false">Кратки, повторливи визуелни елементи кога е пуштена некоја песна.</string>@@ -107,8 +103,6 @@<string name="library_search_text_hint" formatted="false">Пребарај ја „Твојата збирка“</string><string name="account_title" formatted="false">Сметка</string><string name="song_dna_search_chip_followed_artists" formatted="false">Следени изведувачи</string>- <string name="settings_item_crossfade_title" formatted="false">Постепен премин</string>- <string name="playback_settings_crossfade_slider_seconds" formatted="false">%1$d сек.</string><string name="local_files_title" formatted="false">Локални датотеки</string><string name="local_files_empty_section_title" formatted="false">Додавај свои аудиодатотеки во „Твојата збирка“</string><string name="local_files_empty_section_subtitle" formatted="false">Имаш песна или личен поткаст што не е на Spotify?</string>@@ -138,14 +132,10 @@<string name="assisted_curation_search_filter_artists" formatted="false">Изведувачи</string><string name="assisted_curation_search_filter_albums" formatted="false">Албуми</string><string name="assisted_curation_search_filter_playlists" formatted="false">Плејлисти</string>- <string name="assisted_curation_search_filter_clear_content_description" formatted="false">Избриши го филтерот</string>- <string name="ad_category_title_music" formatted="false">Музика</string>- <string name="made_for_you_hub_title" formatted="false">Создадени за тебе</string><string name="settings_item_app_language_title" formatted="false">Јазик на апликацијата</string><string name="create_menu_item_folder_title" formatted="false">Папка</string><string name="create_folder_name_suggested_folder_name" formatted="false">Нова папка</string><string name="context_menu_rename_folder" formatted="false">Преименувај ја папката</string>- <string name="your_library_messaging_folder_rename_hint" formatted="false">Име на папката</string><string name="create_playlist_content_description" formatted="false">Создај плејлиста</string><string name="actions_picker_delete" formatted="false">Избриши</string><string name="filter_and_sort_sort_section_title" formatted="false">Подреди по</string>diff --git a/base/app/src/main/res/values-ml/spotify_strings.xml b/base/app/src/main/res/values-ml/spotify_strings.xmlindex 239eda77..a56f9a0f 100644--- a/base/app/src/main/res/values-ml/spotify_strings.xml+++ b/base/app/src/main/res/values-ml/spotify_strings.xml@@ -17,7 +17,6 @@<string name="snackbar_added_to_liked_songs" formatted="false">ലൈക്ക് ചെയ്ത ഗാനങ്ങളിലേക്ക് ചേർത്തു.</string><string name="snackbar_removed_from_liked_songs" formatted="false">ലൈക്ക് ചെയ്ത ഗാനങ്ങളിൽ നിന്ന് നീക്കംചെയ്തു.</string><string name="content_description_context_menu" formatted="false">കൂടുതൽ ഓപ്ഷനുകൾ</string>- <string name="close_button_content_description" formatted="false">അടയ്ക്കുക</string><string name="add_to_playlist_saved_in_section_header" formatted="false">ഇതിൽ സംരക്ഷിച്ചിരിക്കുന്നു</string><string name="add_to_playlist_new_playlist_button_text" formatted="false">പുതിയ പ്ലേലിസ്റ്റ്</string><string name="add_to_playlist_button_cancel" formatted="false">റദ്ദാക്കുക</string>@@ -25,8 +24,6 @@<string name="lyrics_card_title" formatted="false">വരികൾ</string><string name="lyrics_card_title_preview" formatted="false">വരികളുടെ പ്രിവ്യൂ</string><string name="lyrics_card_show_lyrics_button" formatted="false">വരികൾ കാണിക്കുക</string>- <string name="lyrics_card_expand_button_content_description" formatted="false">വരികളുടെ പൂർണ്ണ സ്ക്രീൻ തുറക്കുക</string>- <string name="lyrics_card_share_button_content_description" formatted="false">വരികൾ പങ്കിടുക</string><string name="lyrics_credential_note" formatted="false">വരികൾ നൽകിയിരിക്കുന്നത് %1$s</string><string name="lyrics_fullscreen_chip_label_share" formatted="false">പങ്കിടുക</string><string name="lyrics_fullscreen_chip_label_translate" formatted="false">വിവർത്തനം ചെയ്യുക</string>@@ -49,7 +46,6 @@<string name="artist_popular_tracks" formatted="false">ജനപ്രിയം</string><string name="curation_button_follow_state_text" formatted="false">പിന്തുടരുക</string><string name="curation_button_following_state_text" formatted="false">പിന്തുടരുന്നു</string>- <string name="search_main_entity_subtitle_artist" formatted="false">ആർട്ടിസ്റ്റ്</string><string name="connect_phone_is_self" formatted="false">ഈ ഫോൺ</string><string name="settings_item_canvas_title" formatted="false">Canvas</string><string name="video_settings_canvas_subtitle" formatted="false">ഒരു ഗാനം പ്ലേ ചെയ്യുമ്പോഴുള്ള ഹ്രസ്വവും ലൂപ്പ് ചെയ്യുന്നതുമായ ദൃശ്യങ്ങൾ.</string>@@ -107,8 +103,6 @@<string name="library_search_text_hint" formatted="false">നിങ്ങളുടെ ലൈബ്രറി തിരയുക</string><string name="account_title" formatted="false">അക്കൗണ്ട്</string><string name="song_dna_search_chip_followed_artists" formatted="false">പിന്തുടരുന്ന ആർട്ടിസ്റ്റുകൾ</string>- <string name="settings_item_crossfade_title" formatted="false">ക്രോസ്ഫേഡ്</string>- <string name="playback_settings_crossfade_slider_seconds" formatted="false">%1$d സെ</string><string name="local_files_title" formatted="false">ലോക്കൽ ഫയലുകൾ</string><string name="local_files_empty_section_title" formatted="false">നിങ്ങളുടെ ലൈബ്രറിയിലേക്ക് സ്വന്തം ഓഡിയോ ഫയലുകൾ ചേർക്കുക</string><string name="local_files_empty_section_subtitle" formatted="false">Spotify-യിൽ ഇല്ലാത്ത ഒരു ഗാനമോ വ്യക്തിഗത പോഡ്കാസ്റ്റോ ലഭിച്ചോ?</string>@@ -138,14 +132,10 @@<string name="assisted_curation_search_filter_artists" formatted="false">ആർട്ടിസ്റ്റുകൾ</string><string name="assisted_curation_search_filter_albums" formatted="false">ആൽബങ്ങൾ</string><string name="assisted_curation_search_filter_playlists" formatted="false">പ്ലേലിസ്റ്റുകൾ</string>- <string name="assisted_curation_search_filter_clear_content_description" formatted="false">ഫിൽട്ടർ ക്ലിയർ ചെയ്യുക</string>- <string name="ad_category_title_music" formatted="false">സംഗീതം</string>- <string name="made_for_you_hub_title" formatted="false">നിങ്ങൾക്കായി സൃഷ്ടിച്ചിരിക്കുന്നത്</string><string name="settings_item_app_language_title" formatted="false">ആപ്പ് ഭാഷ</string><string name="create_menu_item_folder_title" formatted="false">ഫോൾഡർ</string><string name="create_folder_name_suggested_folder_name" formatted="false">പുതിയ ഫോൾഡർ</string><string name="context_menu_rename_folder" formatted="false">ഫോൾഡറിന്റെ പേര് മാറ്റുക</string>- <string name="your_library_messaging_folder_rename_hint" formatted="false">ഫോൾഡറിന്റെ പേര്</string><string name="create_playlist_content_description" formatted="false">പ്ലേലിസ്റ്റ് സൃഷ്ടിക്കുക</string><string name="actions_picker_delete" formatted="false">ഇല്ലാതാക്കുക</string><string name="filter_and_sort_sort_section_title" formatted="false">ഇപ്രകാരം അടുക്കുക</string>diff --git a/base/app/src/main/res/values-mr/spotify_strings.xml b/base/app/src/main/res/values-mr/spotify_strings.xmlindex eab317f8..591bf9d9 100644--- a/base/app/src/main/res/values-mr/spotify_strings.xml+++ b/base/app/src/main/res/values-mr/spotify_strings.xml@@ -17,7 +17,6 @@<string name="snackbar_added_to_liked_songs" formatted="false">लाईक केलेल्या गाण्यामध्ये जोडले.</string><string name="snackbar_removed_from_liked_songs" formatted="false">लाइक केलेल्या गाण्यांमधून हटवले.</string><string name="content_description_context_menu" formatted="false">अधिक पर्याय</string>- <string name="close_button_content_description" formatted="false">बंद करा</string><string name="add_to_playlist_saved_in_section_header" formatted="false">मध्ये सेव्ह केले</string><string name="add_to_playlist_new_playlist_button_text" formatted="false">नवीन प्लेलिस्ट</string><string name="add_to_playlist_button_cancel" formatted="false">रद्द करा</string>@@ -25,8 +24,6 @@<string name="lyrics_card_title" formatted="false">गाण्याचे बोल</string><string name="lyrics_card_title_preview" formatted="false">गाण्याच्या बोलाचे पूर्वावलोकन</string><string name="lyrics_card_show_lyrics_button" formatted="false">गाण्याचे बोल दर्शवा</string>- <string name="lyrics_card_expand_button_content_description" formatted="false">फुलस्क्रीन गाण्याचे बोल उघडा</string>- <string name="lyrics_card_share_button_content_description" formatted="false">गाण्याचे बोल शेअर करा</string><string name="lyrics_credential_note" formatted="false">गीत %1$s द्वारे शब्दबद्ध केले आहेत</string><string name="lyrics_fullscreen_chip_label_share" formatted="false">शेअर करा</string><string name="lyrics_fullscreen_chip_label_translate" formatted="false">भाषांतर करा</string>@@ -49,7 +46,6 @@<string name="artist_popular_tracks" formatted="false">लोकप्रिय</string><string name="curation_button_follow_state_text" formatted="false">फॉलो करा</string><string name="curation_button_following_state_text" formatted="false">फॉलो करत आहे</string>- <string name="search_main_entity_subtitle_artist" formatted="false">कलाकार</string><string name="connect_phone_is_self" formatted="false">हा फोन</string><string name="settings_item_canvas_title" formatted="false">Canvas</string><string name="video_settings_canvas_subtitle" formatted="false">गाणे प्ले होत असताना लहान, लूपमध्ये चालणारी व्हिज्युअल.</string>@@ -107,8 +103,6 @@<string name="library_search_text_hint" formatted="false">तुमची लायब्ररी शोधा</string><string name="account_title" formatted="false">खाते</string><string name="song_dna_search_chip_followed_artists" formatted="false">फॉलो केलेले कलाकार</string>- <string name="settings_item_crossfade_title" formatted="false">क्रॉसफेड</string>- <string name="playback_settings_crossfade_slider_seconds" formatted="false">%1$d से</string><string name="local_files_title" formatted="false">स्थानिक फाइल्स</string><string name="local_files_empty_section_title" formatted="false">तुमच्या स्वतःच्या ऑडिओ फाइल तुमच्या लायब्ररीमध्ये जोडा</string><string name="local_files_empty_section_subtitle" formatted="false">Spotify वर नसलेले गाणे किंवा वैयक्तिक पॉडकास्ट मिळाले?</string>@@ -138,14 +132,10 @@<string name="assisted_curation_search_filter_artists" formatted="false">कलाकार</string><string name="assisted_curation_search_filter_albums" formatted="false">अल्बम</string><string name="assisted_curation_search_filter_playlists" formatted="false">प्लेलिस्ट</string>- <string name="assisted_curation_search_filter_clear_content_description" formatted="false">फिल्टर साफ करा</string>- <string name="ad_category_title_music" formatted="false">संगीत</string>- <string name="made_for_you_hub_title" formatted="false">तुमच्यासाठी बनवलेले</string><string name="settings_item_app_language_title" formatted="false">अॅप भाषा</string><string name="create_menu_item_folder_title" formatted="false">फोल्डर</string><string name="create_folder_name_suggested_folder_name" formatted="false">नवीन फोल्डर</string><string name="context_menu_rename_folder" formatted="false">फोल्डरचे नाव बदला</string>- <string name="your_library_messaging_folder_rename_hint" formatted="false">फोल्डरचे नाव</string><string name="create_playlist_content_description" formatted="false">प्लेलिस्ट तयार करा</string><string name="actions_picker_delete" formatted="false">हटवा</string><string name="filter_and_sort_sort_section_title" formatted="false">द्वारा क्रमवारी</string>diff --git a/base/app/src/main/res/values-ms/spotify_strings.xml b/base/app/src/main/res/values-ms/spotify_strings.xmlindex 4af60e79..9eb0cf79 100644--- a/base/app/src/main/res/values-ms/spotify_strings.xml+++ b/base/app/src/main/res/values-ms/spotify_strings.xml@@ -17,7 +17,6 @@<string name="snackbar_added_to_liked_songs" formatted="false">Ditambahkan pada Lagu Disukai.</string><string name="snackbar_removed_from_liked_songs" formatted="false">Dikeluarkan daripada Lagu Disukai.</string><string name="content_description_context_menu" formatted="false">Lebih banyak pilihan</string>- <string name="close_button_content_description" formatted="false">Tutup</string><string name="add_to_playlist_saved_in_section_header" formatted="false">Disimpan dalam</string><string name="add_to_playlist_new_playlist_button_text" formatted="false">Playlist baharu</string><string name="add_to_playlist_button_cancel" formatted="false">Batal</string>@@ -25,8 +24,6 @@<string name="lyrics_card_title" formatted="false">Lirik</string><string name="lyrics_card_title_preview" formatted="false">Pratonton lirik</string><string name="lyrics_card_show_lyrics_button" formatted="false">Tunjukkan lirik</string>- <string name="lyrics_card_expand_button_content_description" formatted="false">Buka lirik skrin penuh</string>- <string name="lyrics_card_share_button_content_description" formatted="false">Kongsi lirik</string><string name="lyrics_credential_note" formatted="false">Lirik disediakan oleh %1$s</string><string name="lyrics_fullscreen_chip_label_share" formatted="false">Kongsi</string><string name="lyrics_fullscreen_chip_label_translate" formatted="false">Terjemah</string>@@ -49,7 +46,6 @@<string name="artist_popular_tracks" formatted="false">Popular</string><string name="curation_button_follow_state_text" formatted="false">Ikuti</string><string name="curation_button_following_state_text" formatted="false">Mengikuti</string>- <string name="search_main_entity_subtitle_artist" formatted="false">Artis</string><string name="connect_phone_is_self" formatted="false">Telefon ini</string><string name="settings_item_canvas_title" formatted="false">Canvas</string><string name="video_settings_canvas_subtitle" formatted="false">Visual pendek dan berulang apabila lagu dimainkan.</string>@@ -107,8 +103,6 @@<string name="library_search_text_hint" formatted="false">Cari dalam Pustaka Anda</string><string name="account_title" formatted="false">Akaun</string><string name="song_dna_search_chip_followed_artists" formatted="false">Artis yang diikuti</string>- <string name="settings_item_crossfade_title" formatted="false">Lenyap silang</string>- <string name="playback_settings_crossfade_slider_seconds" formatted="false">%1$d s</string><string name="local_files_title" formatted="false">Fail Tempatan</string><string name="local_files_empty_section_title" formatted="false">Tambahkan fail audio anda sendiri pada Pustaka Anda</string><string name="local_files_empty_section_subtitle" formatted="false">Terdapat lagu atau podcast peribadi yang tidak ada di Spotify?</string>@@ -138,14 +132,10 @@<string name="assisted_curation_search_filter_artists" formatted="false">Artis</string><string name="assisted_curation_search_filter_albums" formatted="false">Album</string><string name="assisted_curation_search_filter_playlists" formatted="false">Playlist</string>- <string name="assisted_curation_search_filter_clear_content_description" formatted="false">Kosongkan penapis</string>- <string name="ad_category_title_music" formatted="false">Muzik</string>- <string name="made_for_you_hub_title" formatted="false">Dibuat untuk Anda</string><string name="settings_item_app_language_title" formatted="false">Bahasa aplikasi</string><string name="create_menu_item_folder_title" formatted="false">Folder</string><string name="create_folder_name_suggested_folder_name" formatted="false">Folder baharu</string><string name="context_menu_rename_folder" formatted="false">Namakan semula folder</string>- <string name="your_library_messaging_folder_rename_hint" formatted="false">Nama folder</string><string name="create_playlist_content_description" formatted="false">Buat playlist</string><string name="actions_picker_delete" formatted="false">Padam</string><string name="filter_and_sort_sort_section_title" formatted="false">Isih mengikut</string>diff --git a/base/app/src/main/res/values-nb/spotify_strings.xml b/base/app/src/main/res/values-nb/spotify_strings.xmlindex 6b7281a3..3bc33485 100644--- a/base/app/src/main/res/values-nb/spotify_strings.xml+++ b/base/app/src/main/res/values-nb/spotify_strings.xml@@ -17,7 +17,6 @@<string name="snackbar_added_to_liked_songs" formatted="false">Lagt til i Likte låter.</string><string name="snackbar_removed_from_liked_songs" formatted="false">Fjernet fra Likte låter.</string><string name="content_description_context_menu" formatted="false">Flere valg</string>- <string name="close_button_content_description" formatted="false">Lukk</string><string name="add_to_playlist_saved_in_section_header" formatted="false">Lagret i</string><string name="add_to_playlist_new_playlist_button_text" formatted="false">Ny spilleliste</string><string name="add_to_playlist_button_cancel" formatted="false">Avbryt</string>@@ -25,8 +24,6 @@<string name="lyrics_card_title" formatted="false">Sangtekster</string><string name="lyrics_card_title_preview" formatted="false">Forhåndsvisning av sangtekster</string><string name="lyrics_card_show_lyrics_button" formatted="false">Vis sangtekst</string>- <string name="lyrics_card_expand_button_content_description" formatted="false">Åpne sangtekster i fullskjerm</string>- <string name="lyrics_card_share_button_content_description" formatted="false">Del sangtekst</string><string name="lyrics_credential_note" formatted="false">Sangtekster levert av %1$s</string><string name="lyrics_fullscreen_chip_label_share" formatted="false">Del</string><string name="lyrics_fullscreen_chip_label_translate" formatted="false">Oversett</string>@@ -49,7 +46,6 @@<string name="artist_popular_tracks" formatted="false">Populære</string><string name="curation_button_follow_state_text" formatted="false">Følg</string><string name="curation_button_following_state_text" formatted="false">Følger</string>- <string name="search_main_entity_subtitle_artist" formatted="false">Artist</string><string name="connect_phone_is_self" formatted="false">Denne telefonen</string><string name="settings_item_canvas_title" formatted="false">Canvas</string><string name="video_settings_canvas_subtitle" formatted="false">Korte, gjentakende bilder når en låt spilles av.</string>@@ -107,8 +103,6 @@<string name="library_search_text_hint" formatted="false">Søk i Ditt bibliotek</string><string name="account_title" formatted="false">Konto</string><string name="song_dna_search_chip_followed_artists" formatted="false">Fulgte artister</string>- <string name="settings_item_crossfade_title" formatted="false">Crossfade</string>- <string name="playback_settings_crossfade_slider_seconds" formatted="false">%1$d sek</string><string name="local_files_title" formatted="false">Lokale filer</string><string name="local_files_empty_section_title" formatted="false">Legg til dine egne lydfiler i biblioteket ditt</string><string name="local_files_empty_section_subtitle" formatted="false">Har du en låt eller personlig podkast som ikke er på Spotify?</string>@@ -138,14 +132,10 @@<string name="assisted_curation_search_filter_artists" formatted="false">Artister</string><string name="assisted_curation_search_filter_albums" formatted="false">Album</string><string name="assisted_curation_search_filter_playlists" formatted="false">Spillelister</string>- <string name="assisted_curation_search_filter_clear_content_description" formatted="false">Fjern filter</string>- <string name="ad_category_title_music" formatted="false">Musikk</string>- <string name="made_for_you_hub_title" formatted="false">Spesielt for deg</string><string name="settings_item_app_language_title" formatted="false">Språk i appen</string><string name="create_menu_item_folder_title" formatted="false">Mappe</string><string name="create_folder_name_suggested_folder_name" formatted="false">Ny mappe</string><string name="context_menu_rename_folder" formatted="false">Gi nytt navn til mappen</string>- <string name="your_library_messaging_folder_rename_hint" formatted="false">Mappenavn</string><string name="create_playlist_content_description" formatted="false">Lag spilleliste</string><string name="actions_picker_delete" formatted="false">Slett</string><string name="filter_and_sort_sort_section_title" formatted="false">Sorter etter</string>diff --git a/base/app/src/main/res/values-ne/spotify_strings.xml b/base/app/src/main/res/values-ne/spotify_strings.xmlindex dee24be4..c089e68e 100644--- a/base/app/src/main/res/values-ne/spotify_strings.xml+++ b/base/app/src/main/res/values-ne/spotify_strings.xml@@ -17,7 +17,6 @@<string name="snackbar_added_to_liked_songs" formatted="false">मनपराइएका गीतहरूमा थपियो।</string><string name="snackbar_removed_from_liked_songs" formatted="false">मनपरेका गीतहरूबाट हटाइयो।</string><string name="content_description_context_menu" formatted="false">थप विकल्पहरू</string>- <string name="close_button_content_description" formatted="false">बन्द गर्नुहोस्</string><string name="add_to_playlist_saved_in_section_header" formatted="false">यहाँ सेभ गरिएको</string><string name="add_to_playlist_new_playlist_button_text" formatted="false">नयाँ प्लेलिस्ट</string><string name="add_to_playlist_button_cancel" formatted="false">रद्द गर्नुहोस्</string>@@ -25,8 +24,6 @@<string name="lyrics_card_title" formatted="false">लिरिक्स</string><string name="lyrics_card_title_preview" formatted="false">लिरिक्स प्रिभ्यू</string><string name="lyrics_card_show_lyrics_button" formatted="false">लिरिक्स देखाउनुहोस्</string>- <string name="lyrics_card_expand_button_content_description" formatted="false">लिरिक्स कार्ड फुल स्क्रिनमा खोल्नुहोस्</string>- <string name="lyrics_card_share_button_content_description" formatted="false">लिरिक्स सेयर गर्नुहोस्</string><string name="lyrics_credential_note" formatted="false">%1$s द्वारा उपलब्ध गराइएको लिरिक्स</string><string name="lyrics_fullscreen_chip_label_share" formatted="false">सेयर गर्नुहोस्</string><string name="lyrics_fullscreen_chip_label_translate" formatted="false">अनुवाद गर्नुहोस्</string>@@ -49,7 +46,6 @@<string name="artist_popular_tracks" formatted="false">लोकप्रिय</string><string name="curation_button_follow_state_text" formatted="false">फलो गर्नुहोस्</string><string name="curation_button_following_state_text" formatted="false">फलो गरिरहेको</string>- <string name="search_main_entity_subtitle_artist" formatted="false">कलाकार</string><string name="connect_phone_is_self" formatted="false">यो फोनमा</string><string name="settings_item_canvas_title" formatted="false">Canvas</string><string name="video_settings_canvas_subtitle" formatted="false">गीत बजिरहेको बेला छोटो, लुपिङ दृश्यहरू।</string>@@ -107,8 +103,6 @@<string name="library_search_text_hint" formatted="false">\"तपाईंको लाइब्रेरी\" मा खोज्नुहोस्</string><string name="account_title" formatted="false">खाता</string><string name="song_dna_search_chip_followed_artists" formatted="false">फलो गरिएका कलाकारहरू</string>- <string name="settings_item_crossfade_title" formatted="false">क्रसफेड</string>- <string name="playback_settings_crossfade_slider_seconds" formatted="false">%1$d सेकेन्ड</string><string name="local_files_title" formatted="false">लोकल फाइलहरू</string><string name="local_files_empty_section_title" formatted="false">आफ्नो लाइब्रेरीमा आफ्नै अडियो फाइलहरू हाल्नुहोस्</string><string name="local_files_empty_section_subtitle" formatted="false">तपाईंसँग Spotify मा नभएको गीत वा व्यक्तिगत पोडकास्ट छ?</string>@@ -138,14 +132,10 @@<string name="assisted_curation_search_filter_artists" formatted="false">कलाकारहरू</string><string name="assisted_curation_search_filter_albums" formatted="false">एल्बमहरू</string><string name="assisted_curation_search_filter_playlists" formatted="false">प्लेलिस्टहरू</string>- <string name="assisted_curation_search_filter_clear_content_description" formatted="false">फिल्टर हटाउनुहोस्</string>- <string name="ad_category_title_music" formatted="false">सङ्गीत</string>- <string name="made_for_you_hub_title" formatted="false">तपाईंका लागि बनाइएको</string><string name="settings_item_app_language_title" formatted="false">एपको भाषा</string><string name="create_menu_item_folder_title" formatted="false">फोल्डर</string><string name="create_folder_name_suggested_folder_name" formatted="false">नयाँ फोल्डर</string><string name="context_menu_rename_folder" formatted="false">फोल्डरको नाम बदल्नुहोस्</string>- <string name="your_library_messaging_folder_rename_hint" formatted="false">फोल्डरको नाम</string><string name="create_playlist_content_description" formatted="false">प्लेलिस्ट सिर्जना गर्नुहोस्</string><string name="actions_picker_delete" formatted="false">मेटाउनुहोस्</string><string name="filter_and_sort_sort_section_title" formatted="false">यसअनुसार क्रमबद्ध गर्नुहोस्</string>diff --git a/base/app/src/main/res/values-nl/spotify_strings.xml b/base/app/src/main/res/values-nl/spotify_strings.xmlindex a1da475b..be41d3cb 100644--- a/base/app/src/main/res/values-nl/spotify_strings.xml+++ b/base/app/src/main/res/values-nl/spotify_strings.xml@@ -17,7 +17,6 @@<string name="snackbar_added_to_liked_songs" formatted="false">Toegevoegd aan Gelikete nummers.</string><string name="snackbar_removed_from_liked_songs" formatted="false">Verwijderd uit Gelikete nummers.</string><string name="content_description_context_menu" formatted="false">Meer opties</string>- <string name="close_button_content_description" formatted="false">Sluiten</string><string name="add_to_playlist_saved_in_section_header" formatted="false">Opgeslagen in</string><string name="add_to_playlist_new_playlist_button_text" formatted="false">Nieuwe playlist</string><string name="add_to_playlist_button_cancel" formatted="false">Annuleren</string>@@ -25,8 +24,6 @@<string name="lyrics_card_title" formatted="false">Songtekst</string><string name="lyrics_card_title_preview" formatted="false">Voorbeeld van songtekst</string><string name="lyrics_card_show_lyrics_button" formatted="false">Songtekst weergeven</string>- <string name="lyrics_card_expand_button_content_description" formatted="false">Songtekst op volledig scherm openen</string>- <string name="lyrics_card_share_button_content_description" formatted="false">Songteksten delen</string><string name="lyrics_credential_note" formatted="false">Songtekst geleverd door %1$s</string><string name="lyrics_fullscreen_chip_label_share" formatted="false">Delen</string><string name="lyrics_fullscreen_chip_label_translate" formatted="false">Vertalen</string>@@ -49,7 +46,6 @@<string name="artist_popular_tracks" formatted="false">Populair</string><string name="curation_button_follow_state_text" formatted="false">Volgen</string><string name="curation_button_following_state_text" formatted="false">Volgend</string>- <string name="search_main_entity_subtitle_artist" formatted="false">Artiest</string><string name="connect_phone_is_self" formatted="false">Deze telefoon</string><string name="settings_item_canvas_title" formatted="false">Canvas</string><string name="video_settings_canvas_subtitle" formatted="false">Korte, herhalende beelden wanneer een nummer wordt afgespeeld.</string>@@ -107,8 +103,6 @@<string name="library_search_text_hint" formatted="false">Bibliotheek doorzoeken</string><string name="account_title" formatted="false">Account</string><string name="song_dna_search_chip_followed_artists" formatted="false">Gevolgde artiesten</string>- <string name="settings_item_crossfade_title" formatted="false">Crossfade</string>- <string name="playback_settings_crossfade_slider_seconds" formatted="false">%1$d s.</string><string name="local_files_title" formatted="false">Lokale bestanden</string><string name="local_files_empty_section_title" formatted="false">Voeg je eigen audiobestanden toe aan je bibliotheek</string><string name="local_files_empty_section_subtitle" formatted="false">Heb je een nummer of persoonlijke podcast die niet op Spotify staat?</string>@@ -138,14 +132,10 @@<string name="assisted_curation_search_filter_artists" formatted="false">Artiesten</string><string name="assisted_curation_search_filter_albums" formatted="false">Albums</string><string name="assisted_curation_search_filter_playlists" formatted="false">Playlists</string>- <string name="assisted_curation_search_filter_clear_content_description" formatted="false">Filter wissen</string>- <string name="ad_category_title_music" formatted="false">Muziek</string>- <string name="made_for_you_hub_title" formatted="false">Speciaal voor jou.</string><string name="settings_item_app_language_title" formatted="false">Taal van de app</string><string name="create_menu_item_folder_title" formatted="false">Map</string><string name="create_folder_name_suggested_folder_name" formatted="false">Nieuwe map</string><string name="context_menu_rename_folder" formatted="false">Mapnaam wijzigen</string>- <string name="your_library_messaging_folder_rename_hint" formatted="false">Mapnaam</string><string name="create_playlist_content_description" formatted="false">Playlist maken</string><string name="actions_picker_delete" formatted="false">Verwijderen</string><string name="filter_and_sort_sort_section_title" formatted="false">Sorteren op</string>diff --git a/base/app/src/main/res/values-or/spotify_strings.xml b/base/app/src/main/res/values-or/spotify_strings.xmlindex e4bd257b..7956ccda 100644--- a/base/app/src/main/res/values-or/spotify_strings.xml+++ b/base/app/src/main/res/values-or/spotify_strings.xml@@ -17,7 +17,6 @@<string name="snackbar_added_to_liked_songs" formatted="false">ଲାଇକ୍ ହୋଇଥିବା ଗୀତରେ ଯୋଡ଼ା ଯାଇଛି।</string><string name="snackbar_removed_from_liked_songs" formatted="false">ଲାଇକ୍ ହୋଇଥିବା ଗୀତରୁ କାଢ଼ି ଦିଆଯାଇଛି।</string><string name="content_description_context_menu" formatted="false">ଅଧିକ ବିକଳ୍ପ</string>- <string name="close_button_content_description" formatted="false">ବନ୍ଦ କରନ୍ତୁ</string><string name="add_to_playlist_saved_in_section_header" formatted="false">ଏଥିରେ ସେଭ୍ କରାଯାଇଛି</string><string name="add_to_playlist_new_playlist_button_text" formatted="false">ନୂଆ ପ୍ଲେଲିଷ୍ଟ</string><string name="add_to_playlist_button_cancel" formatted="false">ବାତିଲ୍ କରନ୍ତୁ</string>@@ -25,8 +24,6 @@<string name="lyrics_card_title" formatted="false">ଲିରିକ୍ସ</string><string name="lyrics_card_title_preview" formatted="false">ଲିରିକ୍ସର ପ୍ରିଭ୍ୟୁ</string><string name="lyrics_card_show_lyrics_button" formatted="false">ଲିରିକ୍ସ ଦେଖାନ୍ତୁ</string>- <string name="lyrics_card_expand_button_content_description" formatted="false">ପୂର୍ଣ୍ଣ ସ୍କ୍ରିନ୍ ଲିରିକ୍ସ ଖୋଲନ୍ତୁ</string>- <string name="lyrics_card_share_button_content_description" formatted="false">ଲିରିକ୍ ଅଂଶୀଦାର କରନ୍ତୁ</string><string name="lyrics_credential_note" formatted="false">%1$s ଦ୍ୱାରା ପ୍ରଦାନ କରାଯାଇଥିବା ଲିରିକ୍ସ</string><string name="lyrics_fullscreen_chip_label_share" formatted="false">ସେୟାର୍</string><string name="lyrics_fullscreen_chip_label_translate" formatted="false">ଅନୁବାଦ କର</string>@@ -49,7 +46,6 @@<string name="artist_popular_tracks" formatted="false">ଲୋକପ୍ରିୟ</string><string name="curation_button_follow_state_text" formatted="false">ଅନୁସରଣ କରନ୍ତୁ</string><string name="curation_button_following_state_text" formatted="false">ଅନୁସରଣ କରୁଛନ୍ତି</string>- <string name="search_main_entity_subtitle_artist" formatted="false">କଳାକାର</string><string name="connect_phone_is_self" formatted="false">ଏହି ଫୋନ୍</string><string name="settings_item_canvas_title" formatted="false">କାନଭାସ୍</string><string name="video_settings_canvas_subtitle" formatted="false">ଏକ ଗୀତ ଚାଳନ ବେଳେ ଛୋଟ, ଲୁପିଂ ଭିଜୁଆଲ୍ ।</string>@@ -107,8 +103,6 @@<string name="library_search_text_hint" formatted="false">ଆପଣଙ୍କ ଲାଇବ୍ରେରୀ ସନ୍ଧାନ କରନ୍ତୁ</string><string name="account_title" formatted="false">ଆକାଉଣ୍ଟ</string><string name="song_dna_search_chip_followed_artists" formatted="false">ଅନୁସରଣ କରାଯାଇଥିବା କଳାକାର</string>- <string name="settings_item_crossfade_title" formatted="false">କ୍ରସଫେଡ୍</string>- <string name="playback_settings_crossfade_slider_seconds" formatted="false">%1$d ସେ</string><string name="local_files_title" formatted="false">ଲୋକାଲ୍ ଫାଇଲ୍</string><string name="local_files_empty_section_title" formatted="false">ଆପଣଙ୍କ ଲାଇବ୍ରେରୀରେ ଆପଣଙ୍କର ନିଜର ଅଡିଓ ଫାଇଲ୍ ଯୋଗ କରନ୍ତୁ</string><string name="local_files_empty_section_subtitle" formatted="false">Spotifyରେ ନଥିବା ଏକ ଗୀତ କିମ୍ବା ବ୍ୟକ୍ତିଗତ ପୋଡକାଷ୍ଟ ପାଇଛନ୍ତି କି?</string>@@ -138,14 +132,10 @@<string name="assisted_curation_search_filter_artists" formatted="false">କଳାକାରମାନେ</string><string name="assisted_curation_search_filter_albums" formatted="false">ଆଲବମଗୁଡ଼ିକ</string><string name="assisted_curation_search_filter_playlists" formatted="false">ପ୍ଲେଲିଷ୍ଟଗୁଡ଼ିକ</string>- <string name="assisted_curation_search_filter_clear_content_description" formatted="false">ଫିଲ୍ଟର୍ ଖାଲି କରନ୍ତୁ</string>- <string name="ad_category_title_music" formatted="false">ମ୍ୟୁଜିକ୍</string>- <string name="made_for_you_hub_title" formatted="false">ଆପଣଙ୍କ ପାଇଁ ପ୍ରସ୍ତୁତ</string><string name="settings_item_app_language_title" formatted="false">ଆପର ଭାଷା</string><string name="create_menu_item_folder_title" formatted="false">ଫୋଲ୍ଡର୍</string><string name="create_folder_name_suggested_folder_name" formatted="false">ନୂତନ ଫୋଲ୍ଡର୍</string><string name="context_menu_rename_folder" formatted="false">ଫୋଲ୍ଡର୍ ପୁନଃନାମ କରନ୍ତୁ</string>- <string name="your_library_messaging_folder_rename_hint" formatted="false">ଫୋଲ୍ଡର ନାମ</string><string name="create_playlist_content_description" formatted="false">ପ୍ଲେଲିଷ୍ଟ ତିଆରି କରନ୍ତୁ</string><string name="actions_picker_delete" formatted="false">ଡିଲିଟ୍ କରନ୍ତୁ</string><string name="filter_and_sort_sort_section_title" formatted="false">ଦ୍ୱାରା ସର୍ଟ କରନ୍ତୁ</string>diff --git a/base/app/src/main/res/values-pa-rIN/spotify_strings.xml b/base/app/src/main/res/values-pa-rIN/spotify_strings.xmlindex b7d59cdd..a6f81e0d 100644--- a/base/app/src/main/res/values-pa-rIN/spotify_strings.xml+++ b/base/app/src/main/res/values-pa-rIN/spotify_strings.xml@@ -17,7 +17,6 @@<string name="snackbar_added_to_liked_songs" formatted="false">ਪਸੰਦ ਕੀਤੇ ਗਾਣਿਆਂ ਵਿੱਚ ਸ਼ਾਮਲ ਕੀਤਾ ਗਿਆ।</string><string name="snackbar_removed_from_liked_songs" formatted="false">ਪਸੰਦ ਕੀਤੇ ਗਾਣਿਆਂ ਵਿੱਚੋਂ ਹਟਾ ਦਿੱਤਾ ਗਿਆ।</string><string name="content_description_context_menu" formatted="false">ਹੋਰ ਵਿਕਲਪ</string>- <string name="close_button_content_description" formatted="false">ਬੰਦ ਕਰੋ</string><string name="add_to_playlist_saved_in_section_header" formatted="false">ਇਸ ਵਿੱਚ ਸੁਰੱਖਿਅਤ ਕੀਤਾ ਹੋਇਆ ਹੈ</string><string name="add_to_playlist_new_playlist_button_text" formatted="false">ਨਵੀਂ ਪਲੇਲਿਸਟ</string><string name="add_to_playlist_button_cancel" formatted="false">ਰੱਦ ਕਰੋ</string>@@ -25,8 +24,6 @@<string name="lyrics_card_title" formatted="false">ਗਾਣੇ ਦੇ ਬੋਲ</string><string name="lyrics_card_title_preview" formatted="false">ਗਾਣੇ ਦੇ ਬੋਲਾਂ ਦੀ ਪੂਰਵ-ਝਲਕ</string><string name="lyrics_card_show_lyrics_button" formatted="false">ਗਾਣੇ ਦੇ ਬੋਲ ਦਿਖਾਓ</string>- <string name="lyrics_card_expand_button_content_description" formatted="false">ਪੂਰੀ ਸਕ੍ਰੀਨ \'ਤੇ ਗਾਣੇ ਦੇ ਬੋਲ ਖੋਲ੍ਹੋ</string>- <string name="lyrics_card_share_button_content_description" formatted="false">ਬੋਲ ਸਾਂਝੇ ਕਰੋ</string><string name="lyrics_credential_note" formatted="false">ਗਾਣੇ ਦੇ ਬੋਲ %1$s ਨੇ ਪ੍ਰਦਾਨ ਕੀਤੇ ਹਨ</string><string name="lyrics_fullscreen_chip_label_share" formatted="false">ਸਾਂਝਾ ਕਰੋ</string><string name="lyrics_fullscreen_chip_label_translate" formatted="false">ਅਨੁਵਾਦ ਕਰੋ</string>@@ -49,7 +46,6 @@<string name="artist_popular_tracks" formatted="false">ਪ੍ਰਸਿੱਧ</string><string name="curation_button_follow_state_text" formatted="false">ਫਾਲੋ ਕਰੋ</string><string name="curation_button_following_state_text" formatted="false">ਫਾਲੋ ਕੀਤਾ ਜਾ ਰਿਹਾ ਹੈ</string>- <string name="search_main_entity_subtitle_artist" formatted="false">ਕਲਾਕਾਰ</string><string name="connect_phone_is_self" formatted="false">ਇਸ ਫ਼ੋਨ \'ਤੇ</string><string name="settings_item_canvas_title" formatted="false">Canvas</string><string name="video_settings_canvas_subtitle" formatted="false">ਗਾਣਾ ਚੱਲਣ ਦੌਰਾਨ ਛੋਟੇ, ਲੂਪਿੰਗ ਵਿਜ਼ੂਅਲ।</string>@@ -106,8 +102,6 @@<string name="library_search_text_hint" formatted="false">\'ਤੁਹਾਡੀ ਲਾਇਬ੍ਰੇਰੀ\' ਖੋਜੋ</string><string name="account_title" formatted="false">ਖਾਤਾ</string><string name="song_dna_search_chip_followed_artists" formatted="false">ਕਲਾਕਾਰਾਂ ਨੂੰ ਫਾਲੋ ਕੀਤਾ ਗਿਆ</string>- <string name="settings_item_crossfade_title" formatted="false">ਕ੍ਰਾਸਫੇਡ</string>- <string name="playback_settings_crossfade_slider_seconds" formatted="false">%1$d ਸਕਿੰਟ</string><string name="local_files_title" formatted="false">ਸਥਾਨਕ ਫਾਈਲਾਂ</string><string name="local_files_empty_section_title" formatted="false">ਆਪਣੀ ਲਾਇਬ੍ਰੇਰੀ ਵਿੱਚ ਆਪਣੀਆਂ ਖੁਦ ਦੀਆਂ ਆਡੀਓ ਫਾਈਲਾਂ ਸ਼ਾਮਲ ਕਰੋ</string><string name="local_files_empty_section_subtitle" formatted="false">ਕੀ ਤੁਹਾਡੇ ਕੋਲ ਕੋਈ ਅਜਿਹਾ ਗਾਣਾ ਜਾਂ ਨਿੱਜੀ ਪੋਡਕਾਸਟ ਹੈ ਜੋ Spotify \'ਤੇ ਮੌਜੂਦ ਨਹੀਂ ਹੈ?</string>@@ -137,14 +131,10 @@<string name="assisted_curation_search_filter_artists" formatted="false">ਕਲਾਕਾਰ</string><string name="assisted_curation_search_filter_albums" formatted="false">ਐਲਬਮਾਂ</string><string name="assisted_curation_search_filter_playlists" formatted="false">ਪਲੇਲਿਸਟਾਂ</string>- <string name="assisted_curation_search_filter_clear_content_description" formatted="false">ਫਿਲਟਰ ਹਟਾਓ</string>- <string name="ad_category_title_music" formatted="false">ਸੰਗੀਤ</string>- <string name="made_for_you_hub_title" formatted="false">ਤੁਹਾਡੇ ਲਈ ਬਣਾਈ ਪਲੇਲਿਸਟ</string><string name="settings_item_app_language_title" formatted="false">ਐਪ ਦੀ ਭਾਸ਼ਾ</string><string name="create_menu_item_folder_title" formatted="false">ਫੋਲਡਰ</string><string name="create_folder_name_suggested_folder_name" formatted="false">ਨਵਾਂ ਫੋਲਡਰ</string><string name="context_menu_rename_folder" formatted="false">ਫੋਲਡਰ ਦਾ ਨਾਮ ਬਦਲੋ</string>- <string name="your_library_messaging_folder_rename_hint" formatted="false">ਫੋਲਡਰ ਦਾ ਨਾਮ</string><string name="create_playlist_content_description" formatted="false">ਪਲੇਲਿਸਟ ਬਣਾਓ</string><string name="actions_picker_delete" formatted="false">ਮਿਟਾਓ</string><string name="filter_and_sort_sort_section_title" formatted="false">ਇਸ ਅਨੁਸਾਰ ਛਾਂਟੀ ਕਰੋ</string>diff --git a/base/app/src/main/res/values-pa-rPK/spotify_strings.xml b/base/app/src/main/res/values-pa-rPK/spotify_strings.xmlindex a4234ca0..5faba111 100644--- a/base/app/src/main/res/values-pa-rPK/spotify_strings.xml+++ b/base/app/src/main/res/values-pa-rPK/spotify_strings.xml@@ -17,7 +17,6 @@<string name="snackbar_added_to_liked_songs" formatted="false">لائیک کردہ گانیاں وچ شامل ہو گیا۔</string><string name="snackbar_removed_from_liked_songs" formatted="false">لائیک کردہ گانیاں توں ہٹا دتا گیا۔</string><string name="content_description_context_menu" formatted="false">ہور اختیارات</string>- <string name="close_button_content_description" formatted="false">بند کرو</string><string name="add_to_playlist_saved_in_section_header" formatted="false">ایہدے وچ محفوظ کیتا گیا</string><string name="add_to_playlist_new_playlist_button_text" formatted="false">نویں پلے لسٹ</string><string name="add_to_playlist_button_cancel" formatted="false">منسوخ کرو</string>@@ -25,8 +24,6 @@<string name="lyrics_card_title" formatted="false">بول</string><string name="lyrics_card_title_preview" formatted="false">بولاں دا پیش نظارہ</string><string name="lyrics_card_show_lyrics_button" formatted="false">بول وکھاؤ</string>- <string name="lyrics_card_expand_button_content_description" formatted="false">پوری اسکرین اتے بول کھولو</string>- <string name="lyrics_card_share_button_content_description" formatted="false">بول شئیر کرو</string><string name="lyrics_credential_note" formatted="false">%1$s دے دِتے گانیاں دے بول</string><string name="lyrics_fullscreen_chip_label_share" formatted="false">شئیر کرو</string><string name="lyrics_fullscreen_chip_label_translate" formatted="false">ترجمہ کرو</string>@@ -49,7 +46,6 @@<string name="artist_popular_tracks" formatted="false">مقبول</string><string name="curation_button_follow_state_text" formatted="false">فالو کرو</string><string name="curation_button_following_state_text" formatted="false">فالو کر رئیے او</string>- <string name="search_main_entity_subtitle_artist" formatted="false">آرٹسٹ</string><string name="connect_phone_is_self" formatted="false">ایہہ فون</string><string name="settings_item_canvas_title" formatted="false">Canvas</string><string name="video_settings_canvas_subtitle" formatted="false">جدوں کوئی گانا چل رہیا ہوندا اے تے مختصر، لوپنگ بصریات۔</string>@@ -106,8 +102,6 @@<string name="library_search_text_hint" formatted="false">اپنی لائبریری تلاش کرو</string><string name="account_title" formatted="false">اکاؤنٹ</string><string name="song_dna_search_chip_followed_artists" formatted="false">فالو کیتے ہوئے آرٹسٹ</string>- <string name="settings_item_crossfade_title" formatted="false">کراس فیڈ</string>- <string name="playback_settings_crossfade_slider_seconds" formatted="false">%1$d s</string><string name="local_files_title" formatted="false">مقامی فائلاں</string><string name="local_files_empty_section_title" formatted="false">آپنی ذاتی آڈیو فائلاں آپنی لائبریری وچ شامل کرو</string><string name="local_files_empty_section_subtitle" formatted="false">اک ایہوجیہا گانا یا ذاتی پوڈکاسٹ ملی اے جیہڑی Spotify تے نہیں اے؟</string>@@ -137,14 +131,10 @@<string name="assisted_curation_search_filter_artists" formatted="false">آرٹسٹس</string><string name="assisted_curation_search_filter_albums" formatted="false">البمز</string><string name="assisted_curation_search_filter_playlists" formatted="false">پلے لسٹس</string>- <string name="assisted_curation_search_filter_clear_content_description" formatted="false">فلٹر ہٹاؤ</string>- <string name="ad_category_title_music" formatted="false">موسیقی</string>- <string name="made_for_you_hub_title" formatted="false">تہاڈے لئی بنیا</string><string name="settings_item_app_language_title" formatted="false">ایپ دی زبان</string><string name="create_menu_item_folder_title" formatted="false">فولڈر</string><string name="create_folder_name_suggested_folder_name" formatted="false">نواں فولڈر</string><string name="context_menu_rename_folder" formatted="false">فولڈر دا ناں بدلو</string>- <string name="your_library_messaging_folder_rename_hint" formatted="false">فولڈر ناں</string><string name="create_playlist_content_description" formatted="false">پلے لسٹ بناؤ</string><string name="actions_picker_delete" formatted="false">ڈیلیٹ کرو</string><string name="filter_and_sort_sort_section_title" formatted="false">ترتیب دو بلحاظ</string>diff --git a/base/app/src/main/res/values-pl/extensions_strings.xml b/base/app/src/main/res/values-pl/extensions_strings.xmlnew file mode 100644index 00000000..71dc8466--- /dev/null+++ b/base/app/src/main/res/values-pl/extensions_strings.xml@@ -0,0 +1,211 @@+<?xml version="1.0" encoding="utf-8"?>+<resources>+ <string name="extensions_title">Rozszerzenia</string>+ <string name="extensions_row_detail">Teksty piosenek, źródło dźwięku utworu i skrypty napisane przez innych, w piaskownicy.</string>+ <string name="extensions_install_file">Zainstaluj z pliku</string>+ <string name="extensions_install_url">Zainstaluj z adresu</string>+ <string name="extensions_url_hint">https://…/extension.zip</string>+ <string name="extensions_none">Brak zainstalowanych rozszerzeń.</string>+ <string name="extensions_installed">Zainstalowane</string>+ <string name="extensions_repository_add">Dodaj repozytorium</string>+ <string name="extensions_repository_hint">https://…/index.json</string>+ <string name="extensions_repository_warning">Myspoti nie sprawdza dodanego przez Ciebie repozytorium: to, co z niego zainstalujesz, robisz na własne ryzyko.</string>+ <string name="extensions_repository_remove">Usuń</string>+ <string name="extensions_repository_refresh">Odśwież</string>+ <string name="extensions_install">Zainstaluj</string>+ <string name="extensions_update">Zaktualizuj</string>+ <string name="extensions_up_to_date">Zainstalowane</string>+ <string name="extensions_cancel">Anuluj</string>+ <string name="extensions_loading">Wczytywanie…</string>+ <string name="extensions_error">Nie zainstalowano: %1$s</string>+ <string name="extensions_prompt_title_install">Zainstalować %1$s?</string>+ <string name="extensions_prompt_title_update">Zaktualizować %1$s?</string>+ <string name="extensions_prompt_by">%1$s · wersja %2$s · %3$s</string>+ <string name="extensions_prompt_source">Z %1$s</string>+ <string name="extensions_prompt_source_file">plik na tym telefonie</string>+ <string name="extensions_prompt_new">nowość w tej wersji</string>+ <string name="extensions_prompt_update_same_rights">%1$s → %2$s, z tymi samymi uprawnieniami.</string>+ <string name="extensions_prompt_not_newer">Wersja %1$s (lub nowsza) jest już zainstalowana.</string>+ <string name="extensions_prompt_sha">sha256 paczki: %1$s</string>+ <string name="extension_enabled">Włączone</string>+ <string name="extension_running">Działa</string>+ <string name="extension_not_running">Nie działa</string>+ <string name="extension_turned_off">%1$s wyłączone: %2$s</string>+ <string name="extension_last_error">Ostatni błąd: %1$s</string>+ <string name="extension_disabled_reason">Wyłączone: %1$s</string>+ <string name="extension_inactive">Nieaktywne</string>+ <string name="extension_inactive_detail">Nieaktywne: %1$s</string>+ <string name="extension_homepage">Strona internetowa</string>+ <string name="extension_settings">Ustawienia</string>+ <string name="extension_log">Dziennik</string>+ <string name="extension_log_empty">Nic jeszcze nie zapisano.</string>+ <string name="extension_log_clear">Wyczyść dziennik</string>+ <string name="extension_update_file">Zaktualizuj z pliku</string>+ <string name="extension_uninstall">Odinstaluj</string>+ <string name="extension_uninstall_confirm">Odinstalować %1$s? Jego ustawienia i zapisane dane znikną razem z nim.</string>+ <string name="extension_confirm_title">Rozszerzenie pyta</string>+ <string name="extension_confirm_detail">Nic się nie zmieni, jeśli na to nie pozwolisz.</string>+ <string name="extension_confirm_allow">Zezwól</string>+ <string name="extension_confirm_refuse">Odmów</string>+ <string name="extensions_row_count">Zainstalowane: %1$d, włączone: %2$d</string>+ <string name="extensions_tab_store">Sklep</string>+ <string name="extensions_search">Szukaj rozszerzeń</string>+ <string name="extensions_cat_all">Wszystkie</string>+ <string name="extensions_cat_lyrics">Teksty</string>+ <string name="extensions_cat_playback">Odtwarzanie i dźwięk</string>+ <string name="extensions_cat_library">Biblioteka</string>+ <string name="extensions_cat_discovery">Odkrywanie</string>+ <string name="extensions_cat_stats">Statystyki</string>+ <string name="extensions_cat_look">Wygląd</string>+ <string name="extensions_cat_social">Społeczność</string>+ <string name="extensions_cat_tools">Narzędzia</string>+ <string name="extensions_cat_other">Inne</string>+ <string name="extensions_no_match">Żadne rozszerzenie nie pasuje.</string>+ <string name="extensions_browse_store">Przeglądaj sklep</string>+ <string name="extensions_other_ways">Inne sposoby instalacji</string>+ <string name="extensions_empty_title">Czym są rozszerzenia?</string>+ <string name="extensions_empty_body">Rozszerzenia dodają do Myspoti to, czego aplikacja sama nie robi: teksty z innych źródeł, skąd pochodzi dźwięk lub plik do pobrania danego utworu, narzędzia korzystające z Twojego konta Spotify. Każde działa w piaskownicy i pyta, zanim do czegokolwiek sięgnie. Dodaj repozytorium, aby je przeglądać, albo zainstaluj paczkę, której ufasz.</string>+ <string name="extensions_official_badge">Oficjalne</string>+ <string name="extensions_repo_yours">Dodane przez Ciebie</string>+ <string name="extensions_repo_community">Społeczność</string>+ <string name="extensions_repo_official_note">Każde rozszerzenie jest sprawdzane, zanim trafi na listę.</string>+ <string name="extensions_repo_yours_note">Niesprawdzone przez Myspoti: instaluj na własne ryzyko.</string>+ <string name="extensions_repo_error">Nie udało się odczytać tego repozytorium: %1$s</string>+ <string name="extensions_repo_empty">To repozytorium nie zawiera żadnego rozszerzenia.</string>+ <string name="extensions_requires">Wymaga Myspoti %1$s lub nowszego</string>+ <string name="extensions_requires_api">Stworzone dla nowszego Myspoti (API rozszerzeń %1$d)</string>+ <string name="extensions_update_badge">Aktualizacja</string>+ <string name="extensions_move_up">Przesuń w górę</string>+ <string name="extensions_move_down">Przesuń w dół</string>+ <string name="extension_off">Wyłączone</string>+ <string name="extension_by">autor: %1$s</string>+ <string name="extension_changelog">Co nowego</string>+ <string name="extension_update_from">Dostępna aktualizacja: %1$s → %2$s</string>+ <string name="extension_not_listed">Tego rozszerzenia nie ma w Twoich repozytoriach (albo jeszcze się wczytują).</string>+ <string name="extension_details">Szczegóły</string>+ <string name="extension_detail_updated">Zaktualizowano</string>+ <string name="extension_detail_min_app">Wymaga Myspoti</string>+ <string name="extension_detail_size">Rozmiar</string>+ <string name="extension_detail_id">Id</string>+ <string name="extension_detail_sha">sha256 paczki</string>+ <string name="extension_detail_source">Zainstalowano z</string>+ <string name="extension_see_in_store">Zobacz w sklepie</string>++ <!-- Actions: the closed catalogue, as the user reads it -->+ <string name="action_playback_control">Sterować odtwarzaniem</string>+ <string name="action_playback_queue">Edytować kolejkę</string>+ <string name="action_playback_events">Wiedzieć, czego słuchasz</string>+ <string name="action_lyrics_provide">Dostarczać teksty</string>+ <string name="action_trackinfo_provide">Dodawać szczegóły utworów</string>+ <string name="action_audio_source">Odtwarzać dźwięk z innego źródła</string>+ <string name="action_download_source">Dostarczać pliki do pobrania</string>+ <string name="action_home_sections">Dodawać sekcje na stronie głównej</string>+ <string name="action_search_provide">Dodawać wyniki wyszukiwania</string>+ <string name="action_menu_items">Dodawać pozycje do menu</string>+ <string name="action_player_buttons">Dodawać przyciski odtwarzacza</string>+ <string name="action_settings_page">Własne ustawienia</string>+ <string name="action_notify">Pokazywać krótkie komunikaty</string>+ <string name="action_library_read">Czytać Twoją bibliotekę</string>+ <string name="action_library_write">Zmieniać Twoją bibliotekę</string>+ <string name="action_playlists_write">Edytować Twoje playlisty</string>+ <string name="action_spotify_catalog">Przeglądać Spotify</string>+ <string name="action_spotify_raw">Pełny dostęp do Spotify</string>+ <string name="action_network">Korzystać z internetu</string>+ <string name="action_network_any">Korzystać z dowolnej strony</string>+ <string name="action_webview_page">Własna strona internetowa</string>+ <string name="action_storage">Przechowywać własne dane</string>+ <string name="action_unknown">Nieznane temu Myspoti</string>+ <string name="action_critical">Krytyczne</string>+ <string name="action_no_why">(nie podano powodu)</string>+ <string name="actions_title">Co robi</string>+ <string name="actions_critical_warning">Działania krytyczne mogą zmieniać Twoje konto, zastępować źródło utworów lub pokazywać dowolną stronę internetową. Zezwól na nie tylko wtedy, gdy ufasz autorowi: Myspoti i tak zapyta, zanim cokolwiek zostanie usunięte.</string>+ <!-- Areas of the Installed tab -->+ <string name="area_playback">Odtwarzanie</string>+ <string name="area_lyrics">Teksty i informacje o utworach</string>+ <string name="area_audio">Dźwięk i pobieranie</string>+ <string name="area_home">Strona główna i wyszukiwanie</string>+ <string name="area_menus">Menu i odtwarzacz</string>+ <string name="area_library">Biblioteka i Spotify</string>+ <string name="area_other">Strony i inne</string>+ <string name="area_activity">Ostatnia aktywność</string>+ <string name="area_turn_off">Wyłącz</string>+ <string name="area_active">Aktywne</string>+ <string name="area_idle">Bezczynne</string>+ <string name="area_make_active">Ustaw jako główne dla: %1$s</string>+ <!-- Install prompt -->+ <string name="ext_third_party_notice">Rozszerzenie innej firmy lub osoby, niesprawdzone przez Myspoti, na odpowiedzialność autora.</string>+ <string name="ext_risk_accept">Rozumiem, że to rozszerzenie pochodzi od strony trzeciej, i instaluję je na własną odpowiedzialność</string>+ <string name="ext_clash_exclusive">Zastępuje %1$s, które obecnie zapewnia %2$s</string>+ <string name="ext_clash_conflict">Niezgodne z %1$s (zainstalowanym)</string>+ <string name="ext_clash_replaces">Zastępuje %1$s (zainstalowane)</string>+ <string name="ext_clash_keep_new">Użyj %1$s (drugie zostaje zainstalowane, %2$s)</string>+ <string name="ext_clash_keep_old">Zostaw %1$s</string>+ <string name="ext_clash_idle">bezczynne</string>+ <string name="ext_clash_off">wyłączone</string>+ <string name="ext_clash_title">Które zostawić?</string>+ <string name="ext_clash_ok">Gotowe</string>+ <!-- Blocks and pages -->+ <string name="ext_from">Od %1$s</string>+ <string name="ext_overflow">Rozszerzenia</string>+ <string name="ext_open_page">Otwórz jego stronę</string>+ <string name="ext_page_failed">Nie udało się pokazać strony tego rozszerzenia.</string>+ <string name="ext_suspended_title">%1$s wstrzymane</string>+ <string name="ext_suspended_body">Ciągle cofało to, co %1$s robiło z odtwarzaniem: jego polecenia odtwarzania są zawieszone.</string>+ <string name="ext_suspended_keep">Pozwól działać dalej</string>++ <!-- GitHub: discovery, ratings, reports -->+ <string name="extensions_github_title">Na GitHubie</string>+ <string name="extensions_github_note">Publiczne repozytoria z tematem myspoti-extension, niesprawdzone: każde jest na odpowiedzialność swojego autora.</string>+ <string name="extensions_show_all">Pokaż wszystkie (ukryte: %1$d)</string>+ <string name="extensions_show_less">Ukryj zablokowane, zgłoszone, nisko oceniane i porzucone</string>+ <string name="extension_rating">★ %1$s · głosy: %2$d</string>+ <string name="extension_rating_none">Brak głosów</string>+ <string name="extension_downloads">Pobrania: %1$s</string>+ <string name="extension_rate_up">Oceń dobrze</string>+ <string name="extension_rate_down">Oceń źle</string>+ <string name="extension_rated">Dzięki: Twój głos jest na GitHubie</string>+ <string name="extension_signin_title">Zaloguj się do GitHuba</string>+ <string name="extension_signin_body">Otwórz %1$s i wpisz ten kod. Myspoti nigdy nie widzi Twojego hasła.</string>+ <string name="extension_signin_open">Otwórz GitHuba</string>+ <string name="extension_report">Zgłoś</string>+ <string name="extension_detail_github">GitHub</string>+ <string name="extension_detail_ref">Wersja na GitHubie</string>++ <!-- Updates from GitHub -->+ <string name="extension_check_updates">Sprawdź aktualizacje</string>+ <string name="extension_check_up_to_date">Aktualne</string>+ <string name="extension_check_applied">Zaktualizowano: nie prosi o nic nowego</string>+ <string name="extension_check_needs_ok">Aktualizacja wymaga Twojej zgody</string>+ <string name="extension_check_declined">Zostawiono tę wersję</string>+ <string name="extension_check_incompatible">Nowa wersja wymaga nowszego Myspoti</string>+ <string name="extension_check_blocked">Nowa wersja jest zablokowana przez Myspoti</string>+ <string name="extension_check_failed">Nie udało się sprawdzić: zobacz dziennik</string>+ <string name="extension_source_gone">Źródło zniknęło: jego repozytorium już nie istnieje. Rozszerzenie nadal działa z kopii na Twoim telefonie.</string>+ <string name="extension_revert">Wróć do %1$s</string>+ <string name="extension_reverted">Wrócono do %1$s</string>+ <string name="extension_update_needs_ok">Aktualizacja wymaga Twojej zgody: %1$s → %2$s</string>+ <string name="extension_update_needs_ok_body">Ta wersja prosi o więcej, niż zaakceptowano. Obecna działa dalej, dopóki nie zdecydujesz.</string>+ <string name="extension_update_accept">Zaakceptuj</string>+ <string name="extension_update_keep">Zostaw obecną</string>+ <string name="extension_refused_title">Czeka na Twoją zgodę</string>+ <string name="extension_refused_body">Zainstalowano je, gdy można było odznaczać działania, i część odznaczono. Rozszerzenie dostaje teraz wszystkie działania, które deklaruje: pozostaje wyłączone, dopóki ich nie zaakceptujesz.</string>+ <string name="extension_change_action">Nowe: %1$s</string>+ <string name="extension_change_host">Nowa strona: %1$s</string>+ <string name="extension_change_any_host">Dowolna strona</string>+ <string name="extension_change_exclusive">Teraz na wyłączność: %1$s</string>+ <string name="extension_change_why">Nowy powód dla: %1$s</string>+ <string name="extension_change_was">Było: „%1$s”</string>+ <string name="extension_change_repo">Teraz pochodzi z %1$s (było %2$s)</string>+ <string name="extension_change_author">Nowy autor: %1$s (był %2$s)</string>+ <string name="extension_change_replaces">Wyłącza %1$s po zainstalowaniu</string>+ <string name="extension_change_conflicts">Odmawia działania razem z %1$s</string>+ <string name="action_webview_auth">Zaloguj się na stronie internetowej</string>+ <string name="extension_confirm_once">Zezwól jednorazowo</string>+ <string name="extension_confirm_always">Zawsze zezwalaj na %1$s</string>+ <string name="ext_auth_title">%1$s: logowanie</string>+ <string name="ext_auth_close">Zamknij</string>+ <string name="ext_auth_notice">Własna strona: to, co wpiszesz, i jej pliki cookie zostają w Myspoti. Rozszerzenie dostaje tylko końcowy adres strony.</string>+ <string name="ext_grants_title">Zawsze dozwolone</string>+ <string name="ext_grants_note">Zmiany w Spotify, które to rozszerzenie wykonuje bez pytania. Cofnij jedną, by znów być pytanym.</string>+ <string name="ext_grant_revoke">Cofnij</string>+</resources>diff --git a/base/app/src/main/res/values-pl/myspoti_strings.xml b/base/app/src/main/res/values-pl/myspoti_strings.xmlnew file mode 100644index 00000000..5d02e5b7--- /dev/null+++ b/base/app/src/main/res/values-pl/myspoti_strings.xml@@ -0,0 +1,465 @@+<?xml version="1.0" encoding="utf-8"?>+<!-- Myspoti's own texts (English default, French, Italian). -->+<resources>+ <string name="welcome_lead">Twoja muzyka,</string>+ <string name="welcome_rotate_ads">bez reklam.</string>+ <string name="welcome_rotate_lyrics">z tekstami słowo po słowie.</string>+ <string name="welcome_rotate_clips">z oficjalnymi teledyskami.</string>+ <string name="welcome_rotate_offline">offline, dzięki rozszerzeniom.</string>+ <string name="welcome_login">Zaloguj się przez Spotify</string>+ <string name="welcome_privacy">Logujesz się na stronie samego Spotify. Myspoti nigdy nie widzi Twojego hasła.</string>+ <string name="remove_from_liked">Usuń z polubionych utworów</string>+ <string name="repeat_on">Powtarzanie: włączone</string>+ <string name="repeat_one">Powtarzaj jeden utwór</string>+ <string name="repeat_off">Powtarzanie: wyłączone</string>+ <string name="headphones">Słuchawki</string>+ <string name="listen_on">Słuchaj na</string>+ <string name="no_devices">Nie znaleziono urządzeń</string>+ <string name="sleep_minutes">%1$d min</string>+ <string name="playing_on">Odtwarzanie na:</string>+ <string name="next_in_queue">Następny w kolejce</string>+ <string name="next_from">Dalej z: %1$s</string>+ <string name="next_up">Następne</string>+ <string name="clear_queue">Wyczyść kolejkę</string>+ <string name="my_playlist">Moja playlista</string>+ <string name="playlist_name">Nazwa playlisty</string>+ <string name="loading_playlists">Wczytywanie playlist…</string>+ <string name="couldnt_load">Nie udało się wczytać: %1$s</string>+ <string name="nothing_here">Na razie nic tu nie ma</string>+ <string name="album_not_found">Nie znaleziono albumu</string>+ <string name="liked_song">Polubiony utwór</string>+ <string name="verified_artist">Zweryfikowany wykonawca</string>+ <string name="lyrics_share">Udostępnij tekst</string>+ <string name="lyrics_extra_title">Więcej źródeł tekstów</string>+ <string name="lyrics_extra_summary">NetEase i Genius, gdy Spotify nie ma tekstu</string>+ <string name="lyrics_reload">Wczytaj tekst ponownie</string>+ <string name="lyrics_fullscreen">Otwórz tekst na pełnym ekranie</string>+ <string name="browse_all">Przeglądaj wszystko</string>+ <string name="home_error">Nie udało się wczytać strony głównej.\nSprawdź połączenie i spróbuj ponownie.</string>+ <string name="home_retry">Spróbuj ponownie</string>+ <string name="home_empty">Na razie nie ma nic do pokazania.</string>+ <string name="spotify_account">Konto Spotify</string>+ <string name="spotify_user">Użytkownik Spotify</string>+ <string name="list_view">Pokaż jako listę</string>+ <string name="grid_view">Pokaż jako siatkę</string>+ <string name="library_error">Nie udało się wczytać Twojej biblioteki</string>+ <string name="library_empty">Twoja biblioteka jest pusta</string>+ <string name="background_playback_title">Odtwarzanie w tle</string>+ <string name="background_playback_on">Optymalizacja baterii jest wyłączona: muzyka i Spotify Connect grają dalej przy wyłączonym ekranie.</string>+ <string name="background_playback_off">Wyłącz optymalizację baterii, aby Android nie wstrzymywał aplikacji w tle.</string>+ <plurals name="local_files_count">+ <item quantity="one">%d utwór</item>+ <item quantity="few">%d utwory</item>+ <item quantity="many">%d utworów</item>+ <item quantity="other">%d utworu</item>+ </plurals>+ <string name="local_files_none_subtitle">Nie znaleźliśmy na tym urządzeniu żadnych odtwarzalnych plików audio. Gdy się pojawią, zobaczysz je tutaj.</string>+ <string name="downloads_empty_title">Pobieraj, by słuchać offline</string>+ <string name="downloads_empty_subtitle">Kliknij Pobierz w menu utworu albo przycisk pobierania albumu lub playlisty.</string>+ <string name="downloads_source">Bezstratny FLAC, sprawdzony z oryginalnym nagraniem. Zapisany tylko w Myspoti.</string>+ <string name="downloads_size">%1$s na tym telefonie</string>+ <string name="download_unavailable">Nie znaleziono pasującego nagrania</string>+ <string name="download_retry">Spróbuj ponownie</string>+ <string name="download_cancel">Anuluj pobieranie</string>+ <string name="podcast_download_protected">Ten odcinek jest wyłącznie dla Spotify: można go odtwarzać tylko w aplikacji Spotify, nie można go pobrać.</string>+ <string name="podcast_download_unavailable">Tego odcinka nie można pobrać: brakuje pliku audio od wydawcy.</string>+ <string name="podcast_download_failed">Pobieranie nie powiodło się. Spróbuj ponownie.</string>+ <string name="not_signed_in">Wylogowano Cię ze Spotify. Zaloguj się ponownie, aby to zobaczyć.</string>+ <string name="artist_not_found">Nie znaleziono wykonawcy</string>+ <string name="playlist_not_found">Nie znaleziono playlisty</string>+ <string name="browse_new_releases">Nowe wydania</string>+ <string name="language_auto">Automatyczny</string>+ <string name="language_auto_detail">Język Twojego telefonu, jeśli Myspoti go ma (angielski, chiński, francuski, grecki, hiszpański, niemiecki, polski, portugalski, rosyjski, włoski), w przeciwnym razie angielski</string>+ <string name="language_partial_note">Pozostałe języki: przetłumaczone są tylko etykiety samego Spotify, teksty Myspoti pozostają po angielsku.</string>+ <string name="restart_player_title">Uruchom odtwarzacz ponownie</string>+ <string name="restart_player_detail">Gdy muzyka przestaje reagować: wczytuje odtwarzacz Spotify od nowa</string>+ <string name="ad_playing">Reklama</string>+ <string name="track_unavailable_region">Niedostępne w Twoim regionie</string>+ <string name="diagnostic_export_title">Eksportuj raport diagnostyczny</string>+ <string name="diagnostic_export_detail">Udostępnia ostatni dziennik aplikacji i dane urządzenia</string>+ <string name="diagnostic_export_failed">Nie udało się zapisać raportu diagnostycznego</string>+ <string name="local_playlist_subtitle">Na tym urządzeniu</string>+ <string name="local_playlist_new">Playlista na tym urządzeniu</string>+ <string name="local_added_section">Dodane na tym urządzeniu</string>+ <string name="local_add_note">Pliki z telefonu zostają na telefonie: Spotify nie może ich otrzymać.</string>+ <string name="local_rename">Zmień nazwę</string>+ <string name="local_delete_playlist">Usuń playlistę</string>+ <string name="local_added_to">Dodano do: %1$s</string>+ <string name="local_playlist_empty">Dodawaj utwory z plików lokalnych przyciskiem +.</string>+ <string name="playlist_change_refused">Spotify odrzuciło zmianę w tej playliście</string>+ <string name="download_kept_by_list">Nadal pobrane: trzyma je pobrana playlista</string>+ <string name="support_title">Wesprzyj Myspoti</string>+ <string name="support_body">Myspoti jest darmowe, bez reklam i powstaje w moim wolnym czasie. Jeśli Ci się podoba, niewielka darowizna pomoże je rozwijać.</string>+ <string name="support_action">Wesprzyj na Ko-fi</string>+ <string name="support_decline">Nie, dziękuję</string>+ <string name="support_row_detail">Niewielka darowizna na Ko-fi lub GitHub Sponsors pomaga rozwijać aplikację</string>+ <string name="supporter_perks_title">Bonusy dla wspierających</string>+ <string name="supporter_perks_detail">Kolor akcentu, ikona aplikacji i odznaka, w ramach podziękowania</string>+ <string name="supporter_perks_locked">Odblokowywane przez wsparcie Myspoti. Na słowo honoru: nic nie jest sprawdzane.</string>+ <string name="supporter_i_supported">Wsparłem(-am) Myspoti</string>+ <string name="supporter_how">Jak wsparłeś(-aś)?</string>+ <string name="supporter_once">Darowizna</string>+ <string name="supporter_monthly">Co miesiąc</string>+ <string name="supporter_badge">Wspierający</string>+ <string name="supporter_thanks_title">Dziękujemy za wsparcie!</string>+ <string name="supporter_thanks_body">Jeśli Myspoti nadal Ci służy, kolejna niewielka darowizna pomoże je rozwijać.</string>+ <string name="support_again">Wesprzyj ponownie</string>+ <string name="supporter_accent">Kolor akcentu</string>+ <string name="supporter_icon">Ikona aplikacji</string>+ <string name="supporter_icon_note">Po zmianie ikony jej skrót na ekranie głównym może zniknąć: aplikacja zostanie na liście aplikacji.</string>+ <string name="supporter_monthly_switch">Wspieram co miesiąc (bez przypomnień)</string>+ <string name="color_green">Zielony</string>+ <string name="color_blue">Niebieski</string>+ <string name="color_purple">Fioletowy</string>+ <string name="color_pink">Różowy</string>+ <string name="color_orange">Pomarańczowy</string>+ <string name="about_detail">Wersja, społeczność na Discordzie, kod źródłowy</string>+ <string name="about_discord">Discord</string>+ <string name="about_discord_detail">Nowości, pomoc i pomysły: dołącz do społeczności</string>+ <string name="about_github">Kod źródłowy</string>+ <string name="about_github_detail">Wydania, zgłoszenia i kod na GitHubie</string>+ <string name="about_free">Darmowa, otwartoźródłowa i bez reklam. Niezwiązana ze Spotify.</string>+ <string name="library_reorder_hint">Przytrzymaj playlistę, a potem przeciągnij, aby ją przenieść</string>+ <string name="library_reorder_reset">Wróć do kolejności Spotify</string>+ <string name="song_radio_failed">Nie udało się otworzyć radia tego utworu</string>+ <string name="song_radio_name">Radio: %1$s</string>+ <string name="local_files_find_hint">Szukaj w plikach lokalnych</string>+ <string name="data_saver_title">Oszczędzanie danych</string>+ <string name="data_saver_summary">Przy danych komórkowych Myspoti nie zużywa danych: grają tylko pobrane utwory i pliki lokalne</string>+ <string name="data_saver_blocked">Oszczędzanie danych: przy danych komórkowych grają tylko pobrane utwory i pliki lokalne</string>+ <string name="new_releases_followed">Od obserwowanych wykonawców</string>+ <string name="new_releases_latest">Najnowsze wydania</string>+ <string name="your_episodes_title">Twoje odcinki</string>+ <string name="your_episodes_empty">Zapisane odcinki pojawią się tutaj.</string>+ <string name="recap_title">Twoje podsumowanie</string>+ <string name="recap_month">30 dni</string>+ <string name="recap_year">12 miesięcy</string>+ <string name="recap_all">Cały czas</string>+ <string name="recap_minutes">%1$d min</string>+ <string name="recap_listens">Odsłuchań: %1$d</string>+ <string name="recap_sources">Spotify %1$d min • Pobrane %2$d min • Pliki lokalne %3$d min</string>+ <string name="recap_empty">Posłuchaj trochę: tutaj pojawią się Twoje ulubione utwory i wykonawcy.</string>+ <string name="recently_played_empty">To, co odtwarzasz na tym koncie, pojawi się tutaj.</string>+ <string name="recently_played_failed">Nie udało się wczytać listy ostatnio odtwarzanych (%1$s)</string>+ <string name="recents_title">Ostatnie</string>+ <string name="recents_detail">To, co odtwarzałeś(-aś), na wszystkich urządzeniach</string>+ <string name="recents_filter_music">Muzyka</string>+ <string name="recents_filter_podcasts">Podcasty</string>+ <string name="recents_today">Dziś</string>+ <string name="recents_yesterday">Wczoraj</string>+ <string name="recents_played_one">Odtworzono 1 utwór</string>+ <string name="recents_played_many">Odtworzone utwory: %1$d</string>+ <string name="recents_saved_one">Dodano 1 utwór</string>+ <string name="recents_saved_many">Dodane utwory: %1$d</string>+ <string name="recents_expand">Pokaż utwory</string>+ <string name="recents_collapse">Ukryj utwory</string>+ <string name="recap_plays">Odtworzeń: %1$d</string>+ <string name="recap_top_tracks">Najczęściej słuchane utwory</string>+ <string name="recap_top_artists">Najczęściej słuchani wykonawcy</string>+ <string name="recap_top_albums">Najczęściej słuchane albumy</string>+ <string name="recap_private_note">Liczy wszystko, co odtworzono w Myspoti (Spotify, pobrane, pliki lokalne). Zostaje na tym telefonie i nigdy nie jest wysyłane do Spotify.</string>+ <string name="recap_detail">Twoje słuchanie, wraz z pobranymi i plikami lokalnymi</string>+ <string name="track_credits">Autorzy</string>+ <string name="exclude_taste">Wyklucz z profilu muzycznego</string>+ <string name="include_taste">Uwzględnij w profilu muzycznym</string>+ <string name="playback_speed">Szybkość odtwarzania</string>+ <string name="recommended_songs">Polecane utwory</string>+ <string name="jam_title">Jam</string>+ <string name="jam_leave">Opuść Jam</string>+ <string name="jam_members">Słucha osób: %1$d</string>+ <string name="jam_start">Rozpocznij Jam</string>+ <string name="jam_invite">Udostępnij link z zaproszeniem</string>+ <string name="jam_failed">Spotify odrzuciło ten Jam</string>+ <string name="jam_scan">Zeskanuj kod QR Jam</string>+ <string name="beta_logs_title">Dziennik z ostatnich %1$d min</string>+ <string name="beta_logs_copy">Kopiuj</string>+ <string name="beta_logs_copied">Dziennik skopiowany</string>+ <string name="beta_logs_share">Udostępnij</string>+ <string name="beta_logs_close">Zamknij</string>+ <string name="widget_description">Teraz odtwarzane, z przyciskami odtwarzania i pomijania</string>+ <string name="widget_previous">Poprzedni</string>+ <string name="widget_next">Następny</string>+ <string name="widget_play_pause">Odtwórz lub wstrzymaj</string>+ <string name="offline_only_downloaded">Offline: grają tylko pobrane utwory (%1$d z %2$d)</string>+ <string name="track_sort_title">Tytuł</string>+ <string name="track_sort_artist">Wykonawca</string>+ <string name="track_sort_album">Album</string>+ <string name="track_sort_duration">Czas trwania</string>+ <string name="setup_title">Konfiguracja Myspoti</string>+ <string name="setup_subtitle">Zezwól na to, co chcesz; możesz to zmienić później w ustawieniach telefonu.</string>+ <string name="setup_notifications_title">Powiadomienia</string>+ <string name="setup_notifications_detail">Sterowanie na ekranie blokady i w panelu powiadomień</string>+ <string name="setup_local_title">Muzyka lokalna</string>+ <string name="setup_local_detail">Odtwarzaj pliki muzyczne zapisane na telefonie</string>+ <string name="setup_bluetooth_title">Bluetooth</string>+ <string name="setup_bluetooth_detail">Pokaż w odtwarzaczu nazwę Twoich słuchawek lub głośnika</string>+ <string name="setup_battery_title">Bateria bez ograniczeń</string>+ <string name="setup_battery_detail">Muzyka gra dalej przy wyłączonym ekranie</string>+ <string name="setup_enable">Zezwól</string>+ <string name="setup_continue">Dalej</string>+ <string name="local_folders_button">Foldery</string>+ <string name="local_folders_title">Foldery</string>+ <string name="local_folders_detail">Wybierz foldery pokazywane w plikach lokalnych. Komunikatory i nagrania są domyślnie ukryte.</string>+ <string name="smart_shuffle_title">Inteligentne mieszanie</string>+ <string name="smart_shuffle_on">Inteligentne mieszanie: rekomendacje Spotify dołączają do wymieszanej playlisty.</string>+ <string name="track_sort_added">Data dodania</string>+ <string name="settings_title">Ustawienia</string>+ <string name="settings_detail">Jakość dźwięku, pobieranie, dane, bateria i język</string>+ <string name="settings_section_playback">Odtwarzanie</string>+ <string name="settings_section_downloads">Pobieranie</string>+ <string name="settings_section_data">Dane i bateria</string>+ <string name="settings_section_display">Wyświetlanie i język</string>+ <string name="settings_section_app">Aplikacja</string>+ <string name="quality_streaming_title">Jakość strumieniowania</string>+ <string name="quality_streaming_detail">To, co odtwarzacz pobiera przez sieć.</string>+ <string name="quality_streaming_auto">Automatyczna</string>+ <string name="quality_streaming_auto_detail">Dostosowuje się do Twojego połączenia</string>+ <string name="quality_streaming_low">Najniższa</string>+ <string name="quality_streaming_low_detail">24 kbit/s, najniższa możliwa: zużywa najmniej danych</string>+ <string name="quality_streaming_normal">Normalna</string>+ <string name="quality_streaming_normal_detail">96 kbit/s, dobra równowaga dźwięku i danych</string>+ <string name="quality_streaming_high">Wysoka</string>+ <string name="quality_download_title">Jakość pobierania</string>+ <string name="quality_download_detail">Jak utwory są zapisywane do słuchania offline.</string>+ <string name="quality_download_off">Wyłączone</string>+ <string name="quality_download_off_detail">Bez pobierania</string>+ <string name="quality_download_cd">FLAC, jakość CD</string>+ <string name="quality_download_cd_detail">Bezstratny 16-bitowy, około 30 MB na utwór</string>+ <string name="quality_download_hires">FLAC Hi-Res</string>+ <string name="quality_download_hires_detail">24 bity, gdy są dostępne, pliki około trzy razy większe</string>+ <string name="setup_quality_title">Jakość dźwięku</string>+ <string name="setup_quality_subtitle">Wybierz, jak Myspoti odtwarza i zapisuje Twoją muzykę. Możesz to zmienić później w Ustawieniach.</string>+ <string name="downloads_off_toast">Pobieranie jest wyłączone. Włącz je w Ustawieniach.</string>+ <string name="quality_streaming_high_detail">160 kbit/s, najlepszy dźwięk</string>+ <string name="quality_download_small">Najmniejsza</string>+ <string name="quality_download_small_detail">AAC 96 kbit/s, najlżejsza: około 3 MB na utwór</string>+ <string name="settings_solid_nav_title">Pełny dolny pasek</string>+ <string name="settings_solid_nav_detail">Czerń pod kartami zamiast zanikania nad listą</string>+ <string name="quality_download_ask">Pytaj za każdym razem</string>+ <string name="quality_download_ask_detail">Wybierz przy starcie pobierania, raz dla całej playlisty</string>+ <string name="quality_sheet_title">Jakość dźwięku</string>+ <string name="quality_now">Teraz gra: %1$s</string>+ <string name="quality_now_unknown">Jeszcze nieznana: włącz utwór</string>+ <string name="update_downloading">Pobieranie… %1$d%%</string>+ <string name="update_installing">Instalowanie…</string>+ <string name="update_needs_permission">Aby zaktualizować, zezwól Myspoti na instalowanie aplikacji, a potem wróć tutaj.</string>+ <string name="update_allow">Zezwól</string>+ <string name="update_failed">Aktualizacja nie powiodła się: %1$s</string>+ <string name="update_retry">Spróbuj ponownie</string>+ <!-- A18: the automatic update check can be turned off; the manual check stays. -->+ <string name="settings_auto_update_title">Sprawdzaj aktualizacje przy uruchomieniu</string>+ <string name="settings_auto_update_detail">Wyłączone: bez sprawdzania przy starcie aplikacji. Ręczne sprawdzanie poniżej nadal działa.</string>+ <string name="settings_check_update_title">Sprawdź aktualizacje teraz</string>+ <string name="settings_check_update_detail">Szuka nowszej wersji i proponuje jej instalację</string>+ <string name="settings_update_checking">Sprawdzanie…</string>+ <string name="settings_update_check_latest">Myspoti jest aktualne</string>+ <!-- A25: stop the queue, keep the songs already downloaded. -->+ <string name="downloads_stop_all_title">Zatrzymaj wszystkie pobierania</string>+ <string name="downloads_stop_all_detail">Anuluje to, co zostało; już pobrane utwory zostają</string>+ <string name="removed_from">Usunięto z: %1$s</string>+ <!-- Track options inside a playlist (A11/A12). -->+ <string name="context_menu_remove_from_playlist">Usuń z tej playlisty</string>+ <string name="context_menu_add_to_another_playlist">Dodaj do innej playlisty</string>+ <string name="add_to_playlist_search_hint">Znajdź playlistę</string>+ <string name="add_to_playlist_empty">Nie masz playlisty, do której można dodać ten utwór</string>+ <string name="add_to_playlist_no_match">Żadna playlista nie pasuje do „%1$s”</string>+ <string name="undo">Cofnij</string>+ <string name="done">Gotowe</string>+ <string name="playlist_edit_details">Edytuj szczegóły</string>+ <string name="playlist_name_label">Nazwa</string>+ <string name="playlist_description_label">Opis</string>+ <string name="playlist_change_cover">Zmień okładkę</string>+ <string name="playlist_remove_cover">Usuń okładkę</string>+ <string name="playlist_save">Zapisz</string>+ <string name="playlist_access_title">Kto może ją zobaczyć</string>+ <string name="choose_artist">Wybierz wykonawcę</string>+ <string name="quality_streaming_wifi_title">Strumieniowanie przez Wi-Fi</string>+ <string name="quality_streaming_cell_title">Strumieniowanie przez dane komórkowe</string>+ <string name="canvas_wifi_only">Canvas tylko przez Wi-Fi</string>+ <string name="canvas_wifi_only_detail">Zapętlone wideo odtwarza się przez Wi-Fi, nigdy przez dane komórkowe</string>+ <string name="playlist_delete_confirm">Usunąć „%1$s”? Można ją przywrócić z konta Spotify w ciągu 90 dni.</string>+ <string name="playlist_saved">Playlista zaktualizowana</string>+ <string name="go_to_profile">Przejdź do profilu</string>+ <string name="cancel">Anuluj</string>+ <plurals name="profile_followers">+ <item quantity="one">%1$d obserwujący</item>+ <item quantity="few">%1$d obserwujących</item>+ <item quantity="many">%1$d obserwujących</item>+ <item quantity="other">%1$d obserwującego</item>+ </plurals>+ <string name="profile_following_count">Obserwowani: %1$d</string>+ <string name="profile_public_playlists">Publiczne playlisty</string>+ <string name="profile_followers_title">Obserwujący</string>+ <string name="profile_following_title">Obserwowani</string>+ <string name="profile_list_empty">Na razie nikogo tu nie ma</string>+ <string name="artist_ban">Nie odtwarzaj tego wykonawcy</string>+ <string name="artist_unban">Zezwól na odtwarzanie tego wykonawcy</string>+ <string name="artist_banned">%1$s nie będzie grać w Twoich miksach i radiach</string>+ <string name="artist_unbanned">%1$s znów może grać</string>+ <string name="episode_save">Dodaj do Twoich odcinków</string>+ <string name="episode_unsave">Usuń z Twoich odcinków</string>+ <string name="search_filter_profiles">Profile</string>+ <string name="view_profile">Zobacz profil</string>+ <string name="folder_delete">Usuń folder</string>+ <string name="folder_delete_confirm">Usunąć folder „%1$s”? Jego playlisty zostaną w bibliotece.</string>+ <string name="library_pin">Przypnij</string>+ <string name="library_unpin">Odepnij</string>+ <string name="library_move_to_folder">Przenieś do folderu</string>+ <string name="library_top_level">Twoja biblioteka (najwyższy poziom)</string>+ <string name="more_like_this">Więcej takich</string>+ <string name="library_sort_recents">Ostatnie</string>+ <string name="library_sort_recently_added">Ostatnio dodane</string>+ <string name="library_change_failed">Nie udało się zaktualizować biblioteki, spróbuj ponownie</string>+ <string name="a11y_close_player">Zamknij odtwarzacz</string>+ <string name="a11y_share">Udostępnij</string>+ <string name="search_failed">Wyszukiwanie nie powiodło się. Sprawdź połączenie.</string>+ <string name="retry_button">Spróbuj ponownie</string>+ <string name="page_load_failed">Nie udało się wczytać tej strony.\nSprawdź połączenie i spróbuj ponownie.</string>+ <string name="jam_paste_link">Dołącz ze skopiowanym linkiem</string>+ <string name="play_refused">Spotify odmówiło odtworzenia tego na Twoim koncie. Konta darmowe w niektórych krajach mogą grać tylko w trybie losowym: użyj przycisku mieszania.</string>+ <string name="play_refused_all">Spotify odrzuca teraz każde polecenie tego odtwarzacza na Twoim koncie (odtwarzanie, przewijanie, przenoszenie). Odtwarzacz został raz wczytany od nowa. Jeśli nic nie gra, całkowicie zamknij aplikację i otwórz ją ponownie albo przełącz się między Wi-Fi a danymi komórkowymi.</string>+ <string name="drm_missing">Odtwarzanie tutaj jest niemożliwe: Android System WebView w tym telefonie nie ma działającego DRM Widevine, którego wymaga Spotify. Zaktualizuj Android System WebView i Chrome w Sklepie Play i wybierz go w Ustawienia > Opcje programistyczne > Implementacja WebView.</string>+ <string name="artist_liked_songs">Polubione utwory</string>+ <plurals name="artist_liked_songs_count">+ <item quantity="one">%1$d utwór • %2$s</item>+ <item quantity="few">%1$d utwory • %2$s</item>+ <item quantity="many">%1$d utworów • %2$s</item>+ <item quantity="other">%1$d utworu • %2$s</item>+ </plurals>+ <string name="share_link">Udostępnij link</string>+ <string name="share_as_image">Udostępnij jako obraz</string>+ <string name="settings_autoplay_title">Autoodtwarzanie</string>+ <string name="settings_autoplay_detail">Gdy Twoja muzyka się skończy, odtwarzaj dalej podobne utwory</string>+ <string name="settings_crossfade_title">Płynne przejścia (utwory cichną, ale się nie nakładają)</string>+ <string name="settings_crossfade_detail">Utwór cichnie przez ostatnie sekundy, a następny narasta. Nigdy nie grają naraz: jeden odtwarzacz, jeden strumień audio.</string>+ <string name="settings_crossfade_off">Wyłączone</string>+ <string name="settings_crossfade_seconds">%1$d s</string>+ <string name="settings_rotation_title">Obracanie ekranu</string>+ <string name="settings_rotation_portrait">Pionowo</string>+ <string name="settings_rotation_auto">Automatycznie</string>+ <string name="settings_rotation_landscape">Poziomo</string>+ <string name="support_github_action">Wesprzyj na GitHubie</string>+ <string name="download_on_mobile_data">Pobieranie przez dane komórkowe: zużywa Twój pakiet danych</string>++ <!-- Podcast show page, episode page and podcast player -->+ <string name="show_follow">Obserwuj</string>+ <string name="show_following">Obserwujesz</string>+ <string name="show_tab_episodes">Odcinki</string>+ <string name="show_tab_chapters">Rozdziały</string>+ <string name="show_tab_about">Informacje</string>+ <string name="show_sort_newest">Wszystkie odcinki • Od najnowszych</string>+ <string name="show_sort_oldest">Wszystkie odcinki • Od najstarszych</string>+ <string name="show_sort_chapters_newest">Wszystkie rozdziały • Od najnowszych</string>+ <string name="show_sort_chapters_oldest">Wszystkie rozdziały • Od najstarszych</string>+ <string name="show_empty">Na razie nie ma tu nic do odtworzenia</string>+ <string name="show_authors">Autor: %1$s</string>+ <string name="show_narrators">Czyta: %1$s</string>+ <string name="episode_duration_min">%1$d min</string>+ <string name="episode_remaining">Zostało %1$s</string>+ <string name="episode_mark_played">Oznacz jako odtworzony</string>+ <string name="episode_mark_unplayed">Oznacz jako nierozpoczęty</string>+ <string name="episode_marked_played">Oznaczono jako odtworzony</string>+ <string name="episode_marked_unplayed">Oznaczono jako nierozpoczęty</string>+ <string name="episode_play">Odtwórz</string>+ <string name="episode_open">Otwórz odcinek</string>+ <string name="episode_add_queue">Dodaj do kolejki</string>+ <string name="episode_show_more">pokaż więcej</string>+ <string name="episode_show_less">pokaż mniej</string>+ <string name="episode_download">Pobierz</string>+ <string name="episode_download_remove">Usuń pobrany plik</string>+ <string name="episode_options">Opcje odcinka</string>+ <string name="episode_not_found">Nie znaleziono odcinka</string>+ <string name="podcast_playing_from">Odtwarzanie z podcastu</string>+ <string name="player_speed_chip">%1$s×</string>+ <string name="player_back_15">Cofnij o 15 sekund</string>+ <string name="player_forward_15">Przewiń o 15 sekund do przodu</string>+ <string name="player_sleep_timer">Wyłącznik czasowy</string>+ <string name="restart_player_done">Odtwarzacz uruchomiony ponownie</string>+ <string name="spotify_limited">Spotify na chwilę ogranicza odtwarzanie. Spróbuj ponownie za minutę.</string>+ <string name="library_change_undone">Spotify odrzuciło zmianę, Twoja biblioteka wróciła do poprzedniego stanu</string>+ <string name="blend_title">Blend</string>+ <string name="blend_detail">Playlista zmieszana z Twojego gustu i gustu znajomego</string>+ <string name="blend_invite">Zaproś znajomego do Blend</string>+ <string name="blend_join">Dołącz przez link</string>+ <string name="blend_join_title">Wklej link z zaproszeniem</string>+ <string name="blend_join_button">Dołącz</string>+ <string name="blend_invite_message">Stwórzmy Blend w Spotify: %1$s</string>+ <string name="blend_failed">Nie udało się połączyć z Blend Spotify, spróbuj ponownie</string>+ <string name="blend_bad_link">To nie jest link z zaproszeniem do Blend</string>+ <string name="blend_own_invite">To Twoje własne zaproszenie: wyślij je znajomemu</string>+ <string name="blend_full">Ten Blend jest pełny</string>+ <string name="blend_deleted">Ten Blend został usunięty</string>+ <string name="blend_working">Trwa przetwarzanie…</string>+ <string name="blend_invited_by">%1$s zaprasza Cię do Blend</string>+ <string name="blend_later">Nie teraz</string>+ <string name="blend_members">Członkowie</string>+ <string name="blend_invite_more">Zaproś więcej osób</string>+ <string name="blend_rename">Zmień nazwę Blend</string>+ <string name="blend_leave">Opuść Blend</string>+ <string name="blend_leave_confirm">Opuścić „%1$s”? Zniknie z Twojej biblioteki, a pozostali go zachowają.</string>+ <string name="blend_leave_button">Opuść</string>+ <string name="playlist_invite_banner">Zaproszono Cię do współtworzenia tej playlisty</string>+ <string name="playlist_invite_join">Dołącz</string>+ <string name="playlist_invite_joined">Jesteś teraz współtwórcą</string>+ <string name="settings_keep_playing_title">Graj dalej po zamknięciu aplikacji</string>+ <string name="settings_keep_playing_detail">Gdy wyłączone, zamknięcie Myspoti z listy ostatnich aplikacji zatrzymuje muzykę</string>+ <string name="recommended_songs_from_name">Na podstawie nazwy tej playlisty</string>+ <string name="recommended_songs_from_songs">Na podstawie zawartości tej playlisty</string>+ <string name="recommended_songs_refresh">Odśwież</string>+ <string name="recommended_songs_add">Dodaj do tej playlisty</string>+ <string name="smart_shuffle_recommended">Polecone przez inteligentne mieszanie</string>+ <string name="smart_shuffle_add">Dodaj do tej playlisty</string>+ <string name="add_songs_title">Dodaj do tej playlisty</string>+ <string name="add_songs_close">Zamknij</string>+ <string name="add_songs_search_hint">Szukaj utworów</string>+ <string name="add_songs_nothing">Nie znaleziono utworów dla „%1$s”</string>+ <string name="add_songs_added">Dodano</string>+ <string name="spotify_code_description">Spotify Code</string>+ <string name="spotify_code_hint">Zeskanuj go w Spotify (Szukaj, potem aparat), aby go otworzyć.</string>+ <string name="spotify_code_share_image">Udostępnij kod</string>+ <string name="copy_link">Kopiuj link</string>+ <string name="link_copied">Link skopiowany</string>+ <string name="lyrics_meaning_title">Znaczenie</string>+ <string name="lyrics_meaning_about">O utworze</string>+ <string name="lyrics_meaning_translating">Tłumaczenie…</string>+ <string name="lyrics_meaning_translate">Przetłumacz</string>+ <string name="lyrics_meaning_original">Zobacz oryginał</string>+ <string name="lyrics_meaning_hint">Linie kropkowane: przytrzymaj jedną, aby przeczytać, co o niej pisze Genius.</string>+ <string name="clip_sound_song">Dźwięk: utwór</string>+ <string name="clip_sound_clip">Dźwięk: teledysk</string>+ <string name="clip_sound_on_hint">Słyszysz teraz własny dźwięk teledysku. Utwór nadal gra cicho w Spotify, więc jest liczony.</string>+ <string name="clip_sound_off_hint">Znów słyszysz utwór ze Spotify.</string>+ <string name="lyrics_word_sync_title">Słowo po słowie</string>+ <string name="lyrics_word_sync_on">Najpierw czas karaoke (LyricsPlus, lrc.red, Kugou)</string>+ <string name="lyrics_word_sync_off">Wers po wersie, najpierw Spotify</string>+ <string name="playlist_invite_collaborators">Zaproś współtwórców</string>+ <string name="playlist_invite_message">Dołącz do mojej playlisty „%1$s” w Spotify, możesz do niej dodawać utwory: %2$s</string>+ <string name="playlist_invite_failed">Nie udało się utworzyć linku z zaproszeniem</string>+ <string name="playlist_by">Autor: %1$s</string>+ <string name="playlist_leave">Opuść playlistę</string>+ <string name="playlist_leave_confirm">Opuścić %1$s? Przestaniesz być współtwórcą i nie będziesz mógł(-a) dodawać ani usuwać utworów. Aby dołączyć ponownie, potrzebny będzie nowy link z zaproszeniem.</string>+ <string name="playlist_leave_button">Opuść</string>+ <string name="playlist_make_public">Ustaw jako publiczną</string>+ <string name="playlist_make_private">Ustaw jako prywatną</string>+ <string name="playlist_stop_collab">Zakończ współpracę</string>+ <string name="playlist_add_profile">Dodaj do profilu</string>+ <string name="playlist_remove_profile">Usuń z profilu</string>+ <string name="playlist_now_public">Playlista jest publiczna</string>+ <string name="playlist_now_private">Playlista jest prywatna</string>+ <string name="playlist_now_solo">Teraz tylko Ty możesz dodawać utwory</string>+ <string name="playlist_now_on_profile">Dodano do Twojego profilu</string>+ <string name="playlist_now_off_profile">Usunięto z Twojego profilu</string>+ <string name="playlist_collab_locked">Playlista wspólna: aby dodawać utwory, poproś %1$s o link z zaproszeniem.</string>+ <string name="playlist_collab_owner">jej właściciela</string>+ <string name="playlist_members_title">Współtwórcy</string>+ <string name="playlist_member_owner">Twórca</string>+ <string name="playlist_member_collab">Współtwórca</string>+ <string name="playlist_members_more">%1$s i %2$d innych</string>+ <string name="profile_block">Zablokuj</string>+ <string name="profile_unblock">Odblokuj</string>+ <string name="profile_block_title">Zablokować użytkownika %1$s?</string>+ <string name="profile_block_confirm">%1$s nie będzie mógł cię obserwować ani zobaczyć twojego profilu i publicznych playlist. Możesz go odblokować w dowolnym momencie na jego profilu.</string>+ <string name="profile_blocked">Zablokowano tego użytkownika</string>+ <string name="profile_block_failed">Nie udało się zmienić blokady, spróbuj ponownie</string>+ <string name="profile_more_options">Więcej opcji</string>+</resources>diff --git a/base/app/src/main/res/values-pl/spotify_strings.xml b/base/app/src/main/res/values-pl/spotify_strings.xmlindex f1b0c2cd..37dba472 100644--- a/base/app/src/main/res/values-pl/spotify_strings.xml+++ b/base/app/src/main/res/values-pl/spotify_strings.xml@@ -17,7 +17,6 @@<string name="snackbar_added_to_liked_songs" formatted="false">Dodano do Polubionych utworów.</string><string name="snackbar_removed_from_liked_songs" formatted="false">Usunięto z Polubionych utworów.</string><string name="content_description_context_menu" formatted="false">Więcej opcji</string>- <string name="close_button_content_description" formatted="false">Zamknij</string><string name="add_to_playlist_saved_in_section_header" formatted="false">Zapisane</string><string name="add_to_playlist_new_playlist_button_text" formatted="false">Nowa playlista</string><string name="add_to_playlist_button_cancel" formatted="false">Anuluj</string>@@ -25,8 +24,6 @@<string name="lyrics_card_title" formatted="false">Teksty</string><string name="lyrics_card_title_preview" formatted="false">Podgląd tekstu</string><string name="lyrics_card_show_lyrics_button" formatted="false">Pokaż tekst</string>- <string name="lyrics_card_expand_button_content_description" formatted="false">Otwórz tekst w widoku pełnoekranowym</string>- <string name="lyrics_card_share_button_content_description" formatted="false">Udostępnij tekst</string><string name="lyrics_credential_note" formatted="false">Tekst udostępniony przez: %1$s</string><string name="lyrics_fullscreen_chip_label_share" formatted="false">Udostępnij</string><string name="lyrics_fullscreen_chip_label_translate" formatted="false">Przetłumacz</string>@@ -49,7 +46,6 @@<string name="artist_popular_tracks" formatted="false">Popularne</string><string name="curation_button_follow_state_text" formatted="false">Obserwuj</string><string name="curation_button_following_state_text" formatted="false">Obserwujesz</string>- <string name="search_main_entity_subtitle_artist" formatted="false">Wykonawca</string><string name="connect_phone_is_self" formatted="false">Ten telefon</string><string name="settings_item_canvas_title" formatted="false">Canvas</string><string name="video_settings_canvas_subtitle" formatted="false">Krótkie, zapętlone wizualizacje wyświetlane podczas odtwarzania utworu.</string>@@ -107,8 +103,6 @@<string name="library_search_text_hint" formatted="false">Wyszukaj w Bibliotece</string><string name="account_title" formatted="false">Konto</string><string name="song_dna_search_chip_followed_artists" formatted="false">Obserwowani wykonawcy</string>- <string name="settings_item_crossfade_title" formatted="false">Płynne przejście</string>- <string name="playback_settings_crossfade_slider_seconds" formatted="false">%1$d sek.</string><string name="local_files_title" formatted="false">Pliki lokalne</string><string name="local_files_empty_section_title" formatted="false">Dodaj własne pliki audio do Biblioteki</string><string name="local_files_empty_section_subtitle" formatted="false">Masz na dysku utwór lub podcast, który jest niedostępny w Spotify?</string>@@ -138,14 +132,10 @@<string name="assisted_curation_search_filter_artists" formatted="false">Wykonawcy</string><string name="assisted_curation_search_filter_albums" formatted="false">Albumy</string><string name="assisted_curation_search_filter_playlists" formatted="false">Playlisty</string>- <string name="assisted_curation_search_filter_clear_content_description" formatted="false">Wyczyść filtr</string>- <string name="ad_category_title_music" formatted="false">Muzyka</string>- <string name="made_for_you_hub_title" formatted="false">Przygotowane dla Ciebie</string><string name="settings_item_app_language_title" formatted="false">Język aplikacji</string><string name="create_menu_item_folder_title" formatted="false">Folder</string><string name="create_folder_name_suggested_folder_name" formatted="false">Nowy folder</string><string name="context_menu_rename_folder" formatted="false">Zmień nazwę folderu</string>- <string name="your_library_messaging_folder_rename_hint" formatted="false">Nazwa folderu</string><string name="create_playlist_content_description" formatted="false">Utwórz playlistę</string><string name="actions_picker_delete" formatted="false">Usuń</string><string name="filter_and_sort_sort_section_title" formatted="false">Sortuj wg</string>diff --git a/base/app/src/main/res/values-pl/strings.xml b/base/app/src/main/res/values-pl/strings.xmlnew file mode 100644index 00000000..e70a3fe5--- /dev/null+++ b/base/app/src/main/res/values-pl/strings.xml@@ -0,0 +1,25 @@+<resources>+ <string name="app_name">Myspoti</string>+ <string name="aa_playlists">Playlisty</string>+ <string name="aa_albums">Albumy</string>+ <string name="aa_artists">Wykonawcy</string>+ <string name="settings_amoled_theme">Motyw AMOLED</string>+ <string name="settings_amoled_theme_subtitle">Czarne tło oszczędzające baterię</string>+ <string name="main_update_available">Dostępna jest nowa aktualizacja</string>++ <string name="notif_action_play">Odtwórz</string>+ <string name="notif_action_pause">Wstrzymaj</string>+ <string name="notif_shuffle_enable">Włącz mieszanie</string>+ <string name="notif_shuffle_disable">Wyłącz mieszanie</string>+ <string name="notif_shuffle_disable_smart">Wyłącz inteligentne mieszanie</string>+++ <string name="energy_saver_title">Oszczędzanie baterii</string>+ <string name="energy_saver_summary">Canvas wyłączony, lżejsze wideo i animacje</string>+ <string name="video_fullscreen_enter">Pełny ekran</string>+ <string name="video_fullscreen_exit">Zamknij pełny ekran</string>+ <string name="playback_seek_description">Pozycja odtwarzania</string>+ <string name="account_page_title">Konto Spotify</string>+ <string name="account_page_detail">Abonament, prywatność i urządzenia, na spotify.com</string>+ <string name="player_source_downloaded">Pobrane</string>+</resources>diff --git a/base/app/src/main/res/values-pt-rPT/spotify_strings.xml b/base/app/src/main/res/values-pt-rPT/spotify_strings.xmlindex f3ce3ead..e267d26e 100644--- a/base/app/src/main/res/values-pt-rPT/spotify_strings.xml+++ b/base/app/src/main/res/values-pt-rPT/spotify_strings.xml@@ -17,7 +17,6 @@<string name="snackbar_added_to_liked_songs" formatted="false">Adicionada às Músicas apreciadas.</string><string name="snackbar_removed_from_liked_songs" formatted="false">Removida das Músicas apreciadas.</string><string name="content_description_context_menu" formatted="false">Mais opções</string>- <string name="close_button_content_description" formatted="false">Fechar</string><string name="add_to_playlist_saved_in_section_header" formatted="false">Guardado em:</string><string name="add_to_playlist_new_playlist_button_text" formatted="false">Nova playlist</string><string name="add_to_playlist_button_cancel" formatted="false">Cancelar</string>@@ -25,8 +24,6 @@<string name="lyrics_card_title" formatted="false">Letra</string><string name="lyrics_card_title_preview" formatted="false">Pré-visualização das letras</string><string name="lyrics_card_show_lyrics_button" formatted="false">Mostrar letra</string>- <string name="lyrics_card_expand_button_content_description" formatted="false">Abrir letra em ecrã cheio</string>- <string name="lyrics_card_share_button_content_description" formatted="false">Partilhar a letra</string><string name="lyrics_credential_note" formatted="false">Letra fornecida por %1$s</string><string name="lyrics_fullscreen_chip_label_share" formatted="false">Partilhar</string><string name="lyrics_fullscreen_chip_label_translate" formatted="false">Traduzir</string>@@ -49,7 +46,6 @@<string name="artist_popular_tracks" formatted="false">Popular</string><string name="curation_button_follow_state_text" formatted="false">Seguir</string><string name="curation_button_following_state_text" formatted="false">A seguir</string>- <string name="search_main_entity_subtitle_artist" formatted="false">Artista</string><string name="connect_phone_is_self" formatted="false">Este telemóvel</string><string name="settings_item_canvas_title" formatted="false">Canvas</string><string name="video_settings_canvas_subtitle" formatted="false">Breves elementos visuais em loop quando uma música está a ser reproduzida.</string>@@ -107,8 +103,6 @@<string name="library_search_text_hint" formatted="false">Procurar em A tua Biblioteca</string><string name="account_title" formatted="false">Conta</string><string name="song_dna_search_chip_followed_artists" formatted="false">Artistas seguidos</string>- <string name="settings_item_crossfade_title" formatted="false">Transição gradual</string>- <string name="playback_settings_crossfade_slider_seconds" formatted="false">%1$d s</string><string name="local_files_title" formatted="false">Ficheiros locais</string><string name="local_files_empty_section_title" formatted="false">Adiciona os teus ficheiros de áudio à secção A tua Biblioteca</string><string name="local_files_empty_section_subtitle" formatted="false">Tens uma música ou um podcast pessoal que não esteja no Spotify?</string>@@ -138,14 +132,10 @@<string name="assisted_curation_search_filter_artists" formatted="false">Artistas</string><string name="assisted_curation_search_filter_albums" formatted="false">Álbuns</string><string name="assisted_curation_search_filter_playlists" formatted="false">Playlists</string>- <string name="assisted_curation_search_filter_clear_content_description" formatted="false">Limpar filtro</string>- <string name="ad_category_title_music" formatted="false">Música</string>- <string name="made_for_you_hub_title" formatted="false">Feita para ti</string><string name="settings_item_app_language_title" formatted="false">Idioma da app</string><string name="create_menu_item_folder_title" formatted="false">Pasta</string><string name="create_folder_name_suggested_folder_name" formatted="false">Nova pasta</string><string name="context_menu_rename_folder" formatted="false">Mudar o nome da pasta</string>- <string name="your_library_messaging_folder_rename_hint" formatted="false">Nome da pasta</string><string name="create_playlist_content_description" formatted="false">Criar playlist</string><string name="actions_picker_delete" formatted="false">Eliminar</string><string name="filter_and_sort_sort_section_title" formatted="false">Ordenar por</string>diff --git a/base/app/src/main/res/values-pt/extensions_strings.xml b/base/app/src/main/res/values-pt/extensions_strings.xmlnew file mode 100644index 00000000..127fd2e3--- /dev/null+++ b/base/app/src/main/res/values-pt/extensions_strings.xml@@ -0,0 +1,211 @@+<?xml version="1.0" encoding="utf-8"?>+<resources>+ <string name="extensions_title">Extensões</string>+ <string name="extensions_row_detail">Letras, o áudio de uma música e scripts escritos por outras pessoas, numa sandbox.</string>+ <string name="extensions_install_file">Instalar a partir de um ficheiro</string>+ <string name="extensions_install_url">Instalar a partir de um endereço</string>+ <string name="extensions_url_hint">https://…/extension.zip</string>+ <string name="extensions_none">Nenhuma extensão instalada.</string>+ <string name="extensions_installed">Instaladas</string>+ <string name="extensions_repository_add">Adicionar um repositório</string>+ <string name="extensions_repository_hint">https://…/index.json</string>+ <string name="extensions_repository_warning">O Myspoti não verifica um repositório que adiciones: o que instalares a partir dele é por tua conta e risco.</string>+ <string name="extensions_repository_remove">Remover</string>+ <string name="extensions_repository_refresh">Atualizar</string>+ <string name="extensions_install">Instalar</string>+ <string name="extensions_update">Atualizar</string>+ <string name="extensions_up_to_date">Instalada</string>+ <string name="extensions_cancel">Cancelar</string>+ <string name="extensions_loading">A ler…</string>+ <string name="extensions_error">Não instalada: %1$s</string>+ <string name="extensions_prompt_title_install">Instalar %1$s?</string>+ <string name="extensions_prompt_title_update">Atualizar %1$s?</string>+ <string name="extensions_prompt_by">%1$s · versão %2$s · %3$s</string>+ <string name="extensions_prompt_source">De %1$s</string>+ <string name="extensions_prompt_source_file">um ficheiro neste telemóvel</string>+ <string name="extensions_prompt_new">novo nesta versão</string>+ <string name="extensions_prompt_update_same_rights">%1$s → %2$s, com as mesmas permissões.</string>+ <string name="extensions_prompt_not_newer">A versão %1$s (ou uma mais recente) já está instalada.</string>+ <string name="extensions_prompt_sha">sha256 do pacote: %1$s</string>+ <string name="extension_enabled">Ativa</string>+ <string name="extension_running">Em execução</string>+ <string name="extension_not_running">Parada</string>+ <string name="extension_turned_off">%1$s desativada: %2$s</string>+ <string name="extension_last_error">Último erro: %1$s</string>+ <string name="extension_disabled_reason">Desativada: %1$s</string>+ <string name="extension_inactive">Inativa</string>+ <string name="extension_inactive_detail">Inativa: %1$s</string>+ <string name="extension_homepage">Página web</string>+ <string name="extension_settings">Definições</string>+ <string name="extension_log">Registo</string>+ <string name="extension_log_empty">Ainda nada registado.</string>+ <string name="extension_log_clear">Limpar o registo</string>+ <string name="extension_update_file">Atualizar a partir de um ficheiro</string>+ <string name="extension_uninstall">Desinstalar</string>+ <string name="extension_uninstall_confirm">Desinstalar %1$s? As suas definições e o que guardou vão com ela.</string>+ <string name="extension_confirm_title">Uma extensão pergunta</string>+ <string name="extension_confirm_detail">Nada é alterado sem a tua permissão.</string>+ <string name="extension_confirm_allow">Permitir</string>+ <string name="extension_confirm_refuse">Recusar</string>+ <string name="extensions_row_count">%1$d instaladas, %2$d ativas</string>+ <string name="extensions_tab_store">Loja</string>+ <string name="extensions_search">Pesquisar extensões</string>+ <string name="extensions_cat_all">Todas</string>+ <string name="extensions_cat_lyrics">Letras</string>+ <string name="extensions_cat_playback">Reprodução e áudio</string>+ <string name="extensions_cat_library">Biblioteca</string>+ <string name="extensions_cat_discovery">Descobrir</string>+ <string name="extensions_cat_stats">Estatísticas</string>+ <string name="extensions_cat_look">Aspeto</string>+ <string name="extensions_cat_social">Social</string>+ <string name="extensions_cat_tools">Ferramentas</string>+ <string name="extensions_cat_other">Outras</string>+ <string name="extensions_no_match">Nenhuma extensão corresponde.</string>+ <string name="extensions_browse_store">Explorar a loja</string>+ <string name="extensions_other_ways">Outras formas de instalar</string>+ <string name="extensions_empty_title">O que são extensões?</string>+ <string name="extensions_empty_body">As extensões acrescentam ao Myspoti o que ele não faz sozinho: letras de outras fontes, de onde vem o áudio ou a transferência de uma música, ferramentas que usam a tua conta Spotify. Cada uma corre numa sandbox e pergunta antes de aceder a seja o que for. Adiciona um repositório para as explorar ou instala um pacote em que confies.</string>+ <string name="extensions_official_badge">Oficial</string>+ <string name="extensions_repo_yours">Adicionado por ti</string>+ <string name="extensions_repo_community">Comunidade</string>+ <string name="extensions_repo_official_note">Cada extensão é revista antes de ser listada.</string>+ <string name="extensions_repo_yours_note">Não revisto pelo Myspoti: instala por tua conta e risco.</string>+ <string name="extensions_repo_error">Não foi possível ler este repositório: %1$s</string>+ <string name="extensions_repo_empty">Este repositório não lista nenhuma extensão.</string>+ <string name="extensions_requires">Requer o Myspoti %1$s ou mais recente</string>+ <string name="extensions_requires_api">Feita para um Myspoti mais recente (API de extensões %1$d)</string>+ <string name="extensions_update_badge">Atualização</string>+ <string name="extensions_move_up">Subir</string>+ <string name="extensions_move_down">Descer</string>+ <string name="extension_off">Desativada</string>+ <string name="extension_by">de %1$s</string>+ <string name="extension_changelog">Novidades</string>+ <string name="extension_update_from">Atualização disponível: %1$s → %2$s</string>+ <string name="extension_not_listed">Esta extensão não está nos teus repositórios (ou ainda estão a carregar).</string>+ <string name="extension_details">Detalhes</string>+ <string name="extension_detail_updated">Atualizada</string>+ <string name="extension_detail_min_app">Requer o Myspoti</string>+ <string name="extension_detail_size">Tamanho</string>+ <string name="extension_detail_id">Id</string>+ <string name="extension_detail_sha">sha256 do pacote</string>+ <string name="extension_detail_source">Instalada a partir de</string>+ <string name="extension_see_in_store">Ver na loja</string>++ <!-- Actions: the closed catalogue, as the user reads it -->+ <string name="action_playback_control">Controlar a reprodução</string>+ <string name="action_playback_queue">Editar a fila</string>+ <string name="action_playback_events">Saber o que ouves</string>+ <string name="action_lyrics_provide">Fornecer letras</string>+ <string name="action_trackinfo_provide">Acrescentar detalhes das músicas</string>+ <string name="action_audio_source">Tocar áudio de outro lado</string>+ <string name="action_download_source">Fornecer transferências</string>+ <string name="action_home_sections">Acrescentar secções ao Início</string>+ <string name="action_search_provide">Acrescentar resultados de pesquisa</string>+ <string name="action_menu_items">Acrescentar entradas aos menus</string>+ <string name="action_player_buttons">Acrescentar botões ao leitor</string>+ <string name="action_settings_page">As suas próprias definições</string>+ <string name="action_notify">Mostrar mensagens curtas</string>+ <string name="action_library_read">Ler a tua biblioteca</string>+ <string name="action_library_write">Alterar a tua biblioteca</string>+ <string name="action_playlists_write">Editar as tuas playlists</string>+ <string name="action_spotify_catalog">Explorar o Spotify</string>+ <string name="action_spotify_raw">Acesso total ao Spotify</string>+ <string name="action_network">Usar a internet</string>+ <string name="action_network_any">Usar qualquer site</string>+ <string name="action_webview_page">A sua própria página web</string>+ <string name="action_storage">Guardar os seus próprios dados</string>+ <string name="action_unknown">Desconhecido deste Myspoti</string>+ <string name="action_critical">Crítica</string>+ <string name="action_no_why">(sem motivo indicado)</string>+ <string name="actions_title">O que faz</string>+ <string name="actions_critical_warning">As ações críticas podem alterar a tua conta, substituir a origem das músicas ou mostrar uma página web livre. Permite-as apenas se confiares no autor: o Myspoti continua a perguntar antes de remover seja o que for.</string>+ <!-- Areas of the Installed tab -->+ <string name="area_playback">Reprodução</string>+ <string name="area_lyrics">Letras e info das músicas</string>+ <string name="area_audio">Áudio e transferências</string>+ <string name="area_home">Início e pesquisa</string>+ <string name="area_menus">Menus e leitor</string>+ <string name="area_library">Biblioteca e Spotify</string>+ <string name="area_other">Páginas e mais</string>+ <string name="area_activity">Atividade recente</string>+ <string name="area_turn_off">Desativar</string>+ <string name="area_active">Ativa</string>+ <string name="area_idle">Inativa</string>+ <string name="area_make_active">Usá-la para %1$s</string>+ <!-- Install prompt -->+ <string name="ext_third_party_notice">Extensão de terceiros, não revista pelo Myspoti, sob a responsabilidade do seu autor.</string>+ <string name="ext_risk_accept">Entendo que esta extensão é feita por terceiros e instalo-a sob minha própria responsabilidade</string>+ <string name="ext_clash_exclusive">Substitui %1$s, atualmente fornecido por %2$s</string>+ <string name="ext_clash_conflict">Incompatível com %1$s (instalada)</string>+ <string name="ext_clash_replaces">Substitui %1$s (instalada)</string>+ <string name="ext_clash_keep_new">Usar %1$s (a outra continua instalada, %2$s)</string>+ <string name="ext_clash_keep_old">Manter %1$s</string>+ <string name="ext_clash_idle">inativa</string>+ <string name="ext_clash_off">desativada</string>+ <string name="ext_clash_title">Qual manter?</string>+ <string name="ext_clash_ok">Concluído</string>+ <!-- Blocks and pages -->+ <string name="ext_from">De %1$s</string>+ <string name="ext_overflow">Extensões</string>+ <string name="ext_open_page">Abrir a sua página</string>+ <string name="ext_page_failed">Não foi possível mostrar a página desta extensão.</string>+ <string name="ext_suspended_title">%1$s em pausa</string>+ <string name="ext_suspended_body">Estava sempre a desfazer o que %1$s fazia com a reprodução: os seus comandos de reprodução estão suspensos.</string>+ <string name="ext_suspended_keep">Deixar continuar</string>++ <!-- GitHub: discovery, ratings, reports -->+ <string name="extensions_github_title">No GitHub</string>+ <string name="extensions_github_note">Repositórios públicos com o tópico myspoti-extension, não revistos: cada um é da responsabilidade do seu autor.</string>+ <string name="extensions_show_all">Mostrar todas (%1$d ocultas)</string>+ <string name="extensions_show_less">Ocultar as bloqueadas, denunciadas, mal avaliadas e abandonadas</string>+ <string name="extension_rating">★ %1$s · %2$d votos</string>+ <string name="extension_rating_none">Ainda sem votos</string>+ <string name="extension_downloads">%1$s transferências</string>+ <string name="extension_rate_up">Avaliá-la bem</string>+ <string name="extension_rate_down">Avaliá-la mal</string>+ <string name="extension_rated">Obrigado: o teu voto está no GitHub</string>+ <string name="extension_signin_title">Iniciar sessão no GitHub</string>+ <string name="extension_signin_body">Abre %1$s e introduz este código. O Myspoti nunca vê a tua palavra-passe.</string>+ <string name="extension_signin_open">Abrir o GitHub</string>+ <string name="extension_report">Denunciar</string>+ <string name="extension_detail_github">GitHub</string>+ <string name="extension_detail_ref">Versão no GitHub</string>++ <!-- Updates from GitHub -->+ <string name="extension_check_updates">Procurar atualizações</string>+ <string name="extension_check_up_to_date">Atualizada</string>+ <string name="extension_check_applied">Atualizada: não pede nada de novo</string>+ <string name="extension_check_needs_ok">Uma atualização precisa do teu OK</string>+ <string name="extension_check_declined">Mantiveste esta versão</string>+ <string name="extension_check_incompatible">A nova versão requer um Myspoti mais recente</string>+ <string name="extension_check_blocked">A nova versão está bloqueada pelo Myspoti</string>+ <string name="extension_check_failed">Não foi possível verificar: vê o registo</string>+ <string name="extension_source_gone">Origem desaparecida: o seu repositório já não existe. Continua a funcionar com a cópia no teu telemóvel.</string>+ <string name="extension_revert">Voltar a %1$s</string>+ <string name="extension_reverted">De volta a %1$s</string>+ <string name="extension_update_needs_ok">A atualização precisa do teu OK: %1$s → %2$s</string>+ <string name="extension_update_needs_ok_body">Esta versão pede mais do que aceitaste. A atual continua a funcionar até escolheres.</string>+ <string name="extension_update_accept">Aceitar</string>+ <string name="extension_update_keep">Manter a atual</string>+ <string name="extension_refused_title">Aguarda a sua aprovação</string>+ <string name="extension_refused_body">Foi instalada quando era possível desmarcar ações, e algumas foram desmarcadas. Agora uma extensão recebe todas as ações que declara: fica desligada até as aceitar.</string>+ <string name="extension_change_action">Novo: %1$s</string>+ <string name="extension_change_host">Novo site: %1$s</string>+ <string name="extension_change_any_host">Qualquer site</string>+ <string name="extension_change_exclusive">Agora exclusiva: %1$s</string>+ <string name="extension_change_why">Novo motivo para %1$s</string>+ <string name="extension_change_was">Era: «%1$s»</string>+ <string name="extension_change_repo">Agora vem de %1$s (era %2$s)</string>+ <string name="extension_change_author">Novo autor: %1$s (era %2$s)</string>+ <string name="extension_change_replaces">Desativa %1$s quando instalada</string>+ <string name="extension_change_conflicts">Recusa funcionar com %1$s</string>+ <string name="action_webview_auth">Iniciar sessão num site</string>+ <string name="extension_confirm_once">Permitir uma vez</string>+ <string name="extension_confirm_always">Permitir sempre %1$s</string>+ <string name="ext_auth_title">%1$s: iniciar sessão</string>+ <string name="ext_auth_close">Fechar</string>+ <string name="ext_auth_notice">Uma página própria: o que se escreve e os cookies dela ficam no Myspoti. A extensão só recebe o endereço final da página.</string>+ <string name="ext_grants_title">Sempre permitido</string>+ <string name="ext_grants_note">Alterações ao Spotify que esta extensão faz sem perguntar. Revogue uma para voltar a ser questionado.</string>+ <string name="ext_grant_revoke">Revogar</string>+</resources>diff --git a/base/app/src/main/res/values-pt/myspoti_strings.xml b/base/app/src/main/res/values-pt/myspoti_strings.xmlindex b0e6dd8d..647e4aec 100644--- a/base/app/src/main/res/values-pt/myspoti_strings.xml+++ b/base/app/src/main/res/values-pt/myspoti_strings.xml@@ -1,20 +1,13 @@<?xml version="1.0" encoding="utf-8"?><!-- Textos próprios do Myspoti (inglês por omissão, francês e português). --><resources>- <string name="welcome_tagline">A tua música, com letras sincronizadas e videoclipes oficiais.</string><string name="welcome_lead">Sua música,</string><string name="welcome_rotate_ads">sem anúncios.</string><string name="welcome_rotate_lyrics">com letras palavra por palavra.</string><string name="welcome_rotate_clips">com os clipes oficiais.</string>- <string name="welcome_rotate_offline">até offline.</string>- <string name="welcome_rotate_lossless">em qualidade sem perdas.</string>+ <string name="welcome_rotate_offline">offline, com extensões.</string><string name="welcome_login">Iniciar sessão com o Spotify</string><string name="welcome_privacy">Inicias sessão na página oficial do Spotify. O Myspoti nunca vê a tua palavra-passe.</string>- <string name="crash_heading">O Myspoti parou de funcionar</string>- <string name="crash_explanation">Ocorreu um problema. Reinicia a app; se voltar a acontecer, copia o relatório e partilha-o numa issue no GitHub.</string>- <string name="crash_restart_app">Reiniciar o Myspoti</string>- <string name="crash_copy_report">Copiar o relatório</string>- <string name="crash_report_copied">Relatório copiado</string><string name="remove_from_liked">Remover das Músicas apreciadas</string><string name="repeat_on">Repetir: ativado</string><string name="repeat_one">Repetir uma</string>@@ -54,7 +47,6 @@<string name="background_playback_title">Reprodução em segundo plano</string><string name="background_playback_on">A otimização da bateria está desativada: a música e o Spotify Connect continuam com o ecrã desligado.</string><string name="background_playback_off">Desativa a otimização da bateria para que o Android não pause a app em segundo plano.</string>- <string name="crossfade_summary">Faz desaparecer gradualmente o fim de uma faixa e entrar a seguinte (sem sobreposição). Apenas neste telemóvel.</string><plurals name="local_files_count"><item quantity="one">%d faixa</item><item quantity="other">%d faixas</item>@@ -71,11 +63,8 @@<string name="artist_not_found">Artista não encontrado</string><string name="playlist_not_found">Playlist não encontrada</string><string name="browse_new_releases">Novidades</string>- <string name="browse_charts">Tops</string>- <string name="browse_workout">Treino</string>- <string name="browse_dance_electronic">Dança/Eletrónica</string><string name="language_auto">Automático</string>- <string name="language_auto_detail">O idioma do teu telemóvel quando o Myspoti o tem (alemão, espanhol, francês, grego, inglês, italiano, português); caso contrário, inglês</string>+ <string name="language_auto_detail">O idioma do teu telemóvel quando o Myspoti o tem (alemão, chinês, espanhol, francês, grego, inglês, italiano, polaco, português, russo); caso contrário, inglês</string><string name="language_partial_note">Outras línguas: os rótulos do Spotify são traduzidos, os textos do Myspoti ficam em inglês.</string><string name="restart_player_title">Reiniciar o leitor</string><string name="restart_player_detail">Se a música deixar de responder: recarrega o leitor do Spotify</string>@@ -86,7 +75,6 @@<string name="local_rename">Mudar o nome</string><string name="local_delete_playlist">Eliminar playlist</string><string name="local_added_to">Adicionado a %1$s</string>- <string name="folder_create_failed">Não foi possível criar a pasta</string><string name="local_playlist_empty">Adiciona músicas de Ficheiros locais com o botão +.</string><string name="playlist_change_refused">O Spotify recusou a alteração a esta playlist</string><string name="download_kept_by_list">Continua transferida: uma playlist transferida inclui-a</string>@@ -124,6 +112,7 @@<string name="library_reorder_hint">Mantém uma playlist carregada e arrasta-a para a mover</string><string name="library_reorder_reset">Repor a ordem do Spotify</string><string name="song_radio_failed">Não foi possível abrir a rádio desta música</string>+ <string name="song_radio_name">Rádio de %1$s</string><string name="local_files_find_hint">Procurar em Ficheiros locais</string><string name="data_saver_title">Poupança de dados</string><string name="data_saver_summary">Em dados móveis, o Myspoti não usa dados: só tocam as músicas transferidas e os Ficheiros locais</string>@@ -152,13 +141,8 @@<string name="playback_speed">Velocidade de reprodução</string><string name="recommended_songs">Músicas recomendadas</string><string name="jam_title">Jam</string>- <string name="jam_restricted">O Spotify só permite iniciar uma Jam em contas Premium. Ainda podes entrar numa com uma ligação.</string>- <string name="jam_join">Entrar numa Jam</string>- <string name="jam_join_hint">Cola a ligação do convite</string><string name="jam_leave">Sair da Jam</string><string name="jam_members">%1$d pessoas a ouvir</string>- <string name="pin">Fixar</string>- <string name="unpin">Desafixar</string><string name="jam_start">Iniciar uma Jam</string><string name="jam_invite">Partilhar ligação de convite</string><string name="jam_failed">O Spotify recusou esta Jam</string>@@ -195,27 +179,6 @@<string name="smart_shuffle_title">Reprodução aleatória inteligente</string><string name="smart_shuffle_on">Reprodução aleatória inteligente: as recomendações do Spotify juntam-se à playlist misturada.</string><string name="track_sort_added">Data de adição</string>- <!-- Transferências sem perdas (SpotiFLAC) -->- <string name="spotiflac_row_title">Transferências sem perdas (FLAC)</string>- <string name="spotiflac_row_on">Verificado — o Myspoti usa os servidores do próprio SpotiFLAC.</string>- <string name="spotiflac_row_off">Não verificado — toca para fazer a verificação única.</string>- <string name="spotiflac_verify_title">Verificação SpotiFLAC</string>- <string name="spotiflac_verify_start_failed">Não foi possível iniciar a verificação. Toca em Tentar novamente ou volta mais tarde.</string>- <string name="spotiflac_verify_timeout">A verificação expirou. Toca em Tentar novamente ou em Saltar por agora.</string>- <string name="spotiflac_verify_rejected">A verificação foi rejeitada. Toca em Tentar novamente ou em Saltar por agora.</string>- <string name="spotiflac_session_ok">Sessão SpotiFLAC guardada</string>- <string name="spotiflac_session_creating">A criar sessão segura…</string>- <string name="spotiflac_session_failed">Não foi possível concluir a verificação. Toca em Tentar novamente ou em Saltar por agora.</string>- <string name="spotiflac_skip">Saltar por agora</string>- <string name="retry">Tentar novamente</string>- <string name="spotiflac_status_title">SpotiFLAC</string>- <string name="spotiflac_status_verified">Estás verificado: as transferências passam pelos servidores do próprio SpotiFLAC, a fonte sem perdas mais fiável. Só esta sessão é usada — sem conta, sem mais nada guardado.</string>- <string name="spotiflac_session_expires">Sessão válida até %1$s</string>- <string name="spotiflac_forget">Esquecer esta sessão</string>- <string name="lossless_hires_title">Transferências em alta resolução (24 bits)</string>- <string name="lossless_hires_detail">Uma faixa guardada em 24 bits de alta resolução quando a fonte a tem. Os ficheiros são cerca de três vezes maiores do que em qualidade CD.</string>- <string name="setup_spotiflac_title">Transferências sem perdas (FLAC)</string>- <string name="setup_spotiflac_detail">Verifica uma vez com o SpotiFLAC para que as transferências venham dos seus servidores sem perdas.</string><string name="settings_title">Definições</string><string name="settings_detail">Qualidade do som, transferências, dados, bateria e idioma</string><string name="settings_section_playback">Reprodução</string>@@ -244,7 +207,6 @@<string name="setup_quality_subtitle">Escolhe como o Myspoti reproduz e guarda a tua música. Podes alterar mais tarde nas Definições.</string><string name="downloads_off_toast">As transferências estão desativadas. Ativa-as nas Definições.</string><string name="quality_streaming_high_detail">160 kbit/s, o melhor som</string>- <string name="downloads_verify_hint">Nenhuma fonte sem perdas respondeu. Verifica uma vez o SpotiFLAC em Definições, Transferências: os seus servidores são os fiáveis.</string><string name="quality_download_small">Mais pequena</string><string name="quality_download_small_detail">AAC 96 kbit/s, a mais leve: cerca de 3 MB por música</string><string name="settings_solid_nav_title">Barra inferior opaca</string>@@ -254,14 +216,12 @@<string name="quality_sheet_title">Qualidade do som</string><string name="quality_now">A tocar agora: %1$s</string><string name="quality_now_unknown">Ainda desconhecida: começa uma música</string>- <string name="spotiflac_verify_in_browser">Resolve a verificação no separador do navegador que abriu e depois volta aqui.</string><string name="update_downloading">A transferir… %1$d%%</string><string name="update_installing">A instalar…</string><string name="update_needs_permission">Para atualizar, permite que o Myspoti instale aplicações e depois volta aqui.</string><string name="update_allow">Permitir</string><string name="update_failed">A atualização falhou: %1$s</string><string name="update_retry">Tentar novamente</string>- <string name="downloads_verify_banner">As transferências precisam da verificação SpotiFLAC uma vez nesta app. Toca aqui para a fazer.</string><string name="removed_from">Removido de %1$s</string><string name="done">Concluído</string><string name="playlist_edit_details">Editar detalhes</string>@@ -271,14 +231,6 @@<string name="playlist_remove_cover">Remover a capa</string><string name="playlist_save">Guardar</string><string name="playlist_access_title">Quem pode ver</string>- <string name="playlist_access_public">Pública</string>- <string name="playlist_access_public_detail">Qualquer pessoa a pode encontrar e ouvir</string>- <string name="playlist_access_private">Privada</string>- <string name="playlist_access_private_detail">Só tu a podes ver</string>- <string name="playlist_access_collaborative">Colaborativa</string>- <string name="playlist_access_collaborative_detail">Só as pessoas que você convidar podem adicionar e remover músicas</string>- <string name="playlist_on_profile">No seu perfil</string>- <string name="playlist_on_profile_detail">Aparece no seu perfil para outras pessoas</string><string name="choose_artist">Escolha um artista</string><string name="quality_streaming_wifi_title">Streaming por Wi-Fi</string><string name="quality_streaming_cell_title">Streaming com dados móveis</string>@@ -316,13 +268,13 @@<string name="library_sort_recently_added">Adicionados recentemente</string><string name="library_change_failed">Não foi possível atualizar a tua biblioteca, tenta novamente</string><string name="a11y_close_player">Fechar o leitor</string>- <string name="a11y_devices">Dispositivos</string><string name="a11y_share">Partilhar</string><string name="search_failed">A pesquisa falhou. Verifica a tua ligação.</string><string name="retry_button">Tentar novamente</string><string name="page_load_failed">Não foi possível carregar esta página.\nVerifica a tua ligação e tenta novamente.</string><string name="jam_paste_link">Entrar com uma ligação copiada</string><string name="play_refused">O Spotify recusou reproduzir isto na tua conta. Em alguns países, as contas gratuitas só podem reproduzir aleatoriamente: experimenta o botão de reprodução aleatória.</string>+ <string name="play_refused_all">O Spotify está a recusar todos os comandos deste leitor na tua conta (reproduzir, avançar, transferir). O leitor foi recarregado uma vez; se nada tocar, fecha a app por completo e abre-a de novo, ou alterna entre Wi-Fi e dados móveis.</string><string name="artist_liked_songs">Músicas apreciadas</string><plurals name="artist_liked_songs_count"><item quantity="one">%1$d música de %2$s</item>@@ -337,7 +289,6 @@<string name="settings_rotation_auto">Automática</string><string name="settings_rotation_landscape">Paisagem</string><string name="support_github_action">Patrocinar no GitHub</string>- <string name="spotiflac_verify_again">A verificação do SpotiFLAC expirou: volta a fazê-la nas Definições para transferir sem perdas</string><string name="download_on_mobile_data">Transferência com dados móveis: usa o teu tarifário</string><string name="restart_player_done">Player reiniciado</string><string name="spotify_limited">O Spotify está limitando a reprodução no momento. Tente de novo em um minuto.</string>@@ -356,7 +307,6 @@<string name="blend_deleted">Este Blend foi eliminado</string><string name="blend_working">Em curso…</string><string name="blend_invited_by">%1$s convida-te para um Blend</string>- <string name="blend_open">Abrir o Blend</string><string name="blend_later">Agora não</string><string name="blend_members">Membros</string><string name="blend_invite_more">Convidar mais pessoas</string>@@ -375,7 +325,6 @@<string name="diagnostic_export_title">Exportar um relatório de diagnóstico</string><string name="diagnostic_export_detail">Partilha o registo recente da app e os dados do dispositivo</string><string name="diagnostic_export_failed">Não foi possível gravar o relatório de diagnóstico</string>- <string name="recently_played_title">Reproduzidas recentemente</string><string name="recently_played_empty">O que reproduzires nesta conta aparece aqui.</string><string name="recently_played_failed">Não foi possível carregar a lista das reproduzidas recentemente (%1$s)</string><string name="recents_title">Recentes</string>@@ -418,11 +367,8 @@<string name="show_sort_chapters_newest">Todos os capítulos • Mais recentes</string><string name="show_sort_chapters_oldest">Todos os capítulos • Mais antigos</string><string name="show_empty">Ainda não há nada para reproduzir aqui</string>- <string name="show_rating">%1$s (%2$s)</string><string name="show_authors">Por %1$s</string><string name="show_narrators">Narrado por %1$s</string>- <string name="show_followed">Agora segues este podcast</string>- <string name="show_unfollowed">Deixaste de seguir este podcast</string><string name="episode_duration_min">%1$d min</string><string name="episode_remaining">Faltam %1$s</string><string name="episode_mark_played">Marcar como reproduzido</string>@@ -435,20 +381,14 @@<string name="episode_show_more">mostrar mais</string><string name="episode_show_less">mostrar menos</string><string name="episode_download">Transferir</string>- <string name="episode_downloading">A transferir…</string>- <string name="episode_downloaded">Transferido</string><string name="episode_download_remove">Remover a transferência</string><string name="episode_options">Opções do episódio</string><string name="episode_not_found">Episódio não encontrado</string>- <string name="show_not_found">Podcast não encontrado</string><string name="podcast_playing_from">A reproduzir a partir do podcast</string><string name="player_speed_chip">%1$s×</string><string name="player_back_15">Recuar 15 segundos</string><string name="player_forward_15">Avançar 15 segundos</string>- <string name="player_show_remaining">Mostrar o tempo restante</string>- <string name="player_show_elapsed">Mostrar o tempo decorrido</string><string name="player_sleep_timer">Temporizador de suspensão</string>- <string name="player_speed_a11y">Velocidade de reprodução, %1$s×</string><string name="settings_keep_playing_title">Continuar a reproduzir ao fechar a app</string><string name="settings_keep_playing_detail">Desativado: fechar o Myspoti nas apps recentes para a música</string><string name="recommended_songs_from_name">Com base no nome desta playlist</string>@@ -469,8 +409,6 @@<string name="link_copied">Link copiado</string><string name="lyrics_meaning_title">Significado</string><string name="lyrics_meaning_about">Sobre</string>- <string name="lyrics_meaning_lines">Versos explicados</string>- <string name="lyrics_meaning_source">Do Genius · abrir a música lá</string><string name="lyrics_meaning_translating">Traduzindo…</string><string name="lyrics_meaning_translate">Traduzir</string><string name="lyrics_meaning_original">Ver original</string>diff --git a/base/app/src/main/res/values-pt/spotify_strings.xml b/base/app/src/main/res/values-pt/spotify_strings.xmlindex 733b0e5e..ff501135 100644--- a/base/app/src/main/res/values-pt/spotify_strings.xml+++ b/base/app/src/main/res/values-pt/spotify_strings.xml@@ -17,7 +17,6 @@<string name="snackbar_added_to_liked_songs" formatted="false">Adicionada a Músicas Curtidas.</string><string name="snackbar_removed_from_liked_songs" formatted="false">Removida das Músicas Curtidas.</string><string name="content_description_context_menu" formatted="false">Mais opções</string>- <string name="close_button_content_description" formatted="false">Fechar</string><string name="add_to_playlist_saved_in_section_header" formatted="false">Conteúdo salvo em:</string><string name="add_to_playlist_new_playlist_button_text" formatted="false">Nova playlist</string><string name="add_to_playlist_button_cancel" formatted="false">Cancelar</string>@@ -25,8 +24,6 @@<string name="lyrics_card_title" formatted="false">Letra</string><string name="lyrics_card_title_preview" formatted="false">Prévia da letra</string><string name="lyrics_card_show_lyrics_button" formatted="false">Mostrar letra</string>- <string name="lyrics_card_expand_button_content_description" formatted="false">Abrir a letra em tela cheia</string>- <string name="lyrics_card_share_button_content_description" formatted="false">Compartilhar letra</string><string name="lyrics_credential_note" formatted="false">Letra disponibilizada por %1$s</string><string name="lyrics_fullscreen_chip_label_share" formatted="false">Compartilhar</string><string name="lyrics_fullscreen_chip_label_translate" formatted="false">Traduzir</string>@@ -49,7 +46,6 @@<string name="artist_popular_tracks" formatted="false">Populares</string><string name="curation_button_follow_state_text" formatted="false">Seguir</string><string name="curation_button_following_state_text" formatted="false">Seguindo</string>- <string name="search_main_entity_subtitle_artist" formatted="false">Artista</string><string name="connect_phone_is_self" formatted="false">Este telefone</string><string name="settings_item_canvas_title" formatted="false">Canvas</string><string name="video_settings_canvas_subtitle" formatted="false">Efeitos visuais curtos em loop quando uma música está tocando.</string>@@ -107,8 +103,6 @@<string name="library_search_text_hint" formatted="false">Busque na Sua Biblioteca</string><string name="account_title" formatted="false">Conta</string><string name="song_dna_search_chip_followed_artists" formatted="false">Artistas seguidos</string>- <string name="settings_item_crossfade_title" formatted="false">Transição gradual</string>- <string name="playback_settings_crossfade_slider_seconds" formatted="false">%1$d s</string><string name="local_files_title" formatted="false">Arquivos locais</string><string name="local_files_empty_section_title" formatted="false">Adicione seus próprios arquivos de áudio à Sua Biblioteca</string><string name="local_files_empty_section_subtitle" formatted="false">Tem uma música ou podcast pessoal que não está no Spotify?</string>@@ -138,14 +132,10 @@<string name="assisted_curation_search_filter_artists" formatted="false">Artistas</string><string name="assisted_curation_search_filter_albums" formatted="false">Álbuns</string><string name="assisted_curation_search_filter_playlists" formatted="false">Playlists</string>- <string name="assisted_curation_search_filter_clear_content_description" formatted="false">Limpar filtro</string>- <string name="ad_category_title_music" formatted="false">Músicas</string>- <string name="made_for_you_hub_title" formatted="false">Feito para você</string><string name="settings_item_app_language_title" formatted="false">Idioma do app</string><string name="create_menu_item_folder_title" formatted="false">Pasta</string><string name="create_folder_name_suggested_folder_name" formatted="false">Nova pasta</string><string name="context_menu_rename_folder" formatted="false">Renomear pasta</string>- <string name="your_library_messaging_folder_rename_hint" formatted="false">Nome da pasta</string><string name="create_playlist_content_description" formatted="false">Criar playlist</string><string name="actions_picker_delete" formatted="false">Excluir</string><string name="filter_and_sort_sort_section_title" formatted="false">Classificar por</string>diff --git a/base/app/src/main/res/values-pt/strings.xml b/base/app/src/main/res/values-pt/strings.xmlindex 4e0a68e1..41c1911e 100644--- a/base/app/src/main/res/values-pt/strings.xml+++ b/base/app/src/main/res/values-pt/strings.xml@@ -4,34 +4,14 @@<string name="aa_playlists">Playlists</string><string name="aa_albums">Álbuns</string><string name="aa_artists">Artistas</string>- <string name="aa_podcasts">Podcasts</string><string name="settings_amoled_theme">Tema AMOLED</string><string name="settings_amoled_theme_subtitle">Fundo preto puro para economizar bateria</string>- <string name="settings_lyrics_style_spotify_default">Spotify padrão</string>- <string name="settings_lyrics_style_fullscreen">Tela cheia (cores do álbum)</string>- <string name="settings_lyrics_style_compact">Compacto</string>- <string name="settings_lyrics_style_karaoke">Karaokê</string>- <string name="settings_lyrics_style_bold">Grande e em negrito</string><string name="main_update_available">Uma nova atualização está disponível</string>- <string name="notif_channel_media_name">Reprodução de mídia</string>- <string name="notif_channel_media_description">Controles de reprodução de mídia do Myspoti</string>- <string name="notif_action_previous">Anterior</string>- <string name="notif_action_next">Próxima</string><string name="notif_action_play">Tocar</string><string name="notif_action_pause">Pausar</string><string name="notif_shuffle_enable">Ativar reprodução aleatória</string><string name="notif_shuffle_disable">Desativar reprodução aleatória</string><string name="notif_shuffle_disable_smart">Desativar a reprodução aleatória inteligente</string>- <string name="notif_action_like">Curtir</string>- <string name="notif_action_unlike">Remover \'Curtir\'</string>- <string name="notif_unknown_name">Desconhecido</string>- <string name="notif_by_artist">por %1$s</string>- <string name="notif_repeat_disable">Desativar repetição</string>- <string name="notif_repeat_disable_one">Desativar repetir uma</string>- <string name="notif_repeat_enable">Ativar repetição</string>- <string name="bridge_player_unlocked">Reprodutor desbloqueado</string>- <string name="bridge_reloading">Recarregando…</string>- <string name="service_disabled_message">O serviço não está ativado</string><string name="energy_saver_title">Poupança de bateria</string><string name="energy_saver_summary">Canvas desligado, vídeos e animações mais leves</string><string name="video_fullscreen_enter">Entrar em ecrã inteiro</string>@@ -39,4 +19,5 @@<string name="playback_seek_description">Posição de reprodução</string><string name="account_page_title">Conta Spotify</string><string name="account_page_detail">Plano, privacidade e dispositivos, em spotify.com</string>+ <string name="player_source_downloaded">Baixada</string></resources>diff --git a/base/app/src/main/res/values-ro/spotify_strings.xml b/base/app/src/main/res/values-ro/spotify_strings.xmlindex efe2d01b..0807ed42 100644--- a/base/app/src/main/res/values-ro/spotify_strings.xml+++ b/base/app/src/main/res/values-ro/spotify_strings.xml@@ -17,7 +17,6 @@<string name="snackbar_added_to_liked_songs" formatted="false">Adăugată în Melodii apreciate.</string><string name="snackbar_removed_from_liked_songs" formatted="false">Eliminată din Melodii apreciate.</string><string name="content_description_context_menu" formatted="false">Mai multe opțiuni</string>- <string name="close_button_content_description" formatted="false">Închide</string><string name="add_to_playlist_saved_in_section_header" formatted="false">Salvat în</string><string name="add_to_playlist_new_playlist_button_text" formatted="false">Playlist nou</string><string name="add_to_playlist_button_cancel" formatted="false">Anulează</string>@@ -25,8 +24,6 @@<string name="lyrics_card_title" formatted="false">Versuri</string><string name="lyrics_card_title_preview" formatted="false">Fragment versuri</string><string name="lyrics_card_show_lyrics_button" formatted="false">Afișează versurile</string>- <string name="lyrics_card_expand_button_content_description" formatted="false">Deschide versurile pe ecran complet</string>- <string name="lyrics_card_share_button_content_description" formatted="false">Distribuie versurile</string><string name="lyrics_credential_note" formatted="false">Versuri furnizate de %1$s</string><string name="lyrics_fullscreen_chip_label_share" formatted="false">Distribuie</string><string name="lyrics_fullscreen_chip_label_translate" formatted="false">Tradu</string>@@ -49,7 +46,6 @@<string name="artist_popular_tracks" formatted="false">Popular</string><string name="curation_button_follow_state_text" formatted="false">Urmărește</string><string name="curation_button_following_state_text" formatted="false">Urmărești</string>- <string name="search_main_entity_subtitle_artist" formatted="false">Artist</string><string name="connect_phone_is_self" formatted="false">Acest telefon</string><string name="settings_item_canvas_title" formatted="false">Canvas</string><string name="video_settings_canvas_subtitle" formatted="false">Conținut video scurt, afișat în buclă în timpul redării unei melodii.</string>@@ -107,8 +103,6 @@<string name="library_search_text_hint" formatted="false">Caută în Biblioteca ta</string><string name="account_title" formatted="false">Cont</string><string name="song_dna_search_chip_followed_artists" formatted="false">Artiști urmăriți</string>- <string name="settings_item_crossfade_title" formatted="false">Trecere progresivă între melodii</string>- <string name="playback_settings_crossfade_slider_seconds" formatted="false">%1$d s</string><string name="local_files_title" formatted="false">Fișiere locale</string><string name="local_files_empty_section_title" formatted="false">Adaugă propriile fișiere audio în Biblioteca ta</string><string name="local_files_empty_section_subtitle" formatted="false">Ai o melodie sau un podcast personal care nu este pe Spotify?</string>@@ -138,14 +132,10 @@<string name="assisted_curation_search_filter_artists" formatted="false">Artiști</string><string name="assisted_curation_search_filter_albums" formatted="false">Albume</string><string name="assisted_curation_search_filter_playlists" formatted="false">Playlisturi</string>- <string name="assisted_curation_search_filter_clear_content_description" formatted="false">Șterge filtrul</string>- <string name="ad_category_title_music" formatted="false">Muzică</string>- <string name="made_for_you_hub_title" formatted="false">Realizat pentru tine</string><string name="settings_item_app_language_title" formatted="false">Limba aplicației</string><string name="create_menu_item_folder_title" formatted="false">Folder</string><string name="create_folder_name_suggested_folder_name" formatted="false">Folder nou</string><string name="context_menu_rename_folder" formatted="false">Redenumește folderul</string>- <string name="your_library_messaging_folder_rename_hint" formatted="false">Numele folderului</string><string name="create_playlist_content_description" formatted="false">Creează un playlist</string><string name="actions_picker_delete" formatted="false">Șterge</string><string name="filter_and_sort_sort_section_title" formatted="false">Sortează după</string>diff --git a/base/app/src/main/res/values-ru/extensions_strings.xml b/base/app/src/main/res/values-ru/extensions_strings.xmlnew file mode 100644index 00000000..19866ec9--- /dev/null+++ b/base/app/src/main/res/values-ru/extensions_strings.xml@@ -0,0 +1,211 @@+<?xml version="1.0" encoding="utf-8"?>+<resources>+ <string name="extensions_title">Расширения</string>+ <string name="extensions_row_detail">Тексты песен, источник звука трека и скрипты, написанные другими, в песочнице.</string>+ <string name="extensions_install_file">Установить из файла</string>+ <string name="extensions_install_url">Установить по адресу</string>+ <string name="extensions_url_hint">https://…/extension.zip</string>+ <string name="extensions_none">Расширений не установлено.</string>+ <string name="extensions_installed">Установленные</string>+ <string name="extensions_repository_add">Добавить репозиторий</string>+ <string name="extensions_repository_hint">https://…/index.json</string>+ <string name="extensions_repository_warning">Myspoti не проверяет добавленный вами репозиторий: всё, что вы из него установите, — на ваш страх и риск.</string>+ <string name="extensions_repository_remove">Удалить</string>+ <string name="extensions_repository_refresh">Обновить</string>+ <string name="extensions_install">Установить</string>+ <string name="extensions_update">Обновить</string>+ <string name="extensions_up_to_date">Установлено</string>+ <string name="extensions_cancel">Отмена</string>+ <string name="extensions_loading">Чтение…</string>+ <string name="extensions_error">Не установлено: %1$s</string>+ <string name="extensions_prompt_title_install">Установить %1$s?</string>+ <string name="extensions_prompt_title_update">Обновить %1$s?</string>+ <string name="extensions_prompt_by">%1$s · версия %2$s · %3$s</string>+ <string name="extensions_prompt_source">Источник: %1$s</string>+ <string name="extensions_prompt_source_file">файл на этом телефоне</string>+ <string name="extensions_prompt_new">новое в этой версии</string>+ <string name="extensions_prompt_update_same_rights">%1$s → %2$s, с теми же правами.</string>+ <string name="extensions_prompt_not_newer">Версия %1$s (или более новая) уже установлена.</string>+ <string name="extensions_prompt_sha">sha256 пакета: %1$s</string>+ <string name="extension_enabled">Включено</string>+ <string name="extension_running">Работает</string>+ <string name="extension_not_running">Не работает</string>+ <string name="extension_turned_off">%1$s отключено: %2$s</string>+ <string name="extension_last_error">Последняя ошибка: %1$s</string>+ <string name="extension_disabled_reason">Отключено: %1$s</string>+ <string name="extension_inactive">Неактивно</string>+ <string name="extension_inactive_detail">Неактивно: %1$s</string>+ <string name="extension_homepage">Сайт</string>+ <string name="extension_settings">Настройки</string>+ <string name="extension_log">Журнал</string>+ <string name="extension_log_empty">В журнале пока ничего нет.</string>+ <string name="extension_log_clear">Очистить журнал</string>+ <string name="extension_update_file">Обновить из файла</string>+ <string name="extension_uninstall">Удалить</string>+ <string name="extension_uninstall_confirm">Удалить %1$s? Вместе с ним исчезнут его настройки и сохранённые данные.</string>+ <string name="extension_confirm_title">Расширение спрашивает</string>+ <string name="extension_confirm_detail">Ничего не изменится, пока вы не разрешите.</string>+ <string name="extension_confirm_allow">Разрешить</string>+ <string name="extension_confirm_refuse">Отклонить</string>+ <string name="extensions_row_count">Установлено: %1$d, включено: %2$d</string>+ <string name="extensions_tab_store">Каталог</string>+ <string name="extensions_search">Поиск расширений</string>+ <string name="extensions_cat_all">Все</string>+ <string name="extensions_cat_lyrics">Тексты</string>+ <string name="extensions_cat_playback">Воспроизведение и звук</string>+ <string name="extensions_cat_library">Медиатека</string>+ <string name="extensions_cat_discovery">Открытия</string>+ <string name="extensions_cat_stats">Статистика</string>+ <string name="extensions_cat_look">Оформление</string>+ <string name="extensions_cat_social">Общение</string>+ <string name="extensions_cat_tools">Инструменты</string>+ <string name="extensions_cat_other">Другое</string>+ <string name="extensions_no_match">Подходящих расширений нет.</string>+ <string name="extensions_browse_store">Открыть каталог</string>+ <string name="extensions_other_ways">Другие способы установки</string>+ <string name="extensions_empty_title">Что такое расширения?</string>+ <string name="extensions_empty_body">Расширения добавляют в Myspoti то, чего приложение само не умеет: тексты из других источников, откуда берётся звук или загрузка трека, инструменты, работающие с вашим аккаунтом Spotify. Каждое работает в песочнице и спрашивает разрешения, прежде чем к чему-либо обратиться. Добавьте репозиторий, чтобы просматривать их, или установите пакет, которому доверяете.</string>+ <string name="extensions_official_badge">Официальный</string>+ <string name="extensions_repo_yours">Добавлен вами</string>+ <string name="extensions_repo_community">Сообщество</string>+ <string name="extensions_repo_official_note">Каждое расширение проверяется, прежде чем попасть в список.</string>+ <string name="extensions_repo_yours_note">Не проверен Myspoti: устанавливайте на свой страх и риск.</string>+ <string name="extensions_repo_error">Не удалось прочитать этот репозиторий: %1$s</string>+ <string name="extensions_repo_empty">В этом репозитории нет расширений.</string>+ <string name="extensions_requires">Требуется Myspoti %1$s или новее</string>+ <string name="extensions_requires_api">Создано для более нового Myspoti (API расширений %1$d)</string>+ <string name="extensions_update_badge">Обновление</string>+ <string name="extensions_move_up">Выше</string>+ <string name="extensions_move_down">Ниже</string>+ <string name="extension_off">Выключено</string>+ <string name="extension_by">автор: %1$s</string>+ <string name="extension_changelog">Что нового</string>+ <string name="extension_update_from">Доступно обновление: %1$s → %2$s</string>+ <string name="extension_not_listed">Этого расширения нет в ваших репозиториях (или они ещё загружаются).</string>+ <string name="extension_details">Подробности</string>+ <string name="extension_detail_updated">Обновлено</string>+ <string name="extension_detail_min_app">Требуется Myspoti</string>+ <string name="extension_detail_size">Размер</string>+ <string name="extension_detail_id">Id</string>+ <string name="extension_detail_sha">sha256 пакета</string>+ <string name="extension_detail_source">Установлено из</string>+ <string name="extension_see_in_store">Открыть в каталоге</string>++ <!-- Actions: the closed catalogue, as the user reads it -->+ <string name="action_playback_control">Управлять воспроизведением</string>+ <string name="action_playback_queue">Изменять очередь</string>+ <string name="action_playback_events">Знать, что вы слушаете</string>+ <string name="action_lyrics_provide">Предоставлять тексты</string>+ <string name="action_trackinfo_provide">Добавлять сведения о треках</string>+ <string name="action_audio_source">Воспроизводить звук из другого источника</string>+ <string name="action_download_source">Предоставлять загрузки</string>+ <string name="action_home_sections">Добавлять разделы на главную</string>+ <string name="action_search_provide">Добавлять результаты поиска</string>+ <string name="action_menu_items">Добавлять пункты в меню</string>+ <string name="action_player_buttons">Добавлять кнопки в плеер</string>+ <string name="action_settings_page">Собственные настройки</string>+ <string name="action_notify">Показывать короткие сообщения</string>+ <string name="action_library_read">Читать вашу медиатеку</string>+ <string name="action_library_write">Изменять вашу медиатеку</string>+ <string name="action_playlists_write">Изменять ваши плейлисты</string>+ <string name="action_spotify_catalog">Просматривать Spotify</string>+ <string name="action_spotify_raw">Полный доступ к Spotify</string>+ <string name="action_network">Пользоваться интернетом</string>+ <string name="action_network_any">Обращаться к любому сайту</string>+ <string name="action_webview_page">Собственная веб-страница</string>+ <string name="action_storage">Хранить собственные данные</string>+ <string name="action_unknown">Неизвестно этой версии Myspoti</string>+ <string name="action_critical">Критично</string>+ <string name="action_no_why">(причина не указана)</string>+ <string name="actions_title">Что делает</string>+ <string name="actions_critical_warning">Критичные действия могут менять ваш аккаунт, подменять источник треков или показывать произвольную веб-страницу. Разрешайте их, только если доверяете автору: Myspoti всё равно спросит, прежде чем что-либо удалить.</string>+ <!-- Areas of the Installed tab -->+ <string name="area_playback">Воспроизведение</string>+ <string name="area_lyrics">Тексты и сведения о треках</string>+ <string name="area_audio">Звук и загрузки</string>+ <string name="area_home">Главная и поиск</string>+ <string name="area_menus">Меню и плеер</string>+ <string name="area_library">Медиатека и Spotify</string>+ <string name="area_other">Страницы и прочее</string>+ <string name="area_activity">Недавняя активность</string>+ <string name="area_turn_off">Отключить</string>+ <string name="area_active">Активно</string>+ <string name="area_idle">Простаивает</string>+ <string name="area_make_active">Сделать основным для: %1$s</string>+ <!-- Install prompt -->+ <string name="ext_third_party_notice">Стороннее расширение, не проверено Myspoti, на ответственности его автора.</string>+ <string name="ext_risk_accept">Я понимаю, что это расширение создано третьей стороной, и устанавливаю его под свою ответственность</string>+ <string name="ext_clash_exclusive">Заменяет %1$s, которое сейчас предоставляет %2$s</string>+ <string name="ext_clash_conflict">Несовместимо с %1$s (установлено)</string>+ <string name="ext_clash_replaces">Заменяет %1$s (установлено)</string>+ <string name="ext_clash_keep_new">Использовать %1$s (другое остаётся установленным, %2$s)</string>+ <string name="ext_clash_keep_old">Оставить %1$s</string>+ <string name="ext_clash_idle">простаивает</string>+ <string name="ext_clash_off">выключено</string>+ <string name="ext_clash_title">Какое оставить?</string>+ <string name="ext_clash_ok">Готово</string>+ <!-- Blocks and pages -->+ <string name="ext_from">От %1$s</string>+ <string name="ext_overflow">Расширения</string>+ <string name="ext_open_page">Открыть его страницу</string>+ <string name="ext_page_failed">Не удалось показать страницу этого расширения.</string>+ <string name="ext_suspended_title">%1$s приостановлено</string>+ <string name="ext_suspended_body">Оно постоянно отменяло то, что %1$s делало с воспроизведением: его команды воспроизведения приостановлены.</string>+ <string name="ext_suspended_keep">Пусть работает</string>++ <!-- GitHub: discovery, ratings, reports -->+ <string name="extensions_github_title">На GitHub</string>+ <string name="extensions_github_note">Публичные репозитории с темой myspoti-extension, не проверены: каждый — на ответственности своего автора.</string>+ <string name="extensions_show_all">Показать все (скрыто: %1$d)</string>+ <string name="extensions_show_less">Скрыть заблокированные, с жалобами, с низкой оценкой и заброшенные</string>+ <string name="extension_rating">★ %1$s · голосов: %2$d</string>+ <string name="extension_rating_none">Голосов пока нет</string>+ <string name="extension_downloads">Загрузок: %1$s</string>+ <string name="extension_rate_up">Оценить положительно</string>+ <string name="extension_rate_down">Оценить отрицательно</string>+ <string name="extension_rated">Спасибо: ваш голос отправлен на GitHub</string>+ <string name="extension_signin_title">Войти в GitHub</string>+ <string name="extension_signin_body">Откройте %1$s и введите этот код. Myspoti никогда не видит ваш пароль.</string>+ <string name="extension_signin_open">Открыть GitHub</string>+ <string name="extension_report">Пожаловаться</string>+ <string name="extension_detail_github">GitHub</string>+ <string name="extension_detail_ref">Версия на GitHub</string>++ <!-- Updates from GitHub -->+ <string name="extension_check_updates">Проверить обновления</string>+ <string name="extension_check_up_to_date">Актуальная версия</string>+ <string name="extension_check_applied">Обновлено: ничего нового не запрашивает</string>+ <string name="extension_check_needs_ok">Обновление требует вашего согласия</string>+ <string name="extension_check_declined">Вы оставили эту версию</string>+ <string name="extension_check_incompatible">Новой версии нужен более новый Myspoti</string>+ <string name="extension_check_blocked">Новая версия заблокирована Myspoti</string>+ <string name="extension_check_failed">Не удалось проверить: см. журнал</string>+ <string name="extension_source_gone">Источник исчез: его репозитория больше нет. Расширение продолжает работать с копии на вашем телефоне.</string>+ <string name="extension_revert">Вернуться к %1$s</string>+ <string name="extension_reverted">Возврат к %1$s выполнен</string>+ <string name="extension_update_needs_ok">Обновление требует вашего согласия: %1$s → %2$s</string>+ <string name="extension_update_needs_ok_body">Эта версия запрашивает больше, чем вы принимали. Текущая продолжает работать, пока вы не решите.</string>+ <string name="extension_update_accept">Принять</string>+ <string name="extension_update_keep">Оставить текущую</string>+ <string name="extension_refused_title">Ждёт вашего согласия</string>+ <string name="extension_refused_body">Оно было установлено, когда действия можно было отключать, и некоторые были отключены. Теперь расширение получает все заявленные действия: оно выключено, пока вы их не примете.</string>+ <string name="extension_change_action">Новое: %1$s</string>+ <string name="extension_change_host">Новый сайт: %1$s</string>+ <string name="extension_change_any_host">Любой сайт</string>+ <string name="extension_change_exclusive">Теперь эксклюзивно: %1$s</string>+ <string name="extension_change_why">Новая причина для: %1$s</string>+ <string name="extension_change_was">Было: «%1$s»</string>+ <string name="extension_change_repo">Теперь из %1$s (было %2$s)</string>+ <string name="extension_change_author">Новый автор: %1$s (был %2$s)</string>+ <string name="extension_change_replaces">Отключает %1$s при установке</string>+ <string name="extension_change_conflicts">Отказывается работать вместе с %1$s</string>+ <string name="action_webview_auth">Войти на сайте</string>+ <string name="extension_confirm_once">Разрешить один раз</string>+ <string name="extension_confirm_always">Всегда разрешать %1$s</string>+ <string name="ext_auth_title">%1$s: вход</string>+ <string name="ext_auth_close">Закрыть</string>+ <string name="ext_auth_notice">Отдельная страница: введённое и её cookie остаются в Myspoti. Расширение получает только конечный адрес страницы.</string>+ <string name="ext_grants_title">Всегда разрешено</string>+ <string name="ext_grants_note">Изменения в Spotify, которые это расширение вносит без запроса. Отзовите одно, чтобы вас снова спрашивали.</string>+ <string name="ext_grant_revoke">Отозвать</string>+</resources>diff --git a/base/app/src/main/res/values-ru/myspoti_strings.xml b/base/app/src/main/res/values-ru/myspoti_strings.xmlnew file mode 100644index 00000000..e1a5586b--- /dev/null+++ b/base/app/src/main/res/values-ru/myspoti_strings.xml@@ -0,0 +1,465 @@+<?xml version="1.0" encoding="utf-8"?>+<!-- Myspoti's own texts (English default, French, Italian). -->+<resources>+ <string name="welcome_lead">Ваша музыка,</string>+ <string name="welcome_rotate_ads">без рекламы.</string>+ <string name="welcome_rotate_lyrics">с текстами по словам.</string>+ <string name="welcome_rotate_clips">с официальными клипами.</string>+ <string name="welcome_rotate_offline">офлайн, через расширения.</string>+ <string name="welcome_login">Войти через Spotify</string>+ <string name="welcome_privacy">Вы входите на странице самого Spotify. Myspoti никогда не видит ваш пароль.</string>+ <string name="remove_from_liked">Убрать из «Любимых треков»</string>+ <string name="repeat_on">Повтор: вкл.</string>+ <string name="repeat_one">Повтор одного трека</string>+ <string name="repeat_off">Повтор: выкл.</string>+ <string name="headphones">Наушники</string>+ <string name="listen_on">Слушать на</string>+ <string name="no_devices">Устройства не найдены</string>+ <string name="sleep_minutes">%1$d мин</string>+ <string name="playing_on">Играет на:</string>+ <string name="next_in_queue">Следующий в очереди</string>+ <string name="next_from">Далее из: %1$s</string>+ <string name="next_up">Далее</string>+ <string name="clear_queue">Очистить очередь</string>+ <string name="my_playlist">Мой плейлист</string>+ <string name="playlist_name">Название плейлиста</string>+ <string name="loading_playlists">Загрузка плейлистов…</string>+ <string name="couldnt_load">Не удалось загрузить: %1$s</string>+ <string name="nothing_here">Здесь пока ничего нет</string>+ <string name="album_not_found">Альбом не найден</string>+ <string name="liked_song">Любимый трек</string>+ <string name="verified_artist">Подтверждённый исполнитель</string>+ <string name="lyrics_share">Поделиться текстом</string>+ <string name="lyrics_extra_title">Другие источники текстов</string>+ <string name="lyrics_extra_summary">NetEase и Genius, когда в Spotify нет текста</string>+ <string name="lyrics_reload">Загрузить текст заново</string>+ <string name="lyrics_fullscreen">Открыть текст на весь экран</string>+ <string name="browse_all">Смотреть все</string>+ <string name="home_error">Не удалось загрузить главную.\nПроверьте соединение и повторите попытку.</string>+ <string name="home_retry">Повторить</string>+ <string name="home_empty">Пока нечего показать.</string>+ <string name="spotify_account">Аккаунт Spotify</string>+ <string name="spotify_user">Пользователь Spotify</string>+ <string name="list_view">Показать списком</string>+ <string name="grid_view">Показать сеткой</string>+ <string name="library_error">Не удалось загрузить медиатеку</string>+ <string name="library_empty">Ваша медиатека пуста</string>+ <string name="background_playback_title">Фоновое воспроизведение</string>+ <string name="background_playback_on">Оптимизация батареи отключена: музыка и Spotify Connect продолжают играть при выключенном экране.</string>+ <string name="background_playback_off">Отключите оптимизацию батареи, чтобы Android не приостанавливал приложение в фоне.</string>+ <plurals name="local_files_count">+ <item quantity="one">%d трек</item>+ <item quantity="few">%d трека</item>+ <item quantity="many">%d треков</item>+ <item quantity="other">%d трека</item>+ </plurals>+ <string name="local_files_none_subtitle">На этом устройстве не найдено подходящих аудиофайлов. Когда они появятся, вы увидите их здесь.</string>+ <string name="downloads_empty_title">Скачивайте, чтобы слушать офлайн</string>+ <string name="downloads_empty_subtitle">Нажмите «Скачать» в меню трека или кнопку загрузки у альбома или плейлиста.</string>+ <string name="downloads_source">Lossless FLAC, сверенный с оригинальной записью. Хранится только внутри Myspoti.</string>+ <string name="downloads_size">%1$s на этом телефоне</string>+ <string name="download_unavailable">Подходящая запись не найдена</string>+ <string name="download_retry">Повторить</string>+ <string name="download_cancel">Отменить загрузку</string>+ <string name="podcast_download_protected">Этот выпуск эксклюзивен для Spotify: его можно слушать только в приложении Spotify, скачать нельзя.</string>+ <string name="podcast_download_unavailable">Этот выпуск нельзя скачать: нет аудиофайла от издателя.</string>+ <string name="podcast_download_failed">Не удалось скачать. Повторите попытку.</string>+ <string name="not_signed_in">Вы вышли из Spotify. Войдите снова, чтобы это увидеть.</string>+ <string name="artist_not_found">Исполнитель не найден</string>+ <string name="playlist_not_found">Плейлист не найден</string>+ <string name="browse_new_releases">Новинки</string>+ <string name="language_auto">Автоматически</string>+ <string name="language_auto_detail">Язык вашего телефона, если он есть в Myspoti (английский, греческий, испанский, итальянский, китайский, немецкий, польский, португальский, русский, французский), иначе английский</string>+ <string name="language_partial_note">Остальные языки: переведены только надписи самого Spotify, тексты Myspoti остаются на английском.</string>+ <string name="restart_player_title">Перезапустить плеер</string>+ <string name="restart_player_detail">Если музыка не отвечает: перезагружает плеер Spotify</string>+ <string name="ad_playing">Реклама</string>+ <string name="track_unavailable_region">Недоступно в вашем регионе</string>+ <string name="diagnostic_export_title">Экспортировать диагностический отчёт</string>+ <string name="diagnostic_export_detail">Отправляет последний журнал приложения и данные об устройстве</string>+ <string name="diagnostic_export_failed">Не удалось записать диагностический отчёт</string>+ <string name="local_playlist_subtitle">На этом устройстве</string>+ <string name="local_playlist_new">Плейлист на этом устройстве</string>+ <string name="local_added_section">Добавлено на этом устройстве</string>+ <string name="local_add_note">Файлы телефона остаются на телефоне: Spotify не может их получить.</string>+ <string name="local_rename">Переименовать</string>+ <string name="local_delete_playlist">Удалить плейлист</string>+ <string name="local_added_to">Добавлено в «%1$s»</string>+ <string name="local_playlist_empty">Добавляйте треки из локальных файлов кнопкой +.</string>+ <string name="playlist_change_refused">Spotify отклонил изменение этого плейлиста</string>+ <string name="download_kept_by_list">Остаётся скачанным: его держит скачанный плейлист</string>+ <string name="support_title">Поддержать Myspoti</string>+ <string name="support_body">Myspoti бесплатен, без рекламы и создан в моё свободное время. Если он вам нравится, небольшое пожертвование поможет проекту жить дальше.</string>+ <string name="support_action">Поддержать на Ko-fi</string>+ <string name="support_decline">Нет, спасибо</string>+ <string name="support_row_detail">Небольшое пожертвование на Ko-fi или GitHub Sponsors помогает развивать приложение</string>+ <string name="supporter_perks_title">Бонусы для поддержавших</string>+ <string name="supporter_perks_detail">Цвет акцента, значок приложения и бейдж в знак благодарности</string>+ <string name="supporter_perks_locked">Открывается, если вы поддержали Myspoti. На честное слово: ничего не проверяется.</string>+ <string name="supporter_i_supported">Я поддержал(а) Myspoti</string>+ <string name="supporter_how">Как вы поддержали?</string>+ <string name="supporter_once">Пожертвование</string>+ <string name="supporter_monthly">Каждый месяц</string>+ <string name="supporter_badge">Поддержка</string>+ <string name="supporter_thanks_title">Спасибо за поддержку!</string>+ <string name="supporter_thanks_body">Если Myspoti по-прежнему вам полезен, новое небольшое пожертвование поможет проекту жить дальше.</string>+ <string name="support_again">Поддержать ещё раз</string>+ <string name="supporter_accent">Цвет акцента</string>+ <string name="supporter_icon">Значок приложения</string>+ <string name="supporter_icon_note">При смене значка ярлык на главном экране может исчезнуть: приложение останется в списке приложений.</string>+ <string name="supporter_monthly_switch">Я поддерживаю каждый месяц (без напоминаний)</string>+ <string name="color_green">Зелёный</string>+ <string name="color_blue">Синий</string>+ <string name="color_purple">Фиолетовый</string>+ <string name="color_pink">Розовый</string>+ <string name="color_orange">Оранжевый</string>+ <string name="about_detail">Версия, сообщество в Discord, исходный код</string>+ <string name="about_discord">Discord</string>+ <string name="about_discord_detail">Новости, помощь и идеи: присоединяйтесь к сообществу</string>+ <string name="about_github">Исходный код</string>+ <string name="about_github_detail">Релизы, задачи и код на GitHub</string>+ <string name="about_free">Бесплатно, с открытым кодом и без рекламы. Не связано со Spotify.</string>+ <string name="library_reorder_hint">Удерживайте плейлист и перетащите, чтобы переместить</string>+ <string name="library_reorder_reset">Вернуть порядок Spotify</string>+ <string name="song_radio_failed">Не удалось открыть радио этого трека</string>+ <string name="song_radio_name">Радио: %1$s</string>+ <string name="local_files_find_hint">Найти в локальных файлах</string>+ <string name="data_saver_title">Экономия трафика</string>+ <string name="data_saver_summary">В мобильной сети Myspoti не расходует трафик: играют только скачанные треки и локальные файлы</string>+ <string name="data_saver_blocked">Экономия трафика: в мобильной сети играют только скачанные треки и локальные файлы</string>+ <string name="new_releases_followed">От исполнителей, на которых вы подписаны</string>+ <string name="new_releases_latest">Последние релизы</string>+ <string name="your_episodes_title">Ваши выпуски</string>+ <string name="your_episodes_empty">Сохранённые выпуски появятся здесь.</string>+ <string name="recap_title">Ваш итог</string>+ <string name="recap_month">30 дней</string>+ <string name="recap_year">12 месяцев</string>+ <string name="recap_all">За всё время</string>+ <string name="recap_minutes">%1$d мин</string>+ <string name="recap_listens">Прослушиваний: %1$d</string>+ <string name="recap_sources">Spotify %1$d мин • Загрузки %2$d мин • Локальные файлы %3$d мин</string>+ <string name="recap_empty">Послушайте немного: здесь появятся ваши любимые треки и исполнители.</string>+ <string name="recently_played_empty">Всё, что вы слушаете в этом аккаунте, появится здесь.</string>+ <string name="recently_played_failed">Не удалось загрузить список недавно прослушанного (%1$s)</string>+ <string name="recents_title">Недавнее</string>+ <string name="recents_detail">Что вы слушали, на всех устройствах</string>+ <string name="recents_filter_music">Музыка</string>+ <string name="recents_filter_podcasts">Подкасты</string>+ <string name="recents_today">Сегодня</string>+ <string name="recents_yesterday">Вчера</string>+ <string name="recents_played_one">Прослушан 1 трек</string>+ <string name="recents_played_many">Прослушано треков: %1$d</string>+ <string name="recents_saved_one">Добавлен 1 трек</string>+ <string name="recents_saved_many">Добавлено треков: %1$d</string>+ <string name="recents_expand">Показать треки</string>+ <string name="recents_collapse">Скрыть треки</string>+ <string name="recap_plays">Прослушиваний: %1$d</string>+ <string name="recap_top_tracks">Топ треков</string>+ <string name="recap_top_artists">Топ исполнителей</string>+ <string name="recap_top_albums">Топ альбомов</string>+ <string name="recap_private_note">Учитывает всё, что воспроизведено в Myspoti (Spotify, загрузки, локальные файлы). Хранится только на этом телефоне и никогда не отправляется в Spotify.</string>+ <string name="recap_detail">Ваше прослушивание, включая загрузки и локальные файлы</string>+ <string name="track_credits">Авторы</string>+ <string name="exclude_taste">Исключить из музыкального профиля</string>+ <string name="include_taste">Включить в музыкальный профиль</string>+ <string name="playback_speed">Скорость воспроизведения</string>+ <string name="recommended_songs">Рекомендуемые треки</string>+ <string name="jam_title">Jam</string>+ <string name="jam_leave">Выйти из Jam</string>+ <string name="jam_members">Слушают: %1$d</string>+ <string name="jam_start">Запустить Jam</string>+ <string name="jam_invite">Поделиться ссылкой-приглашением</string>+ <string name="jam_failed">Spotify отклонил этот Jam</string>+ <string name="jam_scan">Сканировать QR-код Jam</string>+ <string name="beta_logs_title">Журнал за последние %1$d мин</string>+ <string name="beta_logs_copy">Копировать</string>+ <string name="beta_logs_copied">Журнал скопирован</string>+ <string name="beta_logs_share">Поделиться</string>+ <string name="beta_logs_close">Закрыть</string>+ <string name="widget_description">Сейчас играет, с кнопками воспроизведения и перемотки</string>+ <string name="widget_previous">Предыдущий</string>+ <string name="widget_next">Следующий</string>+ <string name="widget_play_pause">Воспроизвести или пауза</string>+ <string name="offline_only_downloaded">Офлайн: играют только скачанные треки (%1$d из %2$d)</string>+ <string name="track_sort_title">Название</string>+ <string name="track_sort_artist">Исполнитель</string>+ <string name="track_sort_album">Альбом</string>+ <string name="track_sort_duration">Длительность</string>+ <string name="setup_title">Настройка Myspoti</string>+ <string name="setup_subtitle">Разрешите что хотите; позже это можно изменить в настройках телефона.</string>+ <string name="setup_notifications_title">Уведомления</string>+ <string name="setup_notifications_detail">Управление на экране блокировки и в шторке уведомлений</string>+ <string name="setup_local_title">Локальная музыка</string>+ <string name="setup_local_detail">Воспроизведение музыкальных файлов, хранящихся на телефоне</string>+ <string name="setup_bluetooth_title">Bluetooth</string>+ <string name="setup_bluetooth_detail">Показывать в плеере название ваших наушников или колонки</string>+ <string name="setup_battery_title">Без ограничений батареи</string>+ <string name="setup_battery_detail">Музыка продолжает играть при выключенном экране</string>+ <string name="setup_enable">Разрешить</string>+ <string name="setup_continue">Продолжить</string>+ <string name="local_folders_button">Папки</string>+ <string name="local_folders_title">Папки</string>+ <string name="local_folders_detail">Выберите папки, показываемые в локальных файлах. Мессенджеры и записи изначально скрыты.</string>+ <string name="smart_shuffle_title">Умное перемешивание</string>+ <string name="smart_shuffle_on">Умное перемешивание: рекомендации Spotify добавляются в перемешанный плейлист.</string>+ <string name="track_sort_added">Дата добавления</string>+ <string name="settings_title">Настройки</string>+ <string name="settings_detail">Качество звука, загрузки, трафик, батарея и язык</string>+ <string name="settings_section_playback">Воспроизведение</string>+ <string name="settings_section_downloads">Загрузки</string>+ <string name="settings_section_data">Трафик и батарея</string>+ <string name="settings_section_display">Экран и язык</string>+ <string name="settings_section_app">Приложение</string>+ <string name="quality_streaming_title">Качество стриминга</string>+ <string name="quality_streaming_detail">Что плеер получает по сети.</string>+ <string name="quality_streaming_auto">Автоматически</string>+ <string name="quality_streaming_auto_detail">Подстраивается под ваше соединение</string>+ <string name="quality_streaming_low">Самое низкое</string>+ <string name="quality_streaming_low_detail">24 кбит/с, минимум: расходует меньше всего трафика</string>+ <string name="quality_streaming_normal">Обычное</string>+ <string name="quality_streaming_normal_detail">96 кбит/с, хороший баланс звука и трафика</string>+ <string name="quality_streaming_high">Высокое</string>+ <string name="quality_download_title">Качество загрузки</string>+ <string name="quality_download_detail">Как треки сохраняются для прослушивания офлайн.</string>+ <string name="quality_download_off">Выкл.</string>+ <string name="quality_download_off_detail">Без загрузок</string>+ <string name="quality_download_cd">FLAC, качество CD</string>+ <string name="quality_download_cd_detail">Lossless 16 бит, около 30 МБ на трек</string>+ <string name="quality_download_hires">FLAC Hi-Res</string>+ <string name="quality_download_hires_detail">24 бит, если доступно; файлы примерно втрое больше</string>+ <string name="setup_quality_title">Качество звука</string>+ <string name="setup_quality_subtitle">Выберите, как Myspoti воспроизводит и сохраняет вашу музыку. Позже это можно изменить в настройках.</string>+ <string name="downloads_off_toast">Загрузки отключены. Включите их в настройках.</string>+ <string name="quality_streaming_high_detail">160 кбит/с, лучший звук</string>+ <string name="quality_download_small">Наименьшее</string>+ <string name="quality_download_small_detail">AAC 96 кбит/с, самое лёгкое: около 3 МБ на трек</string>+ <string name="settings_solid_nav_title">Сплошная нижняя панель</string>+ <string name="settings_solid_nav_detail">Чёрный фон под вкладками вместо затухания поверх списка</string>+ <string name="quality_download_ask">Спрашивать каждый раз</string>+ <string name="quality_download_ask_detail">Выбирать при начале загрузки, один раз для всего плейлиста</string>+ <string name="quality_sheet_title">Качество звука</string>+ <string name="quality_now">Сейчас играет: %1$s</string>+ <string name="quality_now_unknown">Пока неизвестно: запустите трек</string>+ <string name="update_downloading">Загрузка… %1$d%%</string>+ <string name="update_installing">Установка…</string>+ <string name="update_needs_permission">Чтобы обновиться, разрешите Myspoti устанавливать приложения и вернитесь сюда.</string>+ <string name="update_allow">Разрешить</string>+ <string name="update_failed">Не удалось обновить: %1$s</string>+ <string name="update_retry">Повторить</string>+ <!-- A18: the automatic update check can be turned off; the manual check stays. -->+ <string name="settings_auto_update_title">Проверять обновления при запуске</string>+ <string name="settings_auto_update_detail">Выкл.: при запуске приложения проверки нет. Ручная проверка ниже по-прежнему работает.</string>+ <string name="settings_check_update_title">Проверить обновления сейчас</string>+ <string name="settings_check_update_detail">Ищет новую версию и предлагает её установить</string>+ <string name="settings_update_checking">Проверка…</string>+ <string name="settings_update_check_latest">У вас последняя версия Myspoti</string>+ <!-- A25: stop the queue, keep the songs already downloaded. -->+ <string name="downloads_stop_all_title">Остановить все загрузки</string>+ <string name="downloads_stop_all_detail">Отменяет оставшееся; уже скачанные треки сохраняются</string>+ <string name="removed_from">Удалено из «%1$s»</string>+ <!-- Track options inside a playlist (A11/A12). -->+ <string name="context_menu_remove_from_playlist">Удалить из этого плейлиста</string>+ <string name="context_menu_add_to_another_playlist">Добавить в другой плейлист</string>+ <string name="add_to_playlist_search_hint">Найти плейлист</string>+ <string name="add_to_playlist_empty">У вас нет плейлиста, в который можно добавить этот трек</string>+ <string name="add_to_playlist_no_match">Нет плейлистов по запросу «%1$s»</string>+ <string name="undo">Отменить</string>+ <string name="done">Готово</string>+ <string name="playlist_edit_details">Изменить данные</string>+ <string name="playlist_name_label">Название</string>+ <string name="playlist_description_label">Описание</string>+ <string name="playlist_change_cover">Изменить обложку</string>+ <string name="playlist_remove_cover">Удалить обложку</string>+ <string name="playlist_save">Сохранить</string>+ <string name="playlist_access_title">Кто может видеть</string>+ <string name="choose_artist">Выберите исполнителя</string>+ <string name="quality_streaming_wifi_title">Стриминг по Wi-Fi</string>+ <string name="quality_streaming_cell_title">Стриминг по мобильной сети</string>+ <string name="canvas_wifi_only">Canvas только по Wi-Fi</string>+ <string name="canvas_wifi_only_detail">Зацикленные видео воспроизводятся по Wi-Fi, но не в мобильной сети</string>+ <string name="playlist_delete_confirm">Удалить «%1$s»? Его можно восстановить в аккаунте Spotify в течение 90 дней.</string>+ <string name="playlist_saved">Плейлист обновлён</string>+ <string name="go_to_profile">Перейти в профиль</string>+ <string name="cancel">Отмена</string>+ <plurals name="profile_followers">+ <item quantity="one">%1$d подписчик</item>+ <item quantity="few">%1$d подписчика</item>+ <item quantity="many">%1$d подписчиков</item>+ <item quantity="other">%1$d подписчика</item>+ </plurals>+ <string name="profile_following_count">Подписки: %1$d</string>+ <string name="profile_public_playlists">Открытые плейлисты</string>+ <string name="profile_followers_title">Подписчики</string>+ <string name="profile_following_title">Подписки</string>+ <string name="profile_list_empty">Пока никого нет</string>+ <string name="artist_ban">Не воспроизводить этого исполнителя</string>+ <string name="artist_unban">Разрешить воспроизведение этого исполнителя</string>+ <string name="artist_banned">%1$s больше не будет играть в ваших миксах и радио</string>+ <string name="artist_unbanned">%1$s снова может играть</string>+ <string name="episode_save">Добавить в «Ваши выпуски»</string>+ <string name="episode_unsave">Убрать из «Ваших выпусков»</string>+ <string name="search_filter_profiles">Профили</string>+ <string name="view_profile">Открыть профиль</string>+ <string name="folder_delete">Удалить папку</string>+ <string name="folder_delete_confirm">Удалить папку «%1$s»? Её плейлисты останутся в медиатеке.</string>+ <string name="library_pin">Закрепить</string>+ <string name="library_unpin">Открепить</string>+ <string name="library_move_to_folder">Переместить в папку</string>+ <string name="library_top_level">Ваша медиатека (верхний уровень)</string>+ <string name="more_like_this">Похожее</string>+ <string name="library_sort_recents">Недавние</string>+ <string name="library_sort_recently_added">Недавно добавленные</string>+ <string name="library_change_failed">Не удалось обновить медиатеку, повторите попытку</string>+ <string name="a11y_close_player">Закрыть плеер</string>+ <string name="a11y_share">Поделиться</string>+ <string name="search_failed">Поиск не удался. Проверьте соединение.</string>+ <string name="retry_button">Повторить</string>+ <string name="page_load_failed">Не удалось загрузить страницу.\nПроверьте соединение и повторите попытку.</string>+ <string name="jam_paste_link">Присоединиться по скопированной ссылке</string>+ <string name="play_refused">Spotify отказался воспроизводить это в вашем аккаунте. Бесплатные аккаунты в некоторых странах могут играть только в режиме перемешивания: нажмите кнопку перемешивания.</string>+ <string name="play_refused_all">Spotify сейчас отклоняет все команды этого плеера для вашего аккаунта (воспроизведение, перемотка, передача). Плеер уже один раз перезагружен; если ничего не играет, полностью закройте приложение и откройте его снова или переключитесь между Wi-Fi и мобильным интернетом.</string>+ <string name="drm_missing">Воспроизведение здесь невозможно: в Android System WebView этого телефона нет работающего DRM Widevine, который нужен Spotify. Обновите Android System WebView и Chrome в Play Маркете и выберите его в Настройки > Для разработчиков > Реализация WebView.</string>+ <string name="artist_liked_songs">Любимые треки</string>+ <plurals name="artist_liked_songs_count">+ <item quantity="one">%1$d трек • %2$s</item>+ <item quantity="few">%1$d трека • %2$s</item>+ <item quantity="many">%1$d треков • %2$s</item>+ <item quantity="other">%1$d трека • %2$s</item>+ </plurals>+ <string name="share_link">Поделиться ссылкой</string>+ <string name="share_as_image">Поделиться изображением</string>+ <string name="settings_autoplay_title">Автовоспроизведение</string>+ <string name="settings_autoplay_detail">Когда ваша музыка закончится, продолжать воспроизведение похожих треков</string>+ <string name="settings_crossfade_title">Плавный переход (треки затихают, но не накладываются)</string>+ <string name="settings_crossfade_detail">Трек затихает в последние секунды, следующий плавно нарастает. Они никогда не звучат одновременно: один плеер, один аудиопоток.</string>+ <string name="settings_crossfade_off">Выкл.</string>+ <string name="settings_crossfade_seconds">%1$d с</string>+ <string name="settings_rotation_title">Поворот экрана</string>+ <string name="settings_rotation_portrait">Портретная</string>+ <string name="settings_rotation_auto">Автоматически</string>+ <string name="settings_rotation_landscape">Альбомная</string>+ <string name="support_github_action">Поддержать на GitHub</string>+ <string name="download_on_mobile_data">Загрузка по мобильной сети: расходуется ваш трафик</string>++ <!-- Podcast show page, episode page and podcast player -->+ <string name="show_follow">Подписаться</string>+ <string name="show_following">Вы подписаны</string>+ <string name="show_tab_episodes">Выпуски</string>+ <string name="show_tab_chapters">Главы</string>+ <string name="show_tab_about">О подкасте</string>+ <string name="show_sort_newest">Все выпуски • Сначала новые</string>+ <string name="show_sort_oldest">Все выпуски • Сначала старые</string>+ <string name="show_sort_chapters_newest">Все главы • Сначала новые</string>+ <string name="show_sort_chapters_oldest">Все главы • Сначала старые</string>+ <string name="show_empty">Пока нечего воспроизводить</string>+ <string name="show_authors">Автор: %1$s</string>+ <string name="show_narrators">Читает: %1$s</string>+ <string name="episode_duration_min">%1$d мин</string>+ <string name="episode_remaining">Осталось %1$s</string>+ <string name="episode_mark_played">Отметить как прослушанное</string>+ <string name="episode_mark_unplayed">Отметить как непрослушанное</string>+ <string name="episode_marked_played">Отмечено как прослушанное</string>+ <string name="episode_marked_unplayed">Отмечено как непрослушанное</string>+ <string name="episode_play">Воспроизвести</string>+ <string name="episode_open">Открыть выпуск</string>+ <string name="episode_add_queue">Добавить в очередь</string>+ <string name="episode_show_more">показать больше</string>+ <string name="episode_show_less">показать меньше</string>+ <string name="episode_download">Скачать</string>+ <string name="episode_download_remove">Удалить загрузку</string>+ <string name="episode_options">Параметры выпуска</string>+ <string name="episode_not_found">Выпуск не найден</string>+ <string name="podcast_playing_from">Воспроизводится из подкаста</string>+ <string name="player_speed_chip">%1$s×</string>+ <string name="player_back_15">Назад на 15 секунд</string>+ <string name="player_forward_15">Вперёд на 15 секунд</string>+ <string name="player_sleep_timer">Таймер сна</string>+ <string name="restart_player_done">Плеер перезапущен</string>+ <string name="spotify_limited">Spotify ненадолго ограничил воспроизведение. Повторите через минуту.</string>+ <string name="library_change_undone">Spotify отклонил изменение, ваша медиатека вернулась к прежнему виду</string>+ <string name="blend_title">Blend</string>+ <string name="blend_detail">Плейлист, смешанный из вашего вкуса и вкуса друга</string>+ <string name="blend_invite">Пригласить друга в Blend</string>+ <string name="blend_join">Присоединиться по ссылке</string>+ <string name="blend_join_title">Вставьте ссылку-приглашение</string>+ <string name="blend_join_button">Присоединиться</string>+ <string name="blend_invite_message">Давай создадим Blend в Spotify: %1$s</string>+ <string name="blend_failed">Не удалось связаться с Blend в Spotify, повторите попытку</string>+ <string name="blend_bad_link">Это не ссылка-приглашение в Blend</string>+ <string name="blend_own_invite">Это ваше собственное приглашение: отправьте его другу</string>+ <string name="blend_full">Этот Blend заполнен</string>+ <string name="blend_deleted">Этот Blend удалён</string>+ <string name="blend_working">Выполняется…</string>+ <string name="blend_invited_by">%1$s приглашает вас в Blend</string>+ <string name="blend_later">Не сейчас</string>+ <string name="blend_members">Участники</string>+ <string name="blend_invite_more">Пригласить ещё людей</string>+ <string name="blend_rename">Переименовать Blend</string>+ <string name="blend_leave">Покинуть Blend</string>+ <string name="blend_leave_confirm">Покинуть «%1$s»? Он исчезнет из вашей медиатеки, а у остальных останется.</string>+ <string name="blend_leave_button">Покинуть</string>+ <string name="playlist_invite_banner">Вас приглашают участвовать в этом плейлисте</string>+ <string name="playlist_invite_join">Присоединиться</string>+ <string name="playlist_invite_joined">Теперь вы соавтор</string>+ <string name="settings_keep_playing_title">Продолжать играть после закрытия приложения</string>+ <string name="settings_keep_playing_detail">Если выключено, закрытие Myspoti из списка недавних приложений останавливает музыку</string>+ <string name="recommended_songs_from_name">По названию этого плейлиста</string>+ <string name="recommended_songs_from_songs">По содержимому этого плейлиста</string>+ <string name="recommended_songs_refresh">Обновить</string>+ <string name="recommended_songs_add">Добавить в этот плейлист</string>+ <string name="smart_shuffle_recommended">Рекомендовано умным перемешиванием</string>+ <string name="smart_shuffle_add">Добавить в этот плейлист</string>+ <string name="add_songs_title">Добавить в этот плейлист</string>+ <string name="add_songs_close">Закрыть</string>+ <string name="add_songs_search_hint">Поиск треков</string>+ <string name="add_songs_nothing">По запросу «%1$s» ничего не найдено</string>+ <string name="add_songs_added">Добавлено</string>+ <string name="spotify_code_description">Spotify Code</string>+ <string name="spotify_code_hint">Отсканируйте его в Spotify (Поиск, затем камера), чтобы открыть.</string>+ <string name="spotify_code_share_image">Поделиться кодом</string>+ <string name="copy_link">Копировать ссылку</string>+ <string name="link_copied">Ссылка скопирована</string>+ <string name="lyrics_meaning_title">Смысл</string>+ <string name="lyrics_meaning_about">О песне</string>+ <string name="lyrics_meaning_translating">Перевод…</string>+ <string name="lyrics_meaning_translate">Перевести</string>+ <string name="lyrics_meaning_original">Показать оригинал</string>+ <string name="lyrics_meaning_hint">Строки с точечным подчёркиванием: удерживайте, чтобы прочитать, что о них пишет Genius.</string>+ <string name="clip_sound_song">Звук: песня</string>+ <string name="clip_sound_clip">Звук: клип</string>+ <string name="clip_sound_on_hint">Теперь вы слышите собственный звук клипа. Песня продолжает тихо играть в Spotify, поэтому прослушивание засчитывается.</string>+ <string name="clip_sound_off_hint">Теперь вы снова слышите песню из Spotify.</string>+ <string name="lyrics_word_sync_title">По словам</string>+ <string name="lyrics_word_sync_on">Сначала караоке-тайминг (LyricsPlus, lrc.red, Kugou)</string>+ <string name="lyrics_word_sync_off">По строкам, сначала Spotify</string>+ <string name="playlist_invite_collaborators">Пригласить соавторов</string>+ <string name="playlist_invite_message">Присоединяйтесь к моему плейлисту «%1$s» в Spotify, вы сможете добавлять в него треки: %2$s</string>+ <string name="playlist_invite_failed">Не удалось создать ссылку-приглашение</string>+ <string name="playlist_by">Автор: %1$s</string>+ <string name="playlist_leave">Покинуть плейлист</string>+ <string name="playlist_leave_confirm">Покинуть «%1$s»? Вы перестанете быть соавтором и не сможете добавлять и удалять треки. Чтобы вернуться, понадобится новая ссылка-приглашение.</string>+ <string name="playlist_leave_button">Покинуть</string>+ <string name="playlist_make_public">Сделать открытым</string>+ <string name="playlist_make_private">Сделать закрытым</string>+ <string name="playlist_stop_collab">Прекратить совместную работу</string>+ <string name="playlist_add_profile">Добавить в профиль</string>+ <string name="playlist_remove_profile">Убрать из профиля</string>+ <string name="playlist_now_public">Плейлист открытый</string>+ <string name="playlist_now_private">Плейлист закрытый</string>+ <string name="playlist_now_solo">Теперь добавлять треки можете только вы</string>+ <string name="playlist_now_on_profile">Добавлено в ваш профиль</string>+ <string name="playlist_now_off_profile">Убрано из вашего профиля</string>+ <string name="playlist_collab_locked">Совместный плейлист: чтобы добавлять треки, попросите у %1$s ссылку-приглашение.</string>+ <string name="playlist_collab_owner">владельца</string>+ <string name="playlist_members_title">Соавторы</string>+ <string name="playlist_member_owner">Создатель</string>+ <string name="playlist_member_collab">Соавтор</string>+ <string name="playlist_members_more">%1$s и ещё %2$d</string>+ <string name="profile_block">Заблокировать</string>+ <string name="profile_unblock">Разблокировать</string>+ <string name="profile_block_title">Заблокировать %1$s?</string>+ <string name="profile_block_confirm">%1$s больше не сможет подписаться на вас и увидеть ваш профиль и публичные плейлисты. Разблокировать пользователя можно в любой момент в его профиле.</string>+ <string name="profile_blocked">Вы заблокировали этого пользователя</string>+ <string name="profile_block_failed">Не удалось изменить блокировку, попробуйте ещё раз</string>+ <string name="profile_more_options">Ещё</string>+</resources>diff --git a/base/app/src/main/res/values-ru/spotify_strings.xml b/base/app/src/main/res/values-ru/spotify_strings.xmlindex c7b11699..225aafeb 100644--- a/base/app/src/main/res/values-ru/spotify_strings.xml+++ b/base/app/src/main/res/values-ru/spotify_strings.xml@@ -17,7 +17,6 @@<string name="snackbar_added_to_liked_songs" formatted="false">Добавлено в любимые треки</string><string name="snackbar_removed_from_liked_songs" formatted="false">Удалено из любимых треков</string><string name="content_description_context_menu" formatted="false">Другие варианты</string>- <string name="close_button_content_description" formatted="false">Закрыть</string><string name="add_to_playlist_saved_in_section_header" formatted="false">Сохранено в плейлистах</string><string name="add_to_playlist_new_playlist_button_text" formatted="false">Создать плейлист</string><string name="add_to_playlist_button_cancel" formatted="false">Отмена</string>@@ -25,8 +24,6 @@<string name="lyrics_card_title" formatted="false">Текст</string><string name="lyrics_card_title_preview" formatted="false">Предпросмотр текста</string><string name="lyrics_card_show_lyrics_button" formatted="false">Показать текст</string>- <string name="lyrics_card_expand_button_content_description" formatted="false">Развернуть текст на весь экран</string>- <string name="lyrics_card_share_button_content_description" formatted="false">Поделись текстом</string><string name="lyrics_credential_note" formatted="false">С разрешения: %1$s</string><string name="lyrics_fullscreen_chip_label_share" formatted="false">Поделиться</string><string name="lyrics_fullscreen_chip_label_translate" formatted="false">Перевести</string>@@ -49,7 +46,6 @@<string name="artist_popular_tracks" formatted="false">Популярное</string><string name="curation_button_follow_state_text" formatted="false">Подписаться</string><string name="curation_button_following_state_text" formatted="false">Подписки</string>- <string name="search_main_entity_subtitle_artist" formatted="false">Исполнитель</string><string name="connect_phone_is_self" formatted="false">Этот телефон</string><string name="settings_item_canvas_title" formatted="false">Canvas</string><string name="video_settings_canvas_subtitle" formatted="false">Показывать короткие зацикленные заставки на экране «Сейчас играет».</string>@@ -107,8 +103,6 @@<string name="library_search_text_hint" formatted="false">Поиск в медиатеке</string><string name="account_title" formatted="false">Аккаунт</string><string name="song_dna_search_chip_followed_artists" formatted="false">Подписки на исполнителей</string>- <string name="settings_item_crossfade_title" formatted="false">Плавный переход между треками</string>- <string name="playback_settings_crossfade_slider_seconds" formatted="false">%1$d сек.</string><string name="local_files_title" formatted="false">Добавленные файлы</string><string name="local_files_empty_section_title" formatted="false">Добавь файлы со своего устройства в медиатеку</string><string name="local_files_empty_section_subtitle" formatted="false">Хочешь добавить трек или подкаст, которого нет в Spotify?</string>@@ -138,14 +132,10 @@<string name="assisted_curation_search_filter_artists" formatted="false">Исполнители</string><string name="assisted_curation_search_filter_albums" formatted="false">Альбомы</string><string name="assisted_curation_search_filter_playlists" formatted="false">Плейлисты</string>- <string name="assisted_curation_search_filter_clear_content_description" formatted="false">Удалить фильтр</string>- <string name="ad_category_title_music" formatted="false">Музыка</string>- <string name="made_for_you_hub_title" formatted="false">Для тебя</string><string name="settings_item_app_language_title" formatted="false">Язык приложения</string><string name="create_menu_item_folder_title" formatted="false">Папка</string><string name="create_folder_name_suggested_folder_name" formatted="false">Новая папка</string><string name="context_menu_rename_folder" formatted="false">Переименовать папку</string>- <string name="your_library_messaging_folder_rename_hint" formatted="false">Название папки</string><string name="create_playlist_content_description" formatted="false">Создать плейлист</string><string name="actions_picker_delete" formatted="false">Удалить</string><string name="filter_and_sort_sort_section_title" formatted="false">Сортировка</string>diff --git a/base/app/src/main/res/values-ru/strings.xml b/base/app/src/main/res/values-ru/strings.xmlindex 9bab7c38..383ca8b7 100644--- a/base/app/src/main/res/values-ru/strings.xml+++ b/base/app/src/main/res/values-ru/strings.xml@@ -1,35 +1,25 @@-<?xml version="1.0" encoding="utf-8"?><resources><string name="app_name">Myspoti</string><string name="aa_playlists">Плейлисты</string><string name="aa_albums">Альбомы</string><string name="aa_artists">Исполнители</string>- <string name="aa_podcasts">Подкасты</string><string name="settings_amoled_theme">Тема AMOLED</string><string name="settings_amoled_theme_subtitle">Чистый чёрный фон для экономии заряда</string>- <string name="settings_lyrics_style_spotify_default">Стандартный Spotify</string>- <string name="settings_lyrics_style_fullscreen">На весь экран (цвета альбома)</string>- <string name="settings_lyrics_style_compact">Компактный</string>- <string name="settings_lyrics_style_karaoke">Караоке</string>- <string name="settings_lyrics_style_bold">Крупный жирный</string><string name="main_update_available">Доступно новое обновление</string>- <string name="notif_channel_media_name">Воспроизведение медиа</string>- <string name="notif_channel_media_description">Управление воспроизведением Myspoti</string>- <string name="notif_action_previous">Предыдущий</string>- <string name="notif_action_next">Следующий</string>+<string name="notif_action_play">Воспроизвести</string><string name="notif_action_pause">Пауза</string><string name="notif_shuffle_enable">Включить перемешивание</string><string name="notif_shuffle_disable">Выключить перемешивание</string><string name="notif_shuffle_disable_smart">Выключить умное перемешивание</string>- <string name="notif_action_like">Нравится</string>- <string name="notif_action_unlike">Убрать «Нравится»</string>- <string name="notif_unknown_name">Неизвестно</string>- <string name="notif_by_artist">от %1$s</string>- <string name="notif_repeat_disable">Выключить повтор</string>- <string name="notif_repeat_disable_one">Выключить повтор одного трека</string>- <string name="notif_repeat_enable">Включить повтор</string>- <string name="bridge_player_unlocked">Плеер разблокирован</string>- <string name="bridge_reloading">Перезагрузка…</string>- <string name="service_disabled_message">Сервис не включён</string>+++ <string name="energy_saver_title">Экономия заряда</string>+ <string name="energy_saver_summary">Canvas выключен, видео и анимации легче</string>+ <string name="video_fullscreen_enter">На весь экран</string>+ <string name="video_fullscreen_exit">Выйти из полноэкранного режима</string>+ <string name="playback_seek_description">Позиция воспроизведения</string>+ <string name="account_page_title">Аккаунт Spotify</string>+ <string name="account_page_detail">Подписка, конфиденциальность и устройства, на spotify.com</string>+ <string name="player_source_downloaded">Скачано</string></resources>diff --git a/base/app/src/main/res/values-sk/spotify_strings.xml b/base/app/src/main/res/values-sk/spotify_strings.xmlindex 46ba5042..36067874 100644--- a/base/app/src/main/res/values-sk/spotify_strings.xml+++ b/base/app/src/main/res/values-sk/spotify_strings.xml@@ -17,7 +17,6 @@<string name="snackbar_added_to_liked_songs" formatted="false">Pridané medzi obľúbené skladby.</string><string name="snackbar_removed_from_liked_songs" formatted="false">Odstránené z obľúbených skladieb.</string><string name="content_description_context_menu" formatted="false">Viac možností</string>- <string name="close_button_content_description" formatted="false">Zavrieť</string><string name="add_to_playlist_saved_in_section_header" formatted="false">Uložené do</string><string name="add_to_playlist_new_playlist_button_text" formatted="false">Nový playlist</string><string name="add_to_playlist_button_cancel" formatted="false">Zrušiť</string>@@ -25,8 +24,6 @@<string name="lyrics_card_title" formatted="false">Text</string><string name="lyrics_card_title_preview" formatted="false">Ukážka textu</string><string name="lyrics_card_show_lyrics_button" formatted="false">Zobraziť text</string>- <string name="lyrics_card_expand_button_content_description" formatted="false">Otvoriť text na celej obrazovke</string>- <string name="lyrics_card_share_button_content_description" formatted="false">Zdieľať text</string><string name="lyrics_credential_note" formatted="false">Text ti prináša: %1$s</string><string name="lyrics_fullscreen_chip_label_share" formatted="false">Zdieľať</string><string name="lyrics_fullscreen_chip_label_translate" formatted="false">Preložiť</string>@@ -49,7 +46,6 @@<string name="artist_popular_tracks" formatted="false">Obľúbené</string><string name="curation_button_follow_state_text" formatted="false">Sledovať</string><string name="curation_button_following_state_text" formatted="false">Sleduješ</string>- <string name="search_main_entity_subtitle_artist" formatted="false">Interpret</string><string name="connect_phone_is_self" formatted="false">Tento telefón</string><string name="settings_item_canvas_title" formatted="false">Canvas</string><string name="video_settings_canvas_subtitle" formatted="false">Krátke videoslučky pri prehrávaní skladby.</string>@@ -107,8 +103,6 @@<string name="library_search_text_hint" formatted="false">Hľadaj vo svojej knižnici</string><string name="account_title" formatted="false">Konto</string><string name="song_dna_search_chip_followed_artists" formatted="false">Sledovaní interpreti</string>- <string name="settings_item_crossfade_title" formatted="false">Prelínanie</string>- <string name="playback_settings_crossfade_slider_seconds" formatted="false">%1$d s</string><string name="local_files_title" formatted="false">Lokálne súbory</string><string name="local_files_empty_section_title" formatted="false">Pridaj si do knižnice vlastné zvukové súbory</string><string name="local_files_empty_section_subtitle" formatted="false">Máš skladbu alebo osobný podcast, ktoré nie sú na Spotify?</string>@@ -138,14 +132,10 @@<string name="assisted_curation_search_filter_artists" formatted="false">Interpreti</string><string name="assisted_curation_search_filter_albums" formatted="false">Albumy</string><string name="assisted_curation_search_filter_playlists" formatted="false">Playlisty</string>- <string name="assisted_curation_search_filter_clear_content_description" formatted="false">Vymazať filter</string>- <string name="ad_category_title_music" formatted="false">Hudba</string>- <string name="made_for_you_hub_title" formatted="false">Len pre teba</string><string name="settings_item_app_language_title" formatted="false">Jazyk apky</string><string name="create_menu_item_folder_title" formatted="false">Priečinok</string><string name="create_folder_name_suggested_folder_name" formatted="false">Nový priečinok</string><string name="context_menu_rename_folder" formatted="false">Premenovať priečinok</string>- <string name="your_library_messaging_folder_rename_hint" formatted="false">Názov priečinka</string><string name="create_playlist_content_description" formatted="false">Vytvoriť playlist</string><string name="actions_picker_delete" formatted="false">Odstrániť</string><string name="filter_and_sort_sort_section_title" formatted="false">Zoradiť podľa</string>diff --git a/base/app/src/main/res/values-sl/spotify_strings.xml b/base/app/src/main/res/values-sl/spotify_strings.xmlindex 2ceffa98..c45cbebd 100644--- a/base/app/src/main/res/values-sl/spotify_strings.xml+++ b/base/app/src/main/res/values-sl/spotify_strings.xml@@ -17,7 +17,6 @@<string name="snackbar_added_to_liked_songs" formatted="false">Dodano všečkanim skladbam.</string><string name="snackbar_removed_from_liked_songs" formatted="false">Odstranjeno iz všečkanih skladb.</string><string name="content_description_context_menu" formatted="false">Več možnosti</string>- <string name="close_button_content_description" formatted="false">Zapri</string><string name="add_to_playlist_saved_in_section_header" formatted="false">Shranjeno v</string><string name="add_to_playlist_new_playlist_button_text" formatted="false">Nov seznam predvajanja</string><string name="add_to_playlist_button_cancel" formatted="false">Prekliči</string>@@ -25,8 +24,6 @@<string name="lyrics_card_title" formatted="false">Besedilo</string><string name="lyrics_card_title_preview" formatted="false">Predogled besedila</string><string name="lyrics_card_show_lyrics_button" formatted="false">Pokaži besedilo</string>- <string name="lyrics_card_expand_button_content_description" formatted="false">Odpri celozaslonsko besedilo</string>- <string name="lyrics_card_share_button_content_description" formatted="false">Deli besedilo</string><string name="lyrics_credential_note" formatted="false">Besedila zagotavlja %1$s</string><string name="lyrics_fullscreen_chip_label_share" formatted="false">Deli</string><string name="lyrics_fullscreen_chip_label_translate" formatted="false">Prevedi</string>@@ -49,7 +46,6 @@<string name="artist_popular_tracks" formatted="false">Priljubljeno</string><string name="curation_button_follow_state_text" formatted="false">Spremljaj</string><string name="curation_button_following_state_text" formatted="false">Spremljaš</string>- <string name="search_main_entity_subtitle_artist" formatted="false">Izvajalec</string><string name="connect_phone_is_self" formatted="false">Ta telefon</string><string name="settings_item_canvas_title" formatted="false">Canvas</string><string name="video_settings_canvas_subtitle" formatted="false">Kratke vizualne vsebine v zanki med predvajanjem skladbe.</string>@@ -107,8 +103,6 @@<string name="library_search_text_hint" formatted="false">Preišči svojo zbirko</string><string name="account_title" formatted="false">Račun</string><string name="song_dna_search_chip_followed_artists" formatted="false">Spremljani izvajalci</string>- <string name="settings_item_crossfade_title" formatted="false">Postopen prehod</string>- <string name="playback_settings_crossfade_slider_seconds" formatted="false">%1$d s</string><string name="local_files_title" formatted="false">Lokalne datoteke</string><string name="local_files_empty_section_title" formatted="false">Dodaj lastne zvočne datoteke v svojo zbirko</string><string name="local_files_empty_section_subtitle" formatted="false">Imaš skladbo ali osebni podkast, ki ni na Spotifyu?</string>@@ -138,14 +132,10 @@<string name="assisted_curation_search_filter_artists" formatted="false">Izvajalci</string><string name="assisted_curation_search_filter_albums" formatted="false">Albumi</string><string name="assisted_curation_search_filter_playlists" formatted="false">Seznami predvajanja</string>- <string name="assisted_curation_search_filter_clear_content_description" formatted="false">Počisti filter</string>- <string name="ad_category_title_music" formatted="false">Glasba</string>- <string name="made_for_you_hub_title" formatted="false">Izbrano zate</string><string name="settings_item_app_language_title" formatted="false">Jezik aplikacije</string><string name="create_menu_item_folder_title" formatted="false">Mapa</string><string name="create_folder_name_suggested_folder_name" formatted="false">Nova mapa</string><string name="context_menu_rename_folder" formatted="false">Preimenuj mapo</string>- <string name="your_library_messaging_folder_rename_hint" formatted="false">Ime mape</string><string name="create_playlist_content_description" formatted="false">Ustvari seznam predvajanja</string><string name="actions_picker_delete" formatted="false">Izbriši</string><string name="filter_and_sort_sort_section_title" formatted="false">Razvrsti po</string>diff --git a/base/app/src/main/res/values-sr/spotify_strings.xml b/base/app/src/main/res/values-sr/spotify_strings.xmlindex 1b51f08d..91c14e8e 100644--- a/base/app/src/main/res/values-sr/spotify_strings.xml+++ b/base/app/src/main/res/values-sr/spotify_strings.xml@@ -17,7 +17,6 @@<string name="snackbar_added_to_liked_songs" formatted="false">Dodali ste u lajkovane pesme.</string><string name="snackbar_removed_from_liked_songs" formatted="false">Uklonili ste iz lajkovanih pesama.</string><string name="content_description_context_menu" formatted="false">Još opcija</string>- <string name="close_button_content_description" formatted="false">Zatvori</string><string name="add_to_playlist_saved_in_section_header" formatted="false">Sačuvano u</string><string name="add_to_playlist_new_playlist_button_text" formatted="false">Nova plejlista</string><string name="add_to_playlist_button_cancel" formatted="false">Otkaži</string>@@ -25,8 +24,6 @@<string name="lyrics_card_title" formatted="false">Tekst</string><string name="lyrics_card_title_preview" formatted="false">Pregled teksta</string><string name="lyrics_card_show_lyrics_button" formatted="false">Prikaži tekst</string>- <string name="lyrics_card_expand_button_content_description" formatted="false">Otvorite tekst preko celog ekrana</string>- <string name="lyrics_card_share_button_content_description" formatted="false">Delite tekst</string><string name="lyrics_credential_note" formatted="false">Autor teksta %1$s</string><string name="lyrics_fullscreen_chip_label_share" formatted="false">Deli</string><string name="lyrics_fullscreen_chip_label_translate" formatted="false">Prevedite</string>@@ -49,7 +46,6 @@<string name="artist_popular_tracks" formatted="false">Popularno</string><string name="curation_button_follow_state_text" formatted="false">Zaprati</string><string name="curation_button_following_state_text" formatted="false">Pratite</string>- <string name="search_main_entity_subtitle_artist" formatted="false">Izvođač</string><string name="connect_phone_is_self" formatted="false">ovom telefonu</string><string name="settings_item_canvas_title" formatted="false">Canvas</string><string name="video_settings_canvas_subtitle" formatted="false">Kratki vizuelni elementi u petlji kada se pesma reprodukuje.</string>@@ -107,8 +103,6 @@<string name="library_search_text_hint" formatted="false">Pretražite svoju biblioteku</string><string name="account_title" formatted="false">Nalog</string><string name="song_dna_search_chip_followed_artists" formatted="false">Izvođači koje pratite</string>- <string name="settings_item_crossfade_title" formatted="false">Postepen prelaz</string>- <string name="playback_settings_crossfade_slider_seconds" formatted="false">%1$d sek</string><string name="local_files_title" formatted="false">Lokalni fajlovi</string><string name="local_files_empty_section_title" formatted="false">Dodajte svoje audio fajlove u Moju biblioteku</string><string name="local_files_empty_section_subtitle" formatted="false">Imate pesmu ili lični podkast koji nisu u usluzi Spotify?</string>@@ -138,14 +132,10 @@<string name="assisted_curation_search_filter_artists" formatted="false">Izvođači</string><string name="assisted_curation_search_filter_albums" formatted="false">Albumi</string><string name="assisted_curation_search_filter_playlists" formatted="false">Plejliste</string>- <string name="assisted_curation_search_filter_clear_content_description" formatted="false">Obrišite filter</string>- <string name="ad_category_title_music" formatted="false">Muzika</string>- <string name="made_for_you_hub_title" formatted="false">Napravljeno za vas</string><string name="settings_item_app_language_title" formatted="false">Jezik aplikacije</string><string name="create_menu_item_folder_title" formatted="false">Folder</string><string name="create_folder_name_suggested_folder_name" formatted="false">Novi folder</string><string name="context_menu_rename_folder" formatted="false">Preimenujte folder</string>- <string name="your_library_messaging_folder_rename_hint" formatted="false">Naziv foldera</string><string name="create_playlist_content_description" formatted="false">Napravi plejlistu</string><string name="actions_picker_delete" formatted="false">Izbriši</string><string name="filter_and_sort_sort_section_title" formatted="false">Sortirajte prema:</string>diff --git a/base/app/src/main/res/values-sv/spotify_strings.xml b/base/app/src/main/res/values-sv/spotify_strings.xmlindex 350eccb8..1f77b719 100644--- a/base/app/src/main/res/values-sv/spotify_strings.xml+++ b/base/app/src/main/res/values-sv/spotify_strings.xml@@ -17,7 +17,6 @@<string name="snackbar_added_to_liked_songs" formatted="false">Tillagd till Gillade låtar.</string><string name="snackbar_removed_from_liked_songs" formatted="false">Borttagen från Gillade Låtar.</string><string name="content_description_context_menu" formatted="false">Fler alternativ</string>- <string name="close_button_content_description" formatted="false">Stäng</string><string name="add_to_playlist_saved_in_section_header" formatted="false">Sparad i</string><string name="add_to_playlist_new_playlist_button_text" formatted="false">Ny spellista</string><string name="add_to_playlist_button_cancel" formatted="false">Avbryt</string>@@ -25,8 +24,6 @@<string name="lyrics_card_title" formatted="false">Låttexter</string><string name="lyrics_card_title_preview" formatted="false">Förhandsgranskning av låttexter</string><string name="lyrics_card_show_lyrics_button" formatted="false">Visa låttexter</string>- <string name="lyrics_card_expand_button_content_description" formatted="false">Öppna låttexten i helskärm</string>- <string name="lyrics_card_share_button_content_description" formatted="false">Dela låttext</string><string name="lyrics_credential_note" formatted="false">Låttexten tillhandahålls av %1$s</string><string name="lyrics_fullscreen_chip_label_share" formatted="false">Dela</string><string name="lyrics_fullscreen_chip_label_translate" formatted="false">Översätt</string>@@ -49,7 +46,6 @@<string name="artist_popular_tracks" formatted="false">Populära</string><string name="curation_button_follow_state_text" formatted="false">Följ</string><string name="curation_button_following_state_text" formatted="false">Följer</string>- <string name="search_main_entity_subtitle_artist" formatted="false">Artist</string><string name="connect_phone_is_self" formatted="false">Den här telefonen</string><string name="settings_item_canvas_title" formatted="false">Canvas</string><string name="video_settings_canvas_subtitle" formatted="false">Korta visuella loopar när en låt spelas upp.</string>@@ -107,8 +103,6 @@<string name="library_search_text_hint" formatted="false">Sök i Ditt bibliotek</string><string name="account_title" formatted="false">Konto</string><string name="song_dna_search_chip_followed_artists" formatted="false">Följda artister</string>- <string name="settings_item_crossfade_title" formatted="false">Crossfade</string>- <string name="playback_settings_crossfade_slider_seconds" formatted="false">%1$d s</string><string name="local_files_title" formatted="false">Lokala filer</string><string name="local_files_empty_section_title" formatted="false">Lägga till egna ljudfiler i Ditt bibliotek</string><string name="local_files_empty_section_subtitle" formatted="false">Har du en låt eller egen podd som inte finns på Spotify?</string>@@ -138,14 +132,10 @@<string name="assisted_curation_search_filter_artists" formatted="false">Artister</string><string name="assisted_curation_search_filter_albums" formatted="false">Album</string><string name="assisted_curation_search_filter_playlists" formatted="false">Spellistor</string>- <string name="assisted_curation_search_filter_clear_content_description" formatted="false">Rensa filter</string>- <string name="ad_category_title_music" formatted="false">Musik</string>- <string name="made_for_you_hub_title" formatted="false">Skapad för dig</string><string name="settings_item_app_language_title" formatted="false">Appspråk</string><string name="create_menu_item_folder_title" formatted="false">Mapp</string><string name="create_folder_name_suggested_folder_name" formatted="false">Ny mapp</string><string name="context_menu_rename_folder" formatted="false">Byt namn på mappen</string>- <string name="your_library_messaging_folder_rename_hint" formatted="false">Mappnamn</string><string name="create_playlist_content_description" formatted="false">Skapa spellista</string><string name="actions_picker_delete" formatted="false">Radera</string><string name="filter_and_sort_sort_section_title" formatted="false">Sortera efter</string>diff --git a/base/app/src/main/res/values-sw/spotify_strings.xml b/base/app/src/main/res/values-sw/spotify_strings.xmlindex 3ef5b511..e5ce4301 100644--- a/base/app/src/main/res/values-sw/spotify_strings.xml+++ b/base/app/src/main/res/values-sw/spotify_strings.xml@@ -17,7 +17,6 @@<string name="snackbar_added_to_liked_songs" formatted="false">Imeongezwa kwenye Nyimbo Zilizokupendeza.</string><string name="snackbar_removed_from_liked_songs" formatted="false">Imeondolewa kwenye Nyimbo Zilizokupendeza.</string><string name="content_description_context_menu" formatted="false">Chaguo zaidi</string>- <string name="close_button_content_description" formatted="false">Funga</string><string name="add_to_playlist_saved_in_section_header" formatted="false">Yamehifadhiwa katika</string><string name="add_to_playlist_new_playlist_button_text" formatted="false">Orodha mpya ya kucheza</string><string name="add_to_playlist_button_cancel" formatted="false">Ghairi</string>@@ -25,8 +24,6 @@<string name="lyrics_card_title" formatted="false">Mistari ya nyimbo</string><string name="lyrics_card_title_preview" formatted="false">Kionjo cha mistari ya nyimbo</string><string name="lyrics_card_show_lyrics_button" formatted="false">Onyesha mistari ya nyimbo</string>- <string name="lyrics_card_expand_button_content_description" formatted="false">Fungua mistari ya nyimbo kwenye skrini nzima</string>- <string name="lyrics_card_share_button_content_description" formatted="false">Shiriki mistari ya nyimbo</string><string name="lyrics_credential_note" formatted="false">Mistari ya nyimbo imetolewa na %1$s</string><string name="lyrics_fullscreen_chip_label_share" formatted="false">Shiriki</string><string name="lyrics_fullscreen_chip_label_translate" formatted="false">Tafsiri</string>@@ -49,7 +46,6 @@<string name="artist_popular_tracks" formatted="false">Maarufu</string><string name="curation_button_follow_state_text" formatted="false">Fuatilia</string><string name="curation_button_following_state_text" formatted="false">Unafuatilia</string>- <string name="search_main_entity_subtitle_artist" formatted="false">Msanii</string><string name="connect_phone_is_self" formatted="false">Simu hii</string><string name="settings_item_canvas_title" formatted="false">Canvas</string><string name="video_settings_canvas_subtitle" formatted="false">Vielelezo vifupi vinavyorudiwa wakati wimbo unacheza.</string>@@ -107,8 +103,6 @@<string name="library_search_text_hint" formatted="false">Tafuta Maktaba Yako</string><string name="account_title" formatted="false">Akaunti</string><string name="song_dna_search_chip_followed_artists" formatted="false">Wasanii unaowafuatilia</string>- <string name="settings_item_crossfade_title" formatted="false">Unganisha</string>- <string name="playback_settings_crossfade_slider_seconds" formatted="false">Sek %1$d</string><string name="local_files_title" formatted="false">Faili zilizo kwenye Kifaa</string><string name="local_files_empty_section_title" formatted="false">Weka faili zako za sauti kwenye Maktaba Yako</string><string name="local_files_empty_section_subtitle" formatted="false">Una wimbo au podikasti ya binafsi ambayo haipo kwenye Spotify?</string>@@ -138,14 +132,10 @@<string name="assisted_curation_search_filter_artists" formatted="false">Wasanii</string><string name="assisted_curation_search_filter_albums" formatted="false">Albamu</string><string name="assisted_curation_search_filter_playlists" formatted="false">Orodha za kucheza</string>- <string name="assisted_curation_search_filter_clear_content_description" formatted="false">Futa kichujio</string>- <string name="ad_category_title_music" formatted="false">Muziki</string>- <string name="made_for_you_hub_title" formatted="false">Kwa Ajili Yako</string><string name="settings_item_app_language_title" formatted="false">Lugha ya programu</string><string name="create_menu_item_folder_title" formatted="false">Folda</string><string name="create_folder_name_suggested_folder_name" formatted="false">Folda mpya</string><string name="context_menu_rename_folder" formatted="false">Badilisha jina la folda</string>- <string name="your_library_messaging_folder_rename_hint" formatted="false">Jina la folda</string><string name="create_playlist_content_description" formatted="false">Unda orodha ya kucheza</string><string name="actions_picker_delete" formatted="false">Futa</string><string name="filter_and_sort_sort_section_title" formatted="false">Panga kulingana na</string>diff --git a/base/app/src/main/res/values-ta/spotify_strings.xml b/base/app/src/main/res/values-ta/spotify_strings.xmlindex f085e7a7..6d7d4a99 100644--- a/base/app/src/main/res/values-ta/spotify_strings.xml+++ b/base/app/src/main/res/values-ta/spotify_strings.xml@@ -17,7 +17,6 @@<string name="snackbar_added_to_liked_songs" formatted="false">விரும்பிய பாடல்களில் சேர்க்கப்பட்டது.</string><string name="snackbar_removed_from_liked_songs" formatted="false">விரும்பிய பாடல்களிலிருந்து அகற்றப்பட்டது.</string><string name="content_description_context_menu" formatted="false">மேலும் விருப்பங்கள்</string>- <string name="close_button_content_description" formatted="false">மூடு</string><string name="add_to_playlist_saved_in_section_header" formatted="false">இவற்றில் சேமிக்கப்பட்டது</string><string name="add_to_playlist_new_playlist_button_text" formatted="false">புதிய பிளேலிஸ்ட்</string><string name="add_to_playlist_button_cancel" formatted="false">ரத்துசெய்</string>@@ -25,8 +24,6 @@<string name="lyrics_card_title" formatted="false">பாடல் வரிகள்</string><string name="lyrics_card_title_preview" formatted="false">பாடல் வரிகளின் முன்னோட்டம்</string><string name="lyrics_card_show_lyrics_button" formatted="false">பாடல் வரிகளைக் காட்டு</string>- <string name="lyrics_card_expand_button_content_description" formatted="false">முழுத்திரையில் பாடல் வரிகளைத் திறக்கும்</string>- <string name="lyrics_card_share_button_content_description" formatted="false">பாடல் வரிகளைப் பகிரவும்</string><string name="lyrics_credential_note" formatted="false">பாடல் வரிகளை வழங்குவது %1$s</string><string name="lyrics_fullscreen_chip_label_share" formatted="false">பகிர்</string><string name="lyrics_fullscreen_chip_label_translate" formatted="false">மொழிபெயர்</string>@@ -49,7 +46,6 @@<string name="artist_popular_tracks" formatted="false">பிரபலமானவை</string><string name="curation_button_follow_state_text" formatted="false">பின்தொடர்</string><string name="curation_button_following_state_text" formatted="false">பின்தொடர்கிறீர்கள்</string>- <string name="search_main_entity_subtitle_artist" formatted="false">கலைஞர்</string><string name="connect_phone_is_self" formatted="false">இந்தத் தொலைபேசி</string><string name="settings_item_canvas_title" formatted="false">Canvas</string><string name="video_settings_canvas_subtitle" formatted="false">பாடல் பிளேயாகும்போது காட்டப்படும் சிறிய லூப் விஷுவல்கள்.</string>@@ -107,8 +103,6 @@<string name="library_search_text_hint" formatted="false">உங்கள் லைப்ரரியில் தேடவும்</string><string name="account_title" formatted="false">கணக்கு</string><string name="song_dna_search_chip_followed_artists" formatted="false">பின்தொடரும் கலைஞர்கள்</string>- <string name="settings_item_crossfade_title" formatted="false">கிராஸ்ஃபேட்</string>- <string name="playback_settings_crossfade_slider_seconds" formatted="false">%1$d வி</string><string name="local_files_title" formatted="false">சாதனத்திலுள்ள கோப்புகள்</string><string name="local_files_empty_section_title" formatted="false">உங்கள் லைப்ரரி பிரிவில் உங்களின் சொந்த ஆடியோ கோப்புகளைச் சேருங்கள்</string><string name="local_files_empty_section_subtitle" formatted="false">Spotifyயில் இல்லாத பாடலோ தனிப்பட்ட பாட்காஸ்ட்டோ உங்களிடம் உள்ளதா?</string>@@ -138,14 +132,10 @@<string name="assisted_curation_search_filter_artists" formatted="false">கலைஞர்கள்</string><string name="assisted_curation_search_filter_albums" formatted="false">ஆல்பங்கள்</string><string name="assisted_curation_search_filter_playlists" formatted="false">பிளேலிஸ்ட்கள்</string>- <string name="assisted_curation_search_filter_clear_content_description" formatted="false">வடிப்பானை அழிக்கும்</string>- <string name="ad_category_title_music" formatted="false">இசை</string>- <string name="made_for_you_hub_title" formatted="false">உங்களுக்காகவே உருவாக்கப்பட்டது</string><string name="settings_item_app_language_title" formatted="false">செயலியின் மொழி</string><string name="create_menu_item_folder_title" formatted="false">கோப்புறை</string><string name="create_folder_name_suggested_folder_name" formatted="false">புதிய கோப்புறை</string><string name="context_menu_rename_folder" formatted="false">கோப்புறையின் பெயரை மாற்று</string>- <string name="your_library_messaging_folder_rename_hint" formatted="false">கோப்புறையின் பெயர்</string><string name="create_playlist_content_description" formatted="false">பிளேலிஸ்ட்டை உருவாக்கும்</string><string name="actions_picker_delete" formatted="false">நீக்கு</string><string name="filter_and_sort_sort_section_title" formatted="false">இதன்படி வரிசைப்படுத்து</string>diff --git a/base/app/src/main/res/values-te/spotify_strings.xml b/base/app/src/main/res/values-te/spotify_strings.xmlindex 8b2ed24a..1770034f 100644--- a/base/app/src/main/res/values-te/spotify_strings.xml+++ b/base/app/src/main/res/values-te/spotify_strings.xml@@ -17,7 +17,6 @@<string name="snackbar_added_to_liked_songs" formatted="false">లైక్ చేసిన పాటలకు జోడించబడింది.</string><string name="snackbar_removed_from_liked_songs" formatted="false">లైక్ చేసిన పాటల నుండి తీసివేయబడింది.</string><string name="content_description_context_menu" formatted="false">మరిన్ని ఎంపికలు</string>- <string name="close_button_content_description" formatted="false">మూసివేయండి</string><string name="add_to_playlist_saved_in_section_header" formatted="false">ఇందులో సేవ్ చేయబడింది</string><string name="add_to_playlist_new_playlist_button_text" formatted="false">కొత్త ప్లేలిస్ట్</string><string name="add_to_playlist_button_cancel" formatted="false">రద్దు చేయి</string>@@ -25,8 +24,6 @@<string name="lyrics_card_title" formatted="false">లిరిక్స్</string><string name="lyrics_card_title_preview" formatted="false">లిరిక్స్ ప్రివ్యూ</string><string name="lyrics_card_show_lyrics_button" formatted="false">లిరిక్స్ని చూపించండి</string>- <string name="lyrics_card_expand_button_content_description" formatted="false">పూర్తి స్క్రీన్ లిరిక్స్ తెరవండి</string>- <string name="lyrics_card_share_button_content_description" formatted="false">లిరిక్స్ షేర్ చేయండి</string><string name="lyrics_credential_note" formatted="false">%1$s ద్వారా లిరిక్స్ అందించబడ్డాయి</string><string name="lyrics_fullscreen_chip_label_share" formatted="false">షేర్ చేయి</string><string name="lyrics_fullscreen_chip_label_translate" formatted="false">అనువదించు</string>@@ -49,7 +46,6 @@<string name="artist_popular_tracks" formatted="false">జనాదరణ పొందిన</string><string name="curation_button_follow_state_text" formatted="false">అనుసరించండి</string><string name="curation_button_following_state_text" formatted="false">అనుసరిస్తున్నారు</string>- <string name="search_main_entity_subtitle_artist" formatted="false">ఆర్టిస్ట్</string><string name="connect_phone_is_self" formatted="false">ఈ ఫోన్</string><string name="settings_item_canvas_title" formatted="false">Canvas</string><string name="video_settings_canvas_subtitle" formatted="false">పాట ప్లే అవుతున్నప్పుడు చిన్న, లూపింగ్ విజువల్స్.</string>@@ -107,8 +103,6 @@<string name="library_search_text_hint" formatted="false">మీ లైబ్రెరీలో వెతకండి</string><string name="account_title" formatted="false">అకౌంట్</string><string name="song_dna_search_chip_followed_artists" formatted="false">అనుసరించిన ఆర్టిస్ట్లు</string>- <string name="settings_item_crossfade_title" formatted="false">క్రాస్ఫేడ్</string>- <string name="playback_settings_crossfade_slider_seconds" formatted="false">%1$d సె</string><string name="local_files_title" formatted="false">స్థానిక ఫైల్స్</string><string name="local_files_empty_section_title" formatted="false">మీ స్వంత ఆడియో ఫైల్స్ను మీ లైబ్రరీకి చేర్చండి</string><string name="local_files_empty_section_subtitle" formatted="false">Spotifyలో లేని పాట లేదా వ్యక్తిగత పాడ్కాస్ట్ ఉందా?</string>@@ -138,14 +132,10 @@<string name="assisted_curation_search_filter_artists" formatted="false">ఆర్టిస్ట్లు</string><string name="assisted_curation_search_filter_albums" formatted="false">ఆల్బమ్లు</string><string name="assisted_curation_search_filter_playlists" formatted="false">ప్లేలిస్ట్లు</string>- <string name="assisted_curation_search_filter_clear_content_description" formatted="false">ఫిల్టర్ను క్లియర్ చేయండి</string>- <string name="ad_category_title_music" formatted="false">మ్యూజిక్</string>- <string name="made_for_you_hub_title" formatted="false">మీ కోసం రూపొందించబడింది</string><string name="settings_item_app_language_title" formatted="false">యాప్ భాష</string><string name="create_menu_item_folder_title" formatted="false">ఫోల్డర్</string><string name="create_folder_name_suggested_folder_name" formatted="false">కొత్త ఫోల్డర్</string><string name="context_menu_rename_folder" formatted="false">ఫోల్డర్ పేరు మార్చండి</string>- <string name="your_library_messaging_folder_rename_hint" formatted="false">ఫోల్డర్ పేరు</string><string name="create_playlist_content_description" formatted="false">ఒక ప్లేలిస్ట్ రూపొందించండి</string><string name="actions_picker_delete" formatted="false">తొలగించండి</string><string name="filter_and_sort_sort_section_title" formatted="false">వీటి ఆధారంగా క్రమబద్ధీకరించండి</string>diff --git a/base/app/src/main/res/values-th/spotify_strings.xml b/base/app/src/main/res/values-th/spotify_strings.xmlindex 1d4d7bff..7a5941ae 100644--- a/base/app/src/main/res/values-th/spotify_strings.xml+++ b/base/app/src/main/res/values-th/spotify_strings.xml@@ -17,7 +17,6 @@<string name="snackbar_added_to_liked_songs" formatted="false">เพิ่มไปยังเพลงที่ถูกใจแล้ว</string><string name="snackbar_removed_from_liked_songs" formatted="false">ลบออกจาก \"เพลงที่ถูกใจ\" แล้ว</string><string name="content_description_context_menu" formatted="false">ตัวเลือกเพิ่มเติม</string>- <string name="close_button_content_description" formatted="false">ปิด</string><string name="add_to_playlist_saved_in_section_header" formatted="false">จำนวนการบันทึกใน</string><string name="add_to_playlist_new_playlist_button_text" formatted="false">เพลย์ลิสต์ใหม่</string><string name="add_to_playlist_button_cancel" formatted="false">ยกเลิก</string>@@ -25,8 +24,6 @@<string name="lyrics_card_title" formatted="false">เนื้อเพลง</string><string name="lyrics_card_title_preview" formatted="false">ตัวอย่างเนื้อเพลง</string><string name="lyrics_card_show_lyrics_button" formatted="false">แสดงเนื้อเพลง</string>- <string name="lyrics_card_expand_button_content_description" formatted="false">เปิดเนื้อเพลงแบบเต็มจอ</string>- <string name="lyrics_card_share_button_content_description" formatted="false">แชร์เนื้อเพลง</string><string name="lyrics_credential_note" formatted="false">เนื้อเพลงโดย %1$s</string><string name="lyrics_fullscreen_chip_label_share" formatted="false">แชร์</string><string name="lyrics_fullscreen_chip_label_translate" formatted="false">แปล</string>@@ -49,7 +46,6 @@<string name="artist_popular_tracks" formatted="false">ยอดนิยม</string><string name="curation_button_follow_state_text" formatted="false">ติดตาม</string><string name="curation_button_following_state_text" formatted="false">กำลังติดตาม</string>- <string name="search_main_entity_subtitle_artist" formatted="false">ศิลปิน</string><string name="connect_phone_is_self" formatted="false">โทรศัพท์เครื่องนี้</string><string name="settings_item_canvas_title" formatted="false">Canvas</string><string name="video_settings_canvas_subtitle" formatted="false">ภาพวนซ้ำสั้นๆ ขณะที่เพลงกำลังเล่น</string>@@ -107,8 +103,6 @@<string name="library_search_text_hint" formatted="false">ค้นหาในคอลเลกชันของคุณ</string><string name="account_title" formatted="false">บัญชี</string><string name="song_dna_search_chip_followed_artists" formatted="false">ศิลปินที่ติดตาม</string>- <string name="settings_item_crossfade_title" formatted="false">ครอสเฟด</string>- <string name="playback_settings_crossfade_slider_seconds" formatted="false">%1$d วิ</string><string name="local_files_title" formatted="false">ไฟล์ในเครื่อง</string><string name="local_files_empty_section_title" formatted="false">เพิ่มไฟล์เสียงลงในคอลเลกชันของคุณ</string><string name="local_files_empty_section_subtitle" formatted="false">หากอยากได้เพลงหรือพอดแคสต์ส่วนตัวที่ไม่มีบน Spotify</string>@@ -138,14 +132,10 @@<string name="assisted_curation_search_filter_artists" formatted="false">ศิลปิน</string><string name="assisted_curation_search_filter_albums" formatted="false">อัลบั้ม</string><string name="assisted_curation_search_filter_playlists" formatted="false">เพลย์ลิสต์</string>- <string name="assisted_curation_search_filter_clear_content_description" formatted="false">ล้างตัวกรอง</string>- <string name="ad_category_title_music" formatted="false">เพลง</string>- <string name="made_for_you_hub_title" formatted="false">จัดทำขึ้นเพื่อคุณ</string><string name="settings_item_app_language_title" formatted="false">ภาษาของแอป</string><string name="create_menu_item_folder_title" formatted="false">โฟลเดอร์</string><string name="create_folder_name_suggested_folder_name" formatted="false">โฟลเดอร์ใหม่</string><string name="context_menu_rename_folder" formatted="false">เปลี่ยนชื่อโฟลเดอร์</string>- <string name="your_library_messaging_folder_rename_hint" formatted="false">ชื่อโฟลเดอร์</string><string name="create_playlist_content_description" formatted="false">สร้างเพลย์ลิสต์</string><string name="actions_picker_delete" formatted="false">ลบ</string><string name="filter_and_sort_sort_section_title" formatted="false">เรียงตาม</string>diff --git a/base/app/src/main/res/values-tl/spotify_strings.xml b/base/app/src/main/res/values-tl/spotify_strings.xmlindex 7c28eef4..932edc59 100644--- a/base/app/src/main/res/values-tl/spotify_strings.xml+++ b/base/app/src/main/res/values-tl/spotify_strings.xml@@ -17,7 +17,6 @@<string name="snackbar_added_to_liked_songs" formatted="false">Idinagdag sa Mga Ni-like na Kanta.</string><string name="snackbar_removed_from_liked_songs" formatted="false">Inalis sa mga Ni-like na Kanta.</string><string name="content_description_context_menu" formatted="false">Iba pang option</string>- <string name="close_button_content_description" formatted="false">Isara</string><string name="add_to_playlist_saved_in_section_header" formatted="false">Naka-save sa</string><string name="add_to_playlist_new_playlist_button_text" formatted="false">Bagong playlist</string><string name="add_to_playlist_button_cancel" formatted="false">I-cancel</string>@@ -25,8 +24,6 @@<string name="lyrics_card_title" formatted="false">Lyrics</string><string name="lyrics_card_title_preview" formatted="false">Preview ng lyrics</string><string name="lyrics_card_show_lyrics_button" formatted="false">Ipakita ang lyrics</string>- <string name="lyrics_card_expand_button_content_description" formatted="false">Buksan ang full screen lyrics</string>- <string name="lyrics_card_share_button_content_description" formatted="false">I-share ang lyrics</string><string name="lyrics_credential_note" formatted="false">Galing sa %1$s ang lyrics</string><string name="lyrics_fullscreen_chip_label_share" formatted="false">I-share</string><string name="lyrics_fullscreen_chip_label_translate" formatted="false">I-translate</string>@@ -49,7 +46,6 @@<string name="artist_popular_tracks" formatted="false">Sikat</string><string name="curation_button_follow_state_text" formatted="false">I-follow</string><string name="curation_button_following_state_text" formatted="false">Fina-follow</string>- <string name="search_main_entity_subtitle_artist" formatted="false">Artist</string><string name="connect_phone_is_self" formatted="false">Phone na \'to</string><string name="settings_item_canvas_title" formatted="false">Canvas</string><string name="video_settings_canvas_subtitle" formatted="false">Maiikli at naglo-loop na visual kapag may nagpe-play na kanta.</string>@@ -107,8 +103,6 @@<string name="library_search_text_hint" formatted="false">Maghanap sa Library Mo</string><string name="account_title" formatted="false">Account</string><string name="song_dna_search_chip_followed_artists" formatted="false">Mga fina-follow na artist</string>- <string name="settings_item_crossfade_title" formatted="false">Crossfade</string>- <string name="playback_settings_crossfade_slider_seconds" formatted="false">%1$d s</string><string name="local_files_title" formatted="false">Mga Local File</string><string name="local_files_empty_section_title" formatted="false">Magdagdag ng sarili mong mga audio file sa Library Mo</string><string name="local_files_empty_section_subtitle" formatted="false">May kanta o personal na podcast na wala sa Spotify?</string>@@ -138,14 +132,10 @@<string name="assisted_curation_search_filter_artists" formatted="false">Mga Artist</string><string name="assisted_curation_search_filter_albums" formatted="false">Mga Album</string><string name="assisted_curation_search_filter_playlists" formatted="false">Mga Playlist</string>- <string name="assisted_curation_search_filter_clear_content_description" formatted="false">I-clear ang filter</string>- <string name="ad_category_title_music" formatted="false">Music</string>- <string name="made_for_you_hub_title" formatted="false">Para sa \'Yo</string><string name="settings_item_app_language_title" formatted="false">Language ng app</string><string name="create_menu_item_folder_title" formatted="false">Folder</string><string name="create_folder_name_suggested_folder_name" formatted="false">Bagong folder</string><string name="context_menu_rename_folder" formatted="false">I-rename ang folder</string>- <string name="your_library_messaging_folder_rename_hint" formatted="false">Pangalan ng folder</string><string name="create_playlist_content_description" formatted="false">Gumawa ng playlist</string><string name="actions_picker_delete" formatted="false">I-delete</string><string name="filter_and_sort_sort_section_title" formatted="false">I-sort ayon sa</string>diff --git a/base/app/src/main/res/values-tr/spotify_strings.xml b/base/app/src/main/res/values-tr/spotify_strings.xmlindex 36e194e3..02ed76c0 100644--- a/base/app/src/main/res/values-tr/spotify_strings.xml+++ b/base/app/src/main/res/values-tr/spotify_strings.xml@@ -17,7 +17,6 @@<string name="snackbar_added_to_liked_songs" formatted="false">Beğenilen Şarkılar\'a eklendi.</string><string name="snackbar_removed_from_liked_songs" formatted="false">Beğenilen Şarkılar\'dan kaldırıldı.</string><string name="content_description_context_menu" formatted="false">Diğer seçenekler</string>- <string name="close_button_content_description" formatted="false">Kapat</string><string name="add_to_playlist_saved_in_section_header" formatted="false">Kaydedildiği çalma listesi</string><string name="add_to_playlist_new_playlist_button_text" formatted="false">Yeni çalma listesi</string><string name="add_to_playlist_button_cancel" formatted="false">İptal</string>@@ -25,8 +24,6 @@<string name="lyrics_card_title" formatted="false">Şarkı sözleri</string><string name="lyrics_card_title_preview" formatted="false">Şarkı Sözleri önizlemesi</string><string name="lyrics_card_show_lyrics_button" formatted="false">Şarkı sözlerini göster</string>- <string name="lyrics_card_expand_button_content_description" formatted="false">Şarkı sözlerini tam ekranda açar</string>- <string name="lyrics_card_share_button_content_description" formatted="false">Şarkı sözlerini paylaş</string><string name="lyrics_credential_note" formatted="false">Şarkı sözlerini sağlayan: %1$s</string><string name="lyrics_fullscreen_chip_label_share" formatted="false">Paylaş</string><string name="lyrics_fullscreen_chip_label_translate" formatted="false">Çevir</string>@@ -49,7 +46,6 @@<string name="artist_popular_tracks" formatted="false">Popüler</string><string name="curation_button_follow_state_text" formatted="false">Takip Et</string><string name="curation_button_following_state_text" formatted="false">Takip Ediliyor</string>- <string name="search_main_entity_subtitle_artist" formatted="false">Sanatçı</string><string name="connect_phone_is_self" formatted="false">Bu telefon</string><string name="settings_item_canvas_title" formatted="false">Canvas</string><string name="video_settings_canvas_subtitle" formatted="false">Şarkı çalarken görüntülenen kısa, dönen görseller.</string>@@ -107,8 +103,6 @@<string name="library_search_text_hint" formatted="false">Kitaplığın\'da Ara</string><string name="account_title" formatted="false">Hesap</string><string name="song_dna_search_chip_followed_artists" formatted="false">Takip edilen sanatçılar</string>- <string name="settings_item_crossfade_title" formatted="false">Sesi azaltarak geç</string>- <string name="playback_settings_crossfade_slider_seconds" formatted="false">%1$d sn.</string><string name="local_files_title" formatted="false">Yerel Dosyalar</string><string name="local_files_empty_section_title" formatted="false">Kendi ses dosyalarını Kitaplığın\'a ekle</string><string name="local_files_empty_section_subtitle" formatted="false">Spotify\'da yer almayan bir şarkın veya kişisel podcast\'in mi var?</string>@@ -138,14 +132,10 @@<string name="assisted_curation_search_filter_artists" formatted="false">Sanatçılar</string><string name="assisted_curation_search_filter_albums" formatted="false">Albümler</string><string name="assisted_curation_search_filter_playlists" formatted="false">Çalma listeleri</string>- <string name="assisted_curation_search_filter_clear_content_description" formatted="false">Filtreyi temizle</string>- <string name="ad_category_title_music" formatted="false">Müzik</string>- <string name="made_for_you_hub_title" formatted="false">Senin için hazırlandı</string><string name="settings_item_app_language_title" formatted="false">Uygulama dili</string><string name="create_menu_item_folder_title" formatted="false">Klasör</string><string name="create_folder_name_suggested_folder_name" formatted="false">Yeni klasör</string><string name="context_menu_rename_folder" formatted="false">Klasörü yeniden adlandır</string>- <string name="your_library_messaging_folder_rename_hint" formatted="false">Klasör adı</string><string name="create_playlist_content_description" formatted="false">Çalma listesi oluşturur</string><string name="actions_picker_delete" formatted="false">Sil</string><string name="filter_and_sort_sort_section_title" formatted="false">Şuna göre sırala:</string>diff --git a/base/app/src/main/res/values-tr/strings.xml b/base/app/src/main/res/values-tr/strings.xmlindex ff0ad524..c7fbf22d 100644--- a/base/app/src/main/res/values-tr/strings.xml+++ b/base/app/src/main/res/values-tr/strings.xml@@ -3,35 +3,16 @@<string name="aa_playlists">Çalma listeleri</string><string name="aa_albums">Albümler</string><string name="aa_artists">Sanatçılar</string>- <string name="aa_podcasts">Podcast\'ler</string><string name="settings_amoled_theme">AMOLED Teması</string><string name="settings_amoled_theme_subtitle">Pil tasarrufu için tamamen siyah arka plan</string>- <string name="settings_lyrics_style_spotify_default">Spotify Varsayılanı</string>- <string name="settings_lyrics_style_fullscreen">Tam Ekran (Albüm Renkleri)</string>- <string name="settings_lyrics_style_compact">Kompakt</string>- <string name="settings_lyrics_style_karaoke">Karaoke</string>- <string name="settings_lyrics_style_bold">Kalın Büyük</string><string name="main_update_available">Yeni bir güncelleme mevcut</string>- <string name="notif_channel_media_name">Medya Oynatma</string>- <string name="notif_channel_media_description">Myspoti medya oynatma kontrolleri</string>- <string name="notif_action_previous">Önceki</string>- <string name="notif_action_next">Sonraki</string><string name="notif_action_play">Oynat</string><string name="notif_action_pause">Duraklat</string><string name="notif_shuffle_enable">Karıştırmayı etkinleştir</string><string name="notif_shuffle_disable">Karıştırmayı devre dışı bırak</string><string name="notif_shuffle_disable_smart">Akıllı karıştırmayı devre dışı bırak</string>- <string name="notif_action_like">Beğen</string>- <string name="notif_action_unlike">Beğenmekten vazgeç</string>- <string name="notif_unknown_name">Bilinmeyen</string>- <string name="notif_by_artist">%1$s tarafından</string>- <string name="notif_repeat_disable">Tekrarı devre dışı bırak</string>- <string name="notif_repeat_disable_one">Birini tekrarlamayı devre dışı bırak</string>- <string name="notif_repeat_enable">Tekrarı etkinleştir</string>- <string name="bridge_player_unlocked">Oynatıcının kilidi açıldı</string>- <string name="bridge_reloading">Yeniden yükleniyor…</string>- <string name="service_disabled_message">Hizmet etkin değil</string>+ <string name="player_source_downloaded">İndirildi</string></resources>diff --git a/base/app/src/main/res/values-uk/spotify_strings.xml b/base/app/src/main/res/values-uk/spotify_strings.xmlindex 7721d020..b06906cd 100644--- a/base/app/src/main/res/values-uk/spotify_strings.xml+++ b/base/app/src/main/res/values-uk/spotify_strings.xml@@ -17,7 +17,6 @@<string name="snackbar_added_to_liked_songs" formatted="false">Додано до пісень, що сподобалися</string><string name="snackbar_removed_from_liked_songs" formatted="false">Видалено з пісень, що сподобалися</string><string name="content_description_context_menu" formatted="false">Більше варіантів</string>- <string name="close_button_content_description" formatted="false">Закрити</string><string name="add_to_playlist_saved_in_section_header" formatted="false">Збережено тут:</string><string name="add_to_playlist_new_playlist_button_text" formatted="false">Новий плейліст</string><string name="add_to_playlist_button_cancel" formatted="false">Скасувати</string>@@ -25,8 +24,6 @@<string name="lyrics_card_title" formatted="false">Текст</string><string name="lyrics_card_title_preview" formatted="false">Попередній перегляд тексту</string><string name="lyrics_card_show_lyrics_button" formatted="false">Показати текст</string>- <string name="lyrics_card_expand_button_content_description" formatted="false">Відкрити текст на весь екран</string>- <string name="lyrics_card_share_button_content_description" formatted="false">Поділіться текстом</string><string name="lyrics_credential_note" formatted="false">Джерело тексту пісні: %1$s</string><string name="lyrics_fullscreen_chip_label_share" formatted="false">Поділитися</string><string name="lyrics_fullscreen_chip_label_translate" formatted="false">Перекласти</string>@@ -49,7 +46,6 @@<string name="artist_popular_tracks" formatted="false">Популярні</string><string name="curation_button_follow_state_text" formatted="false">Підписатися</string><string name="curation_button_following_state_text" formatted="false">Ви підписалися</string>- <string name="search_main_entity_subtitle_artist" formatted="false">Виконавець</string><string name="connect_phone_is_self" formatted="false">Цей телефон</string><string name="settings_item_canvas_title" formatted="false">Canvas</string><string name="video_settings_canvas_subtitle" formatted="false">Короткий повторюваний відеоряд під час відтворення пісні.</string>@@ -107,8 +103,6 @@<string name="library_search_text_hint" formatted="false">Шукати в розділі \"Моя бібліотека\"</string><string name="account_title" formatted="false">Акаунт</string><string name="song_dna_search_chip_followed_artists" formatted="false">Виконавці, на яких ви підписалися</string>- <string name="settings_item_crossfade_title" formatted="false">Плавний перехід</string>- <string name="playback_settings_crossfade_slider_seconds" formatted="false">%1$d с</string><string name="local_files_title" formatted="false">Локальні файли</string><string name="local_files_empty_section_title" formatted="false">Додавайте власні аудіофайли до своєї бібліотеки</string><string name="local_files_empty_section_subtitle" formatted="false">Маєте пісню чи особистий подкаст, яких немає в Spotify?</string>@@ -138,14 +132,10 @@<string name="assisted_curation_search_filter_artists" formatted="false">Виконавці</string><string name="assisted_curation_search_filter_albums" formatted="false">Альбоми</string><string name="assisted_curation_search_filter_playlists" formatted="false">Плейлісти</string>- <string name="assisted_curation_search_filter_clear_content_description" formatted="false">Зняти фільтр</string>- <string name="ad_category_title_music" formatted="false">Музика</string>- <string name="made_for_you_hub_title" formatted="false">Для вас</string><string name="settings_item_app_language_title" formatted="false">Мова додатка</string><string name="create_menu_item_folder_title" formatted="false">Папка</string><string name="create_folder_name_suggested_folder_name" formatted="false">Нова папка</string><string name="context_menu_rename_folder" formatted="false">Перейменувати папку</string>- <string name="your_library_messaging_folder_rename_hint" formatted="false">Назва папки</string><string name="create_playlist_content_description" formatted="false">Створити плейліст</string><string name="actions_picker_delete" formatted="false">Видалити</string><string name="filter_and_sort_sort_section_title" formatted="false">Сортувати</string>diff --git a/base/app/src/main/res/values-ur/spotify_strings.xml b/base/app/src/main/res/values-ur/spotify_strings.xmlindex c8dee47e..db7f4cf0 100644--- a/base/app/src/main/res/values-ur/spotify_strings.xml+++ b/base/app/src/main/res/values-ur/spotify_strings.xml@@ -17,7 +17,6 @@<string name="snackbar_added_to_liked_songs" formatted="false">لائیک کردہ گانوں میں شامل ہوگیا ہے۔</string><string name="snackbar_removed_from_liked_songs" formatted="false">لائیک کردہ گانوں سے ہٹا دیا گیا ہے۔</string><string name="content_description_context_menu" formatted="false">مزید آپشنز</string>- <string name="close_button_content_description" formatted="false">بند کریں</string><string name="add_to_playlist_saved_in_section_header" formatted="false">اس میں محفوظ ہے</string><string name="add_to_playlist_new_playlist_button_text" formatted="false">نئی پلے لسٹ</string><string name="add_to_playlist_button_cancel" formatted="false">منسوخ کریں</string>@@ -25,8 +24,6 @@<string name="lyrics_card_title" formatted="false">بول</string><string name="lyrics_card_title_preview" formatted="false">بول کا پیش منظر</string><string name="lyrics_card_show_lyrics_button" formatted="false">بول دکھائیں</string>- <string name="lyrics_card_expand_button_content_description" formatted="false">پوری اسکرین پر بول کھولیں</string>- <string name="lyrics_card_share_button_content_description" formatted="false">بول شیئر کریں</string><string name="lyrics_credential_note" formatted="false">%1$s کی جانب سے فراہم کردہ بول</string><string name="lyrics_fullscreen_chip_label_share" formatted="false">شیئر کریں</string><string name="lyrics_fullscreen_chip_label_translate" formatted="false">ترجمہ کریں</string>@@ -49,7 +46,6 @@<string name="artist_popular_tracks" formatted="false">مقبول</string><string name="curation_button_follow_state_text" formatted="false">فالو کریں</string><string name="curation_button_following_state_text" formatted="false">فالو کر رہے ہیں</string>- <string name="search_main_entity_subtitle_artist" formatted="false">آرٹسٹ</string><string name="connect_phone_is_self" formatted="false">اس فون</string><string name="settings_item_canvas_title" formatted="false">Canvas</string><string name="video_settings_canvas_subtitle" formatted="false">گانا پلے ہونے پر مختصر، لوپ والے ویژوئلز۔</string>@@ -107,8 +103,6 @@<string name="library_search_text_hint" formatted="false">آپ کی لائبریری میں تلاش کریں</string><string name="account_title" formatted="false">اکاؤنٹ</string><string name="song_dna_search_chip_followed_artists" formatted="false">فالو کردہ آرٹسٹس</string>- <string name="settings_item_crossfade_title" formatted="false">کراس فیڈ</string>- <string name="playback_settings_crossfade_slider_seconds" formatted="false">%1$d سیکنڈ</string><string name="local_files_title" formatted="false">مقامی فائلز</string><string name="local_files_empty_section_title" formatted="false">آپ کی لائبریری میں اپنی ذاتی آڈیو فائلز شامل کریں</string><string name="local_files_empty_section_subtitle" formatted="false">ایسا کوئی گانا یا ذاتی پوڈکاسٹ ہے جو Spotify پر نہیں ہے؟</string>@@ -138,14 +132,10 @@<string name="assisted_curation_search_filter_artists" formatted="false">آرٹسٹس</string><string name="assisted_curation_search_filter_albums" formatted="false">البمز</string><string name="assisted_curation_search_filter_playlists" formatted="false">پلے لسٹس</string>- <string name="assisted_curation_search_filter_clear_content_description" formatted="false">فلٹر صاف کریں</string>- <string name="ad_category_title_music" formatted="false">موسیقی</string>- <string name="made_for_you_hub_title" formatted="false">آپ کیلئے تیار کردہ</string><string name="settings_item_app_language_title" formatted="false">ایپ کی زبان</string><string name="create_menu_item_folder_title" formatted="false">فولڈر</string><string name="create_folder_name_suggested_folder_name" formatted="false">نیا فولڈر</string><string name="context_menu_rename_folder" formatted="false">فولڈر کا نام تبدیل کریں۔</string>- <string name="your_library_messaging_folder_rename_hint" formatted="false">فولڈر کا نام</string><string name="create_playlist_content_description" formatted="false">پلے لسٹ بنائیں</string><string name="actions_picker_delete" formatted="false">ڈیلیٹ کریں</string><string name="filter_and_sort_sort_section_title" formatted="false">ترتیب دیں بلحاظ</string>diff --git a/base/app/src/main/res/values-vi/spotify_strings.xml b/base/app/src/main/res/values-vi/spotify_strings.xmlindex 04f6513d..325eeed7 100644--- a/base/app/src/main/res/values-vi/spotify_strings.xml+++ b/base/app/src/main/res/values-vi/spotify_strings.xml@@ -17,7 +17,6 @@<string name="snackbar_added_to_liked_songs" formatted="false">Đã thêm vào trang Bài hát đã thích.</string><string name="snackbar_removed_from_liked_songs" formatted="false">Đã xóa khỏi trang Bài hát đã thích.</string><string name="content_description_context_menu" formatted="false">Tùy chọn khác</string>- <string name="close_button_content_description" formatted="false">Đóng</string><string name="add_to_playlist_saved_in_section_header" formatted="false">Đã lưu vào</string><string name="add_to_playlist_new_playlist_button_text" formatted="false">Danh sách phát mới</string><string name="add_to_playlist_button_cancel" formatted="false">Hủy</string>@@ -25,8 +24,6 @@<string name="lyrics_card_title" formatted="false">Lời bài hát</string><string name="lyrics_card_title_preview" formatted="false">Bản xem trước lời bài hát</string><string name="lyrics_card_show_lyrics_button" formatted="false">Hiện lời bài hát</string>- <string name="lyrics_card_expand_button_content_description" formatted="false">Mở lời bài hát trên toàn màn hình</string>- <string name="lyrics_card_share_button_content_description" formatted="false">Chia sẻ lời bài hát</string><string name="lyrics_credential_note" formatted="false">Lời bài hát do %1$s cung cấp</string><string name="lyrics_fullscreen_chip_label_share" formatted="false">Chia sẻ</string><string name="lyrics_fullscreen_chip_label_translate" formatted="false">Dịch</string>@@ -49,7 +46,6 @@<string name="artist_popular_tracks" formatted="false">Phổ biến</string><string name="curation_button_follow_state_text" formatted="false">Theo dõi</string><string name="curation_button_following_state_text" formatted="false">Đang theo dõi</string>- <string name="search_main_entity_subtitle_artist" formatted="false">Nghệ sĩ</string><string name="connect_phone_is_self" formatted="false">Điện thoại này</string><string name="settings_item_canvas_title" formatted="false">Canvas</string><string name="video_settings_canvas_subtitle" formatted="false">Hình ảnh ngắn, lặp lại khi bài hát đang phát.</string>@@ -107,8 +103,6 @@<string name="library_search_text_hint" formatted="false">Tìm kiếm trong thư viện</string><string name="account_title" formatted="false">Tài khoản</string><string name="song_dna_search_chip_followed_artists" formatted="false">Nghệ sĩ đang theo dõi</string>- <string name="settings_item_crossfade_title" formatted="false">Chuyển bài</string>- <string name="playback_settings_crossfade_slider_seconds" formatted="false">%1$d giây</string><string name="local_files_title" formatted="false">Tệp trên thiết bị</string><string name="local_files_empty_section_title" formatted="false">Thêm tệp âm thanh của riêng bạn vào Thư viện</string><string name="local_files_empty_section_subtitle" formatted="false">Bạn có bài hát hoặc podcast cá nhân không có trên Spotify?</string>@@ -138,14 +132,10 @@<string name="assisted_curation_search_filter_artists" formatted="false">Nghệ sĩ</string><string name="assisted_curation_search_filter_albums" formatted="false">Album</string><string name="assisted_curation_search_filter_playlists" formatted="false">Danh sách phát</string>- <string name="assisted_curation_search_filter_clear_content_description" formatted="false">Xóa bộ lọc</string>- <string name="ad_category_title_music" formatted="false">Nhạc</string>- <string name="made_for_you_hub_title" formatted="false">Dành cho bạn</string><string name="settings_item_app_language_title" formatted="false">Ngôn ngữ của ứng dụng</string><string name="create_menu_item_folder_title" formatted="false">Thư mục</string><string name="create_folder_name_suggested_folder_name" formatted="false">Thư mục mới</string><string name="context_menu_rename_folder" formatted="false">Đổi tên thư mục</string>- <string name="your_library_messaging_folder_rename_hint" formatted="false">Tên thư mục</string><string name="create_playlist_content_description" formatted="false">Tạo danh sách phát</string><string name="actions_picker_delete" formatted="false">Xóa</string><string name="filter_and_sort_sort_section_title" formatted="false">Sắp xếp theo</string>diff --git a/base/app/src/main/res/values-zh-rHK/spotify_strings.xml b/base/app/src/main/res/values-zh-rHK/spotify_strings.xmlindex 795a2587..ed365a41 100644--- a/base/app/src/main/res/values-zh-rHK/spotify_strings.xml+++ b/base/app/src/main/res/values-zh-rHK/spotify_strings.xml@@ -17,7 +17,6 @@<string name="snackbar_added_to_liked_songs" formatted="false">已新增至「讚好過的歌曲」。</string><string name="snackbar_removed_from_liked_songs" formatted="false">已從「讚好過的歌曲」移除。</string><string name="content_description_context_menu" formatted="false">更多選項</string>- <string name="close_button_content_description" formatted="false">關閉</string><string name="add_to_playlist_saved_in_section_header" formatted="false">已儲存在</string><string name="add_to_playlist_new_playlist_button_text" formatted="false">新播放清單</string><string name="add_to_playlist_button_cancel" formatted="false">取消</string>@@ -25,8 +24,6 @@<string name="lyrics_card_title" formatted="false">歌詞</string><string name="lyrics_card_title_preview" formatted="false">歌詞預覽</string><string name="lyrics_card_show_lyrics_button" formatted="false">顯示歌詞</string>- <string name="lyrics_card_expand_button_content_description" formatted="false">開啟全螢幕歌詞</string>- <string name="lyrics_card_share_button_content_description" formatted="false">分享歌詞</string><string name="lyrics_credential_note" formatted="false">歌詞由%1$s提供</string><string name="lyrics_fullscreen_chip_label_share" formatted="false">分享</string><string name="lyrics_fullscreen_chip_label_translate" formatted="false">翻譯</string>@@ -49,7 +46,6 @@<string name="artist_popular_tracks" formatted="false">熱門</string><string name="curation_button_follow_state_text" formatted="false">關注</string><string name="curation_button_following_state_text" formatted="false">正在關注</string>- <string name="search_main_entity_subtitle_artist" formatted="false">藝人</string><string name="connect_phone_is_self" formatted="false">此手機</string><string name="settings_item_canvas_title" formatted="false">Canvas</string><string name="video_settings_canvas_subtitle" formatted="false">歌曲播放時的簡短循環視覺效果。</string>@@ -107,8 +103,6 @@<string name="library_search_text_hint" formatted="false">搜尋你的音樂庫</string><string name="account_title" formatted="false">帳戶</string><string name="song_dna_search_chip_followed_artists" formatted="false">已關注藝人</string>- <string name="settings_item_crossfade_title" formatted="false">淡入/淡出</string>- <string name="playback_settings_crossfade_slider_seconds" formatted="false">%1$d 秒</string><string name="local_files_title" formatted="false">本機檔案</string><string name="local_files_empty_section_title" formatted="false">將自己的音訊檔案新增至「你的音樂庫」</string><string name="local_files_empty_section_subtitle" formatted="false">擁有 Spotify 沒有的歌曲或個人 Podcast?</string>@@ -138,14 +132,10 @@<string name="assisted_curation_search_filter_artists" formatted="false">藝人</string><string name="assisted_curation_search_filter_albums" formatted="false">專輯</string><string name="assisted_curation_search_filter_playlists" formatted="false">播放清單</string>- <string name="assisted_curation_search_filter_clear_content_description" formatted="false">清除篩選條件</string>- <string name="ad_category_title_music" formatted="false">音樂</string>- <string name="made_for_you_hub_title" formatted="false">為你精心打造</string><string name="settings_item_app_language_title" formatted="false">應用程式語言</string><string name="create_menu_item_folder_title" formatted="false">資料夾</string><string name="create_folder_name_suggested_folder_name" formatted="false">新資料夾</string><string name="context_menu_rename_folder" formatted="false">重新命名資料夾</string>- <string name="your_library_messaging_folder_rename_hint" formatted="false">資料夾名稱</string><string name="create_playlist_content_description" formatted="false">建立播放清單</string><string name="actions_picker_delete" formatted="false">刪除</string><string name="filter_and_sort_sort_section_title" formatted="false">排序方式</string>diff --git a/base/app/src/main/res/values-zh-rTW/spotify_strings.xml b/base/app/src/main/res/values-zh-rTW/spotify_strings.xmlindex a4d6303f..23f18b69 100644--- a/base/app/src/main/res/values-zh-rTW/spotify_strings.xml+++ b/base/app/src/main/res/values-zh-rTW/spotify_strings.xml@@ -17,7 +17,6 @@<string name="snackbar_added_to_liked_songs" formatted="false">已新增至「已按讚的歌曲」。</string><string name="snackbar_removed_from_liked_songs" formatted="false">已從「已按讚的歌曲」中移除。</string><string name="content_description_context_menu" formatted="false">更多選項</string>- <string name="close_button_content_description" formatted="false">關閉</string><string name="add_to_playlist_saved_in_section_header" formatted="false">儲存位置</string><string name="add_to_playlist_new_playlist_button_text" formatted="false">建立新清單</string><string name="add_to_playlist_button_cancel" formatted="false">取消</string>@@ -25,8 +24,6 @@<string name="lyrics_card_title" formatted="false">歌詞</string><string name="lyrics_card_title_preview" formatted="false">歌詞預覽</string><string name="lyrics_card_show_lyrics_button" formatted="false">顯示歌詞</string>- <string name="lyrics_card_expand_button_content_description" formatted="false">全螢幕檢視歌詞</string>- <string name="lyrics_card_share_button_content_description" formatted="false">分享歌詞</string><string name="lyrics_credential_note" formatted="false">歌詞提供者:%1$s</string><string name="lyrics_fullscreen_chip_label_share" formatted="false">分享</string><string name="lyrics_fullscreen_chip_label_translate" formatted="false">翻譯</string>@@ -49,7 +46,6 @@<string name="artist_popular_tracks" formatted="false">流行</string><string name="curation_button_follow_state_text" formatted="false">追蹤</string><string name="curation_button_following_state_text" formatted="false">追蹤中</string>- <string name="search_main_entity_subtitle_artist" formatted="false">藝人</string><string name="connect_phone_is_self" formatted="false">這支手機</string><string name="settings_item_canvas_title" formatted="false">Canvas</string><string name="video_settings_canvas_subtitle" formatted="false">播放歌曲時出現的簡短循環播放視覺效果。</string>@@ -107,8 +103,6 @@<string name="library_search_text_hint" formatted="false">搜尋你的音樂庫</string><string name="account_title" formatted="false">帳戶</string><string name="song_dna_search_chip_followed_artists" formatted="false">已關注藝人</string>- <string name="settings_item_crossfade_title" formatted="false">淡入/淡出</string>- <string name="playback_settings_crossfade_slider_seconds" formatted="false">%1$d 秒</string><string name="local_files_title" formatted="false">本機檔案</string><string name="local_files_empty_section_title" formatted="false">將你自己的音訊檔案新增至「你的音樂庫」</string><string name="local_files_empty_section_subtitle" formatted="false">你有不在 Spotify 上的歌曲或個人 Podcast 嗎?</string>@@ -138,14 +132,10 @@<string name="assisted_curation_search_filter_artists" formatted="false">藝人</string><string name="assisted_curation_search_filter_albums" formatted="false">專輯</string><string name="assisted_curation_search_filter_playlists" formatted="false">播放清單</string>- <string name="assisted_curation_search_filter_clear_content_description" formatted="false">清除篩選條件</string>- <string name="ad_category_title_music" formatted="false">音樂</string>- <string name="made_for_you_hub_title" formatted="false">專屬於你</string><string name="settings_item_app_language_title" formatted="false">App 語言</string><string name="create_menu_item_folder_title" formatted="false">資料夾</string><string name="create_folder_name_suggested_folder_name" formatted="false">新資料夾</string><string name="context_menu_rename_folder" formatted="false">重新命名資料夾</string>- <string name="your_library_messaging_folder_rename_hint" formatted="false">資料夾名稱</string><string name="create_playlist_content_description" formatted="false">建立播放清單</string><string name="actions_picker_delete" formatted="false">刪除</string><string name="filter_and_sort_sort_section_title" formatted="false">排序方式</string>diff --git a/base/app/src/main/res/values-zh/extensions_strings.xml b/base/app/src/main/res/values-zh/extensions_strings.xmlnew file mode 100644index 00000000..e179c9de--- /dev/null+++ b/base/app/src/main/res/values-zh/extensions_strings.xml@@ -0,0 +1,211 @@+<?xml version="1.0" encoding="utf-8"?>+<resources>+ <string name="extensions_title">扩展</string>+ <string name="extensions_row_detail">歌词、歌曲音频来源以及他人编写的脚本,运行在沙盒中。</string>+ <string name="extensions_install_file">从文件安装</string>+ <string name="extensions_install_url">从网址安装</string>+ <string name="extensions_url_hint">https://…/extension.zip</string>+ <string name="extensions_none">尚未安装任何扩展。</string>+ <string name="extensions_installed">已安装</string>+ <string name="extensions_repository_add">添加仓库</string>+ <string name="extensions_repository_hint">https://…/index.json</string>+ <string name="extensions_repository_warning">Myspoti 不会审核你添加的仓库:从中安装的内容风险自负。</string>+ <string name="extensions_repository_remove">移除</string>+ <string name="extensions_repository_refresh">刷新</string>+ <string name="extensions_install">安装</string>+ <string name="extensions_update">更新</string>+ <string name="extensions_up_to_date">已安装</string>+ <string name="extensions_cancel">取消</string>+ <string name="extensions_loading">正在读取…</string>+ <string name="extensions_error">未安装:%1$s</string>+ <string name="extensions_prompt_title_install">安装 %1$s?</string>+ <string name="extensions_prompt_title_update">更新 %1$s?</string>+ <string name="extensions_prompt_by">%1$s · 版本 %2$s · %3$s</string>+ <string name="extensions_prompt_source">来源:%1$s</string>+ <string name="extensions_prompt_source_file">此手机上的文件</string>+ <string name="extensions_prompt_new">此版本新增</string>+ <string name="extensions_prompt_update_same_rights">%1$s → %2$s,权限不变。</string>+ <string name="extensions_prompt_not_newer">已安装版本 %1$s(或更新的版本)。</string>+ <string name="extensions_prompt_sha">安装包 sha256:%1$s</string>+ <string name="extension_enabled">已开启</string>+ <string name="extension_running">运行中</string>+ <string name="extension_not_running">未运行</string>+ <string name="extension_turned_off">%1$s 已关闭:%2$s</string>+ <string name="extension_last_error">最近的错误:%1$s</string>+ <string name="extension_disabled_reason">已关闭:%1$s</string>+ <string name="extension_inactive">暂不可用</string>+ <string name="extension_inactive_detail">暂不可用:%1$s</string>+ <string name="extension_homepage">主页</string>+ <string name="extension_settings">设置</string>+ <string name="extension_log">日志</string>+ <string name="extension_log_empty">暂无日志。</string>+ <string name="extension_log_clear">清除日志</string>+ <string name="extension_update_file">从文件更新</string>+ <string name="extension_uninstall">卸载</string>+ <string name="extension_uninstall_confirm">卸载 %1$s?它的设置和保存的数据也会一并删除。</string>+ <string name="extension_confirm_title">扩展请求确认</string>+ <string name="extension_confirm_detail">未经你允许,不会更改任何内容。</string>+ <string name="extension_confirm_allow">允许</string>+ <string name="extension_confirm_refuse">拒绝</string>+ <string name="extensions_row_count">已安装 %1$d 个,已开启 %2$d 个</string>+ <string name="extensions_tab_store">商店</string>+ <string name="extensions_search">搜索扩展</string>+ <string name="extensions_cat_all">全部</string>+ <string name="extensions_cat_lyrics">歌词</string>+ <string name="extensions_cat_playback">播放与音频</string>+ <string name="extensions_cat_library">音乐库</string>+ <string name="extensions_cat_discovery">发现</string>+ <string name="extensions_cat_stats">统计</string>+ <string name="extensions_cat_look">外观</string>+ <string name="extensions_cat_social">社交</string>+ <string name="extensions_cat_tools">工具</string>+ <string name="extensions_cat_other">其他</string>+ <string name="extensions_no_match">没有匹配的扩展。</string>+ <string name="extensions_browse_store">浏览商店</string>+ <string name="extensions_other_ways">其他安装方式</string>+ <string name="extensions_empty_title">什么是扩展?</string>+ <string name="extensions_empty_body">扩展为 Myspoti 增添其自身不具备的功能:来自其他来源的歌词、歌曲音频或下载的来源、使用你 Spotify 账号的工具。每个扩展都在沙盒中运行,访问任何内容之前都会先征求你的同意。添加仓库即可浏览扩展,也可以安装你信任的安装包。</string>+ <string name="extensions_official_badge">官方</string>+ <string name="extensions_repo_yours">由你添加</string>+ <string name="extensions_repo_community">社区</string>+ <string name="extensions_repo_official_note">每个扩展在上架前都经过审核。</string>+ <string name="extensions_repo_yours_note">未经 Myspoti 审核:安装风险自负。</string>+ <string name="extensions_repo_error">无法读取此仓库:%1$s</string>+ <string name="extensions_repo_empty">此仓库没有列出任何扩展。</string>+ <string name="extensions_requires">需要 Myspoti %1$s 或更高版本</string>+ <string name="extensions_requires_api">为更新版本的 Myspoti 制作(扩展 API %1$d)</string>+ <string name="extensions_update_badge">更新</string>+ <string name="extensions_move_up">上移</string>+ <string name="extensions_move_down">下移</string>+ <string name="extension_off">已关闭</string>+ <string name="extension_by">作者:%1$s</string>+ <string name="extension_changelog">更新内容</string>+ <string name="extension_update_from">有可用更新:%1$s → %2$s</string>+ <string name="extension_not_listed">你的仓库中没有此扩展(或仓库仍在加载)。</string>+ <string name="extension_details">详情</string>+ <string name="extension_detail_updated">更新于</string>+ <string name="extension_detail_min_app">需要 Myspoti</string>+ <string name="extension_detail_size">大小</string>+ <string name="extension_detail_id">ID</string>+ <string name="extension_detail_sha">安装包 sha256</string>+ <string name="extension_detail_source">安装来源</string>+ <string name="extension_see_in_store">在商店中查看</string>++ <!-- Actions: the closed catalogue, as the user reads it -->+ <string name="action_playback_control">控制播放</string>+ <string name="action_playback_queue">编辑播放队列</string>+ <string name="action_playback_events">获知你在播放什么</string>+ <string name="action_lyrics_provide">提供歌词</string>+ <string name="action_trackinfo_provide">添加歌曲详情</string>+ <string name="action_audio_source">从其他来源播放音频</string>+ <string name="action_download_source">提供下载</string>+ <string name="action_home_sections">在首页添加板块</string>+ <string name="action_search_provide">添加搜索结果</string>+ <string name="action_menu_items">添加菜单项</string>+ <string name="action_player_buttons">添加播放器按钮</string>+ <string name="action_settings_page">自有设置页</string>+ <string name="action_notify">显示简短消息</string>+ <string name="action_library_read">读取你的音乐库</string>+ <string name="action_library_write">修改你的音乐库</string>+ <string name="action_playlists_write">编辑你的播放列表</string>+ <string name="action_spotify_catalog">浏览 Spotify</string>+ <string name="action_spotify_raw">完整访问 Spotify</string>+ <string name="action_network">使用互联网</string>+ <string name="action_network_any">使用任何网站</string>+ <string name="action_webview_page">自有网页</string>+ <string name="action_storage">保存自己的数据</string>+ <string name="action_unknown">此版 Myspoti 不认识</string>+ <string name="action_critical">关键</string>+ <string name="action_no_why">(未说明理由)</string>+ <string name="actions_title">功能</string>+ <string name="actions_critical_warning">关键操作可能修改你的账号、替换歌曲来源或显示任意网页。仅在信任作者时才允许:删除任何内容之前,Myspoti 仍会先询问你。</string>+ <!-- Areas of the Installed tab -->+ <string name="area_playback">播放</string>+ <string name="area_lyrics">歌词与歌曲信息</string>+ <string name="area_audio">音频与下载</string>+ <string name="area_home">首页与搜索</string>+ <string name="area_menus">菜单与播放器</string>+ <string name="area_library">音乐库与 Spotify</string>+ <string name="area_other">页面及其他</string>+ <string name="area_activity">最近活动</string>+ <string name="area_turn_off">关闭</string>+ <string name="area_active">使用中</string>+ <string name="area_idle">空闲</string>+ <string name="area_make_active">设为「%1$s」的首选</string>+ <!-- Install prompt -->+ <string name="ext_third_party_notice">第三方扩展,未经 Myspoti 审核,由其作者负责。</string>+ <string name="ext_risk_accept">我了解此扩展由第三方制作,并自行承担安装责任</string>+ <string name="ext_clash_exclusive">替换 %1$s(目前由 %2$s 提供)</string>+ <string name="ext_clash_conflict">与 %1$s(已安装)不兼容</string>+ <string name="ext_clash_replaces">替换 %1$s(已安装)</string>+ <string name="ext_clash_keep_new">使用 %1$s(另一个仍保持安装,%2$s)</string>+ <string name="ext_clash_keep_old">保留 %1$s</string>+ <string name="ext_clash_idle">空闲</string>+ <string name="ext_clash_off">已关闭</string>+ <string name="ext_clash_title">保留哪一个?</string>+ <string name="ext_clash_ok">完成</string>+ <!-- Blocks and pages -->+ <string name="ext_from">来自 %1$s</string>+ <string name="ext_overflow">扩展</string>+ <string name="ext_open_page">打开其页面</string>+ <string name="ext_page_failed">无法显示此扩展的页面。</string>+ <string name="ext_suspended_title">%1$s 已暂停</string>+ <string name="ext_suspended_body">它不断撤销 %1$s 对播放所做的操作:其播放指令已被暂停。</string>+ <string name="ext_suspended_keep">让它继续</string>++ <!-- GitHub: discovery, ratings, reports -->+ <string name="extensions_github_title">GitHub 上</string>+ <string name="extensions_github_note">带有 myspoti-extension 主题的公开仓库,未经审核:每个都由其作者负责。</string>+ <string name="extensions_show_all">显示全部(已隐藏 %1$d 个)</string>+ <string name="extensions_show_less">隐藏已屏蔽、被举报、低评分和已弃用的扩展</string>+ <string name="extension_rating">★ %1$s · %2$d 票</string>+ <string name="extension_rating_none">暂无投票</string>+ <string name="extension_downloads">%1$s 次下载</string>+ <string name="extension_rate_up">好评</string>+ <string name="extension_rate_down">差评</string>+ <string name="extension_rated">谢谢:你的投票已记录在 GitHub</string>+ <string name="extension_signin_title">登录 GitHub</string>+ <string name="extension_signin_body">打开 %1$s 并输入此验证码。Myspoti 不会看到你的密码。</string>+ <string name="extension_signin_open">打开 GitHub</string>+ <string name="extension_report">举报</string>+ <string name="extension_detail_github">GitHub</string>+ <string name="extension_detail_ref">GitHub 上的版本</string>++ <!-- Updates from GitHub -->+ <string name="extension_check_updates">检查更新</string>+ <string name="extension_check_up_to_date">已是最新</string>+ <string name="extension_check_applied">已更新:没有新增请求</string>+ <string name="extension_check_needs_ok">有更新需要你确认</string>+ <string name="extension_check_declined">你保留了此版本</string>+ <string name="extension_check_incompatible">新版本需要更新的 Myspoti</string>+ <string name="extension_check_blocked">新版本已被 Myspoti 屏蔽</string>+ <string name="extension_check_failed">无法检查:请查看其日志</string>+ <string name="extension_source_gone">来源已失效:其仓库已不存在。它仍使用你手机上的副本运行。</string>+ <string name="extension_revert">还原到 %1$s</string>+ <string name="extension_reverted">已还原到 %1$s</string>+ <string name="extension_update_needs_ok">更新需要你确认:%1$s → %2$s</string>+ <string name="extension_update_needs_ok_body">此版本请求的权限超出你已接受的范围。在你选择之前,当前版本会继续运行。</string>+ <string name="extension_update_accept">接受</string>+ <string name="extension_update_keep">保留当前版本</string>+ <string name="extension_refused_title">等待你的确认</string>+ <string name="extension_refused_body">它安装时还可以取消勾选操作,且有些被取消了。现在扩展会获得它声明的全部操作:在你接受之前它保持关闭。</string>+ <string name="extension_change_action">新增:%1$s</string>+ <string name="extension_change_host">新增网站:%1$s</string>+ <string name="extension_change_any_host">任何网站</string>+ <string name="extension_change_exclusive">现为独占:%1$s</string>+ <string name="extension_change_why">%1$s 的新理由</string>+ <string name="extension_change_was">原为:“%1$s”</string>+ <string name="extension_change_repo">现来自 %1$s(原为 %2$s)</string>+ <string name="extension_change_author">新作者:%1$s(原为 %2$s)</string>+ <string name="extension_change_replaces">安装后会关闭 %1$s</string>+ <string name="extension_change_conflicts">拒绝与 %1$s 同时运行</string>+ <string name="action_webview_auth">在网站上登录</string>+ <string name="extension_confirm_once">仅允许一次</string>+ <string name="extension_confirm_always">始终允许 %1$s</string>+ <string name="ext_auth_title">%1$s:登录</string>+ <string name="ext_auth_close">关闭</string>+ <string name="ext_auth_notice">独立的网页:您输入的内容及其 Cookie 保留在 Myspoti 中。扩展程序只获取网页最终停留的地址。</string>+ <string name="ext_grants_title">始终允许</string>+ <string name="ext_grants_note">此扩展无需询问即可对 Spotify 进行的更改。撤销某项后将重新询问。</string>+ <string name="ext_grant_revoke">撤销</string>+</resources>diff --git a/base/app/src/main/res/values-zh/myspoti_strings.xml b/base/app/src/main/res/values-zh/myspoti_strings.xmlnew file mode 100644index 00000000..890fdf3b--- /dev/null+++ b/base/app/src/main/res/values-zh/myspoti_strings.xml@@ -0,0 +1,456 @@+<?xml version="1.0" encoding="utf-8"?>+<!-- Myspoti's own texts (English default, French, Italian). -->+<resources>+ <string name="welcome_lead">你的音乐,</string>+ <string name="welcome_rotate_ads">没有广告。</string>+ <string name="welcome_rotate_lyrics">逐字歌词。</string>+ <string name="welcome_rotate_clips">官方视频。</string>+ <string name="welcome_rotate_offline">通过扩展离线收听。</string>+ <string name="welcome_login">使用 Spotify 登录</string>+ <string name="welcome_privacy">你将在 Spotify 自己的页面登录。Myspoti 永远看不到你的密码。</string>+ <string name="remove_from_liked">从“已点赞的歌曲”中移除</string>+ <string name="repeat_on">循环播放:开</string>+ <string name="repeat_one">单曲循环</string>+ <string name="repeat_off">循环播放:关</string>+ <string name="headphones">耳机</string>+ <string name="listen_on">收听设备</string>+ <string name="no_devices">未找到设备</string>+ <string name="sleep_minutes">%1$d 分钟</string>+ <string name="playing_on">正在播放于:</string>+ <string name="next_in_queue">队列中的下一首</string>+ <string name="next_from">接下来来自:%1$s</string>+ <string name="next_up">接下来</string>+ <string name="clear_queue">清空队列</string>+ <string name="my_playlist">我的播放列表</string>+ <string name="playlist_name">播放列表名称</string>+ <string name="loading_playlists">正在加载播放列表…</string>+ <string name="couldnt_load">无法加载%1$s</string>+ <string name="nothing_here">这里还没有内容</string>+ <string name="album_not_found">未找到专辑</string>+ <string name="liked_song">已点赞的歌曲</string>+ <string name="verified_artist">认证艺人</string>+ <string name="lyrics_share">分享歌词</string>+ <string name="lyrics_extra_title">更多歌词来源</string>+ <string name="lyrics_extra_summary">Spotify 没有歌词时使用 NetEase 和 Genius</string>+ <string name="lyrics_reload">重新加载歌词</string>+ <string name="lyrics_fullscreen">全屏打开歌词</string>+ <string name="browse_all">浏览全部</string>+ <string name="home_error">无法加载首页。\n请检查网络连接后重试。</string>+ <string name="home_retry">重试</string>+ <string name="home_empty">暂时没有内容可显示。</string>+ <string name="spotify_account">Spotify 账号</string>+ <string name="spotify_user">Spotify 用户</string>+ <string name="list_view">以列表显示</string>+ <string name="grid_view">以网格显示</string>+ <string name="library_error">无法加载你的音乐库</string>+ <string name="library_empty">你的音乐库是空的</string>+ <string name="background_playback_title">后台播放</string>+ <string name="background_playback_on">电池优化已关闭:息屏后音乐和 Spotify Connect 仍会继续播放。</string>+ <string name="background_playback_off">请关闭电池优化,以免 Android 在后台暂停应用。</string>+ <plurals name="local_files_count">+ <item quantity="other">%d 首曲目</item>+ </plurals>+ <string name="local_files_none_subtitle">在此设备上没有找到可播放的音频文件。有文件后会显示在这里。</string>+ <string name="downloads_empty_title">下载后可离线收听</string>+ <string name="downloads_empty_subtitle">点按歌曲菜单中的“下载”,或专辑、播放列表的下载按钮。</string>+ <string name="downloads_source">无损 FLAC,已与原始录音核对。仅保存在 Myspoti 内。</string>+ <string name="downloads_size">此手机上占用 %1$s</string>+ <string name="download_unavailable">未找到匹配的录音</string>+ <string name="download_retry">重试</string>+ <string name="download_cancel">取消下载</string>+ <string name="podcast_download_protected">此节目为 Spotify 独家:只能在 Spotify 应用中播放,无法下载。</string>+ <string name="podcast_download_unavailable">无法下载此节目:缺少发布者的音频文件。</string>+ <string name="podcast_download_failed">下载失败。请重试。</string>+ <string name="not_signed_in">你已退出 Spotify。请重新登录以查看此内容。</string>+ <string name="artist_not_found">未找到艺人</string>+ <string name="playlist_not_found">未找到播放列表</string>+ <string name="browse_new_releases">新发行</string>+ <string name="language_auto">自动</string>+ <string name="language_auto_detail">若 Myspoti 支持手机的语言则使用该语言(中文、德语、俄语、法语、希腊语、葡萄牙语、波兰语、西班牙语、意大利语、英语),否则使用英语</string>+ <string name="language_partial_note">其他语言:仅翻译 Spotify 自身的标签,Myspoti 的文字仍为英语。</string>+ <string name="restart_player_title">重启播放器</string>+ <string name="restart_player_detail">音乐无响应时:重新加载 Spotify 播放器</string>+ <string name="ad_playing">广告</string>+ <string name="track_unavailable_region">在你所在的地区不可用</string>+ <string name="diagnostic_export_title">导出诊断报告</string>+ <string name="diagnostic_export_detail">分享应用最近的日志和设备信息</string>+ <string name="diagnostic_export_failed">无法写入诊断报告</string>+ <string name="local_playlist_subtitle">在此设备上</string>+ <string name="local_playlist_new">此设备上的播放列表</string>+ <string name="local_added_section">已添加到此设备</string>+ <string name="local_add_note">手机上的文件只保留在此手机上:Spotify 无法接收它们。</string>+ <string name="local_rename">重命名</string>+ <string name="local_delete_playlist">删除播放列表</string>+ <string name="local_added_to">已添加到%1$s</string>+ <string name="local_playlist_empty">点按“本地文件”中的 + 按钮来添加歌曲。</string>+ <string name="playlist_change_refused">Spotify 拒绝了对此播放列表的更改</string>+ <string name="download_kept_by_list">仍保留下载:已下载的播放列表包含它</string>+ <string name="support_title">支持 Myspoti</string>+ <string name="support_body">Myspoti 免费、无广告,由我在业余时间制作。如果你喜欢它,一点小小的捐助能帮助它继续下去。</string>+ <string name="support_action">在 Ko-fi 上支持</string>+ <string name="support_decline">不用了</string>+ <string name="support_row_detail">在 Ko-fi 或 GitHub Sponsors 上的小额捐助有助于应用持续更新</string>+ <string name="supporter_perks_title">支持者福利</string>+ <string name="supporter_perks_detail">强调色、应用图标和徽章,以表谢意</string>+ <string name="supporter_perks_locked">支持 Myspoti 后解锁。全凭自觉:不会进行任何验证。</string>+ <string name="supporter_i_supported">我已支持 Myspoti</string>+ <string name="supporter_how">你是如何支持的?</string>+ <string name="supporter_once">一次捐助</string>+ <string name="supporter_monthly">每月</string>+ <string name="supporter_badge">支持者</string>+ <string name="supporter_thanks_title">感谢你的支持!</string>+ <string name="supporter_thanks_body">如果 Myspoti 仍然对你有帮助,再次小额捐助能帮助它继续下去。</string>+ <string name="support_again">再次支持</string>+ <string name="supporter_accent">强调色</string>+ <string name="supporter_icon">应用图标</string>+ <string name="supporter_icon_note">更换图标后,其主屏幕快捷方式可能会消失:应用仍保留在应用列表中。</string>+ <string name="supporter_monthly_switch">我每月支持(不再提醒)</string>+ <string name="color_green">绿色</string>+ <string name="color_blue">蓝色</string>+ <string name="color_purple">紫色</string>+ <string name="color_pink">粉色</string>+ <string name="color_orange">橙色</string>+ <string name="about_detail">版本、Discord 社区、源代码</string>+ <string name="about_discord">Discord</string>+ <string name="about_discord_detail">新闻、帮助和创意:加入社区</string>+ <string name="about_github">源代码</string>+ <string name="about_github_detail">GitHub 上的版本发布、问题和代码</string>+ <string name="about_free">免费、开源、无广告。与 Spotify 无关联。</string>+ <string name="library_reorder_hint">按住播放列表,然后拖动即可移动</string>+ <string name="library_reorder_reset">恢复 Spotify 的顺序</string>+ <string name="song_radio_failed">无法打开这首歌的电台</string>+ <string name="song_radio_name">%1$s 电台</string>+ <string name="local_files_find_hint">在本地文件中查找</string>+ <string name="data_saver_title">流量节省</string>+ <string name="data_saver_summary">使用移动数据时,Myspoti 不使用流量:只播放已下载的歌曲和本地文件</string>+ <string name="data_saver_blocked">流量节省:使用移动数据时,只播放已下载的歌曲和本地文件</string>+ <string name="new_releases_followed">来自你关注的艺人</string>+ <string name="new_releases_latest">最新发行</string>+ <string name="your_episodes_title">你的节目</string>+ <string name="your_episodes_empty">你保存的节目会显示在这里。</string>+ <string name="recap_title">你的回顾</string>+ <string name="recap_month">30 天</string>+ <string name="recap_year">12 个月</string>+ <string name="recap_all">全部时间</string>+ <string name="recap_minutes">%1$d 分钟</string>+ <string name="recap_listens">收听 %1$d 次</string>+ <string name="recap_sources">Spotify %1$d 分钟 • 下载 %2$d 分钟 • 本地文件 %3$d 分钟</string>+ <string name="recap_empty">多听一会儿:你的热门曲目和艺人会显示在这里。</string>+ <string name="recently_played_empty">你在此账号上播放的内容会显示在这里。</string>+ <string name="recently_played_failed">无法加载最近播放列表(%1$s)</string>+ <string name="recents_title">最近</string>+ <string name="recents_detail">你在所有设备上播放过的内容</string>+ <string name="recents_filter_music">音乐</string>+ <string name="recents_filter_podcasts">播客</string>+ <string name="recents_today">今天</string>+ <string name="recents_yesterday">昨天</string>+ <string name="recents_played_one">播放了 1 首曲目</string>+ <string name="recents_played_many">播放了 %1$d 首曲目</string>+ <string name="recents_saved_one">添加了 1 首曲目</string>+ <string name="recents_saved_many">添加了 %1$d 首曲目</string>+ <string name="recents_expand">显示曲目</string>+ <string name="recents_collapse">隐藏曲目</string>+ <string name="recap_plays">播放 %1$d 次</string>+ <string name="recap_top_tracks">热门曲目</string>+ <string name="recap_top_artists">热门艺人</string>+ <string name="recap_top_albums">热门专辑</string>+ <string name="recap_private_note">统计在 Myspoti 中播放的所有内容(Spotify、下载、本地文件)。数据仅保存在此手机上,绝不会发送给 Spotify。</string>+ <string name="recap_detail">你的收听记录,包括下载和本地文件</string>+ <string name="track_credits">创作人员</string>+ <string name="exclude_taste">从你的口味档案中排除</string>+ <string name="include_taste">加入你的口味档案</string>+ <string name="playback_speed">播放速度</string>+ <string name="recommended_songs">推荐歌曲</string>+ <string name="jam_title">Jam</string>+ <string name="jam_leave">离开 Jam</string>+ <string name="jam_members">%1$d 人正在收听</string>+ <string name="jam_start">开启 Jam</string>+ <string name="jam_invite">分享邀请链接</string>+ <string name="jam_failed">Spotify 拒绝了此 Jam</string>+ <string name="jam_scan">扫描 Jam 二维码</string>+ <string name="beta_logs_title">最近 %1$d 分钟的日志</string>+ <string name="beta_logs_copy">复制</string>+ <string name="beta_logs_copied">日志已复制</string>+ <string name="beta_logs_share">分享</string>+ <string name="beta_logs_close">关闭</string>+ <string name="widget_description">正在播放,带播放和跳过按钮</string>+ <string name="widget_previous">上一首</string>+ <string name="widget_next">下一首</string>+ <string name="widget_play_pause">播放或暂停</string>+ <string name="offline_only_downloaded">离线:仅播放 %2$d 首中已下载的 %1$d 首</string>+ <string name="track_sort_title">标题</string>+ <string name="track_sort_artist">艺人</string>+ <string name="track_sort_album">专辑</string>+ <string name="track_sort_duration">时长</string>+ <string name="setup_title">设置 Myspoti</string>+ <string name="setup_subtitle">按需授权;之后可在手机设置中更改。</string>+ <string name="setup_notifications_title">通知</string>+ <string name="setup_notifications_detail">在锁屏和通知栏中控制播放</string>+ <string name="setup_local_title">本地音乐</string>+ <string name="setup_local_detail">播放存储在手机上的音乐文件</string>+ <string name="setup_bluetooth_title">蓝牙</string>+ <string name="setup_bluetooth_detail">在播放器中显示耳机或音箱的名称</string>+ <string name="setup_battery_title">电池无限制</string>+ <string name="setup_battery_detail">息屏后音乐继续播放</string>+ <string name="setup_enable">允许</string>+ <string name="setup_continue">继续</string>+ <string name="local_folders_button">文件夹</string>+ <string name="local_folders_title">文件夹</string>+ <string name="local_folders_detail">选择“本地文件”中显示的文件夹。通讯应用和录音文件夹默认隐藏。</string>+ <string name="smart_shuffle_title">智能随机播放</string>+ <string name="smart_shuffle_on">智能随机播放:Spotify 的推荐会加入随机播放的播放列表。</string>+ <string name="track_sort_added">添加日期</string>+ <string name="settings_title">设置</string>+ <string name="settings_detail">音质、下载、流量、电池和语言</string>+ <string name="settings_section_playback">播放</string>+ <string name="settings_section_downloads">下载</string>+ <string name="settings_section_data">流量和电池</string>+ <string name="settings_section_display">显示和语言</string>+ <string name="settings_section_app">应用</string>+ <string name="quality_streaming_title">流媒体音质</string>+ <string name="quality_streaming_detail">播放器通过网络获取的音质。</string>+ <string name="quality_streaming_auto">自动</string>+ <string name="quality_streaming_auto_detail">根据你的网络连接自动调整</string>+ <string name="quality_streaming_low">最低</string>+ <string name="quality_streaming_low_detail">24 kbit/s,最低可能值:最省流量</string>+ <string name="quality_streaming_normal">普通</string>+ <string name="quality_streaming_normal_detail">96 kbit/s,音质与流量的良好平衡</string>+ <string name="quality_streaming_high">高</string>+ <string name="quality_download_title">下载音质</string>+ <string name="quality_download_detail">歌曲为离线收听而保存的方式。</string>+ <string name="quality_download_off">关</string>+ <string name="quality_download_off_detail">不下载</string>+ <string name="quality_download_cd">FLAC,CD 音质</string>+ <string name="quality_download_cd_detail">无损 16 位,每首约 30 MB</string>+ <string name="quality_download_hires">FLAC Hi-Res</string>+ <string name="quality_download_hires_detail">有则使用 24 位,文件约大三倍</string>+ <string name="setup_quality_title">音质</string>+ <string name="setup_quality_subtitle">选择 Myspoti 播放和保存音乐的方式。之后可在“设置”中更改。</string>+ <string name="downloads_off_toast">下载已关闭。请在“设置”中开启。</string>+ <string name="quality_streaming_high_detail">160 kbit/s,最佳音质</string>+ <string name="quality_download_small">最小</string>+ <string name="quality_download_small_detail">AAC 96 kbit/s,最轻量:每首约 3 MB</string>+ <string name="settings_solid_nav_title">纯色底部栏</string>+ <string name="settings_solid_nav_detail">标签栏后面为黑色,而不是在列表上渐隐</string>+ <string name="quality_download_ask">每次询问</string>+ <string name="quality_download_ask_detail">下载开始时选择,整个播放列表只需选一次</string>+ <string name="quality_sheet_title">音质</string>+ <string name="quality_now">正在播放:%1$s</string>+ <string name="quality_now_unknown">暂时未知:请先播放一首歌</string>+ <string name="update_downloading">正在下载… %1$d%%</string>+ <string name="update_installing">正在安装…</string>+ <string name="update_needs_permission">要更新,请允许 Myspoti 安装应用,然后回到这里。</string>+ <string name="update_allow">允许</string>+ <string name="update_failed">更新失败:%1$s</string>+ <string name="update_retry">重试</string>+ <!-- A18: the automatic update check can be turned off; the manual check stays. -->+ <string name="settings_auto_update_title">启动时检查更新</string>+ <string name="settings_auto_update_detail">关闭:应用启动时不检查。下方的手动检查仍然可用。</string>+ <string name="settings_check_update_title">立即检查更新</string>+ <string name="settings_check_update_detail">查找较新的版本并提示安装</string>+ <string name="settings_update_checking">正在检查…</string>+ <string name="settings_update_check_latest">Myspoti 已是最新版本</string>+ <!-- A25: stop the queue, keep the songs already downloaded. -->+ <string name="downloads_stop_all_title">停止所有下载</string>+ <string name="downloads_stop_all_detail">取消剩余的下载;已下载的歌曲会保留</string>+ <string name="removed_from">已从%1$s移除</string>+ <!-- Track options inside a playlist (A11/A12). -->+ <string name="context_menu_remove_from_playlist">从此播放列表中移除</string>+ <string name="context_menu_add_to_another_playlist">添加到其他播放列表</string>+ <string name="add_to_playlist_search_hint">查找播放列表</string>+ <string name="add_to_playlist_empty">你没有可添加此曲目的播放列表</string>+ <string name="add_to_playlist_no_match">没有与“%1$s”匹配的播放列表</string>+ <string name="undo">撤销</string>+ <string name="done">完成</string>+ <string name="playlist_edit_details">编辑详情</string>+ <string name="playlist_name_label">名称</string>+ <string name="playlist_description_label">描述</string>+ <string name="playlist_change_cover">更换封面</string>+ <string name="playlist_remove_cover">移除封面</string>+ <string name="playlist_save">保存</string>+ <string name="playlist_access_title">谁可以看到</string>+ <string name="choose_artist">选择艺人</string>+ <string name="quality_streaming_wifi_title">Wi-Fi 流媒体音质</string>+ <string name="quality_streaming_cell_title">移动数据流媒体音质</string>+ <string name="canvas_wifi_only">仅在 Wi-Fi 下使用 Canvas</string>+ <string name="canvas_wifi_only_detail">循环视频仅在 Wi-Fi 下播放,绝不使用移动数据</string>+ <string name="playlist_delete_confirm">删除“%1$s”?90 天内可从你的 Spotify 账号恢复。</string>+ <string name="playlist_saved">播放列表已更新</string>+ <string name="go_to_profile">前往个人资料</string>+ <string name="cancel">取消</string>+ <plurals name="profile_followers">+ <item quantity="other">%1$d 位粉丝</item>+ </plurals>+ <string name="profile_following_count">关注 %1$d</string>+ <string name="profile_public_playlists">公开播放列表</string>+ <string name="profile_followers_title">粉丝</string>+ <string name="profile_following_title">关注</string>+ <string name="profile_list_empty">这里还没有人</string>+ <string name="artist_ban">不播放此艺人</string>+ <string name="artist_unban">允许播放此艺人</string>+ <string name="artist_banned">%1$s 不会再出现在你的混合推荐和电台中</string>+ <string name="artist_unbanned">%1$s 可以再次播放</string>+ <string name="episode_save">添加到“你的节目”</string>+ <string name="episode_unsave">从“你的节目”中移除</string>+ <string name="search_filter_profiles">个人资料</string>+ <string name="view_profile">查看个人资料</string>+ <string name="folder_delete">删除文件夹</string>+ <string name="folder_delete_confirm">删除文件夹“%1$s”?其中的播放列表会保留在你的音乐库中。</string>+ <string name="library_pin">置顶</string>+ <string name="library_unpin">取消置顶</string>+ <string name="library_move_to_folder">移到文件夹</string>+ <string name="library_top_level">你的音乐库(顶层)</string>+ <string name="more_like_this">更多类似内容</string>+ <string name="library_sort_recents">最近</string>+ <string name="library_sort_recently_added">最近添加</string>+ <string name="library_change_failed">无法更新你的音乐库,请重试</string>+ <string name="a11y_close_player">关闭播放器</string>+ <string name="a11y_share">分享</string>+ <string name="search_failed">搜索失败。请检查网络连接。</string>+ <string name="retry_button">重试</string>+ <string name="page_load_failed">无法加载此页面。\n请检查网络连接后重试。</string>+ <string name="jam_paste_link">使用已复制的链接加入</string>+ <string name="play_refused">Spotify 拒绝在你的账号上播放此内容。部分国家/地区的免费账号只能随机播放:请使用随机播放按钮。</string>+ <string name="play_refused_all">Spotify 目前拒绝此播放器对你的账号发出的所有指令(播放、跳转、转移播放)。播放器已重新加载一次;如果仍无法播放,请完全关闭应用后重新打开,或在 Wi-Fi 和移动数据之间切换。</string>+ <string name="drm_missing">无法在此播放:此手机的 Android System WebView 没有可用的 Widevine DRM,而 Spotify 需要它。请在 Play 商店更新 Android System WebView 和 Chrome,并在“设置”>“开发者选项”>“WebView 实现”中选择它。</string>+ <string name="artist_liked_songs">已点赞的歌曲</string>+ <plurals name="artist_liked_songs_count">+ <item quantity="other">%1$d 首歌曲 • %2$s</item>+ </plurals>+ <string name="share_link">分享链接</string>+ <string name="share_as_image">以图片分享</string>+ <string name="settings_autoplay_title">自动播放</string>+ <string name="settings_autoplay_detail">音乐播放完后,继续播放类似的歌曲</string>+ <string name="settings_crossfade_title">淡入淡出(曲目淡入淡出,不重叠)</string>+ <string name="settings_crossfade_detail">一首歌在最后几秒淡出,下一首淡入。它们不会同时播放:一个播放器,一路音频流。</string>+ <string name="settings_crossfade_off">关</string>+ <string name="settings_crossfade_seconds">%1$d 秒</string>+ <string name="settings_rotation_title">屏幕旋转</string>+ <string name="settings_rotation_portrait">竖屏</string>+ <string name="settings_rotation_auto">自动</string>+ <string name="settings_rotation_landscape">横屏</string>+ <string name="support_github_action">在 GitHub 上赞助</string>+ <string name="download_on_mobile_data">正在使用移动数据下载:会消耗你的流量套餐</string>++ <!-- Podcast show page, episode page and podcast player -->+ <string name="show_follow">关注</string>+ <string name="show_following">已关注</string>+ <string name="show_tab_episodes">节目</string>+ <string name="show_tab_chapters">章节</string>+ <string name="show_tab_about">简介</string>+ <string name="show_sort_newest">所有节目 • 最新优先</string>+ <string name="show_sort_oldest">所有节目 • 最早优先</string>+ <string name="show_sort_chapters_newest">所有章节 • 最新优先</string>+ <string name="show_sort_chapters_oldest">所有章节 • 最早优先</string>+ <string name="show_empty">这里暂时没有可播放的内容</string>+ <string name="show_authors">作者:%1$s</string>+ <string name="show_narrators">朗读:%1$s</string>+ <string name="episode_duration_min">%1$d 分钟</string>+ <string name="episode_remaining">剩余 %1$s</string>+ <string name="episode_mark_played">标记为已播放</string>+ <string name="episode_mark_unplayed">标记为未开始</string>+ <string name="episode_marked_played">已标记为已播放</string>+ <string name="episode_marked_unplayed">已标记为未开始</string>+ <string name="episode_play">播放</string>+ <string name="episode_open">打开节目</string>+ <string name="episode_add_queue">添加到队列</string>+ <string name="episode_show_more">展开</string>+ <string name="episode_show_less">收起</string>+ <string name="episode_download">下载</string>+ <string name="episode_download_remove">移除下载</string>+ <string name="episode_options">节目选项</string>+ <string name="episode_not_found">未找到节目</string>+ <string name="podcast_playing_from">正在播放播客</string>+ <string name="player_speed_chip">%1$s×</string>+ <string name="player_back_15">后退 15 秒</string>+ <string name="player_forward_15">前进 15 秒</string>+ <string name="player_sleep_timer">睡眠定时</string>+ <string name="restart_player_done">播放器已重启</string>+ <string name="spotify_limited">Spotify 暂时限制了播放。请一分钟后重试。</string>+ <string name="library_change_undone">Spotify 拒绝了更改,你的音乐库已恢复原样</string>+ <string name="blend_title">Blend</string>+ <string name="blend_detail">由你和朋友的口味混合而成的播放列表</string>+ <string name="blend_invite">邀请朋友加入 Blend</string>+ <string name="blend_join">通过链接加入</string>+ <string name="blend_join_title">粘贴邀请链接</string>+ <string name="blend_join_button">加入</string>+ <string name="blend_invite_message">一起在 Spotify 上创建 Blend 吧:%1$s</string>+ <string name="blend_failed">无法连接 Spotify 的 Blend,请重试</string>+ <string name="blend_bad_link">这不是 Blend 邀请链接</string>+ <string name="blend_own_invite">这是你自己的邀请:请发送给朋友</string>+ <string name="blend_full">此 Blend 已满</string>+ <string name="blend_deleted">此 Blend 已被删除</string>+ <string name="blend_working">处理中…</string>+ <string name="blend_invited_by">%1$s 邀请你加入 Blend</string>+ <string name="blend_later">以后再说</string>+ <string name="blend_members">成员</string>+ <string name="blend_invite_more">邀请更多人</string>+ <string name="blend_rename">重命名 Blend</string>+ <string name="blend_leave">退出 Blend</string>+ <string name="blend_leave_confirm">退出“%1$s”?它会从你的音乐库中消失,其他人仍会保留。</string>+ <string name="blend_leave_button">退出</string>+ <string name="playlist_invite_banner">你被邀请协作编辑此播放列表</string>+ <string name="playlist_invite_join">加入</string>+ <string name="playlist_invite_joined">你现在是协作者</string>+ <string name="settings_keep_playing_title">关闭应用后继续播放</string>+ <string name="settings_keep_playing_detail">关闭后,从最近任务中关闭 Myspoti 会停止音乐</string>+ <string name="recommended_songs_from_name">根据此播放列表的名称</string>+ <string name="recommended_songs_from_songs">根据此播放列表中的内容</string>+ <string name="recommended_songs_refresh">刷新</string>+ <string name="recommended_songs_add">添加到此播放列表</string>+ <string name="smart_shuffle_recommended">智能随机播放推荐</string>+ <string name="smart_shuffle_add">添加到此播放列表</string>+ <string name="add_songs_title">添加到此播放列表</string>+ <string name="add_songs_close">关闭</string>+ <string name="add_songs_search_hint">搜索歌曲</string>+ <string name="add_songs_nothing">未找到与“%1$s”相关的歌曲</string>+ <string name="add_songs_added">已添加</string>+ <string name="spotify_code_description">Spotify Code</string>+ <string name="spotify_code_hint">在 Spotify 中扫描它(搜索,然后点相机)即可打开。</string>+ <string name="spotify_code_share_image">分享代码</string>+ <string name="copy_link">复制链接</string>+ <string name="link_copied">链接已复制</string>+ <string name="lyrics_meaning_title">含义</string>+ <string name="lyrics_meaning_about">关于</string>+ <string name="lyrics_meaning_translating">正在翻译…</string>+ <string name="lyrics_meaning_translate">翻译</string>+ <string name="lyrics_meaning_original">查看原文</string>+ <string name="lyrics_meaning_hint">虚线歌词:按住一行即可阅读 Genius 对它的解释。</string>+ <string name="clip_sound_song">声音:歌曲</string>+ <string name="clip_sound_clip">声音:视频</string>+ <string name="clip_sound_on_hint">你现在听到的是视频自带的声音。歌曲仍在 Spotify 中静音播放,因此仍会计入播放。</string>+ <string name="clip_sound_off_hint">你现在又听到 Spotify 的歌曲了。</string>+ <string name="lyrics_word_sync_title">逐字歌词</string>+ <string name="lyrics_word_sync_on">优先使用卡拉 OK 时间轴(LyricsPlus、lrc.red、Kugou)</string>+ <string name="lyrics_word_sync_off">逐行歌词,优先使用 Spotify</string>+ <string name="playlist_invite_collaborators">邀请协作者</string>+ <string name="playlist_invite_message">加入我在 Spotify 上的播放列表“%1$s”,你可以向其中添加歌曲:%2$s</string>+ <string name="playlist_invite_failed">无法生成邀请链接</string>+ <string name="playlist_by">创建者:%1$s</string>+ <string name="playlist_leave">退出播放列表</string>+ <string name="playlist_leave_confirm">退出%1$s?你将不再是协作者,也无法添加或移除歌曲。若要重新加入,需要新的邀请链接。</string>+ <string name="playlist_leave_button">退出</string>+ <string name="playlist_make_public">设为公开</string>+ <string name="playlist_make_private">设为私密</string>+ <string name="playlist_stop_collab">停止协作</string>+ <string name="playlist_add_profile">添加到个人资料</string>+ <string name="playlist_remove_profile">从个人资料中移除</string>+ <string name="playlist_now_public">播放列表已设为公开</string>+ <string name="playlist_now_private">播放列表已设为私密</string>+ <string name="playlist_now_solo">现在只有你可以添加歌曲</string>+ <string name="playlist_now_on_profile">已添加到你的个人资料</string>+ <string name="playlist_now_off_profile">已从你的个人资料中移除</string>+ <string name="playlist_collab_locked">协作播放列表:要添加歌曲,请向%1$s索取邀请链接。</string>+ <string name="playlist_collab_owner">其所有者</string>+ <string name="playlist_members_title">协作者</string>+ <string name="playlist_member_owner">创建者</string>+ <string name="playlist_member_collab">协作者</string>+ <string name="playlist_members_more">%1$s 和其他 %2$d 人</string>+ <string name="profile_block">屏蔽</string>+ <string name="profile_unblock">取消屏蔽</string>+ <string name="profile_block_title">屏蔽 %1$s?</string>+ <string name="profile_block_confirm">%1$s 将无法关注你,也无法查看你的个人资料和公开播放列表。你随时可以在其个人资料页取消屏蔽。</string>+ <string name="profile_blocked">你已屏蔽此用户</string>+ <string name="profile_block_failed">无法更改屏蔽状态,请重试</string>+ <string name="profile_more_options">更多选项</string>+</resources>diff --git a/base/app/src/main/res/values-zh/spotify_strings.xml b/base/app/src/main/res/values-zh/spotify_strings.xmlindex ea576342..9a8957be 100644--- a/base/app/src/main/res/values-zh/spotify_strings.xml+++ b/base/app/src/main/res/values-zh/spotify_strings.xml@@ -17,7 +17,6 @@<string name="snackbar_added_to_liked_songs" formatted="false">已加入“已点赞的歌曲”。</string><string name="snackbar_removed_from_liked_songs" formatted="false">已从“已点赞的歌曲”中删除。</string><string name="content_description_context_menu" formatted="false">更多选项</string>- <string name="close_button_content_description" formatted="false">关闭</string><string name="add_to_playlist_saved_in_section_header" formatted="false">保存位置</string><string name="add_to_playlist_new_playlist_button_text" formatted="false">新建歌单</string><string name="add_to_playlist_button_cancel" formatted="false">取消</string>@@ -25,8 +24,6 @@<string name="lyrics_card_title" formatted="false">歌词</string><string name="lyrics_card_title_preview" formatted="false">歌词预览</string><string name="lyrics_card_show_lyrics_button" formatted="false">显示歌词</string>- <string name="lyrics_card_expand_button_content_description" formatted="false">全屏打开歌词</string>- <string name="lyrics_card_share_button_content_description" formatted="false">分享歌词</string><string name="lyrics_credential_note" formatted="false">歌词提供者:%1$s</string><string name="lyrics_fullscreen_chip_label_share" formatted="false">分享</string><string name="lyrics_fullscreen_chip_label_translate" formatted="false">翻译</string>@@ -49,7 +46,6 @@<string name="artist_popular_tracks" formatted="false">热门</string><string name="curation_button_follow_state_text" formatted="false">关注</string><string name="curation_button_following_state_text" formatted="false">已关注</string>- <string name="search_main_entity_subtitle_artist" formatted="false">艺人</string><string name="connect_phone_is_self" formatted="false">此手机</string><string name="settings_item_canvas_title" formatted="false">Canvas</string><string name="video_settings_canvas_subtitle" formatted="false">歌曲播放时的简短视觉循环效果。</string>@@ -106,8 +102,6 @@<string name="library_search_text_hint" formatted="false">搜索“音乐库”</string><string name="account_title" formatted="false">帐号</string><string name="song_dna_search_chip_followed_artists" formatted="false">已关注艺人</string>- <string name="settings_item_crossfade_title" formatted="false">淡入/淡出</string>- <string name="playback_settings_crossfade_slider_seconds" formatted="false">%1$d 秒</string><string name="local_files_title" formatted="false">本地文件</string><string name="local_files_empty_section_title" formatted="false">将你的音频文件添加到“音乐库”</string><string name="local_files_empty_section_subtitle" formatted="false">找到了 Spotify 没有的歌曲或个人播客?</string>@@ -137,14 +131,10 @@<string name="assisted_curation_search_filter_artists" formatted="false">艺人</string><string name="assisted_curation_search_filter_albums" formatted="false">专辑</string><string name="assisted_curation_search_filter_playlists" formatted="false">歌单</string>- <string name="assisted_curation_search_filter_clear_content_description" formatted="false">清除筛选条件</string>- <string name="ad_category_title_music" formatted="false">音乐</string>- <string name="made_for_you_hub_title" formatted="false">为小雅打造</string><string name="settings_item_app_language_title" formatted="false">应用语言</string><string name="create_menu_item_folder_title" formatted="false">文件夹</string><string name="create_folder_name_suggested_folder_name" formatted="false">新文件夹</string><string name="context_menu_rename_folder" formatted="false">重命名文件夹</string>- <string name="your_library_messaging_folder_rename_hint" formatted="false">文件夹名</string><string name="create_playlist_content_description" formatted="false">创建歌单</string><string name="actions_picker_delete" formatted="false">删除</string><string name="filter_and_sort_sort_section_title" formatted="false">排序方式</string>diff --git a/base/app/src/main/res/values-zh/strings.xml b/base/app/src/main/res/values-zh/strings.xmlnew file mode 100644index 00000000..274750f6--- /dev/null+++ b/base/app/src/main/res/values-zh/strings.xml@@ -0,0 +1,25 @@+<resources>+ <string name="app_name">Myspoti</string>+ <string name="aa_playlists">播放列表</string>+ <string name="aa_albums">专辑</string>+ <string name="aa_artists">艺人</string>+ <string name="settings_amoled_theme">AMOLED 主题</string>+ <string name="settings_amoled_theme_subtitle">纯黑背景,节省电量</string>+ <string name="main_update_available">有新的更新可用</string>++ <string name="notif_action_play">播放</string>+ <string name="notif_action_pause">暂停</string>+ <string name="notif_shuffle_enable">开启随机播放</string>+ <string name="notif_shuffle_disable">关闭随机播放</string>+ <string name="notif_shuffle_disable_smart">关闭智能随机播放</string>+++ <string name="energy_saver_title">省电模式</string>+ <string name="energy_saver_summary">关闭 Canvas,视频和动画更轻量</string>+ <string name="video_fullscreen_enter">全屏</string>+ <string name="video_fullscreen_exit">退出全屏</string>+ <string name="playback_seek_description">播放位置</string>+ <string name="account_page_title">Spotify 账号</string>+ <string name="account_page_detail">订阅、隐私和设备,在 spotify.com 上管理</string>+ <string name="player_source_downloaded">已下载</string>+</resources>diff --git a/base/app/src/main/res/values-zu/spotify_strings.xml b/base/app/src/main/res/values-zu/spotify_strings.xmlindex 37846bb1..00c1d570 100644--- a/base/app/src/main/res/values-zu/spotify_strings.xml+++ b/base/app/src/main/res/values-zu/spotify_strings.xml@@ -17,7 +17,6 @@<string name="snackbar_added_to_liked_songs" formatted="false">Kunezelwe kokuthi Izingoma Ezithandiwe.</string><string name="snackbar_removed_from_liked_songs" formatted="false">Kususiwe kokuthi Izingoma Ezithandiwe.</string><string name="content_description_context_menu" formatted="false">Izinketho ezengeziwe</string>- <string name="close_button_content_description" formatted="false">Vala</string><string name="add_to_playlist_saved_in_section_header" formatted="false">Kulondolozwe kokuthi</string><string name="add_to_playlist_new_playlist_button_text" formatted="false">Uhlu lokudlalayo olusha</string><string name="add_to_playlist_button_cancel" formatted="false">Khansela</string>@@ -25,8 +24,6 @@<string name="lyrics_card_title" formatted="false">Amagama engoma</string><string name="lyrics_card_title_preview" formatted="false">Ukuhlola kuqala kwamagama engoma</string><string name="lyrics_card_show_lyrics_button" formatted="false">Bonisa amagama engoma</string>- <string name="lyrics_card_expand_button_content_description" formatted="false">Vula amagama engoma esikrini esigcwele</string>- <string name="lyrics_card_share_button_content_description" formatted="false">Yabelana ngamagama wengoma</string><string name="lyrics_credential_note" formatted="false">Amagama engoma ahlinzekwe ngu-%1$s</string><string name="lyrics_fullscreen_chip_label_share" formatted="false">Yabelana</string><string name="lyrics_fullscreen_chip_label_translate" formatted="false">Humusha</string>@@ -49,7 +46,6 @@<string name="artist_popular_tracks" formatted="false">Okudumile</string><string name="curation_button_follow_state_text" formatted="false">Landela</string><string name="curation_button_following_state_text" formatted="false">Obalandelayo</string>- <string name="search_main_entity_subtitle_artist" formatted="false">Umculi</string><string name="connect_phone_is_self" formatted="false">Le foni</string><string name="settings_item_canvas_title" formatted="false">I-Canvas</string><string name="video_settings_canvas_subtitle" formatted="false">Okubukwayo okufushane, okuphindayo lapho kudlala ingoma.</string>@@ -107,8 +103,6 @@<string name="library_search_text_hint" formatted="false">Sesha Umtapo Wakho</string><string name="account_title" formatted="false">I-akhawunti</string><string name="song_dna_search_chip_followed_artists" formatted="false">Abaculi abalandelwayo</string>- <string name="settings_item_crossfade_title" formatted="false">Isixubanisi</string>- <string name="playback_settings_crossfade_slider_seconds" formatted="false">%1$d s</string><string name="local_files_title" formatted="false">Amafayela Alapha</string><string name="local_files_empty_section_title" formatted="false">Nezela amafayela akho omsindo kokuthi Umtapo Wakho</string><string name="local_files_empty_section_subtitle" formatted="false">Ingabe unayo ingoma noma i-podcast yomuntu siqu engekho ku-Spotify?</string>@@ -138,14 +132,10 @@<string name="assisted_curation_search_filter_artists" formatted="false">Abaculi</string><string name="assisted_curation_search_filter_albums" formatted="false">Ama-albhamu</string><string name="assisted_curation_search_filter_playlists" formatted="false">Izinhlu zokudlalayo</string>- <string name="assisted_curation_search_filter_clear_content_description" formatted="false">Sula isihlungi</string>- <string name="ad_category_title_music" formatted="false">Umculo</string>- <string name="made_for_you_hub_title" formatted="false">Ezenzelwe Wena</string><string name="settings_item_app_language_title" formatted="false">Ulimi lohlelo</string><string name="create_menu_item_folder_title" formatted="false">Ifolda</string><string name="create_folder_name_suggested_folder_name" formatted="false">Ifolda entsha</string><string name="context_menu_rename_folder" formatted="false">Qamba kabusha ifolda</string>- <string name="your_library_messaging_folder_rename_hint" formatted="false">Igama lefolda</string><string name="create_playlist_content_description" formatted="false">Yenza uhlu lokudlalayo</string><string name="actions_picker_delete" formatted="false">Susa</string><string name="filter_and_sort_sort_section_title" formatted="false">Hlukanisa nge-</string>diff --git a/base/app/src/main/res/values/extensions_strings.xml b/base/app/src/main/res/values/extensions_strings.xmlnew file mode 100644index 00000000..22cc8581--- /dev/null+++ b/base/app/src/main/res/values/extensions_strings.xml@@ -0,0 +1,215 @@+<?xml version="1.0" encoding="utf-8"?>+<resources>+ <string name="extensions_title">Extensions</string>+ <string name="extensions_row_detail">Lyrics, a song\'s audio and scripts written by other people, in a sandbox.</string>+ <string name="extensions_install_file">Install from a file</string>+ <string name="extensions_install_url">Install from an address</string>+ <string name="extensions_url_hint">https://…/extension.zip</string>+ <string name="extensions_none">No extension installed.</string>+ <string name="extensions_installed">Installed</string>+ <string name="extensions_repository_add">Add a repository</string>+ <string name="extensions_repository_hint">https://…/index.json</string>+ <string name="extensions_repository_warning">Myspoti does not review a repository you add: what you install from it is at your own risk.</string>+ <string name="extensions_repository_remove">Remove</string>+ <string name="extensions_repository_refresh">Refresh</string>+ <string name="extensions_install">Install</string>+ <string name="extensions_update">Update</string>+ <string name="extensions_up_to_date">Installed</string>+ <string name="extensions_cancel">Cancel</string>+ <string name="extensions_loading">Reading…</string>+ <string name="extensions_error">Not installed: %1$s</string>+ <string name="extensions_prompt_title_install">Install %1$s?</string>+ <string name="extensions_prompt_title_update">Update %1$s?</string>+ <string name="extensions_prompt_by">%1$s · version %2$s · %3$s</string>+ <string name="extensions_prompt_source">From %1$s</string>+ <string name="extensions_prompt_source_file">a file on this phone</string>+ <string name="extensions_prompt_new">new in this version</string>+ <string name="extensions_prompt_update_same_rights">%1$s → %2$s, with the same rights.</string>+ <string name="extensions_prompt_not_newer">Version %1$s (or a newer one) is already installed.</string>+ <string name="extensions_prompt_sha">Package sha256: %1$s</string>+ <string name="extension_enabled">On</string>+ <string name="extension_running">Running</string>+ <string name="extension_not_running">Not running</string>+ <string name="extension_turned_off">%1$s turned off: %2$s</string>+ <string name="extension_last_error">Last error: %1$s</string>+ <string name="extension_disabled_reason">Turned off: %1$s</string>+ <string name="extension_inactive">Inactive</string>+ <string name="extension_inactive_detail">Inactive: %1$s</string>+ <string name="extension_homepage">Homepage</string>+ <string name="extension_settings">Settings</string>+ <string name="extension_log">Log</string>+ <string name="extension_log_empty">Nothing logged yet.</string>+ <string name="extension_log_clear">Clear the log</string>+ <string name="extension_update_file">Update from a file</string>+ <string name="extension_uninstall">Uninstall</string>+ <string name="extension_uninstall_confirm">Uninstall %1$s? Its settings and what it stored go with it.</string>+ <string name="extension_confirm_title">An extension asks</string>+ <string name="extension_confirm_detail">Nothing is changed unless you allow it.</string>+ <string name="extension_confirm_allow">Allow</string>+ <string name="extension_confirm_refuse">Refuse</string>+ <string name="extensions_row_count">%1$d installed, %2$d enabled</string>+ <string name="extensions_tab_store">Store</string>+ <string name="extensions_search">Search extensions</string>+ <string name="extensions_cat_all">All</string>+ <string name="extensions_cat_lyrics">Lyrics</string>+ <string name="extensions_cat_playback">Playback & audio</string>+ <string name="extensions_cat_library">Library</string>+ <string name="extensions_cat_discovery">Discovery</string>+ <string name="extensions_cat_stats">Stats</string>+ <string name="extensions_cat_look">Look & feel</string>+ <string name="extensions_cat_social">Social</string>+ <string name="extensions_cat_tools">Tools</string>+ <string name="extensions_cat_other">Other</string>+ <string name="extensions_no_match">No extension matches.</string>+ <string name="extensions_browse_store">Browse the store</string>+ <string name="extensions_other_ways">Other ways to install</string>+ <string name="extensions_empty_title">What are extensions?</string>+ <string name="extensions_empty_body">Extensions add to Myspoti what it does not do itself: lyrics from other sources, where a song\'s audio or download comes from, tools that use your Spotify account. Each one runs in a sandbox and asks before it reaches anything. Add a repository to browse them, or install a package you trust.</string>+ <string name="extensions_official_badge">Official</string>+ <string name="extensions_repo_yours">Added by you</string>+ <string name="extensions_repo_community">Community</string>+ <string name="extensions_repo_official_note">Each extension is reviewed before it is listed.</string>+ <string name="extensions_repo_yours_note">Not reviewed by Myspoti: install at your own risk.</string>+ <string name="extensions_repo_error">Could not read this repository: %1$s</string>+ <string name="extensions_repo_empty">This repository lists no extension.</string>+ <string name="extensions_requires">Requires Myspoti %1$s or newer</string>+ <string name="extensions_requires_api">Made for a newer Myspoti (extension API %1$d)</string>+ <string name="extensions_update_badge">Update</string>+ <string name="extensions_move_up">Move up</string>+ <string name="extensions_move_down">Move down</string>+ <string name="extension_off">Off</string>+ <string name="extension_by">by %1$s</string>+ <string name="extension_changelog">What\'s new</string>+ <string name="extension_update_from">Update available: %1$s → %2$s</string>+ <string name="extension_not_listed">This extension is not in your repositories (or they are still loading).</string>+ <string name="extension_details">Details</string>+ <string name="extension_detail_updated">Updated</string>+ <string name="extension_detail_min_app">Needs Myspoti</string>+ <string name="extension_detail_size">Size</string>+ <string name="extension_detail_id">Id</string>+ <string name="extension_detail_sha">Package sha256</string>+ <string name="extension_detail_source">Installed from</string>+ <string name="extension_see_in_store">See in the store</string>++ <!-- Actions: the closed catalogue, as the user reads it -->+ <string name="action_playback_control">Control playback</string>+ <string name="action_playback_queue">Edit the queue</string>+ <string name="action_playback_events">Know what you play</string>+ <string name="action_lyrics_provide">Provide lyrics</string>+ <string name="action_trackinfo_provide">Add song details</string>+ <string name="action_audio_source">Play audio from elsewhere</string>+ <string name="action_download_source">Provide downloads</string>+ <string name="action_home_sections">Add Home sections</string>+ <string name="action_search_provide">Add search results</string>+ <string name="action_menu_items">Add menu entries</string>+ <string name="action_player_buttons">Add player buttons</string>+ <string name="action_settings_page">Its own settings</string>+ <string name="action_notify">Show short messages</string>+ <string name="action_library_read">Read your library</string>+ <string name="action_library_write">Change your library</string>+ <string name="action_playlists_write">Edit your playlists</string>+ <string name="action_spotify_catalog">Browse Spotify</string>+ <string name="action_spotify_raw">Full Spotify access</string>+ <string name="action_network">Use the internet</string>+ <string name="action_network_any">Use any website</string>+ <string name="action_webview_page">Its own web page</string>+ <string name="action_storage">Keep its own data</string>+ <string name="action_unknown">Unknown to this Myspoti</string>+ <string name="action_critical">Critical</string>+ <string name="action_no_why">(no reason given)</string>+ <string name="actions_title">What it does</string>+ <string name="actions_critical_warning">Critical actions can change your account, replace where songs come from or show a free web page. Allow them only if you trust the author: Myspoti still asks before anything is removed.</string>+ <!-- Areas of the Installed tab -->+ <string name="area_playback">Playback</string>+ <string name="area_lyrics">Lyrics & song info</string>+ <string name="area_audio">Audio & downloads</string>+ <string name="area_home">Home & search</string>+ <string name="area_menus">Menus & player</string>+ <string name="area_library">Library & Spotify</string>+ <string name="area_other">Pages & more</string>+ <string name="area_activity">Recent activity</string>+ <string name="area_turn_off">Turn off</string>+ <string name="area_active">Active</string>+ <string name="area_idle">Idle</string>+ <string name="area_make_active">Make it the one for %1$s</string>+ <!-- Install prompt -->+ <string name="ext_third_party_notice">Third-party extension, not reviewed by Myspoti, under its author\'s responsibility.</string>+ <string name="ext_risk_accept">I understand this extension is made by a third party and I install it on my own responsibility</string>+ <string name="ext_clash_exclusive">Replaces %1$s, currently provided by %2$s</string>+ <string name="ext_clash_conflict">Incompatible with %1$s (installed)</string>+ <string name="ext_clash_replaces">Replaces %1$s (installed)</string>+ <string name="ext_clash_keep_new">Use %1$s (the other stays installed, %2$s)</string>+ <string name="ext_clash_keep_old">Keep %1$s</string>+ <string name="ext_clash_idle">idle</string>+ <string name="ext_clash_off">turned off</string>+ <string name="ext_clash_title">Which one to keep?</string>+ <string name="ext_clash_ok">Done</string>+ <!-- Blocks and pages -->+ <string name="ext_from">From %1$s</string>+ <string name="ext_overflow">Extensions</string>+ <string name="ext_open_page">Open its page</string>+ <string name="ext_page_failed">This extension\'s page could not be shown.</string>+ <string name="ext_suspended_title">%1$s paused</string>+ <string name="ext_suspended_body">It kept undoing what %1$s did with playback: its playback commands are suspended.</string>+ <string name="ext_suspended_keep">Let it go on</string>+ <string name="ext_welcome_title">%1$s is installed</string>+ <string name="ext_welcome_steps">To finish</string>+ <string name="ext_welcome_from">Written by the extension.</string>+ <string name="ext_welcome_ok">Got it</string>++ <!-- GitHub: discovery, ratings, reports -->+ <string name="extensions_github_title">On GitHub</string>+ <string name="extensions_github_note">Published by the community, not reviewed by Myspoti. Each author is responsible for their extension.</string>+ <string name="extensions_show_all">Show all (%1$d hidden)</string>+ <string name="extensions_show_less">Hide blocked, reported, low-rated and abandoned ones</string>+ <string name="extension_rating">★ %1$s · %2$d votes</string>+ <string name="extension_rating_none">No votes yet</string>+ <string name="extension_downloads">%1$s downloads</string>+ <string name="extension_rate_up">Rate it good</string>+ <string name="extension_rate_down">Rate it bad</string>+ <string name="extension_rated">Thanks: your vote is on GitHub</string>+ <string name="extension_signin_title">Sign in to GitHub</string>+ <string name="extension_signin_body">Open %1$s and type this code. Myspoti never sees your password.</string>+ <string name="extension_signin_open">Open GitHub</string>+ <string name="extension_report">Report</string>+ <string name="extension_detail_github">GitHub</string>+ <string name="extension_detail_ref">Version on GitHub</string>++ <!-- Updates from GitHub -->+ <string name="extension_check_updates">Check for updates</string>+ <string name="extension_check_up_to_date">Up to date</string>+ <string name="extension_check_applied">Updated: it asks nothing new</string>+ <string name="extension_check_needs_ok">An update needs your OK</string>+ <string name="extension_check_declined">You kept this version</string>+ <string name="extension_check_incompatible">The new version needs a newer Myspoti</string>+ <string name="extension_check_blocked">The new version is blocked by Myspoti</string>+ <string name="extension_check_failed">Could not check: see its log</string>+ <string name="extension_source_gone">Source gone: its repository no longer exists. It keeps running from the copy on your phone.</string>+ <string name="extension_revert">Revert to %1$s</string>+ <string name="extension_reverted">Back to %1$s</string>+ <string name="extension_update_needs_ok">Update needs your OK: %1$s → %2$s</string>+ <string name="extension_update_needs_ok_body">This version asks for more than you accepted. The current one keeps running until you choose.</string>+ <string name="extension_update_accept">Accept</string>+ <string name="extension_update_keep">Keep current</string>+ <string name="extension_refused_title">Waits for your OK</string>+ <string name="extension_refused_body">It was installed when actions could be unticked, and some were. Extensions now get every action they list: it stays off until you accept them.</string>+ <string name="extension_change_action">New: %1$s</string>+ <string name="extension_change_host">New website: %1$s</string>+ <string name="extension_change_any_host">Any website</string>+ <string name="extension_change_exclusive">Now exclusive: %1$s</string>+ <string name="extension_change_why">New reason for %1$s</string>+ <string name="extension_change_was">Was: “%1$s”</string>+ <string name="extension_change_repo">Now comes from %1$s (was %2$s)</string>+ <string name="extension_change_author">New author: %1$s (was %2$s)</string>+ <string name="extension_change_replaces">Turns off %1$s when installed</string>+ <string name="extension_change_conflicts">Refuses to run with %1$s</string>+ <string name="action_webview_auth">Sign in on a website</string>+ <string name="extension_confirm_once">Allow once</string>+ <string name="extension_confirm_always">Always allow %1$s</string>+ <string name="ext_auth_title">%1$s: sign in</string>+ <string name="ext_auth_close">Close</string>+ <string name="ext_auth_notice">A page of its own: what you type and its cookies stay in Myspoti. The extension only gets the address the page ends on.</string>+ <string name="ext_grants_title">Always allowed</string>+ <string name="ext_grants_note">Spotify changes this extension makes without asking you. Revoke one to be asked again.</string>+ <string name="ext_grant_revoke">Revoke</string>+</resources>diff --git a/base/app/src/main/res/values/myspoti_strings.xml b/base/app/src/main/res/values/myspoti_strings.xmlindex 71a3db26..01768f06 100644--- a/base/app/src/main/res/values/myspoti_strings.xml+++ b/base/app/src/main/res/values/myspoti_strings.xml@@ -1,20 +1,13 @@<?xml version="1.0" encoding="utf-8"?><!-- Myspoti's own texts (English default, French, Italian). --><resources>- <string name="welcome_tagline">Your music, with synced lyrics and official music videos.</string><string name="welcome_lead">Your music,</string><string name="welcome_rotate_ads">without ads.</string><string name="welcome_rotate_lyrics">with word-by-word lyrics.</string><string name="welcome_rotate_clips">with the official videos.</string>- <string name="welcome_rotate_offline">even offline.</string>- <string name="welcome_rotate_lossless">in lossless quality.</string>+ <string name="welcome_rotate_offline">offline, through extensions.</string><string name="welcome_login">Log in with Spotify</string><string name="welcome_privacy">You sign in on Spotify\'s own page. Myspoti never sees your password.</string>- <string name="crash_heading">Myspoti stopped working</string>- <string name="crash_explanation">Something went wrong. Restart the app; if it happens again, copy the report and share it in a GitHub issue.</string>- <string name="crash_restart_app">Restart Myspoti</string>- <string name="crash_copy_report">Copy the report</string>- <string name="crash_report_copied">Report copied</string><string name="remove_from_liked">Remove from Liked Songs</string><string name="repeat_on">Repeat: on</string><string name="repeat_one">Repeat one</string>@@ -54,7 +47,6 @@<string name="background_playback_title">Background playback</string><string name="background_playback_on">Battery optimization is off: music and Spotify Connect keep going with the screen off.</string><string name="background_playback_off">Turn off battery optimization so Android does not pause the app in the background.</string>- <string name="crossfade_summary">Fades the end of a track out and the next one in (no overlap). On this phone only.</string><plurals name="local_files_count"><item quantity="one">%d track</item><item quantity="other">%d tracks</item>@@ -62,8 +54,13 @@<string name="local_files_none_subtitle">We didn\'t find any playable audio files on this device. When there are some, they\'ll show up here.</string><string name="downloads_empty_title">Download to listen offline</string><string name="downloads_empty_subtitle">Tap Download in a song\'s menu, or the download button of an album or playlist.</string>- <string name="downloads_source">Lossless FLAC, checked against the original recording. Kept inside Myspoti only.</string>+ <string name="downloads_source">From your download-source extension, checked against the original recording. Kept inside Myspoti only.</string><string name="downloads_size">%1$s on this phone</string>+ <string name="downloads_lists">Albums and playlists</string>+ <string name="downloads_singles">Songs</string>+ <string name="downloads_kind_album">Album</string>+ <string name="downloads_kind_playlist">Playlist</string>+ <string name="downloads_kind_liked">Liked Songs</string><string name="download_unavailable">No matching recording found</string><string name="download_retry">Try again</string><string name="download_cancel">Cancel download</string>@@ -74,11 +71,8 @@<string name="artist_not_found">Artist not found</string><string name="playlist_not_found">Playlist not found</string><string name="browse_new_releases">New releases</string>- <string name="browse_charts">Charts</string>- <string name="browse_workout">Workout</string>- <string name="browse_dance_electronic">Dance/Electronic</string><string name="language_auto">Automatic</string>- <string name="language_auto_detail">Your phone\'s language when Myspoti has it (English, French, German, Greek, Italian, Portuguese, Spanish), English otherwise</string>+ <string name="language_auto_detail">Your phone\'s language when Myspoti has it (English, Chinese, French, German, Greek, Italian, Polish, Portuguese, Russian, Spanish), English otherwise</string><string name="language_partial_note">Other languages: Spotify\'s own labels are translated, Myspoti\'s texts stay in English.</string><string name="restart_player_title">Restart the player</string><string name="restart_player_detail">If the music stops responding: reloads Spotify\'s player</string>@@ -94,7 +88,6 @@<string name="local_rename">Rename</string><string name="local_delete_playlist">Delete playlist</string><string name="local_added_to">Added to %1$s</string>- <string name="folder_create_failed">Couldn\'t create the folder</string><string name="local_playlist_empty">Add songs from Local Files with their + button.</string><string name="playlist_change_refused">Spotify refused the change to this playlist</string><string name="download_kept_by_list">Still downloaded: a downloaded playlist holds it</string>@@ -132,6 +125,7 @@<string name="library_reorder_hint">Hold a playlist, then drag it to move it</string><string name="library_reorder_reset">Back to Spotify\'s order</string><string name="song_radio_failed">Couldn\'t open this song\'s radio</string>+ <string name="song_radio_name">%1$s Radio</string><string name="local_files_find_hint">Find in Local Files</string><string name="data_saver_title">Data saver</string><string name="data_saver_summary">On mobile data, Myspoti uses no data: only downloaded songs and Local Files play</string>@@ -148,7 +142,6 @@<string name="recap_listens">%1$d listens</string><string name="recap_sources">Spotify %1$d min • Downloads %2$d min • Local files %3$d min</string><string name="recap_empty">Listen for a while: your top tracks and artists will show up here.</string>- <string name="recently_played_title">Recently played</string><string name="recently_played_empty">What you play on this account shows up here.</string><string name="recently_played_failed">Could not load the recently played list (%1$s)</string><string name="recents_title">Recents</string>@@ -175,13 +168,8 @@<string name="playback_speed">Playback speed</string><string name="recommended_songs">Recommended songs</string><string name="jam_title">Jam</string>- <string name="jam_restricted">Spotify keeps starting a Jam to Premium accounts. You can still join one with a link.</string>- <string name="jam_join">Join a Jam</string>- <string name="jam_join_hint">Paste the invite link</string><string name="jam_leave">Leave the Jam</string><string name="jam_members">%1$d people listening</string>- <string name="pin">Pin</string>- <string name="unpin">Unpin</string><string name="jam_start">Start a Jam</string><string name="jam_invite">Share invite link</string><string name="jam_failed">Spotify refused this Jam</string>@@ -218,27 +206,6 @@<string name="smart_shuffle_title">Smart shuffle</string><string name="smart_shuffle_on">Smart shuffle: Spotify recommendations join the shuffled playlist.</string><string name="track_sort_added">Date added</string>- <!-- Lossless (SpotiFLAC) downloads -->- <string name="spotiflac_row_title">Lossless downloads (FLAC)</string>- <string name="spotiflac_row_on">Verified — Myspoti uses SpotiFLAC\'s own servers.</string>- <string name="spotiflac_row_off">Not verified — tap to solve the one-off check.</string>- <string name="spotiflac_verify_title">SpotiFLAC verification</string>- <string name="spotiflac_verify_start_failed">Could not start verification. Tap Retry or come back later.</string>- <string name="spotiflac_verify_timeout">Verification timed out. Tap Retry or Skip for now.</string>- <string name="spotiflac_verify_rejected">Verification was rejected. Tap Retry or Skip for now.</string>- <string name="spotiflac_session_ok">SpotiFLAC session saved</string>- <string name="spotiflac_session_creating">Creating secure session…</string>- <string name="spotiflac_session_failed">Could not finish verification. Tap Retry or Skip for now.</string>- <string name="spotiflac_skip">Skip for now</string>- <string name="retry">Retry</string>- <string name="spotiflac_status_title">SpotiFLAC</string>- <string name="spotiflac_status_verified">You are verified: downloads go through SpotiFLAC\'s own servers, the most reliable lossless source. Only this session is used — no account, nothing else stored.</string>- <string name="spotiflac_session_expires">Session valid until %1$s</string>- <string name="spotiflac_forget">Forget this session</string>- <string name="lossless_hires_title">Hi-res downloads (24-bit)</string>- <string name="lossless_hires_detail">A track saved in 24-bit hi-res when the source has it. Files are about three times bigger than CD quality.</string>- <string name="setup_spotiflac_title">Lossless downloads (FLAC)</string>- <string name="setup_spotiflac_detail">Verify once with SpotiFLAC so downloads come from its lossless servers.</string><string name="settings_title">Settings</string><string name="settings_detail">Sound quality, downloads, data, battery and language</string><string name="settings_section_playback">Playback</string>@@ -267,7 +234,6 @@<string name="setup_quality_subtitle">Choose how Myspoti plays and saves your music. You can change it later in Settings.</string><string name="downloads_off_toast">Downloads are off. Turn them on in Settings.</string><string name="quality_streaming_high_detail">160 kbit/s, the best sound</string>- <string name="downloads_verify_hint">No lossless source answered. Verify SpotiFLAC once in Settings, Downloads: its servers are the reliable ones.</string><string name="quality_download_small">Smallest</string><string name="quality_download_small_detail">AAC 96 kbit/s, the lightest: about 3 MB a song</string><string name="settings_solid_nav_title">Solid bottom bar</string>@@ -277,7 +243,6 @@<string name="quality_sheet_title">Sound quality</string><string name="quality_now">Playing now: %1$s</string><string name="quality_now_unknown">Not known yet: start a song</string>- <string name="spotiflac_verify_in_browser">Solve the check in the browser tab that opened, then come back here.</string><string name="update_downloading">Downloading… %1$d%%</string><string name="update_installing">Installing…</string><string name="update_needs_permission">To update, allow Myspoti to install apps, then come back here.</string>@@ -294,7 +259,6 @@<!-- A25: stop the queue, keep the songs already downloaded. --><string name="downloads_stop_all_title">Stop all downloads</string><string name="downloads_stop_all_detail">Cancels what is left; songs already downloaded are kept</string>- <string name="downloads_verify_banner">Downloads need the SpotiFLAC verification once on this app. Tap here to do it.</string><string name="removed_from">Removed from %1$s</string><!-- Track options inside a playlist (A11/A12). --><string name="context_menu_remove_from_playlist">Remove from this playlist</string>@@ -311,14 +275,6 @@<string name="playlist_remove_cover">Remove cover</string><string name="playlist_save">Save</string><string name="playlist_access_title">Who can see it</string>- <string name="playlist_access_public">Public</string>- <string name="playlist_access_public_detail">Anyone can find and play it</string>- <string name="playlist_access_private">Private</string>- <string name="playlist_access_private_detail">Only you can see it</string>- <string name="playlist_access_collaborative">Collaborative</string>- <string name="playlist_access_collaborative_detail">Only the people you invite can add and remove songs</string>- <string name="playlist_on_profile">On your profile</string>- <string name="playlist_on_profile_detail">Listed on your profile for others to see</string><string name="choose_artist">Choose an artist</string><string name="quality_streaming_wifi_title">Wi-Fi streaming</string><string name="quality_streaming_cell_title">Mobile data streaming</string>@@ -356,12 +312,12 @@<string name="library_sort_recently_added">Recently added</string><string name="library_change_failed">Could not update your library, try again</string><string name="a11y_close_player">Close the player</string>- <string name="a11y_devices">Devices</string><string name="a11y_share">Share</string><string name="search_failed">Search failed. Check your connection.</string><string name="retry_button">Try again</string><string name="page_load_failed">Couldn\'t load this page.\nCheck your connection and try again.</string><string name="jam_paste_link">Join with a copied link</string>+ <string name="play_refused_all">Spotify refuses every command from this player on your account right now (play, seek, transfer). The player was reloaded once; if nothing plays, close the app fully and open it again, or switch between Wi-Fi and mobile data.</string><string name="play_refused">Spotify refused to play this on your account. Free accounts in some countries can only play shuffled: try the shuffle button.</string><string name="drm_missing">Playback is impossible here: this phone\'s Android System WebView has no working Widevine DRM, which Spotify needs. Update Android System WebView and Chrome in the Play Store, and pick it under Settings > Developer options > WebView implementation.</string><string name="artist_liked_songs">Liked songs</string>@@ -382,7 +338,6 @@<string name="settings_rotation_auto">Automatic</string><string name="settings_rotation_landscape">Landscape</string><string name="support_github_action">Sponsor on GitHub</string>- <string name="spotiflac_verify_again">SpotiFLAC verification expired: verify again in Settings to download in lossless</string><string name="download_on_mobile_data">Downloading on mobile data: it uses your data plan</string><!-- Podcast show page, episode page and podcast player -->@@ -396,11 +351,8 @@<string name="show_sort_chapters_newest">All chapters • Newest</string><string name="show_sort_chapters_oldest">All chapters • Oldest</string><string name="show_empty">Nothing to play here yet</string>- <string name="show_rating">%1$s (%2$s)</string><string name="show_authors">By %1$s</string><string name="show_narrators">Read by %1$s</string>- <string name="show_followed">Followed</string>- <string name="show_unfollowed">Unfollowed</string><string name="episode_duration_min">%1$d min</string><string name="episode_remaining">%1$s left</string><string name="episode_mark_played">Mark as played</string>@@ -413,20 +365,14 @@<string name="episode_show_more">show more</string><string name="episode_show_less">show less</string><string name="episode_download">Download</string>- <string name="episode_downloading">Downloading…</string>- <string name="episode_downloaded">Downloaded</string><string name="episode_download_remove">Remove download</string><string name="episode_options">Episode options</string><string name="episode_not_found">Episode not found</string>- <string name="show_not_found">Show not found</string><string name="podcast_playing_from">Playing from the podcast</string><string name="player_speed_chip">%1$s×</string><string name="player_back_15">Back 15 seconds</string><string name="player_forward_15">Forward 15 seconds</string>- <string name="player_show_remaining">Show the time remaining</string>- <string name="player_show_elapsed">Show the time elapsed</string><string name="player_sleep_timer">Sleep timer</string>- <string name="player_speed_a11y">Playback speed, %1$s×</string><string name="restart_player_done">Player restarted</string><string name="spotify_limited">Spotify is limiting playback for a moment. Try again in a minute.</string><string name="library_change_undone">Spotify refused the change, your library is back as it was</string>@@ -444,7 +390,6 @@<string name="blend_deleted">This Blend was deleted</string><string name="blend_working">Working…</string><string name="blend_invited_by">%1$s invites you to a Blend</string>- <string name="blend_open">Open the Blend</string><string name="blend_later">Not now</string><string name="blend_members">Members</string><string name="blend_invite_more">Invite more people</string>@@ -475,8 +420,6 @@<string name="link_copied">Link copied</string><string name="lyrics_meaning_title">Meaning</string><string name="lyrics_meaning_about">About</string>- <string name="lyrics_meaning_lines">Lines explained</string>- <string name="lyrics_meaning_source">From Genius · open the song there</string><string name="lyrics_meaning_translating">Translating…</string><string name="lyrics_meaning_translate">Translate</string><string name="lyrics_meaning_original">See original</string>@@ -511,5 +454,40 @@<string name="playlist_members_title">Collaborators</string><string name="playlist_member_owner">Creator</string><string name="playlist_member_collab">Collaborator</string>+ <string name="playlist_member_listener">Listener</string>+ <string name="playlist_member_remove_collab">Remove as collaborator</string>+ <string name="playlist_member_make_collab">Make collaborator</string>+ <string name="playlist_member_remove">Remove from playlist</string>+ <string name="playlist_stop_collab_private">Stop collaborating on %1$s? Its collaborators become listeners: they can still listen to it, but no longer add or remove songs. Invitation links already shared stay valid until they expire (up to 7 days) and cannot be cancelled.</string>+ <string name="playlist_stop_collab_public">Stop collaborating on %1$s? Its collaborators are removed from the playlist. Invitation links already shared stay valid until they expire (up to 7 days) and cannot be cancelled.</string><string name="playlist_members_more">%1$s and %2$d others</string>+ <string name="library_chip_playlists">Playlists</string>+ <string name="library_chip_artists">Artists</string>+ <string name="library_chip_albums">Albums</string>+ <string name="library_chip_songs">Songs</string>+ <string name="add_playlist_to_playlist">Add playlist to another playlist</string>+ <string name="add_collection_reading">Reading the songs…</string>+ <string name="add_collection_nothing">Nothing to add</string>+ <string name="add_collection_done">Added %1$d songs to %2$s</string>+ <string name="duplicate_title_some">Some are already added</string>+ <string name="duplicate_title_all">Already added</string>+ <string name="duplicate_text_some">Some of these songs are already in %1$s.</string>+ <string name="duplicate_text_all">These songs are already in %1$s.</string>+ <string name="duplicate_add_all">Add all</string>+ <string name="duplicate_add_new">Add new ones</string>+ <string name="duplicate_add_anyway">Add anyway</string>+ <string name="duplicate_dont_add">Don\'t add</string>+ <string name="settings_music_video_title">Music videos</string>+ <string name="settings_music_video_detail">The video button in the player, and clips that start by themselves. Off: audio and Canvas only.</string>+ <string name="downloads_need_source">Downloads need a source extension. Install one in Settings, Extensions.</string>+ <string name="downloads_source_row_title">Download source</string>+ <string name="downloads_source_row_on">An extension gives the files. Tap to manage extensions.</string>+ <string name="downloads_source_row_off">None yet: install a download-source extension.</string>+ <string name="profile_block">Block</string>+ <string name="profile_unblock">Unblock</string>+ <string name="profile_block_title">Block %1$s?</string>+ <string name="profile_block_confirm">%1$s won’t be able to follow you or see your profile and public playlists. You can unblock them from their profile at any time.</string>+ <string name="profile_blocked">You blocked this user</string>+ <string name="profile_block_failed">Couldn’t change the block, try again</string>+ <string name="profile_more_options">More options</string></resources>diff --git a/base/app/src/main/res/values/spotify_strings.xml b/base/app/src/main/res/values/spotify_strings.xmlindex 5b344bc4..7c0ec0ad 100644--- a/base/app/src/main/res/values/spotify_strings.xml+++ b/base/app/src/main/res/values/spotify_strings.xml@@ -17,7 +17,6 @@<string name="snackbar_added_to_liked_songs" formatted="false">Added to Liked Songs.</string><string name="snackbar_removed_from_liked_songs" formatted="false">Removed from Liked Songs.</string><string name="content_description_context_menu" formatted="false">More options</string>- <string name="close_button_content_description" formatted="false">Close</string><string name="add_to_playlist_saved_in_section_header" formatted="false">Saved in</string><string name="add_to_playlist_new_playlist_button_text" formatted="false">New playlist</string><string name="add_to_playlist_button_cancel" formatted="false">Cancel</string>@@ -25,8 +24,6 @@<string name="lyrics_card_title" formatted="false">Lyrics</string><string name="lyrics_card_title_preview" formatted="false">Lyrics preview</string><string name="lyrics_card_show_lyrics_button" formatted="false">Show lyrics</string>- <string name="lyrics_card_expand_button_content_description" formatted="false">Open fullscreen lyrics</string>- <string name="lyrics_card_share_button_content_description" formatted="false">Share lyrics</string><string name="lyrics_credential_note" formatted="false">Lyrics provided by %1$s</string><string name="lyrics_fullscreen_chip_label_share" formatted="false">Share</string><string name="lyrics_fullscreen_chip_label_translate" formatted="false">Translate</string>@@ -49,7 +46,6 @@<string name="artist_popular_tracks" formatted="false">Popular</string><string name="curation_button_follow_state_text" formatted="false">Follow</string><string name="curation_button_following_state_text" formatted="false">Following</string>- <string name="search_main_entity_subtitle_artist" formatted="false">Artist</string><string name="connect_phone_is_self" formatted="false">This phone</string><string name="settings_item_canvas_title" formatted="false">Canvas</string><string name="video_settings_canvas_subtitle" formatted="false">Short, looping visuals when a song is playing.</string>@@ -107,8 +103,6 @@<string name="library_search_text_hint" formatted="false">Search Your Library</string><string name="account_title" formatted="false">Account</string><string name="song_dna_search_chip_followed_artists" formatted="false">Followed artists</string>- <string name="settings_item_crossfade_title" formatted="false">Crossfade</string>- <string name="playback_settings_crossfade_slider_seconds" formatted="false">%1$d s</string><string name="local_files_title" formatted="false">Local Files</string><string name="local_files_empty_section_title" formatted="false">Add your own audio files to Your Library</string><string name="local_files_empty_section_subtitle" formatted="false">Got a song or personal podcast that\'s not on Spotify?</string>@@ -138,14 +132,10 @@<string name="assisted_curation_search_filter_artists" formatted="false">Artists</string><string name="assisted_curation_search_filter_albums" formatted="false">Albums</string><string name="assisted_curation_search_filter_playlists" formatted="false">Playlists</string>- <string name="assisted_curation_search_filter_clear_content_description" formatted="false">Clear filter</string>- <string name="ad_category_title_music" formatted="false">Music</string>- <string name="made_for_you_hub_title" formatted="false">Made for You</string><string name="settings_item_app_language_title" formatted="false">App language</string><string name="create_menu_item_folder_title" formatted="false">Folder</string><string name="create_folder_name_suggested_folder_name" formatted="false">New folder</string><string name="context_menu_rename_folder" formatted="false">Rename folder</string>- <string name="your_library_messaging_folder_rename_hint" formatted="false">Folder name</string><string name="create_playlist_content_description" formatted="false">Create playlist</string><string name="actions_picker_delete" formatted="false">Delete</string><string name="filter_and_sort_sort_section_title" formatted="false">Sort by</string>diff --git a/base/app/src/main/res/values/stats_strings.xml b/base/app/src/main/res/values/stats_strings.xmlnew file mode 100644index 00000000..68e55d47--- /dev/null+++ b/base/app/src/main/res/values/stats_strings.xml@@ -0,0 +1,25 @@+<?xml version="1.0" encoding="utf-8"?>+<!-- Listening stats, friend activity and the "your top artist" line (EN; FR in values-fr). -->+<resources>+ <string name="stats_tab_spotify">On Spotify</string>+ <string name="stats_tab_phone">On this phone</string>+ <string name="stats_range_short">Past 4 weeks</string>+ <string name="stats_range_medium">Past 6 months</string>+ <string name="stats_range_long">Past year</string>+ <string name="stats_artists_ranked">%1$d artists in your listening</string>+ <string name="stats_empty">Spotify has no top artists or tracks for this period yet. Keep listening and check back.</string>+ <string name="stats_failed">Spotify didn\'t send your stats.</string>+ <string name="stats_spotify_note">Ranked by Spotify from everything this account played, on every device. Spotify doesn\'t share play counts or minutes listened: the minutes under \"On this phone\" are Myspoti\'s own count.</string>+ <string name="stats_weekly_minutes">Minutes per week</string>+ <string name="stats_this_week">This week: %1$d min</string>+ <string name="stats_listening_stats">Listening stats</string>+ <string name="friends_title">Friend activity</string>+ <string name="friends_detail">What the people you follow are listening to</string>+ <string name="friends_now">Now</string>+ <string name="friends_empty">No friend activity yet. Friends you follow who share their listening activity on Spotify show up here.</string>+ <string name="friends_failed">Spotify didn\'t send the friend activity.</string>+ <string name="friends_refresh">Refresh</string>+ <string name="artist_top_short">Your #%1$d artist of the past 4 weeks</string>+ <string name="artist_top_medium">Your #%1$d artist of the past 6 months</string>+ <string name="artist_top_long">Your #%1$d artist of the past year</string>+</resources>diff --git a/base/app/src/main/res/values/strings.xml b/base/app/src/main/res/values/strings.xmlindex e4e4bc14..cba415c4 100644--- a/base/app/src/main/res/values/strings.xml+++ b/base/app/src/main/res/values/strings.xml@@ -3,37 +3,17 @@<string name="aa_playlists">Playlists</string><string name="aa_albums">Albums</string><string name="aa_artists">Artists</string>- <string name="aa_podcasts">Podcasts</string><string name="settings_amoled_theme">AMOLED Theme</string><string name="settings_amoled_theme_subtitle">Pure black background to save battery</string>- <string name="settings_lyrics_style_spotify_default">Spotify Default</string>- <string name="settings_lyrics_style_fullscreen">Fullscreen (Album Colors)</string>- <string name="settings_lyrics_style_compact">Compact</string>- <string name="settings_lyrics_style_karaoke">Karaoke</string>- <string name="settings_lyrics_style_bold">Bold Large</string><string name="main_update_available">A new update is available</string>- <string name="notif_channel_media_name">Media Playback</string>- <string name="notif_channel_media_description">Myspoti media playback controls</string>- <string name="notif_action_previous">Previous</string>- <string name="notif_action_next">Next</string><string name="notif_action_play">Play</string><string name="notif_action_pause">Pause</string><string name="notif_shuffle_enable">Enable shuffle</string><string name="notif_shuffle_disable">Disable shuffle</string><string name="notif_shuffle_disable_smart">Disable smart shuffle</string>- <string name="notif_action_like">Like</string>- <string name="notif_action_unlike">Unlike</string>- <string name="notif_unknown_name">Unknown</string>- <string name="notif_by_artist">by %1$s</string>- <string name="notif_repeat_disable">Disable repeat</string>- <string name="notif_repeat_disable_one">Disable repeat one</string>- <string name="notif_repeat_enable">Enable repeat</string>- <string name="bridge_player_unlocked">Player unlocked</string>- <string name="bridge_reloading">Reloading…</string>- <string name="service_disabled_message">Service is not enabled</string><string name="energy_saver_title" tools:ignore="MissingTranslation">Battery saver</string><string name="energy_saver_summary" tools:ignore="MissingTranslation">Canvas off, lighter videos and animations</string><string name="video_fullscreen_enter" tools:ignore="MissingTranslation">Enter fullscreen</string>@@ -41,4 +21,6 @@<string name="playback_seek_description" tools:ignore="MissingTranslation">Playback position</string><string name="account_page_title">Spotify account</string><string name="account_page_detail">Plan, privacy and devices, on spotify.com</string>+ <string name="player_source_downloaded">Downloaded</string>+ <string name="extension_change_write">Now also allowed to send to Spotify: %1$s</string></resources>diff --git a/base/app/src/test/java/com/music/spotui/cli/CliTest.kt b/base/app/src/test/java/com/music/spotui/cli/CliTest.ktnew file mode 100644index 00000000..3e5458d8--- /dev/null+++ b/base/app/src/test/java/com/music/spotui/cli/CliTest.kt@@ -0,0 +1,113 @@+package com.music.spotui.cli++import app.myspoti.extensions.Hook+import app.myspoti.extensions.Setting+import kotlinx.serialization.json.Json+import kotlinx.serialization.json.JsonNull+import kotlinx.serialization.json.JsonPrimitive+import kotlinx.serialization.json.jsonObject+import kotlinx.serialization.json.jsonPrimitive+import org.junit.Assert.assertEquals+import org.junit.Assert.assertFalse+import org.junit.Assert.assertTrue+import org.junit.Test++class CliTest {+ private fun fails(cmd: String, vararg args: String): String =+ runCatching { CliParser.parse(cmd, args.toList()) }.exceptionOrNull().let { (it as? CliError)?.message ?: error("$cmd did not fail: $it") }++ @Test fun argsComeAsJsonOrBase64() {+ assertEquals(listOf("a", "b c"), CliParser.args("""["a","b c"]""", null))+ val b64 = java.util.Base64.getEncoder().encodeToString("""["x","{\"q\":1}"]""".toByteArray())+ assertEquals(listOf("x", """{"q":1}"""), CliParser.args("ignored", b64))+ assertEquals(emptyList<String>(), CliParser.args(null, null))+ assertTrue(runCatching { CliParser.args("""[1]""", null) }.exceptionOrNull() is CliError)+ assertTrue(runCatching { CliParser.args(null, "%%%") }.exceptionOrNull() is CliError)+ }++ @Test fun parsesEachCommand() {+ assertEquals(CliCommand.Status, CliParser.parse("status", emptyList()))+ assertEquals(CliCommand.ExtInstall("/sdcard/Android/data/app.myspoti.dev/files/cli/in/x.zip"),+ CliParser.parse("ext.install", listOf("/sdcard/Android/data/app.myspoti.dev/files/cli/in/x.zip")))+ assertEquals(CliCommand.ExtEnable("my.ext", false), CliParser.parse("ext.disable", listOf("my.ext")))+ assertEquals(CliCommand.ExtSetting("my.ext", "quality", "\"high\""), CliParser.parse("ext.setting", listOf("my.ext", "quality", "high")))+ assertEquals(CliCommand.ExtSetting("my.ext", "on", "true"), CliParser.parse("ext.setting", listOf("my.ext", "on", "true")))+ assertEquals(CliCommand.ExtSetting("my.ext", "on", null), CliParser.parse("ext.setting", listOf("my.ext", "on", "null")))+ assertEquals(CliCommand.ExtPress("my.ext", "pair"), CliParser.parse("ext.press", listOf("my.ext", "pair")))+ assertEquals(CliCommand.ExtCall("my.ext", Hook.AUDIO_SOURCE, """{"id":"1"}"""), CliParser.parse("ext.call", listOf("my.ext", "audio-source", """{"id":"1"}""")))+ assertEquals(CliCommand.ExtCall("my.ext", Hook.LYRICS, "{}"), CliParser.parse("ext.call", listOf("my.ext", "lyrics")))+ assertEquals(CliCommand.ExtLog("my.ext", 50), CliParser.parse("ext.log", listOf("my.ext")))+ assertEquals(CliCommand.ExtLog("my.ext", 1000), CliParser.parse("ext.log", listOf("my.ext", "99999")))+ assertEquals(CliCommand.Play("spotify:track:4uLU6hMCjMI75M1A2tKUQC", null), CliParser.parse("play", listOf("spotify:track:4uLU6hMCjMI75M1A2tKUQC")))+ assertEquals(CliCommand.Nav("extension/my.ext"), CliParser.parse("nav", listOf("extension/my.ext")))+ }++ @Test fun refusesBadInput() {+ assertTrue(fails("nope").startsWith("unknown command"))+ assertTrue(fails("ext.enable").contains("missing <id>"))+ assertTrue(fails("ext.enable", "../x").contains("bad extension id"))+ assertTrue(fails("ext.install", "relative.zip").contains("absolute"))+ assertTrue(fails("ext.install", "/sdcard/../data/x.zip").contains("absolute"))+ assertTrue(fails("ext.call", "my.ext", "nohook").contains("unknown hook"))+ assertTrue(fails("ext.call", "my.ext", "lyrics", "{oops").contains("not JSON"))+ assertTrue(fails("ext.setting", "my.ext", "k").contains("missing <value>"))+ assertTrue(fails("play", "https://example.com/x").contains("spotify:"))+ assertTrue(fails("nav", "https://example.com").contains("route"))+ assertTrue(fails("pause", "extra").contains("too many"))+ }++ @Test fun masksTokensInText() {+ val t = CliMask.text("GET https://cdn.example/a.flac?token=abcdef123&id=7 Authorization: Bearer abcdefghijk cookie=sess=1; x")+ assertFalse(t, t.contains("abcdef123"))+ assertFalse(t, t.contains("abcdefghijk"))+ assertFalse(t, t.contains("sess=1"))+ assertTrue(t, t.contains("id=7"))+ assertEquals("seen *** here", CliMask.text("seen supersecretvalue here", listOf("supersecretvalue", "abc")))+ assertEquals("short abc", CliMask.text("short abc", listOf("abc")))+ assertFalse(CliMask.text("jwt eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiIxIn0.sig").contains("eyJ"))+ }++ @Test fun masksSensitiveJsonFields() {+ val e = CliMask.json(Json.parseToJsonElement("""{"url":"https://x/y?sig=zzzzzz","accessToken":"t0k3n","author":"Someone","nested":{"cookie":"c"},"n":3}"""))+ val o = e.jsonObject+ assertEquals(CliMask.MASK, o["accessToken"]!!.jsonPrimitive.content)+ assertEquals(CliMask.MASK, o["nested"]!!.jsonObject["cookie"]!!.jsonPrimitive.content)+ assertEquals("Someone", o["author"]!!.jsonPrimitive.content)+ assertEquals("https://x/y?sig=${CliMask.MASK}", o["url"]!!.jsonPrimitive.content)+ assertEquals(JsonPrimitive(3), o["n"])+ }++ @Test fun settingsHideSecretsAndButtons() {+ val declared = listOf(+ Setting("quality", "choice", "Quality", default = JsonPrimitive("high"), options = listOf("high", "low")),+ Setting("password", "secret", "Password"),+ Setting("pair", "button", "Pair again"),+ Setting("server", "text", "Server"),+ )+ val shown = CliMask.settings(declared, mapOf("password" to "\"hunter22\"", "server" to "\"https://s\"", "leftover" to "\"x\""))+ assertEquals(JsonPrimitive("high"), shown["quality"])+ assertEquals(JsonPrimitive(CliMask.MASK), shown["password"])+ assertEquals(JsonPrimitive("https://s"), shown["server"])+ assertEquals(JsonPrimitive(CliMask.MASK), shown["leftover"])+ assertFalse(shown.containsKey("pair"))+ assertEquals(JsonNull, CliMask.settings(listOf(Setting("p", "secret", "P")), emptyMap())["p"])+ }++ @Test fun knownSecretsTakeStoredStrings() {+ val known = CliMask.knownSecrets(listOf(Setting("password", "secret", "P"), Setting("server", "text", "S")),+ mapOf("password" to "\"hunter22\"", "server" to "\"https://s\""), mapOf("auth" to """{"refresh":"r3fr3sh-value"}"""))+ assertTrue("hunter22" in known)+ assertTrue("r3fr3sh-value" in known)+ assertFalse("https://s" in known)+ assertEquals("log *** ok", CliMask.text("log r3fr3sh-value ok", known))+ }++ @Test fun replies() {+ val ok = Json.parseToJsonElement(CliReply.ok("status", JsonPrimitive(1))).jsonObject+ assertEquals(JsonPrimitive(true), ok["ok"])+ val err = Json.parseToJsonElement(CliReply.error("x", "no")).jsonObject+ assertEquals(JsonPrimitive("no"), err["error"])+ assertEquals("a-1_B", CliReply.safeRequestId("a-1_B"))+ assertEquals(null, CliReply.safeRequestId("../x"))+ }+}diff --git a/base/app/src/test/java/com/music/spotui/data/LibraryChipsTest.kt b/base/app/src/test/java/com/music/spotui/data/LibraryChipsTest.ktnew file mode 100644index 00000000..3909f138--- /dev/null+++ b/base/app/src/test/java/com/music/spotui/data/LibraryChipsTest.kt@@ -0,0 +1,48 @@+package com.music.spotui.data++import com.music.spotui.data.entity.ArtistsModel+import com.music.spotui.data.entity.LibraryEntry+import com.music.spotui.data.local.LibraryChip+import com.music.spotui.data.local.LibraryChips+import org.junit.Assert.assertEquals+import org.junit.Test++class LibraryChipsTest {+ private fun playlist(id: String) = LibraryEntry(spotifyId = id, name = id, subtitle = "", coverUri = "", isPlaylist = true)+ private fun album(id: String) = LibraryEntry(spotifyId = id, name = id, subtitle = "", coverUri = "", isPlaylist = false)+ private fun folder(id: String) = LibraryEntry(spotifyId = id, name = id, subtitle = "", coverUri = "", isPlaylist = false, folderUri = id)++ private val liked = playlist("liked")+ private val local = playlist("local")+ private val songIds = setOf("liked", "local")+ private val entries = listOf(liked, local, playlist("p1"), album("a1"), folder("f1"), playlist("p2"), album("a2"))+ private val artists = listOf(ArtistsModel("Adele", "", "1"), ArtistsModel("Zaz", "", "2"))++ private fun ids(chip: LibraryChip) = LibraryChips.apply(chip, entries, artists, songIds).first.map { it.spotifyId }++ @Test fun allKeepsEverything() {+ val (e, a) = LibraryChips.apply(LibraryChip.ALL, entries, artists, songIds)+ assertEquals(entries, e)+ assertEquals(artists, a)+ }++ @Test fun playlistsKeepPlaylistsAndFoldersButNotTheSongRows() =+ assertEquals(listOf("p1", "f1", "p2"), ids(LibraryChip.PLAYLISTS))++ @Test fun albumsKeepOnlyAlbums() = assertEquals(listOf("a1", "a2"), ids(LibraryChip.ALBUMS))++ @Test fun songsKeepLikedAndPhoneRows() = assertEquals(listOf("liked", "local"), ids(LibraryChip.SONGS))++ @Test fun artistsKeepOnlyTheArtists() {+ val (e, a) = LibraryChips.apply(LibraryChip.ARTISTS, entries, artists, songIds)+ assertEquals(emptyList<LibraryEntry>(), e)+ assertEquals(artists, a)+ assertEquals(emptyList<ArtistsModel>(), LibraryChips.apply(LibraryChip.ALBUMS, entries, artists, songIds).second)+ }++ @Test fun tappingTheChosenChipAgainShowsEverything() {+ assertEquals(LibraryChip.ALBUMS, LibraryChips.toggle(LibraryChip.ALL, LibraryChip.ALBUMS))+ assertEquals(LibraryChip.ARTISTS, LibraryChips.toggle(LibraryChip.ALBUMS, LibraryChip.ARTISTS))+ assertEquals(LibraryChip.ALL, LibraryChips.toggle(LibraryChip.ARTISTS, LibraryChip.ARTISTS))+ }+}diff --git a/base/app/src/test/java/com/music/spotui/data/LibraryOutboxTest.kt b/base/app/src/test/java/com/music/spotui/data/LibraryOutboxTest.ktnew file mode 100644index 00000000..7b948d4b--- /dev/null+++ b/base/app/src/test/java/com/music/spotui/data/LibraryOutboxTest.kt@@ -0,0 +1,24 @@+package com.music.spotui.data++import org.junit.Assert.assertEquals+import org.junit.Test++class LibraryOutboxTest {+ @Test fun theLastTapOnAnItemWinsAndKeepsTheOrderOfTaps() {+ val p = LibraryOutbox.Pending(null)+ p.put("spotify:track:a", true)+ p.put("spotify:track:b", true)+ p.put("spotify:track:a", false) // unliked again: one change, now the newest+ assertEquals(listOf("spotify:track:b" to true, "spotify:track:a" to false), p.all.toList())++ // Kept across restarts as text.+ val again = LibraryOutbox.Pending(p.text())+ assertEquals(p.all.toList(), again.all.toList())++ // A sent change goes; one the user changed meanwhile stays to be sent.+ again.sent("spotify:track:b", true)+ again.sent("spotify:track:a", true)+ assertEquals(listOf("spotify:track:a" to false), again.all.toList())+ assertEquals(emptyMap<String, Boolean>(), LibraryOutbox.Pending("not json").all)+ }+}diff --git a/base/app/src/test/java/com/music/spotui/data/StatsTest.kt b/base/app/src/test/java/com/music/spotui/data/StatsTest.ktnew file mode 100644index 00000000..c72bb2b5--- /dev/null+++ b/base/app/src/test/java/com/music/spotui/data/StatsTest.kt@@ -0,0 +1,65 @@+package com.music.spotui.data++import app.myspoti.api.TimeRange+import com.music.spotui.data.api.TopStats+import com.music.spotui.data.local.ListenHistory+import org.junit.Assert.assertEquals+import org.junit.Assert.assertNull+import org.junit.Test+import java.util.Calendar+import java.util.TimeZone++/** The "your top artist" badge rule and the minutes-per-week chart of the stats screen. */+class StatsTest {+ @Test fun rankPrefersShortestWindowInTopTen() {+ val ranked = mapOf(+ TimeRange.SHORT_TERM to listOf("a", "b", "c"),+ TimeRange.MEDIUM_TERM to listOf("c", "a"),+ TimeRange.LONG_TERM to listOf("c"),+ )+ assertEquals(TimeRange.SHORT_TERM to 3, TopStats.rankOf("c", ranked))+ assertEquals(TimeRange.SHORT_TERM to 1, TopStats.rankOf("a", ranked))+ assertNull(TopStats.rankOf("z", ranked))+ }++ @Test fun rankOutsideTopTenTakesTheBestRank() {+ val filler = (1..30).map { "x$it" }+ val ranked = mapOf(+ TimeRange.SHORT_TERM to filler.take(20) + "a",+ TimeRange.MEDIUM_TERM to filler.take(14) + "a",+ TimeRange.LONG_TERM to filler.take(25) + "a",+ )+ assertEquals(TimeRange.MEDIUM_TERM to 15, TopStats.rankOf("a", ranked))+ assertEquals(TimeRange.LONG_TERM to 1, TopStats.rankOf("b", mapOf(TimeRange.LONG_TERM to listOf("b"))))+ }++ private val utc = TimeZone.getTimeZone("UTC")+ private fun at(y: Int, m: Int, d: Int, h: Int = 12) = Calendar.getInstance(utc).apply {+ clear(); set(y, m - 1, d, h, 0)+ }.timeInMillis+ private fun listen(atMs: Long, minutes: Long) =+ ListenHistory.Listen(atMs, "k", "t", "a", "al", "", minutes * 60_000, ListenHistory.Source.SPOTIFY)++ @Test fun weeklyGroupsByCalendarWeekOldestFirst() {+ // Thursday 2026-10-22; weeks start on Monday: 19 Oct, 12 Oct, 5 Oct.+ val now = at(2026, 10, 22)+ val listens = listOf(+ listen(at(2026, 10, 19, 0), 10), // Monday 00:00, this week+ listen(at(2026, 10, 21), 5), // this week+ listen(at(2026, 10, 18, 23), 7), // Sunday, last week+ listen(at(2026, 10, 5), 3), // two weeks ago+ listen(at(2026, 9, 1), 99), // too old+ listen(at(2026, 10, 23), 50), // after now+ )+ val w = ListenHistory.weekly(listens, 3, now, utc, Calendar.MONDAY)+ assertEquals(listOf(at(2026, 10, 5, 0), at(2026, 10, 12, 0), at(2026, 10, 19, 0)), w.map { it.startMs })+ assertEquals(listOf(3L, 7L, 15L), w.map { it.minutes })+ }++ @Test fun weeklyFollowsTheLocaleFirstDay() {+ val now = at(2026, 10, 22)+ val w = ListenHistory.weekly(listOf(listen(at(2026, 10, 18, 9), 4)), 1, now, utc, Calendar.SUNDAY)+ assertEquals(at(2026, 10, 18, 0), w.single().startMs)+ assertEquals(4L, w.single().minutes)+ }+}diff --git a/base/app/src/test/java/com/music/spotui/data/offline/DashLiveTest.kt b/base/app/src/test/java/com/music/spotui/data/offline/DashLiveTest.ktnew file mode 100644index 00000000..ec2e1695--- /dev/null+++ b/base/app/src/test/java/com/music/spotui/data/offline/DashLiveTest.kt@@ -0,0 +1,95 @@+package com.music.spotui.data.offline++import org.junit.Assert.assertArrayEquals+import org.junit.Assert.assertEquals+import org.junit.Assert.assertNull+import org.junit.Test+import java.nio.ByteBuffer++class DashLiveTest {+ private val mpd = """+ <MPD xmlns="urn:mpeg:dash:schema:mpd:2011"><Period><AdaptationSet><Representation codecs="flac">+ <SegmentTemplate timescale="44100" initialization="https://cdn.example.com/x/0.mp4?a=1&b=2"+ media="https://cdn.example.com/x/${'$'}Number${'$'}.mp4?a=1&b=2" startNumber="1">+ <SegmentTimeline><S d="176128" r="2"/><S d="1024"/></SegmentTimeline></SegmentTemplate>+ </Representation></AdaptationSet></Period></MPD>+ """.trimIndent()++ @Test fun aSegmentTemplateBecomesItsAddressesAndDurations() {+ val p = DashLive.parse(mpd)!!+ assertEquals("https://cdn.example.com/x/0.mp4?a=1&b=2", p.initUrl)+ assertEquals((1..4).map { "https://cdn.example.com/x/$it.mp4?a=1&b=2" }, p.segmentUrls)+ assertEquals(44100L, p.timescale)+ assertArrayEquals(longArrayOf(176128, 176128, 176128, 1024), p.durations)+ assertNull(DashLive.parse("<MPD><BaseURL>https://x/a.flac</BaseURL></MPD>"))+ assertNull(DashLive.parse(mpd.replace("https://cdn.example.com/x/0", "x/0")))+ }++ @Test fun theIndexListsEverySegmentForSeeking() {+ val b = ByteBuffer.wrap(DashLive.sidx(44100, longArrayOf(10, 20), longArrayOf(300, 400)))+ assertEquals(32 + 24, b.int)+ assertEquals("sidx", String(ByteArray(4).also { b.get(it) }))+ assertEquals(0, b.int)+ assertEquals(1, b.int); assertEquals(44100, b.int); assertEquals(0, b.int); assertEquals(0, b.int)+ assertEquals(0, b.short.toInt()); assertEquals(2, b.short.toInt())+ assertEquals(300, b.int); assertEquals(10, b.int); assertEquals(0x90000000.toInt(), b.int)+ assertEquals(400, b.int); assertEquals(20, b.int)+ }++ @Test fun theLiveFileReadsAcrossSegmentsAndFromAnyPosition() {+ val segs = mapOf("s1" to ByteArray(5) { (10 + it).toByte() }, "s2" to ByteArray(3) { (20 + it).toByte() })+ val fetched = mutableListOf<String>()+ val live = DashLive(byteArrayOf(1, 2), listOf("s1", "s2"), longArrayOf(5, 3)) { fetched += it; segs.getValue(it) }+ assertEquals(10, live.length)+ val all = ByteArray(10)+ var at = 0L+ while (true) {+ val n = live.read(at, all, at.toInt(), 4)+ if (n < 0) break+ at += n+ }+ assertArrayEquals(byteArrayOf(1, 2, 10, 11, 12, 13, 14, 20, 21, 22), all)+ // A seek into the second segment fetches only it.+ fetched.clear()+ val buf = ByteArray(2)+ assertEquals(2, live.read(8, buf, 0, 2))+ assertArrayEquals(byteArrayOf(21, 22), buf)+ assertEquals(-1, live.read(10, buf, 0, 2))+ assertEquals(emptyList<String>(), fetched) // s2 was the segment read last: still in memory+ }++ @Test fun aSegmentBeingFetchedHoldsNoOtherReadAndIsFetchedOnce() {+ val gate = java.util.concurrent.CountDownLatch(1)+ val fetched = java.util.concurrent.ConcurrentLinkedQueue<String>()+ val live = DashLive(byteArrayOf(1, 2), listOf("s1", "s2"), longArrayOf(2, 2)) { url ->+ fetched += url+ if (url == "s1") gate.await()+ if (url == "s1") byteArrayOf(10, 11) else byteArrayOf(20, 21)+ }+ val warm = Thread { live.warm() }.apply { start() }+ while (fetched.isEmpty()) Thread.sleep(1)+ val waiting = arrayOfNulls<Int>(1)+ val reader = Thread { waiting[0] = live.read(2, ByteArray(2), 0, 2) }.apply { start() }+ // The second segment is read while the first one is still on its way.+ val buf = ByteArray(2)+ assertEquals(2, live.read(4, buf, 0, 2))+ assertArrayEquals(byteArrayOf(20, 21), buf)+ gate.countDown()+ warm.join(5_000); reader.join(5_000)+ assertEquals(2, waiting[0])+ assertEquals(listOf("s1", "s2"), fetched.toList()) // the reader of s1 waited for the warm-up's fetch+ }++ @Test fun theFirstSegmentFetchedAheadIsReadWithoutAnotherFetch() {+ val segs = mapOf("s1" to ByteArray(5) { (10 + it).toByte() }, "s2" to ByteArray(3))+ val fetched = mutableListOf<String>()+ val live = DashLive(byteArrayOf(1, 2), listOf("s1", "s2"), longArrayOf(5, 3)) { fetched += it; segs.getValue(it) }+ live.warm()+ live.warm() // already there: not fetched twice+ assertEquals(listOf("s1"), fetched)+ val buf = ByteArray(5)+ assertEquals(5, live.read(2, buf, 0, 5))+ assertArrayEquals(segs.getValue("s1"), buf)+ assertEquals(listOf("s1"), fetched)+ }+}diff --git a/base/app/src/test/java/com/music/spotui/data/offline/FlacDurationTest.kt b/base/app/src/test/java/com/music/spotui/data/offline/FlacDurationTest.ktnew file mode 100644index 00000000..944e7d05--- /dev/null+++ b/base/app/src/test/java/com/music/spotui/data/offline/FlacDurationTest.kt@@ -0,0 +1,31 @@+package com.music.spotui.data.offline++import org.junit.Assert.assertEquals+import org.junit.Assert.assertNull+import org.junit.Test++class FlacDurationTest {++ private fun fakeFlac(sampleRate: Int = 44_100, samples: Long = sampleRate * 200L): ByteArray {+ val head = ByteArray(42)+ "fLaC".toByteArray().copyInto(head)+ // STREAMINFO fields a real FLAC carries, packed as the parser expects:+ // 20 bits sample rate | 3 channels | 5 bits/sample | 36-bit total samples.+ val packed = (sampleRate.toLong() and 0xFFFFF) shl 44 or+ (2L shl 41) or // stereo+ (16L shl 36) or ((samples and 0xFFFFFFFFL))+ for (i in 0 until 8) head[18 + i] = (packed ushr (56 - 8 * i)).toByte()+ return head+ }++ @Test+ fun readsTheDuration() {+ assertEquals(210, OfflineDownloader.flacDurationSec(fakeFlac(44_100, 44_100L * 210)))+ }++ @Test+ fun notFlacOrTooShortIsNull() {+ assertNull(OfflineDownloader.flacDurationSec(ByteArray(42)))+ assertNull(OfflineDownloader.flacDurationSec(ByteArray(20)))+ }+}diff --git a/base/app/src/test/java/com/music/spotui/data/offline/OfflineDownloaderTest.kt b/base/app/src/test/java/com/music/spotui/data/offline/OfflineDownloaderTest.ktindex 2e6c0024..bbf926b8 100644--- a/base/app/src/test/java/com/music/spotui/data/offline/OfflineDownloaderTest.kt+++ b/base/app/src/test/java/com/music/spotui/data/offline/OfflineDownloaderTest.kt@@ -23,30 +23,13 @@ class OfflineDownloaderTest {assertNull(OfflineDownloader.normalizeIsrc("USUM7170386")) // one digit short}- private fun hit(url: String, title: String, artist: String, sec: Long) = OfflineDownloader.PreviewHit(url, title, artist, sec)-- @Test fun pickPreviewKeepsTheSameSong() {- val results = listOf(- hit("https://cdn/live.mp3", "Paranoïa (Live)", "MadeInParis", 312), // live take, much longer- hit("", "Paranoïa", "MadeInParis", 163), // no preview- hit("https://cdn/other.mp3", "Typical", "Al-Walid", 163), // same length, other song- hit("https://cdn/album.mp3", "Paranoia", "MadeInParis", 164),- )- assertEquals("https://cdn/album.mp3", OfflineDownloader.pickPreview(results, "Paranoïa", "MadeInParis", 163_400))- }-- @Test fun pickPreviewIgnoresFeatAndRemasterSuffixes() {- val results = listOf(hit("https://cdn/a.mp3", "Yellow Submarine (Remastered 2009)", "The Beatles", 157))- assertEquals("https://cdn/a.mp3", OfflineDownloader.pickPreview(results, "Yellow Submarine - Remastered 2009", "The Beatles", 158_000))- val feat = listOf(hit("https://cdn/b.mp3", "Stay (feat. Guest)", "Artist", 200))- assertEquals("https://cdn/b.mp3", OfflineDownloader.pickPreview(feat, "Stay", "Artist", 200_000))- }-- @Test fun pickPreviewRejectsAnotherArtistOrDuration() {- val results = listOf(hit("https://cdn/a.mp3", "GO", "Someone Else", 178))- assertNull(OfflineDownloader.pickPreview(results, "GO", "Slimka", 178_000))- assertNull(OfflineDownloader.pickPreview(listOf(hit("https://cdn/a.mp3", "GO", "Slimka", 178)), "GO", "Slimka", 0))- assertNull(OfflineDownloader.pickPreview(listOf(hit("https://cdn/a.mp3", "GO", "Slimka", 178)), "GO", "Slimka", 190_000))+ @Test fun lengthMismatchRefusesPreviewsAndOtherVersions() {+ assertNull(OfflineDownloader.lengthMismatch(163, 163_400))+ assertNull(OfflineDownloader.lengthMismatch(160, 163_400)) // a few seconds trimmed+ assertNull(OfflineDownloader.lengthMismatch(175, 163_400)) // trailing silence+ assertNull(OfflineDownloader.lengthMismatch(30, 0)) // the song's length unknown+ assertTrue(OfflineDownloader.lengthMismatch(30, 163_400)!!.contains("preview"))+ assertTrue(OfflineDownloader.lengthMismatch(312, 163_400)!!.contains("another version"))}@Test fun localIdsNeverCollideWithMediaStoreIds() {diff --git a/base/app/src/test/java/com/music/spotui/data/offline/OfflineIndexTest.kt b/base/app/src/test/java/com/music/spotui/data/offline/OfflineIndexTest.ktindex e5bb7d71..817a7a61 100644--- a/base/app/src/test/java/com/music/spotui/data/offline/OfflineIndexTest.kt+++ b/base/app/src/test/java/com/music/spotui/data/offline/OfflineIndexTest.kt@@ -20,6 +20,14 @@ class OfflineIndexTest {return root}+ @Test fun theProvidingExtensionIsKeptAndOlderEntriesHaveNone() {+ val old = OfflineTrack.fromJson(entry("a"))+ assertEquals(null, old.providerId)+ val kept = OfflineTrack.fromJson(old.copy(providerId = "io.github.x.dl").toJson())+ assertEquals("io.github.x.dl", kept.providerId)+ assertFalse(old.toJson().has("providerId"))+ }+@Test fun truncatedIndexKeepsEveryFile() {val root = folder("[{\"id\":\"a\",\"file\":\"a.m4a\"", "a", "b")OfflineStore.load(root)diff --git a/base/app/src/test/java/com/music/spotui/data/offline/StreamHeadTest.kt b/base/app/src/test/java/com/music/spotui/data/offline/StreamHeadTest.ktnew file mode 100644index 00000000..b269b857--- /dev/null+++ b/base/app/src/test/java/com/music/spotui/data/offline/StreamHeadTest.kt@@ -0,0 +1,38 @@+package com.music.spotui.data.offline++import org.junit.Assert.assertEquals+import org.junit.Assert.assertNull+import org.junit.Assert.assertSame+import org.junit.Test++class StreamHeadTest {+ private fun head(key: String, url: String = "https://cdn.example.com/$key.flac", until: Long = 1_000) =+ StreamHead.Head(key, url, ByteArray(4), 100, until)++ @Test fun aHeadIsServedOnceToItsSongAndAddress() {+ val h = head("a")+ StreamHead.put(h)+ assertNull(StreamHead.take("b", "https://cdn.example.com/b.flac", now = 10))+ assertSame(h, StreamHead.take("a", "https://cdn.example.com/a.flac", now = 10))+ assertNull(StreamHead.take("a", "https://cdn.example.com/a.flac", now = 10))+ }++ @Test fun aStaleOrMovedHeadIsDropped() {+ StreamHead.put(head("a"))+ // The song got another address (asked again): the head is of the old one.+ assertNull(StreamHead.take("a", "https://cdn.example.com/other.flac", now = 10))+ assertNull(StreamHead.take("a", "https://cdn.example.com/a.flac", now = 10))+ StreamHead.put(head("a", until = 100))+ assertNull(StreamHead.take("a", "https://cdn.example.com/a.flac", now = 100))+ StreamHead.put(head("a", until = 100))+ assertNull(StreamHead.take("b", "https://cdn.example.com/b.flac", now = 200))+ assertNull(StreamHead.take("a", "https://cdn.example.com/a.flac", now = 50))+ }++ @Test fun theTotalIsReadFromTheRange() {+ assertEquals(9_876_543L, StreamHead.total("bytes 0-524287/9876543"))+ assertNull(StreamHead.total("bytes 0-524287/*"))+ assertNull(StreamHead.total("bytes 10-20/30"))+ assertNull(StreamHead.total(null))+ }+}diff --git a/base/app/src/test/java/com/music/spotui/di/LocalQueueOrderTest.kt b/base/app/src/test/java/com/music/spotui/di/LocalQueueOrderTest.ktnew file mode 100644index 00000000..2dbbb20b--- /dev/null+++ b/base/app/src/test/java/com/music/spotui/di/LocalQueueOrderTest.kt@@ -0,0 +1,39 @@+package com.music.spotui.di++import org.junit.Assert.assertEquals+import org.junit.Test++class LocalQueueOrderTest {+ // C is playing; Q1, Q2 were queued by the user; A, B, D are the list's next songs.+ private val order = listOf("P", "C", "Q1", "Q2", "A", "B", "D")+ private val queued = { s: String -> s.startsWith("Q") }++ @Test fun addToQueueGoesAfterTheQueuedSongsAndPlayNextFirst() {+ assertEquals(4, LocalQueueOrder.insertIndex(order, 1, next = false, isQueued = queued))+ assertEquals(2, LocalQueueOrder.insertIndex(order, 1, next = true, isQueued = queued))+ assertEquals(2, LocalQueueOrder.queuedAfter(order, 1, queued))+ // Nothing queued: "Add to queue" is the very next song, not the end of the list.+ assertEquals(2, LocalQueueOrder.insertIndex(listOf("P", "C", "A"), 1, next = false, isQueued = queued))+ }++ @Test fun aTapOnASongOfTheListKeepsTheQueuedSongsRightAfterIt() {+ val (after, at) = LocalQueueOrder.skip(order, 1, 5, queued)+ assertEquals(listOf("P", "C", "A", "B", "Q1", "Q2", "D"), after)+ assertEquals("B", after[at])+ // A tap on a queued song: it plays, nothing moves.+ assertEquals(order to 3, LocalQueueOrder.skip(order, 1, 3, queued))+ }++ @Test fun shuffleLeavesTheQueuedSongsInPlaceAndOffPutsTheListBack() {+ val on = LocalQueueOrder.shuffled(order, 1, queued) { it.reversed() }+ assertEquals(listOf("P", "C", "Q1", "Q2", "D", "B", "A"), on)+ // Back in the list's order, the queued songs still next, a song added meanwhile at the end.+ val before = listOf("A", "P", "C", "B", "D")+ val now = listOf("P", "C", "Q1", "Q2", "D", "X", "B", "A")+ assertEquals(listOf("A", "P", "C", "Q1", "Q2", "B", "D", "X"), LocalQueueOrder.unshuffled(now, 1, before, queued))+ }++ @Test fun aSongDraggedAmongTheQueuedOnesIsMovedUp() {+ assertEquals(listOf("P", "C", "Q1", "Q2", "Q3", "A", "B"), LocalQueueOrder.settle(listOf("P", "C", "Q1", "A", "Q2", "B", "Q3"), 1, queued))+ }+}diff --git a/base/app/src/test/java/com/music/spotui/extensions/AudioRouteTest.kt b/base/app/src/test/java/com/music/spotui/extensions/AudioRouteTest.ktnew file mode 100644index 00000000..a0d43142--- /dev/null+++ b/base/app/src/test/java/com/music/spotui/extensions/AudioRouteTest.kt@@ -0,0 +1,150 @@+package com.music.spotui.extensions++import com.music.spotui.data.entity.SongsModel+import kotlinx.coroutines.runBlocking+import org.junit.Assert.assertEquals+import org.junit.Assert.assertFalse+import org.junit.Assert.assertNull+import org.junit.Assert.assertTrue+import org.junit.Test++/** Which plays ask the audio-source extensions, and the queue the local player gets. */+class AudioRouteTest {+ private fun song(id: String, playable: Boolean = true) =+ SongsModel(id.hashCode(), "T$id", "Album", "Artist", "https://i/$id", "spotify:track:$id", spotifyTrackId = id, playable = playable)++ @Test fun onlyATrackWithAnIdAsksAndOnlyWhileAnAudioSourceIsOn() {+ assertTrue(AudioRoute.asks("abc", hasAudioSource = true))+ assertFalse(AudioRoute.asks("abc", hasAudioSource = false))+ assertFalse(AudioRoute.asks(null, hasAudioSource = true))+ assertFalse(AudioRoute.asks("", hasAudioSource = true))+ }++ @Test fun onlyTheSongAfterTheOneSpotifyPlayedForWantOfAnExtensionIsAskedAgain() {+ assertTrue(AudioRoute.backFromFallback("a", "a", "b", hasAudioSource = true, remote = false))+ // Not the song that fell back, nor once the engine moved on from it, nor with none to ask.+ assertFalse(AudioRoute.backFromFallback("a", "a", "a", hasAudioSource = true, remote = false))+ assertFalse(AudioRoute.backFromFallback("a", "c", "b", hasAudioSource = true, remote = false))+ assertFalse(AudioRoute.backFromFallback(null, "a", "b", hasAudioSource = true, remote = false))+ assertFalse(AudioRoute.backFromFallback("a", "a", "", hasAudioSource = true, remote = false))+ assertFalse(AudioRoute.backFromFallback("a", "a", "b", hasAudioSource = false, remote = false))+ assertFalse(AudioRoute.backFromFallback("a", "a", "b", hasAudioSource = true, remote = true))+ }++ @Test fun theCallersListIsUsedWhenItHoldsTheSongElseTheSongIsLookedUp() = runBlocking {+ val list = listOf(song("a"), song("b"))+ var looked = 0+ assertEquals(list, AudioRoute.songsFor("b", list) { looked++; null })+ assertEquals(0, looked)+ // A link or a block: only the uri is known, the song comes from the lookup.+ assertEquals(listOf(song("c")), AudioRoute.songsFor("c", null) { looked++; song("c") })+ assertEquals(listOf(song("c")), AudioRoute.songsFor("c", list) { looked++; song("c") })+ assertEquals(2, looked)+ // Nothing found, or another song: Spotify plays.+ assertNull(AudioRoute.songsFor("d", null) { null })+ assertNull(AudioRoute.songsFor("d", null) { song("e") })+ }++ @Test fun theQueueKeepsPlayableSongsOnceInOrderWithThePickedOne() {+ val songs = listOf(song("a"), song("x", playable = false), song(""), song("b"), song("a"), song("c"))+ val (queue, at) = AudioRoute.queue(songs, song("b"))+ assertEquals(listOf("a", "b", "c"), queue.map { it.spotifyTrackId })+ assertEquals(1, at)+ // The picked song stays even when marked unplayable.+ val (q2, at2) = AudioRoute.queue(songs, song("x", playable = false))+ assertEquals(listOf("a", "x", "b", "c"), q2.map { it.spotifyTrackId })+ assertEquals(1, at2)+ // The song alone (a search result, a link).+ assertEquals(listOf(song("z")) to 0, AudioRoute.queue(listOf(song("z")), song("z")))+ }++ private class Refused(val code: Int) : java.io.IOException("HTTP $code")+ private fun stream(n: Int) = app.myspoti.extensions.AudioStream("https://cdn.example.com/$n.m4a", emptyMap(), null, null)++ @Test fun aRefusedAddressIsAskedForOnceMoreThenFailsCleanly() {+ val status = { t: Throwable -> (t as? Refused)?.code }+ // Expired: dropped, asked again, the new address plays.+ val asked = mutableListOf<Boolean>()+ var n = 0+ val ok = AudioRoute.openStream({ again -> asked += again; stream(++n) }, { s -> if (s.url.endsWith("1.m4a")) throw Refused(403) else 42L }, status)+ assertEquals(42L, ok)+ assertEquals(listOf(false, true), asked)+ // Refused twice: one retry only, then a NoAudioException (the player does not retry it).+ asked.clear(); n = 0+ val twice = runCatching { AudioRoute.openStream({ again -> asked += again; stream(++n) }, { _: app.myspoti.extensions.AudioStream -> throw Refused(401) }, status) }.exceptionOrNull()+ assertTrue(twice is NoAudioException && AudioRoute.isNoAudio(twice))+ assertEquals(listOf(false, true), asked)+ // Wrapped in another error: still seen.+ asked.clear(); n = 0+ AudioRoute.openStream({ again -> asked += again; stream(++n) }, { s -> if (s.url.endsWith("1.m4a")) throw java.io.IOException("open", Refused(403)) else 1L }, status)+ assertEquals(listOf(false, true), asked)+ // No other address: fails.+ val none = runCatching { AudioRoute.openStream({ again -> if (again) null else stream(1) }, { _: app.myspoti.extensions.AudioStream -> throw Refused(403) }, status) }.exceptionOrNull()+ assertTrue(none is NoAudioException)+ // Gone (404, 410): asked again too, once.+ for (code in listOf(404, 410)) {+ asked.clear(); n = 0+ assertEquals(7L, AudioRoute.openStream({ again -> asked += again; stream(++n) }, { s -> if (s.url.endsWith("1.m4a")) throw Refused(code) else 7L }, status))+ assertEquals(listOf(false, true), asked)+ }+ // Another error (500, a network failure) is not retried.+ asked.clear()+ val other = runCatching { AudioRoute.openStream({ again -> asked += again; stream(1) }, { _: app.myspoti.extensions.AudioStream -> throw Refused(500) }, status) }.exceptionOrNull()+ assertTrue(other is Refused && !AudioRoute.isNoAudio(other))+ assertEquals(listOf(false), asked)+ // No answer at all.+ assertTrue(AudioRoute.isNoAudio(java.io.IOException("source", runCatching { AudioRoute.openStream({ null }, { 0L }, status) }.exceptionOrNull())))+ }++ @Test fun aShufflePlayStartsOnAPlayableSongWithAnId() {+ val songs = listOf(song(""), song("x", playable = false), song("a"))+ repeat(20) { assertEquals("a", AudioRoute.shufflePick(songs, kotlin.random.Random(it))?.spotifyTrackId) }+ assertNull(AudioRoute.shufflePick(listOf(song("x", playable = false))))+ }++ @Test fun aSongNoExtensionHadIsNotAskedAgainForAMinute() {+ var now = 0L+ val misses = AudioMisses(60_000L) { now }+ assertFalse(misses.skips("p", ahead = false))+ // Missed ahead: further asks ahead are skipped, the ask when the song starts still goes out.+ misses.record("p", ahead = true)+ assertTrue(misses.skips("p", ahead = true))+ assertFalse(misses.skips("p", ahead = false))+ // Missed when it started: nothing asks again, an ask ahead does not weaken it.+ misses.record("p", ahead = false)+ misses.record("p", ahead = true)+ assertTrue(misses.skips("p", ahead = false))+ assertTrue(misses.skips("p", ahead = true))+ assertFalse(misses.skips("q", ahead = false))+ // A minute later, asked again.+ now = 60_000L+ assertFalse(misses.skips("p", ahead = false))+ assertFalse(misses.skips("p", ahead = true))+ // An extension live again or changed: forgotten at once.+ misses.record("p", ahead = false)+ misses.clear()+ assertFalse(misses.skips("p", ahead = false))+ }++ @Test fun onlyAQueueTheExtensionsPlayGoesOnAfterItsLastSong() {+ assertTrue(AudioRoute.continues(fromExtensions = true, lastId = "a", repeatAll = false, autoplay = true))+ // Repeat all loops, autoplay off ends, a file of the device or a list of downloads never goes on.+ assertFalse(AudioRoute.continues(fromExtensions = true, lastId = "a", repeatAll = true, autoplay = true))+ assertFalse(AudioRoute.continues(fromExtensions = true, lastId = "a", repeatAll = false, autoplay = false))+ assertFalse(AudioRoute.continues(fromExtensions = true, lastId = "", repeatAll = false, autoplay = true))+ assertFalse(AudioRoute.continues(fromExtensions = false, lastId = "a", repeatAll = false, autoplay = true))+ }++ @Test fun theSongRadioAddsOnlyPlayableSongsNotQueuedOnce() {+ val radio = listOf(song("a"), song("b"), song("b"), song("c", playable = false), song(""), song("d"))+ assertEquals(listOf("b", "d"), AudioRoute.continuation(radio, listOf("a")).map { it.spotifyTrackId })+ assertTrue(AudioRoute.continuation(listOf(song("a")), listOf("a")).isEmpty())+ }++ @Test fun backFromAFallbackTheLocalQueueGoesOnFromTheSongMovedTo() {+ val rest = listOf(song("q"), song("b"), song("r"))+ assertEquals(listOf("q", "b", "r"), AudioRoute.resumeList(rest, "q")!!.map { it.spotifyTrackId })+ assertEquals(listOf("b", "r"), AudioRoute.resumeList(rest, "b")!!.map { it.spotifyTrackId })+ assertNull(AudioRoute.resumeList(rest, "elsewhere"))+ }+}diff --git a/base/app/src/test/java/com/music/spotui/extensions/ExtensionRegistryTest.kt b/base/app/src/test/java/com/music/spotui/extensions/ExtensionRegistryTest.ktnew file mode 100644index 00000000..23f8d07b--- /dev/null+++ b/base/app/src/test/java/com/music/spotui/extensions/ExtensionRegistryTest.kt@@ -0,0 +1,259 @@+package com.music.spotui.extensions++import app.myspoti.extensions.Action+import app.myspoti.extensions.ActionRequest+import app.myspoti.extensions.Area+import app.myspoti.extensions.Clash+import app.myspoti.extensions.Manifest+import app.myspoti.extensions.PermissionRequest+import org.junit.Assert.assertEquals+import org.junit.Assert.assertFalse+import org.junit.Assert.assertNull+import org.junit.Assert.assertTrue+import org.junit.Test+import java.nio.file.Files++/** What is granted, kept and asked again, and what the registry and the stores keep on disk. */+class ExtensionRegistryTest {+ private val why = "Explains why it needs this right"++ private fun manifest(+ versionCode: Int = 1,+ provides: List<String> = listOf("lyrics"),+ permissions: List<PermissionRequest> = listOf(PermissionRequest("network", listOf("api.example.com"))),+ ) = Manifest("io.github.test.ext", "Test", "1.$versionCode", versionCode = versionCode, author = "me", provides = provides, permissions = permissions)++ private fun installed(m: Manifest, granted: Set<String>) =+ InstalledExtension(m.id, m.name, m.version, m.versionCode, m.author, "sha", granted)++ // ── Grants ──++ private val base = setOf("lyrics.provide", "network", "storage")++ @Test fun installingGrantsEveryActionTheManifestLists() {+ val m = manifest(permissions = listOf(PermissionRequest("network", listOf("api.example.com")), PermissionRequest("notify")))+ assertEquals(setOf("lyrics.provide", "network", "notify", "storage"), Grants.keys(m))+ val audio = manifest(provides = listOf("audio-source"), permissions = listOf(PermissionRequest("audio-source", why = why), PermissionRequest("network", listOf("cdn.example.com"))))+ assertEquals(setOf("audio.source", "network", "storage"), Grants.keys(audio))+ }++ @Test fun actionsUntickedBeforeAreRefusedUntilTheUserAcceptsThemAll() {+ val m = manifest(permissions = listOf(PermissionRequest("network", listOf("api.example.com")), PermissionRequest("notify")))+ assertEquals(setOf("notify"), Grants.refused(installed(m, base), m))+ assertTrue(Grants.refused(installed(m, Grants.keys(m)), m).isEmpty())+ assertEquals(base, Grants.replacing(m, setOf("notify")))+ assertEquals(Grants.keys(m), Grants.replacing(m, emptySet()))+ }++ // ── Install plans and the re-ask on update ──++ @Test fun notInstalledIsAFreshInstall() {+ assertTrue(InstallPlan.of(manifest(), null, null) is InstallPlan.Fresh)+ }++ @Test fun theSameOrAnOlderVersionIsRefused() {+ val m = manifest(versionCode = 2)+ assertTrue(InstallPlan.of(m, installed(m, base), m) is InstallPlan.NotNewer)+ assertTrue(InstallPlan.of(manifest(versionCode = 1), installed(m, base), m) is InstallPlan.NotNewer)+ }++ @Test fun anUpdateWithTheSameRightsKeepsWhatWasGrantedWithoutAsking() {+ val old = manifest(1, permissions = listOf(PermissionRequest("network", listOf("api.example.com")), PermissionRequest("notify")))+ val new = old.copy(versionCode = 2, version = "1.2")+ val all = Grants.keys(old)+ val plan = InstallPlan.of(new, installed(old, all), old) as InstallPlan.Update+ assertFalse(plan.reAsk)+ assertTrue(plan.refused.isEmpty())+ // One unticked back when the prompt allowed it: the prompt lists it again.+ val partial = InstallPlan.of(new, installed(old, base), old) as InstallPlan.Update+ assertTrue(partial.reAsk)+ assertEquals(setOf("notify"), partial.refused)+ }++ @Test fun aNewRightIsAskedAgainWithTheOnesUntickedBefore() {+ val old = manifest(1, permissions = listOf(PermissionRequest("network", listOf("api.example.com")), PermissionRequest("notify")))+ val new = manifest(2, permissions = old.permissions + PermissionRequest("spotify.write", why = why))+ val plan = InstallPlan.of(new, installed(old, base), old) as InstallPlan.Update+ assertTrue(plan.reAsk)+ assertEquals(listOf("library.write", "playlists.write", "playback.control", "playback.queue"), plan.newAsks.map { it.key })+ assertEquals(setOf("notify"), plan.refused)+ // The prompt installs with all it lists.+ assertEquals(base + setOf("notify", "library.write", "playlists.write", "playback.control", "playback.queue"), Grants.keys(new))+ }++ @Test fun moreHostsOrAnyHostIsAskedAgain() {+ val old = manifest(1)+ val more = manifest(2, permissions = listOf(PermissionRequest("network", listOf("api.example.com", "other.example.com"))))+ assertEquals(listOf("network"), (InstallPlan.of(more, installed(old, base), old) as InstallPlan.Update).newAsks.map { it.key })+ val fewer = manifest(2, permissions = listOf(PermissionRequest("network", listOf("api.example.com"))))+ assertFalse((InstallPlan.of(fewer, installed(old, base), old) as InstallPlan.Update).reAsk)+ val any = manifest(2, permissions = listOf(PermissionRequest("network", listOf("*"), why = why)))+ val plan = InstallPlan.of(any, installed(old, base), old) as InstallPlan.Update+ assertEquals(listOf("network.any"), plan.newAsks.map { it.key })+ assertFalse("network" in Grants.keys(any))+ }++ @Test fun aNewTakeoverIsAskedAndARightDroppedByTheUpdateIsForgotten() {+ val old = manifest(1, permissions = listOf(PermissionRequest("network", listOf("api.example.com")), PermissionRequest("notify")))+ val new = manifest(2, provides = listOf("lyrics", "audio-source"),+ permissions = listOf(PermissionRequest("network", listOf("api.example.com")), PermissionRequest("audio-source", why = why)))+ val plan = InstallPlan.of(new, installed(old, base + "notify"), old) as InstallPlan.Update+ assertEquals(listOf("audio.source"), plan.newAsks.map { it.key })+ assertFalse("notify" in plan.refused)+ }++ @Test fun anotherReasonIsAskedAgain() {+ val old = manifest(1, permissions = listOf(PermissionRequest("network", listOf("api.example.com"), why = "Reads lyrics")))+ val new = manifest(2, permissions = listOf(PermissionRequest("network", listOf("api.example.com"), why = "Sends what you play")))+ assertEquals(listOf("network"), (InstallPlan.of(new, installed(old, base), old) as InstallPlan.Update).newAsks.map { it.key })+ }++ @Test fun theGitHubRecordIsKeptOnDisk() {+ val m = manifest(2)+ val e = installed(m, setOf("lyrics.provide", "storage")).copy(+ origin = app.myspoti.extensions.Origin("me/ext", "v1.2", tag = true, commit = "0123456789abcdef0123456789abcdef01234567"),+ accepted = app.myspoti.extensions.Snapshot.of(manifest(1), "me/ext"),+ previous = KeptVersion("1.1", 1, "old", null),+ pendingUpdate = PendingUpdate(KeptVersion("1.3", 3, "new"), listOf(app.myspoti.extensions.Change(app.myspoti.extensions.Change.Kind.HOST, "x.example"))),+ declinedVersionCode = 3, sourceGone = true,+ )+ val f = Files.createTempFile("registry", ".json").toFile()+ Registry.write(f, Registry(listOf(e)))+ assertEquals(e, Registry.read(f).find(m.id))+ assertEquals("v1.2 · 0123456", e.origin!!.label())+ f.delete()+ }++ // ── Before actions, areas, clashes ──++ @Test fun aRegistryFromBeforeActionsIsMigrated() {+ val old = Registry(+ extensions = listOf(installed(manifest(), setOf("lyrics", "network", "player.read"))),+ priority = mapOf("lyrics" to listOf("a", "b"), "audio-source" to listOf("c"), "download-source" to listOf("d", "c")),+ )+ val now = old.migrated()+ assertEquals(setOf("lyrics.provide", "network", "playback.events", "storage", "settings.page"), now.extensions.single().granted)+ assertEquals(mapOf("lyrics" to listOf("a", "b"), "audio" to listOf("c", "d")), now.priority)+ // Read from disk, it comes back migrated.+ val file = java.io.File(Files.createTempDirectory("reg").toFile(), "registry.json")+ Registry.write(file, old)+ assertEquals(now, Registry.read(file))+ }++ @Test fun extensionsAreGroupedByAreaInTheUsersOrder() {+ fun m(id: String, vararg actions: String) = Manifest(id, id, "1", author = "me", actions = actions.map { ActionRequest(it, "Because") })+ val manifests = mapOf(+ "x.lyrics" to m("x.lyrics", "lyrics.provide", "network"),+ "x.both" to m("x.both", "lyrics.provide", "player.buttons"),+ "x.net" to m("x.net", "network", "storage"),+ )+ var r = Registry().put(installed(manifests.getValue("x.lyrics"), base).copy(id = "x.lyrics"))+ .put(installed(manifests.getValue("x.both"), base).copy(id = "x.both"))+ .put(installed(manifests.getValue("x.net"), base).copy(id = "x.net"))+ r = r.move(Area.LYRICS.key, listOf("x.lyrics", "x.both"), "x.both", -1)+ val g = Areas.group(r) { manifests[it] }+ assertEquals(Area.entries.toList(), g.keys.toList())+ assertEquals(listOf("x.both", "x.lyrics"), g.getValue(Area.LYRICS).map { it.id })+ assertEquals(listOf("x.both"), g.getValue(Area.MENUS).map { it.id })+ // Support actions alone: Other.+ assertEquals(listOf("x.net"), g.getValue(Area.OTHER).map { it.id })+ assertTrue(g.getValue(Area.PLAYBACK).isEmpty())+ }++ @Test fun aClashIsSettledAsTheUserChose() {+ val m = manifest()+ val r = Registry().put(installed(m, base).copy(id = "old.one")).put(installed(m, base).copy(id = "old.two"))+ val audio = Clash(Clash.Kind.EXCLUSIVE, "old.one", Action.AUDIO_SOURCE)+ val conflict = Clash(Clash.Kind.CONFLICT, "old.two")+ val (kept, off) = Clashes.apply(r, "new.one", listOf(audio, conflict)) { true }+ assertEquals("new.one", kept.active["audio.source"])+ assertFalse(kept.find("old.two")!!.enabled)+ assertTrue(kept.find("old.one")!!.enabled) // idle, not off+ assertFalse(off)+ val (refused, newOff) = Clashes.apply(r, "new.one", listOf(audio, conflict)) { false }+ assertEquals("old.one", refused.active["audio.source"])+ assertTrue(refused.find("old.two")!!.enabled)+ assertTrue(newOff)+ assertEquals(emptyMap<String, String>(), kept.remove("new.one").active)+ }++ // ── On disk ──++ @Test fun theRegistryKeepsOrderAndSurvivesARestart() {+ val dir = Files.createTempDirectory("ext").toFile()+ val file = java.io.File(dir, "registry.json")+ val a = installed(manifest(), base).copy(id = "io.a.one")+ val b = installed(manifest(), base).copy(id = "io.b.two")+ var r = Registry().put(a).put(b).copy(repositories = listOf("https://example.com/index.json"))+ r = r.put(b.copy(enabled = false, disabledReason = "failed"))+ Registry.write(file, r)+ val back = Registry.read(file)+ assertEquals(listOf("io.a.one", "io.b.two"), back.extensions.map { it.id })+ assertEquals("failed", back.find("io.b.two")?.disabledReason)+ assertEquals(listOf("https://example.com/index.json"), back.repositories)+ assertEquals(listOf("io.b.two"), back.remove("io.a.one").extensions.map { it.id })+ assertEquals(Registry(), Registry.read(java.io.File(dir, "missing.json")))+ dir.deleteRecursively()+ }++ @Test fun aStoreIsWrittenThroughAndCounted() {+ val dir = Files.createTempDirectory("ext").toFile()+ val f = java.io.File(dir, "x/storage.json")+ FileStore(f).apply { set("k", "[1,2]"); set("s", "\"v\""); remove("s") }+ val again = FileStore(f)+ assertEquals("[1,2]", again.get("k"))+ assertNull(again.get("s"))+ assertEquals(1 + 5, again.size())+ dir.deleteRecursively()+ }++ @Test fun theLogKeepsItsLastLines() {+ val dir = Files.createTempDirectory("ext").toFile()+ val log = ExtensionLog(java.io.File(dir, "log.txt"), maxLines = 3)+ (1..5).forEach { log.add("line $it") }+ assertEquals(listOf("line 3", "line 4", "line 5"), log.lines())+ assertEquals(listOf("line 3", "line 4", "line 5"), ExtensionLog(java.io.File(dir, "log.txt"), maxLines = 3).lines())+ dir.deleteRecursively()+ }++ @Test fun threeFailuresInARowTurnAnExtensionOff() {+ val c = FailureCounter(limit = 3)+ assertFalse(c.failed("a")); assertFalse(c.failed("a"))+ c.succeeded("a")+ assertFalse(c.failed("a")); assertFalse(c.failed("a"))+ assertTrue(c.failed("a"))+ assertFalse(c.failed("b"))+ }++ // ── Priority ──++ @Test fun priorityIsInstallationOrderUntilTheUserMovesOne() {+ val ids = listOf("a", "b", "c")+ var r = Registry()+ assertEquals(ids, r.byPriority("lyrics", ids) { it })+ r = r.move("lyrics", ids, "c", -1)+ assertEquals(listOf("a", "c", "b"), r.byPriority("lyrics", ids) { it })+ r = r.move("lyrics", ids, "c", -5)+ assertEquals(listOf("c", "a", "b"), r.byPriority("lyrics", ids) { it })+ // Another area keeps installation order; a newly installed one comes last.+ assertEquals(ids, r.byPriority("audio", ids) { it })+ assertEquals(listOf("c", "a", "b", "d"), r.byPriority("lyrics", ids + "d") { it })+ // Moving past the end, or an unknown id, changes nothing.+ assertEquals(r, r.move("lyrics", ids, "b", 3))+ assertEquals(r, r.move("lyrics", ids, "zz", 1))+ }++ @Test fun priorityIsKeptOnDiskAndForgetsAnUninstalledExtension() {+ val m = manifest()+ val a = installed(m, base).copy(id = "a.b.a")+ val b = installed(m, base).copy(id = "a.b.b")+ var r = Registry().put(a).put(b).move("lyrics", listOf("a.b.a", "a.b.b"), "a.b.b", -1)+ val file = java.io.File(Files.createTempDirectory("reg").toFile(), "registry.json")+ Registry.write(file, r)+ r = Registry.read(file)+ assertEquals(listOf("a.b.b", "a.b.a"), r.byPriority("lyrics", r.extensions) { it.id }.map { it.id })+ r = r.remove("a.b.b")+ assertEquals(mapOf("lyrics" to listOf("a.b.a")), r.priority)+ assertEquals(emptyMap<String, List<String>>(), r.remove("a.b.a").priority)+ }+}diff --git a/base/app/src/test/java/com/music/spotui/extensions/HookDispatchTest.kt b/base/app/src/test/java/com/music/spotui/extensions/HookDispatchTest.ktnew file mode 100644index 00000000..a3f16797--- /dev/null+++ b/base/app/src/test/java/com/music/spotui/extensions/HookDispatchTest.kt@@ -0,0 +1,98 @@+package com.music.spotui.extensions++import app.myspoti.extensions.LyricsResult+import com.music.spotui.data.entity.LyricLine+import com.music.spotui.data.entity.LyricWord+import com.music.spotui.data.entity.Lyrics+import com.music.spotui.data.entity.LyricsColors+import kotlinx.coroutines.delay+import kotlinx.coroutines.runBlocking+import org.junit.Assert.assertEquals+import org.junit.Assert.assertNull+import org.junit.Assert.assertSame+import org.junit.Assert.assertTrue+import org.junit.Test++/** The order hooks are asked in, and how an extension's lyrics meet the app's own. */+class HookDispatchTest {+ @Test fun theFirstInstalledAnswerWinsEvenWhenALaterOneIsQuicker() = runBlocking {+ val r = HookDispatch.firstInOrder(listOf("a", "b", "c")) { c ->+ when (c) { "a" -> { delay(200); "from a" }; "b" -> "from b"; else -> "from c" }+ }+ assertEquals("a" to "from a", r)+ }++ @Test fun noAnswerOrAFailureGivesTheTurnToTheNext() = runBlocking {+ val r = HookDispatch.firstInOrder(listOf("a", "b", "c")) { c ->+ when (c) { "a" -> null; "b" -> throw IllegalStateException("boom"); else -> "from c" }+ }+ assertEquals("c" to "from c", r)+ assertNull(HookDispatch.firstInOrder(listOf("a")) { null })+ assertNull(HookDispatch.firstInOrder(emptyList<String>()) { "x" })+ }++ @Test fun theOthersAreNotWaitedForOnceTheFirstAnswers() = runBlocking {+ val started = System.currentTimeMillis()+ val r = HookDispatch.firstInOrder(listOf("a", "b")) { c -> if (c == "a") "quick" else { delay(5_000); "slow" } }+ assertEquals("quick", r?.second)+ assertTrue(System.currentTimeMillis() - started < 2_000)+ }++ @Test fun theBestRankWinsAndTiesGoToTheFirstInstalled() = runBlocking {+ val rank = { s: String -> s.length }+ assertEquals("b" to "long", HookDispatch.bestInOrder(listOf("a", "b", "c"), rank) { c -> mapOf("a" to "ab", "b" to "long", "c" to "abc")[c] })+ assertEquals("a" to "xy", HookDispatch.bestInOrder(listOf("a", "b"), rank) { c -> if (c == "a") "xy" else "zw" })+ assertEquals("b" to "zw", HookDispatch.bestInOrder(listOf("a", "b"), rank) { c -> if (c == "a") throw RuntimeException() else "zw" })+ }++ // ── Lyrics ──++ private fun lyrics(synced: Boolean, words: Boolean, provider: String, colors: LyricsColors? = null, uncapped: Boolean = true) = Lyrics(+ lines = listOf(LyricLine(if (synced) 1000 else 0, "line", if (words) listOf(LyricWord(1000, 1200, "line")) else null)),+ synced = synced, provider = provider, colors = colors, uncapped = uncapped,+ )++ private val colors = LyricsColors(1, 2, 3)++ @Test fun anExtensionFillsInWhenTheAppHasNothing() {+ val ext = lyrics(synced = true, words = false, provider = "Ext")+ assertSame(ext, LyricsMerge.choose(null, ext))+ val own = lyrics(synced = true, words = false, provider = "LRCLIB")+ assertSame(own, LyricsMerge.choose(own, null))+ }++ @Test fun betterLyricsWinWhoeverGivesThem() {+ val plain = lyrics(synced = false, words = false, provider = "Genius")+ val line = lyrics(synced = true, words = false, provider = "Ext")+ assertEquals("Ext", LyricsMerge.choose(plain, line)?.provider)+ val words = lyrics(synced = true, words = true, provider = "LyricsPlus")+ assertEquals("LyricsPlus", LyricsMerge.choose(words, line)?.provider)+ }++ @Test fun atTheSameLevelSpotifysOwnStayFirstAndOtherSourcesGiveWay() {+ val spotify = lyrics(synced = true, words = false, provider = "Musixmatch", colors = colors)+ val ext = lyrics(synced = true, words = false, provider = "Ext")+ assertEquals("Musixmatch", LyricsMerge.choose(spotify, ext)?.provider)+ val lrclib = lyrics(synced = true, words = false, provider = "LRCLIB")+ assertEquals("Ext", LyricsMerge.choose(lrclib, ext)?.provider)+ // Spotify's preview only (Free cap): the extension's full lyrics, with Spotify's colours.+ val preview = lyrics(synced = true, words = false, provider = "Musixmatch", colors = colors, uncapped = false)+ val chosen = LyricsMerge.choose(preview, ext)+ assertEquals("Ext", chosen?.provider)+ assertEquals(colors, chosen?.colors)+ }++ @Test fun anExtensionsAnswerBecomesTheAppsLyrics() {+ val r = LyricsResult.parse("""{"provider":"P","lines":[{"time":1500,"text":"a","words":[{"time":1500,"end":1700,"text":"a"}]},{"time":"2500","text":"b"}]}""", "Ext")!!+ val l = LyricsMerge.toLyrics(r)+ assertTrue(l.synced)+ assertEquals("P", l.provider)+ assertEquals(listOf(1500L, 2500L), l.lines.map { it.timeMs })+ assertEquals(1700L, l.lines[0].words!![0].endMs)+ assertEquals(3, LyricsMerge.rank(l))+ val plain = LyricsMerge.toLyrics(LyricsResult.parse("""{"plain":"one\ntwo"}""", "Ext")!!)+ assertEquals("Ext", plain.provider)+ assertEquals(1, LyricsMerge.rank(plain))+ assertEquals(listOf("one", "two"), plain.lines.map { it.text })+ }+}diff --git a/base/app/src/test/java/com/music/spotui/extensions/PlaybackTrackerTest.kt b/base/app/src/test/java/com/music/spotui/extensions/PlaybackTrackerTest.ktnew file mode 100644index 00000000..0c648cd7--- /dev/null+++ b/base/app/src/test/java/com/music/spotui/extensions/PlaybackTrackerTest.kt@@ -0,0 +1,102 @@+package com.music.spotui.extensions++import app.myspoti.extensions.PlaybackEvent+import app.myspoti.extensions.TrackInfo+import com.music.spotui.extensions.PlaybackTracker.Snapshot+import org.junit.Assert.assertEquals+import org.junit.Assert.assertTrue+import org.junit.Test++class PlaybackTrackerTest {+ private fun track(id: String) = TrackInfo(id, "spotify:track:$id", "T$id", "A", listOf("A"), "B", 200_000)+ private fun snap(id: String, pos: Long, playing: Boolean = true, source: String = PlaybackEvent.LOCAL) =+ Snapshot("$source:$id", track(id), source, playing, pos, 200_000, "spotify:playlist:p", shuffle = true)++ /** Plays [id] from [from] for [seconds], one snapshot a second; the events of those snapshots. */+ private fun PlaybackTracker.play(id: String, from: Long, seconds: Int, t0: Long): List<PlaybackEvent> =+ (0..seconds).flatMap { s -> observe(snap(id, from + s * 1000L), t0 + s * 1000L) }++ @Test fun startProgressAndASkipAfterFortySeconds() {+ val t = PlaybackTracker()+ val events = t.play("1", 0, 40, 1_000_000).toMutableList()+ t.skipAsked("forward", 1_040_500)+ events += t.observe(snap("2", 0), 1_041_000)+ assertEquals(listOf("start", "progress", "progress", "progress", "progress", "skip", "start"), events.map { it.type })+ assertEquals("play", events.first().reason)+ val skip = events[5]+ assertEquals("forward", skip.reason)+ assertTrue(skip.playedMs in 40_000..41_000)+ assertTrue(skip.positionMs in 40_000..41_000)+ assertEquals("skip", events.last().reason)+ assertEquals("spotify:playlist:p", skip.contextUri)+ assertTrue(skip.shuffle)+ assertEquals(PlaybackEvent.LOCAL, skip.source)+ }++ @Test fun everyEventSaysWhereTheAudioComesFrom() {+ val t = PlaybackTracker()+ val from = snap("1", 0).copy(origin = PlaybackEvent.ORIGIN_DOWNLOAD, providerId = "io.github.x.dl")+ val start = t.observe(from, 0).single()+ assertEquals(PlaybackEvent.ORIGIN_DOWNLOAD, start.origin)+ assertEquals("io.github.x.dl", start.providerId)+ val left = t.observe(snap("2", 0, source = PlaybackEvent.SPOTIFY), 1_000)+ assertEquals("io.github.x.dl", left.first().providerId)+ assertEquals(PlaybackEvent.ORIGIN_SPOTIFY, left.last().origin)+ assertEquals(null, left.last().providerId)+ }++ @Test fun aSongPlayedToItsEndEndsFinishedAndTheNextStartsAsNext() {+ val t = PlaybackTracker()+ t.observe(snap("1", 196_000), 0)+ t.observe(snap("1", 198_000), 2_000)+ val e = t.observe(snap("2", 500), 3_000)+ assertEquals(listOf("end", "start"), e.map { it.type })+ assertEquals("finished", e[0].reason)+ assertEquals("next", e[1].reason)+ }++ @Test fun pauseResumeAndSeekAreReportedAndASeekIsNotPlayedTime() {+ val t = PlaybackTracker()+ t.observe(snap("1", 0), 0)+ t.observe(snap("1", 1_000), 1_000)+ assertEquals(listOf("pause"), t.observe(snap("1", 2_000, playing = false), 2_000).map { it.type })+ assertEquals(emptyList<String>(), t.observe(snap("1", 2_000, playing = false), 10_000).map { it.type })+ assertEquals(listOf("resume"), t.observe(snap("1", 2_000), 11_000).map { it.type })+ val seek = t.observe(snap("1", 120_000), 12_000)+ assertEquals(listOf("seek"), seek.map { it.type })+ assertEquals("forward", seek[0].reason)+ assertTrue(seek[0].playedMs in 2_000..4_000)+ }++ @Test fun stoppingOrSwitchingPlayerEndsWithStop() {+ val t = PlaybackTracker()+ t.observe(snap("1", 10_000), 0)+ val e = t.observe(null, 1_000)+ assertEquals(listOf("end"), e.map { it.type })+ assertEquals("stop", e[0].reason)+ t.observe(snap("1", 10_000), 5_000)+ val sw = t.observe(snap("3", 0, source = PlaybackEvent.SPOTIFY), 6_000)+ assertEquals(listOf("end", "start"), sw.map { it.type })+ assertEquals("stop", sw[0].reason)+ assertEquals(PlaybackEvent.SPOTIFY, sw[1].source)+ }++ @Test fun theLastSongOfTheQueueEndsOnceAndAReplayIsANewStart() {+ val t = PlaybackTracker()+ t.observe(snap("1", 197_000), 0)+ val e = t.observe(snap("1", 200_000, playing = false), 3_000)+ assertEquals(listOf("end"), e.map { it.type })+ assertEquals("finished", e[0].reason)+ assertEquals(emptyList<String>(), t.observe(snap("1", 200_000, playing = false), 4_000).map { it.type })+ assertEquals(emptyList<String>(), t.observe(null, 5_000).map { it.type })+ assertEquals(listOf("start"), t.observe(snap("2", 0), 6_000).map { it.type })+ }++ @Test fun repeatOneIsAnEndAndANewStart() {+ val t = PlaybackTracker()+ t.observe(snap("1", 197_000), 0)+ val e = t.observe(snap("1", 1_000), 4_000)+ assertEquals(listOf("end", "start"), e.map { it.type })+ assertEquals("finished", e[0].reason)+ }+}diff --git a/base/app/src/test/java/com/music/spotui/lossless/LosslessMatchTest.kt b/base/app/src/test/java/com/music/spotui/lossless/LosslessMatchTest.ktdeleted file mode 100644index 0a650464..00000000--- a/base/app/src/test/java/com/music/spotui/lossless/LosslessMatchTest.kt+++ /dev/null@@ -1,134 +0,0 @@-package com.music.spotui.lossless--import org.junit.Assert.assertEquals-import org.junit.Assert.assertFalse-import org.junit.Assert.assertTrue-import org.junit.Assert.assertNull-import org.junit.Test--private fun hit(id: String, title: String, artist: String, duration: Int, isrc: String = "") =- LosslessSource.TidalHit(id, title, artist, duration, isrc)--/** The exact-recording rules: ISRC first, otherwise nothing but the same song wins. */-class LosslessMatchTest {-- @Test- fun picksByExactIsrc() {- val hits = listOf(hit("1", "Wrong", "A", 300, "GBXXX2400001"))- assertEquals("1", LosslessSource.pickHit(hits, "GBXXX2400001", "Real Title", "Artist", 200)?.id)- }-- @Test- fun withoutIsrcPicksSameTitleArtistDuration() {- val hits = listOf(- hit("1", "Real Title", "Artist", 201), // within 3 s- hit("2", "Real Title (Live)", "Artist", 200), // live take never wins- hit("3", "Real Title", "Someone", 200),- )- assertEquals("1", LosslessSource.pickHit(hits, "", "Real Title", "Artist", 200)?.id)- }-- @Test- fun rejectsRemixCoverAndOffDuration() {- val hits = listOf(- hit("1", "Real Title - Remix", "Artist", 200),- hit("2", "Other Song", "Artist", 200),- hit("3", "Real Title", "Artist", 310), // 110 s off- )- assertNull(LosslessSource.pickHit(hits, "", "Real Title", "Artist", 200))- }-- @Test- fun isrcBeatsTitleOnlyWhenSameRecording() {- val hits = listOf(- hit("1", "Real Title", "Artist", 200, "GBUM71705174"),- hit("2", "Real Title", "Artist", 200, "USUM71712345"),- )- // The track's own ISRC decides which of the same-named candidates wins.- assertEquals("1", LosslessSource.pickHit(hits, "GBUM71705174", "Real Title", "Artist", 200)?.id)- }-- @Test- fun aVersionKeptApartByTidalIsPutBackInTheTitle() {- assertEquals("Song (2011 Remaster)", LosslessSource.fullTitle("Song", "2011 Remaster"))- // Already part of the title: not written twice.- assertEquals("Song (Slowed)", LosslessSource.fullTitle("Song (Slowed)", "Slowed"))- assertEquals("Song", LosslessSource.fullTitle("Song", ""))- val hits = listOf(hit("1", LosslessSource.fullTitle("Song", "2011 Remaster"), "Artist", 200))- assertEquals("1", LosslessSource.pickHit(hits, "", "Song - 2011 Remaster", "Artist", 200)?.id)- }-- @Test- fun remasterSpellingsAndSlowedSuffixesMatch() {- val hits = listOf(- hit("1", "Song (Remastered 2011)", "Artist", 200),- hit("2", "Song (Slowed + Reverb)", "Artist", 250),- )- assertEquals("1", LosslessSource.pickHit(hits, "", "Song - 2011 Remaster", "Artist", 200)?.id)- assertEquals("2", LosslessSource.pickHit(hits, "", "Song - Slowed + Reverb", "Artist", 250)?.id)- // The plain song is not its slowed version, nor the reverse.- assertNull(LosslessSource.pickHit(hits.take(1), "", "Song - Slowed + Reverb", "Artist", 200))- assertNull(LosslessSource.pickHit(hits.drop(1), "", "Song", "Artist", 250))- }-- @Test- fun spotifyListsEveryArtistTidalNamesOne() {- val hits = listOf(hit("1", "Real Title", "Artist", 200))- assertEquals("1", LosslessSource.pickHit(hits, "", "Real Title", "Artist, Guest", 200)?.id)- val credited = listOf(LosslessSource.TidalHit("2", "Real Title", "Other", 200, "", listOf("Other", "Guest")))- assertEquals("2", LosslessSource.pickHit(credited, "", "Real Title", "Artist, Guest", 200)?.id)- assertNull(LosslessSource.pickHit(hits, "", "Real Title", "Someone, Guest", 200))- }-- @Test- fun theSearchAsksForOneArtistThenTheBareTitle() {- assertEquals(listOf("Song - Slowed A", "Song A"), LosslessSource.searchQueries("Song - Slowed", "A, B"))- assertEquals(listOf("Song A"), LosslessSource.searchQueries("Song", "A"))- }-}--/** The FLAC STREAMINFO read that rejects 30 s previews handed out by backends. */-class FlacDurationTest {-- private fun fakeFlac(sampleRate: Int = 44_100, samples: Long = sampleRate * 200L): ByteArray {- val head = ByteArray(42)- "fLaC".toByteArray().copyInto(head)- // STREAMINFO fields a real FLAC carries, packed as the parser expects:- // 20 bits sample rate | 3 channels | 5 bits/sample | 36-bit total samples.- val packed = (sampleRate.toLong() and 0xFFFFF) shl 44 or- (2L shl 41) or // stereo- (16L shl 36) or ((samples and 0xFFFFFFFFL))- for (i in 0 until 8) head[18 + i] = (packed ushr (56 - 8 * i)).toByte()- return head- }-- @Test- fun readsTheDuration() {- val head = fakeFlac(44_100, 44_100L * 210)- assertEquals(210, LosslessSource.flacDurationSec(head))- }-- @Test- fun notFlacOrTooShortIsNull() {- assertNull(LosslessSource.flacDurationSec(ByteArray(42)))- assertNull(LosslessSource.flacDurationSec(ByteArray(20)))- }-- @Test- fun aTitleMatchIsNotAnIsrcMatch() {- assertTrue(LosslessSource.isrcMatches("usum71703861", "USUM71703861"))- // Same song name, another recording (live, remaster): its own ISRC.- assertFalse(LosslessSource.isrcMatches("GBUM71703999", "USUM71703861"))- // Spotify gave no ISRC: nothing can match it.- assertFalse(LosslessSource.isrcMatches("USUM71703861", ""))- }-- @Test- fun readsTheOneFileOfAnAacManifest() {- fun b64(s: String) = java.util.Base64.getEncoder().encodeToString(s.toByteArray())- assertEquals("https://cdn/x.mp4", LosslessSource.aacManifestUrl(b64("""{"mimeType":"audio/mp4","codecs":"mp4a.40.5","urls":["https://cdn/x.mp4"]}""")))- // A FLAC or a DASH manifest is not the small AAC file.- assertNull(LosslessSource.aacManifestUrl(b64("""{"mimeType":"audio/flac","urls":["https://cdn/x.flac"]}""")))- assertNull(LosslessSource.aacManifestUrl(b64("<MPD></MPD>")))- }-}diff --git a/base/app/src/test/java/com/music/spotui/lossless/ZarzSignatureTest.kt b/base/app/src/test/java/com/music/spotui/lossless/ZarzSignatureTest.ktdeleted file mode 100644index 8c1b3419..00000000--- a/base/app/src/test/java/com/music/spotui/lossless/ZarzSignatureTest.kt+++ /dev/null@@ -1,28 +0,0 @@-package com.music.spotui.lossless--import org.junit.Assert.assertEquals-import org.junit.Test--/** ZARZ-HMAC-V1, checked against an independent implementation of the same protocol. */-class ZarzSignatureTest {- @Test fun signsLikeTheExtensionRuntime() {- val h = ZarzSession.signHeaders(- sessionId = "sess_123", secret = "s3cr3t", appVersion = "[email protected]",- method = "POST", path = "/v2/dl/tid", body = """{"id":"1"}""".toByteArray(),- nowMs = 1_760_000_000_123, nonce = "abcdef012345",- )- assertEquals("2025-10-09T08:53:20.123Z", h["X-Zarz-Timestamp"])- assertEquals("5811967f540d300d249ab30ae681359a7815fdb5d3dc71a94be1d491006a6b27", h["X-Zarz-Body-SHA256"])- assertEquals("8EVagVFjx3zbtgAmLx-ZDgxj579Dc4nuoYlfYaOlJNw", h["X-Zarz-Signature"])- assertEquals("[email protected]", h["X-Zarz-App-Version"])- assertEquals("extension", h["X-Zarz-Platform"])- }-- @Test fun readsTheGrantWhereverTheReturnLinkPutsIt() {- assertEquals("g1" to "s1", ZarzSession.parseGrant("spotiflac://session-grant?cb_version=v2grant&state=s1&grant=g1"))- assertEquals("g2" to "s2", ZarzSession.parseGrant("spotiflac://session-grant?state=s2#grant=g2"))- assertEquals("g3" to "s3", ZarzSession.parseGrant("spotiflac://session-grant?code=g3&state=s3"))- assertEquals("g%4" to "s4", ZarzSession.parseGrant("spotiflac://session-grant?grant=g%254&state=s4"))- assertEquals(null, ZarzSession.parseGrant("spotiflac://session-grant?state=s5"))- }-}diff --git a/base/extensions-cli/build.gradle.kts b/base/extensions-cli/build.gradle.ktsnew file mode 100644index 00000000..dd5516f3--- /dev/null+++ b/base/extensions-cli/build.gradle.kts@@ -0,0 +1,24 @@+// `myspoti-ext`: build, check and try Myspoti extensions on a computer. With --cdp it also+// reaches a real Spotify account through a desktop Chrome (:host-cdp), which :extensions itself+// never depends on.+// ./gradlew :extensions-cli:run --args="run path/to/extension lyrics ..."+plugins {+ alias(libs.plugins.kotlin.jvm)+ application+}++kotlin {+ jvmToolchain(17)+}++application {+ mainClass.set("app.myspoti.extensions.cli.RunKt")+ applicationName = "myspoti-ext"+}++dependencies {+ implementation(project(":extensions"))+ implementation(project(":host-cdp"))+ implementation(libs.serialization.json)+ implementation(libs.coroutines.core)+}diff --git a/base/extensions-cli/src/main/kotlin/app/myspoti/extensions/cli/Run.kt b/base/extensions-cli/src/main/kotlin/app/myspoti/extensions/cli/Run.ktnew file mode 100644index 00000000..7d71e123--- /dev/null+++ b/base/extensions-cli/src/main/kotlin/app/myspoti/extensions/cli/Run.kt@@ -0,0 +1,369 @@+package app.myspoti.extensions.cli++import app.myspoti.extensions.AudioQuery+import app.myspoti.extensions.AudioStream+import app.myspoti.extensions.Blocks+import app.myspoti.extensions.PageContent+import app.myspoti.extensions.Surface+import app.myspoti.extensions.Catalog+import app.myspoti.extensions.ExtensionException+import app.myspoti.extensions.ExtensionPackage+import app.myspoti.extensions.ExtensionRuntime+import app.myspoti.extensions.ExtensionStatus+import app.myspoti.extensions.Hook+import app.myspoti.extensions.Host+import app.myspoti.extensions.LyricsResult+import app.myspoti.extensions.Manifest+import app.myspoti.extensions.MemoryStorage+import app.myspoti.extensions.SpotifyCall+import app.myspoti.extensions.SpotifyDispatcher+import app.myspoti.extensions.SpotifyRaw+import app.myspoti.extensions.DownloadFile+import app.myspoti.extensions.DownloadQuery+import app.myspoti.extensions.PlaybackEvent+import app.myspoti.extensions.Storage+import app.myspoti.extensions.TrackInfo+import app.myspoti.host.cdp.CdpHost+import app.myspoti.spotify.SpotifyApi+import app.myspoti.spotify.gql.isMutation+import kotlinx.coroutines.CoroutineScope+import kotlinx.coroutines.Dispatchers+import kotlinx.coroutines.SupervisorJob+import kotlinx.coroutines.cancel+import kotlinx.coroutines.runBlocking+import kotlinx.coroutines.withContext+import kotlinx.coroutines.withTimeout+import kotlinx.serialization.json.JsonElement+import kotlinx.serialization.json.JsonObject+import java.io.File+import kotlin.system.exitProcess++private const val USAGE = """myspoti-ext: build and try Myspoti extensions on a computer.++ check <folder> the manifest's problems, whether the script loads, the actions the+ user is asked (icon, level, why), and the blocks each drawn hook answers+ run <folder|zip> <hook> [options] calls a hook as the app would, prints what it answered+ --title T --artist A [--album B] [--duration MS] [--id SPOTIFY_ID] [--isrc ISRC]+ --set key=value a setting's value (repeatable)+ --cdp PORT|URL myspoti.spotify works on the account signed in to the Web Player+ of a Chrome started with --remote-debugging-port=PORT; a change+ that removes something (delete, remove, unfollow, clear) asks+ yes or no on this terminal first+ --quality hi-res|cd|small download-source only: the quality asked (default cd)+ --ahead true audio-source only: asked before the song plays (ahead: true)+ run <folder|zip> track [options] delivers the "track" event (same options, and --origin, --provider)+ run <folder|zip> playback [options] delivers a play of the song: start, a progress every 10 s,+ [--played MS] [--leave skip|end|stop] [--context URI] [--shuffle true] [--source local|spotify]+ [--origin spotify|download|audio-source|local-file] [--provider EXTENSION_ID]+ pack <folder> [out-folder] builds <id>-<version>.zip and prints its index entry+ index <folder-of-zips> <name> writes index.json for a repository of packages++Hooks: lyrics, audio-source, download-source, trackinfo, home, search (--query Q), menu (--kind track|album|+playlist|artist), player, page, message (--data JSON), tap (--action ID), status (live or not, within 5 s). Everything the manifest asks is granted here. Without --cdp,+myspoti.spotify has no account and its calls fail."""++fun main(args: Array<String>) {+ if (args.isEmpty()) { println(USAGE); return }+ try {+ when (args[0]) {+ "check" -> check(File(args.getOrElse(1) { usage() }))+ "run" -> run(File(args.getOrElse(1) { usage() }), args.getOrElse(2) { usage() }, args.drop(3))+ "pack" -> pack(File(args.getOrElse(1) { usage() }), args.getOrNull(2)?.let(::File))+ "index" -> index(File(args.getOrElse(1) { usage() }), args.getOrElse(2) { usage() })+ else -> usage()+ }+ } catch (e: ExtensionException) {+ System.err.println("✗ ${e.message}")+ exitProcess(1)+ }+}++private fun usage(): Nothing { println(USAGE); exitProcess(2) }++private class DesktopHost(+ private val settings: Map<String, String>,+ private val track: TrackInfo?,+ private val spotify: SpotifyDispatcher? = null,+) : Host {+ private val store = MemoryStorage()+ override suspend fun spotify(extensionId: String, call: SpotifyCall): String =+ spotify?.execute(call) ?: super.spotify(extensionId, call)+ override fun spotifyMutation(name: String): Boolean = spotify?.isMutation(name) ?: true+ override suspend fun confirm(extensionId: String, text: String): Boolean = withContext(Dispatchers.IO) {+ System.err.println("[$extensionId] $text")+ System.err.print("Allow it? [y/N] ")+ System.err.flush()+ readlnOrNull()?.trim()?.lowercase() in setOf("y", "yes")+ }+ override fun log(extensionId: String, message: String) = System.err.println("[$extensionId] $message")+ override fun storage(extensionId: String): Storage = store+ override fun setting(extensionId: String, key: String): String? = settings[key]?.let { v ->+ if (v == "true" || v == "false" || v.toDoubleOrNull() != null) v else kotlinx.serialization.json.JsonPrimitive(v).toString()+ }+ override fun nowPlaying(): String? = track?.toJson()+ override fun control(extensionId: String, action: String, argument: Long?): Boolean { System.err.println("player: $action ${argument ?: ""}"); return true }+}++/** The Web Player of a Chrome on [cdp] (a port, or its http address), as a Spotify account for extensions. */+private class Account(cdp: String) : AutoCloseable {+ private val scope = CoroutineScope(SupervisorJob() + Dispatchers.Default)+ private val host: CdpHost+ val dispatcher: SpotifyDispatcher++ init {+ val url = if (cdp.all { it.isDigit() }) "http://localhost:$cdp" else cdp+ val api: SpotifyApi+ val chrome = runBlocking {+ val h = CdpHost.connect(url)+ api = SpotifyApi(h, scope)+ h.reload()+ h.awaitLoad()+ api.onPageLoaded()+ withTimeout(60_000) { api.awaitReady() }+ if (!api.isSignedIn()) throw ExtensionException("the Web Player in that Chrome is not signed in")+ h+ }+ host = chrome+ dispatcher = SpotifyDispatcher(api, ApiRaw(api))+ }++ override fun close() { host.close(); scope.cancel() }+}++private class ApiRaw(private val api: SpotifyApi) : SpotifyRaw {+ override suspend fun gql(operation: String, variables: JsonObject): JsonElement = api.raw.gql(operation, variables)+ override fun operations(): Set<String> = api.raw.operations+ override suspend fun service(service: String, method: String, args: List<JsonElement>): JsonElement = api.raw.service(service, method, *args.toTypedArray())+ override suspend fun get(url: String): JsonElement? = api.raw.get(url)+ override fun isMutation(operation: String): Boolean = isMutation(operation)+ override suspend fun request(method: String, url: String, body: ByteArray?, headers: Map<String, String>): JsonElement =+ api.raw.request(method, url, body, headers).let { app.myspoti.extensions.RawRequest.response(it.status, it.headers, it.body) }+}++private fun load(path: File): Pair<Manifest, String> = if (path.isDirectory) {+ val m = Manifest.parse(File(path, "manifest.json").readText())+ m to File(path, m.main).readText()+} else ExtensionPackage.read(path.readBytes()).let { it.manifest to it.script }++private fun check(dir: File) {+ val (m, script) = load(dir)+ val problems = m.problems()+ problems.forEach { println("✗ $it") }+ if (m.isLegacy) println("! old format (provides + permissions): it still installs, mapped to actions; write \"actions\" instead (docs/extensions/API.md §2)")+ val granted = m.asks().map { it.key }.toSet()+ ExtensionRuntime(m, script, DesktopHost(emptyMap(), null), granted).use { rt ->+ rt.start()+ println("✓ script loads")+ println("The user is asked (icon, action, level — why):")+ m.asks().forEach { a ->+ val act = a.action+ println(" ${if (a.critical) "⚠" else "•"} [${act?.icon ?: "?"}] ${a.key} (${act?.label ?: "unknown"}, ${a.level.name.lowercase()})" ++ (if (a.hosts.isNotEmpty()) " ${a.hosts}" else "") + " — ${a.why.ifBlank { "(no reason given)" }}")+ }+ // Each drawn hook it provides, asked once with sample input: its blocks must parse.+ val sample = TrackInfo("4uLU6hMCjMI75M1A2tKUQC", "spotify:track:4uLU6hMCjMI75M1A2tKUQC", "Sample", "Artist", listOf("Artist"), "Album", 200_000)+ val asked = listOf(+ Triple(Hook.HOME, Surface.HOME, "{}"),+ Triple(Hook.SEARCH, Surface.SEARCH, """{"query":"sample"}"""),+ Triple(Hook.MENU, Surface.TRACK_MENU, """{"kind":"track","uri":"${sample.uri}","title":"Sample","subtitle":"Artist"}"""),+ Triple(Hook.PLAYER, Surface.PLAYER, sample.toJson()),+ Triple(Hook.TRACK_INFO, Surface.TRACK_INFO, sample.toJson()),+ )+ var bad = false+ asked.filter { rt.provides(it.first) }.forEach { (hook, surface, input) ->+ val out = runCatching { rt.call(hook, input, 5_000) }.getOrElse { println("✗ $hook: ${it.message}"); bad = true; return@forEach }+ if (out == null) println(" $hook: no blocks for the sample") else runCatching { Blocks.parse(out, surface) }+ .onSuccess { println("✓ ${hook.key}: ${it.size} block(s) (${it.joinToString { b -> b.javaClass.simpleName }})") }+ .onFailure { println("✗ ${hook.key}: ${it.message}"); bad = true }+ }+ if (rt.provides(Hook.PAGE)) runCatching { rt.call(Hook.PAGE, "{}", 5_000)?.let { PageContent.parse(it, m.name) } }+ .onSuccess { println(if (it == null) " page: no page" else "✓ page \"${it.title}\": ${it.html.length} characters of HTML") }+ .onFailure { println("✗ page: ${it.message}"); bad = true }+ ExtensionStatus.probe(rt, 5_000).let { s ->+ println(when (s.state) {+ "live" -> "✓ status: live${s.detail?.let { " ($it)" } ?: ""}"+ "inactive" -> "! status: inactive (${s.detail ?: "no detail"})"+ else -> "! status: no answer (${s.detail ?: "no detail"}): the app keeps using it"+ })+ }+ if (bad && problems.isEmpty()) exitProcess(1)+ }+ m.categoryWarning()?.let { println("! $it") }+ println("In the store: ${m.category().key}${if (m.category == null) " (set \"category\" to choose)" else ""}" ++ (m.minAppVersion?.let { ", Myspoti $it or newer" } ?: "") + (if (m.tags.isNotEmpty()) ", tags ${m.tags}" else ""))+ if (problems.isNotEmpty()) exitProcess(1)+}++private fun run(path: File, hookName: String, rest: List<String>) {+ val (m, script) = load(path)+ val opts = HashMap<String, String>()+ val settings = HashMap<String, String>()+ var i = 0+ while (i < rest.size) {+ val k = rest[i].removePrefix("--")+ val v = rest.getOrElse(i + 1) { usage() }+ if (k == "set") settings[v.substringBefore('=')] = v.substringAfter('=') else opts[k] = v+ i += 2+ }+ val artist = opts["artist"] ?: ""+ val track = TrackInfo(+ id = opts["id"] ?: "", uri = opts["id"]?.let { "spotify:track:$it" } ?: "", title = opts["title"] ?: usage(),+ artist = artist.substringBefore(",").trim(), artists = artist.split(",").map { it.trim() }.filter { it.isNotEmpty() },+ album = opts["album"] ?: "", durationMs = opts["duration"]?.toLongOrNull() ?: 0, isrc = opts["isrc"],+ )+ val account = opts["cdp"]?.let { Account(it) }+ ExtensionRuntime(m, script, DesktopHost(settings, track, account?.dispatcher), m.asks().map { it.key }.toSet()).use { rt ->+ account.use { runScript(rt, m, hookName, track, opts) }+ }+}++private fun runScript(rt: ExtensionRuntime, m: Manifest, hookName: String, track: TrackInfo, opts: Map<String, String> = emptyMap()) {+ rt.start()+ if (hookName == ExtensionRuntime.EVENT_TRACK) {+ rt.emit(hookName, PlaybackEvent.trackEventJson(track, opts["origin"] ?: PlaybackEvent.ORIGIN_SPOTIFY, opts["provider"]))+ println("✓ delivered"); return+ }+ if (hookName == ExtensionRuntime.EVENT_PLAYBACK) { playback(rt, track, opts); return }+ val hook = Hook.of(hookName) ?: usage()+ if (!rt.provides(hook)) throw ExtensionException("this extension does not provide $hookName (or its action is not in the manifest)")+ val started = System.currentTimeMillis()+ val input = when (hook) {+ Hook.DOWNLOAD_SOURCE -> DownloadQuery.toJson(track, opts["quality"] ?: "cd")+ Hook.AUDIO_SOURCE -> AudioQuery.toJson(track, opts["ahead"] == "true")+ Hook.SEARCH -> kotlinx.serialization.json.buildJsonObject { put("query", kotlinx.serialization.json.JsonPrimitive(opts["query"] ?: track.title)) }.toString()+ Hook.MENU -> kotlinx.serialization.json.buildJsonObject {+ put("kind", kotlinx.serialization.json.JsonPrimitive(opts["kind"] ?: "track"))+ put("uri", kotlinx.serialization.json.JsonPrimitive(track.uri)); put("title", kotlinx.serialization.json.JsonPrimitive(track.title))+ put("subtitle", kotlinx.serialization.json.JsonPrimitive(track.artist))+ }.toString()+ Hook.HOME, Hook.PAGE, Hook.STATUS -> "{}"+ Hook.MESSAGE -> opts["data"] ?: "null"+ Hook.TAP -> kotlinx.serialization.json.buildJsonObject {+ put("action", kotlinx.serialization.json.JsonPrimitive(opts["action"] ?: usage())); put("surface", kotlinx.serialization.json.JsonPrimitive("home"))+ put("context", kotlinx.serialization.json.JsonObject(emptyMap()))+ }.toString()+ else -> track.toJson()+ }+ if (hook == Hook.STATUS) {+ // As the app asks it: only live: false is inactive; a failure or a late answer proves nothing.+ val s = ExtensionStatus.probe(rt, 5_000)+ val ms = System.currentTimeMillis() - started+ println(when (s.state) {+ "live" -> "✓ live${s.detail?.let { ": $it" } ?: ""} ($ms ms)"+ "inactive" -> "— inactive: ${s.detail ?: "no detail"} ($ms ms): the app skips it for songs' audio and downloads"+ else -> "— no answer: ${s.detail ?: "no detail"} ($ms ms): the app keeps using it"+ })+ return+ }+ val out = rt.call(hook, input, when (hook) { Hook.LYRICS -> 8_000; Hook.DOWNLOAD_SOURCE -> 30_000; else -> 15_000 })+ val ms = System.currentTimeMillis() - started+ if (out == null) { println("— no answer ($ms ms): the app goes on without this extension"); return }+ val surface = when (hook) {+ Hook.HOME -> Surface.HOME; Hook.SEARCH -> Surface.SEARCH; Hook.PLAYER -> Surface.PLAYER; Hook.TRACK_INFO -> Surface.TRACK_INFO+ Hook.MENU -> when (opts["kind"]) { "album" -> Surface.ALBUM_MENU; "playlist" -> Surface.PLAYLIST_MENU; "artist" -> Surface.ARTIST_MENU; else -> Surface.TRACK_MENU }+ else -> null+ }+ if (surface != null) {+ val blocks = Blocks.parse(out, surface)+ println("✓ ${blocks.size} block(s) for ${surface.key} ($ms ms)")+ blocks.forEach { println(" $it") }+ return+ }+ when (hook) {+ Hook.LYRICS -> LyricsResult.parse(out, m.name).let { l ->+ if (l == null) println("— empty lyrics ($ms ms)")+ else {+ println("✓ ${l.lines.size} lines from ${l.provider}, synced=${l.synced}, word by word=${l.wordSynced} ($ms ms)")+ l.lines.take(8).forEach { println(" [${it.startMs}] ${it.text}") }+ }+ }+ Hook.AUDIO_SOURCE -> AudioStream.parse(out).let { a ->+ if (a == null) println("— no audio ($ms ms)") else println(+ "✓ ${a.url.ifEmpty { "manifest (${a.manifest?.length} chars)" }}\n headers=${a.headers} type=${a.mimeType} duration=${a.durationMs}" ++ " expiresInMs=${a.expiresInMs ?: "-"} quality=${a.qualityLabel() ?: "-"} ($ms ms)",+ )+ }+ Hook.DOWNLOAD_SOURCE -> DownloadFile.parseList(out).let { files ->+ if (files.isEmpty()) println("— no file ($ms ms)")+ else {+ println("✓ ${files.size} file(s), best first ($ms ms)")+ files.forEach { f ->+ println(" ${f.format} ${f.bitDepth ?: "-"}-bit ${f.sampleRate ?: "-"} Hz ${f.provider ?: ""} isrcMatched=${f.isrcMatched} size=${f.sizeHint ?: "-"}")+ println(" ${f.url ?: "manifest (${f.manifest!!.length} chars)"}${if (f.headers.isNotEmpty()) " headers=${f.headers}" else ""}")+ }+ }+ }+ Hook.PAGE -> PageContent.parse(out, m.name).let { println("✓ page \"${it.title}\" ($ms ms)\n${it.html.take(2_000)}") }+ else -> println("✓ $out ($ms ms)")+ }+}++/**+ * Plays [track] for `--played` ms (default 40000) as the app reports it: start, a progress+ * every 10 s, then `--leave skip|end|stop` (default skip), one event a step, each delivered+ * at once with the timestamp it would have had.+ */+private fun playback(rt: ExtensionRuntime, track: TrackInfo, opts: Map<String, String>) {+ val played = opts["played"]?.toLongOrNull() ?: 40_000L+ val duration = track.durationMs.takeIf { it > 0 } ?: 200_000L+ val leave = opts["leave"] ?: "skip"+ val t0 = System.currentTimeMillis() - played+ val context = opts["context"] ?: ""+ val source = opts["source"] ?: PlaybackEvent.LOCAL+ fun ev(type: String, at: Long, reason: String? = null) = PlaybackEvent(+ type, track.copy(durationMs = duration), positionMs = at, durationMs = duration, timestamp = t0 + at, source = source,+ contextUri = context, shuffle = opts["shuffle"] == "true", reason = reason, playedMs = at,+ origin = opts["origin"] ?: PlaybackEvent.ORIGIN_SPOTIFY, providerId = opts["provider"],+ )+ val events = buildList {+ add(ev("start", 0, "play"))+ var p = 10_000L+ while (p <= played) { add(ev("progress", p)); p += 10_000 }+ when (leave) {+ "end" -> add(ev("end", duration, "finished"))+ "stop" -> add(ev("end", played, "stop"))+ else -> add(ev("skip", played, "forward"))+ }+ }+ events.forEach { e ->+ rt.emit(ExtensionRuntime.EVENT_PLAYBACK, e.toJson(), 15_000)+ println("✓ ${e.type}${e.reason?.let { " ($it)" } ?: ""} at ${e.positionMs} ms")+ }+}++private fun pack(dir: File, outDir: File?) {+ check(dir)+ val bytes = ExtensionPackage.pack(dir)+ val p = ExtensionPackage.read(bytes)+ val out = File(outDir ?: dir.parentFile ?: File("."), "${p.manifest.id}-${p.manifest.version}.zip")+ out.parentFile.mkdirs()+ out.writeBytes(bytes)+ println("✓ ${out.path} (${bytes.size} bytes)\nsha256 ${p.sha256}\n\nIndex entry:")+ println(Catalog.encodeEntry(entry(p, out.name, bytes.size.toLong())))+}++private fun index(dir: File, name: String) {+ val zips = dir.listFiles { f -> f.name.endsWith(".zip") }.orEmpty().sortedBy { it.name }+ // The newest version of each extension.+ val old = File(dir, "index.json").takeIf { it.isFile }?.let { runCatching { Catalog.parse(it.readText()) }.getOrNull() }+ val entries = zips.map { f -> ExtensionPackage.read(f.readBytes()).let { p -> p to entry(p, f.name, f.length()) } }+ .groupBy { it.second.id }.values.map { v -> v.maxBy { it.second.versionCode } }+ .map { (p, e) ->+ // The icon next to the packages, so the store shows it before download; the date the+ // package was first listed is kept while its bytes stay the same.+ val icon = p.icon?.let { bytes -> File(dir, "icons/${e.id}.png").also { it.parentFile.mkdirs(); it.writeBytes(bytes) }; "icons/${e.id}.png" }+ val listed = old?.extensions?.firstOrNull { it.id == e.id && it.sha256 == e.sha256 }?.updatedAt+ e.copy(iconUrl = icon, updatedAt = listed ?: e.updatedAt)+ }.sortedBy { it.name.lowercase() }+ File(dir, "index.json").writeText(Catalog.encode(Catalog(name = name, extensions = entries, blocked = old?.blocked.orEmpty())) + "\n")+ println("✓ ${File(dir, "index.json").path}: ${entries.size} extensions${if (old?.blocked?.isNotEmpty() == true) ", ${old.blocked.size} blocked kept" else ""}")+}++private fun entry(p: ExtensionPackage, url: String, size: Long) = with(p.manifest) {+ Catalog.Entry(+ id, name, version, versionCode, apiVersion, author, description, actions = actions, provides = provides, permissions = permissions,+ url = url, sha256 = p.sha256, size = size, homepage = homepage,+ updatedAt = java.time.LocalDate.now(java.time.ZoneOffset.UTC).toString(), category = category, tags = tags,+ minAppVersion = minAppVersion, changelog = changelog, replaces = replaces, conflictsWith = conflictsWith,+ )+}diff --git a/base/extensions/build.gradle.kts b/base/extensions/build.gradle.ktsnew file mode 100644index 00000000..103983c3--- /dev/null+++ b/base/extensions/build.gradle.kts@@ -0,0 +1,20 @@+// Myspoti extensions: the sandbox third-party scripts run in, their manifest, permissions,+// packages and catalogue. Plain JVM, so an extension runs on a desktop exactly as on the phone+// (the runner is :extensions-cli). It depends on the :api contract only, never on Spotify's+// implementation: a host gives it a MyspotiApi (SpotifyDispatcher) and, if it wants, the raw door.+plugins {+ alias(libs.plugins.kotlin.jvm)+ alias(libs.plugins.kotlin.serialization)+}++kotlin {+ jvmToolchain(17)+}++dependencies {+ api(project(":api"))+ // The same Rhino NewPipeExtractor brings to the app: no second JavaScript engine.+ implementation("org.mozilla:rhino:1.8.1")+ implementation(libs.serialization.json)+ testImplementation("junit:junit:4.13.2")+}diff --git a/base/extensions/src/main/kotlin/app/myspoti/extensions/Actions.kt b/base/extensions/src/main/kotlin/app/myspoti/extensions/Actions.ktnew file mode 100644index 00000000..22c3022b--- /dev/null+++ b/base/extensions/src/main/kotlin/app/myspoti/extensions/Actions.kt@@ -0,0 +1,218 @@+package app.myspoti.extensions++import kotlinx.serialization.Serializable++/**+ * How much an action can cost the user. A critical one is shown in the warning colour, the user+ * ticks "I accept the risk" before it is granted, and the app frames it at run time (destructive+ * Spotify writes are confirmed one by one, the app keeps the last word).+ */+enum class Level { NORMAL, CRITICAL }++/**+ * Where an action acts in the app: the Installed tab is organised by area, each one opening with+ * what Myspoti does there by itself ("Built-in"), then the extensions acting there, in the order+ * the user set ([Registry.priority] is kept per area).+ */+enum class Area(val key: String) {+ PLAYBACK("playback"),+ LYRICS("lyrics"),+ AUDIO("audio"),+ HOME("home"),+ MENUS("menus"),+ LIBRARY("library"),+ /** Free pages, and the extensions that only support others (network, storage, messages). */+ OTHER("other");++ companion object {+ fun of(key: String) = entries.firstOrNull { it.key == key }+ }+}++/**+ * What an extension can do, as the user sees it: a closed catalogue defined by the app. Each one+ * has a fixed Material icon ([icon], the name of `Icons.Rounded.<icon>`), a short [label], a+ * [level] and the API it unlocks ([api]). An extension lists the ones it needs in its manifest,+ * each with a `why` of 80 characters at most, read by the user before installing.+ *+ * [takeover]: the extension exists for it (it provides something the app draws or asks). The+ * others are reach. An installed extension is granted every action it lists, either kind.+ * [area]: null for the support actions, which never place an extension on the Installed tab.+ */+enum class Action(+ val key: String,+ val level: Level,+ val area: Area?,+ val icon: String,+ val label: String,+ val api: String,+ val takeover: Boolean = false,+) {+ PLAYBACK_CONTROL("playback.control", Level.NORMAL, Area.PLAYBACK, "PlayCircle", "Control playback",+ "myspoti.player.play/pause/next/previous/seek; spotify.player play, pause, resume, seek, next, previous, shuffle, repeat, volume, speed, skipTo; spotify.devices transfer, pullHere"),+ PLAYBACK_QUEUE("playback.queue", Level.NORMAL, Area.PLAYBACK, "QueueMusic", "Edit the queue",+ "spotify.player addToQueue, playNext, moveInQueue, removeFromQueue, clearQueue (removals confirmed)"),+ PLAYBACK_EVENTS("playback.events", Level.NORMAL, Area.PLAYBACK, "GraphicEq", "Know what you play",+ "myspoti.player.current(); myspoti.on('track' | 'playback'); spotify.player state, queue, volume"),+ LYRICS_PROVIDE("lyrics.provide", Level.NORMAL, Area.LYRICS, "Lyrics", "Provide lyrics",+ "myspoti.provide('lyrics', fn(track) → lyrics)", takeover = true),+ TRACKINFO_PROVIDE("trackinfo.provide", Level.NORMAL, Area.LYRICS, "Info", "Add song details",+ "myspoti.provide('trackinfo', fn(track) → blocks), shown in the song's credits sheet", takeover = true),+ AUDIO_SOURCE("audio.source", Level.CRITICAL, Area.AUDIO, "Headphones", "Play audio from elsewhere",+ "myspoti.provide('audio-source', fn(track) → { url })", takeover = true),+ DOWNLOAD_SOURCE("download.source", Level.CRITICAL, Area.AUDIO, "Download", "Provide downloads",+ "myspoti.provide('download-source', fn(query) → files)", takeover = true),+ HOME_SECTIONS("home.sections", Level.NORMAL, Area.HOME, "Dashboard", "Add home sections",+ "myspoti.provide('home', fn() → sections of blocks)", takeover = true),+ SEARCH_PROVIDE("search.provide", Level.NORMAL, Area.HOME, "ManageSearch", "Add search results",+ "myspoti.provide('search', fn({ query }) → blocks)", takeover = true),+ MENU_ITEMS("menu.items", Level.NORMAL, Area.MENUS, "MoreHoriz", "Add menu entries",+ "myspoti.provide('menu', fn({ kind, uri, title }) → menu blocks) in the ⋯ menus of songs, albums, playlists, artists", takeover = true),+ PLAYER_BUTTONS("player.buttons", Level.NORMAL, Area.MENUS, "SmartButton", "Add player buttons",+ "myspoti.provide('player', fn(track) → button blocks), under the player's own controls", takeover = true),+ SETTINGS_PAGE("settings.page", Level.NORMAL, null, "Tune", "Its own settings",+ "manifest \"settings\"; myspoti.settings.get(key)", takeover = true),+ NOTIFY("notify", Level.NORMAL, null, "Notifications", "Show short messages",+ "myspoti.notify(text)"),+ LIBRARY_READ("library.read", Level.NORMAL, Area.LIBRARY, "LibraryMusic", "Read your library",+ "spotify.library, playlists (yours), users, recents, devices.list, podcasts.savedEpisodes, blends (reads), search.recent, home.whatsNew"),+ LIBRARY_WRITE("library.write", Level.CRITICAL, Area.LIBRARY, "LibraryAdd", "Change your library",+ "spotify.library add/remove/pin/folders; users follow/unfollow/private session; extras taste and bans; episodes saved; search.clearRecent (removals confirmed)"),+ PLAYLISTS_WRITE("playlists.write", Level.CRITICAL, Area.LIBRARY, "PlaylistAdd", "Edit your playlists",+ "spotify.playlists create/rename/describe/cover/access/collaborate/follow/add/move/remove/delete; spotify.blends invite/join/rename/leave (removals confirmed)"),+ SPOTIFY_CATALOG("spotify.catalog", Level.NORMAL, Area.LIBRARY, "Album", "Browse Spotify",+ "spotify.search, catalog, playlists (public), home, podcasts, extras (lyrics, canvas, credits, radio)"),+ SPOTIFY_RAW("spotify.raw", Level.CRITICAL, Area.LIBRARY, "Code", "Full Spotify access",+ "spotify.raw gql/service/get/request: anything the account can do (changes confirmed)"),+ NETWORK("network", Level.NORMAL, null, "Public", "Use the internet",+ "myspoti.http to the hosts listed (\"*\": any host, critical)"),+ WEBVIEW_PAGE("webview.page", Level.CRITICAL, Area.OTHER, "Web", "Its own web page",+ "myspoti.provide('page', fn() → { title, html }) in a sandboxed WebView; myspoti.provide('message', fn(data) → reply)", takeover = true),+ WEBVIEW_AUTH("webview.auth", Level.CRITICAL, Area.OTHER, "Key", "Sign in on a website",+ "myspoti.auth.open({ url, callback }) → myspoti.on('auth'): a full web view with its own cookies, apart from the app's; only the callback address comes back"),+ STORAGE("storage", Level.NORMAL, null, "Save", "Keep its own data",+ "myspoti.storage get/set/remove (512 KB)");++ companion object {+ fun of(key: String) = entries.firstOrNull { it.key == key }++ /** The key the user grants for "network to any host": critical, apart from listed hosts. */+ const val NETWORK_ANY = "network.any"++ /** The actions whose answer is drawn by the app as native blocks. */+ val BLOCKS: Set<Action> = setOf(TRACKINFO_PROVIDE, HOME_SECTIONS, SEARCH_PROVIDE, MENU_ITEMS, PLAYER_BUTTONS)++ /** At most this many characters in a `why`. */+ const val WHY_MAX = 80++ // ── The old manifests (provides + permissions, before actions) ──++ /** An old hook key or permission key → the actions it stands for now. */+ val LEGACY: Map<String, List<Action>> = mapOf(+ "lyrics" to listOf(LYRICS_PROVIDE),+ "audio-source" to listOf(AUDIO_SOURCE),+ "download-source" to listOf(DOWNLOAD_SOURCE),+ "network" to listOf(NETWORK),+ "notify" to listOf(NOTIFY),+ "player.read" to listOf(PLAYBACK_EVENTS),+ "player.control" to listOf(PLAYBACK_CONTROL),+ "spotify.catalog" to listOf(SPOTIFY_CATALOG),+ "spotify.library.read" to listOf(LIBRARY_READ, PLAYBACK_EVENTS),+ "spotify.write" to listOf(LIBRARY_WRITE, PLAYLISTS_WRITE, PLAYBACK_CONTROL, PLAYBACK_QUEUE),+ "spotify.raw" to listOf(SPOTIFY_RAW),+ )++ /**+ * The keys an extension installed before actions was granted, as action keys: each old+ * key becomes its actions; `network.any` and action keys stay; storage and the settings+ * page, which every old extension had, are added.+ */+ fun migrateGranted(granted: Set<String>): Set<String> {+ if (granted.none { it in LEGACY }) return granted+ return buildSet {+ granted.forEach { k -> LEGACY[k]?.forEach { add(it.key) } ?: add(k) }+ add(STORAGE.key)+ add(SETTINGS_PAGE.key)+ }+ }+ }+}++/** One action as a manifest asks it: `{ "name": "lyrics.provide", "why": "…" }`. */+@Serializable+data class ActionRequest(+ /** An [Action] key. */+ val name: String,+ /** Why the extension needs it, 1 to 80 characters, shown next to its icon. */+ val why: String = "",+ /** network only: the hosts it may call ("api.example.com", "*.example.com", or "*"). */+ val hosts: List<String> = emptyList(),+ /**+ * spotify.raw only: the `raw.request` writes it needs ("POST https://host/path"), shown before+ * install and allowed with it, so they never ask while music plays. 8 at most.+ */+ val writes: List<String> = emptyList(),+)++/**+ * The parts of the app no extension can hide, delay, cover, restyle or observe. No action targets+ * them, extension blocks and pages are drawn beneath them and suspended while one is on screen,+ * and no event about them is ever sent to an extension (see [SurfaceGuard]).+ */+enum class ProtectedSurface(val key: String) {+ /** The owner's donation reminder and the Support sheets (Ko-fi, GitHub Sponsors). */+ SUPPORT("support"),+ /** "New version" card. */+ UPDATE("update"),+ /** The install prompt, its warnings and the third-party notice. */+ INSTALL("install"),+ /** A critical action's confirmation (a destructive Spotify change, granting a critical action). */+ CONFIRM("confirm"),+ /** The Report button (beta logs) and what it opens. */+ REPORT("report"),+ /** About: version, credits, source code, legal. */+ ABOUT("about"),+}++/**+ * The places an extension's blocks or page are drawn. None of them is a [ProtectedSurface]+ * (a test checks the two never meet): an action can only reach these.+ */+enum class Surface(val key: String, val action: Action) {+ HOME("home", Action.HOME_SECTIONS),+ SEARCH("search", Action.SEARCH_PROVIDE),+ TRACK_MENU("menu.track", Action.MENU_ITEMS),+ ALBUM_MENU("menu.album", Action.MENU_ITEMS),+ PLAYLIST_MENU("menu.playlist", Action.MENU_ITEMS),+ ARTIST_MENU("menu.artist", Action.MENU_ITEMS),+ PLAYER("player", Action.PLAYER_BUTTONS),+ TRACK_INFO("trackinfo", Action.TRACKINFO_PROVIDE),+ PAGE("page", Action.WEBVIEW_PAGE),+}++/**+ * Which protected surfaces are on screen now. While any is, extension blocks and pages are not+ * asked or drawn ([ExtensionRuntime.call] answers nothing for a block hook, taps and page messages+ * are dropped) and the app hides their views. The app reports each protected surface as it shows+ * and goes; nothing about them is forwarded to an extension.+ */+class SurfaceGuard {+ private val showing = java.util.concurrent.ConcurrentHashMap<ProtectedSurface, Int>()+ private val _state = kotlinx.coroutines.flow.MutableStateFlow<Set<ProtectedSurface>>(emptySet())+ val state: kotlinx.coroutines.flow.StateFlow<Set<ProtectedSurface>> get() = _state++ fun shown(s: ProtectedSurface) { showing.merge(s, 1) { a, b -> a + b }; _state.value = showing.keys.toSet() }++ fun hidden(s: ProtectedSurface) {+ showing.computeIfPresent(s) { _, n -> if (n <= 1) null else n - 1 }+ _state.value = showing.keys.toSet()+ }++ /** True while a protected surface is on screen: extension UI waits. */+ val suspended: Boolean get() = showing.isNotEmpty()++ companion object {+ /** The app's own guard. */+ val app = SurfaceGuard()+ }+}diff --git a/base/extensions/src/main/kotlin/app/myspoti/extensions/Blocks.kt b/base/extensions/src/main/kotlin/app/myspoti/extensions/Blocks.ktnew file mode 100644index 00000000..43663008--- /dev/null+++ b/base/extensions/src/main/kotlin/app/myspoti/extensions/Blocks.kt@@ -0,0 +1,211 @@+package app.myspoti.extensions++import kotlinx.serialization.json.JsonArray+import kotlinx.serialization.json.JsonElement+import kotlinx.serialization.json.JsonObject+import kotlinx.serialization.json.JsonPrimitive+import kotlinx.serialization.json.contentOrNull+import kotlinx.serialization.json.doubleOrNull++/**+ * What an extension adds to the app's screens, described as JSON and drawn by the app itself:+ * the app's fonts, colours, spacing and icons, never the extension's. The only free page is+ * [Action.WEBVIEW_PAGE]. See docs/extensions/API.md §6 for the schema.+ *+ * A block opens a Spotify page ([Target.open], a `spotify:` uri the app opens itself) or calls the+ * extension back ([Target.action], delivered to its `tap` hook). Nothing else: no style, no+ * position, no layer; a block cannot reach a [ProtectedSurface].+ */+sealed interface Block {+ /** A titled group of blocks (Home; elsewhere its blocks are shown under its title). */+ data class Section(val title: String, val subtitle: String?, val blocks: List<Block>) : Block++ data class Card(val title: String, val subtitle: String?, val image: String?, val target: Target?) : Block++ /** A list of Spotify items of one [kind], drawn as the app draws its own lists. */+ data class Items(val kind: ItemKind, val title: String?, val items: List<Item>) : Block++ data class Button(val label: String, val icon: String, val action: String) : Block++ /** An entry of a ⋯ menu. */+ data class MenuEntry(val label: String, val icon: String, val action: String) : Block++ data class Text(val text: String, val style: TextStyle) : Block++ data class Image(val url: String, val ratio: Float, val target: Target?) : Block+}++enum class ItemKind(val key: String, val uriType: String) {+ TRACKS("tracks", "track"), ALBUMS("albums", "album"), PLAYLISTS("playlists", "playlist"), ARTISTS("artists", "artist");+}++enum class TextStyle { TITLE, BODY, CAPTION }++data class Item(val uri: String, val title: String, val subtitle: String?, val image: String?)++/** Where a tap goes: a Spotify page the app opens, or the extension's `tap` hook with [action]. */+data class Target(val open: String?, val action: String?)++object Blocks {+ /** The icons a block may name; anything else is drawn as [DEFAULT_ICON]. The app maps each to its own. */+ val ICONS = listOf(+ "add", "album", "artist", "bolt", "bookmark", "chart", "check", "download", "edit", "extension", "favorite", "headphones",+ "info", "language", "link", "lyrics", "mic", "music", "open", "play", "playlist", "queue", "radio", "refresh",+ "repeat", "search", "settings", "share", "shuffle", "star", "timer", "translate", "tune", "volume",+ )+ const val DEFAULT_ICON = "extension"++ const val MAX_TOP = 10+ const val MAX_IN_SECTION = 12+ const val MAX_ITEMS = 50+ const val MAX_MENU = 4+ const val MAX_BUTTONS = 3+ private const val LABEL = 40+ private const val TITLE = 80+ private const val TEXT = 1_000++ private val ACTION_ID = Regex("^[A-Za-z0-9_.:-]{1,64}$")+ private val SPOTIFY_URI = Regex("^spotify:(track|album|playlist|artist|show|episode):[A-Za-z0-9]{1,40}$")++ /** The block types a [Surface] accepts. */+ fun allowed(surface: Surface): Set<String> = when (surface) {+ Surface.HOME, Surface.SEARCH, Surface.TRACK_INFO -> setOf("section", "card", "tracks", "albums", "playlists", "artists", "button", "text", "image")+ Surface.TRACK_MENU, Surface.ALBUM_MENU, Surface.PLAYLIST_MENU, Surface.ARTIST_MENU -> setOf("menu")+ Surface.PLAYER -> setOf("button")+ Surface.PAGE -> emptySet()+ }++ /**+ * An extension's answer for [surface]: a list of blocks (or one block). Home's loose blocks+ * are gathered in one untitled section. A block of an unknown type is left out (a newer+ * extension on an older app); one that breaks the rules fails the whole answer.+ */+ fun parse(json: String, surface: Surface): List<Block> {+ val root = runCatching { ExtJson.parseToJsonElement(json) }.getOrNull() ?: throw ExtensionException("blocks: not JSON")+ val list = when (root) {+ is JsonArray -> root+ is JsonObject -> (root["blocks"] as? JsonArray) ?: JsonArray(listOf(root))+ else -> throw ExtensionException("blocks: a list of blocks")+ }+ val max = when (surface) {+ Surface.TRACK_MENU, Surface.ALBUM_MENU, Surface.PLAYLIST_MENU, Surface.ARTIST_MENU -> MAX_MENU+ Surface.PLAYER -> MAX_BUTTONS+ else -> MAX_TOP+ }+ if (list.size > max) throw ExtensionException("blocks: $max at most here (${surface.key}), ${list.size} given")+ val out = list.mapNotNull { block(it, allowed(surface), top = true) }+ if (surface != Surface.HOME) return out+ // Home is a list of sections: loose blocks go together under no title.+ val loose = out.filterNot { it is Block.Section }+ return out.filterIsInstance<Block.Section>() + if (loose.isEmpty()) emptyList() else listOf(Block.Section("", null, loose))+ }++ private fun block(e: JsonElement, allowed: Set<String>, top: Boolean): Block? {+ val o = e as? JsonObject ?: throw ExtensionException("blocks: each block is an object { type, … }")+ val type = str(o, "type") ?: throw ExtensionException("blocks: a block without its \"type\"")+ if (type !in ALL) return null+ if (type !in allowed) throw ExtensionException("blocks: \"$type\" is not allowed here (${allowed.joinToString().ifEmpty { "nothing" }})")+ return when (type) {+ "section" -> {+ if (!top) throw ExtensionException("blocks: a section cannot hold another section")+ val inner = o["blocks"] as? JsonArray ?: throw ExtensionException("blocks: a section needs \"blocks\"")+ if (inner.size > MAX_IN_SECTION) throw ExtensionException("blocks: $MAX_IN_SECTION blocks at most in a section")+ Block.Section(text(o, "title", TITLE).orEmpty(), text(o, "subtitle", TITLE), inner.mapNotNull { block(it, allowed - "section", top = false) })+ }+ "card" -> Block.Card(need(o, "title", TITLE, type), text(o, "subtitle", TITLE), image(o, "image"), target(o, type))+ "tracks", "albums", "playlists", "artists" -> {+ val kind = ItemKind.entries.first { it.key == type }+ val raw = o["items"] as? JsonArray ?: throw ExtensionException("blocks: \"$type\" needs \"items\"")+ if (raw.size > MAX_ITEMS) throw ExtensionException("blocks: $MAX_ITEMS items at most")+ Block.Items(kind, text(o, "title", TITLE), raw.map { item(it, kind) })+ }+ "button" -> Block.Button(need(o, "label", LABEL, type), icon(o), action(o, type) ?: throw ExtensionException("blocks: a button needs its \"action\""))+ "menu" -> Block.MenuEntry(need(o, "label", LABEL, type), icon(o), action(o, type) ?: throw ExtensionException("blocks: a menu entry needs its \"action\""))+ "text" -> Block.Text(need(o, "text", TEXT, type), when (str(o, "style")) { "title" -> TextStyle.TITLE; "caption" -> TextStyle.CAPTION; else -> TextStyle.BODY })+ "image" -> Block.Image(image(o, "url") ?: throw ExtensionException("blocks: an image needs its \"url\""),+ ((o["ratio"] as? JsonPrimitive)?.doubleOrNull?.toFloat() ?: 1.78f).coerceIn(0.5f, 3f), target(o, type))+ else -> null+ }+ }++ private val ALL = setOf("section", "card", "tracks", "albums", "playlists", "artists", "button", "menu", "text", "image")++ private fun item(e: JsonElement, kind: ItemKind): Item {+ val o = e as? JsonObject ?: throw ExtensionException("blocks: each item is an object { uri, title }")+ val uri = str(o, "uri") ?: throw ExtensionException("blocks: an item needs its \"uri\"")+ if (!SPOTIFY_URI.matches(uri) || uri.split(':')[1] != kind.uriType) throw ExtensionException("blocks: \"$uri\" is not a spotify:${kind.uriType}: uri")+ return Item(uri, need(o, "title", TITLE, "item"), text(o, "subtitle", TITLE), image(o, "image"))+ }++ private fun target(o: JsonObject, type: String): Target? {+ val open = str(o, "open")?.also { if (!SPOTIFY_URI.matches(it)) throw ExtensionException("blocks: \"open\" is a spotify: uri of a song, album, playlist, artist, show or episode") }+ val action = action(o, type)+ if (open != null && action != null) throw ExtensionException("blocks: \"$type\" has \"open\" or \"action\", not both")+ return if (open == null && action == null) null else Target(open, action)+ }++ private fun action(o: JsonObject, type: String): String? = str(o, "action")?.also {+ if (!ACTION_ID.matches(it)) throw ExtensionException("blocks: $type action \"$it\": 1 to 64 letters, digits, _ . : -")+ }++ private fun icon(o: JsonObject): String = str(o, "icon")?.takeIf { it in ICONS } ?: DEFAULT_ICON++ /** An https image on a public host. */+ private fun image(o: JsonObject, key: String): String? = str(o, key)?.also {+ if (!it.startsWith("https://")) throw ExtensionException("blocks: $key must be https")+ checkUrl("blocks", it)+ }++ private fun need(o: JsonObject, key: String, max: Int, type: String): String =+ text(o, key, max)?.takeIf { it.isNotBlank() } ?: throw ExtensionException("blocks: \"$type\" needs \"$key\"")++ private fun text(o: JsonObject, key: String, max: Int): String? = str(o, key)?.trim()?.take(max)++ private fun str(o: JsonObject, key: String): String? = (o[key] as? JsonPrimitive)?.takeIf { it.isString }?.contentOrNull+}++/** What a page hook answers: a title and the HTML the app shows in its sandboxed WebView. */+data class PageContent(val title: String, val html: String) {+ companion object {+ const val MAX_HTML = 512 * 1024++ fun parse(json: String, fallbackTitle: String): PageContent {+ val o = runCatching { ExtJson.parseToJsonElement(json) as JsonObject }.getOrNull() ?: throw ExtensionException("page: an object { title, html }")+ val html = (o["html"] as? JsonPrimitive)?.contentOrNull ?: throw ExtensionException("page: \"html\" is needed")+ if (html.length > MAX_HTML) throw ExtensionException("page: html over ${MAX_HTML / 1024} KB")+ val title = (o["title"] as? JsonPrimitive)?.contentOrNull?.trim()?.take(40)?.ifBlank { null } ?: fallbackTitle+ return PageContent(title, html)+ }+ }+}++/**+ * What an extension's web page ([Action.WEBVIEW_PAGE]) may load: GET over https from the hosts+ * its network action lists (any host only when `network.any` is granted), never a local address+ * nor a Spotify one (the app's own WebView is signed in there). The app fetches what is allowed+ * itself, without cookies, and refuses the rest; [csp] is put at the top of the page as well.+ */+object PageNetwork {+ fun allows(url: String, method: String, listed: List<String>, networkGranted: Boolean, anyGranted: Boolean): Boolean {+ val uri = runCatching { java.net.URI(url) }.getOrNull() ?: return false+ val host = uri.host?.lowercase() ?: return false+ if (uri.scheme != "https" || !method.equals("GET", ignoreCase = true)) return false+ if (ExtensionRuntime.isPrivate(host) || RawRequest.isSpotifyHost(host)) return false+ return (anyGranted && "*" in listed) || (networkGranted && listed.any { it != "*" && ExtensionRuntime.hostMatches(it, host) })+ }++ /** No navigation, no frames, no forms; scripts and styles of the page itself; loads only from the hosts allowed. */+ fun csp(listed: List<String>, networkGranted: Boolean, anyGranted: Boolean): String {+ val hosts = when {+ anyGranted && "*" in listed -> "https:"+ networkGranted -> listed.filter { it != "*" && !RawRequest.isSpotifyHost(it.removePrefix("*.")) }.joinToString(" ") { "https://$it" }+ else -> ""+ }+ return "default-src 'none'; script-src 'unsafe-inline'; style-src 'unsafe-inline'; img-src data: $hosts; media-src data: $hosts; " ++ "font-src data: $hosts; connect-src $hosts; frame-src 'none'; form-action 'none'; base-uri 'none'"+ }++ /** [html] with the [csp] first, so it applies before anything of the page. */+ fun wrap(html: String, csp: String): String =+ "<meta http-equiv=\"Content-Security-Policy\" content=\"${csp.replace("\"", "")}\">\n$html"+}diff --git a/base/extensions/src/main/kotlin/app/myspoti/extensions/Catalog.kt b/base/extensions/src/main/kotlin/app/myspoti/extensions/Catalog.ktnew file mode 100644index 00000000..706911c2--- /dev/null+++ b/base/extensions/src/main/kotlin/app/myspoti/extensions/Catalog.kt@@ -0,0 +1,105 @@+package app.myspoti.extensions++import kotlinx.serialization.SerialName+import kotlinx.serialization.Serializable++/**+ * A repository's `index.json`: the extensions it offers, and the ones it asks every Myspoti to+ * turn off. The official repository is reviewed (each extension is added by a pull request);+ * another one is added by the user, at their own risk.+ *+ * An entry's store fields (`icon_url`, `updated_at`, `category`, `tags`, `min_app_version`,+ * `changelog`) are optional: an index without them is read as before, and an older Myspoti+ * ignores them. Relative addresses (`url`, `icon_url`) are resolved against the index's own.+ */+@Serializable+data class Catalog(+ val format: Int = 1,+ val name: String,+ val extensions: List<Entry> = emptyList(),+ val blocked: List<Block> = emptyList(),+) {+ @Serializable+ data class Entry(+ val id: String,+ val name: String,+ val version: String,+ val versionCode: Int,+ val apiVersion: Int = API_VERSION,+ val author: String,+ val description: String = "",+ /** The manifest's actions, so the store shows their icons and the risk before downloading. */+ val actions: List<ActionRequest> = emptyList(),+ /** Old format, still read: the manifest's hooks. */+ val provides: List<String> = emptyList(),+ /** Old format, still read: the manifest's permissions. */+ val permissions: List<PermissionRequest> = emptyList(),+ /** The package, absolute or relative to the index. */+ val url: String,+ /** Of the package's bytes: checked before anything of it is read (empty: not known, GitHub discovery). */+ val sha256: String,+ val size: Long = 0,+ /** The older name of [iconUrl], still read. */+ val icon: String? = null,+ val homepage: String? = null,+ /** The icon shown in the store before download: a PNG, absolute or relative to the index. */+ @SerialName("icon_url") val iconUrl: String? = null,+ /** When this version was listed, ISO 8601 (`2026-10-23` or a full timestamp). */+ @SerialName("updated_at") val updatedAt: String? = null,+ /** A [Category] key; absent, derived from [actions]. */+ val category: String? = null,+ val tags: List<String> = emptyList(),+ /** The oldest Myspoti this version works on: see [Manifest.minAppVersion]. */+ @SerialName("min_app_version") val minAppVersion: String? = null,+ /** What changed in this version. */+ val changelog: String = "",+ /** The manifest's `replaces` and `conflictsWith`, so the store warns before download. */+ val replaces: List<String> = emptyList(),+ @SerialName("conflicts_with") val conflictsWith: List<String> = emptyList(),+ /**+ * `owner/name` on GitHub: installed from there ([GitHubRepo]: the release's package, else+ * the archive), kept on the phone, and updated from there. The index's [sha256], when+ * given (not empty), is checked against the package.+ */+ val repo: String? = null,+ ) {+ /** The manifest the entry describes, for the risk shown before download. */+ fun preview() = Manifest(+ id, name, version, versionCode, apiVersion, author, description, homepage, actions = actions, provides = provides, permissions = permissions,+ category = category, tags = tags, minAppVersion = minAppVersion, changelog = changelog,+ replaces = replaces, conflictsWith = conflictsWith,+ )++ /** The icon's address as written in the index ([iconUrl], else the older [icon]). */+ fun iconAddress(): String? = (iconUrl ?: icon)?.takeIf { it.isNotBlank() }++ fun category(): Category = Category.of(category, preview().actionSet())++ /** Whether this Myspoti ([appVersion]) can install it: its API and its minimum version. */+ fun compatible(appVersion: String): Boolean = apiVersion <= API_VERSION && AppVersion.atLeast(appVersion, minAppVersion)+ }++ /** An extension every Myspoti turns off: all of its versions, or the packages listed. */+ @Serializable+ data class Block(val id: String, val sha256: List<String> = emptyList(), val reason: String = "")++ /** Whether this repository asks to turn off [id] in the package [sha256]. */+ fun blocks(id: String, sha256: String?): Block? = blocked.firstOrNull { b -> b.id == id && (b.sha256.isEmpty() || sha256 in b.sha256) }++ companion object {+ fun parse(text: String): Catalog {+ val c = ExtJson.decodeFromString(serializer(), text)+ if (c.format != 1) throw ExtensionException("index format ${c.format}: this Myspoti reads format 1")+ return c+ }++ private val pretty = kotlinx.serialization.json.Json { prettyPrint = true; encodeDefaults = false; explicitNulls = false }++ fun encode(c: Catalog): String = pretty.encodeToString(serializer(), c)++ fun encodeEntry(e: Entry): String = pretty.encodeToString(Entry.serializer(), e)++ /** [url] of an entry, resolved against the index's own address. */+ fun resolve(indexUrl: String, url: String): String = java.net.URI(indexUrl).resolve(url).toString()+ }+}diff --git a/base/extensions/src/main/kotlin/app/myspoti/extensions/Conflicts.kt b/base/extensions/src/main/kotlin/app/myspoti/extensions/Conflicts.ktnew file mode 100644index 00000000..6530143e--- /dev/null+++ b/base/extensions/src/main/kotlin/app/myspoti/extensions/Conflicts.kt@@ -0,0 +1,209 @@+package app.myspoti.extensions++/**+ * How extensions doing the same thing live together.+ *+ * [Mode.ADDITIVE]: every extension's answer is used, merged and de-duplicated in the area's+ * priority order (lyrics: the best one; blocks: all, quotas per extension). [Mode.EXCLUSIVE]: one+ * active extension per action (the user picks; the others stay installed and idle).+ * [Mode.SHARED]: reach (network, storage…), nothing to share out.+ */+enum class Mode { ADDITIVE, EXCLUSIVE, SHARED }++val Action.mode: Mode+ get() = when (this) {+ Action.AUDIO_SOURCE, Action.DOWNLOAD_SOURCE -> Mode.EXCLUSIVE+ Action.LYRICS_PROVIDE, Action.TRACKINFO_PROVIDE, Action.HOME_SECTIONS, Action.SEARCH_PROVIDE,+ Action.MENU_ITEMS, Action.PLAYER_BUTTONS -> Mode.ADDITIVE+ else -> Mode.SHARED+ }++/** What installing or turning on an extension would collide with, so the user picks. */+data class Clash(val kind: Kind, val otherId: String, val action: Action? = null) {+ enum class Kind {+ /** It provides an exclusive action [otherId] provides now: "replaces X currently provided by Y". */+ EXCLUSIVE,+ /** One of the two lists the other in `conflictsWith`: "incompatible with X (installed)". */+ CONFLICT,+ /** It lists [otherId] in `replaces`. */+ REPLACES,+ }+}++object Conflicts {+ /** The one extension (of [providers], in priority order) acting for an exclusive action: the user's [chosen], else the first. */+ fun activeFor(providers: List<String>, chosen: String?): String? = chosen?.takeIf { it in providers } ?: providers.firstOrNull()++ /**+ * What [m] collides with among [installed] (the enabled extensions, in priority order, with+ * their manifests; [m]'s own id is skipped). [active]: the user's choice per exclusive action key.+ */+ fun clashes(m: Manifest, installed: List<Manifest>, active: Map<String, String>): List<Clash> {+ val others = installed.filter { it.id != m.id }+ val out = LinkedHashMap<String, Clash>()+ m.actionSet().filter { it.mode == Mode.EXCLUSIVE }.forEach { a ->+ activeFor(others.filter { a in it.actionSet() }.map { it.id }, active[a.key])+ ?.let { out["x:${a.key}"] = Clash(Clash.Kind.EXCLUSIVE, it, a) }+ }+ others.forEach { o ->+ when {+ o.id in m.replaces -> out["r:${o.id}"] = Clash(Clash.Kind.REPLACES, o.id)+ o.id in m.conflictsWith || m.id in o.conflictsWith -> out["c:${o.id}"] = Clash(Clash.Kind.CONFLICT, o.id)+ }+ }+ return out.values.toList()+ }++ /**+ * Additive blocks of several extensions (in priority order) for one place: an item, card or+ * entry already given by a higher one is dropped (same uri, or same label), then each+ * extension keeps [Quotas.perExtension] of its blocks on screen, and the place [Quotas.total];+ * what is left goes to [Shown.overflow] (the "Extensions ⋯" entry), except on Home, where it is+ * dropped. Never mixes two extensions' blocks: each block stays with its owner.+ */+ fun <K> merge(perExtension: List<Pair<K, List<Block>>>, surface: Surface): Shown<K> {+ val seenUris = HashSet<String>()+ val seenLabels = HashSet<String>()+ val shown = ArrayList<Pair<K, Block>>()+ val overflow = ArrayList<Pair<K, Block>>()+ val total = Quotas.total(surface)+ val each = Quotas.perExtension(surface)+ perExtension.forEach { (owner, blocks) ->+ var mine = 0+ dedupe(blocks, seenUris, seenLabels).forEach { b ->+ if (mine < each && shown.size < total) { shown += owner to b; mine++ } else if (Quotas.overflows(surface)) overflow += owner to b+ }+ }+ return Shown(shown, overflow)+ }++ data class Shown<K>(val shown: List<Pair<K, Block>>, val overflow: List<Pair<K, Block>>)++ private fun dedupe(blocks: List<Block>, uris: MutableSet<String>, labels: MutableSet<String>): List<Block> = blocks.mapNotNull { b ->+ when (b) {+ is Block.Items -> b.copy(items = b.items.filter { uris.add(it.uri) }).takeIf { it.items.isNotEmpty() }+ is Block.Card -> b.takeIf { c -> c.target?.open?.let(uris::add) ?: true }+ is Block.MenuEntry -> b.takeIf { labels.add("m:" + it.label.lowercase()) }+ is Block.Button -> b.takeIf { labels.add("b:" + it.label.lowercase()) }+ is Block.Section -> b.copy(blocks = dedupe(b.blocks, uris, labels)).takeIf { it.blocks.isNotEmpty() }+ else -> b+ }+ }+}++/** How much of a place one extension, and all of them, may take. */+object Quotas {+ fun perExtension(surface: Surface): Int = when (surface) {+ Surface.TRACK_MENU, Surface.ALBUM_MENU, Surface.PLAYLIST_MENU, Surface.ARTIST_MENU -> 2+ Surface.PLAYER -> 1+ Surface.HOME -> 2+ Surface.SEARCH, Surface.TRACK_INFO -> 4+ Surface.PAGE -> 0+ }++ fun total(surface: Surface): Int = when (surface) {+ Surface.TRACK_MENU, Surface.ALBUM_MENU, Surface.PLAYLIST_MENU, Surface.ARTIST_MENU -> 4+ Surface.PLAYER -> 3+ Surface.HOME -> 6+ Surface.SEARCH, Surface.TRACK_INFO -> 8+ Surface.PAGE -> 0+ }++ /** Menus and the player gather the rest under "Extensions ⋯"; other places drop it. */+ fun overflows(surface: Surface): Boolean = surface == Surface.PLAYER || surface.action == Action.MENU_ITEMS+}++/**+ * Every playback command an extension sends goes through here before the player.+ *+ * - Two extensions' commands of the same group (play/pause, next/previous/skip, seek, shuffle/repeat)+ * within [windowMs]: the higher priority one wins (a lower one arriving after it is dropped; a+ * higher one arriving after a lower one runs and overrides it).+ * - The same two extensions contradicting each other [loopCount] times within [loopMs] (A skips,+ * B goes back, again and again): the lower priority one is suspended ([Verdict.suspend]); the app+ * says so with a button to turn it off.+ * - At most [perMinute] commands per extension a minute.+ *+ * [priority]: an extension's rank in the Playback area (0 is first).+ */+class PlaybackArbiter(+ private val priority: (String) -> Int,+ private val clock: () -> Long = System::currentTimeMillis,+ private val windowMs: Long = 2_000,+ private val loopMs: Long = 30_000,+ private val loopCount: Int = 3,+ private val perMinute: Int = 20,+) {+ data class Verdict(val allowed: Boolean, val reason: String? = null, val winner: String? = null, val suspend: String? = null)++ private data class Sent(val id: String, val group: String, val at: Long)++ private val recent = ArrayDeque<Sent>()+ private val counts = HashMap<String, ArrayDeque<Long>>()+ private val clashes = HashMap<Pair<String, String>, ArrayDeque<Long>>()+ private val suspended = HashSet<String>()++ fun isSuspended(id: String) = synchronized(this) { id in suspended }++ /** Lets [id] send commands again (turned back on by the user). */+ fun resume(id: String) = synchronized(this) { suspended -= id; clashes.keys.removeAll { id in it.toList() } }++ @Synchronized+ fun submit(id: String, command: String): Verdict {+ val now = clock()+ if (id in suspended) return Verdict(false, "suspended")+ val times = counts.getOrPut(id) { ArrayDeque() }+ while (times.isNotEmpty() && now - times.first() > 60_000) times.removeFirst()+ if (times.size >= perMinute) return Verdict(false, "rate")+ times.addLast(now)+ while (recent.isNotEmpty() && now - recent.first().at > windowMs) recent.removeFirst()+ val group = groupOf(command)+ val rival = recent.lastOrNull { it.id != id && it.group == group }+ var verdict = Verdict(true)+ if (rival != null) {+ val pair = if (id < rival.id) id to rival.id else rival.id to id+ val log = clashes.getOrPut(pair) { ArrayDeque() }+ while (log.isNotEmpty() && now - log.first() > loopMs) log.removeFirst()+ log.addLast(now)+ val mineFirst = priority(id) < priority(rival.id) || (priority(id) == priority(rival.id) && id < rival.id)+ val lower = if (mineFirst) rival.id else id+ verdict = if (mineFirst) Verdict(true, "overrides", winner = id) else Verdict(false, "overridden", winner = rival.id)+ if (log.size >= loopCount) {+ suspended += lower+ log.clear()+ verdict = verdict.copy(suspend = lower)+ }+ }+ if (verdict.allowed) recent.addLast(Sent(id, group, now))+ return verdict+ }++ companion object {+ /** The commands that are arbitrated, and the group each one competes in. */+ fun groupOf(command: String): String = when (command) {+ "play", "pause", "resume" -> "transport"+ "next", "previous", "skipTo", "playContext" -> "track"+ "seek" -> "position"+ "setShuffle", "setRepeat", "shuffle", "repeat" -> "mode"+ else -> command+ }+ }+}++/** "Who did what", per area, for the Installed tab: the last [max] things extensions did. */+class ActivityLog(private val max: Int = 200, private val clock: () -> Long = System::currentTimeMillis) {+ data class Entry(val at: Long, val area: Area, val extensionId: String, val text: String)++ private val entries = ArrayDeque<Entry>()+ private val _state = kotlinx.coroutines.flow.MutableStateFlow<List<Entry>>(emptyList())+ val state: kotlinx.coroutines.flow.StateFlow<List<Entry>> get() = _state++ @Synchronized fun add(area: Area, extensionId: String, text: String) {+ entries.addLast(Entry(clock(), area, extensionId, text.take(120)))+ while (entries.size > max) entries.removeFirst()+ _state.value = entries.toList()+ }++ /** The newest first. */+ @Synchronized fun forArea(area: Area, limit: Int = 5): List<Entry> = entries.filter { it.area == area }.takeLast(limit).asReversed()+}diff --git a/base/extensions/src/main/kotlin/app/myspoti/extensions/Discovery.kt b/base/extensions/src/main/kotlin/app/myspoti/extensions/Discovery.ktnew file mode 100644index 00000000..015ee520--- /dev/null+++ b/base/extensions/src/main/kotlin/app/myspoti/extensions/Discovery.kt@@ -0,0 +1,250 @@+package app.myspoti.extensions++import kotlinx.serialization.SerialName+import kotlinx.serialization.Serializable++/**+ * The store's discovery on GitHub: every public repository with the topic [TOPIC] is offered,+ * along with the repositories' indexes. One search call per store visit, cached 6 hours (the+ * API allows 10 searches a minute without an account); the manifests and packages then come+ * from raw.githubusercontent.com and codeload.github.com, which have no such limit.+ */+object Discovery {+ const val TOPIC = "myspoti-extension"++ /** The label of the issue in an author's repository whose 👍 and 👎 are the extension's rating. */+ const val RATINGS_LABEL = "myspoti-ratings"++ /** The pseudo-address the discovered extensions are listed under in the store. */+ const val SOURCE = "github:topic/$TOPIC"++ const val CACHE_MS = 6 * 3600 * 1000L++ /** Up to 100 repositories with the topic, the most recently pushed first. */+ const val SEARCH_URL = "https://api.github.com/search/repositories?q=topic:$TOPIC+fork:true+archived:false&sort=updated&order=desc&per_page=100"++ /** Every open ratings issue (one search for all the store, filtered to the discovered repositories' owners). */+ const val RATINGS_URL = "https://api.github.com/search/issues?q=label:$RATINGS_LABEL+is:issue+is:open&per_page=100"++ /** The newest release of [repo], for its packages' download counts (the store page only). */+ fun releaseUrl(repo: String) = "https://api.github.com/repos/$repo/releases/latest"++ @Serializable+ data class Owner(val login: String)++ /** A repository as the search answers it (the fields the store uses). */+ @Serializable+ data class Found(+ @SerialName("full_name") val fullName: String,+ val owner: Owner,+ val description: String? = null,+ @SerialName("html_url") val htmlUrl: String = "",+ @SerialName("default_branch") val defaultBranch: String = GitHubRepo.HEAD,+ @SerialName("pushed_at") val pushedAt: String? = null,+ @SerialName("updated_at") val updatedAt: String? = null,+ @SerialName("stargazers_count") val stars: Int = 0,+ val archived: Boolean = false,+ val topics: List<String> = emptyList(),+ ) {+ val repo: GitHubRepo? get() = GitHubRepo.parse(fullName)++ /** Where its manifest is read, on the default branch. */+ fun manifestUrl(): String? = repo?.raw(defaultBranch, "manifest.json")+ }++ @Serializable+ private data class SearchAnswer(val items: List<Found> = emptyList())++ fun parseSearch(text: String): List<Found> = ExtJson.decodeFromString(SearchAnswer.serializer(), text).items.filter { !it.archived && it.repo != null }++ /**+ * The store entry of a discovered repository, from its [manifest]: installed from GitHub+ * ([Catalog.Entry.repo]), its package built when the user taps Install. No sha256: GitHub+ * builds the archive, the app keeps the hash of what it installed.+ */+ fun entry(found: Found, manifest: Manifest): Catalog.Entry {+ val repo = found.repo!!+ return Catalog.Entry(+ id = manifest.id, name = manifest.name, version = manifest.version, versionCode = manifest.versionCode,+ apiVersion = manifest.apiVersion, author = manifest.author, description = manifest.description.ifBlank { found.description.orEmpty() },+ actions = manifest.actions, provides = manifest.provides, permissions = manifest.permissions,+ url = repo.archive(found.defaultBranch, tag = false), sha256 = "",+ homepage = manifest.homepage ?: found.htmlUrl.ifBlank { repo.page },+ iconUrl = repo.raw(found.defaultBranch, manifest.icon ?: "icon.png"),+ updatedAt = found.pushedAt ?: found.updatedAt, category = manifest.category, tags = manifest.tags,+ minAppVersion = manifest.minAppVersion, changelog = manifest.changelog,+ replaces = manifest.replaces, conflictsWith = manifest.conflictsWith, repo = repo.slug,+ )+ }++ // ── Ratings ──++ @Serializable+ private data class Reactions(@SerialName("+1") val up: Int = 0, @SerialName("-1") val down: Int = 0)++ @Serializable+ private data class Issue(+ val number: Int,+ val user: Owner,+ @SerialName("repository_url") val repositoryUrl: String = "",+ val reactions: Reactions = Reactions(),+ )++ @Serializable+ private data class IssueAnswer(val items: List<Issue> = emptyList())++ /**+ * The ratings of [repos] (`owner/name`) from the ratings issues search: only an issue opened+ * by the repository's owner counts (anyone can open one elsewhere); the first one wins.+ */+ fun parseRatings(text: String, repos: Set<String>): Map<String, Rating> {+ val out = LinkedHashMap<String, Rating>()+ ExtJson.decodeFromString(IssueAnswer.serializer(), text).items.forEach { i ->+ val repo = i.repositoryUrl.substringAfter("/repos/", "").takeIf { it.count { c -> c == '/' } == 1 } ?: return@forEach+ if (repo !in repos || repo in out || !repo.substringBefore('/').equals(i.user.login, ignoreCase = true)) return@forEach+ out[repo] = Rating(i.reactions.up, i.reactions.down, i.number)+ }+ return out+ }++ @Serializable+ private data class Asset(val name: String = "", @SerialName("download_count") val downloads: Long = 0)++ @Serializable+ private data class Release(val assets: List<Asset> = emptyList())++ /** The downloads of the release's package ([GitHub.ASSET], else all its zips); null without one. */+ fun parseDownloads(text: String): Long? {+ val assets = ExtJson.decodeFromString(Release.serializer(), text).assets+ val pkg = assets.filter { it.name == GitHub.ASSET }.ifEmpty { assets.filter { it.name.endsWith(".zip") } }+ return if (pkg.isEmpty()) null else pkg.sumOf { it.downloads }+ }+}++/** 👍 and 👎 on an extension's ratings issue ([issue] in its repository). */+@Serializable+data class Rating(val up: Int = 0, val down: Int = 0, val issue: Int = 0) {+ val votes: Int get() = up + down+}++/**+ * The store's order and what it hides. Each extension's score is a Bayesian average of its+ * 👍 share: [PRIOR] votes at [PRIOR_MEAN] are added to its own, so three 👍 do not outrank a+ * hundred votes at 95 %. Then the most recently updated first.+ */+object Ranking {+ const val PRIOR_MEAN = 0.7+ const val PRIOR = 5.0++ /** Below this score, with at least [MIN_VOTES] votes, an extension is hidden behind "Show all". */+ const val LOW_SCORE = 0.4+ const val MIN_VOTES = 10++ /** Not updated for 18 months: hidden behind "Show all". */+ const val STALE_MS = 548L * 24 * 3600 * 1000++ fun score(r: Rating?): Double = ((r?.up ?: 0) + PRIOR_MEAN * PRIOR) / ((r?.votes ?: 0) + PRIOR)++ /** The score as 1 to 5 stars, to one decimal. */+ fun stars(r: Rating?): Double = Math.round((1 + 4 * score(r)) * 10) / 10.0++ enum class Hidden { BLOCKED, FLAGGED, LOW_SCORE, STALE }++ /** One store entry, ranked: [updatedMs] from its `updated_at` (0: unknown). */+ data class Ranked<T>(val item: T, val id: String, val sha256: String?, val rating: Rating?, val updatedMs: Long) {+ val score: Double get() = Ranking.score(rating)+ }++ /** Why [r] is hidden behind "Show all" ([now] in ms), or null when it is shown. */+ fun hidden(r: Ranked<*>, blocks: BlockList, now: Long): Hidden? = when {+ blocks.blocks(r.id, r.sha256) != null -> Hidden.BLOCKED+ blocks.flags(r.id) != null -> Hidden.FLAGGED+ (r.rating?.votes ?: 0) >= MIN_VOTES && r.score < LOW_SCORE -> Hidden.LOW_SCORE+ r.updatedMs > 0 && now - r.updatedMs > STALE_MS -> Hidden.STALE+ else -> null+ }++ /** [items] in the store's order: score, then the most recently updated. */+ fun <T> order(items: List<Ranked<T>>): List<Ranked<T>> =+ items.sortedWith(compareByDescending<Ranked<T>> { it.score }.thenByDescending { it.updatedMs })++ /** What the store lists: in order, without the hidden ones unless [showAll]. */+ fun <T> listed(items: List<Ranked<T>>, blocks: BlockList, now: Long, showAll: Boolean): List<Ranked<T>> =+ order(items).filter { showAll || hidden(it, blocks, now) == null }++ /** `2026-10-23` or `2026-10-23T10:00:00Z` in ms; 0 when it cannot be read. */+ fun time(iso: String?): Long {+ val s = iso?.trim().orEmpty()+ if (s.isEmpty()) return 0+ return runCatching { java.time.Instant.parse(s).toEpochMilli() }.recoverCatching {+ java.time.LocalDate.parse(s.take(10)).atStartOfDay(java.time.ZoneOffset.UTC).toInstant().toEpochMilli()+ }.getOrDefault(0)+ }+}++/**+ * Rating with 👍 / 👎 needs a GitHub account: the app signs in with GitHub's device flow (the+ * user types a short code on github.com, no password in the app) and reacts on the ratings+ * issue. The tokens of the Myspoti Extensions OAuth app expire (8 hours): a reaction answered+ * 401 simply runs the device flow again. While [GITHUB_CLIENT_ID] is empty the rate buttons+ * are hidden; reading the counts never needs an account.+ */+object GitHubAuth {+ const val GITHUB_CLIENT_ID = "Ov23liFBqyO4elV0s5gq"++ val enabled: Boolean get() = GITHUB_CLIENT_ID.isNotEmpty()++ const val DEVICE_CODE_URL = "https://github.com/login/device/code"+ const val TOKEN_URL = "https://github.com/login/oauth/access_token"++ /** Reacting on public issues: the narrowest scope that allows it. */+ const val SCOPE = "public_repo"++ fun deviceCodeBody(): String = "client_id=$GITHUB_CLIENT_ID&scope=$SCOPE"++ fun tokenBody(deviceCode: String): String =+ "client_id=$GITHUB_CLIENT_ID&device_code=$deviceCode&grant_type=urn:ietf:params:oauth:grant-type:device_code"++ /** What GitHub answers the first call: the code the user types at [verificationUri]. */+ @Serializable+ data class DeviceCode(+ @SerialName("device_code") val deviceCode: String,+ @SerialName("user_code") val userCode: String,+ @SerialName("verification_uri") val verificationUri: String,+ @SerialName("expires_in") val expiresIn: Int = 900,+ val interval: Int = 5,+ )++ fun parseDeviceCode(text: String): DeviceCode = ExtJson.decodeFromString(DeviceCode.serializer(), text)++ /** One poll of [TOKEN_URL] while the user types the code. */+ sealed interface Poll {+ data class Token(val token: String) : Poll+ data object Pending : Poll+ /** GitHub asks to wait 5 more seconds between polls. */+ data object SlowDown : Poll+ data class Failed(val reason: String) : Poll+ }++ @Serializable+ private data class TokenAnswer(+ @SerialName("access_token") val token: String? = null,+ val error: String? = null,+ @SerialName("error_description") val description: String? = null,+ )++ fun parsePoll(text: String): Poll {+ val a = runCatching { ExtJson.decodeFromString(TokenAnswer.serializer(), text) }.getOrElse { return Poll.Failed("unreadable answer") }+ return when {+ !a.token.isNullOrBlank() -> Poll.Token(a.token)+ a.error == "authorization_pending" -> Poll.Pending+ a.error == "slow_down" -> Poll.SlowDown+ else -> Poll.Failed(a.description ?: a.error ?: "no token")+ }+ }++ /** Where a 👍 or 👎 is posted (and read back) on [repo]'s ratings issue [issue]. */+ fun reactionsUrl(repo: String, issue: Int) = "https://api.github.com/repos/$repo/issues/$issue/reactions"++ fun reactionBody(up: Boolean) = """{"content":"${if (up) "+1" else "-1"}"}"""+}diff --git a/base/extensions/src/main/kotlin/app/myspoti/extensions/ExtensionRuntime.kt b/base/extensions/src/main/kotlin/app/myspoti/extensions/ExtensionRuntime.ktnew file mode 100644index 00000000..de9f1517--- /dev/null+++ b/base/extensions/src/main/kotlin/app/myspoti/extensions/ExtensionRuntime.kt@@ -0,0 +1,573 @@+package app.myspoti.extensions++import kotlinx.coroutines.TimeoutCancellationException+import kotlinx.coroutines.runBlocking+import kotlinx.coroutines.withTimeout+import kotlinx.serialization.builtins.ListSerializer+import kotlinx.serialization.builtins.MapSerializer+import kotlinx.serialization.builtins.serializer+import kotlinx.serialization.json.JsonArray+import kotlinx.serialization.json.JsonObject+import kotlinx.serialization.json.JsonPrimitive+import org.mozilla.javascript.Callable+import org.mozilla.javascript.Context+import org.mozilla.javascript.ContextFactory+import org.mozilla.javascript.LambdaFunction+import org.mozilla.javascript.RhinoException+import org.mozilla.javascript.Scriptable+import org.mozilla.javascript.ScriptRuntime+import org.mozilla.javascript.ScriptableObject+import org.mozilla.javascript.Undefined+import java.net.URI+import java.security.MessageDigest+import java.util.concurrent.ExecutorService+import java.util.concurrent.Executors+import java.util.concurrent.TimeUnit+import java.util.concurrent.TimeoutException+import java.util.concurrent.atomic.AtomicLong+import javax.crypto.Mac+import javax.crypto.spec.SecretKeySpec++/** An extension that failed: its script threw, ran out of time, or answered something unusable. */+open class ExtensionException(message: String, cause: Throwable? = null) : Exception(message, cause)++/** The script ran past its time limit (a slow phone, a cold start), as opposed to an error of its own. */+class ExtensionTimeout(message: String, cause: Throwable? = null) : ExtensionException(message, cause)++/** The call never started: the extension was still busy with earlier ones. Not the extension's fault. */+class ExtensionBusy(message: String) : ExtensionException(message)++/**+ * One extension, running. Its script lives in its own Rhino scope on its own thread, sees only+ * `myspoti` (prelude.js) and the standard objects without Java, and every call it makes to the+ * app is checked here against the actions the user granted, a subset of what its manifest+ * declares ([Manifest.declared]). While a protected surface is on screen ([guard]), the hooks the+ * app draws (blocks, page, taps) answer nothing.+ *+ * Limits: [Limits.loadMs] to run its top level (compiling it is not counted), a per-call time limit given by the caller (counted in script+ * instructions, so a loop cannot hold the thread), [Limits.requestsPerMinute] network requests,+ * [Limits.storageChars] of storage, [Limits.spotifyCallsPerMinute] `myspoti.spotify` calls. A call that runs over is abandoned; the next one waits behind+ * it on the extension's thread, never on the app's.+ */+class ExtensionRuntime(+ val manifest: Manifest,+ private val script: String,+ private val host: Host,+ /** Ask keys the user accepted ([Ask.key]); keys of before actions are mapped ([Action.migrateGranted]). */+ grantedKeys: Set<String>,+ private val limits: Limits = Limits(),+ private val guard: SurfaceGuard = SurfaceGuard.app,+) : AutoCloseable {+ private val granted: Set<String> = Action.migrateGranted(grantedKeys)+ private val declared: Set<Action> = manifest.actionSet()++ /** Whether [a] is in the manifest and granted. */+ fun has(a: Action): Boolean = a in declared && (a.key in granted || (a == Action.NETWORK && Action.NETWORK_ANY in granted))++ /** How long a call may wait for its turn, on top of its own time (the longest hook is 30 s). */+ private val QUEUE_MS = 30_000L++ data class Limits(+ /** Running the script's top level, counted once it is compiled. */+ val loadMs: Long = 3_000,+ /** Compiling it: the app's work, not the script's, slow only on a busy phone (a cold start). */+ val compileMs: Long = 20_000,+ val requestsPerMinute: Int = 120,+ val spotifyCallsPerMinute: Int = 60,+ /** How long the user has to answer a confirmation; no answer is a refusal. */+ val confirmMs: Long = 120_000,+ /** The biggest answer a Spotify call gives the script. */+ val spotifyResultChars: Int = 2 * 1024 * 1024,+ val storageChars: Int = 512 * 1024,+ )++ private val id = manifest.id+ private val thread: ExecutorService = Executors.newSingleThreadExecutor { r ->+ Thread(r, "ext-$id").apply { isDaemon = true; priority = Thread.NORM_PRIORITY - 1 }+ }+ private var scope: ScriptableObject? = null+ @Volatile private var deadline = Long.MAX_VALUE+ private val requestTimes = ArrayDeque<Long>()+ private val spotifyTimes = ArrayDeque<Long>()+ /** Time spent waiting for the user in the run on the thread now: it is not the script's time. */+ @Volatile private var activePause: Pause? = null++ /** The last failure, for the extension's page ("this extension failed: …"). */+ @Volatile var lastError: String? = null+ private set++ /** Loads the script. Throws [ExtensionException] when it does not load. */+ fun start() {+ // Compiling is not the script's time: on a phone busy starting the app it alone can take+ // seconds, and an extension was turned off for it. [Limits.loadMs] counts its top level only.+ val (prelude, main) = run(limits.compileMs) { cx ->+ cx.compileString(PRELUDE, "prelude.js", 1, null) to cx.compileString(script, manifest.main, 1, null)+ }+ run(limits.loadMs) { cx ->+ val s = cx.initSafeStandardObjects(null, false)+ ScriptableObject.putProperty(s, "__host", hostObject(cx, s))+ prelude.exec(cx, s)+ scope = s+ main.exec(cx, s)+ null+ }+ }++ /** Whether the user lets the script provide [hook] (its action declared and granted; `tap`: any drawn action; `status`: always). */+ fun provides(hook: Hook): Boolean = hook.free || (hook.action?.let(::has) ?: Action.BLOCKS.any(::has))++ /**+ * Calls the script's [hook] with [inputJson]; its answer as JSON text, or null when it has+ * none. Throws [ExtensionException] on failure or after [timeoutMs]. A drawn hook answers+ * nothing while a protected surface is on screen.+ */+ fun call(hook: Hook, inputJson: String, timeoutMs: Long): String? {+ if (!provides(hook)) return null+ if (hook.drawn && guard.suspended) return null+ return run(timeoutMs) { cx -> dispatch(cx, "hook", hook.key, inputJson) }+ }++ private val listening: MutableSet<String> = java.util.concurrent.ConcurrentHashMap.newKeySet()++ /** Whether the script listens to [event] and may receive it (so the app can skip the work). */+ fun listens(event: String): Boolean = event in listening && EVENTS[event]?.let(::has) == true++ /**+ * Delivers an app event (the listeners' answers are ignored). One still waiting its turn after+ * [timeoutMs] (a long hook call held the extension's thread) is dropped quietly: not the+ * script's failure, nothing logged and no [lastError].+ */+ fun emit(event: String, inputJson: String, timeoutMs: Long = 3_000) {+ if (EVENTS[event]?.let(::has) != true) return+ runCatching { run(timeoutMs, quietWhileQueued = true) { cx -> dispatch(cx, "event", event, inputJson) } }+ }++ /** Whether [close] ran: a call it cut short is not the script's failure. */+ val closed: Boolean get() = thread.isShutdown++ override fun close() {+ thread.shutdownNow()+ pool?.shutdownNow()+ }++ private fun dispatch(cx: Context, kind: String, name: String, input: String): String? {+ val s = scope ?: throw ExtensionException("not started")+ val fn = ScriptableObject.getProperty(s, "__dispatch") as Callable+ val out = fn.call(cx, s, s, arrayOf(kind, name, input))+ return if (out == null || out is Undefined) null else Context.toString(out)+ }++ /** [quietWhileQueued]: a run that never started within [timeoutMs] is dropped without a failure. */+ private fun <T> run(timeoutMs: Long, quietWhileQueued: Boolean = false, block: (Context) -> T): T {+ val pause = Pause()+ // The time limit counts from when the call runs: one waiting behind a slow call (a song+ // looked up for 15 s) has used none of its own time.+ val began = java.util.concurrent.atomic.AtomicLong(0)+ val task = thread.submit<T> {+ began.set(System.nanoTime())+ activePause = pause+ deadline = System.nanoTime() + TimeUnit.MILLISECONDS.toNanos(timeoutMs)+ try {+ FACTORY.call { cx -> block(cx) }+ } finally {+ deadline = Long.MAX_VALUE+ activePause = null+ }+ }+ val queued = System.nanoTime()+ return try {+ // Still waiting for its turn after its own time plus the longest call: it is dropped.+ while (began.get() == 0L) {+ val waited = System.nanoTime() - queued+ // An event not run within its own time is dropped without a failure.+ if (quietWhileQueued && waited > TimeUnit.MILLISECONDS.toNanos(timeoutMs)) {+ task.cancel(false)+ if (began.get() == 0L) throw ExtensionException("dropped: the extension was busy")+ break+ }+ if (waited > TimeUnit.MILLISECONDS.toNanos(timeoutMs + QUEUE_MS)) {+ task.cancel(false)+ if (began.get() == 0L) throw ExtensionBusy("busy with earlier calls: not run")+ break+ }+ try { return task.get(10, TimeUnit.MILLISECONDS) } catch (_: TimeoutException) { /* not its turn yet */ }+ }+ await(task, timeoutMs, began.get(), pause)+ } catch (e: TimeoutException) {+ task.cancel(true)+ fail("took longer than $timeoutMs ms", e, timeout = true)+ } catch (e: java.util.concurrent.ExecutionException) {+ val c = e.cause+ when (c) {+ is TimeLimit -> fail("took longer than $timeoutMs ms", c, timeout = true)+ is RhinoException -> fail("${c.details()} (${c.sourceName()}:${c.lineNumber()})", c)+ is ExtensionException -> fail(c.message ?: "failed", c)+ else -> fail(c?.toString() ?: "failed", c)+ }+ }+ }++ /** Waits for [task] for [timeoutMs] (and a little more), plus as long as the user was asked something meanwhile. */+ private fun <T> await(task: java.util.concurrent.Future<T>, timeoutMs: Long, started: Long, pause: Pause): T {+ while (true) {+ val left = TimeUnit.MILLISECONDS.toNanos(timeoutMs + 500) + pause.nanos() - (System.nanoTime() - started)+ if (left <= 0) throw TimeoutException()+ try { return task.get(left, TimeUnit.NANOSECONDS) } catch (_: TimeoutException) { /* the pause may have grown: look again */ }+ }+ }++ private fun fail(message: String, cause: Throwable?, timeout: Boolean = false): Nothing {+ if (closed) throw ExtensionException("stopped", cause)+ lastError = message+ host.log(id, "failed: $message")+ throw if (timeout) ExtensionTimeout(message, cause) else ExtensionException(message, cause)+ }++ // ── What the script can ask of the app ──++ private fun hostObject(cx: Context, s: Scriptable): Scriptable {+ val o = cx.newObject(s)+ fun def(name: String, length: Int, fn: (Array<Any?>) -> Any?) =+ ScriptableObject.putProperty(o, name, LambdaFunction(s, name, length) { _, _, _, args -> fn(args) ?: Undefined.instance })+ fun str(args: Array<Any?>, i: Int): String = args.getOrNull(i)?.takeUnless { it is Undefined }?.let { Context.toString(it) }.orEmpty()++ def("info", 0) { ExtJson.encodeToString(Info.serializer(), Info(manifest.id, manifest.name, manifest.version)) }+ def("mayProvide", 1) { a ->+ val key = str(a, 0)+ val hook = Hook.of(key) ?: throw error("unknown hook \"$key\" (known: ${Hook.entries.joinToString { it.key }})")+ val action = hook.action+ if (hook.free) return@def null+ if (action == null) {+ if (Action.BLOCKS.none { it in declared }) throw error("provide(\"tap\") needs an action drawn as blocks (${Action.BLOCKS.joinToString { it.key }})")+ } else if (action !in declared) throw error("provide(\"$key\") needs the ${action.key} action in the manifest")+ null+ }+ def("mayListen", 1) { a ->+ val event = str(a, 0)+ val action = EVENTS[event] ?: throw error("unknown event \"$event\" (known: ${EVENTS.keys.joinToString()})")+ if (action !in declared) throw error("on(\"$event\") needs the ${action.key} action")+ listening += event+ null+ }+ def("http", 1) { a -> http(str(a, 0)) }+ def("httpAll", 1) { a -> httpAll(str(a, 0)) }+ def("storageGet", 1) { a -> need(Action.STORAGE); host.storage(id).get(str(a, 0)) }+ def("storageSet", 2) { a ->+ need(Action.STORAGE)+ val store = host.storage(id)+ val key = str(a, 0)+ val value = str(a, 1)+ val after = store.size() - (store.get(key)?.let { it.length + key.length } ?: 0) + key.length + value.length+ if (after > limits.storageChars) throw error("storage full (${limits.storageChars / 1024} KB)")+ store.set(key, value)+ null+ }+ def("storageRemove", 1) { a -> need(Action.STORAGE); host.storage(id).remove(str(a, 0)); null }+ def("setting", 1) { a ->+ val key = str(a, 0)+ host.setting(id, key) ?: manifest.settings.firstOrNull { it.key == key }?.default?.toString()+ }+ def("nowPlaying", 0) { need(Action.PLAYBACK_EVENTS); host.nowPlaying() }+ def("control", 2) { a ->+ need(Action.PLAYBACK_CONTROL)+ val action = str(a, 0)+ if (action !in CONTROLS) throw error("unknown player action \"$action\"")+ val arg = (a.getOrNull(1) as? Number)?.toLong()?.takeIf { it >= 0 }+ host.control(id, action, arg)+ }+ def("notify", 1) { a -> need(Action.NOTIFY); host.notify(id, str(a, 0).take(200)); null }+ def("refresh", 1) { a ->+ val surface = Surface.entries.firstOrNull { it.key == str(a, 0) || it.key.substringBefore('.') == str(a, 0) }+ ?: throw error("ui.refresh: unknown place \"${str(a, 0)}\" (${Surface.entries.joinToString { it.key.substringBefore('.') }.split(", ").distinct().joinToString()})")+ need(surface.action)+ host.refresh(id, surface.key.substringBefore('.'))+ null+ }+ def("pagePost", 1) { a ->+ need(Action.WEBVIEW_PAGE)+ val json = str(a, 0)+ if (json.length > MAX_PAGE_MESSAGE) throw error("page.post: message over ${MAX_PAGE_MESSAGE / 1024} KB")+ if (!guard.suspended) host.postToPage(id, json)+ null+ }+ def("authOpen", 2) { a ->+ need(Action.WEBVIEW_AUTH)+ val request = try { AuthRequest(str(a, 0), str(a, 1), hidden = a.getOrNull(2) == true).checked() } catch (e: IllegalArgumentException) { throw error(e.message ?: "auth.open: refused") }+ runCatching { host.openAuth(id, request) }.getOrElse { throw error("auth.open: ${it.message ?: it.javaClass.simpleName}") }+ }+ def("whenOnline", 0) { need(Action.NETWORK); host.whenOnline(id); null }+ def("log", 1) { a -> host.log(id, str(a, 0).take(2_000)); null }+ def("util", 2) { a -> util(str(a, 0), str(a, 1)) }+ def("spotifyMethods", 0) { ExtJson.encodeToString(METHOD_NAMES, SpotifyMethods.names()) }+ def("spotify", 3) { a -> spotify(str(a, 0), str(a, 1), str(a, 2)) }+ return o+ }++ private fun need(a: Action) {+ if (!has(a)) throw error(+ if (a in declared) "the user did not grant ${a.key}"+ else "${a.key} is not in this extension's manifest (actions)",+ )+ }++ private fun http(json: String): String {+ val r = runCatching { ExtJson.decodeFromString(HttpRequest.serializer(), json) }.getOrElse { throw error("http: unreadable request") }+ refusal(r)?.let { throw error(it) }+ throttle()+ val response = runCatching { host.http(id, r.copy(timeout = r.timeout.coerceAtMost(remainingMs()))) }+ .getOrElse { throw error("http: ${it.message ?: it.javaClass.simpleName}") }+ return ExtJson.encodeToString(HttpResponse.serializer(), response)+ }++ /** Why [r] may not be sent (its host, its scheme), or null. */+ private fun refusal(r: HttpRequest): String? {+ val uri = runCatching { URI(r.url) }.getOrElse { return "http: not a URL: ${r.url}" }+ val hostName = uri.host?.lowercase() ?: return "http: no host in ${r.url}"+ if (isPrivate(hostName)) return "http: $hostName is a local address"+ val listed = manifest.hosts()+ val anyHost = Action.NETWORK_ANY in granted && "*" in listed && Action.NETWORK in declared+ val named = listed.any { it != "*" && hostMatches(it, hostName) }+ if (!(anyHost || (Action.NETWORK.key in granted && Action.NETWORK in declared && named)))+ return "http: $hostName is not in this extension's network hosts"+ // Plain http only to a host named outright: never through a wildcard or "any host".+ val exact = listed.any { it == hostName }+ if (uri.scheme != "https" && !(uri.scheme == "http" && exact)) return "http: https only (or http to a host the manifest names exactly)"+ return null+ }++ /** For `http.all`: at most [MAX_PARALLEL] requests at a time, made only while the script waits. */+ @Volatile private var pool: ExecutorService? = null+ private fun parallel(): ExecutorService = pool ?: synchronized(this) {+ pool ?: Executors.newFixedThreadPool(MAX_PARALLEL) { r -> Thread(r, "ext-$id-http").apply { isDaemon = true } }.also { pool = it }+ }++ /**+ * `http.all([request, ...])`: up to [MAX_PARALLEL] requests sent together, each checked and+ * counted like one `http.request`; the answers in the same order, `{ error }` in place of one+ * that failed. The script waits for all of them, within its time limit.+ */+ private fun httpAll(json: String): String {+ val items = runCatching { ExtJson.parseToJsonElement(json) as JsonArray }.getOrElse { throw error("http.all: unreadable requests") }+ if (items.size > MAX_PARALLEL) throw error("http.all: at most $MAX_PARALLEL requests at once")+ val jobs = items.map { e ->+ val r = runCatching { ExtJson.decodeFromJsonElement(HttpRequest.serializer(), e) }.getOrNull()+ ?: return@map Result.failure<java.util.concurrent.Future<HttpResponse>>(IllegalArgumentException("http: unreadable request"))+ val why = refusal(r) ?: if (!allowRequest()) "more than ${limits.requestsPerMinute} requests in a minute" else null+ if (why != null) return@map Result.failure(IllegalArgumentException(why))+ val sent = r.copy(timeout = r.timeout.coerceAtMost(remainingMs()))+ Result.success(parallel().submit<HttpResponse> { host.http(id, sent) })+ }+ try {+ val answers = jobs.map { job ->+ job.mapCatching { f ->+ try { f.get(leftMs(), TimeUnit.MILLISECONDS) } catch (e: java.util.concurrent.ExecutionException) { throw e.cause ?: e }+ }.fold(+ { ExtJson.encodeToJsonElement(HttpResponse.serializer(), it) },+ { e ->+ if (e is TimeoutException || e is TimeLimit) throw TimeLimit()+ if (e is InterruptedException) throw e+ JsonObject(mapOf("error" to JsonPrimitive(e.message ?: e.javaClass.simpleName)))+ },+ )+ }+ return JsonArray(answers).toString()+ } finally {+ jobs.forEach { it.getOrNull()?.cancel(true) }+ }+ }++ private fun throttle(times: ArrayDeque<Long> = requestTimes, max: Int = limits.requestsPerMinute, what: String = "requests") {+ if (!allowRequest(times, max)) throw error("more than $max $what in a minute")+ }++ /** Counts one more call in [times], or false when [max] were made in the last minute. */+ private fun allowRequest(times: ArrayDeque<Long> = requestTimes, max: Int = limits.requestsPerMinute): Boolean {+ val now = System.currentTimeMillis()+ synchronized(times) {+ while (times.isNotEmpty() && now - times.first() > 60_000) times.removeFirst()+ if (times.size >= max) return false+ times.addLast(now)+ return true+ }+ }++ private fun leftMs(): Long {+ val left = TimeUnit.NANOSECONDS.toMillis(deadline - System.nanoTime())+ if (left <= 0) throw TimeLimit()+ return left+ }++ private fun remainingMs(): Int = leftMs().coerceAtMost(20_000).toInt()++ /**+ * `myspoti.spotify.<area>.<method>(...)`: the method must be in [SpotifyMethods] and its right+ * granted; a destructive one runs only if the user says yes ([Host.confirm]). The script's+ * thread waits for the host, within the call's time limit.+ */+ private fun spotify(area: String, name: String, argsJson: String): String {+ val method = SpotifyMethods.find(area, name) ?: throw error("spotify.$area.$name: no such method")+ need(method.action)+ val args = SpotifyArgs(+ runCatching { ExtJson.parseToJsonElement(argsJson) as JsonArray }.getOrElse { throw error("spotify.${method.key}: unreadable arguments") },+ "spotify.${method.key}",+ )+ if (argsJson.length > MAX_SPOTIFY_ARGS) throw error("spotify.${method.key}: arguments over ${MAX_SPOTIFY_ARGS / 1024} KB")+ val destructive = try { method.isDestructive(args, host::spotifyMutation) } catch (e: IllegalArgumentException) { throw error(e.message ?: "bad arguments") }+ if (destructive && !mayWrite(method, args, argsJson)) throw error("spotify.${method.key}: the user refused")+ throttle(spotifyTimes, limits.spotifyCallsPerMinute, "Spotify calls")+ val result = try {+ runBlocking { withTimeout(leftMs()) { host.spotify(id, SpotifyCall(area, name, argsJson)) } }+ } catch (e: TimeoutCancellationException) {+ throw TimeLimit()+ } catch (e: InterruptedException) {+ throw e+ } catch (e: Exception) {+ val why = e.message ?: e.javaClass.simpleName+ throw error(if (why.startsWith("spotify.")) why else "spotify.${method.key}: $why")+ }+ if (result.length > limits.spotifyResultChars) throw error("spotify.${method.key}: answer over ${limits.spotifyResultChars / 1024 / 1024} MB")+ return result+ }++ /**+ * Whether a destructive call may run: asked each time, apart from a `raw.request` write one of+ * the user's [RawGrant]s covers; that question offers "always" for this kind of request.+ */+ private fun mayWrite(method: SpotifyMethod, args: SpotifyArgs, argsJson: String): Boolean {+ val text = "${manifest.name} wants to ${method.label}.\n${summary(argsJson)}"+ if (method.key != RAW_REQUEST) return confirm(text)+ val verb = RawRequest.check(args.str(0, "method"), args.str(1, "url"))+ val url = args.str(1, "url")+ if (RawRequest.covered(host.rawGrants(id), verb, url)) return true+ val offer = RawRequest.offer(verb, url)+ return paused { host.confirmWrite(id, text, offer) }.let { it == Consent.ONCE || it == Consent.ALWAYS }+ }++ /** Asks the user through the host; the wait is not the script's time. */+ private fun confirm(text: String): Boolean = paused { host.confirm(id, text) } == true++ private fun <T> paused(ask: suspend () -> T): T? {+ val pause = activePause+ pause?.begin()+ val started = System.nanoTime()+ try {+ return try {+ runBlocking { withTimeout(limits.confirmMs) { ask() } }+ } catch (e: TimeoutCancellationException) {+ null+ }+ } finally {+ val waited = System.nanoTime() - started+ if (deadline != Long.MAX_VALUE) deadline += waited+ pause?.end(waited)+ }+ }++ private fun summary(argsJson: String) = argsJson.take(300) + if (argsJson.length > 300) "…" else ""++ /** The time a run spent waiting for the user: finished waits, and the one going on. */+ private class Pause {+ private val done = AtomicLong()+ @Volatile private var since = 0L+ fun begin() { since = System.nanoTime() }+ fun end(nanos: Long) { done.addAndGet(nanos); since = 0L }+ fun nanos(): Long = done.get() + since.let { if (it == 0L) 0L else System.nanoTime() - it }+ }++ private fun util(op: String, input: String): String = when (op) {+ "base64Encode" -> java.util.Base64.getEncoder().encodeToString(input.toByteArray())+ "base64Decode" -> runCatching { String(java.util.Base64.getDecoder().decode(input)) }.getOrElse { throw error("base64Decode: not base64") }+ "md5" -> hex(MessageDigest.getInstance("MD5").digest(input.toByteArray()))+ "sha1" -> hex(MessageDigest.getInstance("SHA-1").digest(input.toByteArray()))+ "sha256" -> hex(MessageDigest.getInstance("SHA-256").digest(input.toByteArray()))+ "hmacSha256" -> {+ val key = input.substringBefore('\u0000')+ val text = input.substringAfter('\u0000')+ val mac = Mac.getInstance("HmacSHA256").apply { init(SecretKeySpec(key.toByteArray(), "HmacSHA256")) }+ hex(mac.doFinal(text.toByteArray()))+ }+ else -> throw error("unknown util $op")+ }++ @kotlinx.serialization.Serializable+ private data class Info(val id: String, val name: String, val version: String)++ /** Thrown inside the script's thread when its time is up; not catchable by the script. */+ private class TimeLimit : Error("time limit")++ private class LimitedContext(f: ContextFactory) : Context(f)++ companion object {+ const val EVENT_TRACK = "track"+ /** Start, progress, pause, resume, seek, skip, end of a song (docs/extensions/API.md §3). */+ const val EVENT_PLAYBACK = "playback"+ /** A sign-in page ended ([AuthResult]). */+ const val EVENT_AUTH = "auth"+ /** The network is there after [Host.whenOnline]: the time to send what waited. */+ const val EVENT_ONLINE = "online"+ /** One of its settings changed (`{ key }`), or a button setting was pressed (`{ key, pressed: true }`). */+ const val EVENT_SETTING = "setting"+ /** Each event, and the action an extension needs to receive it. */+ val EVENTS: Map<String, Action> = mapOf(+ EVENT_TRACK to Action.PLAYBACK_EVENTS,+ EVENT_PLAYBACK to Action.PLAYBACK_EVENTS,+ EVENT_AUTH to Action.WEBVIEW_AUTH,+ EVENT_ONLINE to Action.NETWORK,+ EVENT_SETTING to Action.SETTINGS_PAGE,+ )+ private const val RAW_REQUEST = "raw.request"+ private val METHOD_NAMES = MapSerializer(String.serializer(), ListSerializer(String.serializer()))+ private const val MAX_SPOTIFY_ARGS = 256 * 1024+ private const val MAX_PAGE_MESSAGE = 64 * 1024+ /** `http.all`: the most requests sent together. */+ const val MAX_PARALLEL = 4+ private val CONTROLS = setOf("play", "pause", "next", "previous", "seek")++ private val PRELUDE: String = ExtensionRuntime::class.java.getResource("prelude.js")!!.readText()++ private val FACTORY = object : ContextFactory() {+ override fun makeContext(): Context = LimitedContext(this).apply {+ // Android cannot load generated classes, and instruction counting needs the interpreter.+ isInterpretedMode = true+ languageVersion = Context.VERSION_ES6+ instructionObserverThreshold = 5_000+ setMaximumInterpreterStackDepth(800)+ // No Java at all: no class can be named, built or reached from a script.+ setClassShutter { false }+ }++ override fun observeInstructionCount(cx: Context, instructionCount: Int) {+ val runtime = RUNNING.get() ?: return+ if (System.nanoTime() > runtime.deadline) throw TimeLimit()+ }+ }++ /** The runtime whose script runs on this thread, for the instruction observer. */+ private val RUNNING = ThreadLocal<ExtensionRuntime>()++ private fun error(message: String): RuntimeException = ScriptRuntime.constructError("Error", message)++ private fun hex(bytes: ByteArray) = bytes.joinToString("") { "%02x".format(it) }++ internal fun hostMatches(pattern: String, host: String): Boolean = when {+ pattern == "*" -> true+ pattern.startsWith("*.") -> host == pattern.removePrefix("*.") || host.endsWith(pattern.removePrefix("*"))+ else -> host == pattern+ }++ internal fun isPrivate(host: String): Boolean {+ if (host == "localhost" || host.endsWith(".localhost") || host.endsWith(".local")) return true+ val v4 = host.split('.').mapNotNull { it.toIntOrNull() }.takeIf { it.size == 4 && host.count { c -> c == '.' } == 3 }+ if (v4 != null) {+ val (a, b) = v4+ return a == 10 || a == 127 || a == 0 || (a == 172 && b in 16..31) || (a == 192 && b == 168) || (a == 169 && b == 254)+ }+ return host.startsWith("[") || host.contains(':')+ }+ }++ init {+ // The instruction observer finds the runtime through its thread.+ thread.submit { RUNNING.set(this) }+ }+}diff --git a/base/extensions/src/main/kotlin/app/myspoti/extensions/Hooks.kt b/base/extensions/src/main/kotlin/app/myspoti/extensions/Hooks.ktnew file mode 100644index 00000000..aa74cc22--- /dev/null+++ b/base/extensions/src/main/kotlin/app/myspoti/extensions/Hooks.kt@@ -0,0 +1,327 @@+package app.myspoti.extensions++import kotlinx.serialization.Serializable+import kotlinx.serialization.json.JsonArray+import kotlinx.serialization.json.JsonObject+import kotlinx.serialization.json.JsonPrimitive+import kotlinx.serialization.json.booleanOrNull+import kotlinx.serialization.json.contentOrNull+import kotlinx.serialization.json.jsonObject+import kotlinx.serialization.json.longOrNull++/** A song as every hook and event receives it. */+@Serializable+data class TrackInfo(+ /** Spotify's track id ("4uLU6hMCjMI75M1A2tKUQC"), empty for a local file. */+ val id: String,+ val uri: String,+ val title: String,+ /** The first artist. */+ val artist: String,+ val artists: List<String>,+ val album: String,+ val durationMs: Long,+ val isrc: String? = null,+ val cover: String? = null,+) {+ fun toJson(): String = ExtJson.encodeToString(serializer(), this)+}++/** An extension's lyrics, checked: at most [MAX_LINES] lines, times in milliseconds. */+data class LyricsResult(val provider: String, val synced: Boolean, val lines: List<Line>) {+ data class Line(val startMs: Long, val endMs: Long?, val text: String, val words: List<Word>?)+ data class Word(val startMs: Long, val endMs: Long?, val text: String)++ val wordSynced: Boolean get() = synced && lines.any { !it.words.isNullOrEmpty() }++ companion object {+ const val MAX_LINES = 3_000++ /**+ * `{ provider?, synced?, lines: [{ time?, end?, text, words?: [{ time, end?, text }] }] }`,+ * or `{ provider?, plain: "text" }`. Null when there is nothing to show.+ */+ fun parse(json: String, fallbackProvider: String): LyricsResult? {+ val o = runCatching { ExtJson.parseToJsonElement(json).jsonObject }.getOrNull() ?: throw ExtensionException("lyrics: not an object")+ val provider = (o["provider"] as? JsonPrimitive)?.contentOrNull?.take(40)?.ifBlank { null } ?: fallbackProvider+ val plain = (o["plain"] as? JsonPrimitive)?.contentOrNull+ if (o["lines"] == null && plain != null) {+ val lines = plain.lines().take(MAX_LINES).map { Line(0, null, it.take(500), null) }+ return LyricsResult(provider, false, lines).takeIf { lines.any { it.text.isNotBlank() } }+ }+ val raw = (o["lines"] as? JsonArray) ?: throw ExtensionException("lyrics: \"lines\" (an array) or \"plain\" (a text)")+ if (raw.size > MAX_LINES) throw ExtensionException("lyrics: more than $MAX_LINES lines")+ val lines = raw.map { e ->+ val l = e as? JsonObject ?: throw ExtensionException("lyrics: each line is an object { time, text }")+ val words = (l["words"] as? JsonArray)?.take(200)?.map { w ->+ val wo = w.jsonObject+ Word(ms(wo["time"]) ?: throw ExtensionException("lyrics: a word without its time"), ms(wo["end"]), text(wo["text"]))+ }+ Line(ms(l["time"]) ?: 0, ms(l["end"]), text(l["text"]), words?.takeIf { it.isNotEmpty() })+ }+ val synced = (o["synced"] as? JsonPrimitive)?.booleanOrNull ?: raw.any { (it as JsonObject)["time"] != null }+ return LyricsResult(provider, synced, lines).takeIf { lines.any { it.text.isNotBlank() } }+ }++ private fun ms(e: kotlinx.serialization.json.JsonElement?): Long? =+ (e as? JsonPrimitive)?.let { p -> p.longOrNull ?: p.contentOrNull?.toDoubleOrNull()?.toLong() }?.coerceAtLeast(0)++ private fun text(e: kotlinx.serialization.json.JsonElement?): String = (e as? JsonPrimitive)?.contentOrNull?.take(500).orEmpty()+ }+}++/** Where a song's audio is, as an audio-source extension gives it. */+data class AudioStream(+ val url: String,+ val headers: Map<String, String>,+ val mimeType: String?,+ val durationMs: Long?,+ /** The id of the extension that answered (set by the app, never read from the answer). */+ val providerId: String? = null,+ /**+ * Instead of [url] (then empty): an MPEG-DASH manifest, base64, of FLAC in fragmented MP4+ * (as `dash-flac` downloads); the app plays its segments in order, seekable.+ */+ val manifest: String? = null,+ /** How long the answer stays good, ms (its address expires): the app asks again after it. */+ val expiresInMs: Long? = null,+ /** The quality the extension announces, shown as it is: bits per sample, Hz, codec ("flac"). */+ val bitDepth: Int? = null,+ val sampleRate: Int? = null,+ val codec: String? = null,+ /**+ * Free text the player shows of the audio when the fields above say nothing ("FLAC · 16-bit ·+ * 44.1 kHz"), 80 characters at most.+ */+ val source: String? = null,+) {+ /** How long the app keeps this answer: [expiresInMs], at most [maxMs]. */+ fun keepMs(maxMs: Long): Long = expiresInMs?.coerceIn(0, maxMs) ?: maxMs++ /**+ * "FLAC · 24-bit · 96 kHz" from what the extension announced (its fields, else its [source]+ * text); null when it said nothing.+ */+ fun qualityLabel(): String? = listOfNotNull(+ codec?.uppercase(),+ bitDepth?.let { "$it-bit" },+ sampleRate?.let { hz -> (if (hz % 1000 == 0) "${hz / 1000}" else "%.1f".format(java.util.Locale.ROOT, hz / 1000.0)) + " kHz" },+ ).takeIf { it.isNotEmpty() }?.joinToString(" · ") ?: source++ companion object {+ private const val MAX_MANIFEST = 1024 * 1024+ private const val MAX_SOURCE = 80++ /**+ * `{ url | manifest, headers?, mimeType?, durationMs?, expiresInMs?, bitDepth?, sampleRate?, codec?, source? }`;+ * null when the extension has no audio for it.+ */+ fun parse(json: String): AudioStream? {+ val o = runCatching { ExtJson.parseToJsonElement(json).jsonObject }.getOrNull() ?: throw ExtensionException("audio-source: not an object")+ fun long(k: String) = (o[k] as? JsonPrimitive)?.let { p -> p.longOrNull ?: p.contentOrNull?.toDoubleOrNull()?.toLong() }+ val mime = (o["mimeType"] as? JsonPrimitive)?.contentOrNull+ val duration = (o["durationMs"] as? JsonPrimitive)?.longOrNull+ val source = (o["source"] as? JsonPrimitive)?.takeIf { it.isString }?.content?.replace(Regex("\\s+"), " ")?.trim()+ ?.take(MAX_SOURCE)?.ifBlank { null }+ val base = AudioStream(+ "", headersOf(o["headers"]), mime, duration, source = source,+ expiresInMs = long("expiresInMs")?.coerceAtLeast(0),+ bitDepth = long("bitDepth")?.toInt()?.takeIf { it in 8..32 },+ sampleRate = long("sampleRate")?.toInt()?.takeIf { it in 8_000..768_000 },+ codec = (o["codec"] as? JsonPrimitive)?.contentOrNull?.lowercase()?.takeIf { it.matches(Regex("[a-z0-9.+-]{1,16}")) },+ )+ val manifest = (o["manifest"] as? JsonPrimitive)?.contentOrNull+ if (manifest != null) {+ if (manifest.length > MAX_MANIFEST) throw ExtensionException("audio-source: manifest over 1 MB")+ val mpd = runCatching { String(java.util.Base64.getMimeDecoder().decode(manifest)) }.getOrNull()+ if (mpd == null || !mpd.contains("<MPD")) throw ExtensionException("audio-source: manifest is not a base64 MPEG-DASH manifest")+ Regex("(?:initialization|media)=\"([^\"]+)\"").findAll(mpd).forEach { checkUrl("audio-source", it.groupValues[1].replace("&", "&")) }+ return base.copy(manifest = manifest)+ }+ val url = (o["url"] as? JsonPrimitive)?.contentOrNull ?: return null+ checkUrl("audio-source", url)+ return base.copy(url = url)+ }+ }+}++/**+ * What an `audio-source` extension is asked: the song, and `ahead` (true when the app asks before+ * the song plays, to have it ready: the answer is kept and played as given when the song comes).+ */+object AudioQuery {+ fun toJson(track: TrackInfo, ahead: Boolean): String {+ val o = ExtJson.encodeToJsonElement(TrackInfo.serializer(), track).jsonObject+ return JsonObject(o + ("ahead" to JsonPrimitive(ahead))).toString()+ }+}++/** A public http(s) address, or the hook's error. */+internal fun checkUrl(hook: String, url: String) {+ val scheme = url.substringBefore(':').lowercase()+ if (scheme != "https" && scheme != "http") throw ExtensionException("$hook: the url must be http(s)")+ val host = runCatching { java.net.URI(url).host?.lowercase() }.getOrNull() ?: throw ExtensionException("$hook: not a URL")+ if (ExtensionRuntime.isPrivate(host)) throw ExtensionException("$hook: $host is a local address")+}++/** At most 20 headers, without the ones the app sets itself. */+internal fun headersOf(e: kotlinx.serialization.json.JsonElement?): Map<String, String> =+ (e as? JsonObject)?.entries?.take(20)?.associate { (k, v) ->+ k to ((v as? JsonPrimitive)?.contentOrNull ?: v.toString())+ }?.filterKeys { it.lowercase() !in setOf("host", "content-length", "connection", "cookie") }.orEmpty()++/**+ * What a `download-source` extension is asked: the song, and the quality the user wants+ * ([QUALITIES]: `hi-res` = the best there is, `cd` = 16-bit lossless, `small` = a small lossy file).+ */+object DownloadQuery {+ val QUALITIES = listOf("hi-res", "cd", "small")++ fun toJson(track: TrackInfo, quality: String): String {+ require(quality in QUALITIES) { "quality $quality" }+ val o = ExtJson.encodeToJsonElement(TrackInfo.serializer(), track).jsonObject+ return JsonObject(o + ("quality" to JsonPrimitive(quality))).toString()+ }+}++/**+ * One file a `download-source` extension offers for a song. Either [url] (a file to fetch) or,+ * for `dash-flac`, [manifest] (an MPEG-DASH manifest, base64, of FLAC in fragmented MP4: the app+ * joins the segments into one FLAC file). Finding and matching the file is the extension's job;+ * the app only checks that it is real audio of the song's length.+ */+data class DownloadFile(+ val url: String?,+ val manifest: String?,+ val headers: Map<String, String>,+ /** One of [FORMATS]. */+ val format: String,+ val bitDepth: Int?,+ val sampleRate: Int?,+ /** Bytes, as the extension expects them (for the progress bar only). */+ val sizeHint: Long?,+ /** Shown in the Downloaded list ("where it came from"), 40 characters. */+ val provider: String?,+ /** The extension found this file by the song's ISRC (the exact recording). */+ val isrcMatched: Boolean,+) {+ val lossless get() = format == "flac" || format == "dash-flac"++ companion object {+ val FORMATS = setOf("flac", "dash-flac", "m4a", "mp3")+ const val MAX_FILES = 10+ private const val MAX_MANIFEST = 1024 * 1024++ /**+ * `[file, ...]`, `{ files: [file, ...] }` or one `file`, each+ * `{ url | manifest, format, headers?, bitDepth?, sampleRate?, sizeHint?, provider?, isrcMatched? }`.+ * In the extension's order (best first); empty when it has nothing.+ */+ fun parseList(json: String): List<DownloadFile> {+ val root = runCatching { ExtJson.parseToJsonElement(json) }.getOrNull() ?: throw ExtensionException("download-source: not JSON")+ val items = when (root) {+ is JsonArray -> root+ is JsonObject -> (root["files"] as? JsonArray) ?: JsonArray(listOf(root))+ else -> throw ExtensionException("download-source: a list of files")+ }+ if (items.size > MAX_FILES) throw ExtensionException("download-source: more than $MAX_FILES files")+ return items.mapNotNull { e ->+ val o = e as? JsonObject ?: throw ExtensionException("download-source: each file is an object { url, format }")+ parse(o)+ }+ }++ private fun parse(o: JsonObject): DownloadFile? {+ fun str(k: String) = (o[k] as? JsonPrimitive)?.contentOrNull+ fun int(k: String) = (o[k] as? JsonPrimitive)?.longOrNull+ val format = str("format")?.lowercase() ?: throw ExtensionException("download-source: \"format\" (${FORMATS.joinToString()})")+ if (format !in FORMATS) throw ExtensionException("download-source: format \"$format\" unknown (${FORMATS.joinToString()})")+ val url = str("url")?.takeIf { it.isNotBlank() }+ val manifest = str("manifest")?.takeIf { it.isNotBlank() }+ if (format == "dash-flac") {+ if (manifest == null) throw ExtensionException("download-source: dash-flac needs \"manifest\" (base64)")+ if (manifest.length > MAX_MANIFEST) throw ExtensionException("download-source: manifest over 1 MB")+ } else {+ url ?: return null+ checkUrl("download-source", url)+ }+ return DownloadFile(+ url = if (format == "dash-flac") null else url,+ manifest = if (format == "dash-flac") manifest else null,+ headers = headersOf(o["headers"]),+ format = format,+ bitDepth = int("bitDepth")?.toInt()?.takeIf { it in 8..32 },+ sampleRate = int("sampleRate")?.toInt()?.takeIf { it in 8_000..768_000 },+ sizeHint = int("sizeHint")?.takeIf { it > 0 },+ provider = str("provider")?.take(40)?.ifBlank { null },+ isrcMatched = (o["isrcMatched"] as? JsonPrimitive)?.booleanOrNull ?: false,+ )+ }+ }+}++/**+ * One `playback` event (docs/extensions/API.md §3): what happened to the song playing, in+ * Myspoti's own player (`source = "local"`: downloads, local files, extensions' audio) or the+ * Spotify Web Player (`"spotify"`).+ */+@Serializable+data class PlaybackEvent(+ /** One of [TYPES]. */+ val type: String,+ val track: TrackInfo,+ /** Where in the song, ms. */+ val positionMs: Long,+ val durationMs: Long,+ /** When it happened, ms since 1970 (UTC). */+ val timestamp: Long,+ val source: String,+ /** The list, album or artist it plays from; empty when unknown (a local file, a single song). */+ val contextUri: String = "",+ val shuffle: Boolean = false,+ /** See [TYPES]; null for progress, pause and resume. */+ val reason: String? = null,+ /** The time actually played of this song so far (seeks and pauses excluded), ms. */+ val playedMs: Long = 0,+ /** Where the audio comes from: one of [ORIGINS]. */+ val origin: String = ORIGIN_SPOTIFY,+ /** The id of the extension that supplied the file or the stream; null for Spotify (or unknown). */+ val providerId: String? = null,+) {+ /** Every field present (`reason: null`, `shuffle: false`, `playedMs: 0`), as documented. */+ fun toJson(): String = FULL.encodeToString(serializer(), this)++ companion object {+ private val FULL = kotlinx.serialization.json.Json { encodeDefaults = true; explicitNulls = true }++ /**+ * start (reason: `play` the first song, `next` after one ended, `skip` after one was skipped),+ * progress (every 10 s played), pause, resume, seek (reason `forward` / `backward`),+ * skip (reason `forward` / `backward` / `other`: the song left before its end),+ * end (reason `finished`: played to the end, `stop`: playback stopped or switched to another player).+ * A song that started leaves with exactly one `skip` or `end`.+ */+ val TYPES = listOf("start", "progress", "pause", "resume", "seek", "skip", "end")+ const val LOCAL = "local"+ const val SPOTIFY = "spotify"++ /** Spotify's own stream (the Web Player, or Spotify Connect). */+ const val ORIGIN_SPOTIFY = "spotify"+ /** A song downloaded with a download-source extension. */+ const val ORIGIN_DOWNLOAD = "download"+ /** A stream an audio-source extension gave. */+ const val ORIGIN_AUDIO_SOURCE = "audio-source"+ /** A file on the phone (the device's music, not a download). */+ const val ORIGIN_LOCAL_FILE = "local-file"+ val ORIGINS = listOf(ORIGIN_SPOTIFY, ORIGIN_DOWNLOAD, ORIGIN_AUDIO_SOURCE, ORIGIN_LOCAL_FILE)++ /**+ * The `track` event: the song's fields ([TrackInfo]) and where its audio comes from,+ * `origin` and `providerId` (always present, `providerId: null` for Spotify).+ */+ fun trackEventJson(track: TrackInfo, origin: String, providerId: String?): String {+ val o = FULL.encodeToJsonElement(TrackInfo.serializer(), track).jsonObject+ return JsonObject(o + mapOf("origin" to JsonPrimitive(origin), "providerId" to JsonPrimitive(providerId))).toString()+ }+ }+}diff --git a/base/extensions/src/main/kotlin/app/myspoti/extensions/Host.kt b/base/extensions/src/main/kotlin/app/myspoti/extensions/Host.ktnew file mode 100644index 00000000..3f3a60e5--- /dev/null+++ b/base/extensions/src/main/kotlin/app/myspoti/extensions/Host.kt@@ -0,0 +1,193 @@+package app.myspoti.extensions++import kotlinx.serialization.Serializable+import java.io.ByteArrayOutputStream+import java.net.HttpURLConnection+import java.net.URI++/**+ * What the app gives the sandbox. Every call arrives here already checked against the rights the+ * user granted (see [ExtensionRuntime]): an implementation only does the work.+ */+interface Host {+ /** A request to one of the extension's hosts, without cookies or any account. */+ fun http(extensionId: String, request: HttpRequest): HttpResponse = BasicHttp.send(request, userAgent(extensionId))++ fun log(extensionId: String, message: String)++ /** The extension's own small store (key → JSON text). */+ fun storage(extensionId: String): Storage++ /** The user's value for one of the extension's settings, as JSON text, or null when unset. */+ fun setting(extensionId: String, key: String): String?++ /** The song playing now, as the hooks receive a track (JSON), or null. */+ fun nowPlaying(): String? = null++ /**+ * play, pause, next, previous, seek (argument: milliseconds), asked by [extensionId]. False when+ * it could not be done, or the app's [PlaybackArbiter] dropped it.+ */+ fun control(extensionId: String, action: String, argument: Long?): Boolean = false++ fun notify(extensionId: String, text: String) = log(extensionId, "notify: $text")++ /** The extension's blocks on [surface] (home, search, menu, player, trackinfo) changed: ask it again when shown. */+ fun refresh(extensionId: String, surface: String) {}++ /** A message from the extension to its own web page, if it is open (JSON text). */+ fun postToPage(extensionId: String, json: String) {}++ /**+ * Runs one `myspoti.spotify` call as the signed-in account and answers its result as JSON.+ * The method is known and the right granted already; [SpotifyDispatcher] does the work over a+ * [app.myspoti.api.MyspotiApi]. Suspends: the script's thread waits, within its time limit.+ */+ suspend fun spotify(extensionId: String, call: SpotifyCall): String = throw UnsupportedOperationException("this app has no Spotify account for extensions")++ /** Whether the raw GraphQL operation [name] changes something. Unknown to the host: it does. */+ fun spotifyMutation(name: String): Boolean = true++ /**+ * Asks the user to allow a destructive change an extension is about to make ([text] says what,+ * in plain words). False refuses it, which is also what a host without a screen answers.+ */+ suspend fun confirm(extensionId: String, text: String): Boolean = false++ /** The writes the user allowed [extensionId] for good on `raw.request` ([RawGrant]). */+ fun rawGrants(extensionId: String): List<RawGrant> = emptyList()++ /**+ * Like [confirm], for a `raw.request` write, with a third answer: always allow [offer] to this+ * extension. On [Consent.ALWAYS] the host keeps [offer] and lists it in the extension's rights,+ * where the user revokes it. A host that cannot keep grants asks a plain [confirm].+ */+ suspend fun confirmWrite(extensionId: String, text: String, offer: RawGrant): Consent =+ if (confirm(extensionId, text)) Consent.ONCE else Consent.REFUSE++ /**+ * Opens a sign-in page for [extensionId] ([Action.WEBVIEW_AUTH], [AuthRequest] checked) and+ * returns at once with its id; the outcome comes later as the `auth` event ([AuthResult]).+ * The page runs in a web view of its own: its cookies are never the app's, never Spotify's,+ * never given to the extension. Throws when it cannot be opened now.+ */+ fun openAuth(extensionId: String, request: AuthRequest): String = throw UnsupportedOperationException("this app has no sign-in pages for extensions")++ /**+ * Asks for the `online` event once the device has a network ([Action.NETWORK]): at once when+ * it has one, else when it comes back, also after the app was restarted. Asking again before+ * it fires changes nothing.+ */+ fun whenOnline(extensionId: String) {}++ fun userAgent(extensionId: String) = "Myspoti-Extension/$API_VERSION ($extensionId)"+}++interface Storage {+ fun get(key: String): String?+ fun set(key: String, json: String)+ fun remove(key: String)+ /** Characters stored, to keep the store small. */+ fun size(): Int+}++/** A store in memory, for tests and the desktop runner. */+class MemoryStorage : Storage {+ private val values = java.util.concurrent.ConcurrentHashMap<String, String>()+ override fun get(key: String) = values[key]+ override fun set(key: String, json: String) { values[key] = json }+ override fun remove(key: String) { values.remove(key) }+ override fun size() = values.entries.sumOf { it.key.length + it.value.length }+ fun snapshot(): Map<String, String> = values.toMap()+}++/**+ * `myspoti.auth.open({ url, callback, hidden? })`: where the sign-in starts, and the address it ends+ * on. [hidden]: the page first runs out of sight (a check that passes by itself needs no screen) and+ * is shown only if it has not reached the callback after [Companion.HIDDEN_MS].+ */+@Serializable+data class AuthRequest(val url: String, val callback: String, val hidden: Boolean = false) {+ /** This request, or why it is refused. */+ fun checked(): AuthRequest {+ val start = runCatching { URI(url) }.getOrNull() ?: throw IllegalArgumentException("auth.open: not a URL: $url")+ require(start.scheme == "https" && !start.host.isNullOrEmpty()) { "auth.open: the url must be https" }+ require(!RawRequest.isSpotifyHost(start.host.lowercase())) { "auth.open: not on a Spotify address" }+ val end = runCatching { URI(callback) }.getOrNull() ?: throw IllegalArgumentException("auth.open: not a URL: $callback")+ val scheme = end.scheme?.lowercase() ?: throw IllegalArgumentException("auth.open: the callback needs a scheme")+ require(scheme !in UNSAFE_SCHEMES) { "auth.open: a $scheme: callback is not allowed" }+ if (scheme == "https") require(!end.host.isNullOrEmpty() && !RawRequest.isSpotifyHost(end.host.lowercase())) { "auth.open: the callback must name a host that is not Spotify's" }+ else require(scheme.matches(Regex("[a-z][a-z0-9+.-]{1,40}"))) { "auth.open: the callback is https or a custom scheme (myextension://done)" }+ require(url.length <= 8_192 && callback.length <= 1_024) { "auth.open: address too long" }+ return this+ }++ /** Whether the page reached the callback: [address] starts with it (its query and fragment are the answer). */+ fun reached(address: String): Boolean = address.startsWith(callback, ignoreCase = false) &&+ address.length.let { it == callback.length || address[callback.length] in "?#/&" || callback.last() in "?#/&=" }++ companion object {+ /** How long a hidden sign-in runs out of sight before it is shown. */+ const val HIDDEN_MS = 8_000L+ /** A sign-in that has not reached its callback by then ends with the error "timeout". */+ const val TIMEOUT_MS = 180_000L+ private val UNSAFE_SCHEMES = setOf("http", "javascript", "data", "file", "content", "intent", "about", "blob", "filesystem", "ws", "wss")+ }+}++/** The `auth` event: `{ id, url }` when the callback was reached (with its query), `{ id, error }` otherwise. */+@Serializable+data class AuthResult(val id: String, val url: String? = null, val error: String? = null)++@Serializable+data class HttpRequest(+ val url: String,+ val method: String = "GET",+ val headers: Map<String, String> = emptyMap(),+ val body: String? = null,+ /** Milliseconds; capped by the sandbox. */+ val timeout: Int = 15_000,+)++@Serializable+data class HttpResponse(val status: Int, val headers: Map<String, String>, val body: String)++/** Plain HTTP for extensions: no cookies, no cache, a size cap, redirects only to https. */+object BasicHttp {+ const val MAX_BODY = 5 * 1024 * 1024+ private val METHODS = setOf("GET", "POST", "PUT", "PATCH", "DELETE", "HEAD")+ /** Set by the transport itself: an extension cannot pretend to be another client this way. */+ private val FORBIDDEN_HEADERS = setOf("host", "content-length", "connection", "cookie", "transfer-encoding")++ fun send(request: HttpRequest, userAgent: String): HttpResponse {+ val method = request.method.uppercase()+ require(method in METHODS) { "method $method is not allowed" }+ val c = URI(request.url).toURL().openConnection() as HttpURLConnection+ c.instanceFollowRedirects = false+ c.useCaches = false+ c.connectTimeout = request.timeout.coerceIn(1_000, 20_000)+ c.readTimeout = request.timeout.coerceIn(1_000, 20_000)+ c.requestMethod = method+ c.setRequestProperty("User-Agent", userAgent)+ request.headers.forEach { (k, v) -> if (k.lowercase() !in FORBIDDEN_HEADERS) c.setRequestProperty(k, v) }+ if (request.body != null && method != "GET" && method != "HEAD") {+ c.doOutput = true+ c.outputStream.use { it.write(request.body.toByteArray()) }+ }+ val status = c.responseCode+ val stream = if (status >= 400) c.errorStream else runCatching { c.inputStream }.getOrNull()+ val out = ByteArrayOutputStream()+ stream?.use { s ->+ val buf = ByteArray(16 * 1024)+ while (true) {+ val n = s.read(buf)+ if (n < 0) break+ out.write(buf, 0, n)+ if (out.size() > MAX_BODY) throw IllegalStateException("response larger than ${MAX_BODY / 1024 / 1024} MB")+ }+ }+ val headers = c.headerFields.filterKeys { it != null }.mapKeys { it.key.lowercase() }.mapValues { it.value.joinToString(", ") }+ c.disconnect()+ return HttpResponse(status, headers, out.toString(Charsets.UTF_8))+ }+}diff --git a/base/extensions/src/main/kotlin/app/myspoti/extensions/Manifest.kt b/base/extensions/src/main/kotlin/app/myspoti/extensions/Manifest.ktnew file mode 100644index 00000000..f400cb24--- /dev/null+++ b/base/extensions/src/main/kotlin/app/myspoti/extensions/Manifest.kt@@ -0,0 +1,320 @@+package app.myspoti.extensions++import kotlinx.serialization.Serializable+import kotlinx.serialization.json.Json+import kotlinx.serialization.json.JsonElement++/** The version of the extension API this build of Myspoti speaks. An extension asks for one. */+const val API_VERSION = 1++internal val ExtJson = Json { ignoreUnknownKeys = true; encodeDefaults = false; explicitNulls = false }++/**+ * `manifest.json`, at the root of an extension's package: who made it and what it does in the+ * app ([actions], from the app's closed catalogue). Everything the user is asked before+ * installing comes from here, and the sandbox enforces exactly this, nothing more.+ */+@Serializable+data class Manifest(+ /** Reverse-domain, lower case: `io.github.someone.lyrics`. Never changes between versions. */+ val id: String,+ val name: String,+ /** Shown to people: "1.2.0". */+ val version: String,+ /** Compared between versions: higher is newer. */+ val versionCode: Int = 1,+ val apiVersion: Int = API_VERSION,+ val author: String,+ val description: String = "",+ val homepage: String? = null,+ /** The script that runs: one file, in the package. */+ val main: String = "main.js",+ /**+ * What the extension does, from the app's catalogue ([Action]), each with its reason:+ * `[{ "name": "lyrics.provide", "why": "Synced lyrics from LRCLIB" }, { "name": "network", "hosts": ["lrclib.net"], "why": "…" }]`.+ */+ val actions: List<ActionRequest> = emptyList(),+ /** Old format (before [actions]): the hooks it takes over. Still read, mapped to actions. */+ val provides: List<String> = emptyList(),+ /** Old format: what it reaches. Still read, mapped to actions. */+ val permissions: List<PermissionRequest> = emptyList(),+ /** Options the user sets on the extension's page, read with `myspoti.settings.get(key)`. */+ val settings: List<Setting> = emptyList(),+ /**+ * A PNG at the root of the package shown as the extension's icon (square, 256 px or less).+ * Absent: `icon.png` when the package has one, else a tinted letter.+ */+ val icon: String? = null,+ /** A [Category] key, to file it in the store; checked against [actions], else "other" ([Category.of]). */+ val category: String? = null,+ /** Words the store's search also finds: 8 at most, lower case. */+ val tags: List<String> = emptyList(),+ /**+ * The oldest Myspoti it works on ("2.0.2", compared as [AppVersion]); an older app shows+ * "Requires Myspoti 2.0.2 or newer" and does not install it.+ */+ val minAppVersion: String? = null,+ /** What changed in this version, in a few lines: shown on the store page and before an update. */+ val changelog: String = "",+ /** What the extension does and what is left to do, shown once right after it is first installed. */+ val welcome: Welcome? = null,+ /** Extensions (ids) this one takes the place of: installing it offers to turn them off. */+ val replaces: List<String> = emptyList(),+ /** Extensions (ids) that must not run with this one: the user is asked which to keep. */+ val conflictsWith: List<String> = emptyList(),+) {+ /** True for a manifest written before actions (`provides` and `permissions`): still loaded, mapped to actions. */+ val isLegacy: Boolean get() = actions.isEmpty() && (provides.isNotEmpty() || permissions.isNotEmpty())++ /**+ * The actions this extension asks, in the manifest's order. An old manifest's hooks and+ * permissions are mapped ([Action.LEGACY]), its reasons kept (cut to 80 characters); storage,+ * which every old extension had, is added, and the settings page when it has settings.+ */+ fun declared(): List<ActionRequest> {+ if (!isLegacy) return actions+ val out = LinkedHashMap<String, ActionRequest>()+ fun put(a: Action, why: String, hosts: List<String> = emptyList()) {+ val before = out[a.key]+ out[a.key] = ActionRequest(a.key, (before?.why?.ifBlank { null } ?: why).take(Action.WHY_MAX), (before?.hosts.orEmpty() + hosts).distinct())+ }+ provides.forEach { h -> Action.LEGACY[h]?.forEach { put(it, why(h)) } }+ permissions.forEach { p -> Action.LEGACY[p.name]?.takeIf { Hook.ofLegacy(p.name) == null }?.forEach { put(it, p.why, if (it == Action.NETWORK) p.hosts else emptyList()) } }+ if (settings.isNotEmpty()) put(Action.SETTINGS_PAGE, "")+ put(Action.STORAGE, "")+ return out.values.toList()+ }++ /** The [Action]s declared that this Myspoti knows. */+ fun actionSet(): Set<Action> = declared().mapNotNull { Action.of(it.name) }.toSet()++ fun declares(a: Action): Boolean = declared().any { it.name == a.key }++ /**+ * The writes `spotify.raw` lists, as the grants they become at install ([RawRequest.offer]):+ * the same kind of request on another song or playlist is covered, nothing else.+ */+ fun declaredWrites(): List<RawGrant> = declared().firstOrNull { it.name == Action.SPOTIFY_RAW.key }?.writes.orEmpty()+ .mapNotNull { w -> runCatching { w.trim().split(Regex("\\s+"), 2).let { (m, u) -> RawRequest.offer(RawRequest.check(m, u), u) } }.getOrNull() }+ .distinct()++ /** The hosts `network` lists. */+ fun hosts(): List<String> = declared().firstOrNull { it.name == Action.NETWORK.key }?.hosts.orEmpty()++ /** What the user is asked to accept, in the manifest's order; network to any host is `network.any`, critical. */+ fun asks(): List<Ask> = declared().mapNotNull { r ->+ val a = Action.of(r.name) ?: return@mapNotNull null+ if (a == Action.NETWORK && r.hosts.any { it == "*" }) Ask(Action.NETWORK_ANY, Level.CRITICAL, r.why, r.hosts, a)+ else Ask(a.key, a.level, r.why, r.hosts + if (a == Action.SPOTIFY_RAW) declaredWrites().map { it.toString() } else emptyList(), a)+ }++ /** True when the user is shown the warning and has to tick that they accept the risk. */+ fun isCritical(): Boolean = asks().any { it.level == Level.CRITICAL }++ /** The justification the author gives for an old hook, written as a permission named after it. */+ private fun why(key: String) = permissions.firstOrNull { it.name == key }?.why.orEmpty()++ /** Every reason this manifest cannot be installed, for the author (empty: it can). */+ fun problems(): List<String> = buildList {+ if (!ID.matches(id)) add("id \"$id\": lower case, reverse-domain, at least two parts (io.github.you.name)")+ if (name.isBlank() || name.length > 40) add("name: 1 to 40 characters")+ if (version.isBlank() || version.length > 20) add("version: 1 to 20 characters")+ if (versionCode < 1) add("versionCode: 1 or more")+ if (apiVersion < 1 || apiVersion > API_VERSION) add("apiVersion $apiVersion: this Myspoti speaks $API_VERSION")+ if (author.isBlank() || author.length > 60) add("author: 1 to 60 characters")+ if (description.length > 500) add("description: 500 characters at most")+ if (!main.endsWith(".js") || main.contains("/") || main.contains("\\")) add("main \"$main\": a .js file at the root of the package")+ if (actions.isNotEmpty() && (provides.isNotEmpty() || permissions.isNotEmpty()))+ add("actions: list everything there; provides and permissions are the old format and cannot be mixed with it")+ if (isLegacy) legacyProblems() else actionProblems()+ settings.forEach { s ->+ if (!KEY.matches(s.key)) add("setting \"${s.key}\": letters, digits and _ only")+ if (s.type !in Setting.TYPES) add("setting \"${s.key}\": type ${s.type} unknown (${Setting.TYPES.joinToString()})")+ if (s.type == "choice" && s.options.isEmpty()) add("setting \"${s.key}\": a choice needs options")+ if (s.type == "button" && s.default != null) add("setting \"${s.key}\": a button has no default")+ if (s.label.isBlank()) add("setting \"${s.key}\": a label")+ }+ if (settings.size != settings.map { it.key }.toSet().size) add("settings: a key listed twice")+ icon?.let { if (!it.endsWith(".png") || it.contains("/") || it.contains("\\") || it == main) add("icon \"$it\": a .png file at the root of the package") }+ if (tags.size > 8) add("tags: 8 at most")+ tags.filterNot { TAG.matches(it) }.forEach { add("tag \"$it\": 1 to 24 characters, lower case letters, digits, spaces and -") }+ minAppVersion?.let { if (AppVersion.parse(it) == null) add("minAppVersion \"$it\": a version like 2.0.2 or 2.0.2-beta.4") }+ if (changelog.length > 2000) add("changelog: 2000 characters at most")+ welcome?.let { w ->+ if (w.message.isBlank() && w.steps.isEmpty()) add("welcome: a message or steps")+ if (w.message.length > 600) add("welcome.message: 600 characters at most")+ if (w.steps.size > 5) add("welcome.steps: 5 at most")+ if (w.steps.any { it.isBlank() || it.length > 160 }) add("welcome.steps: each 1 to 160 characters")+ }+ for ((field, ids) in listOf("replaces" to replaces, "conflictsWith" to conflictsWith)) {+ if (ids.size > 10) add("$field: 10 ids at most")+ ids.filterNot { ID.matches(it) }.forEach { add("$field \"$it\": an extension id (io.github.you.name)") }+ if (id in ids) add("$field: not its own id")+ }+ }++ /** The rules of `actions`: known names, once each, a why of 1 to 80 characters each, network's hosts. */+ private fun MutableList<String>.actionProblems() {+ if (actions.isEmpty()) add("actions: at least one (known: ${Action.entries.joinToString { it.key }})")+ actions.forEach { r ->+ val a = Action.of(r.name)+ when {+ a == null -> add("action \"${r.name}\": unknown (known: ${Action.entries.joinToString { it.key }})")+ r.why.isBlank() -> add("action \"${r.name}\": say why the extension needs it in \"why\" (1 to ${Action.WHY_MAX} characters), shown next to its icon before install")+ r.why.length > Action.WHY_MAX -> add("action \"${r.name}\": \"why\" is ${r.why.length} characters, ${Action.WHY_MAX} at most")+ }+ if (a == Action.NETWORK) {+ if (r.hosts.isEmpty()) add("network: list the hosts it calls (\"api.example.com\", \"*.example.com\", or \"*\" for any)")+ r.hosts.filterNot { HOST.matches(it) }.forEach { add("network host \"$it\": a host name, *.domain, or *") }+ } else if (a != null && r.hosts.isNotEmpty()) add("action \"${r.name}\": only network takes hosts")+ if (a != null && a != Action.SPOTIFY_RAW && r.writes.isNotEmpty()) add("action \"${r.name}\": only spotify.raw takes writes")+ if (a == Action.SPOTIFY_RAW) {+ if (r.writes.size > MAX_WRITES) add("spotify.raw: $MAX_WRITES writes at most")+ r.writes.forEach { w ->+ val parts = w.trim().split(Regex("\\s+"), 2)+ val why = if (parts.size != 2) "\"METHOD https://host/path\""+ else runCatching { RawRequest.check(parts[0], parts[1]) }.fold(+ { m -> if (m in RawRequest.READS) "a write (POST, PUT, PATCH, DELETE): reads never ask" else null },+ { it.message })+ why?.let { add("spotify.raw write \"$w\": $it") }+ }+ }+ }+ if (actions.size != actions.map { it.name }.toSet().size) add("actions: an action listed twice")+ if (settings.isNotEmpty() && actions.none { it.name == Action.SETTINGS_PAGE.key }) add("settings: add the settings.page action (with its why) to have a settings page")+ }++ /** The rules of an old manifest, as they were: it still installs, mapped to actions. */+ private fun MutableList<String>.legacyProblems() {+ if (provides.isEmpty() && permissions.none { it.name == "player.read" }) add("provides: at least one of ${Hook.LEGACY_KEYS.joinToString()} (or player.read, for an extension that only listens); better: \"actions\"")+ provides.filter { Hook.ofLegacy(it) == null }.forEach { add("provides \"$it\": unknown (known: ${Hook.LEGACY_KEYS.joinToString()})") }+ if (provides.size != provides.toSet().size) add("provides: listed twice")+ permissions.forEach { p ->+ val known = p.name in Action.LEGACY+ val hook = Hook.ofLegacy(p.name)+ when {+ !known -> add("permission \"${p.name}\": unknown (known: ${Action.LEGACY.keys.filter { Hook.ofLegacy(it) == null }.joinToString()})")+ hook != null && hook.key !in provides -> add("permission \"${p.name}\": a justification for a hook the extension does not provide")+ p.name == "network" && p.hosts.isEmpty() -> add("network: list the hosts it calls (\"api.example.com\", \"*.example.com\", or \"*\" for any)")+ p.name == "network" -> p.hosts.filterNot { HOST.matches(it) }.forEach { add("network host \"$it\": a host name, *.domain, or *") }+ }+ }+ if (permissions.size != permissions.map { it.name }.toSet().size) add("permissions: a name listed twice")+ asks().filter { it.level == Level.CRITICAL && it.why.trim().length < 15 }+ .forEach { add("\"${it.key}\" is a critical action: say why the extension needs it in \"why\" (15 to 80 characters), the user reads it before installing") }+ }++ /** Where the store files it: the declared category if its actions fit it, else [Category.OTHER]. */+ fun category(): Category = Category.of(category, actionSet())++ /**+ * Why the declared category is not the one it is filed under, for the author (null: it is).+ * Not a reason to refuse the package: it is filed under "other".+ */+ fun categoryWarning(): String? {+ val c = category ?: return null+ val known = Category.of(c) ?: return "category \"$c\": unknown (known: ${Category.entries.joinToString { it.key }}), filed under other"+ val filed = category()+ return if (filed == known) null else "category \"$c\": filed under ${filed.key} (${if (filed == Category.TOOLS) "it provides downloads" else "it needs one of ${known.needs.joinToString { it.key }}"})"+ }++ companion object {+ private val ID = Regex("^[a-z][a-z0-9_]*(\\.[a-z0-9_]+)+$")+ private val HOST = Regex("^(\\*|(\\*\\.)?[a-z0-9]([a-z0-9-]*[a-z0-9])?(\\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)+)$")+ private val KEY = Regex("^[A-Za-z0-9_]{1,40}$")+ private val TAG = Regex("^[a-z0-9][a-z0-9 -]{0,23}$")+ private const val MAX_WRITES = 8++ fun parse(text: String): Manifest = ExtJson.decodeFromString(serializer(), text)+ }+}++/**+ * `welcome`: a few words after the first install, for what the extension does ([message]) and the+ * little the user still has to do ([steps], in order: "Pair your account in Settings → Extensions").+ */+@Serializable+data class Welcome(val message: String = "", val steps: List<String> = emptyList())++@Serializable+data class PermissionRequest(+ /** A [Permission] key, or a [Hook] key to give the reason for a takeover. */+ val name: String,+ /** network only: the hosts it may call. */+ val hosts: List<String> = emptyList(),+ /** Why the extension needs it, in the author's words: shown to the user for sensitive rights. */+ val why: String = "",+)++@Serializable+data class Setting(+ val key: String,+ /**+ * text, secret (a password field, never logged), toggle, number, choice, or button: no value,+ * a button that sends the `setting` event with `pressed` (pair again, clear a cache…).+ */+ val type: String = "text",+ val label: String,+ val description: String = "",+ val default: JsonElement? = null,+ /** choice only. */+ val options: List<String> = emptyList(),+) {+ companion object {+ val TYPES = listOf("text", "secret", "toggle", "number", "choice", "button")+ }+}++/**+ * One line of the install prompt and the detail pages: an [Action] (or `network.any`), its level,+ * the author's reason and, for network, the hosts.+ */+data class Ask(val key: String, val level: Level, val why: String = "", val hosts: List<String> = emptyList(), val action: Action? = Action.of(key)) {+ val critical: Boolean get() = level == Level.CRITICAL+}++/**+ * A point where the app calls the script: `myspoti.provide(key, fn)`. Each is unlocked by one+ * [action] (null for `tap`: unlocked by any action whose answer is drawn as blocks).+ */+enum class Hook(val key: String, val action: Action?) {+ /** Lyrics for a song, asked along the app's own sources. */+ LYRICS("lyrics", Action.LYRICS_PROVIDE),+ /** Where a song's audio comes from; it then plays in Myspoti's own player, like a download. */+ AUDIO_SOURCE("audio-source", Action.AUDIO_SOURCE),+ /** The files a song can be downloaded from: the app downloads, checks, encrypts and keeps them. */+ DOWNLOAD_SOURCE("download-source", Action.DOWNLOAD_SOURCE),+ /** Blocks under a song's credits. */+ TRACK_INFO("trackinfo", Action.TRACKINFO_PROVIDE),+ /** Sections at the end of Home. */+ HOME("home", Action.HOME_SECTIONS),+ /** Blocks under the search results. */+ SEARCH("search", Action.SEARCH_PROVIDE),+ /** Entries at the end of the ⋯ menus of songs, albums, playlists and artists. */+ MENU("menu", Action.MENU_ITEMS),+ /** Buttons under the player's own controls. */+ PLAYER("player", Action.PLAYER_BUTTONS),+ /** Its web page: `{ title, html }`. */+ PAGE("page", Action.WEBVIEW_PAGE),+ /** A message its web page posted; the answer is posted back to the page. */+ MESSAGE("message", Action.WEBVIEW_PAGE),+ /** A block with an `action` was tapped: `{ action, surface, context }`. */+ TAP("tap", null),+ /** Whether its source answers now: `{ live, detail? }` ([ExtensionStatus]). Any extension may provide it. */+ STATUS("status", null);++ /** Whether this hook's answer is drawn as blocks (suspended while a protected surface shows). */+ val drawn: Boolean get() = action in Action.BLOCKS || action == Action.WEBVIEW_PAGE || this == TAP++ /** Provided without an action of its own: `status`. */+ val free: Boolean get() = this == STATUS++ companion object {+ fun of(key: String) = entries.firstOrNull { it.key == key }++ /** The three hooks old manifests could list in `provides`. */+ val LEGACY_KEYS = listOf(LYRICS.key, AUDIO_SOURCE.key, DOWNLOAD_SOURCE.key)++ fun ofLegacy(key: String) = if (key in LEGACY_KEYS) of(key) else null+ }+}diff --git a/base/extensions/src/main/kotlin/app/myspoti/extensions/Package.kt b/base/extensions/src/main/kotlin/app/myspoti/extensions/Package.ktnew file mode 100644index 00000000..95d5543e--- /dev/null+++ b/base/extensions/src/main/kotlin/app/myspoti/extensions/Package.kt@@ -0,0 +1,100 @@+package app.myspoti.extensions++import java.io.ByteArrayInputStream+import java.io.ByteArrayOutputStream+import java.io.File+import java.security.MessageDigest+import java.util.zip.ZipEntry+import java.util.zip.ZipInputStream+import java.util.zip.ZipOutputStream++/**+ * An extension as it travels: a zip with `manifest.json`, its script and, if it likes, an+ * icon (`icon.png`, or the PNG the manifest's `icon` names: square, 256 px or less) and a+ * `LICENSE`. Nothing else is read.+ */+class ExtensionPackage(val manifest: Manifest, val script: String, val icon: ByteArray?, val sha256: String) {+ companion object {+ const val MAX_ZIP = 2 * 1024 * 1024+ const val MAX_SCRIPT = 1024 * 1024+ const val MAX_ICON = 256 * 1024+ private val KEPT = setOf("manifest.json", "icon.png", "LICENSE", "LICENSE.txt", "README.md")++ /** Reads and checks a package. Throws [ExtensionException] with the reason it is refused. */+ fun read(zip: ByteArray): ExtensionPackage {+ if (zip.size > MAX_ZIP) throw ExtensionException("package larger than ${MAX_ZIP / 1024 / 1024} MB")+ val files = HashMap<String, ByteArray>()+ ZipInputStream(ByteArrayInputStream(zip)).use { z ->+ var count = 0+ while (true) {+ val e = z.nextEntry ?: break+ if (++count > 30) throw ExtensionException("package has more than 30 files")+ if (e.isDirectory) continue+ val name = e.name+ if (name.contains("..") || name.startsWith("/") || name.contains('\\')) throw ExtensionException("package path not allowed: $name")+ files[name] = z.readLimited(MAX_SCRIPT + 1)+ }+ }+ val manifestBytes = files["manifest.json"] ?: throw ExtensionException("no manifest.json at the root of the package")+ val manifest = runCatching { Manifest.parse(manifestBytes.decodeToString()) }+ .getOrElse { throw ExtensionException("manifest.json: ${it.message?.lineSequence()?.firstOrNull()}") }+ manifest.problems().takeIf { it.isNotEmpty() }?.let { throw ExtensionException("manifest.json: " + it.joinToString("; ")) }+ val script = files[manifest.main] ?: throw ExtensionException("${manifest.main} (main) is not in the package")+ if (script.size > MAX_SCRIPT) throw ExtensionException("${manifest.main} larger than 1 MB")+ val iconName = manifest.icon ?: "icon.png"+ if (manifest.icon != null && iconName !in files) throw ExtensionException("$iconName (icon) is not in the package")+ val icon = files[iconName]?.also { if (it.size > MAX_ICON) throw ExtensionException("$iconName larger than 256 KB") }+ (files.keys - KEPT - manifest.main - iconName).takeIf { it.isNotEmpty() }?.let { throw ExtensionException("files not used by Myspoti in the package: ${it.joinToString()}") }+ return ExtensionPackage(manifest, script.decodeToString(), icon, sha256(zip))+ }++ /**+ * Builds the package from an extension's folder, the same bytes every time for the same+ * files (fixed order and dates), so its sha256 can be checked by anyone who builds it.+ */+ fun pack(dir: File): ByteArray {+ val manifest = Manifest.parse(File(dir, "manifest.json").readText())+ val names = (listOf("manifest.json", manifest.main) + listOfNotNull(manifest.icon) + KEPT.filter { File(dir, it).isFile }).distinct()+ return zip(names.associateWith { name -> File(dir, name).takeIf { it.isFile }?.readBytes() ?: throw ExtensionException("$name is missing in ${dir.path}") })+ }++ /**+ * The package made of the files at the root of an extension's folder, given as [files]+ * (name → bytes): the manifest, its script, its icon and the [KEPT] files; anything else+ * (a repository's README images, workflows, sources) is left out. Same bytes as [pack].+ */+ fun packFiles(files: Map<String, ByteArray>): ByteArray {+ val manifestBytes = files["manifest.json"] ?: throw ExtensionException("no manifest.json at the root of the repository")+ val manifest = runCatching { Manifest.parse(manifestBytes.decodeToString()) }+ .getOrElse { throw ExtensionException("manifest.json: ${it.message?.lineSequence()?.firstOrNull()}") }+ val names = (listOf("manifest.json", manifest.main) + listOfNotNull(manifest.icon) + KEPT.filter { it in files }).distinct()+ return zip(names.associateWith { files[it] ?: throw ExtensionException("$it is missing in the repository") })+ }++ private fun zip(files: Map<String, ByteArray>): ByteArray {+ val out = ByteArrayOutputStream()+ ZipOutputStream(out).use { z ->+ for ((name, bytes) in files) {+ z.putNextEntry(ZipEntry(name).apply { time = 315532800000L })+ z.write(bytes)+ z.closeEntry()+ }+ }+ return out.toByteArray()+ }++ fun sha256(bytes: ByteArray): String = MessageDigest.getInstance("SHA-256").digest(bytes).joinToString("") { "%02x".format(it) }++ private fun ZipInputStream.readLimited(limit: Int): ByteArray {+ val out = ByteArrayOutputStream()+ val buf = ByteArray(8192)+ while (true) {+ val n = read(buf)+ if (n < 0) break+ out.write(buf, 0, n)+ if (out.size() > limit) break+ }+ return out.toByteArray()+ }+ }+}diff --git a/base/extensions/src/main/kotlin/app/myspoti/extensions/Sources.kt b/base/extensions/src/main/kotlin/app/myspoti/extensions/Sources.ktnew file mode 100644index 00000000..29709a20--- /dev/null+++ b/base/extensions/src/main/kotlin/app/myspoti/extensions/Sources.kt@@ -0,0 +1,193 @@+package app.myspoti.extensions++import kotlinx.serialization.Serializable+import java.io.ByteArrayInputStream+import java.io.ByteArrayOutputStream+import java.net.URLEncoder+import java.util.zip.ZipInputStream++/**+ * A GitHub repository an extension is installed from: `owner/name`. Everything is fetched from+ * GitHub's file hosts (`raw.githubusercontent.com`, `codeload.github.com`, release downloads),+ * never from its API, which allows 60 calls an hour without an account: the API is only used+ * for the store's search (see [Discovery]), once per visit and cached.+ */+@Serializable+data class GitHubRepo(val owner: String, val name: String) {+ val slug: String get() = "$owner/$name"++ /** A file of the repository at [ref] (a tag, a branch, or `HEAD` for the default branch). */+ fun raw(ref: String, path: String) = "https://raw.githubusercontent.com/$owner/$name/$ref/$path"++ /** The whole repository at [ref], zipped: a tag when [tag], else a branch (`HEAD`: the default one). */+ fun archive(ref: String, tag: Boolean) =+ if (ref == HEAD) "https://codeload.github.com/$owner/$name/zip/HEAD"+ else "https://codeload.github.com/$owner/$name/zip/refs/${if (tag) "tags" else "heads"}/$ref"++ /** Redirects to the newest release's page (`…/releases/tag/<tag>`); 404 without a release. */+ val latestRelease: String get() = "https://github.com/$owner/$name/releases/latest"++ /** The package attached to the release [tag], when the author attached one ([GitHub.ASSET]). */+ fun releaseAsset(tag: String) = "https://github.com/$owner/$name/releases/download/$tag/${GitHub.ASSET}"++ val page: String get() = "https://github.com/$owner/$name"++ companion object {+ const val HEAD = "HEAD"+ private val PART = Regex("^[A-Za-z0-9_.-]{1,100}$")++ /** `owner/name`, `github.com/owner/name` or `https://github.com/owner/name(.git)(/…)`; null otherwise. */+ fun parse(text: String): GitHubRepo? {+ var s = text.trim().removeSuffix("/")+ s = s.removePrefix("https://").removePrefix("http://").removePrefix("www.")+ if (s.startsWith("github.com/")) s = s.removePrefix("github.com/")+ else if (s.contains("://") || s.contains('.') && s.substringBefore('/').contains('.')) return null+ val parts = s.split('/')+ if (parts.size < 2) return null+ val owner = parts[0]+ val name = parts[1].removeSuffix(".git")+ if (!PART.matches(owner) || !PART.matches(name) || name == "." || name == "..") return null+ return GitHubRepo(owner, name)+ }+ }+}++/**+ * Where an installed extension came from on GitHub: [repo] (`owner/name`), the [ref] read (a+ * release tag when [tag], else a branch or `HEAD`), the [commit] when GitHub gave it (in the+ * archive), and whether the package was the release's own [asset] or built from the archive.+ */+@Serializable+data class Origin(+ val repo: String,+ val ref: String = GitHubRepo.HEAD,+ val tag: Boolean = false,+ val commit: String? = null,+ val asset: Boolean = false,+) {+ fun gitHub(): GitHubRepo? = GitHubRepo.parse(repo)++ /** "v1.2.0 · 3f2a9c1" for the details. */+ fun label(): String = listOfNotNull(ref.takeIf { it != GitHubRepo.HEAD }, commit?.take(7)).joinToString(" · ").ifEmpty { ref }+}++/** The constants shared by the app and the tools: the official repository, the package's name in a release. */+object GitHub {+ /** The official repository: its `blocked.json` turns extensions off everywhere, the store's reports go to it. */+ const val OFFICIAL_REPO = "kota-zo/myspoti-extensions"++ /** The kill switch, read once a day; a 404 (not created yet) is an empty list. */+ const val BLOCKED_URL = "https://raw.githubusercontent.com/$OFFICIAL_REPO/main/blocked.json"++ /** The package an author attaches to a release, when they do: else the release's archive is read. */+ const val ASSET = "extension.zip"++ /** At most this much of a repository's archive is read (it is cut down to the package after). */+ const val MAX_ARCHIVE = 8 * 1024 * 1024++ /** The tag a `releases/latest` redirect points to (`…/releases/tag/v1.2.0` → `v1.2.0`); null otherwise. */+ fun tagFromLocation(location: String?): String? {+ val l = location ?: return null+ val i = l.indexOf("/releases/tag/")+ if (i < 0) return null+ return java.net.URLDecoder.decode(l.substring(i + "/releases/tag/".length).substringBefore('?').substringBefore('#'), "UTF-8").takeIf { it.isNotBlank() }+ }++ /**+ * The repository a GitHub address is in (`github.com/o/r/…`, `codeload.github.com/o/r/…`,+ * `raw.githubusercontent.com/o/r/…`), as `owner/name`: where a download really came from,+ * after GitHub's redirects (a repository renamed or moved to another owner); null otherwise.+ */+ fun repoOf(url: String?): String? {+ val u = runCatching { java.net.URI(url ?: return null) }.getOrNull() ?: return null+ if (u.host !in setOf("github.com", "codeload.github.com", "raw.githubusercontent.com")) return null+ val parts = u.path.orEmpty().trim('/').split('/')+ if (parts.size < 2) return null+ return GitHubRepo.parse(parts[0] + "/" + parts[1])?.slug+ }++ /**+ * A prefilled "report an extension" form on the official repository, opened in the browser:+ * no account in the app, nothing about the user in it (the extension's id, version, source+ * and package hash only; the reporter writes the rest). The ids are those of the fields of+ * the repository's `report-extension.yml` issue form.+ */+ fun reportUrl(id: String, version: String, repo: String?, sha256: String?): String = buildString {+ append("https://github.com/").append(OFFICIAL_REPO).append("/issues/new?template=report-extension.yml&labels=report")+ append("&title=").append(enc("Report: $id"))+ append("&extension=").append(enc(id)).append("&version=").append(enc(version))+ repo?.let { append("&source=").append(enc("https://github.com/$it")) }+ sha256?.let { append("&sha256=").append(enc(it)) }+ }++ private fun enc(s: String) = URLEncoder.encode(s, "UTF-8").replace("+", "%20")+}++/**+ * A repository's zipped archive (`codeload.github.com/…/zip/…`), as an extension package: the+ * files at the root of the archive's single top folder, cut down to what a package holds+ * ([ExtensionPackage.packFiles]). GitHub writes the commit in the archive's comment.+ */+object Archive {+ private const val MAX_ENTRIES = 3000++ /** A downloaded zip as a package: as is when it is one (manifest at its root), else cut from an archive. */+ fun toPackage(zip: ByteArray): ByteArray = if (rootNames(zip).contains("manifest.json")) zip else fromArchive(zip)++ /** The package built from a repository archive's root files. */+ fun fromArchive(zip: ByteArray): ByteArray {+ if (zip.size > GitHub.MAX_ARCHIVE) throw ExtensionException("repository archive larger than ${GitHub.MAX_ARCHIVE / 1024 / 1024} MB")+ val files = HashMap<String, ByteArray>()+ var top: String? = null+ ZipInputStream(ByteArrayInputStream(zip)).use { z ->+ var count = 0+ while (true) {+ val e = z.nextEntry ?: break+ if (++count > MAX_ENTRIES) throw ExtensionException("repository archive has more than $MAX_ENTRIES files")+ val name = e.name+ if (name.contains("..") || name.startsWith("/") || name.contains('\\')) throw ExtensionException("archive path not allowed: $name")+ val first = name.substringBefore('/')+ if (top == null) top = first else if (top != first) throw ExtensionException("not a GitHub archive (several top folders)")+ val rest = name.substringAfter('/', "")+ if (e.isDirectory || rest.isEmpty() || rest.contains('/')) continue+ files[rest] = z.readUpTo(ExtensionPackage.MAX_SCRIPT + 1)+ }+ }+ return ExtensionPackage.packFiles(files)+ }++ /** The commit GitHub wrote in an archive's comment (40 hex digits), or null. */+ fun commit(zip: ByteArray): String? = comment(zip)?.trim()?.takeIf { COMMIT.matches(it) }++ /** The zip's comment, from its end-of-central-directory record. */+ fun comment(zip: ByteArray): String? {+ // The record is 22 bytes plus a comment of at most 65535: look for its signature from the end.+ val stop = maxOf(0, zip.size - 22 - 0xFFFF)+ for (i in zip.size - 22 downTo stop) {+ if (zip[i] == 0x50.toByte() && zip[i + 1] == 0x4b.toByte() && zip[i + 2] == 0x05.toByte() && zip[i + 3] == 0x06.toByte()) {+ val len = (zip[i + 20].toInt() and 0xff) or ((zip[i + 21].toInt() and 0xff) shl 8)+ if (i + 22 + len > zip.size) return null+ return String(zip, i + 22, len, Charsets.UTF_8)+ }+ }+ return null+ }++ private val COMMIT = Regex("^[0-9a-f]{40}$")++ private fun rootNames(zip: ByteArray): Set<String> = runCatching {+ buildSet { ZipInputStream(ByteArrayInputStream(zip)).use { z -> var n = 0; while (n++ < MAX_ENTRIES) add((z.nextEntry ?: break).name) } }+ }.getOrDefault(emptySet())++ private fun ZipInputStream.readUpTo(limit: Int): ByteArray {+ val out = ByteArrayOutputStream()+ val buf = ByteArray(8192)+ while (true) {+ val n = read(buf)+ if (n < 0) break+ out.write(buf, 0, n)+ if (out.size() > limit) break+ }+ return out.toByteArray()+ }+}diff --git a/base/extensions/src/main/kotlin/app/myspoti/extensions/SpotifyDispatcher.kt b/base/extensions/src/main/kotlin/app/myspoti/extensions/SpotifyDispatcher.ktnew file mode 100644index 00000000..2d90c341--- /dev/null+++ b/base/extensions/src/main/kotlin/app/myspoti/extensions/SpotifyDispatcher.kt@@ -0,0 +1,69 @@+package app.myspoti.extensions++import app.myspoti.api.MyspotiApi+import kotlinx.serialization.json.JsonArray+import kotlinx.serialization.json.JsonElement+import kotlinx.serialization.json.JsonNull+import kotlinx.serialization.json.JsonPrimitive+import kotlinx.serialization.json.buildJsonArray+import kotlinx.serialization.json.buildJsonObject+import java.lang.reflect.Modifier++/**+ * Runs the `myspoti.spotify` calls of extensions over a [MyspotiApi] (and [raw], when the host+ * gives the raw door). A host implements [Host.spotify] with it:+ *+ * override suspend fun spotify(extensionId: String, call: SpotifyCall) = dispatcher.execute(call)+ *+ * It checks nothing about rights: [ExtensionRuntime] has done that, from [SpotifyMethods].+ */+class SpotifyDispatcher(api: MyspotiApi, private val raw: SpotifyRaw? = null, media: PlayerMedia? = null) {+ private val backend = SpotifyBackend(api, raw, media)++ /** The call's result as JSON text (`null` for a method that returns nothing). */+ suspend fun execute(call: SpotifyCall): String {+ val method = SpotifyMethods.find(call.area, call.method) ?: throw IllegalArgumentException("spotify.${call.area}.${call.method}: unknown method")+ val args = ExtJson.parseToJsonElement(call.argsJson) as? JsonArray ?: throw IllegalArgumentException("spotify.${call.area}.${call.method}: arguments must be a list")+ return JsonModel.encode(method.run(backend, SpotifyArgs(args, "spotify.${method.key}"))).toString()+ }++ /** For [Host.spotifyMutation]: whether the raw GraphQL operation changes something (true when there is no raw door). */+ fun isMutation(operation: String): Boolean = raw?.isMutation(operation) ?: true+}++/**+ * The API's models are plain Kotlin classes, not `@Serializable`: this turns a result into JSON+ * by reading their fields (the field names are the property names). Enums are their names,+ * [Unit] and null are null, byte arrays are base64.+ */+internal object JsonModel {+ private const val MAX_DEPTH = 12++ fun encode(value: Any?, depth: Int = 0): JsonElement {+ if (depth > MAX_DEPTH) return JsonNull+ return when (value) {+ null, Unit -> JsonNull+ is JsonElement -> value+ is Boolean -> JsonPrimitive(value)+ is Number -> JsonPrimitive(value)+ is String -> JsonPrimitive(value)+ is Char -> JsonPrimitive(value.toString())+ is Enum<*> -> JsonPrimitive(value.name)+ is ByteArray -> JsonPrimitive(java.util.Base64.getEncoder().encodeToString(value))+ is Map<*, *> -> buildJsonObject { value.forEach { (k, v) -> put(k.toString(), encode(v, depth + 1)) } }+ is Iterable<*> -> buildJsonArray { value.forEach { add(encode(it, depth + 1)) } }+ is Array<*> -> buildJsonArray { value.forEach { add(encode(it, depth + 1)) } }+ else -> buildJsonObject {+ fields(value.javaClass).forEach { f ->+ f.isAccessible = true+ put(f.name, encode(f.get(value), depth + 1))+ }+ }+ }+ }++ private fun fields(c: Class<*>) = generateSequence(c) { it.superclass.takeIf { s -> s != Any::class.java } }+ .flatMap { it.declaredFields.asSequence() }+ .filter { !Modifier.isStatic(it.modifiers) && !it.isSynthetic && !it.name.startsWith("$") }+ .toList()+}diff --git a/base/extensions/src/main/kotlin/app/myspoti/extensions/SpotifyMethods.kt b/base/extensions/src/main/kotlin/app/myspoti/extensions/SpotifyMethods.ktnew file mode 100644index 00000000..4e3c1fd1--- /dev/null+++ b/base/extensions/src/main/kotlin/app/myspoti/extensions/SpotifyMethods.kt@@ -0,0 +1,465 @@+package app.myspoti.extensions++import app.myspoti.api.Blends+import app.myspoti.api.ItemKind+import app.myspoti.api.LibraryFilter+import app.myspoti.api.LibrarySort+import app.myspoti.api.MyspotiApi+import app.myspoti.api.NowPlaying+import app.myspoti.api.PlaylistAccess+import app.myspoti.api.PlaylistSort+import app.myspoti.api.Repeat+import app.myspoti.api.TimeRange+import app.myspoti.api.HomeFilter+import kotlinx.serialization.json.JsonArray+import kotlinx.serialization.json.JsonElement+import kotlinx.serialization.json.JsonNull+import kotlinx.serialization.json.JsonObject+import kotlinx.serialization.json.JsonPrimitive+import kotlinx.serialization.json.booleanOrNull+import kotlinx.serialization.json.contentOrNull+import kotlinx.serialization.json.doubleOrNull+import kotlinx.serialization.json.longOrNull++/** One `myspoti.spotify.<area>.<method>(...)` call, as the sandbox hands it to the host. */+data class SpotifyCall(val area: String, val method: String, val argsJson: String)++/** What the raw door reaches: the Web Player's GraphQL operations, page services and Spotify URLs. */+interface SpotifyRaw {+ suspend fun gql(operation: String, variables: JsonObject): JsonElement+ fun operations(): Set<String>+ suspend fun service(service: String, method: String, args: List<JsonElement>): JsonElement+ /** A GET on a Spotify address, with the account's token (the Spotify layer refuses other hosts). */+ suspend fun get(url: String): JsonElement?+ /** Whether the GraphQL operation changes something. */+ fun isMutation(operation: String): Boolean+ /**+ * Any method on a Spotify address ([RawRequest] checked it): `*.spotify.com` with the account's+ * credentials, `*.spotifycdn.com` without. `{ status, headers, body }`, a 4xx/5xx included.+ * [body] is sent as these bytes (a script's text as UTF-8, or the bytes of its base64).+ */+ suspend fun request(method: String, url: String, body: ByteArray?, headers: Map<String, String>): JsonElement =+ throw UnsupportedOperationException("this app has no raw Spotify requests for extensions")+}++/** The rules of `raw.request`, checked before the host is asked. */+object RawRequest {+ val METHODS = setOf("GET", "HEAD", "POST", "PUT", "PATCH", "DELETE")+ /** What only reads: never confirmed. */+ val READS = setOf("GET", "HEAD")++ /** The upper-case method, or why the request is refused. */+ fun check(method: String, url: String): String {+ val m = method.uppercase()+ require(m in METHODS) { "method \"$method\" (${METHODS.joinToString()})" }+ val uri = runCatching { java.net.URI(url) }.getOrNull() ?: throw IllegalArgumentException("not a URL: $url")+ val host = uri.host?.lowercase() ?: throw IllegalArgumentException("no host in $url")+ require(uri.scheme == "https") { "https only" }+ require(isSpotifyHost(host)) { "$host is not a Spotify address (*.spotify.com, *.spotifycdn.com)" }+ return m+ }++ /**+ * The bytes of a script's body: its text as UTF-8, or, with `{ encoding: 'base64' }` as the+ * fifth argument, the bytes that base64 stands for (a binary body: a script has only text).+ */+ fun bytes(body: String, a: SpotifyArgs): ByteArray {+ val encoding = if (a.size > 4) (a.obj(4, "options")["encoding"] as? JsonPrimitive)?.contentOrNull else null+ return when (encoding) {+ null, "utf-8" -> body.toByteArray()+ "base64" -> runCatching { java.util.Base64.getDecoder().decode(body) }+ .getOrElse { throw IllegalArgumentException("raw.request: the body is not base64") }+ else -> throw IllegalArgumentException("raw.request: encoding \"$encoding\" (utf-8, base64)")+ }+ }++ /** The answer as scripts get it: `{ status, headers, body }`. */+ fun response(status: Int, headers: Map<String, String>, body: String): JsonElement = JsonObject(mapOf(+ "status" to JsonPrimitive(status),+ "headers" to JsonObject(headers.mapValues { JsonPrimitive(it.value) }),+ "body" to JsonPrimitive(body),+ ))++ fun isSpotifyHost(host: String): Boolean =+ host == "spotify.com" || host.endsWith(".spotify.com") || host == "spotifycdn.com" || host.endsWith(".spotifycdn.com")++ /** Up to this many segments in a path a grant covers. */+ private const val MAX_SEGMENTS = 16++ /**+ * The grant the user is offered for a write: its method and host, and its path with every+ * segment that names one thing (an id, a number, a uri) as `*`, so the same kind of request on+ * another song or playlist is covered and nothing else.+ */+ fun offer(method: String, url: String): RawGrant {+ val uri = java.net.URI(url)+ val segments = uri.rawPath.orEmpty().split('/').filter { it.isNotEmpty() }.take(MAX_SEGMENTS)+ return RawGrant(method.uppercase(), uri.host.lowercase(), "/" + segments.joinToString("/") { if (isNameOfOne(it)) "*" else it })+ }++ /** Whether one of [grants] covers [method] on [url] (the query is not looked at). */+ fun covered(grants: List<RawGrant>, method: String, url: String): Boolean {+ val uri = runCatching { java.net.URI(url) }.getOrNull() ?: return false+ val host = uri.host?.lowercase() ?: return false+ val segments = uri.rawPath.orEmpty().split('/').filter { it.isNotEmpty() }+ return grants.any { it.method == method.uppercase() && it.host == host && it.matches(segments) }+ }++ private fun isNameOfOne(segment: String): Boolean =+ segment.any { it.isDigit() } && (segment.length >= 8 || segment.all { it.isDigit() }) || ':' in segment || segment.contains("%3A", ignoreCase = true)+}++/**+ * A write the user allowed for good to one extension: [method] on [host], on a path matching+ * [path], where a `*` segment stands for any one segment. Kept by the host, listed on the+ * extension's page and revocable there; a request it covers runs without asking.+ */+data class RawGrant(val method: String, val host: String, val path: String) {+ fun matches(segments: List<String>): Boolean {+ val mine = path.split('/').filter { it.isNotEmpty() }+ return mine.size == segments.size && mine.zip(segments).all { (p, s) -> p == "*" || p == s }+ }++ override fun toString() = "$method https://$host$path"+}++/** The user's answer to a write: no, this once, or always for the offered [RawGrant]. */+enum class Consent { REFUSE, ONCE, ALWAYS }++/**+ * The player's media manifests: what Spotify sent the player for a song it has queued (formats+ * and file ids), as it sent it. Read only; null for a song the player has not been sent.+ */+fun interface PlayerMedia {+ fun manifest(trackUri: String): JsonElement?+}++/** What a method runs on: the typed API, the raw door and the player's media when the host has them. */+class SpotifyBackend(val api: MyspotiApi, val raw: SpotifyRaw?, val media: PlayerMedia? = null)++/**+ * One method an extension may call. [action] is what the user must have granted;+ * [destructive] says whether it removes or clears something, so the user is asked first+ * (its second argument tells whether a raw GraphQL operation is a mutation).+ */+class SpotifyMethod internal constructor(+ val area: String,+ val name: String,+ val action: Action,+ /** Finishes "… wants to <label>" in the confirmation. */+ val label: String,+ internal val destructive: (SpotifyArgs, (String) -> Boolean) -> Boolean,+ internal val run: suspend (SpotifyBackend, SpotifyArgs) -> Any?,+) {+ val key get() = "$area.$name"++ fun isDestructive(args: SpotifyArgs, isMutation: (String) -> Boolean): Boolean = destructive(args, isMutation)+}++/** The positional arguments of a call, read the way the typed API wants them; a wrong one fails with its name. */+class SpotifyArgs(private val list: JsonArray, private val where: String) {+ val size get() = list.size++ private fun at(i: Int): JsonElement? = list.getOrNull(i)?.takeUnless { it is JsonNull }+ private fun bad(i: Int, name: String, wants: String): Nothing =+ throw IllegalArgumentException("$where: $name (argument ${i + 1}) must be $wants")+ private fun prim(i: Int, name: String, wants: String): JsonPrimitive? =+ at(i)?.let { it as? JsonPrimitive ?: bad(i, name, wants) }++ fun str(i: Int, name: String): String = strOrNull(i, name) ?: bad(i, name, "a string")+ fun strOrNull(i: Int, name: String): String? = prim(i, name, "a string")?.takeIf { it.isString }?.content ?: if (at(i) != null) bad(i, name, "a string") else null++ fun int(i: Int, name: String, default: Int): Int = longOrNull(i, name)?.toInt() ?: default+ fun long(i: Int, name: String): Long = longOrNull(i, name) ?: bad(i, name, "a number")+ fun longOrNull(i: Int, name: String): Long? = prim(i, name, "a number")?.let { it.longOrNull ?: it.doubleOrNull?.toLong() ?: bad(i, name, "a number") }+ fun double(i: Int, name: String): Double = prim(i, name, "a number")?.doubleOrNull ?: bad(i, name, "a number")+ fun bool(i: Int, name: String): Boolean = prim(i, name, "true or false")?.booleanOrNull ?: bad(i, name, "true or false")+ fun bool(i: Int, name: String, default: Boolean): Boolean = if (at(i) == null) default else bool(i, name)++ fun strings(i: Int, name: String): List<String> {+ val a = at(i) as? JsonArray ?: bad(i, name, "a list of strings")+ if (a.size > MAX_LIST) bad(i, name, "a list of $MAX_LIST strings at most")+ return a.map { (it as? JsonPrimitive)?.takeIf { p -> p.isString }?.content ?: bad(i, name, "a list of strings") }+ }++ fun json(i: Int, name: String): JsonElement = at(i) ?: bad(i, name, "given")+ fun obj(i: Int, name: String): JsonObject = (at(i) ?: JsonObject(emptyMap())) as? JsonObject ?: bad(i, name, "an object")+ fun rest(from: Int): List<JsonElement> = list.drop(from)++ /** A queue item: `{ uri, uid? }`, or the whole item `player.queue()` gave. */+ fun queueItem(i: Int, name: String): NowPlaying {+ val o = at(i) as? JsonObject ?: bad(i, name, "an object { uri, uid }")+ val uri = (o["uri"] as? JsonPrimitive)?.takeIf { it.isString }?.content ?: bad(i, name, "an object with a uri")+ val uid = (o["uid"] as? JsonPrimitive)?.takeIf { it.isString }?.content+ return NowPlaying(ItemKind.TRACK, uri, uid, name = "", artists = emptyList(), album = null, imageUrl = null, durationMs = 0)+ }++ fun queueItems(i: Int, name: String): List<NowPlaying> {+ val a = at(i) as? JsonArray ?: bad(i, name, "a list of { uri, uid }")+ if (a.size > MAX_LIST) bad(i, name, "a list of $MAX_LIST items at most")+ return a.indices.map { k -> SpotifyArgs(JsonArray(listOf(a[k])), where).queueItem(0, name) }+ }++ inline fun <reified E : Enum<E>> enum(i: Int, name: String, default: E): E = enumIn(i, name, enumValues<E>(), default)++ fun <E : Enum<E>> enumIn(i: Int, name: String, values: Array<E>, default: E): E {+ val s = strOrNull(i, name) ?: return default+ return values.firstOrNull { it.name.equals(s, ignoreCase = true) }+ ?: throw IllegalArgumentException("$where: $name must be one of ${values.joinToString { it.name.lowercase() }}")+ }++ companion object {+ const val MAX_LIST = 1_000+ }+}++/**+ * Every method of `myspoti.spotify`, with the right it needs and whether the user is asked before+ * it runs. The one place where that is decided: a method that is not here is refused, and the+ * script's `myspoti.spotify` is built from this table.+ *+ * Reading Spotify's public content is [Action.SPOTIFY_CATALOG]; what belongs to the account is+ * [Action.LIBRARY_READ], what plays and the queue [Action.PLAYBACK_EVENTS]; driving playback is+ * [Action.PLAYBACK_CONTROL], the queue [Action.PLAYBACK_QUEUE]; changing the library and account+ * [Action.LIBRARY_WRITE], playlists and Blends [Action.PLAYLISTS_WRITE]; the raw door is+ * [Action.SPOTIFY_RAW]. They are separate: writing does not give reading. Not exposed: Jam (a live shared session, not a thing to script).+ */+object SpotifyMethods {+ private val CATALOG = Action.SPOTIFY_CATALOG+ private val READ = Action.LIBRARY_READ+ private val NOW = Action.PLAYBACK_EVENTS+ private val CONTROL = Action.PLAYBACK_CONTROL+ private val QUEUE = Action.PLAYBACK_QUEUE+ private val LIBRARY = Action.LIBRARY_WRITE+ private val PLAYLISTS = Action.PLAYLISTS_WRITE+ private val RAW = Action.SPOTIFY_RAW++ private val table = LinkedHashMap<String, SpotifyMethod>()++ fun find(area: String, name: String): SpotifyMethod? = table["$area.$name"]+ fun all(): Collection<SpotifyMethod> = table.values++ /** `{ area: [method, ...] }`, what the script's `myspoti.spotify` is built from. */+ fun names(): Map<String, List<String>> = table.values.groupBy({ it.area }, { it.name })++ private fun add(+ area: String, name: String, action: Action, label: String,+ destructive: (SpotifyArgs, (String) -> Boolean) -> Boolean = { _, _ -> false },+ run: suspend (SpotifyBackend, SpotifyArgs) -> Any?,+ ) {+ val m = SpotifyMethod(area, name, action, label, destructive, run)+ check(table.put(m.key, m) == null) { "${m.key} listed twice" }+ }++ /** A method of the typed API: [body] has the [MyspotiApi] as its receiver. */+ private fun typed(+ area: String, name: String, action: Action, label: String = name,+ destructive: Boolean = false, body: suspend MyspotiApi.(SpotifyArgs) -> Any?,+ ) = add(area, name, action, label, { _, _ -> destructive }) { b, a -> b.api.body(a) }++ /** Like [typed], destructive only when [whenArgs] says so for these arguments. */+ private fun typedIf(+ area: String, name: String, action: Action, label: String,+ whenArgs: (SpotifyArgs) -> Boolean, body: suspend MyspotiApi.(SpotifyArgs) -> Any?,+ ) = add(area, name, action, label, { a, _ -> whenArgs(a) }) { b, a -> b.api.body(a) }++ private fun raw(b: SpotifyBackend): SpotifyRaw = b.raw ?: throw UnsupportedOperationException("this app has no raw Spotify door for extensions")++ init {+ // ── player ──+ typed("player", "state", NOW, "read what is playing") { player.state.value }+ typed("player", "queue", NOW, "read the queue") { player.queue.value }+ typed("player", "volume", NOW, "read the volume") { player.volume() }+ // Also myspoti.spotify.media(trackUri) in the script.+ add("player", "media", NOW, "read a song's media manifest") { b, a ->+ val uri = a.str(0, "trackUri")+ require(uri.startsWith("spotify:track:")) { "spotify.player.media: trackUri must be a spotify:track: uri" }+ val m = b.media ?: throw UnsupportedOperationException("this app has no player media for extensions")+ m.manifest(uri)?.let { JsonObject(mapOf("uri" to JsonPrimitive(uri), "manifest" to it)) }+ }+ typed("player", "play", CONTROL, "start playing something") { a ->+ player.play(a.str(0, "contextUri"), a.strOrNull(1, "trackUri"), a.longOrNull(2, "index")?.toInt(), a.longOrNull(3, "positionMs"),+ if (a.size > 4 && a.json(4, "order") !is JsonNull) a.strings(4, "order") else null)+ }+ typed("player", "pause", CONTROL, "pause playback") { player.pause() }+ typed("player", "resume", CONTROL, "resume playback") { player.resume() }+ typed("player", "seek", CONTROL, "move in the song") { a -> player.seek(a.long(0, "positionMs")) }+ typed("player", "next", CONTROL, "skip to the next song") { player.next() }+ typed("player", "previous", CONTROL, "go back to the previous song") { player.previous() }+ typed("player", "setShuffle", CONTROL, "change shuffle") { a -> player.setShuffle(a.bool(0, "on")) }+ typed("player", "setRepeat", CONTROL, "change repeat") { a -> player.setRepeat(a.enum(0, "mode", Repeat.OFF)) }+ typed("player", "addToQueue", QUEUE, "add songs to the queue") { a -> player.addToQueue(a.strings(0, "uris")) }+ typed("player", "playNext", QUEUE, "put songs next in the queue") { a -> player.playNext(a.strings(0, "uris")) }+ typed("player", "removeFromQueue", QUEUE, "remove songs from the queue", destructive = true) { a -> player.removeFromQueue(a.queueItems(0, "items")) }+ typed("player", "clearQueue", QUEUE, "clear the queue", destructive = true) { player.clearQueue() }+ typed("player", "skipTo", CONTROL, "jump to a song of the queue") { a -> player.skipTo(a.queueItem(0, "item")) }+ typed("player", "moveInQueue", QUEUE, "reorder the queue") { a -> player.moveInQueue(a.queueItem(0, "item"), a.queueItem(1, "target"), a.bool(2, "after", false)) }+ typed("player", "setVolume", CONTROL, "change the volume") { a -> player.setVolume(a.double(0, "level")) }+ typed("player", "setSpeed", CONTROL, "change the playback speed") { a -> player.setSpeed(a.double(0, "speed")) }++ // ── search ──+ typed("search", "all", CATALOG) { a -> search.all(a.str(0, "query"), a.int(1, "limit", 10)) }+ fun paged(name: String, call: suspend MyspotiApi.(String, Int, Int) -> Any?) =+ typed("search", name, CATALOG) { a -> call(a.str(0, "query"), a.int(1, "offset", 0), a.int(2, "limit", 30)) }+ paged("tracks") { q, o, l -> search.tracks(q, o, l) }+ paged("artists") { q, o, l -> search.artists(q, o, l) }+ paged("albums") { q, o, l -> search.albums(q, o, l) }+ paged("playlists") { q, o, l -> search.playlists(q, o, l) }+ paged("shows") { q, o, l -> search.shows(q, o, l) }+ paged("episodes") { q, o, l -> search.episodes(q, o, l) }+ paged("audiobooks") { q, o, l -> search.audiobooks(q, o, l) }+ paged("users") { q, o, l -> search.users(q, o, l) }+ paged("genres") { q, o, l -> search.genres(q, o, l) }+ typed("search", "suggestions", CATALOG) { a -> search.suggestions(a.str(0, "query"), a.int(1, "limit", 10)) }+ typed("search", "recent", READ, "read the account's recent searches") { search.recent() }+ typed("search", "clearRecent", LIBRARY, "clear the account's recent searches", destructive = true) { search.clearRecent() }++ // ── catalog ──+ typed("catalog", "track", CATALOG) { a -> catalog.track(a.str(0, "uri")) }+ typed("catalog", "album", CATALOG) { a -> catalog.album(a.str(0, "uri")) }+ typed("catalog", "albumTracks", CATALOG) { a -> catalog.albumTracks(a.str(0, "uri"), a.int(1, "offset", 0), a.int(2, "limit", 50)) }+ typed("catalog", "artist", CATALOG) { a -> catalog.artist(a.str(0, "uri")) }+ typed("catalog", "artistTopTracks", CATALOG) { a -> catalog.artistTopTracks(a.str(0, "uri")) }+ typed("catalog", "artistPage", CATALOG) { a -> catalog.artistPage(a.str(0, "uri")) }+ typed("catalog", "isrc", CATALOG) { a -> catalog.isrc(a.str(0, "trackUri")) }+ typed("catalog", "discography", CATALOG) { a -> catalog.discography(a.str(0, "uri"), a.int(1, "offset", 0), a.int(2, "limit", 50)) }+ typed("catalog", "relatedArtists", CATALOG) { a -> catalog.relatedArtists(a.str(0, "uri")) }+ typed("catalog", "appearsOn", CATALOG) { a -> catalog.appearsOn(a.str(0, "uri")) }+ typed("catalog", "similarAlbums", CATALOG) { a -> catalog.similarAlbums(a.str(0, "trackUri"), a.int(1, "limit", 20)) }++ // ── library ──+ typed("library", "contains", READ, "check what is in the library") { a -> library.contains(a.strings(0, "uris")) }+ typed("library", "items", READ, "read the library") { a ->+ library.items(a.enum(0, "filter", LibraryFilter.ALL), a.enum(1, "sort", LibrarySort.RECENTS), a.strOrNull(2, "folderUri"), a.int(3, "offset", 0), a.int(4, "limit", 50))+ }+ typed("library", "likedTracks", READ, "read the liked songs") { a -> library.likedTracks(a.int(0, "offset", 0), a.int(1, "limit", 50)) }+ typed("library", "add", LIBRARY, "save to the library") { a -> library.add(a.strings(0, "uris")) }+ typed("library", "remove", LIBRARY, "remove from the library", destructive = true) { a -> library.remove(a.strings(0, "uris")) }+ typed("library", "pin", LIBRARY, "pin in the library") { a -> library.pin(a.str(0, "uri")) }+ typed("library", "unpin", LIBRARY, "unpin from the library") { a -> library.unpin(a.str(0, "uri")) }+ typed("library", "createFolder", LIBRARY, "create a library folder") { a -> library.createFolder(a.str(0, "name"), a.strOrNull(1, "parentFolderUri")) }+ typed("library", "renameFolder", LIBRARY, "rename a library folder") { a -> library.renameFolder(a.str(0, "folderUri"), a.str(1, "name")) }+ typed("library", "deleteFolder", LIBRARY, "delete a library folder", destructive = true) { a -> library.deleteFolder(a.str(0, "folderUri")) }+ typed("library", "moveToFolder", LIBRARY, "move to a library folder") { a -> library.moveToFolder(a.str(0, "uri"), a.strOrNull(1, "folderUri")) }++ // ── playlists ──+ typed("playlists", "playlist", CATALOG) { a -> playlists.playlist(a.str(0, "uri")) }+ typed("playlists", "tracks", CATALOG) { a -> playlists.tracks(a.str(0, "uri"), a.int(1, "offset", 0), a.int(2, "limit", 100)) }+ typed("playlists", "sortedTracks", CATALOG) { a -> playlists.sortedTracks(a.str(0, "uri"), a.enum(1, "sort", PlaylistSort.CUSTOM), a.bool(2, "descending", false)) }+ typed("playlists", "recommended", CATALOG) { a ->+ playlists.recommended(a.str(0, "uri"), a.int(1, "limit", 10), if (a.size > 2) a.strings(2, "skip") else emptyList())+ }+ typed("playlists", "mine", READ, "read the account's playlists") { playlists.mine() }+ typed("playlists", "editable", READ, "read the playlists it may add to") { playlists.editable() }+ typed("playlists", "access", READ, "read who may see a playlist") { a -> playlists.access(a.str(0, "uri")) }+ typed("playlists", "published", READ, "read whether a playlist is on the profile") { a -> playlists.published(a.str(0, "uri")) }+ typed("playlists", "members", READ, "read who can change a playlist") { a -> playlists.members(a.str(0, "uri")) }+ typed("playlists", "addedBy", READ, "read who added a playlist's songs") { a -> playlists.addedBy(a.str(0, "uri")) }+ typed("playlists", "create", PLAYLISTS, "create a playlist") { a -> playlists.create(a.str(0, "name"), a.strOrNull(1, "folderUri")) }+ typed("playlists", "rename", PLAYLISTS, "rename a playlist") { a -> playlists.rename(a.str(0, "uri"), a.str(1, "name")) }+ typed("playlists", "setDescription", PLAYLISTS, "change a playlist's description") { a -> playlists.setDescription(a.str(0, "uri"), a.str(1, "description")) }+ typed("playlists", "setAccess", PLAYLISTS, "change who may see a playlist") { a -> playlists.setAccess(a.str(0, "uri"), a.enum(1, "access", PlaylistAccess.PUBLIC)) }+ typed("playlists", "setPublished", PLAYLISTS, "show or hide a playlist on the profile") { a -> playlists.setPublished(a.str(0, "uri"), a.bool(1, "published")) }+ typed("playlists", "setPublic", PLAYLISTS, "make a playlist public or private") { a -> playlists.setPublic(a.str(0, "uri"), a.bool(1, "public")) }+ typed("playlists", "setCollaborative", PLAYLISTS, "make a playlist collaborative or not") { a -> playlists.setCollaborative(a.str(0, "uri"), a.bool(1, "collaborative")) }+ typed("playlists", "setCover", PLAYLISTS, "change a playlist's cover") { a ->+ playlists.setCover(a.str(0, "uri"), a.strOrNull(1, "jpegBase64")?.let { s ->+ runCatching { java.util.Base64.getDecoder().decode(s) }.getOrElse { throw IllegalArgumentException("spotify.playlists.setCover: jpegBase64 is not base64") }+ })+ }+ typed("playlists", "delete", PLAYLISTS, "delete a playlist", destructive = true) { a -> playlists.delete(a.str(0, "uri")) }+ typed("playlists", "follow", PLAYLISTS, "follow a playlist") { a -> playlists.follow(a.str(0, "uri")) }+ typed("playlists", "unfollow", PLAYLISTS, "unfollow a playlist", destructive = true) { a -> playlists.unfollow(a.str(0, "uri")) }+ typed("playlists", "join", PLAYLISTS, "join a collaborative playlist") { a -> playlists.join(a.str(0, "uri"), a.str(1, "invitationToken")) }+ typed("playlists", "collaboratorInvite", PLAYLISTS, "make an invitation link for a playlist") { a -> playlists.collaboratorInvite(a.str(0, "uri")) }+ typed("playlists", "addTracks", PLAYLISTS, "add songs to a playlist") { a -> playlists.addTracks(a.str(0, "uri"), a.strings(1, "trackUris")) }+ typed("playlists", "removeTracks", PLAYLISTS, "remove songs from a playlist", destructive = true) { a -> playlists.removeTracks(a.str(0, "uri"), a.strings(1, "uids")) }+ typed("playlists", "moveTracks", PLAYLISTS, "reorder a playlist") { a -> playlists.moveTracks(a.str(0, "uri"), a.strings(1, "uids"), a.strOrNull(2, "beforeUid")) }++ // ── home ──+ typed("home", "feed", CATALOG) { a -> home.feed(a.enum(0, "filter", HomeFilter.ALL), a.int(1, "itemsPerShelf", 10)) }+ typed("home", "categories", CATALOG) { home.categories() }+ typed("home", "category", CATALOG) { a -> home.category(a.str(0, "uri")) }+ typed("home", "whatsNew", READ, "read the new releases of the artists it follows") { a -> home.whatsNew(a.int(0, "offset", 0), a.int(1, "limit", 50)) }++ // ── podcasts ──+ typed("podcasts", "show", CATALOG) { a -> podcasts.show(a.str(0, "uri")) }+ typed("podcasts", "episodes", CATALOG) { a -> podcasts.episodes(a.str(0, "uri"), a.int(1, "offset", 0), a.int(2, "limit", 50)) }+ typed("podcasts", "episode", CATALOG) { a -> podcasts.episode(a.str(0, "uri")) }+ typed("podcasts", "audioUrl", CATALOG) { a -> podcasts.audioUrl(a.str(0, "uri")) }+ typed("podcasts", "audiobook", CATALOG) { a -> podcasts.audiobook(a.str(0, "uri")) }+ typed("podcasts", "chapters", CATALOG) { a -> podcasts.chapters(a.str(0, "uri"), a.int(1, "offset", 0), a.int(2, "limit", 50)) }+ typed("podcasts", "savedEpisodes", READ, "read the saved episodes") { a -> podcasts.savedEpisodes(a.int(0, "offset", 0), a.int(1, "limit", 50)) }+ typedIf("podcasts", "setEpisodeSaved", LIBRARY, "save or unsave an episode", whenArgs = { !it.bool(1, "saved") }) { a ->+ podcasts.setEpisodeSaved(a.str(0, "uri"), a.bool(1, "saved"))+ }++ // ── users ──+ typed("users", "me", READ, "read the account") { users.me() }+ typed("users", "profile", READ, "read a profile") { a -> users.profile(a.str(0, "userUri")) }+ typed("users", "followers", READ, "read a user's followers") { a -> users.followers(a.str(0, "userUri")) }+ typed("users", "following", READ, "read who a user follows") { a -> users.following(a.str(0, "userUri")) }+ typed("users", "top", READ, "read the account's top artists and songs") { a -> users.top(a.enum(0, "range", TimeRange.SHORT_TERM), a.int(1, "limit", 10)) }+ typed("users", "isFollowing", READ, "check who it follows") { a -> users.isFollowing(a.strings(0, "userUris")) }+ typed("users", "friendActivity", READ, "read what friends listen to") { users.friendActivity() }+ typed("users", "history", READ, "read the listening history") { users.history() }+ typed("users", "follow", LIBRARY, "follow users") { a -> users.follow(a.strings(0, "userUris")) }+ typed("users", "unfollow", LIBRARY, "unfollow users", destructive = true) { a -> users.unfollow(a.strings(0, "userUris")) }+ typed("users", "setPrivateSession", LIBRARY, "change the private session") { a -> users.setPrivateSession(a.bool(0, "on")) }++ // ── extras ──+ typed("extras", "lyrics", CATALOG) { a -> extras.lyrics(a.str(0, "trackUri")) }+ typed("extras", "canvas", CATALOG) { a -> extras.canvas(a.str(0, "trackUri")) }+ typed("extras", "credits", CATALOG) { a -> extras.credits(a.str(0, "trackUri")) }+ typed("extras", "radio", CATALOG) { a -> extras.radio(a.str(0, "seedUri")) }+ typed("extras", "isExcludedFromTaste", READ, "read which songs are kept out of its taste") { a -> extras.isExcludedFromTaste(a.strings(0, "trackUris")) }+ typed("extras", "isArtistBanned", READ, "read which artists are banned") { a -> extras.isArtistBanned(a.strings(0, "artistUris")) }+ typed("extras", "setExcludedFromTaste", LIBRARY, "keep a song out of its taste") { a -> extras.setExcludedFromTaste(a.str(0, "trackUri"), a.bool(1, "excluded")) }+ typed("extras", "setArtistBanned", LIBRARY, "ban or allow an artist") { a -> extras.setArtistBanned(a.str(0, "artistUri"), a.bool(1, "banned")) }++ // ── devices ──+ typed("devices", "list", READ, "read the Spotify Connect devices") { devices.refresh(); devices.devices.value }+ typed("devices", "transfer", CONTROL, "move playback to a device") { a -> devices.transfer(a.str(0, "deviceId"), a.bool(1, "play", true)) }+ typed("devices", "pullHere", CONTROL, "bring playback back to this app") { devices.pullHere() }++ // ── recents ──+ typed("recents", "recentEntries", READ, "read the recently played") { a -> recents.recentEntries(a.int(0, "offset", 0), a.int(1, "limit", 50)) }++ // ── blends ──+ fun blends(name: String, action: Action, label: String, destructive: Boolean = false, body: suspend Blends.(SpotifyArgs) -> Any?) =+ typed("blends", name, action, label, destructive) { a -> blends.body(a) }+ blends("invitation", READ, "read a Blend invitation") { a -> invitation(a.str(0, "linkOrId")) }+ blends("group", READ, "read who is in a Blend") { a -> group(a.str(0, "playlist")) }+ blends("story", READ, "read a Blend's taste match") { a -> story(a.str(0, "playlist")) }+ blends("invite", PLAYLISTS, "make a Blend invitation") { invite() }+ blends("join", PLAYLISTS, "join a Blend") { a -> join(a.str(0, "linkOrId")) }+ blends("rename", PLAYLISTS, "rename a Blend") { a -> rename(a.str(0, "playlist"), a.str(1, "name")) }+ blends("leave", PLAYLISTS, "leave a Blend", destructive = true) { a -> leave(a.str(0, "playlist")) }++ // ── raw ──+ // A GraphQL mutation and any page service call can change the account in ways nothing+ // here can describe: both are confirmed. A GraphQL query and a GET are not.+ add("raw", "operations", RAW, "list the Web Player operations") { b, _ -> raw(b).operations().sorted() }+ add("raw", "gql", RAW, "run a Web Player GraphQL operation", destructive = { a, isMutation -> isMutation(a.str(0, "operation")) }) { b, a ->+ raw(b).gql(a.str(0, "operation"), a.obj(1, "variables"))+ }+ add("raw", "service", RAW, "call a Web Player service", destructive = { _, _ -> true }) { b, a ->+ raw(b).service(a.str(0, "service"), a.str(1, "method"), a.rest(2))+ }+ add("raw", "get", RAW, "read a Spotify address") { b, a -> raw(b).get(a.str(0, "url")) }+ // Any method on a Spotify address: a read runs, anything that may change the account asks.+ add("raw", "request", RAW, "send a request to Spotify", destructive = { a, _ ->+ RawRequest.check(a.str(0, "method"), a.str(1, "url")) !in RawRequest.READS+ }) { b, a ->+ val method = RawRequest.check(a.str(0, "method"), a.str(1, "url"))+ val body = when (val e = if (a.size > 2) a.json(2, "body").takeUnless { it is JsonNull } else null) {+ null -> null+ is JsonPrimitive -> if (e.isString) e.content else e.toString()+ else -> e.toString()+ }+ val headers = if (a.size > 3) a.obj(3, "headers").mapValues { (_, v) -> (v as? JsonPrimitive)?.content ?: v.toString() } else emptyMap()+ raw(b).request(method, a.str(1, "url"), body?.let { RawRequest.bytes(it, a) }, headers)+ }+ }+}diff --git a/base/extensions/src/main/kotlin/app/myspoti/extensions/Status.kt b/base/extensions/src/main/kotlin/app/myspoti/extensions/Status.ktnew file mode 100644index 00000000..e5f14ad9--- /dev/null+++ b/base/extensions/src/main/kotlin/app/myspoti/extensions/Status.kt@@ -0,0 +1,72 @@+package app.myspoti.extensions++import kotlinx.serialization.json.JsonObject+import kotlinx.serialization.json.JsonPrimitive+import kotlinx.serialization.json.booleanOrNull+import kotlinx.serialization.json.contentOrNull+import java.util.concurrent.ConcurrentHashMap++/**+ * What an extension's `status` hook says: whether its source answers now, and why not ([detail],+ * shown as it is). An inactive extension is skipped by the source hooks until it is live again;+ * it stays on, and this is not a failure. Only an explicit `live: false` makes it inactive: a+ * probe without an answer ([answered] false: late, threw, not one) leaves it in use.+ */+data class ExtensionStatus(val live: Boolean, val detail: String? = null, val answered: Boolean = true) {+ /** "live", "inactive" or "unknown", for logs and the adb CLI. */+ val state: String get() = if (!answered) "unknown" else if (live) "live" else "inactive"++ companion object {+ const val MAX_DETAIL = 120+ val LIVE = ExtensionStatus(true)++ /** No answer from the probe ([detail]: why): not proof the source is down, it stays in use. */+ fun unknown(detail: String?) = ExtensionStatus(true, detail?.take(MAX_DETAIL), answered = false)++ /** `{ live, detail? }`; no answer (the extension has no `status`) is live. */+ fun parse(json: String?): ExtensionStatus {+ if (json == null) return LIVE+ val o = runCatching { ExtJson.parseToJsonElement(json) as? JsonObject }.getOrNull() ?: throw ExtensionException("status: not an object { live, detail }")+ val live = (o["live"] as? JsonPrimitive)?.booleanOrNull ?: throw ExtensionException("status: \"live\" (true or false) is missing")+ val detail = (o["detail"] as? JsonPrimitive)?.contentOrNull?.trim()?.take(MAX_DETAIL)?.ifBlank { null }+ return ExtensionStatus(live, detail)+ }++ /**+ * Asks [rt]'s `status` within [timeoutMs]: an answer that fails, is late or is not one is+ * [unknown] (a busy phone or a slow start says nothing about the source).+ */+ fun probe(rt: ExtensionRuntime, timeoutMs: Long): ExtensionStatus = try {+ parse(rt.call(Hook.STATUS, "{}", timeoutMs))+ } catch (e: ExtensionException) {+ unknown(e.message)+ }+ }+}++/** The last [ExtensionStatus] of each extension and when it was asked ([clock], ms). */+class StatusBook(private val clock: () -> Long = System::currentTimeMillis) {+ private class Entry(val status: ExtensionStatus, val at: Long)+ private val entries = ConcurrentHashMap<String, Entry>()++ /** Keeps [status] for [id]; true when its [ExtensionStatus.state] changes (the first one too). */+ fun record(id: String, status: ExtensionStatus): Boolean {+ val before = entries[id]?.status?.state+ entries[id] = Entry(status, clock())+ return before != status.state+ }++ /** Its last status, or null (never probed). */+ fun last(id: String): ExtensionStatus? = entries[id]?.status++ /** Its last probe said it is not live (never probed, or no answer: in use). */+ fun inactive(id: String): Boolean = entries[id]?.status?.live == false++ /** Never probed, or last probed [maxAgeMs] ago or more. */+ fun stale(id: String, maxAgeMs: Long): Boolean = entries[id]?.let { clock() - it.at >= maxAgeMs } ?: true++ fun forget(id: String) { entries.remove(id) }++ /** The inactive ones, with what they said. */+ fun inactiveNow(): Map<String, ExtensionStatus> = entries.filterValues { !it.status.live }.mapValues { it.value.status }+}diff --git a/base/extensions/src/main/kotlin/app/myspoti/extensions/Store.kt b/base/extensions/src/main/kotlin/app/myspoti/extensions/Store.ktnew file mode 100644index 00000000..1e7527f5--- /dev/null+++ b/base/extensions/src/main/kotlin/app/myspoti/extensions/Store.kt@@ -0,0 +1,130 @@+package app.myspoti.extensions++/**+ * Where the store files an extension: a fixed, neutral list defined by the app. An author+ * declares one (`category` in the manifest or the index); the app checks it against the declared+ * actions ([fits]) and files it under [OTHER] when it does not fit or is unknown. An extension+ * that provides downloads is always under [TOOLS]. Free `tags` are shown and searched, never+ * filtered on.+ */+enum class Category(val key: String) {+ LYRICS("lyrics"),+ PLAYBACK("playback"),+ LIBRARY("library"),+ DISCOVERY("discovery"),+ STATS("stats"),+ LOOK("look"),+ SOCIAL("social"),+ TOOLS("tools"),+ OTHER("other");++ /** The actions one of which an extension needs to be filed here (empty: any extension fits). */+ val needs: Set<Action>+ get() = when (this) {+ LYRICS -> setOf(Action.LYRICS_PROVIDE, Action.TRACKINFO_PROVIDE)+ PLAYBACK -> setOf(Action.PLAYBACK_CONTROL, Action.PLAYBACK_QUEUE, Action.PLAYBACK_EVENTS, Action.AUDIO_SOURCE, Action.PLAYER_BUTTONS)+ LIBRARY -> setOf(Action.LIBRARY_READ, Action.LIBRARY_WRITE, Action.PLAYLISTS_WRITE)+ DISCOVERY -> setOf(Action.HOME_SECTIONS, Action.SEARCH_PROVIDE, Action.SPOTIFY_CATALOG)+ STATS -> setOf(Action.PLAYBACK_EVENTS, Action.LIBRARY_READ)+ LOOK -> Action.BLOCKS + Action.WEBVIEW_PAGE+ SOCIAL -> setOf(Action.NETWORK, Action.LIBRARY_READ, Action.SPOTIFY_CATALOG)+ TOOLS, OTHER -> emptySet()+ }++ /** Whether an extension declaring [actions] may be filed here. */+ fun fits(actions: Set<Action>): Boolean = needs.isEmpty() || needs.any { it in actions }++ companion object {+ /** The keys of the first store (before this list), read as their nearest category. */+ private val OLD = mapOf("audio-source" to PLAYBACK, "player" to PLAYBACK, "spotify" to LIBRARY, "downloads" to TOOLS)++ fun of(key: String): Category? = entries.firstOrNull { it.key == key } ?: OLD[key]++ /**+ * Where an extension declaring [declared] and [actions] is filed: [TOOLS] when it provides+ * downloads, else the declared category when it is known and [fits], else [OTHER].+ */+ fun of(declared: String?, actions: Set<Action>): Category = when {+ Action.DOWNLOAD_SOURCE in actions -> TOOLS+ else -> declared?.let(::of)?.takeIf { it.fits(actions) } ?: OTHER+ }+ }+}++/**+ * Myspoti's version names, compared like semantic versions: `2.0.2` > `2.0.2-beta.4-dev` >+ * `2.0.2-beta.4` > `2.0.1`. Missing parts count as 0 (`2.1` = `2.1.0`).+ */+object AppVersion {+ private val FORMAT = Regex("^v?(\\d+)(?:\\.(\\d+))?(?:\\.(\\d+))?(?:-([0-9A-Za-z.-]+))?$")++ data class Parsed(val core: List<Int>, val pre: List<String>)++ fun parse(s: String): Parsed? {+ val m = FORMAT.matchEntire(s.trim()) ?: return null+ val core = (1..3).map { m.groupValues[it].ifEmpty { "0" }.toIntOrNull() ?: return null }+ val pre = m.groupValues[4].takeIf { it.isNotEmpty() }?.split('.').orEmpty()+ return Parsed(core, pre)+ }++ /** Negative when [a] is older than [b]; an unreadable version counts as the oldest. */+ fun compare(a: String, b: String): Int {+ val x = parse(a) ?: return if (parse(b) == null) 0 else -1+ val y = parse(b) ?: return 1+ for (i in 0..2) x.core[i].compareTo(y.core[i]).let { if (it != 0) return it }+ // A release is newer than its pre-releases.+ if (x.pre.isEmpty() || y.pre.isEmpty()) return y.pre.size.coerceAtMost(1) - x.pre.size.coerceAtMost(1)+ for (i in 0 until minOf(x.pre.size, y.pre.size)) {+ val p = x.pre[i]; val q = y.pre[i]+ val pn = p.toIntOrNull(); val qn = q.toIntOrNull()+ val c = when {+ pn != null && qn != null -> pn.compareTo(qn)+ pn != null -> -1+ qn != null -> 1+ else -> p.compareTo(q)+ }+ if (c != 0) return c+ }+ return x.pre.size.compareTo(y.pre.size)+ }++ /** Whether [app] is [min] or newer; no minimum, or an app version that cannot be read: yes. */+ fun atLeast(app: String, min: String?): Boolean =+ min.isNullOrBlank() || parse(app) == null || compare(app, min) >= 0+}++/** The one button of a store row. */+enum class StoreAction { INSTALL, UPDATE, INSTALLED, INCOMPATIBLE }++/** What the store shows, without Android: a row's button, the update count, the search. */+object Store {+ /**+ * The button for [entry] when [installedVersionCode] is on the phone (null: not installed),+ * in a Myspoti named [appVersion]. A version this app cannot run is [StoreAction.INCOMPATIBLE]+ * (as an update too); what is installed and not older stays [StoreAction.INSTALLED].+ */+ fun action(entry: Catalog.Entry, installedVersionCode: Int?, appVersion: String): StoreAction = when {+ installedVersionCode != null && entry.versionCode <= installedVersionCode -> StoreAction.INSTALLED+ !entry.compatible(appVersion) -> StoreAction.INCOMPATIBLE+ installedVersionCode != null -> StoreAction.UPDATE+ else -> StoreAction.INSTALL+ }++ /** The newest entry of each extension across [catalogs] (the first repository wins a tie). */+ fun newest(catalogs: List<Pair<String, Catalog>>): Map<String, Pair<String, Catalog.Entry>> {+ val out = LinkedHashMap<String, Pair<String, Catalog.Entry>>()+ catalogs.forEach { (url, c) -> c.extensions.forEach { e -> if ((out[e.id]?.second?.versionCode ?: Int.MIN_VALUE) < e.versionCode) out[e.id] = url to e } }+ return out+ }++ /** The installed extensions (id → versionCode) a repository has a version of that this app can install. */+ fun updates(catalogs: List<Pair<String, Catalog>>, installed: Map<String, Int>, appVersion: String): Set<String> =+ newest(catalogs).filter { (id, p) -> installed[id]?.let { action(p.second, it, appVersion) == StoreAction.UPDATE } == true }.keys++ /** Whether [entry] is in [category] (null: any) and every word of [query] is in its name, author, description, id or tags. */+ fun matches(entry: Catalog.Entry, query: String, category: Category?): Boolean {+ if (category != null && category != entry.category()) return false+ val hay = listOf(entry.name, entry.author, entry.description, entry.id, entry.tags.joinToString(" ")).joinToString(" ").lowercase()+ return query.lowercase().split(' ').filter { it.isNotBlank() }.all { it in hay }+ }+}diff --git a/base/extensions/src/main/kotlin/app/myspoti/extensions/Updates.kt b/base/extensions/src/main/kotlin/app/myspoti/extensions/Updates.ktnew file mode 100644index 00000000..76286e83--- /dev/null+++ b/base/extensions/src/main/kotlin/app/myspoti/extensions/Updates.kt@@ -0,0 +1,148 @@+package app.myspoti.extensions++import kotlinx.serialization.Serializable++/**+ * What the user accepted of an extension, kept with it: its actions with their reasons and+ * hosts, its exclusive roles, what it replaces or conflicts with, its author and source. An+ * update is always weighed against this, the last snapshot the user accepted (at install, or by+ * tapping Accept), never against the version running: an update that silently drops an action+ * and a later one that adds it back with another reason are both seen for what they ask.+ */+@Serializable+data class Snapshot(+ val id: String,+ val version: String,+ val versionCode: Int,+ val author: String,+ /** `owner/name` on GitHub; null for a package from a file or an address. */+ val repo: String? = null,+ /** [Manifest.declared]: each action with its why and, for network, its hosts. */+ val actions: List<ActionRequest> = emptyList(),+ /** The [Mode.EXCLUSIVE] actions it takes (one extension at a time acts for each). */+ val exclusive: List<String> = emptyList(),+ val replaces: List<String> = emptyList(),+ val conflictsWith: List<String> = emptyList(),+) {+ fun hosts(): List<String> = actions.firstOrNull { it.name == Action.NETWORK.key }?.hosts.orEmpty()++ /** The Spotify writes accepted, as grants ([Manifest.declaredWrites]). */+ fun writes(): List<String> = toManifest().declaredWrites().map { it.toString() }++ /** A manifest holding what was accepted, for [app.myspoti.extensions.Manifest.asks]-based comparisons. */+ fun toManifest() = Manifest(id, id, version, versionCode, author = author, actions = actions, replaces = replaces, conflictsWith = conflictsWith)++ companion object {+ fun of(m: Manifest, repo: String?) = Snapshot(+ id = m.id, version = m.version, versionCode = m.versionCode, author = m.author, repo = repo,+ actions = m.declared(), exclusive = m.actionSet().filter { it.mode == Mode.EXCLUSIVE }.map { it.key },+ replaces = m.replaces, conflictsWith = m.conflictsWith,+ )+ }+}++/**+ * One thing an update asks that the user has not accepted, as the "Update needs your OK" card+ * lists it: [key] is the action key (or the host, or the new repo/author/id), [why] the+ * author's new reason, [before] what the user accepted (the old reason, repo or author).+ */+@Serializable+data class Change(val kind: Kind, val key: String, val why: String = "", val before: String = "", val critical: Boolean = false) {+ enum class Kind {+ /** An action not accepted before (a critical one, `webview.page` and exclusive roles included). */+ ACTION,+ /** A network host not accepted before (`*`: any host, critical). */+ HOST,+ /** A Spotify write declared under spotify.raw not accepted before (allowed with the update: critical). */+ WRITE,+ /** An exclusive role taken by an action already accepted (the app made it exclusive since). */+ EXCLUSIVE,+ /** An accepted action whose reason changed: any change counts, the user judges the meaning. */+ WHY,+ /** It now comes from another repository. */+ REPO,+ /** Another author. */+ AUTHOR,+ /** It now turns off another extension when installed. */+ REPLACES,+ /** It now refuses to run with another extension. */+ CONFLICTS,+ }++ /** The action concerned, for its icon. */+ val action: Action? get() = when (kind) {+ Kind.ACTION, Kind.EXCLUSIVE, Kind.WHY -> Action.of(key)+ Kind.HOST -> Action.NETWORK+ Kind.WRITE -> Action.SPOTIFY_RAW+ else -> null+ }+}++/** Whether an update found on GitHub is applied by itself, or waits for the user's OK. */+object UpdateGate {+ sealed interface Decision {+ /** It asks nothing new: applied, the previous version kept to revert to. */+ data object Apply : Decision+ /** It asks [changes]: the old version keeps running, the user reads the card. */+ data class Ask(val changes: List<Change>) : Decision+ }++ fun decide(accepted: Snapshot, next: Snapshot): Decision = diff(accepted, next).let { if (it.isEmpty()) Decision.Apply else Decision.Ask(it) }++ /**+ * Everything [next] asks beyond [accepted]: new actions (critical, page and exclusive ones+ * included), new hosts, exclusive roles, reasons that changed, another repository or author,+ * new replacements and conflicts. What it drops is not a change: it asks less.+ */+ fun diff(accepted: Snapshot, next: Snapshot): List<Change> = buildList {+ if (next.id != accepted.id) add(Change(Change.Kind.REPO, next.id, before = accepted.id, critical = true))+ if (next.repo != accepted.repo && accepted.repo != null) add(Change(Change.Kind.REPO, next.repo.orEmpty(), before = accepted.repo, critical = true))+ if (next.author.trim() != accepted.author.trim()) add(Change(Change.Kind.AUTHOR, next.author, before = accepted.author, critical = true))+ val was = accepted.actions.associateBy { it.name }+ next.actions.forEach { r ->+ val a = Action.of(r.name)+ val old = was[r.name]+ when {+ old == null -> add(Change(Change.Kind.ACTION, r.name, r.why, critical = a == null || a.level == Level.CRITICAL || (a == Action.NETWORK && "*" in r.hosts)))+ old.why.trim() != r.why.trim() -> add(Change(Change.Kind.WHY, r.name, r.why, before = old.why, critical = a?.level == Level.CRITICAL))+ }+ }+ val hostsBefore = accepted.hosts().toSet()+ next.hosts().filter { it !in hostsBefore }.forEach { add(Change(Change.Kind.HOST, it, critical = it == "*")) }+ val writesBefore = accepted.writes().toSet()+ next.writes().filter { it !in writesBefore }.forEach { add(Change(Change.Kind.WRITE, it, critical = true)) }+ val newActions = next.actions.map { it.name }.filter { it !in was }.toSet()+ next.exclusive.filter { it !in accepted.exclusive && it !in newActions }.forEach { add(Change(Change.Kind.EXCLUSIVE, it, critical = true)) }+ next.replaces.filter { it !in accepted.replaces }.forEach { add(Change(Change.Kind.REPLACES, it)) }+ next.conflictsWith.filter { it !in accepted.conflictsWith }.forEach { add(Change(Change.Kind.CONFLICTS, it)) }+ }+}++/**+ * The official repository's `blocked.json` ([GitHub.BLOCKED_URL]), read once a day: [blocked]+ * extensions (all versions, or the packages listed) are turned off on every phone with a notice;+ * [flagged] ones (reported and confirmed) stay installed but are hidden from the store behind+ * "Show all". A missing file is an empty list.+ *+ * `{ "blocked": [{ "id": "…", "sha256": ["…"], "reason": "…" }], "flagged": [{ "id": "…", "reason": "…" }] }`+ */+@Serializable+data class BlockList(val blocked: List<Catalog.Block> = emptyList(), val flagged: List<Flag> = emptyList()) {+ @Serializable+ data class Flag(val id: String, val reason: String = "")++ /** Whether [id] in the package [sha256] is to be turned off (an entry without hashes: every package). */+ fun blocks(id: String, sha256: String?): Catalog.Block? =+ blocked.firstOrNull { b -> b.id == id && (b.sha256.isEmpty() || b.sha256.any { it.equals(sha256, ignoreCase = true) }) }++ fun flags(id: String): Flag? = flagged.firstOrNull { it.id == id }++ companion object {+ val EMPTY = BlockList()++ fun parse(text: String): BlockList = if (text.isBlank()) EMPTY else ExtJson.decodeFromString(serializer(), text)++ /** The body of an answer: a 404 (the file does not exist yet) is an empty list, other failures are thrown by the caller. */+ fun of(status: Int, text: String?): BlockList = if (status == 404) EMPTY else parse(text.orEmpty())+ }+}diff --git a/base/extensions/src/main/resources/app/myspoti/extensions/prelude.js b/base/extensions/src/main/resources/app/myspoti/extensions/prelude.jsnew file mode 100644index 00000000..6101f7f1--- /dev/null+++ b/base/extensions/src/main/resources/app/myspoti/extensions/prelude.js@@ -0,0 +1,204 @@+// Runs before every extension. Gives it `myspoti`, the only door to the app, and closes the+// ones a reviewed script could use to change after review (code built from strings).+// The checks that matter (hosts, rights, sizes) are made by the app, in Kotlin: this file only+// shapes the API.+(function (host, global) {+ 'use strict';+ var hooks = {};+ var listeners = {};+ var parse = function (text) { return text == null ? undefined : JSON.parse(text); };++ function response(r) {+ r.ok = r.status >= 200 && r.status < 300;+ r.json = function () { return JSON.parse(r.body); };+ return r;+ }++ // A request as the app reads it: a body that is not text is sent as JSON.+ function shape(r) {+ if (r == null || typeof r.url !== 'string') throw new TypeError('http.request({ url, method, headers, body })');+ var body = r.body;+ var headers = r.headers || {};+ if (body != null && typeof body !== 'string') {+ body = JSON.stringify(body);+ if (!Object.keys(headers).some(function (k) { return k.toLowerCase() === 'content-type'; })) {+ headers = Object.assign({ 'Content-Type': 'application/json' }, headers);+ }+ }+ return { url: r.url, method: r.method || 'GET', headers: headers, body: body == null ? undefined : body, timeout: r.timeout };+ }++ function request(r) { return response(parse(host.http(JSON.stringify(shape(r))))); }++ // Up to 4 requests sent together; the answers in the same order, { error } for one that failed.+ function all(list) {+ if (!Array.isArray(list)) throw new TypeError('http.all([{ url, method, headers, body }, ...])');+ return parse(host.httpAll(JSON.stringify(list.map(shape)))).map(function (r) { return r.error != null ? r : response(r); });+ }++ // myspoti.spotify.<area>.<method>(...): built from the app's own table of methods, so nothing+ // here decides what is allowed. Arguments go as a JSON list; the answer is the method's result.+ var spotify = {};+ var methods = parse(host.spotifyMethods());+ Object.keys(methods).forEach(function (area) {+ var calls = {};+ methods[area].forEach(function (name) {+ calls[name] = function () {+ return parse(host.spotify(area, name, JSON.stringify(Array.prototype.slice.call(arguments))));+ };+ });+ spotify[area] = Object.freeze(calls);+ });+ // The player's media manifest of a song (file ids included): spotify.media(trackUri).+ if (spotify.player && spotify.player.media) spotify.media = spotify.player.media;++ var myspoti = {+ apiVersion: 1,+ extension: Object.freeze(parse(host.info())),++ /**+ * Answers the app at one of its fixed points, unlocked by an action of the manifest:+ * lyrics, audio-source, download-source, trackinfo, home, search, menu, player (blocks),+ * page, message (its web page), tap (a block with an action was tapped); and status (no action+ * needed): { live, detail? }, whether its source answers now.+ */+ provide: function (hook, fn) {+ if (typeof fn !== 'function') throw new TypeError('provide("' + hook + '", fn): fn must be a function');+ host.mayProvide(String(hook));+ hooks[hook] = fn;+ },++ /**+ * Listens to the app: on('track' | 'playback', fn) needs playback.events, on('auth', fn)+ * webview.auth, on('online', fn) network, on('setting', fn) settings.page ({ key } when one of+ * its settings changed, { key, pressed: true } for a button setting).+ */+ on: function (event, fn) {+ if (typeof fn !== 'function') throw new TypeError('on("' + event + '", fn): fn must be a function');+ host.mayListen(String(event));+ (listeners[event] = listeners[event] || []).push(fn);+ },++ http: Object.freeze({+ request: request,+ all: all,+ get: function (url, options) { return request(Object.assign({}, options, { url: url, method: 'GET' })); },+ post: function (url, body, options) { return request(Object.assign({}, options, { url: url, method: 'POST', body: body })); },+ }),++ /** Builds "a=1&b=two" from { a: 1, b: 'two' } (undefined and null are left out). */+ query: function (params) {+ return Object.keys(params || {}).filter(function (k) { return params[k] != null; })+ .map(function (k) { return encodeURIComponent(k) + '=' + encodeURIComponent(String(params[k])); }).join('&');+ },++ storage: Object.freeze({+ get: function (key) { return parse(host.storageGet(String(key))); },+ set: function (key, value) { host.storageSet(String(key), JSON.stringify(value === undefined ? null : value)); },+ remove: function (key) { host.storageRemove(String(key)); },+ }),++ settings: Object.freeze({+ get: function (key) { return parse(host.setting(String(key))); },+ }),++ player: Object.freeze({+ current: function () { return parse(host.nowPlaying()); },+ play: function () { return host.control('play', -1); },+ pause: function () { return host.control('pause', -1); },+ next: function () { return host.control('next', -1); },+ previous: function () { return host.control('previous', -1); },+ seek: function (ms) { return host.control('seek', Number(ms)); },+ }),++ /**+ * The signed-in Spotify account: search, catalog, library, playlists, player, home, podcasts,+ * users, extras, devices, recents, blends (typed, like the app's own API) and raw (GraphQL,+ * page services, Spotify URLs). Each needs a spotify.* permission; removing things asks the user.+ */+ spotify: Object.freeze(spotify),++ notify: function (text) { host.notify(String(text)); },++ /**+ * What this app understands beyond the first API, for an extension to adapt to: "audio.manifest",+ * "audio.expires", "audio.quality", "audio.source", "audio.ahead", "http.all", "status", "raw.base64".+ */+ features: Object.freeze(['audio.manifest', 'audio.expires', 'audio.quality', 'audio.source', 'audio.ahead', 'http.all', 'status', 'raw.base64']),++ /**+ * A sign-in page (webview.auth): open({ url, callback, hidden }) shows url in a web view of its+ * own and returns an id; on('auth', fn) later gets { id, url } once the page reaches callback+ * (its query is the answer), or { id, error }. hidden: true runs the page out of sight first and+ * shows it only if it needs the user. The page's cookies stay in the app.+ */+ auth: Object.freeze({+ open: function (r) {+ if (r == null || typeof r.url !== 'string' || typeof r.callback !== 'string') throw new TypeError('auth.open({ url, callback })');+ return host.authOpen(r.url, r.callback, r.hidden === true);+ },+ }),++ /** Work that waits for the network (network): whenOnline() asks for one on('online') once it is there. */+ work: Object.freeze({+ whenOnline: function () { host.whenOnline(); },+ }),++ /** The blocks it drew: ui.refresh('home' | 'search' | 'menu' | 'player' | 'trackinfo') asks the app to ask again. */+ ui: Object.freeze({+ refresh: function (place) { host.refresh(String(place)); },+ }),++ /** Its own web page (webview.page): page.post(data) sends data to the page, if it is open. */+ page: Object.freeze({+ post: function (data) { host.pagePost(JSON.stringify(data === undefined ? null : data)); },+ }),++ log: function () {+ host.log(Array.prototype.map.call(arguments, function (a) {+ return typeof a === 'string' ? a : JSON.stringify(a);+ }).join(' '));+ },++ util: Object.freeze({+ base64Encode: function (text) { return host.util('base64Encode', String(text)); },+ base64Decode: function (text) { return host.util('base64Decode', String(text)); },+ md5: function (text) { return host.util('md5', String(text)); },+ sha1: function (text) { return host.util('sha1', String(text)); },+ sha256: function (text) { return host.util('sha256', String(text)); },+ hmacSha256: function (key, text) { return host.util('hmacSha256', String(key) + '\u0000' + String(text)); },+ }),+ };++ // The app calls in here, and only here: a hook's answer, or an event delivered.+ function dispatch(kind, name, args) {+ var input = parse(args);+ if (kind === 'hook') {+ var fn = hooks[name];+ if (!fn) return null;+ var out = fn(input);+ return out == null ? null : JSON.stringify(out);+ }+ (listeners[name] || []).forEach(function (fn) { fn(input); });+ return null;+ }++ var console = Object.freeze({ log: myspoti.log, info: myspoti.log, warn: myspoti.log, error: myspoti.log });+ var fixed = { writable: false, configurable: false, enumerable: false };+ Object.defineProperty(global, 'myspoti', Object.assign({ value: Object.freeze(myspoti) }, fixed));+ Object.defineProperty(global, 'console', Object.assign({ value: console }, fixed));+ Object.defineProperty(global, '__dispatch', Object.assign({ value: dispatch }, fixed));++ // No code built from strings: what was reviewed is what runs.+ // Function keeps its prototype, so `instanceof Function` and Function.prototype.call still work.+ var refused = function Function() { throw new Error('code from strings is not allowed in extensions'); };+ refused.prototype = Function.prototype;+ Object.defineProperty(global, 'eval', Object.assign({ value: refused }, fixed));+ Object.defineProperty(Function.prototype, 'constructor', Object.assign({ value: refused }, fixed));+ Object.defineProperty(global, 'Function', Object.assign({ value: refused }, fixed));+ try {+ var generator = Object.getPrototypeOf(function* () {});+ Object.defineProperty(generator, 'constructor', Object.assign({ value: refused }, fixed));+ } catch (e) { /* no generators in this engine */ }+})(__host, this);+delete this.__host;diff --git a/base/extensions/src/test/kotlin/app/myspoti/extensions/ActionsTest.kt b/base/extensions/src/test/kotlin/app/myspoti/extensions/ActionsTest.ktnew file mode 100644index 00000000..17fbf582--- /dev/null+++ b/base/extensions/src/test/kotlin/app/myspoti/extensions/ActionsTest.kt@@ -0,0 +1,315 @@+package app.myspoti.extensions++import org.junit.Assert.assertEquals+import org.junit.Assert.assertFalse+import org.junit.Assert.assertNull+import org.junit.Assert.assertTrue+import org.junit.Assert.fail+import org.junit.Test++/** The action catalogue, its manifests (new and old), the native blocks and the protected surfaces. */+class ActionsTest {+ private val track = TrackInfo("abc", "spotify:track:abc", "Song", "Artist", listOf("Artist"), "Album", 180_000)++ private fun manifest(vararg actions: ActionRequest) =+ Manifest("io.github.test.act", "Act", "1.0", author = "me", actions = actions.toList())++ private fun a(name: String, why: String = "Shows what you need", hosts: List<String> = emptyList()) = ActionRequest(name, why, hosts)++ private class QuietHost : Host {+ val logs = mutableListOf<String>()+ val refreshed = mutableListOf<String>()+ val posted = mutableListOf<String>()+ override fun log(extensionId: String, message: String) { logs += message }+ val store = MemoryStorage()+ override fun storage(extensionId: String): Storage = store+ override fun setting(extensionId: String, key: String): String? = null+ override fun refresh(extensionId: String, surface: String) { refreshed += surface }+ override fun postToPage(extensionId: String, json: String) { posted += json }+ }++ // ── The catalogue ──++ @Test fun theCatalogueIsClosedAndComplete() {+ assertEquals(22, Action.entries.size)+ assertEquals(Action.entries.size, Action.entries.map { it.key }.toSet().size)+ assertEquals(+ setOf("audio.source", "download.source", "library.write", "playlists.write", "spotify.raw", "webview.page", "webview.auth"),+ Action.entries.filter { it.level == Level.CRITICAL }.map { it.key }.toSet(),+ )+ Action.entries.forEach { act ->+ assertTrue(act.key, act.icon.isNotBlank() && act.label.isNotBlank() && act.label.length <= 28 && act.api.isNotBlank())+ }+ // Every area has at least one action, and every hook but tap is unlocked by one.+ Area.entries.forEach { area -> assertTrue(area.key, Action.entries.any { it.area == area }) }+ Hook.entries.filter { it != Hook.TAP && !it.free }.forEach { h -> assertTrue(h.key, h.action != null) }+ }++ // ── Sign-in pages and work that waits for the network ──++ private class AuthHost : Host {+ val opened = mutableListOf<AuthRequest>()+ var online = 0+ override fun log(extensionId: String, message: String) {}+ override fun storage(extensionId: String): Storage = MemoryStorage()+ override fun setting(extensionId: String, key: String): String? = null+ override fun openAuth(extensionId: String, request: AuthRequest): String { opened += request; return "auth-${opened.size}" }+ override fun whenOnline(extensionId: String) { online++ }+ }++ private fun hooked(body: String, host: Host, vararg actions: ActionRequest): String? =+ ExtensionRuntime(manifest(a("lyrics.provide"), *actions), "myspoti.provide('lyrics', function () { try { return { v: $body }; } catch (e) { return { v: 'error: ' + e.message }; } });", host, (actions.map { it.name } + "lyrics.provide").toSet())+ .use { it.start(); it.call(Hook.LYRICS, track.toJson(), 3_000) }++ @Test fun authOpensOnlyWithItsActionAndSafeAddresses() {+ val host = AuthHost()+ assertEquals("""{"v":"auth-1"}""", hooked("myspoti.auth.open({ url: 'https://id.example.com/authorize?x=1', callback: 'myext://done' })", host, a("webview.auth")))+ assertTrue(hooked("myspoti.auth.open({ url: 'https://id.example.com/', callback: 'myext://done' })", host)!!.contains("webview.auth"))+ for ((url, cb) in listOf(+ "http://id.example.com/" to "myext://done",+ "https://accounts.spotify.com/login" to "myext://done",+ "https://id.example.com/" to "javascript:alert(1)",+ "https://id.example.com/" to "http://cb.example.com/",+ "https://id.example.com/" to "https://open.spotify.com/cb",+ "https://id.example.com/" to "intent://x",+ )) assertTrue("$url $cb", hooked("myspoti.auth.open({ url: '$url', callback: '$cb' })", host, a("webview.auth"))!!.startsWith("""{"v":"error:"""))+ assertEquals(1, host.opened.size)+ // webview.page gives no sign-in page.+ assertTrue(hooked("myspoti.auth.open({ url: 'https://id.example.com/', callback: 'myext://done' })", host, a("webview.page"))!!.contains("webview.auth"))+ }++ @Test fun aHiddenSignInIsAskedForByAGenericOptionOnly() {+ val host = AuthHost()+ assertEquals("""{"v":"auth-1"}""", hooked("myspoti.auth.open({ url: 'https://id.example.com/check', callback: 'myext://done', hidden: true })", host, a("webview.auth")))+ assertEquals("""{"v":"auth-2"}""", hooked("myspoti.auth.open({ url: 'https://id.example.com/check', callback: 'myext://done' })", host, a("webview.auth")))+ // Only a real true hides it; and hidden or not, the addresses are checked the same way.+ assertEquals("""{"v":"auth-3"}""", hooked("myspoti.auth.open({ url: 'https://id.example.com/check', callback: 'myext://done', hidden: 'yes' })", host, a("webview.auth")))+ assertTrue(hooked("myspoti.auth.open({ url: 'http://id.example.com/', callback: 'myext://done', hidden: true })", host, a("webview.auth"))!!.startsWith("""{"v":"error:"""))+ assertEquals(listOf(true, false, false), host.opened.map { it.hidden })+ assertEquals(AuthRequest("https://id.example.com/check", "myext://done", hidden = true), host.opened[0])+ }++ @Test fun theCallbackIsReachedByItsPrefixOnly() {+ val r = AuthRequest("https://id.example.com/", "https://cb.example.com/done")+ assertTrue(r.reached("https://cb.example.com/done?code=1"))+ assertTrue(r.reached("https://cb.example.com/done"))+ assertFalse(r.reached("https://cb.example.com/doneX?code=1"))+ assertFalse(r.reached("https://cb.example.com.evil.net/done"))+ assertTrue(AuthRequest("https://id.example.com/", "myext://done").reached("myext://done#token=1"))+ }++ @Test fun authAndOnlineEventsNeedTheirActions() {+ val host = AuthHost()+ val script = "myspoti.on('auth', function (e) { myspoti.storage.set('auth', e); }); myspoti.on('online', function () { myspoti.storage.set('online', true); }); myspoti.work.whenOnline();"+ ExtensionRuntime(manifest(a("webview.auth"), a("network", hosts = listOf("api.example.com")), a("storage")), script, host, setOf("webview.auth", "network", "storage")).use { rt ->+ rt.start()+ assertEquals(1, host.online)+ assertTrue(rt.listens(ExtensionRuntime.EVENT_AUTH) && rt.listens(ExtensionRuntime.EVENT_ONLINE))+ rt.emit(ExtensionRuntime.EVENT_AUTH, ExtJson.encodeToString(AuthResult.serializer(), AuthResult("auth-1", url = "myext://done?code=1")))+ rt.emit(ExtensionRuntime.EVENT_ONLINE, "{}")+ }+ assertTrue(ExtensionRuntime(manifest(a("storage")), "myspoti.on('auth', function () {});", host, setOf("storage")).runCatching { use { it.start() } }.isFailure)+ assertTrue(ExtensionRuntime(manifest(a("storage")), "myspoti.work.whenOnline();", host, setOf("storage")).runCatching { use { it.start() } }.isFailure)+ assertEquals(1, host.online)+ }++ @Test fun aButtonSettingHasNoDefaultAndTheSettingEventNeedsSettingsPage() {+ val ok = Manifest("io.github.test.act", "Act", "1.0", author = "me", actions = listOf(a("settings.page")),+ settings = listOf(Setting("pair", "button", "Pair again"), Setting("quality", "choice", "Quality", options = listOf("FLAC", "MP3"))))+ assertEquals(emptyList<String>(), ok.problems())+ val bad = ok.copy(settings = listOf(Setting("pair", "button", "Pair again", default = kotlinx.serialization.json.JsonPrimitive(true))))+ assertTrue(bad.problems().any { "button has no default" in it })++ val host = QuietHost()+ ExtensionRuntime(ok.copy(actions = listOf(a("settings.page"), a("storage"))), "myspoti.on('setting', function (e) { myspoti.storage.set('last', e); });", host, setOf("settings.page", "storage")).use { rt ->+ rt.start()+ assertTrue(rt.listens(ExtensionRuntime.EVENT_SETTING))+ rt.emit(ExtensionRuntime.EVENT_SETTING, """{"key":"pair","pressed":true}""")+ }+ assertEquals("""{"key":"pair","pressed":true}""", host.store.get("last"))+ assertTrue(ExtensionRuntime(manifest(a("storage")), "myspoti.on('setting', function () {});", host, setOf("storage")).runCatching { use { it.start() } }.isFailure)+ }++ @Test fun oldManifestsMapToActions() {+ val old = Manifest("io.github.old.ext", "Old", "1.0", author = "me", provides = listOf("lyrics", "download-source"),+ permissions = listOf(+ PermissionRequest("download-source", why = "Finds the files on my own server, nowhere else at all"),+ PermissionRequest("network", listOf("api.example.com")),+ PermissionRequest("player.read", why = "Scrobbles"),+ PermissionRequest("player.control"),+ PermissionRequest("notify"),+ ))+ assertTrue(old.isLegacy)+ assertEquals(emptyList<String>(), old.problems())+ assertEquals(+ listOf("lyrics.provide", "download.source", "network", "playback.events", "playback.control", "notify", "storage"),+ old.declared().map { it.name },+ )+ assertEquals("Finds the files on my own server, nowhere else at all", old.asks().first { it.key == "download.source" }.why)+ assertEquals(listOf("api.example.com"), old.hosts())+ // What an old install was granted becomes its actions; new keys are kept as they are.+ assertEquals(+ setOf("lyrics.provide", "network", "playback.events", "library.read", "storage", "settings.page"),+ Action.migrateGranted(setOf("lyrics", "network", "spotify.library.read")),+ )+ assertEquals(setOf("lyrics.provide", "network.any"), Action.migrateGranted(setOf("lyrics.provide", "network.any")))+ // An old install keeps working: granted with old keys, its hook and its storage answer.+ val host = QuietHost()+ ExtensionRuntime(old, "myspoti.storage.set('a', 1); myspoti.provide('lyrics', function () { return { plain: 'la ' + myspoti.storage.get('a') }; });",+ host, setOf("lyrics", "network", "download-source")).use { rt ->+ rt.start()+ assertEquals("""{"plain":"la 1"}""", rt.call(Hook.LYRICS, track.toJson(), 3_000))+ }+ }++ @Test fun everyActionSaysWhyIn80Characters() {+ assertEquals(emptyList<String>(), manifest(a("lyrics.provide"), a("network", hosts = listOf("lrclib.net"))).problems())+ val missing = manifest(a("lyrics.provide", why = " ")).problems()+ assertTrue(missing.toString(), missing.single().contains("action \"lyrics.provide\": say why"))+ val long = manifest(a("lyrics.provide", why = "x".repeat(81))).problems()+ assertTrue(long.toString(), long.single().contains("81 characters, 80 at most"))+ assertTrue(manifest(a("lyrics.provide", why = "x".repeat(80))).problems().isEmpty())+ // Unknown names, twice the same, hosts out of place, settings without their page, both formats at once.+ val p = manifest(a("everything"), a("notify"), a("notify"), a("storage", hosts = listOf("x.org")), a("network")).copy(+ settings = listOf(Setting("k", label = "K")), provides = listOf("lyrics"),+ ).problems().joinToString("\n")+ for (want in listOf("action \"everything\": unknown", "an action listed twice", "only network takes hosts", "network: list the hosts",+ "settings.page action", "cannot be mixed")) assertTrue("$want in\n$p", p.contains(want))+ assertTrue(manifest().problems().single().startsWith("actions: at least one"))+ }++ @Test fun theRuntimeChecksActionsNotNames() {+ val m = manifest(a("home.sections"), a("menu.items"), a("storage"))+ val host = QuietHost()+ val script = """+ myspoti.provide('home', function () { return [{ type: 'section', title: 'Mine', blocks: [{ type: 'text', text: 'hi' }] }]; });+ myspoti.provide('tap', function (e) { myspoti.log('tap ' + e.action); myspoti.ui.refresh('home'); });+ """+ ExtensionRuntime(m, script, host, m.asks().map { it.key }.toSet(), guard = SurfaceGuard()).use { rt ->+ rt.start()+ assertTrue(rt.provides(Hook.HOME) && rt.provides(Hook.TAP) && !rt.provides(Hook.LYRICS))+ val blocks = Blocks.parse(rt.call(Hook.HOME, "{}", 3_000)!!, Surface.HOME)+ assertEquals(listOf(Block.Section("Mine", null, listOf(Block.Text("hi", TextStyle.BODY)))), blocks)+ rt.call(Hook.TAP, """{"action":"go","surface":"home"}""", 3_000)+ }+ assertEquals(listOf("tap go"), host.logs)+ assertEquals(listOf("home"), host.refreshed)+ // A hook whose action is not declared cannot even be provided.+ try {+ ExtensionRuntime(m, "myspoti.provide('player', function () { return []; });", host, emptySet()).use { it.start() }+ fail("provided player without player.buttons")+ } catch (e: ExtensionException) { assertTrue(e.message, e.message!!.contains("player.buttons")) }+ // Declared but not granted: the app does not ask it.+ ExtensionRuntime(m, script, host, setOf("menu.items"), guard = SurfaceGuard()).use { rt ->+ rt.start()+ assertFalse(rt.provides(Hook.HOME))+ assertNull(rt.call(Hook.HOME, "{}", 3_000))+ }+ }++ // ── Native blocks ──++ @Test fun blocksAreParsedForTheirPlace() {+ val home = Blocks.parse("""[+ { "type": "card", "title": "Daily", "subtitle": "for you", "image": "https://i.example.org/a.jpg", "open": "spotify:playlist:37i9dQZF1" },+ { "type": "section", "title": "Picks", "blocks": [+ { "type": "tracks", "title": "Songs", "items": [{ "uri": "spotify:track:4uLU6hMCjMI75M1A2tKUQC", "title": "One" }] },+ { "type": "button", "label": "More", "icon": "nope", "action": "more" },+ { "type": "hologram", "text": "from a newer app" } ] }+ ]""", Surface.HOME)+ assertEquals(2, home.size)+ val picks = home[0] as Block.Section+ assertEquals("Picks", picks.title)+ assertEquals(Block.Button("More", Blocks.DEFAULT_ICON, "more"), picks.blocks[1])+ assertEquals(2, picks.blocks.size)+ assertEquals(Block.Section("", null, listOf(Block.Card("Daily", "for you", "https://i.example.org/a.jpg", Target("spotify:playlist:37i9dQZF1", null)))), home[1])++ val menu = Blocks.parse("""[{ "type": "menu", "label": "Find the sample", "icon": "search", "action": "sample" }]""", Surface.TRACK_MENU)+ assertEquals(listOf(Block.MenuEntry("Find the sample", "search", "sample")), menu)+ assertEquals(1, Blocks.parse("""{ "type": "button", "label": "Scrobble", "icon": "check", "action": "s" }""", Surface.PLAYER).size)++ for ((json, surface) in listOf(+ """[{ "type": "card", "title": "x" }]""" to Surface.PLAYER, // not a button+ """[{ "type": "menu", "label": "x" }]""" to Surface.TRACK_MENU, // no action+ """[{ "type": "card", "title": "x", "open": "https://evil.example.org" }]""" to Surface.HOME, // not a spotify uri+ """[{ "type": "card", "title": "x", "open": "spotify:track:a", "action": "b" }]""" to Surface.HOME, // both+ """[{ "type": "image", "url": "http://i.example.org/a.jpg" }]""" to Surface.HOME, // not https+ """[{ "type": "image", "url": "https://192.168.1.1/a.jpg" }]""" to Surface.HOME, // local+ """[{ "type": "albums", "items": [{ "uri": "spotify:track:a", "title": "x" }] }]""" to Surface.SEARCH, // wrong kind+ """[{ "type": "section", "blocks": [{ "type": "section", "blocks": [] }] }]""" to Surface.HOME, // nested+ """[{ "type": "button", "label": "x", "action": "a b" }]""" to Surface.HOME, // bad action id+ List(5) { """{ "type": "menu", "label": "x", "action": "a" }""" }.joinToString(",", "[", "]") to Surface.ARTIST_MENU, // too many+ )) {+ try { Blocks.parse(json, surface); fail("$surface accepted $json") } catch (_: ExtensionException) {}+ }+ assertEquals(PageContent("Act", "<p>hi</p>"), PageContent.parse("""{ "html": "<p>hi</p>" }""", "Act"))+ }++ @Test fun aPageLoadsOnlyFromItsHosts() {+ val hosts = listOf("api.example.com", "*.cdn.example.org")+ assertTrue(PageNetwork.allows("https://api.example.com/a.png", "GET", hosts, networkGranted = true, anyGranted = false))+ assertTrue(PageNetwork.allows("https://img.cdn.example.org/a.png", "GET", hosts, true, false))+ for (url in listOf("http://api.example.com/a", "https://other.org/a", "https://open.spotify.com/", "https://10.0.0.1/a", "file:///sdcard/a"))+ assertFalse(url, PageNetwork.allows(url, "GET", hosts, true, false))+ assertFalse(PageNetwork.allows("https://api.example.com/a", "POST", hosts, true, false))+ assertFalse("not granted", PageNetwork.allows("https://api.example.com/a", "GET", hosts, false, false))+ assertTrue(PageNetwork.allows("https://any.org/a", "GET", listOf("*"), false, true))+ assertFalse(PageNetwork.allows("https://api.spotify.com/v1/me", "GET", listOf("*"), false, true))+ val csp = PageNetwork.csp(hosts + "*.spotify.com", true, false)+ assertTrue(csp, csp.contains("connect-src https://api.example.com https://*.cdn.example.org;") && !csp.contains("spotify") && csp.contains("frame-src 'none'"))+ assertTrue(PageNetwork.wrap("<p>x</p>", csp).startsWith("<meta http-equiv=\"Content-Security-Policy\""))+ }++ // ── Protected surfaces ──++ @Test fun noActionReachesAProtectedSurface() {+ val protectedKeys = ProtectedSurface.entries.map { it.key }.toSet()+ // The places extensions draw and the protected ones never meet, by name or by action.+ assertTrue(Surface.entries.none { it.key in protectedKeys || it.key.substringBefore('.') in protectedKeys })+ assertTrue(Action.entries.none { it.key in protectedKeys || it.key.substringBefore('.') in protectedKeys })+ assertTrue(Hook.entries.none { it.key in protectedKeys })+ // No event about them exists, and an extension cannot listen for one.+ assertTrue(ExtensionRuntime.EVENTS.keys.none { it in protectedKeys })+ val m = manifest(a("playback.events"))+ for (event in protectedKeys) {+ try {+ ExtensionRuntime(m, "myspoti.on('$event', function () {});", QuietHost(), m.asks().map { it.key }.toSet()).use { it.start() }+ fail("listened to $event")+ } catch (e: ExtensionException) { assertTrue(e.message!!.contains("unknown event")) }+ }+ // A block can only open Spotify content or call its own extension back.+ for (uri in listOf("myspoti:support", "myspoti:about", "myspoti:update", "spotify:user:me", "intent://x")) {+ try { Blocks.parse("""[{ "type": "card", "title": "x", "open": "$uri" }]""", Surface.HOME); fail(uri) } catch (_: ExtensionException) {}+ }+ }++ @Test fun extensionUiWaitsWhileAProtectedSurfaceShows() {+ val guard = SurfaceGuard()+ val m = manifest(a("home.sections"), a("webview.page"), a("lyrics.provide"))+ val host = QuietHost()+ val script = """+ myspoti.provide('home', function () { return [{ type: 'text', text: 'hi' }]; });+ myspoti.provide('lyrics', function () { return { plain: 'la' }; });+ myspoti.provide('page', function () { return { html: 'x' }; });+ myspoti.provide('message', function (d) { myspoti.page.post({ echo: d }); return 'ok'; });+ myspoti.provide('tap', function () { myspoti.log('tapped'); });+ """+ ExtensionRuntime(m, script, host, m.asks().map { it.key }.toSet(), guard = guard).use { rt ->+ rt.start()+ assertTrue(rt.call(Hook.HOME, "{}", 3_000) != null)+ guard.shown(ProtectedSurface.SUPPORT)+ guard.shown(ProtectedSurface.SUPPORT) // shown twice (two sheets), hidden once: still there+ guard.hidden(ProtectedSurface.SUPPORT)+ assertTrue(guard.suspended)+ assertEquals(setOf(ProtectedSurface.SUPPORT), guard.state.value)+ for (h in listOf(Hook.HOME, Hook.PAGE, Hook.MESSAGE, Hook.TAP)) assertNull(h.key, rt.call(h, "{}", 3_000))+ // What is not drawn goes on: lyrics are no UI over the app.+ assertEquals("""{"plain":"la"}""", rt.call(Hook.LYRICS, track.toJson(), 3_000))+ guard.hidden(ProtectedSurface.SUPPORT)+ assertFalse(guard.suspended)+ assertEquals("\"ok\"", rt.call(Hook.MESSAGE, "\"hi\"", 3_000))+ }+ assertTrue(host.logs.none { it == "tapped" })+ assertEquals(listOf("""{"echo":"hi"}"""), host.posted)+ }+}diff --git a/base/extensions/src/test/kotlin/app/myspoti/extensions/ConflictsTest.kt b/base/extensions/src/test/kotlin/app/myspoti/extensions/ConflictsTest.ktnew file mode 100644index 00000000..8342c63f--- /dev/null+++ b/base/extensions/src/test/kotlin/app/myspoti/extensions/ConflictsTest.kt@@ -0,0 +1,153 @@+package app.myspoti.extensions++import org.junit.Assert.assertEquals+import org.junit.Assert.assertFalse+import org.junit.Assert.assertNull+import org.junit.Assert.assertTrue+import org.junit.Test++/** Extensions together: additive merges, exclusive choices, the playback arbiter, quotas, conflicts, isolation. */+class ConflictsTest {+ private fun m(id: String, vararg actions: String, conflictsWith: List<String> = emptyList(), replaces: List<String> = emptyList()) =+ Manifest(id, id.substringAfterLast('.'), "1.0", author = "me", actions = actions.map { ActionRequest(it, "Because it is needed here") },+ conflictsWith = conflictsWith, replaces = replaces)++ @Test fun modes() {+ assertEquals(setOf(Action.AUDIO_SOURCE, Action.DOWNLOAD_SOURCE), Action.entries.filter { it.mode == Mode.EXCLUSIVE }.toSet())+ assertTrue(listOf(Action.LYRICS_PROVIDE, Action.MENU_ITEMS, Action.HOME_SECTIONS, Action.SEARCH_PROVIDE, Action.TRACKINFO_PROVIDE).all { it.mode == Mode.ADDITIVE })+ assertEquals(Mode.SHARED, Action.NETWORK.mode)+ }++ @Test fun anExclusiveActionHasOneActiveExtension() {+ val a = m("io.x.a", "audio.source")+ val b = m("io.x.b", "audio.source", "download.source")+ val lyrics = m("io.x.l", "lyrics.provide")+ // Nothing chosen: the first in priority acts; a choice wins while that one is there.+ assertEquals("io.x.a", Conflicts.activeFor(listOf("io.x.a", "io.x.b"), null))+ assertEquals("io.x.b", Conflicts.activeFor(listOf("io.x.a", "io.x.b"), "io.x.b"))+ assertEquals("io.x.a", Conflicts.activeFor(listOf("io.x.a"), "io.x.gone"))+ assertNull(Conflicts.activeFor(emptyList(), "io.x.b"))+ // Installing b next to a: it would replace a for audio; downloads are free. Additive actions never clash.+ assertEquals(listOf(Clash(Clash.Kind.EXCLUSIVE, "io.x.a", Action.AUDIO_SOURCE)), Conflicts.clashes(b, listOf(a, lyrics), emptyMap()))+ assertEquals(emptyList<Clash>(), Conflicts.clashes(m("io.x.l2", "lyrics.provide"), listOf(lyrics), emptyMap()))+ // With b active for audio, a new audio source would replace b.+ val c = m("io.x.c", "audio.source")+ assertEquals("io.x.b", Conflicts.clashes(c, listOf(a, b), mapOf("audio.source" to "io.x.b")).single().otherId)+ }++ @Test fun conflictsWithAndReplacesAreAskedEitherWay() {+ val a = m("io.x.a", "notify")+ val b = m("io.x.b", "notify", conflictsWith = listOf("io.x.a"))+ val c = m("io.x.c", "notify", replaces = listOf("io.x.a"))+ assertEquals(listOf(Clash(Clash.Kind.CONFLICT, "io.x.a")), Conflicts.clashes(b, listOf(a), emptyMap()))+ // Declared by the one installed: still a conflict.+ assertEquals(listOf(Clash(Clash.Kind.CONFLICT, "io.x.b")), Conflicts.clashes(a, listOf(b), emptyMap()))+ assertEquals(listOf(Clash(Clash.Kind.REPLACES, "io.x.a")), Conflicts.clashes(c, listOf(a), emptyMap()))+ assertTrue(Conflicts.clashes(b, listOf(b), emptyMap()).isEmpty())+ val bad = m("io.x.d", "notify", conflictsWith = listOf("io.x.d", "Not An Id")).problems().joinToString()+ assertTrue(bad, bad.contains("not its own id") && bad.contains("\"Not An Id\""))+ }++ @Test fun additiveBlocksAreMergedDeduplicatedAndQuotaed() {+ fun menu(vararg labels: String) = labels.map { Block.MenuEntry(it, "add", it.lowercase().replace(' ', '-')) }+ val merged = Conflicts.merge(listOf(+ "a" to menu("Count", "Share lyrics", "Third"),+ "b" to menu("count", "Find sample"),+ "c" to menu("Translate", "Shazam it"),+ ), Surface.TRACK_MENU)+ // a keeps 2 on screen (its quota), b's "count" is a's again, the menu holds 4: the rest is under "Extensions ⋯".+ assertEquals(listOf("a" to "Count", "a" to "Share lyrics", "b" to "Find sample", "c" to "Translate"), merged.shown.map { it.first to (it.second as Block.MenuEntry).label })+ assertEquals(listOf("a" to "Third", "c" to "Shazam it"), merged.overflow.map { it.first to (it.second as Block.MenuEntry).label })+ // Items: the same song from a lower extension is dropped; Home drops what is over its quota.+ val song = Item("spotify:track:1", "One", null, null)+ val home = Conflicts.merge(listOf(+ "a" to listOf(Block.Section("A", null, listOf(Block.Items(ItemKind.TRACKS, null, listOf(song))))),+ "b" to listOf(+ Block.Section("B", null, listOf(Block.Items(ItemKind.TRACKS, null, listOf(song, Item("spotify:track:2", "Two", null, null))))),+ Block.Section("B2", null, listOf(Block.Text("x", TextStyle.BODY))),+ Block.Section("B3", null, listOf(Block.Text("y", TextStyle.BODY))),+ ),+ ), Surface.HOME)+ assertEquals(listOf("A", "B", "B2"), home.shown.map { (it.second as Block.Section).title })+ assertEquals(listOf("Two"), ((home.shown[1].second as Block.Section).blocks.single() as Block.Items).items.map { it.title })+ assertTrue(home.overflow.isEmpty())+ // The player: one button each on screen.+ val player = Conflicts.merge(listOf("a" to listOf(Block.Button("A1", "add", "1"), Block.Button("A2", "add", "2")), "b" to listOf(Block.Button("B1", "add", "1"))), Surface.PLAYER)+ assertEquals(listOf("A1", "B1"), player.shown.map { (it.second as Block.Button).label })+ assertEquals(listOf("A2"), player.overflow.map { (it.second as Block.Button).label })+ }++ @Test fun theArbiterSettlesContradictionsByPriority() {+ var now = 0L+ val rank = mapOf("high" to 0, "low" to 1)+ val arbiter = PlaybackArbiter({ rank.getValue(it) }, { now })+ assertTrue(arbiter.submit("low", "next").allowed)+ // The higher one says otherwise within the window: it wins.+ now += 500+ assertEquals(PlaybackArbiter.Verdict(true, "overrides", winner = "high"), arbiter.submit("high", "previous"))+ // The lower one answers back: dropped.+ now += 500+ assertEquals(PlaybackArbiter.Verdict(false, "overridden", winner = "high"), arbiter.submit("low", "next"))+ // Another group, or after the window: no contest.+ assertTrue(arbiter.submit("low", "pause").allowed)+ now += 5_000+ assertTrue(arbiter.submit("low", "next").allowed)+ }++ @Test fun aLoopSuspendsTheLowerOne() {+ var now = 0L+ val arbiter = PlaybackArbiter({ if (it == "high") 0 else 1 }, { now })+ var suspended: String? = null+ repeat(6) { i ->+ now += 1_000+ val v = arbiter.submit(if (i % 2 == 0) "low" else "high", if (i % 2 == 0) "next" else "previous")+ v.suspend?.let { suspended = it }+ }+ assertEquals("low", suspended)+ assertTrue(arbiter.isSuspended("low"))+ assertEquals("suspended", arbiter.submit("low", "next").reason)+ assertTrue(arbiter.submit("high", "next").allowed)+ arbiter.resume("low")+ now += 60_000+ assertTrue(arbiter.submit("low", "next").allowed)+ }++ @Test fun eachExtensionHasACommandRate() {+ var now = 0L+ val arbiter = PlaybackArbiter({ 0 }, { now }, perMinute = 5)+ repeat(5) { now += 100; assertTrue(arbiter.submit("a", "seek").allowed) }+ assertEquals("rate", arbiter.submit("a", "seek").reason)+ assertTrue(arbiter.submit("b", "pause").allowed)+ now += 61_000+ assertTrue(arbiter.submit("a", "seek").allowed)+ }++ @Test fun theActivityLogIsPerArea() {+ var now = 0L+ val log = ActivityLog(max = 3) { now++ }+ log.add(Area.LYRICS, "a", "Lyrics from A")+ log.add(Area.PLAYBACK, "b", "Skipped by B")+ log.add(Area.LYRICS, "c", "Lyrics from C")+ log.add(Area.LYRICS, "d", "Lyrics from D")+ assertEquals(listOf("d", "c"), log.forArea(Area.LYRICS).map { it.extensionId })+ assertEquals(listOf("Skipped by B"), log.forArea(Area.PLAYBACK).map { it.text })+ }++ @Test fun oneExtensionCannotReachAnothersData() {+ val stores = HashMap<String, MemoryStorage>()+ val host = object : Host {+ override fun log(extensionId: String, message: String) {}+ override fun storage(extensionId: String): Storage = stores.getOrPut(extensionId) { MemoryStorage() }+ override fun setting(extensionId: String, key: String): String? = "\"$extensionId\""+ }+ val a = m("io.x.a", "storage", "lyrics.provide")+ val b = m("io.x.b", "storage", "lyrics.provide")+ val write = "myspoti.storage.set('secret', 42); myspoti.provide('lyrics', function () { return { plain: String(myspoti.storage.get('secret')) }; });"+ val read = "myspoti.provide('lyrics', function () { return { plain: String(myspoti.storage.get('secret')) + ' ' + myspoti.settings.get('x') }; });"+ val track = TrackInfo("t", "spotify:track:t", "T", "A", listOf("A"), "B", 1).toJson()+ ExtensionRuntime(a, write, host, a.asks().map { it.key }.toSet()).use { it.start(); assertEquals("""{"plain":"42"}""", it.call(Hook.LYRICS, track, 3_000)) }+ ExtensionRuntime(b, read, host, b.asks().map { it.key }.toSet()).use { it.start(); assertEquals("""{"plain":"undefined io.x.b"}""", it.call(Hook.LYRICS, track, 3_000)) }+ assertEquals(setOf("io.x.a", "io.x.b"), stores.keys)+ assertFalse(stores.getValue("io.x.b").snapshot().containsKey("secret"))+ }+}diff --git a/base/extensions/src/test/kotlin/app/myspoti/extensions/GitHubTest.kt b/base/extensions/src/test/kotlin/app/myspoti/extensions/GitHubTest.ktnew file mode 100644index 00000000..bfb619fa--- /dev/null+++ b/base/extensions/src/test/kotlin/app/myspoti/extensions/GitHubTest.kt@@ -0,0 +1,267 @@+package app.myspoti.extensions++import org.junit.Assert.assertArrayEquals+import org.junit.Assert.assertEquals+import org.junit.Assert.assertFalse+import org.junit.Assert.assertNotNull+import org.junit.Assert.assertNull+import org.junit.Assert.assertTrue+import org.junit.Test+import java.io.ByteArrayOutputStream+import java.util.zip.ZipEntry+import java.util.zip.ZipInputStream+import java.util.zip.ZipOutputStream++/** GitHub sources, the update gate, the kill switch, the store's discovery and ranking. */+class GitHubTest {+ private fun req(name: String, why: String = "Because it needs it", hosts: List<String> = emptyList()) = ActionRequest(name, why, hosts)++ private fun manifest(code: Int, vararg actions: ActionRequest, author: String = "me", replaces: List<String> = emptyList()) =+ Manifest("io.github.me.ext", "Ext", "1.$code", code, author = author, actions = actions.toList(), replaces = replaces)++ private fun snap(m: Manifest, repo: String? = "me/ext") = Snapshot.of(m, repo)++ private val lyrics = req("lyrics.provide", "Synced lyrics from LRCLIB")+ private val net = req("network", "Asks LRCLIB", listOf("lrclib.net"))++ // ── The update gate ──++ @Test fun anUpdateAskingNothingNewIsApplied() {+ val accepted = snap(manifest(1, lyrics, net))+ assertEquals(UpdateGate.Decision.Apply, UpdateGate.decide(accepted, snap(manifest(2, lyrics, net))))+ // Asking less is not a change either.+ assertEquals(UpdateGate.Decision.Apply, UpdateGate.decide(accepted, snap(manifest(2, lyrics))))+ }++ @Test fun everyNewRequestHoldsTheUpdateBack() {+ val accepted = snap(manifest(1, lyrics, net))+ fun changes(vararg a: ActionRequest, author: String = "me", repo: String? = "me/ext", replaces: List<String> = emptyList()) =+ (UpdateGate.decide(accepted, snap(manifest(2, *a, author = author, replaces = replaces), repo)) as UpdateGate.Decision.Ask).changes++ changes(lyrics, net, req("home.sections", "Your top songs")).single().let { assertEquals(Change.Kind.ACTION, it.kind); assertFalse(it.critical) }+ changes(lyrics, net, req("library.write", "Saves the songs you like")).single().let { assertTrue(it.critical) }+ changes(lyrics, net, req("webview.page", "Its own page")).single().let { assertEquals("webview.page", it.key); assertTrue(it.critical) }+ changes(lyrics, net, req("download.source", "Downloads")).single().let { assertEquals(Change.Kind.ACTION, it.kind); assertTrue(it.critical) }+ changes(lyrics, req("network", "Asks LRCLIB", listOf("lrclib.net", "evil.example"))).single().let { assertEquals(Change.Kind.HOST, it.kind); assertEquals("evil.example", it.key) }+ changes(lyrics, req("network", "Asks LRCLIB", listOf("*"))).single().let { assertTrue(it.critical) }+ // Any change of a why counts, even a small one.+ changes(req("lyrics.provide", "Synced lyrics from LRCLIB."), net).single().let { assertEquals(Change.Kind.WHY, it.kind); assertEquals("Synced lyrics from LRCLIB", it.before) }+ assertEquals(Change.Kind.AUTHOR, changes(lyrics, net, author = "someone else").single().kind)+ assertEquals(Change.Kind.REPO, changes(lyrics, net, repo = "thief/ext").single().kind)+ assertEquals(Change.Kind.REPLACES, changes(lyrics, net, replaces = listOf("io.github.other.lyrics")).single().kind)+ }++ @Test fun anExclusiveRoleOnAnAcceptedActionIsAChange() {+ val m = manifest(1, req("audio.source", "Plays from my server"))+ val accepted = snap(m).copy(exclusive = emptyList())+ val c = (UpdateGate.decide(accepted, snap(manifest(2, req("audio.source", "Plays from my server")))) as UpdateGate.Decision.Ask).changes.single()+ assertEquals(Change.Kind.EXCLUSIVE, c.kind)+ // A new exclusive action is listed once, as an action.+ val fresh = (UpdateGate.decide(snap(manifest(1, lyrics)), snap(manifest(2, lyrics, req("audio.source", "x")))) as UpdateGate.Decision.Ask).changes+ assertEquals(listOf(Change.Kind.ACTION), fresh.map { it.kind })+ }++ @Test fun theDiffIsAgainstTheAcceptedSnapshotNotThePreviousVersion() {+ val accepted = snap(manifest(1, lyrics, net))+ // v2 drops network: applied by itself; the accepted snapshot stays the user's.+ assertEquals(UpdateGate.Decision.Apply, UpdateGate.decide(accepted, snap(manifest(2, lyrics))))+ // v3 brings it back with another reason and a new host: against v2 everything would look new,+ // against v1 only what the user never accepted is.+ val v3 = snap(manifest(3, lyrics, req("network", "Sends your plays to my server", listOf("lrclib.net", "tracker.example"))))+ val c = (UpdateGate.decide(accepted, v3) as UpdateGate.Decision.Ask).changes+ assertEquals(listOf(Change.Kind.WHY to "network", Change.Kind.HOST to "tracker.example"), c.map { it.kind to it.key })+ // Back exactly as accepted: nothing to ask.+ assertEquals(UpdateGate.Decision.Apply, UpdateGate.decide(accepted, snap(manifest(4, lyrics, net))))+ }++ @Test fun anOldManifestIsComparedThroughItsActions() {+ val old = Manifest("io.github.me.ext", "Ext", "1", 1, author = "me", provides = listOf("lyrics"),+ permissions = listOf(PermissionRequest("lyrics", why = "Synced lyrics from LRCLIB"), PermissionRequest("network", listOf("lrclib.net"), "Asks LRCLIB")))+ val accepted = snap(old)+ assertEquals(UpdateGate.Decision.Apply, UpdateGate.decide(accepted, snap(manifest(2, lyrics, net, req("storage", "")))))+ assertEquals(accepted, Snapshot.of(old, "me/ext"))+ assertEquals(old.asks().map { it.key }, accepted.toManifest().asks().map { it.key })+ }++ // ── The kill switch ──++ @Test fun blockedJsonTurnsOffByIdOrPackage() {+ val b = BlockList.parse("""{ "blocked": [ { "id": "a.b.all", "reason": "malware" }, { "id": "a.b.some", "sha256": ["ABCD"] } ],+ "flagged": [ { "id": "a.b.flag", "reason": "stolen" } ], "later": 1 }""")+ assertEquals("malware", b.blocks("a.b.all", "anything")!!.reason)+ assertNotNull(b.blocks("a.b.some", "abcd"))+ assertNull(b.blocks("a.b.some", "ffff"))+ assertNull(b.blocks("a.b.flag", null))+ assertEquals("stolen", b.flags("a.b.flag")!!.reason)+ // Not created yet: an empty list, nothing turned off.+ assertEquals(BlockList.EMPTY, BlockList.of(404, "Not Found"))+ assertEquals(BlockList.EMPTY, BlockList.parse(""))+ }++ // ── Ranking ──++ private fun ranked(id: String, up: Int, down: Int, updated: Long = 0) = Ranking.Ranked(id, id, null, Rating(up, down, 1), updated)++ @Test fun theScoreIsBayesian() {+ assertEquals(Ranking.PRIOR_MEAN, Ranking.score(null), 1e-9)+ // Three 👍 do not outrank a hundred votes at 95 %.+ assertTrue(Ranking.score(Rating(95, 5)) > Ranking.score(Rating(3, 0)))+ assertTrue(Ranking.score(Rating(3, 0)) > Ranking.score(null))+ assertEquals(5.0, Ranking.stars(Rating(10_000, 0)), 0.05)+ assertEquals(3.8, Ranking.stars(null), 1e-9)+ }++ @Test fun orderIsScoreThenRecency() {+ val list = listOf(ranked("new", 0, 0, 2000), ranked("old", 0, 0, 1000), ranked("loved", 95, 5, 10), ranked("hated", 2, 30, 3000))+ assertEquals(listOf("loved", "new", "old", "hated"), Ranking.order(list).map { it.id })+ }++ @Test fun showAllRevealsTheHiddenOnes() {+ val now = 100L * 365 * 24 * 3600 * 1000+ val blocks = BlockList(listOf(Catalog.Block("blocked")), listOf(BlockList.Flag("flagged")))+ val list = listOf(+ ranked("fine", 0, 0, now), ranked("blocked", 50, 0, now), ranked("flagged", 50, 0, now),+ ranked("hated", 1, 20, now), ranked("fewvotes", 0, 3, now), ranked("stale", 5, 0, now - Ranking.STALE_MS - 1),+ )+ assertEquals(Ranking.Hidden.BLOCKED, Ranking.hidden(list[1], blocks, now))+ assertEquals(Ranking.Hidden.FLAGGED, Ranking.hidden(list[2], blocks, now))+ assertEquals(Ranking.Hidden.LOW_SCORE, Ranking.hidden(list[3], blocks, now))+ assertEquals(Ranking.Hidden.STALE, Ranking.hidden(list[5], blocks, now))+ assertEquals(setOf("fine", "fewvotes"), Ranking.listed(list, blocks, now, showAll = false).map { it.id }.toSet())+ assertEquals(6, Ranking.listed(list, blocks, now, showAll = true).size)+ assertEquals(Ranking.time("2026-10-23"), Ranking.time("2026-10-23T00:00:00Z"))+ assertEquals(0L, Ranking.time("soon"))+ }++ // ── Discovery ──++ @Test fun searchRatingsAndDownloadsAreRead() {+ val found = Discovery.parseSearch("""{ "total_count": 3, "items": [+ { "full_name": "me/ext", "owner": { "login": "me" }, "default_branch": "main", "pushed_at": "2026-10-01T10:00:00Z", "topics": ["myspoti-extension"] },+ { "full_name": "old/gone", "owner": { "login": "old" }, "archived": true } ] }""")+ assertEquals(listOf("me/ext"), found.map { it.fullName })+ assertEquals("https://raw.githubusercontent.com/me/ext/main/manifest.json", found.single().manifestUrl())+ val e = Discovery.entry(found.single(), manifest(3, lyrics).copy(category = "lyrics"))+ assertEquals("me/ext", e.repo)+ assertEquals("", e.sha256)+ assertEquals(Category.LYRICS, e.category())+ assertEquals("https://codeload.github.com/me/ext/zip/refs/heads/main", e.url)++ val ratings = Discovery.parseRatings("""{ "items": [+ { "number": 7, "user": { "login": "intruder" }, "repository_url": "https://api.github.com/repos/me/ext", "reactions": { "+1": 900, "-1": 0 } },+ { "number": 3, "user": { "login": "ME" }, "repository_url": "https://api.github.com/repos/me/ext", "reactions": { "+1": 12, "-1": 2 } },+ { "number": 1, "user": { "login": "x" }, "repository_url": "https://api.github.com/repos/x/unknown", "reactions": { "+1": 5 } } ] }""", setOf("me/ext"))+ assertEquals(mapOf("me/ext" to Rating(12, 2, 3)), ratings)++ assertEquals(41L, Discovery.parseDownloads("""{ "assets": [ { "name": "extension.zip", "download_count": 41 }, { "name": "other.zip", "download_count": 9 } ] }"""))+ assertEquals(9L, Discovery.parseDownloads("""{ "assets": [ { "name": "other.zip", "download_count": 9 } ] }"""))+ assertNull(Discovery.parseDownloads("""{ "assets": [] }"""))+ }++ @Test fun deviceFlowAnswersAreRead() {+ assertTrue(GitHubAuth.enabled)+ assertTrue(GitHubAuth.tokenBody("d").startsWith("client_id=Ov23liFBqyO4elV0s5gq&"))+ assertEquals(GitHubAuth.Poll.Token("gho_x"), GitHubAuth.parsePoll("""{ "access_token": "gho_x", "token_type": "bearer" }"""))+ assertEquals(GitHubAuth.Poll.Pending, GitHubAuth.parsePoll("""{ "error": "authorization_pending" }"""))+ assertEquals(GitHubAuth.Poll.SlowDown, GitHubAuth.parsePoll("""{ "error": "slow_down" }"""))+ assertTrue(GitHubAuth.parsePoll("""{ "error": "access_denied" }""") is GitHubAuth.Poll.Failed)+ assertEquals("ABCD-1234", GitHubAuth.parseDeviceCode("""{ "device_code": "d", "user_code": "ABCD-1234", "verification_uri": "https://github.com/login/device" }""").userCode)+ }++ // ── Sources ──++ @Test fun repositoriesAndTagsAreRead() {+ assertEquals("me/ext", GitHubRepo.parse("https://github.com/me/ext.git/")?.slug)+ assertEquals("me/ext", GitHubRepo.parse("github.com/me/ext/releases")?.slug)+ assertEquals("me/ext", GitHubRepo.parse("me/ext")?.slug)+ assertNull(GitHubRepo.parse("https://gitlab.com/me/ext"))+ assertNull(GitHubRepo.parse("https://example.com/ext.zip"))+ assertNull(GitHubRepo.parse("me"))+ assertEquals("v1.2.0", GitHub.tagFromLocation("https://github.com/me/ext/releases/tag/v1.2.0"))+ assertNull(GitHub.tagFromLocation("https://github.com/me/ext/releases"))+ assertEquals("new/ext", GitHub.repoOf("https://codeload.github.com/new/ext/zip/refs/heads/main"))+ assertNull(GitHub.repoOf("https://objects.githubusercontent.com/x/y"))+ val report = GitHub.reportUrl("a.b.c", "1.0", "me/ext", "ff")+ assertTrue(report.startsWith("https://github.com/kota-zo/myspoti-extensions/issues/new?template=report-extension.yml&labels=report&title=Report%3A%20a.b.c&extension=a.b.c&version=1.0"))+ assertTrue(report.endsWith("&source=https%3A%2F%2Fgithub.com%2Fme%2Fext&sha256=ff"))+ assertFalse(report.contains(' '))+ }++ /** The files of the official repository (kota-zo/myspoti-extensions) are read by the app as they are. */+ @Test fun theOfficialRepositoryFilesAreReadByTheApp() {+ val blocked = BlockList.parse("""{ "blocked": [ { "id": "io.github.a.b", "reason": "x" }, { "id": "io.github.c.d", "sha256": ["AB"], "reason": "y" } ], "flagged": [ { "id": "io.github.e.f", "reason": "z" } ] }""")+ assertNotNull(blocked.blocks("io.github.a.b", "anything"))+ assertNotNull(blocked.blocks("io.github.c.d", "ab"))+ assertNull(blocked.blocks("io.github.c.d", "cd"))+ assertNotNull(blocked.flags("io.github.e.f"))+ val empty = BlockList.parse("""{ "blocked": [], "flagged": [] }""")+ assertTrue(empty.blocked.isEmpty() && empty.flagged.isEmpty())+ val index = Catalog.parse("""{ "format": 1, "name": "Myspoti verified extensions", "extensions": [] }""")+ assertTrue(index.extensions.isEmpty())+ val verified = Catalog.parse("""{ "format": 1, "name": "v", "extensions": [ { "id": "io.github.someone.name", "name": "Name", "version": "1.0.0", "versionCode": 1, "author": "Someone", "description": "d", "actions": [ { "name": "lyrics.provide", "why": "Synced lyrics" } ], "repo": "someone/name", "url": "https://github.com/someone/name/releases/latest/download/extension.zip", "sha256": "" } ] }""")+ assertEquals("someone/name", verified.extensions.single().repo)+ }++ private fun zip(files: List<Pair<String, String>>, comment: String? = null): ByteArray {+ val out = ByteArrayOutputStream()+ ZipOutputStream(out).use { z ->+ files.forEach { (n, t) -> z.putNextEntry(ZipEntry(n)); if (!n.endsWith("/")) z.write(t.toByteArray()); z.closeEntry() }+ comment?.let { z.setComment(it) }+ }+ return out.toByteArray()+ }++ private val manifestJson = """{ "id": "io.github.me.ext", "name": "Ext", "version": "1", "author": "me", "actions": [ { "name": "lyrics.provide", "why": "Synced lyrics" } ] }"""++ @Test fun anArchiveIsCutDownToThePackage() {+ val commit = "0123456789abcdef0123456789abcdef01234567"+ val archive = zip(listOf(+ "ext-main/" to "", "ext-main/manifest.json" to manifestJson, "ext-main/main.js" to "myspoti.provide('lyrics', function () { return null; });",+ "ext-main/README.md" to "# Ext", "ext-main/screenshot.jpg" to "jpeg", "ext-main/.github/workflows/ci.yml" to "on: push", "ext-main/src/a.ts" to "x",+ ), commit)+ assertEquals(commit, Archive.commit(archive))+ val pkgBytes = Archive.toPackage(archive)+ val p = ExtensionPackage.read(pkgBytes)+ assertEquals("io.github.me.ext", p.manifest.id)+ val names = ZipInputStream(pkgBytes.inputStream()).use { z -> generateSequence { z.nextEntry?.name }.toList() }+ assertEquals(listOf("manifest.json", "main.js", "README.md"), names)+ // The same archive always gives the same package (its sha256 can be listed in an index).+ assertArrayEquals(pkgBytes, Archive.fromArchive(archive))+ // A release's own package is kept as it is.+ assertArrayEquals(pkgBytes, Archive.toPackage(pkgBytes))+ assertNull(Archive.commit(pkgBytes))+ }++ @Test fun anArchiveWithoutManifestIsRefused() {+ val e = runCatching { Archive.toPackage(zip(listOf("r-main/README.md" to "hi"))) }.exceptionOrNull()+ assertTrue(e?.message, e is ExtensionException && "manifest.json" in e.message!!)+ val two = runCatching { Archive.fromArchive(zip(listOf("a/manifest.json" to manifestJson, "b/main.js" to ""))) }.exceptionOrNull()+ assertTrue(two?.message, "several top folders" in two?.message.orEmpty())+ }++ @Test fun spotifyWritesAreDeclaredCheckedGrantedAndAskedAgainWhenNew() {+ val events = "POST https://spclient.wg.spotify.com/gabo-receiver-service/v3/events/"+ val raw = ActionRequest("spotify.raw", "Sends your listens to Spotify", writes = listOf(events))+ val m = manifest(1, raw)+ assertTrue(m.problems().none { it.contains("write") })+ assertEquals(listOf(RawGrant("POST", "spclient.wg.spotify.com", "/gabo-receiver-service/v3/events")), m.declaredWrites())+ // Shown before install, under the action.+ assertTrue(m.asks().first { it.key == "spotify.raw" }.hosts.contains("POST https://spclient.wg.spotify.com/gabo-receiver-service/v3/events"))+ // An id in the path becomes *: the same request on another playlist, nothing else.+ val put = manifest(1, ActionRequest("spotify.raw", "Edits playlists", writes = listOf("PUT https://spclient.wg.spotify.com/playlist/v2/playlist/37i9dQZF1DXcBWIGoYBM5M/changes")))+ assertEquals("/playlist/v2/playlist/*/changes", put.declaredWrites().single().path)++ for (bad in listOf("GET https://api.spotify.com/v1/me", "POST https://example.com/x", "POST", "TRACE https://api.spotify.com/")) {+ assertTrue(bad, manifest(1, ActionRequest("spotify.raw", "x", writes = listOf(bad))).problems().any { it.contains("write") })+ }+ assertTrue(manifest(1, ActionRequest("spotify.raw", "x", writes = List(9) { "POST https://api.spotify.com/v1/x$it" })).problems().any { it.contains("8 writes") })+ assertTrue(manifest(1, ActionRequest("network", "x", listOf("a.org"), writes = listOf(events))).problems().any { it.contains("only spotify.raw takes writes") })++ // An update that adds a write waits for the user; the same writes again apply by themselves.+ val accepted = snap(manifest(1, ActionRequest("spotify.raw", "Sends your listens to Spotify")))+ val changes = (UpdateGate.decide(accepted, snap(manifest(2, raw))) as UpdateGate.Decision.Ask).changes+ assertEquals(listOf(Change.Kind.WRITE), changes.map { it.kind })+ assertTrue(changes.single().critical)+ assertEquals(UpdateGate.Decision.Apply, UpdateGate.decide(snap(m), snap(manifest(2, raw))))+ }+}diff --git a/base/extensions/src/test/kotlin/app/myspoti/extensions/ManifestTest.kt b/base/extensions/src/test/kotlin/app/myspoti/extensions/ManifestTest.ktnew file mode 100644index 00000000..5dec40c4--- /dev/null+++ b/base/extensions/src/test/kotlin/app/myspoti/extensions/ManifestTest.kt@@ -0,0 +1,99 @@+package app.myspoti.extensions++import org.junit.Assert.assertEquals+import org.junit.Assert.assertFalse+import org.junit.Assert.assertNotNull+import org.junit.Assert.assertNull+import org.junit.Assert.assertTrue+import org.junit.Assert.fail+import org.junit.Test+import java.io.File+import java.nio.file.Files++class ManifestTest {+ private val good = """+ {+ "id": "io.github.someone.lyrics",+ "name": "Some lyrics",+ "version": "1.0.0",+ "versionCode": 3,+ "author": "someone",+ "provides": ["lyrics"],+ "permissions": [{ "name": "network", "hosts": ["api.example.com"] }],+ "settings": [{ "key": "lang", "type": "choice", "label": "Language", "options": ["en", "fr"] }],+ "futureField": true+ }+ """.trimIndent()++ @Test fun aGoodManifestHasNoProblems() {+ val m = Manifest.parse(good)+ assertEquals(emptyList<String>(), m.problems())+ assertFalse(m.isCritical())+ // An old manifest: its hooks and permissions become actions, plus its settings page and storage.+ assertTrue(m.isLegacy)+ assertEquals(listOf("lyrics.provide", "network", "settings.page", "storage"), m.asks().map { it.key })+ }++ @Test fun problemsAreSaidPlainly() {+ val m = Manifest.parse(good).copy(id = "Bad", provides = listOf("lyrics", "everything"),+ permissions = listOf(PermissionRequest("network"), PermissionRequest("root")))+ val p = m.problems().joinToString("\n")+ assertTrue(p, p.contains("id \"Bad\""))+ assertTrue(p, p.contains("provides \"everything\": unknown"))+ assertTrue(p, p.contains("network: list the hosts"))+ assertTrue(p, p.contains("permission \"root\": unknown"))+ }++ @Test fun aWelcomeIsShortAndOptional() {+ assertNull(Manifest.parse(good).welcome)+ val m = Manifest.parse(good.replace("\"futureField\": true", "\"welcome\": { \"message\": \"Lyrics for every song.\", \"steps\": [\"Pick a language in Settings\"] }"))+ assertEquals(Welcome("Lyrics for every song.", listOf("Pick a language in Settings")), m.welcome)+ assertEquals(emptyList<String>(), m.problems())+ val p = m.copy(welcome = Welcome("x".repeat(601), List(6) { "step" } + "")).problems().joinToString("\n")+ assertTrue(p, p.contains("welcome.message: 600"))+ assertTrue(p, p.contains("welcome.steps: 5 at most"))+ assertTrue(p, p.contains("welcome.steps: each 1 to 160"))+ assertTrue(m.copy(welcome = Welcome()).problems().any { it.startsWith("welcome: a message or steps") })+ }++ @Test fun aSensitiveRightNeedsItsReason() {+ val m = Manifest.parse(good).copy(provides = listOf("audio-source"), permissions = listOf(PermissionRequest("network", listOf("*"))))+ assertTrue(m.isCritical())+ val p = m.problems()+ assertTrue(p.toString(), p.any { it.contains("\"audio.source\" is a critical action") })+ assertTrue(p.toString(), p.any { it.contains("\"network.any\" is a critical action") })+ val fixed = m.copy(permissions = listOf(+ PermissionRequest("network", listOf("*"), "The songs are found on whichever site has them"),+ PermissionRequest("audio-source", why = "Plays the songs from my own server instead of Spotify"),+ ))+ assertEquals(emptyList<String>(), fixed.problems())+ assertEquals("Plays the songs from my own server instead of Spotify", fixed.asks().first { it.key == "audio.source" }.why)+ }++ @Test fun packRoundTripsWithAStableHash() {+ val dir = Files.createTempDirectory("ext").toFile()+ File(dir, "manifest.json").writeText(good)+ File(dir, "main.js").writeText("myspoti.provide('lyrics', function () { return null; });")+ val a = ExtensionPackage.pack(dir)+ Thread.sleep(1_100)+ val b = ExtensionPackage.pack(dir)+ val p = ExtensionPackage.read(a)+ assertEquals(ExtensionPackage.sha256(b), p.sha256)+ assertEquals("io.github.someone.lyrics", p.manifest.id)+ File(dir, "manifest.json").writeText(good.replace("\"lyrics\"]", "\"lyrics\", \"nope\"]"))+ try { ExtensionPackage.read(ExtensionPackage.pack(dir)); fail("bad manifest read") } catch (e: ExtensionException) { assertTrue(e.message!!.contains("nope")) }+ dir.deleteRecursively()+ }++ @Test fun catalogBlocksByIdOrPackage() {+ val c = Catalog.parse("""+ { "name": "Official", "extensions": [], "blocked": [+ { "id": "a.b.c", "reason": "steals data" },+ { "id": "d.e.f", "sha256": ["aa"], "reason": "one bad build" } ] }+ """)+ assertNotNull(c.blocks("a.b.c", "zz"))+ assertNotNull(c.blocks("d.e.f", "aa"))+ assertNull(c.blocks("d.e.f", "bb"))+ assertEquals("https://x.org/repo/pkgs/a.zip", Catalog.resolve("https://x.org/repo/index.json", "pkgs/a.zip"))+ }+}diff --git a/base/extensions/src/test/kotlin/app/myspoti/extensions/SandboxTest.kt b/base/extensions/src/test/kotlin/app/myspoti/extensions/SandboxTest.ktnew file mode 100644index 00000000..5a89d8c0--- /dev/null+++ b/base/extensions/src/test/kotlin/app/myspoti/extensions/SandboxTest.kt@@ -0,0 +1,459 @@+package app.myspoti.extensions++import org.junit.Assert.assertEquals+import org.junit.Assert.assertFalse+import org.junit.Assert.assertNotNull+import org.junit.Assert.assertNull+import org.junit.Assert.assertTrue+import org.junit.Assert.fail+import org.junit.Test++class SandboxTest {+ private val track = TrackInfo("abc", "spotify:track:abc", "Song", "Artist", listOf("Artist"), "Album", 180_000)++ private class FakeHost : Host {+ val requests = mutableListOf<HttpRequest>()+ val logs = mutableListOf<String>()+ val store = MemoryStorage()+ var answer = HttpResponse(200, mapOf("content-type" to "application/json"), """{"ok":1}""")+ override fun http(extensionId: String, request: HttpRequest): HttpResponse { requests += request; return answer }+ override fun log(extensionId: String, message: String) { logs += message }+ override fun storage(extensionId: String): Storage = store+ override fun setting(extensionId: String, key: String): String? = if (key == "lang") "\"fr\"" else null+ override fun nowPlaying(): String = """{"title":"Now"}"""+ }++ private fun manifest(+ provides: List<String> = listOf("lyrics"),+ permissions: List<PermissionRequest> = listOf(PermissionRequest("network", listOf("api.example.com", "*.cdn.example.org"))),+ ) = Manifest("io.github.test.ext", "Test", "1.0", author = "me", provides = provides, permissions = permissions,+ settings = listOf(Setting("depth", "number", "Depth", default = kotlinx.serialization.json.JsonPrimitive(3))))++ private fun runtime(script: String, m: Manifest = manifest(), host: Host = FakeHost(), granted: Set<String> = m.asks().map { it.key }.toSet()) =+ ExtensionRuntime(m, script, host, granted).also { it.start() }++ /** What the lyrics hook answered when it returns the expression [expr]. */+ private fun eval(expr: String, host: Host = FakeHost(), m: Manifest = manifest(), granted: Set<String>? = null): String? =+ runtime("myspoti.provide('lyrics', function (t) { return { v: (function () { $expr })() }; });", m, host, granted ?: m.asks().map { it.key }.toSet())+ .use { it.call(Hook.LYRICS, track.toJson(), 3_000) }++ @Test fun lyricsHookAnswersAndIsParsed() {+ val out = runtime("""+ myspoti.provide('lyrics', function (t) {+ return { provider: 'Test', lines: [{ time: 0, text: t.title }, { time: 1500, text: 'by ' + t.artist, words: [{ time: 1500, text: 'by' }] }] };+ });+ """).use { it.call(Hook.LYRICS, track.toJson(), 3_000) }+ val l = LyricsResult.parse(out!!, "x")!!+ assertEquals("Test", l.provider)+ assertEquals(listOf("Song", "by Artist"), l.lines.map { it.text })+ assertTrue(l.synced)+ assertTrue(l.wordSynced)+ }++ @Test fun noHookMeansNoAnswer() {+ assertNull(runtime("// provides nothing yet").use { it.call(Hook.LYRICS, track.toJson(), 1_000) })+ }++ @Test fun modernSyntaxRuns() {+ assertEquals("""{"v":"a-2-x"}""", eval("""+ const f = (a, b) => a + '-' + b;+ let { x } = { x: 'x' };+ const [first] = ['a'];+ return f(first, `${'$'}{1 + 1}`) + '-' + x;+ """))+ }++ @Test fun noJavaNoStringCode() {+ assertEquals("""{"v":"undefined undefined undefined"}""", eval("return typeof java + ' ' + typeof Packages + ' ' + typeof JavaImporter;"))+ for (attempt in listOf("eval('1+1')", "Function('return 1')()", "(function () {}).constructor('return 1')()", "new Function('return 1')()")) {+ val out = eval("try { $attempt; return 'ran'; } catch (e) { return String(e.message); }")+ assertTrue("$attempt: $out", out!!.contains("not allowed"))+ }+ assertEquals("""{"v":true}""", eval("return (function () {}) instanceof Function && typeof Function.prototype.call === 'function';"))+ }++ @Test fun builtInObjectsCannotBeReplaced() {+ assertEquals("""{"v":"kept"}""", eval("try { myspoti = null; } catch (e) {} try { myspoti.http = null; } catch (e) {} return typeof myspoti.http.get === 'function' ? 'kept' : 'lost';"))+ assertEquals("""{"v":"undefined"}""", eval("return typeof __host;"))+ }++ @Test fun aSlowLoadIsATimeoutAndAnErrorIsNot() {+ val m = manifest()+ val slow = ExtensionRuntime(m, "while (true) {}", FakeHost(), m.asks().map { it.key }.toSet(), ExtensionRuntime.Limits(loadMs = 300))+ try { slow.start(); fail("loaded") } catch (e: ExtensionException) { assertTrue(e is ExtensionTimeout) } finally { slow.close() }+ val broken = ExtensionRuntime(m, "throw new Error('no')", FakeHost(), m.asks().map { it.key }.toSet())+ try { broken.start(); fail("loaded") } catch (e: ExtensionException) { assertFalse(e is ExtensionTimeout) } finally { broken.close() }+ }++ @Test fun aCallWaitingBehindASlowOneHasItsOwnTime() {+ // The first call takes 1.2 s; the second, 0.5 s allowed, waits for it then runs at once.+ val rt = runtime("""myspoti.provide('lyrics', function (t) {+ if (t.title === 'slow') { var end = Date.now() + 1200; while (Date.now() < end) {} }+ return { plain: t.title };+ });""")+ val slow = Thread { rt.call(Hook.LYRICS, track.copy(title = "slow").toJson(), 3_000) }.apply { start() }+ Thread.sleep(100)+ val quick = rt.call(Hook.LYRICS, track.copy(title = "quick").toJson(), 500)+ assertTrue(quick!!.contains("quick"))+ slow.join()+ rt.close()+ }++ @Test fun anEndlessLoopIsStopped() {+ val rt = runtime("myspoti.provide('lyrics', function () { while (true) {} });")+ val started = System.currentTimeMillis()+ try {+ rt.call(Hook.LYRICS, track.toJson(), 500)+ fail("an endless loop answered")+ } catch (e: ExtensionException) {+ assertTrue(e.message!!.contains("took longer"))+ assertTrue("a time limit is told apart from the script's own errors", e is ExtensionTimeout)+ }+ assertTrue(System.currentTimeMillis() - started < 3_000)+ // The extension's thread is free again for the next call.+ rt.close()+ }++ @Test fun aCallCutShortByCloseIsNotTheScriptsFailure() {+ val rt = runtime("myspoti.provide('lyrics', function () { while (true) {} });")+ Thread { Thread.sleep(200); rt.close() }.start()+ try {+ rt.call(Hook.LYRICS, track.toJson(), 5_000)+ fail("a closed extension answered")+ } catch (e: ExtensionException) {+ assertEquals("stopped", e.message)+ }+ assertTrue(rt.closed)+ assertNull(rt.lastError)+ }++ @Test fun networkGoesOnlyToTheListedHosts() {+ val host = FakeHost()+ assertEquals("""{"v":1}""", eval("return myspoti.http.get('https://api.example.com/x?' + myspoti.query({ q: 'a b', n: null })).json().ok;", host))+ assertEquals("https://api.example.com/x?q=a%20b", host.requests.single().url)+ assertEquals("""{"v":true}""", eval("return myspoti.http.get('https://img.cdn.example.org/a').ok;", host))+ for (url in listOf("https://evil.com/", "https://api.example.com.evil.com/", "http://127.0.0.1/", "https://localhost/", "http://cdn.example.org/")) {+ val out = eval("try { myspoti.http.get('$url'); return 'sent'; } catch (e) { return e.message; }", host)+ assertFalse("$url: $out", out!!.contains("sent"))+ }+ assertEquals(2, host.requests.size)+ }++ /** Answers each request with its url as the body, after [delayMs]; fails on a url with "broken". */+ private class SlowHost(val delayMs: Long) : Host {+ val requests: MutableList<HttpRequest> = java.util.Collections.synchronizedList(mutableListOf())+ override fun http(extensionId: String, request: HttpRequest): HttpResponse {+ requests += request+ Thread.sleep(delayMs)+ if ("broken" in request.url) throw java.io.IOException("connection reset")+ return HttpResponse(200, emptyMap(), request.url)+ }+ override fun log(extensionId: String, message: String) {}+ override fun storage(extensionId: String): Storage = MemoryStorage()+ override fun setting(extensionId: String, key: String): String? = null+ }++ @Test fun httpAllSendsTogetherAndAnswersInOrder() {+ val host = SlowHost(400)+ val started = System.nanoTime()+ val out = eval("""+ return myspoti.http.all([1, 2, 3, 4].map(function (n) { return { url: 'https://api.example.com/' + n }; }))+ .map(function (r) { return r.ok + ':' + r.body; }).join(' ');+ """, host)+ val ms = (System.nanoTime() - started) / 1_000_000+ assertEquals("""{"v":"true:https://api.example.com/1 true:https://api.example.com/2 true:https://api.example.com/3 true:https://api.example.com/4"}""", out)+ assertTrue("4 requests of 400 ms took $ms ms", ms < 1_400)+ assertEquals(4, host.requests.size)+ }++ @Test fun httpAllIsolatesAFailedRequest() {+ val host = SlowHost(0)+ val out = eval("""+ var r = myspoti.http.all([{ url: 'https://api.example.com/a' }, { url: 'https://evil.com/' }, { url: 'https://api.example.com/broken' }, { url: 'https://img.cdn.example.org/b', method: 'POST', body: { x: 1 } }]);+ return [r[0].body, r[1].error, r[2].error, r[3].body, typeof r[1].ok].join('|');+ """, host)!!+ assertTrue(out, out.startsWith("""{"v":"https://api.example.com/a|http: evil.com is not in this extension's network hosts|connection reset|https://img.cdn.example.org/b|undefined"""))+ // The refused one never left; the body that is not text went as JSON.+ assertEquals(3, host.requests.size)+ assertEquals("""{"x":1}""", host.requests.first { it.method == "POST" }.body)+ assertEquals("application/json", host.requests.first { it.method == "POST" }.headers["Content-Type"])+ }++ @Test fun httpAllHasItsLimits() {+ val five = eval("try { myspoti.http.all([1, 2, 3, 4, 5].map(function (n) { return { url: 'https://api.example.com/' + n }; })); return 'sent'; } catch (e) { return e.message; }", SlowHost(0))+ assertEquals("""{"v":"http.all: at most 4 requests at once"}""", five)+ assertEquals("""{"v":0}""", eval("return myspoti.http.all([]).length;", SlowHost(0)))+ // Counted in the requests per minute like http.request.+ val host = SlowHost(0)+ val m = manifest()+ val rt = ExtensionRuntime(m, """+ myspoti.provide('lyrics', function () {+ var r = myspoti.http.all([1, 2, 3].map(function (n) { return { url: 'https://api.example.com/' + n }; }));+ return { v: r.map(function (x) { return x.error || x.status; }).join(',') };+ });+ """, host, m.asks().map { it.key }.toSet(), ExtensionRuntime.Limits(requestsPerMinute = 2)).also { it.start() }+ rt.use { assertEquals("""{"v":"200,200,more than 2 requests in a minute"}""", it.call(Hook.LYRICS, track.toJson(), 3_000)) }+ // Without the network right, every request is refused in place.+ val none = eval("return myspoti.http.all([{ url: 'https://api.example.com/a' }])[0].error;", SlowHost(0), granted = setOf("lyrics"))+ assertTrue(none!!, none.contains("not in this extension's network hosts"))+ }++ @Test fun featuresNameWhatThisAppUnderstands() {+ assertEquals("""{"v":"audio.manifest,audio.expires,audio.quality,audio.source,audio.ahead,http.all,status,raw.base64"}""", eval("return myspoti.features.join(',');"))+ }++ @Test fun statusNeedsNoActionAndSaysWhetherTheSourceAnswers() {+ // Provided with only the lyrics action granted: status asks for nothing more.+ val m = manifest()+ assertTrue(runtime("", m, granted = emptySet()).use { it.provides(Hook.STATUS) })+ val down = runtime("myspoti.provide('status', function () { return { live: false, detail: ' ' + 'x'.repeat(300) }; });", m)+ down.use {+ val s = ExtensionStatus.probe(it, 3_000)+ assertFalse(s.live)+ assertEquals(ExtensionStatus.MAX_DETAIL, s.detail!!.length)+ }+ assertEquals(ExtensionStatus(true, "ok"), runtime("myspoti.provide('status', function () { return { live: true, detail: 'ok' }; });", m).use { ExtensionStatus.probe(it, 3_000) })+ // No status hook: live.+ assertEquals(ExtensionStatus.LIVE, runtime("myspoti.provide('lyrics', function () { return null; });", m).use { ExtensionStatus.probe(it, 3_000) })+ }++ @Test fun aStatusThatThrowsIsLateOrIsNotOneIsUnknownAndStaysInUse() {+ val m = manifest()+ val threw = runtime("myspoti.provide('status', function () { throw new Error('server down'); });", m).use { ExtensionStatus.probe(it, 3_000) }+ assertTrue(threw.live)+ assertEquals("unknown", threw.state)+ assertTrue(threw.detail!!, threw.detail!!.contains("server down"))+ val late = runtime("myspoti.provide('status', function () { while (true) {} });", m).use { ExtensionStatus.probe(it, 300) }+ assertEquals("unknown", late.state)+ assertTrue(late.detail!!, late.detail!!.contains("longer than 300 ms"))+ assertEquals("unknown", runtime("myspoti.provide('status', function () { return 'yes'; });", m).use { ExtensionStatus.probe(it, 3_000) }.state)+ assertEquals("unknown", runtime("myspoti.provide('status', function () { return { detail: 'no live' }; });", m).use { ExtensionStatus.probe(it, 3_000) }.state)+ // Only an explicit live: false is inactive.+ assertEquals("inactive", runtime("myspoti.provide('status', function () { return { live: false }; });", m).use { ExtensionStatus.probe(it, 3_000) }.state)+ }++ @Test fun theStatusBookKeepsWhoIsInactiveAndWhenItWasAsked() {+ var now = 0L+ val book = StatusBook { now }+ assertFalse(book.inactive("a"))+ assertTrue(book.stale("a", 1_000))+ assertTrue(book.record("a", ExtensionStatus(false, "down")))+ assertTrue(book.inactive("a"))+ assertFalse(book.stale("a", 1_000))+ assertEquals(mapOf("a" to ExtensionStatus(false, "down")), book.inactiveNow())+ // Inactive again: no change; live again: active at once.+ now = 1_000+ assertTrue(book.stale("a", 1_000))+ assertFalse(book.record("a", ExtensionStatus(false, "still down")))+ assertTrue(book.record("a", ExtensionStatus.LIVE))+ assertFalse(book.inactive("a"))+ assertTrue(book.inactiveNow().isEmpty())+ // A probe without an answer is no proof: in use, a change of state all the same.+ assertTrue(book.record("a", ExtensionStatus.unknown("took longer than 5000 ms")))+ assertFalse(book.inactive("a"))+ assertTrue(book.inactiveNow().isEmpty())+ assertEquals("unknown", book.last("a")!!.state)+ book.forget("a")+ assertTrue(book.stale("a", 1_000))+ }++ @Test fun anyHostNeedsItsOwnGrant() {+ val m = manifest(permissions = listOf(PermissionRequest("network", listOf("*"), "Looks the song up on many sites")))+ assertTrue(m.isCritical())+ val granted = eval("return myspoti.http.get('https://anything.net/').status;", m = m)+ assertEquals("""{"v":200}""", granted)+ val refused = eval("try { myspoti.http.get('https://anything.net/'); return 'sent'; } catch (e) { return e.message; }", m = m, granted = setOf("lyrics"))+ assertTrue(refused!!.contains("not in this extension's network hosts"))+ }++ @Test fun sensitiveRightsAreChecked() {+ val notAsked = eval("try { return myspoti.player.current(); } catch (e) { return e.message; }")+ assertTrue(notAsked!!.contains("not in this extension's manifest"))+ val m = manifest(permissions = listOf(PermissionRequest("player.read", why = "Shows the song in a widget")))+ assertEquals("""{"v":"Now"}""", eval("return myspoti.player.current().title;", m = m))+ val notGranted = eval("try { return myspoti.player.current(); } catch (e) { return e.message; }", m = m, granted = setOf("lyrics"))+ assertTrue(notGranted!!.contains("did not grant"))+ }++ @Test fun storageSettingsAndUtil() {+ val host = FakeHost()+ assertEquals("""{"v":[2,"fr",3,null]}""", eval("""+ myspoti.storage.set('n', { a: 2 });+ const n = myspoti.storage.get('n').a;+ myspoti.storage.remove('n');+ return [n, myspoti.settings.get('lang'), myspoti.settings.get('depth'), myspoti.storage.get('n') === undefined ? null : 1];+ """, host))+ assertEquals("""{"v":"aGk= 2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824"}""",+ eval("return myspoti.util.base64Encode('hi') + ' ' + myspoti.util.sha256('hello');"))+ }++ @Test fun storageIsCapped() {+ val m = manifest()+ val rt = ExtensionRuntime(m, "myspoti.provide('lyrics', function () { var s = new Array(2000).join('x'); for (var i = 0; i < 1000; i++) myspoti.storage.set('k' + i, s); });",+ FakeHost(), m.asks().map { it.key }.toSet(), ExtensionRuntime.Limits(storageChars = 100_000)).also { it.start() }+ try { rt.call(Hook.LYRICS, track.toJson(), 3_000); fail("stored past the cap") } catch (e: ExtensionException) { assertTrue(e.message!!.contains("storage full")) }+ rt.close()+ }++ @Test fun aLoadCountsTheTopLevelNotTheCompiling() {+ val m = manifest()+ // Compiling a long script is not its time: thousands of functions load within 300 ms of running.+ val big = (1..4_000).joinToString("\n") { "function f$it(a) { return a + $it; }" } + "\nmyspoti.provide('lyrics', function () { return null; });"+ ExtensionRuntime(m, big, FakeHost(), m.asks().map { it.key }.toSet(), ExtensionRuntime.Limits(loadMs = 300)).also { it.start() }.close()+ val loop = ExtensionRuntime(m, "while (true) {}", FakeHost(), m.asks().map { it.key }.toSet(), ExtensionRuntime.Limits(loadMs = 300))+ try { loop.start(); fail("an endless top level loaded") } catch (e: ExtensionException) { assertTrue(e.message!!.contains("took longer than 300 ms")) }+ loop.close()+ }++ @Test fun aScriptThatThrowsReportsWhere() {+ try {+ runtime("var a = 1;\nnull.boom;")+ fail("loaded")+ } catch (e: ExtensionException) {+ assertTrue(e.message, e.message!!.contains("main.js:2"))+ }+ }++ @Test fun provideOnlyWhatTheManifestSays() {+ try {+ runtime("myspoti.provide('audio-source', function () {});")+ fail("provided a hook it did not declare")+ } catch (e: ExtensionException) {+ assertTrue(e.message!!.contains("needs the audio.source action"))+ }+ }++ @Test fun trackEventsReachListenersWithPlayerRead() {+ val host = FakeHost()+ val m = manifest(provides = emptyList(), permissions = listOf(PermissionRequest("player.read", why = "Scrobbles what you listen to")))+ runtime("myspoti.on('track', function (t) { myspoti.log('now ' + t.title + ' ' + t.origin + ' ' + t.providerId); });", m, host).use {+ it.emit("track", PlaybackEvent.trackEventJson(track, PlaybackEvent.ORIGIN_DOWNLOAD, "io.github.x.dl"))+ it.emit("track", PlaybackEvent.trackEventJson(track, PlaybackEvent.ORIGIN_SPOTIFY, null))+ }+ assertEquals(listOf("now Song download io.github.x.dl", "now Song spotify null"), host.logs)+ }++ @Test fun anEventWaitingBehindALongCallIsDroppedQuietly() {+ val host = FakeHost()+ val m = manifest(permissions = listOf(PermissionRequest("player.read", why = "Scrobbles")))+ val script = """+ myspoti.provide('lyrics', function () { var t = Date.now(); while (Date.now() - t < 1500) {} return null; });+ myspoti.on('track', function (t) { myspoti.log('now ' + t.title); });+ """+ runtime(script, m, host).use { rt ->+ val call = Thread { rt.call(Hook.LYRICS, track.toJson(), 5_000) }.apply { start() }+ Thread.sleep(200)+ rt.emit("track", PlaybackEvent.trackEventJson(track, PlaybackEvent.ORIGIN_SPOTIFY, null), timeoutMs = 300)+ call.join()+ assertNull(rt.lastError)+ assertTrue(host.logs.toString(), host.logs.none { it.startsWith("failed") || it.startsWith("now") })+ // Free again: the next event is delivered.+ rt.emit("track", PlaybackEvent.trackEventJson(track, PlaybackEvent.ORIGIN_SPOTIFY, null))+ }+ assertEquals(listOf("now Song"), host.logs)+ }++ @Test fun playbackEventsReachListenersWithPlayerReadOnly() {+ val host = FakeHost()+ val m = manifest(provides = emptyList(), permissions = listOf(PermissionRequest("player.read", why = "Scrobbles what you listen to")))+ val e = PlaybackEvent("skip", track, 40_000, 180_000, 1_700_000_000_000, PlaybackEvent.LOCAL, "spotify:album:x", true, "forward", 40_000)+ val script = "myspoti.on('playback', function (e) { myspoti.log(e.type + ' ' + e.reason + ' ' + e.playedMs + ' ' + e.source + ' ' + e.track.title); });"+ runtime(script, m, host).use {+ assertTrue(it.listens("playback"))+ assertFalse(it.listens("track"))+ it.emit("playback", e.toJson())+ }+ assertEquals(listOf("skip forward 40000 local Song"), host.logs)+ // Every field is there, defaults included.+ val start = PlaybackEvent("start", track, 0, 180_000, 1, PlaybackEvent.SPOTIFY).toJson()+ for (k in listOf("\"reason\":null", "\"shuffle\":false", "\"playedMs\":0", "\"contextUri\":\"\"", "\"origin\":\"spotify\"", "\"providerId\":null")) assertTrue(k, start.contains(k))+ val fromExt = PlaybackEvent("start", track, 0, 180_000, 1, PlaybackEvent.LOCAL, origin = PlaybackEvent.ORIGIN_AUDIO_SOURCE, providerId = "io.github.x.audio").toJson()+ assertTrue(fromExt, fromExt.contains("\"origin\":\"audio-source\"") && fromExt.contains("\"providerId\":\"io.github.x.audio\""))+ // Not granted: nothing is delivered, and the app is told nobody listens.+ val quiet = FakeHost()+ runtime(script, m, quiet, granted = emptySet()).use { assertFalse(it.listens("playback")); it.emit("playback", e.toJson()) }+ assertTrue(quiet.logs.isEmpty())+ // Without player.read in the manifest, on() itself throws.+ try {+ runtime(script, manifest(provides = listOf("lyrics"), permissions = emptyList()))+ fail("listened without player.read")+ } catch (e: ExtensionException) {+ assertTrue(e.message!!.contains("playback.events"))+ }+ }++ @Test fun downloadSourceAnswersAreChecked() {+ val m = manifest(provides = listOf("download-source"), permissions = listOf(PermissionRequest("download-source", why = "Finds where each song can be downloaded")))+ assertTrue(m.problems().toString(), m.problems().isEmpty())+ val out = runtime("""+ myspoti.provide('download-source', function (t) {+ if (t.quality !== 'hi-res' || t.isrc !== 'USUM71703861') return null;+ return [ { url: 'https://cdn.example.org/a.flac', format: 'flac', bitDepth: 24, sampleRate: 96000, sizeHint: 90000000, provider: 'Example', isrcMatched: true, headers: { Referer: 'r', Cookie: 'no' } },+ { manifest: 'PE1QRD4=', format: 'dash-flac', bitDepth: 24 } ];+ });""", m).use { it.call(Hook.DOWNLOAD_SOURCE, DownloadQuery.toJson(track.copy(isrc = "USUM71703861"), "hi-res"), 3_000) }+ val files = DownloadFile.parseList(out!!)+ assertEquals(2, files.size)+ assertEquals(DownloadFile("https://cdn.example.org/a.flac", null, mapOf("Referer" to "r"), "flac", 24, 96_000, 90_000_000, "Example", true), files[0])+ assertEquals("dash-flac", files[1].format)+ assertTrue(files[1].lossless && files[1].url == null)+ // Single object and { files } forms; nothing is no file.+ assertEquals(1, DownloadFile.parseList("""{"url":"https://x.example.org/a.m4a","format":"m4a"}""").size)+ assertEquals(1, DownloadFile.parseList("""{"files":[{"url":"https://x.example.org/a.mp3","format":"mp3"}]}""").size)+ assertTrue(DownloadFile.parseList("""[]""").isEmpty())+ for (bad in listOf("""[{"url":"https://x.example.org/a"}]""", """[{"url":"https://x.example.org/a","format":"ogg"}]""",+ """[{"url":"http://10.0.0.2/a.flac","format":"flac"}]""", """[{"format":"dash-flac"}]""", "\"text\"")) {+ try { DownloadFile.parseList(bad); fail(bad) } catch (_: ExtensionException) {}+ }+ try { DownloadQuery.toJson(track, "best"); fail("unknown quality") } catch (_: IllegalArgumentException) {}+ }++ @Test fun audioStreamIsChecked() {+ val a = AudioStream.parse("""{"url":"https://cdn.example.org/a.m4a","headers":{"Referer":"x","Cookie":"no"},"mimeType":"audio/mp4"}""")!!+ assertEquals(mapOf("Referer" to "x"), a.headers)+ assertNull(a.source)+ // The label the player shows: one line, 80 characters at most, blank as none.+ assertEquals("FLAC · 16-bit · 44.1 kHz", AudioStream.parse("""{"url":"https://cdn.example.org/a","source":" FLAC ·\n16-bit · 44.1 kHz "}""")!!.source)+ assertEquals(80, AudioStream.parse("""{"url":"https://cdn.example.org/a","source":"${"x".repeat(200)}"}""")!!.source!!.length)+ assertNull(AudioStream.parse("""{"url":"https://cdn.example.org/a","source":" "}""")!!.source)+ assertNull(AudioStream.parse("""{"url":"https://cdn.example.org/a","source":5}""")!!.source)+ assertNull(AudioStream.parse("""{}"""))+ for (bad in listOf("""{"url":"file:///sdcard/x"}""", """{"url":"http://192.168.1.2/a"}""", """{"url":"content://x"}""")) {+ try { AudioStream.parse(bad); fail(bad) } catch (_: ExtensionException) {}+ }+ assertNull(a.qualityLabel())+ assertEquals(10 * 60_000L, a.keepMs(10 * 60_000L))+ }++ @Test fun audioStreamLifetimeAndQuality() {+ val a = AudioStream.parse("""{"url":"https://cdn.example.org/a.flac","expiresInMs":90000,"bitDepth":24,"sampleRate":96000,"codec":"FLAC"}""")!!+ assertEquals(90_000L, a.expiresInMs)+ assertEquals(90_000L, a.keepMs(600_000))+ assertEquals("FLAC · 24-bit · 96 kHz", a.qualityLabel())+ // At most the app's own time; a past or negative one is asked again at once.+ assertEquals(600_000L, AudioStream.parse("""{"url":"https://x.example.org/a","expiresInMs":86400000}""")!!.keepMs(600_000))+ assertEquals(0L, AudioStream.parse("""{"url":"https://x.example.org/a","expiresInMs":-5}""")!!.keepMs(600_000))+ assertEquals("16-bit · 44.1 kHz", AudioStream.parse("""{"url":"https://x.example.org/a","bitDepth":16,"sampleRate":44100}""")!!.qualityLabel())+ // Out of range or unreadable: left out, never made up.+ val odd = AudioStream.parse("""{"url":"https://x.example.org/a","bitDepth":64,"sampleRate":"fast","codec":"<b>flac</b>"}""")!!+ assertNull(odd.bitDepth); assertNull(odd.sampleRate); assertNull(odd.codec); assertNull(odd.qualityLabel())+ // The same fields with a manifest.+ val mpd = java.util.Base64.getEncoder().encodeToString("<MPD><SegmentTemplate initialization=\"https://x.example.org/0.mp4\" media=\"https://x.example.org/${'$'}Number${'$'}.mp4\"/></MPD>".toByteArray())+ val d = AudioStream.parse("""{"manifest":"$mpd","expiresInMs":30000,"codec":"flac","bitDepth":24}""")!!+ assertEquals(30_000L, d.expiresInMs); assertEquals("FLAC · 24-bit", d.qualityLabel())+ }++ @Test fun anAudioSourceKnowsWhenItIsAskedAhead() {+ val out = runtime("myspoti.provide('audio-source', function (t) { return { url: 'https://cdn.example.org/' + (t.ahead ? 'ahead' : 'now') + '.flac' }; });",+ manifest(provides = listOf("audio-source"))).use { rt ->+ listOf(true, false).map { AudioStream.parse(rt.call(Hook.AUDIO_SOURCE, AudioQuery.toJson(track, it), 3_000)!!)!!.url }+ }+ assertEquals(listOf("https://cdn.example.org/ahead.flac", "https://cdn.example.org/now.flac"), out)+ }++ @Test fun plainLyrics() {+ val l = LyricsResult.parse("""{"plain":"one\ntwo"}""", "Ext")!!+ assertFalse(l.synced)+ assertEquals("Ext", l.provider)+ assertNotNull(l.lines.firstOrNull { it.text == "two" })+ }+}diff --git a/base/extensions/src/test/kotlin/app/myspoti/extensions/SpotifyTest.kt b/base/extensions/src/test/kotlin/app/myspoti/extensions/SpotifyTest.ktnew file mode 100644index 00000000..5d09863d--- /dev/null+++ b/base/extensions/src/test/kotlin/app/myspoti/extensions/SpotifyTest.kt@@ -0,0 +1,340 @@+package app.myspoti.extensions++import app.myspoti.api.AlbumRef+import app.myspoti.api.ArtistRef+import app.myspoti.api.MyspotiApi+import app.myspoti.api.Page+import app.myspoti.api.Track+import kotlinx.coroutines.flow.MutableStateFlow+import kotlinx.coroutines.flow.StateFlow+import kotlinx.coroutines.delay+import kotlinx.serialization.json.JsonElement+import kotlinx.serialization.json.JsonObject+import kotlinx.serialization.json.JsonPrimitive+import org.junit.Assert.assertEquals+import org.junit.Assert.assertFalse+import org.junit.Assert.assertTrue+import org.junit.Test+import java.lang.reflect.Proxy++class SpotifyTest {+ private val track = TrackInfo("abc", "spotify:track:abc", "Song", "Artist", listOf("Artist"), "Album", 180_000)+ private val why = "Needs it to do what the user asked for"++ /** A [MyspotiApi] that records `area.method(args)` and answers from [answers] (null when there is none). */+ private class FakeApi {+ val calls = mutableListOf<String>()+ val answers = HashMap<String, Any?>()+ val api: MyspotiApi = proxy(MyspotiApi::class.java, "")++ @Suppress("UNCHECKED_CAST")+ private fun <T> proxy(type: Class<T>, prefix: String): T = Proxy.newProxyInstance(type.classLoader, arrayOf(type)) { _, m, args ->+ if (m.parameterCount == 0 && m.name.startsWith("get")) {+ val name = m.name.removePrefix("get").replaceFirstChar { it.lowercase() }+ val key = if (prefix.isEmpty()) name else "$prefix.$name"+ when {+ StateFlow::class.java.isAssignableFrom(m.returnType) -> MutableStateFlow(answers[key])+ m.returnType.isInterface && m.returnType.name.startsWith("app.myspoti.api.") -> proxy(m.returnType, name)+ else -> null+ }+ } else {+ // A suspend function's last argument is its continuation.+ val shown = args.orEmpty().filter { it !is kotlin.coroutines.Continuation<*> }+ val key = "$prefix.${m.name}"+ calls += "$key(${shown.joinToString()})"+ answers[key]+ }+ } as T+ }++ private class FakeRaw : SpotifyRaw {+ val calls = mutableListOf<String>()+ var lastBody: ByteArray? = null+ override suspend fun gql(operation: String, variables: JsonObject): JsonElement { calls += "gql $operation $variables"; return JsonPrimitive("gql-ok") }+ override fun operations() = setOf("searchDesktop", "addToPlaylist")+ override suspend fun service(service: String, method: String, args: List<JsonElement>): JsonElement { calls += "service $service.$method $args"; return JsonPrimitive("svc-ok") }+ override suspend fun get(url: String): JsonElement? { calls += "get $url"; return JsonPrimitive("get-ok") }+ override fun isMutation(operation: String) = operation.startsWith("add")+ override suspend fun request(method: String, url: String, body: ByteArray?, headers: Map<String, String>): JsonElement {+ calls += "request $method $url ${body?.decodeToString()} $headers"+ lastBody = body+ return RawRequest.response(200, mapOf("content-type" to "application/json"), "{}")+ }+ }++ private class SpotifyHost(+ val api: FakeApi, val raw: FakeRaw? = FakeRaw(), var allow: Boolean = false, val thinkMs: Long = 0,+ media: PlayerMedia? = null,+ ) : Host {+ val asked = mutableListOf<String>()+ val grants = mutableListOf<RawGrant>()+ /** Answers a write question with this instead of [allow] when set. */+ var consent: Consent? = null+ val offered = mutableListOf<RawGrant>()+ private val dispatcher = SpotifyDispatcher(api.api, raw, media)+ override fun rawGrants(extensionId: String) = grants.toList()+ override suspend fun confirmWrite(extensionId: String, text: String, offer: RawGrant): Consent {+ val c = consent ?: return super.confirmWrite(extensionId, text, offer)+ asked += text; offered += offer+ if (c == Consent.ALWAYS) grants += offer+ return c+ }+ override fun log(extensionId: String, message: String) {}+ override fun storage(extensionId: String): Storage = MemoryStorage()+ override fun setting(extensionId: String, key: String): String? = null+ override suspend fun spotify(extensionId: String, call: SpotifyCall) = dispatcher.execute(call)+ override fun spotifyMutation(name: String) = dispatcher.isMutation(name)+ override suspend fun confirm(extensionId: String, text: String): Boolean { asked += text; delay(thinkMs); return allow }+ }++ private fun manifest(vararg permissions: String) = Manifest(+ "io.github.test.spotify", "Spotify Test", "1.0", author = "me", provides = listOf("lyrics"),+ permissions = permissions.map { PermissionRequest(it, why = why) },+ )++ /** What [body] (a JS expression run in the lyrics hook) gives back; a thrown error comes back as "error: message". */+ private fun script(body: String, host: Host, m: Manifest, granted: Set<String> = m.asks().map { it.key }.toSet(), timeoutMs: Long = 3_000): String? =+ ExtensionRuntime(m, "myspoti.provide('lyrics', function () { try { return { v: $body }; } catch (e) { return { v: 'error: ' + e.message }; } });", host, granted)+ .use { it.start(); it.call(Hook.LYRICS, track.toJson(), timeoutMs) }++ @Test fun aCatalogReadNeedsTheCatalogRight() {+ val api = FakeApi()+ api.answers["search.tracks"] = Page(listOf(Track("spotify:track:1", "Papaoutai", 232_000, listOf(ArtistRef("spotify:artist:2", "Stromae")), AlbumRef("spotify:album:3", "Racine carrée"))), 0, 1, null)+ val call = "myspoti.spotify.search.tracks('papaoutai').items[0].artists[0].name"+ // Not in the manifest.+ assertTrue(script(call, SpotifyHost(api), manifest("notify"))!!.contains("spotify.catalog is not in this extension's manifest"))+ // In the manifest, the user said no.+ val m = manifest("spotify.catalog")+ assertTrue(script(call, SpotifyHost(api), m, granted = setOf("lyrics"))!!.contains("the user did not grant spotify.catalog"))+ assertTrue(api.calls.isEmpty())+ // Granted: the typed call runs with the API's own defaults, and the model comes back as JSON.+ assertEquals("""{"v":"Stromae"}""", script(call, SpotifyHost(api), m))+ assertEquals(listOf("search.tracks(papaoutai, 0, 30)"), api.calls)+ }++ @Test fun theFourRightsAreSeparate() {+ val api = FakeApi()+ val m = manifest("spotify.catalog", "spotify.write")+ for (call in listOf("myspoti.spotify.library.likedTracks()", "myspoti.spotify.users.me()", "myspoti.spotify.player.state()", "myspoti.spotify.raw.operations()")) {+ assertTrue(call, script(call, SpotifyHost(api), m)!!.contains("is not in this extension's manifest"))+ }+ assertTrue(script("myspoti.spotify.library.add(['spotify:track:1'])", SpotifyHost(api), manifest("spotify.library.read"))!!.contains("library.write is not in"))+ assertTrue(api.calls.isEmpty())+ }++ @Test fun anUnknownMethodDoesNotExist() {+ assertEquals(null, SpotifyMethods.find("library", "nope"))+ assertEquals(null, SpotifyMethods.find("jam", "start"))+ val m = manifest("spotify.write")+ assertTrue(script("myspoti.spotify.library.nope()", SpotifyHost(FakeApi()), m)!!.contains("error"))+ assertTrue(script("typeof myspoti.spotify.jam", SpotifyHost(FakeApi()), m)!!.contains("undefined"))+ }++ @Test fun aWrongArgumentIsNamed() {+ val m = manifest("spotify.catalog")+ assertTrue(script("myspoti.spotify.search.tracks()", SpotifyHost(FakeApi()), m)!!.contains("query (argument 1) must be a string"))+ assertTrue(script("myspoti.spotify.search.tracks('a', 'x')", SpotifyHost(FakeApi()), m)!!.contains("offset (argument 2) must be a number"))+ }++ @Test fun aWriteRunsWithoutAsking() {+ val api = FakeApi()+ val host = SpotifyHost(api)+ script("(myspoti.spotify.library.add(['spotify:track:1', 'spotify:album:2']), myspoti.spotify.playlists.setAccess('spotify:playlist:p', 'private'))", host, manifest("spotify.write"))+ assertTrue(host.asked.isEmpty())+ assertEquals(listOf("library.add([spotify:track:1, spotify:album:2])", "playlists.setAccess(spotify:playlist:p, PRIVATE)"), api.calls)+ }++ @Test fun aDestructiveWriteIsRefusedUnlessTheUserAllowsIt() {+ val api = FakeApi()+ val host = SpotifyHost(api, allow = false)+ val m = manifest("spotify.write")+ val out = script("myspoti.spotify.library.remove(['spotify:track:1'])", host, m)!!+ assertTrue(out, out.contains("the user refused"))+ assertEquals(1, host.asked.size)+ assertTrue(host.asked[0], host.asked[0].contains("Spotify Test wants to remove from the library") && host.asked[0].contains("spotify:track:1"))+ assertTrue(api.calls.isEmpty())++ host.allow = true+ assertEquals("""{"v":"done"}""", script("(myspoti.spotify.library.remove(['spotify:track:1']), 'done')", host, m))+ assertEquals(listOf("library.remove([spotify:track:1])"), api.calls)+ }++ @Test fun unsavingAnEpisodeAsksButSavingDoesNot() {+ val api = FakeApi()+ val host = SpotifyHost(api, allow = false)+ val m = manifest("spotify.write")+ script("myspoti.spotify.podcasts.setEpisodeSaved('spotify:episode:e', true)", host, m)+ assertTrue(host.asked.isEmpty())+ script("myspoti.spotify.podcasts.setEpisodeSaved('spotify:episode:e', false)", host, m)+ assertEquals(1, host.asked.size)+ assertEquals(listOf("podcasts.setEpisodeSaved(spotify:episode:e, true)"), api.calls)+ }++ @Test fun theTimeTheUserTakesIsNotTheScriptsTime() {+ val api = FakeApi()+ val host = SpotifyHost(api, allow = true, thinkMs = 1_500)+ // The call has 1 s; the user needs 1.5 s to answer.+ val out = script("(myspoti.spotify.playlists.delete('spotify:playlist:p'), 'deleted')", host, manifest("spotify.write"), timeoutMs = 1_000)+ assertEquals("""{"v":"deleted"}""", out)+ assertEquals(listOf("playlists.delete(spotify:playlist:p)"), api.calls)+ }++ @Test fun rawNeedsItsOwnRight() {+ val m = manifest("spotify.catalog", "spotify.library.read", "spotify.write")+ for (call in listOf("raw.gql('searchDesktop', {})", "raw.service('a', 'b')", "raw.get('https://api.spotify.com/v1/me')", "raw.operations()")) {+ val raw = FakeRaw()+ assertTrue(call, script("myspoti.spotify.$call", SpotifyHost(FakeApi(), raw), m)!!.contains("spotify.raw is not in this extension's manifest"))+ assertTrue(raw.calls.isEmpty())+ }+ }++ @Test fun rawReadsRunButRawMutationsAndServicesAsk() {+ val m = manifest("spotify.raw")+ val raw = FakeRaw()+ val host = SpotifyHost(FakeApi(), raw, allow = false)+ assertEquals("""{"v":"gql-ok"}""", script("myspoti.spotify.raw.gql('searchDesktop', { searchTerm: 'a' })", host, m))+ assertEquals("""{"v":"get-ok"}""", script("myspoti.spotify.raw.get('https://api.spotify.com/v1/me')", host, m))+ assertEquals("""{"v":["addToPlaylist","searchDesktop"]}""", script("myspoti.spotify.raw.operations()", host, m))+ assertTrue(host.asked.isEmpty())++ assertTrue(script("myspoti.spotify.raw.gql('addToPlaylist', {})", host, m)!!.contains("the user refused"))+ assertTrue(script("myspoti.spotify.raw.service('player', 'stop')", host, m)!!.contains("the user refused"))+ assertEquals(2, host.asked.size)+ assertEquals(2, raw.calls.size)+ host.allow = true+ assertEquals("""{"v":"svc-ok"}""", script("myspoti.spotify.raw.service('player', 'stop', 1, 'x')", host, m))+ assertEquals("service player.stop [1, \"x\"]", raw.calls.last())+ }++ @Test fun rawRequestReadsRunWritesAskAndOnlySpotifyIsReached() {+ val m = manifest("spotify.raw")+ val raw = FakeRaw()+ val host = SpotifyHost(FakeApi(), raw, allow = false)+ assertEquals("""{"v":200}""", script("myspoti.spotify.raw.request('GET', 'https://api.spotify.com/v1/me').status", host, m))+ assertEquals("""{"v":"{}"}""", script("myspoti.spotify.raw.request('head', 'https://open.spotifycdn.com/x.js').body", host, m))+ assertTrue(host.asked.isEmpty())+ assertEquals(listOf("request GET https://api.spotify.com/v1/me null {}", "request HEAD https://open.spotifycdn.com/x.js null {}"), raw.calls)++ // A write asks first, whatever the path; refused, nothing is sent.+ assertTrue(script("myspoti.spotify.raw.request('PUT', 'https://gue1-spclient.spotify.com/x', { a: 1 })", host, m)!!.contains("the user refused"))+ assertEquals(1, host.asked.size)+ assertEquals(2, raw.calls.size)+ host.allow = true+ assertEquals("""{"v":200}""", script("myspoti.spotify.raw.request('POST', 'https://api.spotify.com/v1/x', { a: 1 }, { 'X-Test': 'y' }).status", host, m))+ assertEquals("request POST https://api.spotify.com/v1/x {\"a\":1} {X-Test=y}", raw.calls.last())+ // A binary body comes as base64 and leaves as its bytes; a body that is not base64 never leaves.+ assertEquals("""{"v":200}""", script("myspoti.spotify.raw.request('POST', 'https://spclient.wg.spotify.com/x', 'CgD/', { 'Content-Type': 'application/x-protobuf' }, { encoding: 'base64' }).status", host, m))+ assertEquals(listOf(0x0a, 0x00, 0xff), raw.lastBody!!.map { it.toInt() and 0xff })+ val sent = raw.calls.size+ assertTrue(script("myspoti.spotify.raw.request('POST', 'https://spclient.wg.spotify.com/x', 'no!', {}, { encoding: 'base64' })", host, m)!!.contains("not base64"))+ assertTrue(script("myspoti.spotify.raw.request('POST', 'https://spclient.wg.spotify.com/x', 'x', {}, { encoding: 'hex' })", host, m)!!.contains("encoding"))+ assertEquals(sent, raw.calls.size)++ // Anything that is not https on a Spotify host never leaves.+ for (url in listOf("https://example.com/", "http://api.spotify.com/v1/me", "https://evilspotify.com/", "https://spotify.com.evil.net/")) {+ assertTrue(url, script("myspoti.spotify.raw.request('GET', '$url')", host, m)!!.startsWith("""{"v":"error:"""))+ }+ assertTrue(script("myspoti.spotify.raw.request('TRACE', 'https://api.spotify.com/')", host, m)!!.contains("method"))+ assertEquals(4, raw.calls.size)+ }++ @Test fun anAlwaysGrantCoversItsMethodHostAndPathOnly() {+ val m = manifest("spotify.raw")+ val raw = FakeRaw()+ val host = SpotifyHost(FakeApi(), raw).apply { consent = Consent.ALWAYS }+ val put = "https://gue1-spclient.spotify.com/playlist/v2/playlist/37i9dQZF1DXcBWIGoYBM5M/changes"+ assertEquals("""{"v":200}""", script("myspoti.spotify.raw.request('PUT', '$put?x=1').status", host, m))+ assertEquals(listOf(RawGrant("PUT", "gue1-spclient.spotify.com", "/playlist/v2/playlist/*/changes")), host.grants)++ // The same kind of request on another playlist runs without a question.+ host.consent = Consent.REFUSE+ assertEquals("""{"v":200}""", script("myspoti.spotify.raw.request('PUT', '${put.replace("37i9dQZF1DXcBWIGoYBM5M", "4uLU6hMCjMI75M1A2tKUQC")}').status", host, m))+ assertEquals(1, host.asked.size)++ // Another method, host or path asks again.+ for (call in listOf("'POST', '$put'", "'PUT', 'https://api.spotify.com/playlist/v2/playlist/x1234567/changes'", "'PUT', '${put.removeSuffix("/changes")}'")) {+ assertTrue(call, script("myspoti.spotify.raw.request($call)", host, m)!!.contains("the user refused"))+ }+ assertEquals(4, host.asked.size)+ assertEquals(2, raw.calls.size)+ }++ @Test fun grantPatternsKeepWordsAndStarNames() {+ assertEquals(RawGrant("POST", "api.spotify.com", "/v1/me/player/*"), RawRequest.offer("post", "https://api.spotify.com/v1/me/player/12345"))+ assertEquals("/a/*/b/*", RawRequest.offer("PUT", "https://x.spotify.com/a/spotify:track:1/b/0a1b2c3d4e5f").path)+ assertFalse(RawRequest.covered(listOf(RawGrant("PUT", "x.spotify.com", "/a/*")), "PUT", "https://x.spotify.com/a/b/c"))+ assertTrue(RawRequest.covered(listOf(RawGrant("PUT", "x.spotify.com", "/a/*")), "put", "https://X.spotify.com/a/b?q=1"))+ }++ @Test fun mediaReadsThePlayersManifestWithPlaybackEvents() {+ val manifest = JsonObject(mapOf("file_ids_mp4" to kotlinx.serialization.json.JsonArray(listOf(JsonObject(mapOf("file_id" to JsonPrimitive("f00d"), "format" to JsonPrimitive("10")))))))+ val host = SpotifyHost(FakeApi(), media = PlayerMedia { if (it == "spotify:track:abc") manifest else null })+ val m = manifest("player.read")+ assertEquals("""{"v":"f00d"}""", script("myspoti.spotify.media('spotify:track:abc').manifest.file_ids_mp4[0].file_id", host, m))+ assertEquals("""{"v":"spotify:track:abc"}""", script("myspoti.spotify.player.media('spotify:track:abc').uri", host, m))+ assertEquals("""{"v":null}""", script("myspoti.spotify.media('spotify:track:zzz')", host, m))+ assertTrue(script("myspoti.spotify.media('spotify:album:abc')", host, m)!!.contains("trackUri"))+ assertTrue(script("myspoti.spotify.media('spotify:track:abc')", host, manifest("spotify.catalog"))!!.startsWith("""{"v":"error:"""))+ assertTrue(host.asked.isEmpty())+ }++ @Test fun aHostWithoutAnAccountSaysSo() {+ val host = object : Host {+ override fun log(extensionId: String, message: String) {}+ override fun storage(extensionId: String): Storage = MemoryStorage()+ override fun setting(extensionId: String, key: String): String? = null+ }+ assertTrue(script("myspoti.spotify.search.all('a')", host, manifest("spotify.catalog"))!!.contains("has no Spotify account"))+ // And it never says yes to a destructive change.+ assertTrue(script("myspoti.spotify.library.remove(['spotify:track:1'])", host, manifest("spotify.write"))!!.contains("the user refused"))+ }++ @Test fun theTableIsTheWholeSurface() {+ val all = SpotifyMethods.all()+ fun count(a: Action) = all.count { it.action == a }+ assertEquals(+ setOf(Action.SPOTIFY_CATALOG, Action.LIBRARY_READ, Action.PLAYBACK_EVENTS, Action.PLAYBACK_CONTROL, Action.PLAYBACK_QUEUE,+ Action.LIBRARY_WRITE, Action.PLAYLISTS_WRITE, Action.SPOTIFY_RAW),+ all.map { it.action }.toSet(),+ )+ assertEquals(5, count(Action.SPOTIFY_RAW))+ assertTrue(count(Action.SPOTIFY_CATALOG) > 20 && count(Action.LIBRARY_READ) > 20 && count(Action.PLAYLISTS_WRITE) > 15 && count(Action.LIBRARY_WRITE) > 10)+ assertEquals(listOf("addToQueue", "clearQueue", "moveInQueue", "playNext", "removeFromQueue"), all.filter { it.action == Action.PLAYBACK_QUEUE }.map { it.name }.sorted())+ // Every method that is always destructive: the day one is added or dropped, this list is read again.+ val args = SpotifyArgs(kotlinx.serialization.json.JsonArray(listOf(JsonPrimitive("x"))), "t")+ val destructive = all.filter { m -> runCatching { m.isDestructive(args) { true } }.getOrDefault(false) }.map { it.key }.sorted()+ assertEquals(+ listOf(+ "blends.leave", "library.deleteFolder", "library.remove", "player.clearQueue", "player.removeFromQueue", "playlists.delete",+ "playlists.removeTracks", "playlists.unfollow", "raw.gql", "raw.service", "search.clearRecent", "users.unfollow",+ ),+ destructive,+ )+ // A destructive method is a write (or raw); reading never asks.+ val writes = setOf(Action.LIBRARY_WRITE, Action.PLAYLISTS_WRITE, Action.PLAYBACK_QUEUE, Action.SPOTIFY_RAW)+ all.filter { it.key in destructive }.forEach { assertTrue(it.key, it.action in writes) }+ all.filter { it.action == Action.SPOTIFY_CATALOG || it.action == Action.LIBRARY_READ || it.action == Action.PLAYBACK_EVENTS }.forEach { assertFalse(it.key, it.key in destructive) }+ }++ @Test fun modelsComeBackAsPlainJson() {+ val json = JsonModel.encode(Page(listOf(Track("u", "n", 1, emptyList(), null, explicit = true)), 0, 1, null)).toString()+ assertEquals("""{"items":[{"uri":"u","name":"n","durationMs":1,"artists":[],"album":null,"explicit":true,"playable":true,"uid":null,"addedAt":null,"hasVideo":false}],"offset":0,"total":1,"nextOffset":null}""", json)+ }++ @Test fun spotifyRightsAreInTheInstallPrompt() {+ val m = manifest("spotify.catalog", "spotify.library.read", "spotify.write", "spotify.raw")+ assertEquals(emptyList<String>(), m.problems())+ // The old permissions become their actions: spotify.write is four of them, three critical.+ assertEquals(+ listOf("lyrics.provide" to Level.NORMAL, "spotify.catalog" to Level.NORMAL, "library.read" to Level.NORMAL, "playback.events" to Level.NORMAL,+ "library.write" to Level.CRITICAL, "playlists.write" to Level.CRITICAL, "playback.control" to Level.NORMAL, "playback.queue" to Level.NORMAL,+ "spotify.raw" to Level.CRITICAL, "storage" to Level.NORMAL),+ m.asks().map { it.key to it.level },+ )+ assertTrue(m.isCritical())+ assertFalse(manifest("spotify.catalog").isCritical())+ // A critical Spotify action has to say why.+ val bare = Manifest("io.github.test.x", "X", "1.0", author = "me", provides = listOf("lyrics"), permissions = listOf(PermissionRequest("spotify.write")))+ assertTrue(bare.problems().toString(), bare.problems().any { it.contains("\"library.write\" is a critical action") })+ }+}diff --git a/base/extensions/src/test/kotlin/app/myspoti/extensions/StoreTest.kt b/base/extensions/src/test/kotlin/app/myspoti/extensions/StoreTest.ktnew file mode 100644index 00000000..5d2f9a0d--- /dev/null+++ b/base/extensions/src/test/kotlin/app/myspoti/extensions/StoreTest.kt@@ -0,0 +1,152 @@+package app.myspoti.extensions++import org.junit.Assert.assertEquals+import org.junit.Assert.assertFalse+import org.junit.Assert.assertNull+import org.junit.Assert.assertTrue+import org.junit.Test+import java.io.File+import java.nio.file.Files++/** The store's fields in the index and the manifest, a row's button, categories and search. */+class StoreTest {+ private fun entry(+ versionCode: Int = 2,+ minApp: String? = null,+ apiVersion: Int = API_VERSION,+ provides: List<String> = listOf("lyrics"),+ permissions: List<String> = listOf("network"),+ category: String? = null,+ tags: List<String> = emptyList(),+ ) = Catalog.Entry(+ id = "io.github.x.ext", name = "Ext", version = "1.$versionCode", versionCode = versionCode, apiVersion = apiVersion,+ author = "x", description = "Synced lyrics", provides = provides, permissions = permissions.map { PermissionRequest(it, listOf("a.example.com")) },+ url = "e.zip", sha256 = "00", minAppVersion = minApp, category = category, tags = tags,+ )++ // ── The index ──++ @Test fun indexReadsTheStoreFields() {+ val c = Catalog.parse("""+ { "format": 1, "name": "Repo", "extensions": [ {+ "id": "a.b.c", "name": "ABC", "version": "1.1", "versionCode": 4, "author": "me",+ "url": "pkgs/abc.zip", "sha256": "ff",+ "icon_url": "icons/abc.png", "updated_at": "2026-10-23", "category": "spotify",+ "tags": ["playlists", "sort"], "min_app_version": "2.0.2", "changelog": "Faster.",+ "somethingLater": 1 } ] }+ """)+ val e = c.extensions.single()+ assertEquals("icons/abc.png", e.iconAddress())+ assertEquals("2026-10-23", e.updatedAt)+ assertEquals(listOf("playlists", "sort"), e.tags)+ assertEquals("2.0.2", e.minAppVersion)+ assertEquals("Faster.", e.changelog)+ // "spotify", a key of the first store, reads as Library; an extension with no library action is filed under Other.+ assertEquals(Category.OTHER, e.category())+ assertEquals("https://h.org/r/icons/abc.png", Catalog.resolve("https://h.org/r/index.json", e.iconAddress()!!))+ // Written back under the same names.+ val text = Catalog.encode(c)+ listOf("\"icon_url\"", "\"updated_at\"", "\"min_app_version\"", "\"changelog\"").forEach { assertTrue(text, it in text) }+ assertEquals(e, Catalog.parse(text).extensions.single())+ }++ @Test fun anOldIndexStillReads() {+ val e = Catalog.parse("""{ "name": "Old", "extensions": [ { "id": "a.b.c", "name": "ABC", "version": "1", "versionCode": 1,+ "author": "me", "url": "a.zip", "sha256": "ff", "icon": "https://h.org/i.png" } ] }""").extensions.single()+ assertEquals("https://h.org/i.png", e.iconAddress())+ assertNull(e.minAppVersion)+ assertTrue(e.tags.isEmpty())+ assertTrue(e.compatible("1.0.0"))+ }++ // ── A store row's button ──++ @Test fun aRowSaysInstallUpdateInstalledOrIncompatible() {+ val app = "2.0.2-beta.4-dev"+ assertEquals(StoreAction.INSTALL, Store.action(entry(), null, app))+ assertEquals(StoreAction.UPDATE, Store.action(entry(versionCode = 3), 2, app))+ assertEquals(StoreAction.INSTALLED, Store.action(entry(versionCode = 2), 2, app))+ assertEquals(StoreAction.INSTALLED, Store.action(entry(versionCode = 1), 2, app))+ assertEquals(StoreAction.INCOMPATIBLE, Store.action(entry(minApp = "2.1.0"), null, app))+ assertEquals(StoreAction.INCOMPATIBLE, Store.action(entry(versionCode = 3, minApp = "2.0.2"), 2, app))+ assertEquals(StoreAction.INSTALLED, Store.action(entry(minApp = "9.0"), 2, app))+ assertEquals(StoreAction.INCOMPATIBLE, Store.action(entry(apiVersion = API_VERSION + 1), null, app))+ assertEquals(StoreAction.INSTALL, Store.action(entry(minApp = "2.0.2-beta.4"), null, app))+ }++ @Test fun updatesCountOnlyWhatCanBeInstalled() {+ val a = Catalog(name = "A", extensions = listOf(entry(versionCode = 3), entry(versionCode = 5, minApp = "3.0").copy(id = "x.y.z")))+ val b = Catalog(name = "B", extensions = listOf(entry(versionCode = 4)))+ val installed = mapOf("io.github.x.ext" to 2, "x.y.z" to 1)+ assertEquals(setOf("io.github.x.ext"), Store.updates(listOf("a" to a, "b" to b), installed, "2.0.2"))+ assertEquals("b" to 4, Store.newest(listOf("a" to a, "b" to b))["io.github.x.ext"]!!.let { it.first to it.second.versionCode })+ }++ @Test fun versionsCompareLikeSemver() {+ assertTrue(AppVersion.compare("2.0.2", "2.0.2-beta.4-dev") > 0)+ assertTrue(AppVersion.compare("2.0.2-beta.4-dev", "2.0.2-beta.4") > 0)+ assertTrue(AppVersion.compare("2.0.2-beta.10", "2.0.2-beta.9") > 0)+ assertTrue(AppVersion.compare("2.0.1", "2.0.2-beta.1") < 0)+ assertEquals(0, AppVersion.compare("2.1", "2.1.0"))+ assertTrue(AppVersion.atLeast("2.0.2", null))+ assertTrue(AppVersion.atLeast("dev", "9.9"))+ assertFalse(AppVersion.atLeast("2.0.1", "2.0.2"))+ assertNull(AppVersion.parse("two"))+ }++ // ── Categories and search ──++ @Test fun categoriesAreDeclaredAndCheckedAgainstTheActions() {+ assertEquals(Category.LYRICS, entry(category = "lyrics").category())+ assertEquals(Category.OTHER, entry().category())+ assertEquals(Category.OTHER, entry(category = "nonsense").category())+ // Declared without the action it needs: Other.+ assertEquals(Category.OTHER, entry(provides = listOf("audio-source"), category = "lyrics").category())+ assertEquals(Category.PLAYBACK, entry(provides = listOf("lyrics", "audio-source"), category = "playback").category())+ assertEquals(Category.LIBRARY, entry(provides = emptyList(), permissions = listOf("player.read", "spotify.write"), category = "library").category())+ assertEquals(Category.STATS, entry(provides = emptyList(), permissions = listOf("player.read"), category = "stats").category())+ assertEquals(Category.TOOLS, entry(provides = emptyList(), permissions = listOf("player.read"), category = "tools").category())+ // Downloads always go under Tools, whatever is declared; no category is named after them.+ assertEquals(Category.TOOLS, entry(provides = listOf("lyrics", "download-source"), category = "lyrics").category())+ assertTrue(Category.entries.none { "download" in it.key || "rip" in it.key })+ // The first store's keys still read.+ assertEquals(Category.TOOLS, Category.of("downloads"))+ assertEquals(Category.PLAYBACK, Category.of("audio-source"))+ }++ @Test fun aCategoryThatDoesNotFitIsAWarningNotARefusal() {+ val m = Manifest("a.b.c", "N", "1", author = "me", actions = listOf(ActionRequest("lyrics.provide", "Synced lyrics")), category = "library")+ assertTrue(m.problems().isEmpty())+ assertEquals(Category.OTHER, m.category())+ assertTrue(m.categoryWarning()!!, "library" in m.categoryWarning()!!)+ assertNull(m.copy(category = "lyrics").categoryWarning())+ assertTrue("unknown" in m.copy(category = "games").categoryWarning()!!)+ }++ @Test fun searchFindsNameTagsAndCategory() {+ val e = entry(tags = listOf("karaoke"))+ assertTrue(Store.matches(e, "", null))+ assertTrue(Store.matches(e.copy(category = "lyrics"), "KARA ext", Category.LYRICS))+ assertFalse(Store.matches(e, "", Category.TOOLS))+ assertFalse(Store.matches(e, "flac", null))+ }++ // ── The manifest ──++ @Test fun manifestStoreFieldsAreChecked() {+ val base = Manifest("a.b.c", "N", "1", author = "me", provides = listOf("lyrics"))+ assertEquals(emptyList<String>(), base.copy(icon = "logo.png", category = "lyrics", tags = listOf("synced", "word by word"), minAppVersion = "2.0.2-beta.4", changelog = "New").problems())+ val p = base.copy(icon = "img/logo.jpg", tags = listOf("UPPER"), minAppVersion = "soon", changelog = "x".repeat(2001)).problems().joinToString("\n")+ listOf("icon \"img/logo.jpg\"", "tag \"UPPER\"", "minAppVersion \"soon\"", "changelog").forEach { assertTrue(p, it in p) }+ }++ @Test fun aNamedIconTravelsInThePackage() {+ val dir = Files.createTempDirectory("ext").toFile()+ File(dir, "manifest.json").writeText("""{ "id": "a.b.c", "name": "N", "version": "1", "author": "me", "provides": ["lyrics"], "icon": "logo.png" }""")+ File(dir, "main.js").writeText("myspoti.provide('lyrics', function () { return null; });")+ File(dir, "logo.png").writeBytes(byteArrayOf(1, 2, 3))+ val p = ExtensionPackage.read(ExtensionPackage.pack(dir))+ assertEquals(listOf<Byte>(1, 2, 3), p.icon!!.toList())+ dir.deleteRecursively()+ }+}diff --git a/base/host-android/src/main/kotlin/app/myspoti/host/android/ControlRelay.kt b/base/host-android/src/main/kotlin/app/myspoti/host/android/ControlRelay.ktindex 83c3fa71..91859898 100644--- a/base/host-android/src/main/kotlin/app/myspoti/host/android/ControlRelay.kt+++ b/base/host-android/src/main/kotlin/app/myspoti/host/android/ControlRelay.kt@@ -3,6 +3,9 @@ package app.myspoti.host.androidimport android.os.Handlerimport android.os.Looperimport android.webkit.WebView+import app.myspoti.spotify.bridge.IpFamily+import app.myspoti.spotify.bridge.RelayRoute+import app.myspoti.spotify.bridge.RelayRoutesimport okhttp3.Callimport okhttp3.Callbackimport okhttp3.Cookie@@ -62,9 +65,15 @@ internal class ControlRelay(private val view: WebView, private val fingerprint:.connectTimeout(15, TimeUnit.SECONDS).readTimeout(30, TimeUnit.SECONDS).cookieJar(cookies)+ .eventListener(RelayEvents).build()+ /** The same client, pinned to one address family (see RelayRoutes). */+ private val v4Client by lazy { http.newBuilder().dns(FamilyDns(IpFamily.V4)).build() }+ private val v6Client by lazy { http.newBuilder().dns(FamilyDns(IpFamily.V6)).build() }+ private val routes get() = ROUTESfun install() {+ NetworkReport.logOnce(view.context.applicationContext)view.exposeToPlayer("MyspotiNet", ::onMessage)val documentStart = androidx.webkit.WebViewFeature.isFeatureSupported(androidx.webkit.WebViewFeature.DOCUMENT_START_SCRIPT)if (documentStart) androidx.webkit.WebViewCompat.addDocumentStartJavaScript(view, SCRIPT, setOf("https://open.spotify.com"))@@ -180,61 +189,144 @@ internal class ControlRelay(private val view: WebView, private val fingerprint:if (debuggable && rewritten != body) Logbook.log("device registered as \"$deviceName\"")rewritten} else body- // Bytes, not a String body: OkHttp would append "; charset=utf-8" to the content type.- val payload = if (method == "GET" || method == "HEAD") null else (sent ?: "").toByteArray().toRequestBody(null)- val request = Request.Builder().url(url).headers(built).method(method, payload).build()val asked = android.os.SystemClock.uptimeMillis()- http.newCall(request).enqueue(object : Callback {- override fun onFailure(call: Call, e: IOException) {- Logbook.log("relay $method ${shortPath(url)} failed: ${e.message}")- reply(id, 0, "{}", "")+ // A refused command (or a refused registration) is sent again another way before the page+ // hears of it (see RelayRoutes): the other address family, then the platform's own stack.+ val retriable = COMMAND.containsMatchIn(url) || registration+ val tried = ArrayList<RelayRoute>()+ var refusal: Answer? = null+ fun attempt(route: RelayRoute) {+ tried += route+ fetch(route, url, method, built, sent) { answer, error ->+ val via = if (route == RelayRoute.DEFAULT) "" else " via $route"+ if (answer == null) {+ Logbook.log("relay $method ${shortPath(url)} failed$via: $error")+ val first = refusal+ when {+ first != null -> routes.next(tried, null)?.let { attempt(it) } ?: handle(id, url, method, body, registration, asked, first)+ // A kept route the network no longer offers (IPv6 gone with the Wi-Fi): this+ // request goes the default way; the route stays kept for the next ones.+ route != RelayRoute.DEFAULT && RelayRoute.DEFAULT !in tried -> attempt(RelayRoute.DEFAULT)+ else -> reply(id, 0, "{}", "")+ }+ return@fetch+ }+ val refused = answer.code == 402 || (registration && answer.code == 403)+ if (refused && retriable) {+ if (refusal == null) { refusal = answer; logRefusal(answer, body) }+ val next = routes.next(tried, answer.family)+ if (next != null) {+ Logbook.log("relay $method ${shortPath(url)} -> ${answer.code}$via (${answer.family ?: "family unknown"}): sent again via $next")+ attempt(next)+ return@fetch+ }+ }+ if (refusal != null) {+ if (answer.code in 200..299) {+ routes.won(route)+ Logbook.log("relay: $route answered ${answer.code} where ${tried.first()} was refused: kept for this session")+ Logbook.fact("relay route", "$route (taken after a refusal on ${tried.first()})")+ } else Logbook.log("relay: refused on every route (${tried.joinToString()})")+ }+ handle(id, url, method, body, registration, asked, answer)}+ }+ attempt(routes.kept)+ }++ /** A relayed request's answer, whichever stack carried it. */+ private class Answer(+ val code: Int,+ val headers: List<Pair<String, String>>,+ val text: String,+ val protocol: String,+ val tls: String?,+ val family: IpFamily?,+ ) {+ fun header(name: String) = headers.lastOrNull { it.first.equals(name, true) }?.second+ }++ private fun clientFor(route: RelayRoute): OkHttpClient = when (route) {+ RelayRoute.IPV4 -> v4Client+ RelayRoute.IPV6 -> v6Client+ else -> http+ }++ /** Sends one relayed request over [route]; [done] gets the answer, or null and why it failed. */+ private fun fetch(route: RelayRoute, url: String, method: String, headers: Headers, sent: String?, done: (Answer?, String?) -> Unit) {+ if (route == RelayRoute.HTTP_ENGINE && android.os.Build.VERSION.SDK_INT >= 34) {+ PlatformStack.fetch(view.context.applicationContext, url, method, headers, sent) { code, heads, text, protocol, error ->+ done(if (error == null) Answer(code, heads, text, protocol, null, null) else null, error)+ }+ return+ }+ // Bytes, not a String body: OkHttp would append "; charset=utf-8" to the content type.+ val payload = if (method == "GET" || method == "HEAD") null else (sent ?: "").toByteArray().toRequestBody(null)+ val tag = RelayTag()+ val request = Request.Builder().url(url).headers(headers).method(method, payload).tag(RelayTag::class.java, tag).build()+ clientFor(route).newCall(request).enqueue(object : Callback {+ override fun onFailure(call: Call, e: IOException) = done(null, e.message)override fun onResponse(call: Call, response: Response) {- response.use {- val out = JSONObject()- it.headers.names().forEach { name -> out.put(name, it.header(name)) }- val text = it.body.string()- val net = android.os.SystemClock.uptimeMillis() - asked- Logbook.log("relay $method ${shortPath(url)} -> ${it.code} in $net ms")- if (it.code >= 400) Logbook.log("relay error body: ${text.take(400)}")- if (it.code in 200..299 && method == "POST" && url.substringBefore('?').endsWith("/track-playback/v1/devices")) onDeviceRegistered?.invoke()- // B3 (402 on some free accounts): what a tester's report must carry to tell the- // causes apart — the refusal's own headers, and what the refused command asked- // (the license the page put in it, a picked song or not). No ids, no cookies.- if (it.code == 402) {- val heads = it.headers.names().filterNot { n -> n.equals("set-cookie", true) || n.startsWith("authorization", true) }- .joinToString(", ") { n -> "$n=${it.header(n)?.take(80)}" }- Logbook.log("refusal headers (${it.protocol}, ${it.handshake?.tlsVersion?.javaName ?: "no tls"}): $heads")- if (body != null) Logbook.log("refused command: ${commandSummary(body)}")- }- if (registration) Regex("\"effective_license\"\\s*:\\s*\"([^\"]*)\"").find(text)- ?.let { m -> Logbook.log("registration: effective_license=${m.groupValues[1]}") }- if (registration && it.code in 200..299) Logbook.log("registration answer: ${registrationSummary(text)}")- // What Spotify holds for this account's devices (this player's license, whether- // it may play, another device active): the cluster comes back on joining and- // on every cluster read, the one the page makes after a refused command.- if (it.code in 200..299 && (url.contains("/connect-state/v1/cluster") || (method == "PUT" && url.contains("/connect-state/v1/devices/"))))- clusterSummary(text, self)?.let { s -> Logbook.log("cluster: $s") }- if (debuggable && registration) Logbook.log("registration answered: ${text.take(500)}")- if (debuggable && AD_MARK.containsMatchIn(text)) keepAdSample(method, url, body, text)- // An ad in the queue Spotify sends: the song before it goes on to the next song- // instead, before the page sees the queue (see AdBlock.withoutAds).- val given = if (url.contains("/track-playback/")) app.myspoti.spotify.bridge.AdBlock.withoutAds(text) else null- given?.second?.forEach { note -> Logbook.log("ad left out: $note") }- val sent = given?.first ?: text- // Both ways on from this song lead to the ad: the player plays the next song- // just before this one ends (AdBlock.adAhead).- if (url.contains("/track-playback/")) app.myspoti.spotify.bridge.AdBlock.adAhead(sent)?.let { a ->- if (app.myspoti.spotify.bridge.AdBlock.ahead.value != a) Logbook.log("ad ahead: ${a.nextUri} is played before the end")- app.myspoti.spotify.bridge.AdBlock.ahead.value = a+ val answer = runCatching {+ response.use {+ Answer(it.code, it.headers.map { h -> h.first to h.second }, it.body.string(), it.protocol.toString(),+ it.handshake?.tlsVersion?.javaName, tag.family)}- reply(id, it.code, out.toString(), sent)}+ done(answer.getOrNull(), answer.exceptionOrNull()?.message)}})}+ // B3 (402 on some free accounts): what a tester's report must carry to tell the causes apart —+ // the refusal's own headers, and what the refused command asked (the license the page put in+ // it, a picked song or not). No ids, no cookies.+ private fun logRefusal(answer: Answer, body: String?) {+ val heads = answer.headers.map { it.first }.distinct()+ .filterNot { n -> n.equals("set-cookie", true) || n.startsWith("authorization", true) }+ .joinToString(", ") { n -> "$n=${answer.header(n)?.take(80)}" }+ Logbook.log("refusal headers (${answer.protocol}, ${answer.tls ?: "no tls"}, ${answer.family ?: "family unknown"}): $heads")+ if (body != null) Logbook.log("refused command: ${commandSummary(body)}")+ }++ /** What the page gets back, and what the logs keep of it. */+ private fun handle(id: Int, url: String, method: String, body: String?, registration: Boolean, asked: Long, it: Answer) {+ val out = JSONObject()+ it.headers.forEach { (name, value) -> out.put(name, value) }+ val text = it.text+ val net = android.os.SystemClock.uptimeMillis() - asked+ Logbook.log("relay $method ${shortPath(url)} -> ${it.code} in $net ms")+ if (it.code >= 400) Logbook.log("relay error body: ${text.take(400)}")+ if (it.code in 200..299 && method == "POST" && url.substringBefore('?').endsWith("/track-playback/v1/devices")) onDeviceRegistered?.invoke()+ if (it.code == 402 && !(COMMAND.containsMatchIn(url) || registration)) logRefusal(it, body)+ if (registration) Regex("\"effective_license\"\\s*:\\s*\"([^\"]*)\"").find(text)+ ?.let { m -> Logbook.log("registration: effective_license=${m.groupValues[1]}") }+ if (registration && it.code in 200..299) Logbook.log("registration answer: ${registrationSummary(text)}")+ if (registration) Logbook.fact("registration", "${it.code}" + (Regex("\"effective_license\"\\s*:\\s*\"([^\"]*)\"").find(text)?.let { m -> " effective_license=${m.groupValues[1]}" } ?: ""))+ // What Spotify holds for this account's devices (this player's license, whether+ // it may play, another device active): the cluster comes back on joining and+ // on every cluster read, the one the page makes after a refused command.+ if (it.code in 200..299 && (url.contains("/connect-state/v1/cluster") || (method == "PUT" && url.contains("/connect-state/v1/devices/"))))+ clusterSummary(text, self)?.let { s -> Logbook.log("cluster: $s"); Logbook.fact("devices", s) }+ if (debuggable && registration) Logbook.log("registration answered: ${text.take(500)}")+ if (debuggable && AD_MARK.containsMatchIn(text)) keepAdSample(method, url, body, text)+ // An ad in the queue Spotify sends: the song before it goes on to the next song+ // instead, before the page sees the queue (see AdBlock.withoutAds).+ val given = if (url.contains("/track-playback/")) app.myspoti.spotify.bridge.AdBlock.withoutAds(text) else null+ given?.second?.forEach { note -> Logbook.log("ad left out: $note") }+ val sent = given?.first ?: text+ // The songs' media manifests, for extensions to read (spotify.media).+ if (it.code in 200..299 && url.contains("/track-playback/")) app.myspoti.spotify.bridge.MediaManifests.record(sent)+ // Both ways on from this song lead to the ad: the player plays the next song+ // just before this one ends (AdBlock.adAhead).+ if (url.contains("/track-playback/")) app.myspoti.spotify.bridge.AdBlock.adAhead(sent)?.let { a ->+ if (app.myspoti.spotify.bridge.AdBlock.ahead.value != a) Logbook.log("ad ahead: ${a.nextUri} is played before the end")+ app.myspoti.spotify.bridge.AdBlock.ahead.value = a+ }+ reply(id, it.code, out.toString(), sent)+ }+private fun reply(id: Int, status: Int, headersJson: String, body: String) {val posted = android.os.SystemClock.uptimeMillis()main.post { replyNow(id, status, headersJson, body, posted) }@@ -300,11 +392,10 @@ internal class ControlRelay(private val view: WebView, private val fingerprint:* removes it; the playback commands were only the first ones (that header alone was enough to* silence them). One rule on Spotify's side is all it takes to flag every install.*- * Only the playback commands and states are on the list. The play telemetry (`melody`,- * `gabo-receiver-service`) was added in 2.0.2-beta.1 and that beta's page never registered- * its playback device on a free account ("Device not found", nothing plays): it leaves from- * the WebView again, as in 2.0.1, until it is proven harmless on a phone. Widening this to- * everything else broke the page too (protobuf and binary bodies, see the notes).+ * The playback commands and states are on the list, and the play reports ([REPORTS]).+ * `gabo-receiver-service` (product analytics, it counts no listen) leaves from the WebView,+ * as in 2.0.1. Widening this to everything else broke the page (protobuf and binary+ * bodies, see the notes).** Login and consent hosts stay out: their flows post forms and redirect, and a relay would* have to reproduce every step exactly to sign in.@@ -312,7 +403,25 @@ internal class ControlRelay(private val view: WebView, private val fingerprint:private val RELAYED = Regex("^https://[a-z0-9-]+(\\.[a-z0-9-]+)*\\.spotify\\.com/(connect-state|track-playback)/v1/")private val NOT_RELAYED = Regex("^https://(accounts|challenge|www)\\.spotify\\.com/")- fun isRelayed(url: String) = RELAYED.containsMatchIn(url) && !NOT_RELAYED.containsMatchIn(url)+ /**+ * The play reports: `melody/v1/msg/batch`, base64 JSON text that tells Spotify what was+ * played and for how long (`jssdk_playback_start`, `track_stream_verification` with the+ * milliseconds really heard). With the playback states, they are what puts a song in the+ * account's history and Wrapped; they left the WebView with the package-name header on+ * them, and plays streamed here were not counted. Only the batches: `melody/v1/time` and+ * `melody/v1/license_url` (the Widevine licence's address) stay with the WebView.+ *+ * The page relays them only once its playback device is registered (see [SCRIPT]): in+ * 2.0.2-beta.1, which relayed them from the start along with a Widevine probe at boot, the+ * page never registered its device on a free account. Until the registration is answered+ * the page boots exactly as 2.0.1 did.+ */+ private val REPORTS = Regex("^https://[a-z0-9-]+(\\.[a-z0-9-]+)*\\.spotify\\.com/melody/v1/msg/")++ fun isRelayed(url: String) = (RELAYED.containsMatchIn(url) || REPORTS.containsMatchIn(url)) && !NOT_RELAYED.containsMatchIn(url)++ /** The route kept for this session, shared by every page and WebView of the process. */+ private val ROUTES = RelayRoutes(engineAvailable = android.os.Build.VERSION.SDK_INT >= 34)private val COMMAND = Regex("/connect-state/v1/(player/command|connect/transfer)/")@@ -423,6 +532,11 @@ internal class ControlRelay(private val view: WebView, private val fingerprint:};const relayed = /^https:\/\/([a-z0-9-]+\.)*spotify\.com\/(connect-state|track-playback)\/v1\//;const notRelayed = /^https:\/\/(accounts|challenge|www)\.spotify\.com\//;+ // The play reports (REPORTS on the host side), relayed only once this page's device+ // is registered: until then the page boots exactly as in 2.0.1.+ const reports = /^https:\/\/([a-z0-9-]+\.)*spotify\.com\/melody\/v1\/msg\//;+ const registration = /^https:\/\/([a-z0-9-]+\.)*spotify\.com\/track-playback\/v1\/devices(\?|$)/;+ let registered = false;const pending = new Map();let seq = 0;const original = window.fetch;@@ -430,9 +544,15 @@ internal class ControlRelay(private val view: WebView, private val fingerprint:// A refused play or transfer (free accounts in some countries): the app tries another way.// late: the command was acknowledged but nothing played (see trust): the host judges it// more than its usual few seconds after the play.- const tell = (status, url, late) => {+ // kind: what was refused (a transfer, or the command's endpoint: play, seek_to...). The+ // app stops trying other ways once two kinds were refused: the account is refused everything.+ const kindOf = (url, body) => {+ if (/connect\/transfer/.test(url)) return 'transfer';+ try { const c = JSON.parse(body).command; return (c && c.endpoint) || 'command'; } catch (e) { return 'command'; }+ };+ const tell = (status, url, late, body) => {if ((status === 402 || status === 403) && command.test(url) && window.MyspotiHost) {- try { window.MyspotiHost.postMessage(JSON.stringify({ type: 'refused', status, late: !!late, path: url.split('?')[0].replace(/^.*\/v1\//, '').replace(/\/from\/.*$/, '') })); } catch (e) { /* host gone */ }+ try { window.MyspotiHost.postMessage(JSON.stringify({ type: 'refused', status, late: !!late, kind: kindOf(url, body), path: url.split('?')[0].replace(/^.*\/v1\//, '').replace(/\/from\/.*$/, '') })); } catch (e) { /* host gone */ }}};const note = (value) => { try { window.MyspotiNet.postMessage(JSON.stringify(Object.assign({ type: 'direct' }, value))); } catch (e) { /* host gone */ } };@@ -442,7 +562,7 @@ internal class ControlRelay(private val view: WebView, private val fingerprint:// it took. Kept only if something plays within 10 s: a command sent from the page can// be acknowledged and never delivered (X-Requested-With, see above).const plays = () => [...media].some(m => !m.paused && !m.ended && m.readyState > 2);- const trust = (url) => {+ const trust = (url, body) => {if (window.__mspDirect) return;window.__mspDirect = true;setTimeout(() => {@@ -453,15 +573,16 @@ internal class ControlRelay(private val view: WebView, private val fingerprint:// started (reported after 2.0.1: "I can press play, the clock moves, nothing// plays"). Told as a refusal, so the app's fallbacks run and, failing all of// them, the user is told instead of left on a silent player.- if (!kept) tell(402, url, true);+ if (!kept) tell(402, url, true, body);}, 10000);};- const direct = (url, init) => original.call(window, url, init).then(r => { tell(r.status, url); return r; });+ const direct = (url, init) => original.call(window, url, init).then(r => { tell(r.status, url, false, init && init.body); return r; });window.__mspNetDone = (id, status, headers, body) => {const p = pending.get(id);if (!p) return;pending.delete(id);if (!status) return p.reject(new TypeError('Failed to fetch'));+ if (status >= 200 && status < 300 && p.method === 'POST' && registration.test(p.url)) registered = true;const relayedAnswer = () => {const noBody = status === 204 || status === 205 || status === 304;return new Response(noBody ? null : body, { status, headers: JSON.parse(headers) });@@ -469,25 +590,28 @@ internal class ControlRelay(private val view: WebView, private val fingerprint:if (status === 402 && command.test(p.url) && !window.__mspDirect) {original.call(window, p.url, p.init).then(r => {note({ status: r.status });- if (r.ok) trust(p.url); else tell(r.status, p.url);+ const sentBody = p.init && p.init.body;+ if (r.ok) trust(p.url, sentBody); else tell(r.status, p.url, false, sentBody);p.resolve(r);- }, () => { tell(status, p.url); p.resolve(relayedAnswer()); });+ }, () => { tell(status, p.url, false, p.init && p.init.body); p.resolve(relayedAnswer()); });return;}- tell(status, p.url);+ tell(status, p.url, false, p.init && p.init.body);p.resolve(relayedAnswer());};window.fetch = function (input, init) {const url = typeof input === 'string' ? input : (input instanceof URL ? input.href : null);const body = init && init.body;- if (!url || !relayed.test(url) || notRelayed.test(url) || (body != null && typeof body !== 'string')) return original.apply(this, arguments);+ const report = registered && !!url && reports.test(url) && typeof body === 'string' &&+ ((init && init.method) || 'GET').toUpperCase() === 'POST';+ if (!url || !(relayed.test(url) || report) || notRelayed.test(url) || (body != null && typeof body !== 'string')) return original.apply(this, arguments);if (window.__mspDirect && command.test(url)) return direct(url, init);const headers = {};new Headers((init && init.headers) || {}).forEach((v, k) => { headers[k] = v; });const method = ((init && init.method) || 'GET').toUpperCase();return new Promise((resolve, reject) => {const id = ++seq;- pending.set(id, { resolve, reject, url, init });+ pending.set(id, { resolve, reject, url, init, method });window.MyspotiNet.postMessage(JSON.stringify({ id, url, method, headers, body: body == null ? null : body }));});};diff --git a/base/host-android/src/main/kotlin/app/myspoti/host/android/Covers.kt b/base/host-android/src/main/kotlin/app/myspoti/host/android/Covers.ktnew file mode 100644index 00000000..50144e2a--- /dev/null+++ b/base/host-android/src/main/kotlin/app/myspoti/host/android/Covers.kt@@ -0,0 +1,23 @@+package app.myspoti.host.android++/**+ * Spotify's album covers come in 64, 300 and 640 px under the same image id, told apart by its+ * prefix. The queue, the lists and a song picked from them carry the small ones; what plays is+ * shown large (player, notification, lock screen), as the song Spotify plays is.+ */+object Covers {+ private val SMALL_ALBUM_COVER = Regex("ab67616d0000(?:1e02|4851)")+ private val CDN_IMAGE = Regex("^https://[a-z0-9-]+\\.spotifycdn\\.com/image/")+ private const val LARGE_ALBUM_COVER_PREFIX = "ab67616d0000b273"++ /**+ * [url]'s 640 px album cover when it is a smaller one of `i.scdn.co`, of an `image-cdn-*.spotifycdn.com`+ * host (or `spotify:image:`); anything else as it is.+ */+ fun large(url: String): String {+ val image = url.startsWith("https://i.scdn.co/image/") || url.startsWith("spotify:image:") ||+ CDN_IMAGE.containsMatchIn(url)+ if (!image) return url+ return SMALL_ALBUM_COVER.find(url)?.let { url.replaceRange(it.range, LARGE_ALBUM_COVER_PREFIX) } ?: url+ }+}diff --git a/base/host-android/src/main/kotlin/app/myspoti/host/android/Logbook.kt b/base/host-android/src/main/kotlin/app/myspoti/host/android/Logbook.ktindex aa3e9ac2..77188993 100644--- a/base/host-android/src/main/kotlin/app/myspoti/host/android/Logbook.kt+++ b/base/host-android/src/main/kotlin/app/myspoti/host/android/Logbook.kt@@ -21,7 +21,7 @@ object Logbook {* Only the tail is kept: a report is read from the end, and an unbounded buffer would* grow for the whole life of the process (the page can run for hours).*/- private const val MAX_LINES = 1500+ private const val MAX_LINES = 6000/** Guarded by its own monitor: [log] is called from the main thread, OkHttp threads and coroutines. */private val lines = ArrayDeque<String>(MAX_LINES)@@ -40,6 +40,17 @@ object Logbook {}}+ /**+ * What the report's header says of this session, kept apart from the log (which may have cut+ * the line long ago): the account, the network, the devices, the registration... Set from+ * where it is known, the latest value wins.+ */+ private val facts = java.util.concurrent.ConcurrentHashMap<String, String>()+ fun fact(key: String, value: String) { facts[key] = value }++ /** More header lines the app knows of (its extensions), asked when the report is written. */+ @Volatile var headerExtras: (() -> List<Pair<String, String>>)? = null+/** The buffered lines, oldest first. */fun recent(): String = synchronized(lines) { lines.joinToString("\n") }@@ -57,6 +68,8 @@ object Logbook {return file}+ private val FACT_ORDER = listOf("account", "network", "registration", "devices", "relay route")+private fun report(context: Context): String {val info = runCatching { context.packageManager.getPackageInfo(context.packageName, 0) }.getOrNull()val versionName = info?.versionName ?: "?"@@ -64,17 +77,30 @@ object Logbook {// The player's page URL tells which Spotify screen the app was on; read only when the// runtime started, or the not-yet-initialized host would crash the export.val pageUrl = if (MyspotiRuntime.isStarted) runCatching { MyspotiRuntime.host.url.value }.getOrNull() else null- val tail = recent()+ val tail = synchronized(lines) { lines.toList() }+ val webView = runCatching { android.webkit.WebView.getCurrentWebViewPackage() }.getOrNull()+ val widevine = if (MyspotiRuntime.isStarted) runCatching {+ if (MyspotiRuntime.spotify.player.drmMissing.value) "missing (nothing Spotify streams can play)" else null+ }.getOrNull() else null+ val header = buildList {+ add("app" to "$versionName ($versionCode)")+ add("android" to "${android.os.Build.VERSION.RELEASE} (SDK ${android.os.Build.VERSION.SDK_INT})")+ add("device" to "${android.os.Build.MANUFACTURER} ${android.os.Build.MODEL}")+ add("webview" to (webView?.let { "${it.packageName} ${it.versionName}" } ?: "?"))+ add("locale" to Locale.getDefault().toLanguageTag())+ if (!pageUrl.isNullOrEmpty()) add("page" to pageUrl)+ for (key in FACT_ORDER) facts[key]?.let { add(key to it) }+ facts.keys.filter { it !in FACT_ORDER }.sorted().forEach { add(it to facts.getValue(it)) }+ add("widevine" to (widevine ?: facts["widevine"] ?: "not reported missing"))+ runCatching { headerExtras?.invoke() }.getOrNull()?.let { addAll(it) }+ }+ // Masked and cut down (DiagnosticDigest): small enough to paste, nothing that opens an account.return buildString {appendLine("Myspoti diagnostic report")- appendLine("app : $versionName ($versionCode)")- appendLine("android : ${android.os.Build.VERSION.RELEASE} (SDK ${android.os.Build.VERSION.SDK_INT})")- appendLine("device : ${android.os.Build.MANUFACTURER} ${android.os.Build.MODEL}")- appendLine("locale : ${Locale.getDefault().toLanguageTag()}")- if (!pageUrl.isNullOrEmpty()) appendLine("page : $pageUrl")+ header.forEach { (k, v) -> appendLine("${k.padEnd(12)}: ${app.myspoti.spotify.report.DiagnosticDigest.mask(v)}") }appendLine()appendLine("--- log ---")- appendLine(tail)+ append(app.myspoti.spotify.report.DiagnosticDigest.digest(tail))}}}diff --git a/base/host-android/src/main/kotlin/app/myspoti/host/android/MyspotiRuntime.kt b/base/host-android/src/main/kotlin/app/myspoti/host/android/MyspotiRuntime.ktindex ca72aa4a..b30ed63e 100644--- a/base/host-android/src/main/kotlin/app/myspoti/host/android/MyspotiRuntime.kt+++ b/base/host-android/src/main/kotlin/app/myspoti/host/android/MyspotiRuntime.kt@@ -30,6 +30,7 @@ object MyspotiRuntime {if (isStarted) returnval updater = app.myspoti.spotify.gql.GqlOpsUpdater(okhttp3.OkHttpClient(), java.io.File(context.filesDir, "spotify/gql-ops.json"))host = WebPlayerHost(context)+ AudioModeWatch.install(context.applicationContext)spotify = SpotifyApi(host, scope, language = Locale.getDefault().language, ops = updater.load(), deviceId = clientDeviceId(context), userAgent = host.userAgent)spotify.bridge.logger = { line -> Logbook.log(line) }host.onPageLoaded = { scope.launch { spotify.onPageLoaded() } }@@ -39,6 +40,7 @@ object MyspotiRuntime {// the player is not there to answer, and the "page not answering" reload threw the user// off the e-mail code step while they were away reading the code (reported, log seen).spotify.player.recoveryHeld = { host.licenseLimited() || host.loginRequired.value }+ spotify.player.playbackHeld = { host.licenseLimited() }// Spotify limiting this client: stop asking (a paused player requests no licence).scope.launch {host.licenseLimitedUntil.collect { until ->@@ -78,6 +80,7 @@ object MyspotiRuntime {val attrs = a["attributes"] as? kotlinx.serialization.json.JsonObjectfun v(o: kotlinx.serialization.json.JsonObject?, k: String) = (o?.get(k) as? kotlinx.serialization.json.JsonPrimitive)?.contentLogbook.log("account: product=${v(a, "product")} country=${v(a, "country")} catalogue=${v(attrs, "catalogue")} onDemand=${v(attrs, "onDemand")} ads=${v(attrs, "ads")}")+ Logbook.fact("account", "product=${v(a, "product")} country=${v(a, "country")} catalogue=${v(attrs, "catalogue")} onDemand=${v(attrs, "onDemand")} ads=${v(attrs, "ads")}")}.onFailure { planLogged = false }}val s = spotify.player.state.valuediff --git a/base/host-android/src/main/kotlin/app/myspoti/host/android/PlatformStack.kt b/base/host-android/src/main/kotlin/app/myspoti/host/android/PlatformStack.ktnew file mode 100644index 00000000..f485221d--- /dev/null+++ b/base/host-android/src/main/kotlin/app/myspoti/host/android/PlatformStack.kt@@ -0,0 +1,94 @@+package app.myspoti.host.android++import android.content.Context+import android.net.http.HttpEngine+import android.net.http.HttpException+import android.net.http.UploadDataProvider+import android.net.http.UploadDataSink+import android.net.http.UrlRequest+import android.net.http.UrlResponseInfo+import androidx.annotation.RequiresApi+import okhttp3.Headers+import java.io.ByteArrayOutputStream+import java.nio.ByteBuffer+import java.util.concurrent.Executors++/**+ * The platform's own HTTP stack (android.net.http, Cronet in the system since Android 14): the+ * last way a refused relayed command is sent (see RelayRoutes). Chromium's network stack, like+ * the WebView's, without a new dependency.+ *+ * The request carries exactly the headers the OkHttp relay sends, built in the same place; this+ * stack adds no "X-Requested-With" (that header is the WebView's own), only its transport headers+ * (Accept-Encoding, which it also decodes). The WebView's cookies are added by hand: this stack+ * has no cookie jar of its own.+ */+/** A body from memory (the platform has no ready-made one). */+@RequiresApi(34)+private class BytesUpload(private val bytes: ByteArray) : UploadDataProvider() {+ private var at = 0+ override fun getLength(): Long = bytes.size.toLong()+ override fun read(sink: UploadDataSink, buffer: ByteBuffer) {+ val n = minOf(buffer.remaining(), bytes.size - at)+ buffer.put(bytes, at, n)+ at += n+ sink.onReadSucceeded(false)+ }+ override fun rewind(sink: UploadDataSink) {+ at = 0+ sink.onRewindSucceeded()+ }+}++@RequiresApi(34)+internal object PlatformStack {+ @Volatile private var engine: HttpEngine? = null+ private val executor = Executors.newSingleThreadExecutor { r -> Thread(r, "relay-platform").apply { isDaemon = true } }++ private fun engine(context: Context): HttpEngine =+ engine ?: synchronized(this) { engine ?: HttpEngine.Builder(context).build().also { engine = it } }++ fun fetch(+ context: Context,+ url: String,+ method: String,+ headers: Headers,+ sent: String?,+ done: (code: Int, headers: List<Pair<String, String>>, text: String, protocol: String, error: String?) -> Unit,+ ) {+ val out = ByteArrayOutputStream()+ val callback = object : UrlRequest.Callback {+ override fun onRedirectReceived(request: UrlRequest, info: UrlResponseInfo, newLocationUrl: String) = request.followRedirect()++ override fun onResponseStarted(request: UrlRequest, info: UrlResponseInfo) = request.read(ByteBuffer.allocateDirect(32 * 1024))++ override fun onReadCompleted(request: UrlRequest, info: UrlResponseInfo, buffer: ByteBuffer) {+ buffer.flip()+ val bytes = ByteArray(buffer.remaining())+ buffer.get(bytes)+ out.write(bytes)+ buffer.clear()+ request.read(buffer)+ }++ override fun onSucceeded(request: UrlRequest, info: UrlResponseInfo) =+ done(info.httpStatusCode, info.headers.asList.map { it.key to it.value }, out.toString(Charsets.UTF_8.name()), info.negotiatedProtocol, null)++ override fun onFailed(request: UrlRequest, info: UrlResponseInfo?, error: HttpException) =+ done(0, emptyList(), "", "", error.message ?: "failed")++ override fun onCanceled(request: UrlRequest, info: UrlResponseInfo?) = done(0, emptyList(), "", "", "canceled")+ }+ runCatching {+ val builder = engine(context).newUrlRequestBuilder(url, executor, callback).setHttpMethod(method)+ headers.forEach { (name, value) -> builder.addHeader(name, value) }+ android.webkit.CookieManager.getInstance().getCookie(url)?.takeIf { it.isNotBlank() }?.let { builder.addHeader("Cookie", it) }+ if (method != "GET" && method != "HEAD") {+ // This stack refuses a body without a type: the one a browser's fetch gives a string body.+ if (headers["Content-Type"] == null) builder.addHeader("Content-Type", "text/plain;charset=UTF-8")+ builder.setUploadDataProvider(BytesUpload((sent ?: "").toByteArray()), executor)+ }+ builder.build().start()+ }.onFailure { done(0, emptyList(), "", "", it.message ?: "not sent") }+ }+}diff --git a/base/host-android/src/main/kotlin/app/myspoti/host/android/PlaybackService.kt b/base/host-android/src/main/kotlin/app/myspoti/host/android/PlaybackService.ktindex dac2d663..7914aadc 100644--- a/base/host-android/src/main/kotlin/app/myspoti/host/android/PlaybackService.kt+++ b/base/host-android/src/main/kotlin/app/myspoti/host/android/PlaybackService.kt@@ -259,7 +259,7 @@ class PlaybackService : MediaBrowserServiceCompat() {// An album cover comes in 64, 300 and 640 px under the same id: ask for the 640 one first// (the queue and the next song may only carry the small one), the given size is the fallback.val candidates = listOfNotNull(- SMALL_ALBUM_COVER.find(resolved)?.let { resolved.replace(it.value, LARGE_ALBUM_COVER_PREFIX) },+ Covers.large(resolved).takeIf { it != resolved },resolved,).distinct()for (candidate in candidates) {@@ -393,6 +393,7 @@ class PlaybackService : MediaBrowserServiceCompat() {// play/pause controls, but browsing and search return nothing.val packages = runCatching { packageManager.getPackagesForUid(clientUid)?.toList() }.getOrNull().orEmpty()if (clientPackageName != packageName && clientPackageName !in packages) return null+ if (clientPackageName != packageName) Logbook.log("media browser connected: $clientPackageName (browse: ${if (mayBrowse(clientPackageName)) "yes" else "no"})")if (!mayBrowse(clientPackageName)) {android.util.Log.w("Myspoti", "media browser: empty root for $clientPackageName")return BrowserRoot(EMPTY_ROOT_ID, null)@@ -478,8 +479,6 @@ class PlaybackService : MediaBrowserServiceCompat() {private const val COVER_CACHE_BYTES = 8 * 1024 * 1024/** Pause before each new try of a failed cover; after the last one the cover waits for the next state change. */private val COVER_RETRY_MS = longArrayOf(2_000L, 6_000L, 15_000L)- private val SMALL_ALBUM_COVER = Regex("ab67616d0000(?:1e02|4851)")- private const val LARGE_ALBUM_COVER_PREFIX = "ab67616d0000b273"@Volatile private var instance: PlaybackService? = null@Volatile private var current: NowPlayingInfo? = null@@ -513,7 +512,9 @@ class PlaybackService : MediaBrowserServiceCompat() {current = infoval svc = instanceif (svc == null) {- if (info.playing) runCatching {+ // Loading counts: Android gives the audio only to a player in the foreground, and a+ // song an extension is still resolving starts right after.+ if (info.playing || info.buffering) runCatching {androidx.core.content.ContextCompat.startForegroundService(context, Intent(context, PlaybackService::class.java))}returndiff --git a/base/host-android/src/main/kotlin/app/myspoti/host/android/RelayNetwork.kt b/base/host-android/src/main/kotlin/app/myspoti/host/android/RelayNetwork.ktnew file mode 100644index 00000000..a9666ada--- /dev/null+++ b/base/host-android/src/main/kotlin/app/myspoti/host/android/RelayNetwork.kt@@ -0,0 +1,113 @@+package app.myspoti.host.android++import android.content.Context+import android.net.ConnectivityManager+import android.net.NetworkCapabilities+import app.myspoti.spotify.bridge.IpFamily+import app.myspoti.spotify.bridge.RelayRoutes+import okhttp3.Call+import okhttp3.Connection+import okhttp3.Dns+import okhttp3.EventListener+import java.net.Inet4Address+import java.net.Inet6Address+import java.net.InetAddress++/*+ * 402 on some free accounts (see RelayRoutes): what a tester's diagnostic must carry to tell the+ * paths apart — which address family the relayed requests went out on, from and to which+ * (masked) addresses, and what the phone's network offers. Logged when it changes, not per call.+ */++/** Filled by [RelayEvents] for one relayed request: the connection it went out on. */+internal class RelayTag {+ @Volatile var family: IpFamily? = null+}++internal object RelayEvents : EventListener() {+ @Volatile private var lastPath: String? = null++ override fun connectionAcquired(call: Call, connection: Connection) {+ val socket = runCatching { connection.socket() }.getOrNull() ?: return+ val remote = socket.inetAddress+ call.request().tag(RelayTag::class.java)?.family = IpFamily.of(remote)+ val path = "${RelayRoutes.mask(socket.localAddress)} -> ${RelayRoutes.mask(remote)} (${connection.protocol()})"+ if (path != lastPath) {+ lastPath = path+ Logbook.log("relay path: $path")+ }+ }+}++/** The system resolver, keeping one address family only (see [RelayRoutes.only]). */+internal class FamilyDns(private val family: IpFamily) : Dns {+ override fun lookup(hostname: String): List<InetAddress> = RelayRoutes.only(family, hostname, Dns.SYSTEM.lookup(hostname))+}++internal object NetworkReport {+ @Volatile private var logged = false++ /** Once per session: the active network's families, CLAT (464XLAT), VPN and Private DNS. */+ fun logOnce(context: Context) {+ if (logged) return+ logged = true+ runCatching {+ val cm = context.getSystemService(ConnectivityManager::class.java)+ val network = cm.activeNetwork+ val link = cm.getLinkProperties(network)+ val caps = cm.getNetworkCapabilities(network)+ val addresses = link?.linkAddresses.orEmpty().map { it.address }+ val v6 = addresses.any { it is Inet6Address && !it.isLinkLocalAddress && !it.isLoopbackAddress }+ val v4 = addresses.any { it is Inet4Address }+ // The CLAT interface ("v4-rmnet…") carries IPv4 over an IPv6-only network: the WebView's+ // IPv4 requests then leave from a translated address.+ val clat = runCatching {+ java.net.NetworkInterface.getNetworkInterfaces()?.toList().orEmpty().any { it.name.startsWith("v4-") && it.isUp }+ }.getOrDefault(false)+ val transport = when {+ caps == null -> "none"+ caps.hasTransport(NetworkCapabilities.TRANSPORT_WIFI) -> "wifi"+ caps.hasTransport(NetworkCapabilities.TRANSPORT_CELLULAR) -> "cellular"+ caps.hasTransport(NetworkCapabilities.TRANSPORT_ETHERNET) -> "ethernet"+ else -> "other"+ }+ val vpn = caps?.hasTransport(NetworkCapabilities.TRANSPORT_VPN) == true+ val privateDns = when {+ link?.isPrivateDnsActive != true -> "off"+ link?.privateDnsServerName != null -> "strict"+ else -> "opportunistic"+ }+ fun yn(b: Boolean) = if (b) "yes" else "no"+ val line = "$transport, IPv4 ${yn(v4)}, IPv6 ${yn(v6)}, CLAT ${yn(clat)}, VPN ${yn(vpn)}, private DNS $privateDns"+ Logbook.log("network: $line")+ Logbook.fact("network", line)+ }.onFailure { Logbook.log("network: not read (${it.message})") }+ }+}++/**+ * Calls in the timeline: the phone's audio mode (ringing, in a call, back to normal), the moments+ * a report of "the music did not come back after a call" turns on. Android 12+.+ */+internal object AudioModeWatch {+ @Volatile private var installed = false++ fun install(context: Context) {+ if (installed || android.os.Build.VERSION.SDK_INT < 31) return+ installed = true+ runCatching {+ val audio = context.getSystemService(android.media.AudioManager::class.java)+ audio.addOnModeChangedListener(java.util.concurrent.Executors.newSingleThreadExecutor()) { mode ->+ val name = when (mode) {+ android.media.AudioManager.MODE_NORMAL -> "normal"+ android.media.AudioManager.MODE_RINGTONE -> "ringing"+ android.media.AudioManager.MODE_IN_CALL -> "in a call"+ android.media.AudioManager.MODE_IN_COMMUNICATION -> "in a voice/video call (app)"+ android.media.AudioManager.MODE_CALL_SCREENING -> "call screening"+ else -> "mode $mode"+ }+ Logbook.log("audio mode: $name")+ }+ }+ }+}diff --git a/base/host-android/src/test/kotlin/app/myspoti/host/android/ControlRelayTest.kt b/base/host-android/src/test/kotlin/app/myspoti/host/android/ControlRelayTest.ktindex 0bcd5cb3..bcb775a6 100644--- a/base/host-android/src/test/kotlin/app/myspoti/host/android/ControlRelayTest.kt+++ b/base/host-android/src/test/kotlin/app/myspoti/host/android/ControlRelayTest.kt@@ -13,10 +13,15 @@ class ControlRelayTest {assertTrue(ControlRelay.isRelayed("https://gew4-spclient.spotify.com/track-playback/v1/devices/a/state"))}- // Relayed in 2.0.2-beta.1, whose page then never registered its device: back with the WebView.- @Test fun `play telemetry stays with the WebView, as in 2_0_1`() {- assertFalse(ControlRelay.isRelayed("https://gew4-spclient.spotify.com/melody/v1/msg/batch"))+ // The play reports count the listen: relayed (the page sends them only once its device is registered).+ @Test fun `play reports leave from the app`() {+ assertTrue(ControlRelay.isRelayed("https://gew4-spclient.spotify.com/melody/v1/msg/batch"))+ }++ // Analytics, the server clock and the Widevine licence address stay with the WebView, as in 2.0.1.+ @Test fun `the rest of the telemetry stays with the WebView`() {assertFalse(ControlRelay.isRelayed("https://gew4-spclient.spotify.com/melody/v1/time"))+ assertFalse(ControlRelay.isRelayed("https://gew4-spclient.spotify.com/melody/v1/license_url?keySystem=com.widevine.alpha"))assertFalse(ControlRelay.isRelayed("https://gew4-spclient.spotify.com/gabo-receiver-service/v3/events"))assertFalse(ControlRelay.isRelayed("https://gew4-spclient.spotify.com/gabo-receiver-service/public/v3/events"))}@@ -45,14 +50,14 @@ class ControlRelayTest {val s = ControlRelay.clusterSummary("""{"active_device_id":"$other","devices":{"$self":{"device_type":"COMPUTER","license":"tft","can_play":true,"name":"Pixel","capabilities":{"is_controllable":true,"can_be_player":true}},- "$other":{"device_type":"SMARTPHONE","license":"mft","can_play":true,"name":"Daniel","public_ip":"1.2.3.4","device_software_version":"Spotify 9.0.1"}},+ "$other":{"device_type":"SMARTPHONE","license":"mft","can_play":true,"name":"Alex","public_ip":"1.2.3.4","device_software_version":"Spotify 9.0.1"}},"player_state":{"restrictions":{"disallow_resuming_reasons":["not_paused"],"disallow_seeking_reasons":[]}}}""",self,)!!assertTrue(s, s.startsWith("devices=2 active=other self_listed=true [self COMPUTER license=tft can_play=true controllable=true player=true; active SMARTPHONE license=mft"))assertTrue(s, s.contains("Spotify 9.0.1"))assertTrue(s, s.endsWith("restrictions: resuming=not_paused"))- assertFalse(s, s.contains(self) || s.contains(other) || s.contains("Daniel") || s.contains("Pixel") || s.contains("1.2.3.4"))+ assertFalse(s, s.contains(self) || s.contains(other) || s.contains("Alex") || s.contains("Pixel") || s.contains("1.2.3.4"))}@Test fun `a body that is not a cluster says nothing`() {diff --git a/base/host-android/src/test/kotlin/app/myspoti/host/android/CoversTest.kt b/base/host-android/src/test/kotlin/app/myspoti/host/android/CoversTest.ktnew file mode 100644index 00000000..ca1712a0--- /dev/null+++ b/base/host-android/src/test/kotlin/app/myspoti/host/android/CoversTest.kt@@ -0,0 +1,18 @@+package app.myspoti.host.android++import org.junit.Assert.assertEquals+import org.junit.Test++class CoversTest {+ @Test fun aSmallAlbumCoverIsAskedLarge() {+ assertEquals("https://i.scdn.co/image/ab67616d0000b273aa11", Covers.large("https://i.scdn.co/image/ab67616d00001e02aa11"))+ assertEquals("https://i.scdn.co/image/ab67616d0000b273aa11", Covers.large("https://i.scdn.co/image/ab67616d00004851aa11"))+ assertEquals("spotify:image:ab67616d0000b273aa11", Covers.large("spotify:image:ab67616d00001e02aa11"))+ assertEquals("https://image-cdn-ak.spotifycdn.com/image/ab67616d0000b273aa11", Covers.large("https://image-cdn-ak.spotifycdn.com/image/ab67616d00004851aa11"))+ }++ @Test fun anythingElseIsKept() {+ for (u in listOf("https://i.scdn.co/image/ab67616d0000b273aa11", "https://mosaic.scdn.co/640/ab67616d00001e02aaab67616d00001e02bb",+ "content://media/external/audio/albumart/3", "https://i.scdn.co/image/ab6761610000e5ebcc", "")) assertEquals(u, Covers.large(u))+ }+}diff --git a/base/settings.gradle.kts b/base/settings.gradle.ktsindex d855585c..2c158551 100644--- a/base/settings.gradle.kts+++ b/base/settings.gradle.kts@@ -28,6 +28,8 @@ dependencyResolutionManagement {rootProject.name = "Myspoti"include(":app")include(":api")+include(":extensions")+include(":extensions-cli")include(":api-spotify")include(":host-cdp")include(":host-android")diff --git a/docs/api/LIBRARY.md b/docs/api/LIBRARY.mdindex 53ad246d..50929c89 100644--- a/docs/api/LIBRARY.md+++ b/docs/api/LIBRARY.md@@ -487,7 +487,30 @@ username is the account's own (`UserAPI.getUser().username`); the same call, witusername, is the owner's "Remove from playlist" in the members list. A public playlist stays in thelibrary after leaving (followed, read-only); to join again a new invitation link is needed(`claimPermissions`). In the app: `Playlists.leave(uri)`, offered in the playlist's menu when-`Playlist.canLeave`.+`Playlist.canLeave`. Guests also get "Leave playlist" on their own row of the members sheet.++## Managing members and stopping a collaboration (owner)++The Web Player's "Shared with" list (`xpui-root-dialogs`, `permissions.*` strings) has a menu per+member, gated by `capabilities.canAdministratePermissions`:++| Menu entry | Call |+|---|---|+| "Make collaborator" (listener row) / "Make listener" (collaborator row) | page service `PlaylistPermissionsAPI.setMemberPermission(playlistUri, username, "CONTRIBUTOR" \| "VIEWER")` |+| "Remove from playlist" | `PlaylistPermissionsAPI.removeMember(playlistUri, username)` |++`setMemberPermission` first reads `GET /playlist/{id}/permission/members` (`{memberPermissions:{username:{revision}}}`)+and fails when the user is not a member, then sends spclient `POST /playlist/{id}/permission/member/user/{username}`+with `{revision, permissionLevel}`. In the app: `Playlists.setMemberCollaborator`, `Playlists.removeMember`+(the members sheet; the menu shows on every non-owner row for the owner).++The Web Player has **no "stop collaborating"** (its "Invite as collaborator" switch of the share dialog only+adds the `pt` token to the copied link), and **no call to revoke an invitation link**: the only+`permission-grant` calls in the bundles are `POST …/permission-grant` (create, `ttlMs` 7 days) and+`POST …/permission-grant/token/{pt}/claim`. So `Playlists.stopCollaboration(uri)` is built from the member+calls: each collaborator becomes a listener when the playlist is private (not listed on the profile) or is+removed when it is public, then the base permission goes back to `BLOCKED` (private) / `VIEWER` (public).+Links already shared are not revoked; the app's confirmation says so. Not tested on a real account.## Blend ("Mix à plusieurs")diff --git a/docs/api/feature-inventory.md b/docs/api/feature-inventory.mdindex 08e79ca0..63f84da2 100644--- a/docs/api/feature-inventory.md+++ b/docs/api/feature-inventory.md@@ -98,7 +98,8 @@ as a page service (`service: Name.method`, through the bridge) or an HTTP endpoi| Add tracks | exposed | `addToPlaylist` || Remove tracks | exposed | `removeFromPlaylist` (by row uid) || Reorder tracks | exposed | `moveItemsInPlaylist` (`BOTTOM_OF_PLAYLIST` and `BEFORE_UID`) |-| Hide a song in a playlist (Spotify's "Hide song") | needs capture | no operation name in the bundle table and no endpoint captured |+| Hide a song in a playlist (Spotify's "Hide in this playlist") | not possible | the menu item calls `FeedbackAPI.addContextTrackBan(contextUri, trackUri)`, which the Web Player's `FeedbackAPI` leaves unimplemented (throws "Method not implemented"; `getCapabilities()` is `{canBan:false}`), so the item never shows there |+| Add a whole playlist or album to another playlist, with the duplicate dialog | added now | the page reads the target (`getContents`), splits new from already-there songs and asks ("Add all" / "Add new ones", or "Add anyway" / "Don't add"), then `PlaylistAPI.add`; here `PlaylistMerge` + `addToPlaylist` in 100-song requests || Sort the playlist (title, artist, album, date added, duration) with ascending or descending | added now | client side: `Playlists.sortedTracks` reads every page and sorts. The server has no sort parameter || Playlist order as the playback order | exposed | `Player.play(order)` || Delete a playlist | exposed | rootlist `REM` (`Playlists.delete`); for owned playlists the Web Player may do more, not confirmed |@@ -124,8 +125,9 @@ as a page service (`service: Name.method`, through the bridge) or an HTTP endpoi| Public profile: name, avatar, follower and following counts, public playlists | exposed | spclient `user-profile-view/v3/profile/{id}` || Follow and unfollow users, check follow state | exposed | `followUsers`, `unfollowUsers`, `isFollowingUsers` || Followers list and following list of a user | needs capture | no operation or endpoint captured |-| Top artists and tracks (per time range) | exposed | `userTopContent` |-| Friend activity | not possible | the Web Player has no friend feed; `friendActivity()` returns an empty list |+| Top artists and tracks (per time range) | exposed | `userTopContent`; `AffinityInput.timeRange` is `SHORT_TERM` (~4 weeks), `MID_TERM` (~6 months), `LONG_TERM` (~1 year), `MEDIUM_TERM` is refused; `sortBy` `AFFINITY`/`PLAY_COUNT`/`LAST_PLAYED`; ranks and `totalCount` only, no play counts |+| Friend activity | exposed (spclient) | the Web Player's `BuddyFeedAPI` is a stub (`isSupported: false`), but the desktop feed's `GET presence-view/v1/buddylist` (guc-spclient, then spclient.wg) answers the page token on both hosts (200, checked 2026-10-23): `friends[] {timestamp, user{uri,name,imageUrl}, track{uri,name,imageUrl,album,artist,context{uri,name,index}}}`; "now" = played within 15 min |+| Minutes listened, play counts, top-listener / early-fan badges | not exposed | the Web Player's listening-stats route only shows an "open the app" modal, and `queryArtistOverview` has no per-user fan data; Myspoti counts minutes on the phone (Recap) and shows "your #N artist" from `userTopContent` || Private session | not possible | the Web Player reports `isSupported: false`; `setPrivateSession` throws || Comments and reactions on entities | needs capture | `getCommentsForEntity`, `addComment`, `addCommentReaction` and others (not wired) |diff --git a/docs/cli.md b/docs/cli.mdnew file mode 100644index 00000000..415dded5--- /dev/null+++ b/docs/cli.md@@ -0,0 +1,61 @@+# Driving the app over adb (`tools/myspoti-cli`)++Debug and beta builds answer a few commands sent over adb, so a test (or an agent) checks a feature+through the app's own code paths without screenshots or taps. Stable releases leave the receiver+off in their manifest, and it answers nothing outside debug and beta builds even if turned on.++```+tools/myspoti-cli [-p app.myspoti.dev] [-s serial] [-t 40] [--raw] <command> [args…]+```++Each command is one broadcast (`<package>.CLI`, held to the adb shell by the `DUMP` permission).+The app writes its JSON reply to `/sdcard/Android/data/<package>/files/cli/<request>.json` and to+logcat under `MyspotiCli`; the script reads it back, prints the `result`, and deletes the file.++Exit codes: `0` ok, `1` the app answered an error (on stderr), `2` no reply (not installed, a+stable build, timeout), `3` adb failed. `ADB`, `ANDROID_SERIAL` and `MYSPOTI_PACKAGE` override the+defaults (the beta is `-p app.myspoti`).++## Commands++| Command | Does |+| --- | --- |+| `status` | Version, debug/beta, signed in or not, what plays (uri, position, duration), installed extensions, whether the screen is open. `player` says who plays: `local` (the app's own player; `source` is `audio-source`, `download` or `file`, and `extension` the id of the extension that gave the stream) or `engine` (Spotify); `routing` is true while the extensions are asked for a song; while the local player has a queue, `playWhenReady` says whether it is to play and `playbackState` whether it is `idle` (stopped by an error), `buffering`, `ready` or `ended`. |+| `ext.list` | Installed extensions: version, enabled, running, last error, actions, settings (secret ones masked), and their last `status` probe: `status` (`live`, `inactive`, `unknown` for no answer, `not probed`), `inactive` (skipped for songs' audio and downloads) and `statusDetail`. |+| `ext.install <zip>` | Installs a package with all it asks, without the prompt. A zip on the computer is pushed first to `…/files/cli/in/`. |+| `ext.uninstall <id>` | As its page's Uninstall button. |+| `ext.enable <id>` / `ext.disable <id>` | Turns it on (clashes settled for it) or off. |+| `ext.setting <id> <key> <value>` | Sets a setting. `true`, `false`, numbers and JSON stay JSON, anything else is a string, `null` goes back to the default. The extension gets its `setting` event after the usual pause. |+| `ext.press <id> <key>` | Presses a button setting (`setting` event with `pressed: true`). |+| `ext.call <id> <hook> [json]` | Calls one hook of that extension alone (`lyrics`, `audio-source`, `download-source`, `trackinfo`, `home`, `search`, `menu`, `player`, `page`, `message`, `tap`, `status`) and prints its answer, masked; `null` when its script provides no such hook. Asked while the app starts, it waits for the extensions to load. |+| `ext.log <id> [lines]` | Its log's last lines (50 by default), masked. |+| `ext.storage <id>` | Its storage's keys and size, never the values. |+| `play <spotify:…> [context]`, `pause`, `resume`, `next`, `previous` | The player's own commands. |+| `nav <route>` | The open screen navigates to a route (`settings`, `extensions`, `extension/<id>`, `queue`…). |++## What never leaves the phone++Storage values; secret settings and settings the manifest does not list; in logs, errors and hook+answers, any stored or secret value, `Bearer`/`Basic` credentials, `Cookie`/`Authorization`+headers, JWTs, the values of fields and URL parameters named like a token, key, signature,+session, cookie or password. All replace with `***`. Only extension and player state is reachable;+no command reads the app's own account tokens.++## End to end++A sample lyrics extension, from packing to its answer, from the repository root with the debug build on the phone:++```bash+cd base && ./gradlew -q :extensions-cli:installDist && cd ..+base/extensions-cli/build/install/myspoti-ext/bin/myspoti-ext pack docs/extensions/samples/lrclib-lyrics /tmp/myspoti-cli+tools/myspoti-cli ext.install /tmp/myspoti-cli/app.myspoti.samples.lrclib-*.zip+tools/myspoti-cli ext.list+tools/myspoti-cli ext.call app.myspoti.samples.lrclib lyrics '{"title":"Get Lucky","artist":"Daft Punk","durationMs":369000}'+tools/myspoti-cli ext.log app.myspoti.samples.lrclib 20+tools/myspoti-cli play spotify:track:69kOkLUCkxIZYexIgSG8rq+tools/myspoti-cli status+tools/myspoti-cli ext.disable app.myspoti.samples.lrclib+```++In a script, `--raw` prints the whole reply (`{"ok":…,"cmd":…,"result":…}`) and the exit code says+whether it worked, e.g. `tools/myspoti-cli --raw ext.list | jq '.result[].id'`.diff --git a/docs/extensions/API.md b/docs/extensions/API.mdnew file mode 100644index 00000000..1e7ffb41--- /dev/null+++ b/docs/extensions/API.md@@ -0,0 +1,1304 @@+# Myspoti extensions: API for authors++An extension is a small JavaScript file plus a `manifest.json`. Myspoti runs it in a sandbox. What+it may do is a list of **actions** from a closed catalogue the app defines (section 4): provide+lyrics or song details, add Home sections, search results, menu entries or player buttons (as+native blocks the app draws itself, section 3), give a song's audio or download files, show its own+web page, sign in on a website, react to the song playing, and, if the user allows it, read or change the signed-in+Spotify account. Each action has a fixed icon, a short label, a level (normal or critical) and the+API it unlocks; the user sees them as icons, each with your reason, before installing.++This page documents what the build ships (API version 1). Nothing here is a promise about+anything else.++## 1. A minimal extension++`manifest.json`:++```json+{+ "id": "io.github.you.lyrics",+ "name": "My Lyrics",+ "version": "1.0.0",+ "author": "You",+ "description": "Lyrics from example.com.",+ "actions": [+ { "name": "lyrics.provide", "why": "Synced lyrics from example.com" },+ { "name": "network", "hosts": ["lyrics.example.com"], "why": "Asks example.com for the lyrics" }+ ]+}+```++`main.js`:++```js+myspoti.provide('lyrics', function (track) {+ var r = myspoti.http.get('https://lyrics.example.com/api?' ++ myspoti.query({ artist: track.artist, title: track.title }));+ if (!r.ok) return null; // null: "I have nothing", the app tries its other sources+ var lines = r.json().lines; // [{ ms: 1200, text: "..." }, ...]+ return { provider: 'example.com', lines: lines.map(function (l) { return { time: l.ms, text: l.text }; }) };+});+```++Package it (a zip with the manifest and the script at its root, nothing else but the optional+files below):++```+myspoti-ext pack ./my-lyrics # writes io.github.you.lyrics-1.0.0.zip, prints its sha256+```++A package may hold `manifest.json`, the `main` script, `icon.png` (or the PNG named by the+manifest's `icon`), `LICENSE`, `LICENSE.txt`, `README.md` and nothing more (any other file refuses the package). At most 30 files, 2 MB for the+zip, 1 MB for the script, 256 KB for the icon. The zip is built the same way every time (fixed+order and dates), so anyone can rebuild it and compare the sha256.++How an extension reaches people: its own GitHub repository, found by the store through the topic+`myspoti-extension` (section 9), the official repository's optional list of verified extensions or a repository the user adds at their own risk. A repository is a folder of packages+and an `index.json` (`myspoti-ext index <folder> <name>` writes it). The index can also list+extensions every Myspoti must turn off (`blocked`: an id, optionally some package sha256, a reason).++An index entry is the manifest's fields (`id`, `name`, `version`, `versionCode`, `apiVersion`,+`author`, `description`, `actions` (or the old `provides` and `permissions`), `homepage`, `replaces`,+`conflicts_with`) plus `repo` (optional: `owner/name` on GitHub, the package is then read from+there as in section 9 and kept updated from there; `sha256`, when not empty, is checked against the+release's package or the package built from the archive) and the package's `url` (absolute+or relative to the index), `sha256` and `size`, and these optional store fields (an older Myspoti+ignores them, an index without them still reads):++| Field | Type | Shown |+|---|---|---|+| `icon_url` | string | The icon before download: a PNG, absolute or relative to the index (`myspoti-ext index` writes `icons/<id>.png`). `icon`, the older name, is still read. |+| `updated_at` | string | ISO 8601 date the version was listed (`2026-10-23`); `index` keeps it while the package's sha256 is unchanged. |+| `category`, `tags`, `changelog` | | As in the manifest. |+| `min_app_version` | string | As the manifest's `minAppVersion`: the row says "Requires Myspoti X or newer" and its Install button is off. |++In the app, Extensions has two tabs. **Store**: each repository with its trust note (verified by the+owner, or added by the user), a search field and category chips, and one row per extension+(icon, name, version, one line, its actions as icons, critical ones in the warning colour, one+button: Install, Update, Installed; "Incompatible with X (installed)" when `conflictsWith` or+`replaces` meets an installed one). A row opens the store page (description, changelog, tags, each+action's icon, label and your `why`, repository, sha256) before anything is downloaded; Install+then shows the install prompt: name, author and source, every action with your `why` (critical+ones marked), what it collides with (the user picking which to keep, section 4.2), the third-party+notice ("Third-party extension, not reviewed by Myspoti, under its author's responsibility.") and+one box, "I understand this extension is made by a third party and I install it on my own+responsibility", which enables Install. There is no per-action choice: an extension gets every+action it lists, or is not installed. The official repository is suggested, never added without the user.++**Installed** is organised **by area**: Playback, Lyrics & song info, Audio & downloads, Home &+search, Menus & player, Library & Spotify, Pages & more. Each area opens with a **Built-in** row (a+dropdown of what Myspoti does there by itself, e.g. Lyrics: Spotify, LRCLIB, NetEase, KuGou,+Lyrics+, Genius; built-in sources are not extensions), then the extensions acting there with their+switch and action icons, in the user's order (arrows; installation order until moved). That order+is the one the area asks them in (section 3) and the one the playback arbiter uses. The Built-in row says in+one plain sentence what the app already does there; an area no extension acts in says "No+extension — the app already does: …". Nothing is ever installed without the install prompt, and+the samples in `docs/extensions/samples` are for authors only. An exclusive+action shows which extension is **Active** and which are **Idle**. Under each area, the last things+extensions did there ("Lyrics of X from Y", "Skipped by Z") with a one-tap Turn off.++## 2. Manifest++`manifest.json` at the root of the package. Unknown keys are ignored.++| Field | Type | Default | Rule |+|---|---|---|---|+| `id` | string | required | Lower case, reverse-domain, at least two parts: `^[a-z][a-z0-9_]*(\.[a-z0-9_]+)+$`. Never changes between versions. |+| `name` | string | required | 1 to 40 characters. |+| `version` | string | required | 1 to 20 characters, shown to people (`"1.2.0"`). |+| `versionCode` | int | `1` | 1 or more. Higher is newer; this is what is compared. |+| `apiVersion` | int | `1` | Between 1 and 1 (the version this Myspoti speaks). |+| `author` | string | required | 1 to 60 characters. |+| `description` | string | `""` | 500 characters at most. |+| `homepage` | string | none | Not checked. |+| `main` | string | `"main.js"` | A `.js` file at the root of the package (no `/`, no `\`). |+| `actions` | object[] | required | What it does, from the catalogue of section 4: `{ "name", "why", "hosts"? }`. At least one, each once. |+| `settings` | object[] | `[]` | Options the user sets on the extension's page. A key at most once. Needs the `settings.page` action. |+| `replaces` | string[] | `[]` | Extension ids this one takes the place of (10 at most): installing it offers to turn them off. |+| `conflictsWith` | string[] | `[]` | Extension ids that must not run with this one (10 at most): the user picks which to keep. Either side declaring it is enough. |+| `icon` | string | none | A `.png` at the root of the package (square, 256 px or less). Without it, `icon.png` is used if the package has one, else a tile with the name's first letter. |+| `category` | string | `other` | Where the store files it, one of a fixed list: `lyrics` (needs `lyrics.provide` or `trackinfo.provide`), `playback` (Playback & audio: a `playback.*`, `audio.source` or `player.buttons` action), `library` (`library.read`, `library.write` or `playlists.write`), `discovery` (`home.sections`, `search.provide` or `spotify.catalog`), `stats` (`playback.events` or `library.read`), `look` (Look & feel: a blocks action or `webview.page`), `social` (`network`, `library.read` or `spotify.catalog`), `tools`, `other`. A category the actions do not fit, or an unknown one, is filed under `other` (`myspoti-ext check` says so); an extension with `download.source` is always under `tools`. `tags` are shown and found by the search, not filtered on. |+| `tags` | string[] | `[]` | 8 at most, each 1 to 24 characters: lower case letters, digits, spaces, `-`. The store's search finds them. |+| `minAppVersion` | string | none | The oldest Myspoti it works on (`"2.0.2"`, `"2.0.2-beta.4"`), compared like semantic versions (a release is newer than its betas). An older Myspoti shows "Requires Myspoti 2.0.2 or newer" and does not install it. |+| `changelog` | string | `""` | What changed in this version, 2000 characters at most: shown on the store page and before an update. |+| `welcome` | object | none | `{ "message": "...", "steps": ["...", "..."] }`, shown once right after the first install (not on updates): what the extension does (600 characters at most) and what is left to do (5 steps at most, 160 characters each). Older apps ignore it. |++An action entry: `{ "name": "...", "why": "...", "hosts": [...] }`.++- `name` is an action key (section 4). Unknown names, or a name twice, refuse the package.+- `why` is **required for every action**, 1 to 80 characters, in your words: it is shown next to+ the action's icon in the install prompt and on the store page. A missing or longer `why` refuses+ the package.+- `hosts` is for `network` only, and `network` needs at least one. Each host is lower case: a+ name (`api.example.com`), `*.example.com` (the domain itself and every subdomain), or `*` (any+ host, a critical action shown as "Use any website"). Names have at least two labels: no port,+ no scheme, no path, no `localhost`.++**Old manifests** (before actions: `provides` + `permissions`) still load and install, mapped to+actions (section 4.1); `myspoti-ext check` says so. `actions` cannot be mixed with them.++A setting: `{ "key", "type", "label", "description", "default", "options" }`.++- `key`: letters, digits, `_`, 1 to 40 characters.+- `type`: `text` (default), `secret` (a password field, never logged), `toggle`, `number`, `choice`, `button`.+- `label`: required. `description`: optional. `default`: any JSON value. `options`: strings, required+ (non-empty) for `choice`.+- `button`: an action, not a value. It has no `default` (the check refuses one) and no value, so+ `myspoti.settings.get` gives `undefined`. It is shown as a button with its `label` and `description`.+ Pressing it sends the `setting` event with `pressed: true` (section 3). Typical uses: pair again+ with a server, clear a cache, sign in again.+- Read it with `myspoti.settings.get(key)`: the user's value, else `default`, else `undefined`.++Settings are shown on the extension's page. Every installed extension that declares settings is also+listed in the app's Settings screen, in the section "Extensions", and each row opens its page.++A downloader with a quality choice and a button (its manifest also lists `settings.page` in `actions`):++```json+"settings": [+ { "key": "quality", "type": "choice", "label": "Quality", "options": ["FLAC", "MP3 320", "AAC 256"], "default": "FLAC" },+ { "key": "pair", "type": "button", "label": "Pair again with the server" }+]+```++`myspoti-ext check` prints every problem in plain words.++## 3. Hooks++A hook is a fixed point where the app asks the extension. Register it with+`myspoti.provide(name, fn)`; `fn` gets one object and returns its answer. Each hook is unlocked by+one action, which must be in the manifest, otherwise `provide` throws (`provide("player") needs the+player.buttons action in the manifest`):++| Hook | Action | Input | Answer |+|---|---|---|---|+| `lyrics` | `lyrics.provide` | track | lyrics (below) |+| `audio-source` | `audio.source` | track | `{ url, … }` |+| `download-source` | `download.source` | track + quality | files |+| `trackinfo` | `trackinfo.provide` | track | blocks, under the song's credits |+| `home` | `home.sections` | `{}` | sections of blocks, at the end of Home |+| `search` | `search.provide` | `{ query }` | blocks, under the search results |+| `menu` | `menu.items` | `{ kind, uri, title, subtitle }` (`kind`: track, album, playlist, artist) | `menu` blocks, at the end of that ⋯ menu |+| `player` | `player.buttons` | track | `button` blocks, under the player's controls |+| `page` | `webview.page` | `{}` | `{ title?, html }` (section 3, "Pages") |+| `message` | `webview.page` | what its page posted | the reply posted back to the page |+| `tap` | any blocks action | `{ action, surface, context }` | nothing (the app asks the blocks again) |+| `status` | none | `{}` | `{ live, detail? }` (below) |++The lyrics, song details, Home, search, menu and player hooks are **additive**: every extension is+asked, the answers merged in the area's order (lyrics: the best, ties to the higher one). Audio and+downloads are **exclusive**: only the active extension of the area is asked (section 4.2). Registering twice replaces. Returning+`null`/`undefined` means "no answer": the app goes on without this extension. A throw or a timeout+is a failure (recorded as the extension's last error, shown on its page). Calls are synchronous:+return the answer, do not return a promise.++The input of every hook, and of the `track` event, is this track:++```+{ id, uri, title, artist, artists, album, durationMs, isrc?, cover? }+```++`id` is Spotify's track id (empty for a local file), `artist` the first of `artists`. `isrc` and+`cover` are absent when unknown (`null` inside a `playback` event).++### `lyrics`++Asked among the app's own lyrics sources. Return one of:++```js+{ provider: 'Name', // optional, 40 characters at most, default: the extension's name+ synced: true, // optional, default: true if any line has a time+ lines: [+ { time: 1500, // ms from the start; missing = 0+ end: 4000, // optional ms+ text: 'line', // 500 characters at most+ words: [ { time: 1500, end: 1900, text: 'word' } ] // optional, `time` required, 200 at most+ } ] }+```++or `{ provider?, plain: 'text\nof the song' }` for unsynced lyrics (one line per row; used only+when `lines` is absent). At most 3000 lines (more is an error). Times are numbers or numeric+strings, in milliseconds. Lyrics with no non-blank text count as no answer. Word-by-word display+needs `synced` and at least one line with `words`.++Action: `lyrics.provide` (normal). Usually you also need `network`.++### `audio-source`++Where the audio of a song is. The song then plays in Myspoti's own player, like a download;+Spotify's player does not play it. Action: `audio.source` (critical, exclusive: one active+extension).++```js+{ url: 'https://cdn.example.com/a.m4a', // http or https, not a local address; required+ headers: { Referer: '...' }, // optional, 20 at most; host, content-length, connection, cookie are dropped+ mimeType: 'audio/mp4', // optional+ durationMs: 215000, // optional+ expiresInMs: 300000, // optional: how long the address stays good+ codec: 'flac', bitDepth: 24, sampleRate: 96000, // optional: the quality, shown as you say it+ source: 'FLAC · 16-bit · 44.1 kHz' } // optional: free text shown when the three above are absent (80 characters)+```++**Lossless DASH.** Instead of `url`, `{ manifest, mimeType?, durationMs? }`: an MPEG-DASH manifest,+base64 (1 MB at most), of FLAC in fragmented MP4 with a `SegmentTemplate` + `SegmentTimeline` and+absolute https addresses (as a `dash-flac` download). Myspoti plays its segments in order as one+file, seekable. Check `myspoti.features.indexOf('audio.manifest') >= 0` first: an older Myspoti has+no `features` and needs a `url`. The song is asked for 10 s after the one before starts, so it starts+at once.++The song comes with its `isrc` when Spotify knows it (asked from its catalogue if the list lacked it),+and `ahead`: `true` when the app asks before the song plays (the next song of the queue, 10 s after+the one before starts), `false` when it is about to play. An answer given ahead is kept and played as+it is when the song comes (it is not asked again), so it must be just as playable; only the urgency+differs: you may take more of the time, and leave out side work that only matters once the song+plays. Check `myspoti.features.indexOf('audio.ahead') >= 0`: an older Myspoti does not send it.++**Quality.** `codec` (lower-case, 16 characters: `"flac"`, `"aac"`, `"mp3"`…), `bitDepth` (8 to 32)+and `sampleRate` (Hz, 8000 to 768000) are what the song's sound-quality line shows while it plays+("FLAC · 24-bit · 96 kHz"), with either answer. Myspoti shows what you announce, without checking or+rounding it up; a value out of range is left out. Without any of the three, your `source` text is+shown instead (80 characters at most; feature `audio.source`), else nothing. Feature:+`audio.quality`.++No `url` (or a null answer) means "no audio for this song". A `file:`/`content:` URL or a+private address is an error. Note the returned `url` is checked for being public, not against your+`network` hosts.++**When it is asked.** Every play of a song goes to the active `audio-source` extension first,+wherever it starts: a list or an album, a search result, an artist, Home, Recents, shuffle, a+Spotify link opened with Myspoti, another extension's block. It is asked for the picked song (or,+for shuffle, a random one of the list); with an answer, that song plays in Myspoti's own player and+the rest of the list follows as the queue, each song asked when its turn comes. Without an answer,+the song plays on Spotify as usual. A song already downloaded plays from its file. Episodes, plays+while offline or with data saver on, and plays while another Spotify Connect device is playing,+never ask.++**In the player.** The song stays the Spotify song: like, lyrics, Canvas, clip and queue work as+usual, and "Play next" / "Add to queue" go into Myspoti's own queue (each song asked when its turn+comes). Your extension's name, then that quality line, is shown under the output device (a tap opens the sound-quality sheet), and your name beside the artist in the mini player. Picking a+Spotify Connect device hands the song, its list and its place over to that device, played by+Spotify.++**An address that expires.** An answer is reused about ten minutes (seeks, replays), or+`expiresInMs` when it is shorter (milliseconds from your answer; ten minutes at most, `0` or less:+never reused). A song that starts after that asks you again. When the server refuses the address+(HTTP 401, 403, 404 or 410), the answer is forgotten and you are asked once more for that song; a+second refusal fails the song cleanly (the player moves on). Feature: `audio.expires` (an older+Myspoti ignores `expiresInMs` and retries on 401 and 403 only).++**Starting at once.** For the next song, Myspoti also reads ahead the first 512 KB of a `url`+(then asks the rest from there with an HTTP `Range`, sending your `headers`), or the first segment+of a `manifest`, once per song, off mobile data, and drops it if the queue changes. A server that+does not answer a range with 206 and a `Content-Range` total simply gets the whole file as before.++A `download-source` extension does not stream by itself: if its files should also play without+being downloaded, provide `audio-source` as well (the two may share their code).++### `download-source`++Where a song can be downloaded from, and which file is the right recording: finding the audio,+fetching what it needs and matching it to the song are the extension's job. Myspoti only keeps+what you hand over: it downloads the file, runs the same checks on any file whatever its origin+(below), encrypts it, and lists it in Downloaded. Myspoti never compares the file with a reference+recording: if you want that check (an official preview, a fingerprint), do it in the extension+before answering, and say `isrcMatched` only for a file you found by the song's ISRC. Without an+extension providing this hook, downloads tell the user to install one. Action: `download.source`+(critical, exclusive: one active extension).++The input is the track of this section plus `quality`, what the user asked for:++```+{ id, uri, title, artist, artists, album, durationMs, isrc?, cover?, quality }+```++`quality` is `"hi-res"` (the best there is), `"cd"` (16-bit lossless) or `"small"` (a small file;+a FLAC you return is then re-encoded to AAC on the phone). Return the files you have, best first:++```js+[ { url: 'https://cdn.example.com/x.flac', // the file; http(s), public address+ format: 'flac', // required: flac, dash-flac, m4a, mp3+ headers: { Referer: '...' }, // optional, as for audio-source+ bitDepth: 24, sampleRate: 96000, // optional, shown and logged+ sizeHint: 91234567, // optional, bytes, for the progress bar+ provider: 'Example', // optional, 40 characters: shown in Downloaded (default: the extension's name)+ isrcMatched: true }, // optional: you found this file by the song's ISRC+ { format: 'dash-flac', manifest: '<base64 of a DASH MPD>' } ]+```++`{ files: [...] }` or a single file object work too. 10 files at most. `null`, `[]` or files with+no `url` mean "nothing for this song". `dash-flac` takes `manifest` instead of `url`: an MPEG-DASH+manifest (base64, 1 MB at most) of FLAC in fragmented MP4 (a `dfLa` box in the init segment),+described by one `SegmentTemplate` with `initialization`, `media` using `$Number$`, and a+`SegmentTimeline`; Myspoti fetches the segments with your `headers` and joins them into one FLAC+file. Anything else a service needs (another manifest layout, decryption, an API call per+segment, a token refresh) is yours to do: hand over a plain file `url`, or a manifest in that form.+Myspoti tries the files in your order and keeps the first that passes the checks: a FLAC must be+a real FLAC file (its header is read), an `m4a` or `mp3` must hold an audio track the phone can+read, and the length must be the song's (Spotify's duration): not shorter by more than 5 s+(previews are refused) nor longer by more than 15 s (another version). `m4a` and `mp3` are kept as+served. A format outside the list, a private address or a missing `format` is an error. The+extensions are asked at once; the first one installed that answers wins. Time limit: 30 s (the+desktop runner: the same).++### `status`++Whether your source answers now, for an extension that depends on a server (an `audio-source` or+`download-source` above all). No action is needed: any extension may provide it.++```js+myspoti.provide('status', function () {+ var r = myspoti.http.get('https://api.example.com/ping', { timeout: 3000 });+ return r.status === 200 ? { live: true } : { live: false, detail: 'The server is down (' + r.status + ')' };+});+```++- **Answer**: `{ live: true | false, detail? }`. `detail` is shown as it is, trimmed to 120+ characters; say what the user can do ("Sign in again in the settings").+- **When**: in the background, when the extension starts, then every 5 minutes while the app is on+ screen or playing, when the network comes back, and right before a song's audio or a download is+ asked from it if the last answer is older than 5 minutes (the song waits at most for the budget).+- **Budget**: 5 s. Keep it to one cheap request. A call already running for that extension (a+ song's audio) is not interrupted: the probe is skipped and asked again later.+- **Effect**: `live: false` makes the extension **inactive**: it is skipped for `audio-source` and `download-source` (the next+ extension in the area's order is asked, or the song plays from Spotify), its row and page say+ "Inactive" with your `detail`. It stays on, is not counted as failing and is not turned off; the+ next answer `live: true` makes it active again at once. Its other hooks keep being asked. A+ throw, an answer that is not `{ live }` or no answer in 5 s proves nothing (a busy phone, a slow+ start): the extension stays in use, and its log says the probe had no answer.+- Without a `status` hook an extension is always live. Check+ `myspoti.features.indexOf('status') >= 0`: an older Myspoti never asks it.++### `track` event++`myspoti.on('track', function (track) { ... })` is called for each new song, with the song's fields+(as hooks receive them) plus `origin` and `providerId`, as in the `playback` event below. It needs+`playback.events` in the manifest (checked when you call `on`) and granted by the user (otherwise+nothing is delivered). Return values are ignored; an error in a listener is swallowed (only logged),+and later listeners of the same event do not run. Time limit 3 s per delivery. There is no way to+remove a listener.++### `playback` event++`myspoti.on('playback', function (e) { ... })`: what happens to the song playing, in Myspoti's own+player (downloads, local files, songs from an `audio-source` extension) and in the Spotify Web+Player. Same rules as `track` (`playback.events`, 3 s per delivery, errors swallowed). Events arrive in+order, one at a time.++```+{ type, // start, progress, pause, resume, seek, skip, end+ track, // the track of this section+ positionMs, durationMs,+ timestamp, // ms since 1970, UTC, when it happened+ source, // "local": Myspoti's own player; "spotify": the Web Player+ contextUri, // the list, album or artist it plays from; "" when unknown (a local file)+ shuffle, // true or false+ reason, // see below; null for progress, pause, resume+ playedMs, // time actually played of this song so far (pauses and seeks excluded)+ origin, // where the audio comes from: "spotify", "download", "audio-source", "local-file"+ providerId } // id of the extension that supplied the file or the stream; null for Spotify+```++`origin`: `spotify` is Spotify's own stream; `download` a song downloaded with a `download-source`+extension (`providerId` is that extension; null for a download made before Myspoti kept it);+`audio-source` a stream an `audio-source` extension gave (`providerId` is the one that answered);+`local-file` a file on the phone that is not a download (`providerId: null`). An extension can use it+to tell its own plays from the others', for example not to scrobble twice.++| `type` | When | `reason` |+|---|---|---|+| `start` | A song starts. | `play` (first song, or after a stop), `next` (the previous one ended), `skip` (the previous one was skipped) |+| `progress` | Every 10 s of play. | — |+| `pause` / `resume` | | — |+| `seek` | The position moved by more than 3 s. | `forward`, `backward` |+| `skip` | The song left before its end. | `forward` (next), `backward` (previous), `other` (a song picked, the queue changed) |+| `end` | The song left at its end (within 5 s), or playback stopped. | `finished`, `stop` (stopped, or switched to the other player) |++Every song that started leaves with exactly one `skip` or `end`. The players are read about once a+second, so positions and times are within a second; three seconds with nothing playing count as a+stop. While no extension listens to `playback`, nothing is read.++### Blocks (`trackinfo`, `home`, `search`, `menu`, `player`)++An extension never draws: it describes **native blocks** as JSON, and the app draws them with its own+fonts, colours, spacing and icons, under the extension's name ("From X"). Answer a list of blocks+(or one block). A block of an unknown type is left out (a newer extension on an older app); a block+that breaks a rule fails the whole answer (a failure, like a throw).++| Type | Fields | Where |+|---|---|---|+| `section` | `title`, `subtitle?`, `blocks` (12 at most, no section inside) | Home, search, song details. On Home, loose blocks are gathered in one untitled section. |+| `card` | `title`, `subtitle?`, `image?`, and `open` or `action` | Home, search, song details |+| `tracks`, `albums`, `playlists`, `artists` | `title?`, `items`: `[{ uri, title, subtitle?, image? }]` (50 at most; `uri` a `spotify:` uri of that kind) | Home, search, song details. A song plays, the rest opens its page. |+| `button` | `label` (40), `icon`, `action` | Home, search, song details, the player |+| `menu` | `label` (40), `icon`, `action` | ⋯ menus only |+| `text` | `text` (1000), `style`: `title`, `body` (default), `caption` | Home, search, song details |+| `image` | `url`, `ratio?` (0.5 to 3, default 1.78), `open` or `action` | Home, search, song details |++- `open`: a `spotify:` uri of a track, album, playlist, artist, show or episode; the app opens it.+ Nothing else can be opened: no web address, no app screen.+- `action`: 1 to 64 letters, digits, `_ . : -`. A tap calls your `tap` hook with+ `{ action, surface, context }` (`context`: the place, e.g. the menu's `{ kind, uri, title }`).+- `icon`: one of `add album artist bolt bookmark chart check download edit extension favorite+ headphones info language link lyrics mic music open play playlist queue radio refresh repeat+ search settings share shuffle star timer translate tune volume`; anything else is `extension`.+- Images: https on a public host. Text is cut to its length. No colour, size, position or layer.+- At most 10 top-level blocks per answer (4 menu entries, 3 player buttons). On screen, quotas per+ extension: 2 menu entries, 1 player button, 2 Home sections, 4 blocks in search and song details;+ in all: 4 menu entries, 3 player buttons, 6 Home sections. What is over goes under an+ **"Extensions ⋯"** entry (menus, player); Home, search and song details drop it. An item, card or+ entry already given by a higher extension (same uri, same label) is dropped.+- `myspoti.ui.refresh('home' | 'search' | 'menu' | 'player' | 'trackinfo')` asks the app to ask again.++```js+myspoti.provide('menu', function (t) {+ if (t.kind !== 'track') return [];+ return [{ type: 'menu', label: 'Find the sample', icon: 'search', action: 'sample' }];+});+myspoti.provide('tap', function (e) {+ if (e.action === 'sample') myspoti.notify('Looking for ' + e.context.title);+});+```++`docs/extensions/samples/blocks-demo` shows one block of each kind.++### Pages (`page`, `message`)++`webview.page` (critical) gives the extension one free page, opened from its detail page ("Open+its page"). `page` answers `{ title?, html }` (512 KB). The app shows it in a locked WebView: no+file or content access, no navigation (links do nothing), no new windows, no storage, no cookies,+no geolocation. Everything it loads is fetched by the app: GET over https from the hosts your+`network` action lists (any host only with `network.any`), never a local or Spotify address, without+cookies; a Content-Security-Policy says the same (no frames, no forms). The only bridge is+`MyspotiPage.postMessage(text)`, to your own extension: your `message` hook receives it (parsed+JSON if it is JSON) and its answer is dispatched to the page as a `message` event+(`window.addEventListener('message', e => e.data)`). `myspoti.page.post(data)` sends to the page+at any time, if it is open.++Sign-in pages are a different thing, see "Sign in on a website" below.++### Sign in on a website (`auth`)++Action: `webview.auth` (critical, "Sign in on a website"). `myspoti.auth.open({ url, callback })` opens+the page at once and returns an id. Later, `myspoti.on('auth', fn)` is called with `{ id, url }` when+the page reached the callback (the full address, query and fragment included), or with `{ id, error }`+(for example `"closed"`). Use the id to tell your sign-ins apart. `auth` needs `webview.auth` in the manifest.++```js+function signIn() {+ return myspoti.auth.open({ url: 'https://login.example.com/start', callback: 'myextension://done' });+}+myspoti.on('auth', function (e) {+ if (e.error) return myspoti.notify('Sign-in: ' + e.error);+ myspoti.storage.set('callback', e.url); // the answer is in the query of e.url+});+```++**Rules.** `url` must be https and not a Spotify address. `callback` is a custom scheme+(`myextension://done`) or an https address on a non-Spotify host. `javascript:`, `data:`, `file:`,+`intent:`, `http:` and the like are refused.++The page opens full screen in a web view with its own profile for each extension. Its cookies and+storage are never the app's or Spotify's, and the extension never gets them. The profile persists+between sign-ins of the same extension. Cookies, POST forms, redirects and iframes work as in a browser.++The callback is caught on links, on redirects, and on a form POSTed to an https callback. The POST+body itself is not returned: use a callback that puts the answer in the query.++**Hidden.** `myspoti.auth.open({ url, callback, hidden: true })` loads the same page out of sight+first: a check that passes by itself (redirects, an invisible captcha) reaches the callback with+nothing on screen. If it has not after 8 seconds, the same page (not reloaded) is shown full screen+with its Close button, for the user to finish it. Use it for a verification that usually needs+nobody; leave it out for a real sign-in form.++**Errors.** `{ id, error }` is `"closed"` (the user closed it, or pressed Back), `"timeout"` (no+callback after 3 minutes) or `"network: …"` (the page could not be loaded). An HTTP error status of+the page itself is not an error: challenge pages often answer 403 or 503. A callback the page opens+with `window.open` is caught too; no second window is ever shown.++Only one sign-in page is open at a time. It needs Android System WebView with multi-profile support;+otherwise `auth.open` throws. It is separate from `webview.page`, whose page stays locked as before+(no cookies, GET only from listed hosts).++### Waiting for the network (`online`)++Action: `network`. `myspoti.work.whenOnline()` asks for one `online` event. `myspoti.on('online', fn)`+is called at once when the phone has a validated network, or as soon as it comes back, also after the+app restarts. Asking again before it fires changes nothing. The work runs with a 30 s time limit.+`online` needs `network` in the manifest.++Typical use: send a queue of things the extension kept in `myspoti.storage` while offline.++```js+myspoti.on('track', function (t) {+ var queue = myspoti.storage.get('queue') || [];+ queue.push(t.uri);+ myspoti.storage.set('queue', queue.slice(-200));+ myspoti.work.whenOnline();+});+myspoti.on('online', function () {+ var queue = myspoti.storage.get('queue') || [];+ queue.forEach(function (uri) { myspoti.http.post('https://plays.example.com/api', { uri: uri }); });+ myspoti.storage.remove('queue');+});+```++(manifest: `playback.events`, `storage`, and `network` for `plays.example.com`.)++### Settings changed (`setting`)++Action: `settings.page`. `myspoti.on('setting', fn)` is called when the user changes one of the+extension's settings (section 2):++- `{ key }` when a setting changed. For a text field, it comes once the user stops typing for a+ moment. Read the new value with `myspoti.settings.get(key)`. The event carries only the key.+- `{ key, pressed: true }` when the user presses a `button` setting.++It needs `settings.page` in the manifest (checked when you call `on`). Time limit 30 s per delivery.++```js+myspoti.on('setting', function (e) {+ if (e.key === 'pair' && e.pressed) pair();+ if (e.key === 'quality') myspoti.log('quality is now ' + myspoti.settings.get('quality'));+});+```++## 4. Actions++The closed catalogue. The icon is the Material Rounded icon the app draws; the user sees the icon,+the label and your `why`. **Critical** actions are shown in the warning colour and explained; the+app frames them at run time (destructive Spotify writes are confirmed one by one, section 6; audio+and downloads are exclusive; pages are locked down, sign-in pages have their own profile). The sandbox enforces exactly what the manifest+declares: a call outside it throws (`"x is not in this extension's manifest (actions)"`). The user+cannot untick single actions: installing grants all of them. An extension installed by an older+Myspoti that let the user untick some stays off, with a "Waits for your OK" card on its page,+until the user accepts them all with the same tick.++| Action | Icon | Label | Level | Mode | Unlocks |+|---|---|---|---|---|---|+| `playback.control` | PlayCircle | Control playback | normal | shared | `myspoti.player.play/pause/next/previous/seek`; `spotify.player` play, pause, resume, seek, next, previous, shuffle, repeat, volume, speed, skipTo; `spotify.devices` transfer, pullHere |+| `playback.queue` | QueueMusic | Edit the queue | normal | shared | `spotify.player` addToQueue, playNext, moveInQueue, removeFromQueue, clearQueue |+| `playback.events` | GraphicEq | Know what you play | normal | shared | `myspoti.player.current()`, `myspoti.on('track' \| 'playback')`, `spotify.player` state, queue, volume, media (`myspoti.spotify.media`) |+| `lyrics.provide` | Lyrics | Provide lyrics | normal | additive, takeover | `lyrics` hook |+| `trackinfo.provide` | Info | Add song details | normal | additive, takeover | `trackinfo` hook |+| `audio.source` | Headphones | Play audio from elsewhere | **critical** | exclusive, takeover | `audio-source` hook |+| `download.source` | Download | Provide downloads | **critical** | exclusive, takeover | `download-source` hook |+| `home.sections` | Dashboard | Add Home sections | normal | additive, takeover | `home` hook |+| `search.provide` | ManageSearch | Add search results | normal | additive, takeover | `search` hook |+| `menu.items` | MoreHoriz | Add menu entries | normal | additive, takeover | `menu` hook |+| `player.buttons` | SmartButton | Add player buttons | normal | additive, takeover | `player` hook |+| `settings.page` | Tune | Its own settings | normal | takeover | manifest `settings`, `myspoti.settings`, `setting` event |+| `notify` | Notifications | Show short messages | normal | shared | `myspoti.notify` |+| `library.read` | LibraryMusic | Read your library | normal | shared | `spotify` library, own playlists, users, recents, devices.list, saved episodes, Blends (reads), recent searches, What's new |+| `library.write` | LibraryAdd | Change your library | **critical** | shared | `spotify` library edits, follows, private session, taste and bans, saved episodes, clear recent searches |+| `playlists.write` | PlaylistAdd | Edit your playlists | **critical** | shared | `spotify.playlists` edits, `spotify.blends` invite/join/rename/leave |+| `spotify.catalog` | Album | Browse Spotify | normal | shared | `spotify` search, catalog, public playlists, home, podcasts, extras |+| `spotify.raw` | Code | Full Spotify access | **critical** | shared | `spotify.raw` (GraphQL, page services, Spotify URLs); `raw.request` writes can be kept with Always allow (section 6) |+| `network` | Public | Use the internet | normal (`"*"`: **critical**, "Use any website") | shared | `myspoti.http` to the listed hosts; `myspoti.work.whenOnline()` and the `online` event |+| `webview.page` | Web | Its own web page | **critical** | takeover | `page` and `message` hooks, `myspoti.page.post` |+| `webview.auth` | Key | Sign in on a website | **critical** | takeover | `myspoti.auth.open`, `auth` event |+| `storage` | Save | Keep its own data | normal | shared | `myspoti.storage` (512 KB) |++### 4.1 Old manifests++A manifest with `provides` and `permissions` (before actions) still loads, installs and runs. Its+keys become actions: `lyrics` → `lyrics.provide`, `audio-source` → `audio.source`,+`download-source` → `download.source`, `network` → `network`, `notify` → `notify`, `player.read` →+`playback.events`, `player.control` → `playback.control`, `spotify.catalog` → `spotify.catalog`,+`spotify.library.read` → `library.read` + `playback.events`, `spotify.write` → `library.write` ++`playlists.write` + `playback.control` + `playback.queue`, `spotify.raw` → `spotify.raw`; `storage`+(and `settings.page` with settings) are added, as every old extension had them. A permission named+after a hook still gives that action's `why` (cut to 80 characters); a critical one still needs 15+characters or more. What an installed extension was granted, and the priorities per hook, are+migrated the same way when the app starts.++### 4.2 Living together++- **Additive** actions (lyrics, song details, Home, search, menus, player): every extension adds;+ answers are merged in the area's order, duplicates dropped, quotas per extension (section 3).+- **Exclusive** actions (`audio.source`, `download.source`): one extension acts per action, the one+ the user made active (else the first in the area). Installing or turning on a second says+ "Replaces *song audio*, currently provided by Y" and the user picks; the other stays installed,+ idle, and can be made active again from the Installed tab.+- `conflictsWith` / `replaces`: "Incompatible with X (installed)" / "Replaces X (installed)" in the+ store, and the install or turn-on prompt asks which to keep; the one not kept is turned off (or the+ new one installs turned off).+- **Playback arbiter.** Every playback command from an extension (`myspoti.player.*`,+ `spotify.player` play/pause/resume/seek/next/previous/shuffle/repeat/skipTo, `spotify.devices`+ transfer) goes through the app. Two extensions' commands of the same kind (play/pause,+ next/previous/skip, seek, shuffle/repeat) within 2 s: the one higher in the Playback area wins+ (a lower one after it is dropped: `myspoti.player.*` returns `false`, `spotify.player.*` returns+ `null`). The same two contradicting each other 3 times within 30 s: the lower one's playback+ commands are suspended and the user is told, with a Turn off button. At most 20 commands a minute+ per extension.+- **Isolation.** Each extension has its own thread, storage, settings, log and sign-in profile; no API names another+ extension. A block's tap, a page's messages and `myspoti.page.post` only ever reach the extension+ that drew them.++### 4.3 Protected surfaces++No extension can hide, delay, cover, restyle or observe these: the owner's donation reminder and+Support sheets, the "New version" card, the install prompt (warnings, third-party notice), the+confirmations of critical actions (destructive Spotify changes, granting a critical action), the+Report button (beta logs) and what it opens, About (version, credits, source, legal).++- No action, hook, block or `open` uri targets them (blocks open only `spotify:` content; a test+ checks the names never meet).+- Extension blocks are drawn inside the app's pages and pages in the app's WebView: these surfaces+ are dialogs and sheets above them, and the Report button is drawn after the app.+- While one is on screen, extension blocks and pages are not asked nor drawn, the page's WebView is+ hidden and paused, taps and page messages are dropped.+- No event about them exists (`myspoti.on` knows `track`, `playback`, `auth`, `online` and `setting` only).++## 5. The `myspoti` object++The script runs in Rhino 1.8.1 (ES6: `let`, `const`, arrow functions, template strings,+destructuring) on its own thread. It sees the standard JavaScript objects, `myspoti` and+`console`, and nothing else: no `require`, `fetch`, timers, DOM, or Java (`java`, `Packages` are+undefined). `myspoti` and `console` cannot be replaced. Everything is synchronous.++**Forbidden:** `eval`, `Function`, `new Function(...)`, `(function(){}).constructor(...)` and the+generator constructor all throw `"code from strings is not allowed in extensions"`. What was+reviewed is what runs.++A script that throws while loading fails to load, with `file:line` in the message.++| Call | Notes |+|---|---|+| `myspoti.apiVersion` | `1`. |+| `myspoti.extension` | `{ id, name, version }` from the manifest. |+| `myspoti.features` | What this Myspoti understands beyond the first API: `audio.manifest`, `audio.expires`, `audio.quality`, `audio.ahead` (section 3, `audio-source`), `http.all`, `status` (section 3). Missing on an older Myspoti: test `myspoti.features && myspoti.features.indexOf(name) >= 0`. |+| `myspoti.provide(hook, fn)` | Section 3. |+| `myspoti.on('track' \| 'playback', fn)` | Section 3. Needs `playback.events`. |+| `myspoti.on('auth', fn)` | Section 3, sign in. Needs `webview.auth`. |+| `myspoti.on('online', fn)` | Section 3, waiting for the network. Needs `network`. |+| `myspoti.auth.open({ url, callback })` | Section 3, sign in. Returns an id at once. Needs `webview.auth`. |+| `myspoti.work.whenOnline()` | Section 3, waiting for the network. Needs `network`. |+| `myspoti.on('setting', fn)` | Section 3, settings changed. Needs `settings.page`. |+| `myspoti.http.get(url, options?)` | `options`: `{ headers, timeout }`. |+| `myspoti.http.post(url, body, options?)` | A non-string `body` is sent as JSON (`Content-Type: application/json` unless you set one). |+| `myspoti.http.request({ url, method, headers, body, timeout })` | Methods: GET POST PUT PATCH DELETE HEAD. |+| `myspoti.http.all([request, ...])` | Up to 4 requests sent together (below). Feature `http.all`. |+| `myspoti.query({ a: 1, b: 'x y' })` | `"a=1&b=x%20y"`. `null` and `undefined` values are left out. |+| `myspoti.storage.get(key)` / `.set(key, value)` / `.remove(key)` | `storage`. Your own store, values are JSON. `get` of a missing key is `undefined`. 512 KB in all (keys plus values), then `set` throws `"storage full (512 KB)"`. |+| `myspoti.settings.get(key)` | Section 2. |+| `myspoti.player.current()` | The track playing in Myspoti (shape of section 3) or `null`. `playback.events`. |+| `myspoti.player.play()`, `.pause()`, `.next()`, `.previous()`, `.seek(ms)` | Myspoti's own player. `playback.control`, through the arbiter (4.2). Return `true` if it was done. |+| `myspoti.ui.refresh(place)` | Section 3, blocks. The place's action. |+| `myspoti.page.post(data)` | Section 3, pages. `webview.page`. |+| `myspoti.spotify.<area>.<method>(...)` | Section 6. |+| `myspoti.notify(text)` | A short message on screen, 200 characters, with your extension's name. `notify`. |+| `myspoti.log(...)`, `console.log/info/warn/error(...)` | Same thing: arguments joined by spaces, objects as JSON, 2000 characters at most. |+| `myspoti.util.base64Encode(s)` / `base64Decode(s)` | UTF-8 text. Decode throws on bad input. |+| `myspoti.util.md5(s)`, `sha1(s)`, `sha256(s)` | Lower-case hex. |+| `myspoti.util.hmacSha256(key, text)` | Lower-case hex. |++`myspoti.player` (needs `playback.events` / `playback.control`) is Myspoti's own player. The+Spotify account's player (what the Web Player is playing) is `myspoti.spotify.player`, with the+playback actions.++### `myspoti.http`++Returns `{ status, headers, body, ok, json() }`. `headers` has lower-case names (several values+joined by `", "`), `body` is text, `ok` is true for 2xx, `json()` parses the body. A 4xx or 5xx+does not throw. A network failure, a refused host or a limit throws `Error("http: ...")`.++Rules, all enforced by the app:++- The host must be in your `network` hosts (a `*.domain` entry matches the domain and its+ subdomains), or you hold `network` with `*` and the user accepted it.+- https only. Plain `http` is allowed only to a host the manifest names exactly (never through+ `*.domain` or `*`).+- Local addresses are refused whatever the manifest says: `localhost`, `*.localhost`, `*.local`,+ IPv4 literals in 0/8, 10/8, 127/8, 169.254/16, 172.16/12, 192.168/16, and every IPv6 literal.+- No cookies, no cache, no account. Redirects are not followed: you receive the 3xx and its+ `location` header. The headers `host`, `content-length`, `connection`, `cookie`,+ `transfer-encoding` are dropped. The default `User-Agent` is `Myspoti-Extension/1 (<id>)`.+- Timeout: `timeout` in ms, default 15000, kept between 1000 and 20000 and cut to what is left of+ the call's time. Response body: 5 MB at most.+- 120 requests per minute (sliding window): over that, `"more than 120 requests in a minute"`.++`myspoti.http.all([{ url, method, headers, body, timeout }, ...])` sends up to 4 requests at the+same time and waits for all of them: the script stays synchronous, the call returns once the last+one has answered. The answers come in the same order, each like `http.request`'s; a request that+fails (refused host, network failure, over the limit) gives `{ error: "http: ..." }` in its place,+without failing the others. More than 4 in one call throws `"http.all: at most 4 requests at once"`+(split the list yourself: nothing is queued). Every request is checked by the rules above and counts+in the 120 per minute; each timeout is cut to what is left of the call's time.++```js+var answers = myspoti.http.all(ids.map(function (id) { return { url: 'https://api.example.com/t/' + id }; }));+answers.forEach(function (r) { if (r.error) myspoti.log(r.error); else use(r.json()); });+```++Check `myspoti.features.indexOf('http.all') >= 0` first; without it, send them one by one.++Example, a listener that remembers what it saw:++```js+myspoti.on('track', function (t) {+ var seen = myspoti.storage.get('seen') || [];+ seen.push(t.uri);+ myspoti.storage.set('seen', seen.slice(-100));+});+```++(manifest: `"actions": [{ "name": "playback.events", "why": "Remembers the last 100 songs played" }, { "name": "storage", "why": "Keeps them" }]`,+and `"provides": []`.)++## 6. Spotify access++`myspoti.spotify.<area>.<method>(...args)` talks to the account signed in to Myspoti. Areas:+`player`, `search`, `catalog`, `library`, `playlists`, `home`, `podcasts`, `users`, `extras`,+`devices`, `recents`, `blends`, `raw`. The object is built from the app's own method table, so a+method that is not in the tables below does not exist (`undefined`). Jam (live shared sessions) is+not exposed.++```js+var r = myspoti.spotify.search.tracks('papaoutai'); // needs spotify.catalog+myspoti.spotify.library.add([r.items[0].uri]); // needs library.write+```++**Arguments** are positional. Optional ones may be left out or `null`. Defaults are in the tables.++- URIs are strings (`"spotify:track:..."`). Lists of strings: 1000 entries at most.+- Numbers: integer arguments accept any number (truncated). Booleans are `true`/`false`. A wrong+ type is an error that names the argument; a number where a string is expected is wrong too.+- Enums are given by name, case-insensitive (`'private'`, `'short_term'`); results name them in+ upper case (`"PRIVATE"`).+- A queue item is `{ uri, uid? }`, or an item from `player.queue()` as is.+- The whole argument list may not exceed 256 KB.++**Results** are JSON: the app's models, field by field (section 6.2). A method that returns+nothing gives `null`. `null` fields are present as `null`. Depth is cut at 12 levels.++**Errors** are thrown as `Error` with a message starting `spotify.<area>.<method>:` :+`no such method`, `unreadable arguments`, `query (argument 1) must be a string`,+`the user refused`, or the failure Spotify or the app reported. The right check comes first+(`"library.write is not in this extension's manifest (actions)"`, `"the user did not grant+library.write"`). No Spotify account in the host (the desktop runner without `--cdp`): the call+throws.++**Limits:** 60 Spotify calls per minute (`"more than 60 Spotify calls in a minute"`), an answer over+2 MB is an error, and the call must finish inside the time limit of the hook (section 7).++**Confirmation.** A call marked "asks" in the tables does not run until the user says yes. They+see: `<extension name> wants to <what>.` followed by the first 300 characters of your arguments. If+they refuse, or do not answer within 120 seconds, the call throws `spotify.<method>: the user+refused`; catch it. The time the user takes does not count against your time limit. A host+without a screen refuses. Confirmed calls are counted in the per-minute limit only once allowed.++Which calls ask: everything that removes or clears something (the tables), plus:++- `raw.gql`: only when the operation is a mutation. An operation the app does not know counts as a+ mutation. A query does not ask.+- `raw.service`: always (a page service call can change the account in ways nothing can describe).+- `raw.request`: when the method is not `GET` or `HEAD`, whatever the address, unless the user chose Always allow (below).+- `raw.get` (a GET on a Spotify address, with the account's token; other hosts are refused) and+ `raw.operations()` never ask.+- `podcasts.setEpisodeSaved(uri, saved)` asks only when `saved` is `false`.++Everything else runs without asking: the user already accepted the action.++**Declared writes.** The `raw.request` writes an extension always needs are listed under its+`spotify.raw` action, as `"METHOD https://host/path"` (8 at most):++```json+{ "name": "spotify.raw", "why": "Sends your listens to Spotify",+ "writes": ["POST https://spclient.wg.spotify.com/gabo-receiver-service/v3/events/"] }+```++They are shown before install under the action and allowed with it, as the grants below: they+never ask while music plays. An update that declares a new one waits for the user's OK.++**Always allow.** For a `raw.request` write (POST, PUT, PATCH, DELETE) the dialog offers **Allow once**,+**Always allow** and **Refuse**. Always allow keeps a grant for this extension only. The grant is the+method, the host and a path pattern. In the path, a segment that names one thing becomes `*`, and+matches exactly one segment. A segment names one thing when it contains a digit and is 8 characters+or longer, or when it is all digits, or when it contains `:` (an id, a number, a uri). The query is+ignored. Example: `PUT https://gue1-spclient.spotify.com/playlist/v2/playlist/*/changes`. Covered+writes then run without asking. Grants are listed on the extension's page under its actions+("Always allowed"), and each one can be revoked. They are kept across updates and removed on+uninstall. Other destructive methods (`raw.gql` mutations, `raw.service`, typed removals) are still+asked every time.++### 6.1 Methods++"Right" is the action needed: `catalog` = `spotify.catalog`; `library.read` = `library.read`,+except `player.state`, `player.queue`, `player.volume`, `player.media` = `playback.events`; `write` = by area:+`player` and `devices` = `playback.control` (addToQueue, playNext, moveInQueue, removeFromQueue,+clearQueue = `playback.queue`), `playlists` and `blends` = `playlists.write`, everything else+(`library`, `users`, `extras`, `podcasts`, `search`) = `library.write`; `raw` = `spotify.raw`. "Asks the user": empty means it runs directly. `?` after a+type means optional/nullable. Returns of "—" mean `null`.++#### `player`++| Call | Returns | Right | Asks the user |+|---|---|---|---|+| `state()` | PlayerState? | library.read | |+| `queue()` | Queue? | library.read | |+| `volume()` | number | library.read | |+| `media(trackUri: string)` | Media? | playback.events | |+| `play(contextUri: string, trackUri: string?, index: number?, positionMs: number?, order: string[]?)` | — | write | |+| `pause()` | — | write | |+| `resume()` | — | write | |+| `seek(positionMs: number)` | — | write | |+| `next()` | — | write | |+| `previous()` | — | write | |+| `setShuffle(on: bool)` | — | write | |+| `setRepeat(mode: Repeat = 'off')` | — | write | |+| `addToQueue(uris: string[])` | — | write | |+| `playNext(uris: string[])` | — | write | |+| `removeFromQueue(items: {uri,uid?}[])` | — | write | yes |+| `clearQueue()` | — | write | yes |+| `skipTo(item: {uri,uid?})` | — | write | |+| `moveInQueue(item: {uri,uid?}, target: {uri,uid?}, after = false)` | — | write | |+| `setVolume(level: number)` | — | write | |+| `setSpeed(speed: number)` | — | write | |++`media(trackUri)` (also `myspoti.spotify.media(trackUri)`) returns the media manifest Spotify sent the+player for that song: `{ uri, manifest }`, exactly as sent. It has the formats and `file_id`s, for+example `manifest.file_ids_mp4[0].file_id`. It returns `null` when the player was not sent that song.+Only songs queued in the player count, and the last 200 are kept. `trackUri` must be a `spotify:track:`+uri. It never asks and changes nothing.++#### `search`++| Call | Returns | Right | Asks the user |+|---|---|---|---|+| `all(query: string, limit = 10)` | SearchResults | catalog | |+| `tracks(query: string, offset = 0, limit = 30)` | Page<Track> | catalog | |+| `artists(query: string, offset = 0, limit = 30)` | Page<Artist> | catalog | |+| `albums(query: string, offset = 0, limit = 30)` | Page<Album> | catalog | |+| `playlists(query: string, offset = 0, limit = 30)` | Page<Playlist> | catalog | |+| `shows(query: string, offset = 0, limit = 30)` | Page<MediaCard> | catalog | |+| `episodes(query: string, offset = 0, limit = 30)` | Page<Episode> | catalog | |+| `audiobooks(query: string, offset = 0, limit = 30)` | Page<MediaCard> | catalog | |+| `users(query: string, offset = 0, limit = 30)` | Page<MediaCard> | catalog | |+| `genres(query: string, offset = 0, limit = 30)` | Page<MediaCard> | catalog | |+| `suggestions(query: string, limit = 10)` | string[] | catalog | |+| `recent()` | MediaCard[] | library.read | |+| `clearRecent()` | — | write | yes |++#### `catalog`++| Call | Returns | Right | Asks the user |+|---|---|---|---|+| `track(uri: string)` | Track | catalog | |+| `album(uri: string)` | Album | catalog | |+| `albumTracks(uri: string, offset = 0, limit = 50)` | Page<Track> | catalog | |+| `artist(uri: string)` | Artist | catalog | |+| `artistTopTracks(uri: string)` | Track[] | catalog | |+| `artistPage(uri: string)` | ArtistPage | catalog | |+| `isrc(trackUri: string)` | string? | catalog | |+| `discography(uri: string, offset = 0, limit = 50)` | Page<Album> | catalog | |+| `relatedArtists(uri: string)` | Artist[] | catalog | |+| `appearsOn(uri: string)` | Album[] | catalog | |+| `similarAlbums(trackUri: string, limit = 20)` | Album[] | catalog | |++#### `library`++| Call | Returns | Right | Asks the user |+|---|---|---|---|+| `contains(uris: string[])` | bool[] | library.read | |+| `items(filter: LibraryFilter = 'all', sort: LibrarySort = 'recents', folderUri: string?, offset = 0, limit = 50)` | Page<LibraryItem> | library.read | |+| `likedTracks(offset = 0, limit = 50)` | Page<SavedTrack> | library.read | |+| `add(uris: string[])` | — | write | |+| `remove(uris: string[])` | — | write | yes |+| `pin(uri: string)` | — | write | |+| `unpin(uri: string)` | — | write | |+| `createFolder(name: string, parentFolderUri: string?)` | string | write | |+| `renameFolder(folderUri: string, name: string)` | — | write | |+| `deleteFolder(folderUri: string)` | — | write | yes |+| `moveToFolder(uri: string, folderUri: string?)` | — | write | |++#### `playlists`++| Call | Returns | Right | Asks the user |+|---|---|---|---|+| `playlist(uri: string)` | Playlist | catalog | |+| `tracks(uri: string, offset = 0, limit = 100)` | Page<Track> | catalog | |+| `sortedTracks(uri: string, sort: PlaylistSort = 'custom', descending = false)` | Track[] | catalog | |+| `recommended(uri: string, limit = 10, skip: string[] = [])` | Track[] | catalog | |+| `mine()` | Playlist[] | library.read | |+| `editable()` | Playlist[] | library.read | |+| `access(uri: string)` | PlaylistAccess | library.read | |+| `published(uri: string)` | bool | library.read | |+| `members(uri: string)` | PlaylistMember[] | library.read | |+| `addedBy(uri: string)` | RowAdder[] | library.read | |+| `create(name: string, folderUri: string?)` | string | write | |+| `rename(uri: string, name: string)` | — | write | |+| `setDescription(uri: string, description: string)` | — | write | |+| `setAccess(uri: string, access: PlaylistAccess = 'public')` | — | write | |+| `setPublished(uri: string, published: bool)` | — | write | |+| `setPublic(uri: string, public: bool)` | — | write | |+| `setCollaborative(uri: string, collaborative: bool)` | — | write | |+| `setCover(uri: string, jpegBase64: string?)` | — | write | |+| `delete(uri: string)` | — | write | yes |+| `follow(uri: string)` | — | write | |+| `unfollow(uri: string)` | — | write | yes |+| `join(uri: string, invitationToken: string)` | PlaylistAccess | write | |+| `collaboratorInvite(uri: string)` | string | write | |+| `addTracks(uri: string, trackUris: string[])` | — | write | |+| `removeTracks(uri: string, uids: string[])` | — | write | yes |+| `moveTracks(uri: string, uids: string[], beforeUid: string?)` | — | write | |++#### `home`++| Call | Returns | Right | Asks the user |+|---|---|---|---|+| `feed(filter: HomeFilter = 'all', itemsPerShelf = 10)` | HomeFeed | catalog | |+| `categories()` | Category[] | catalog | |+| `category(uri: string)` | BrowsePage | catalog | |+| `whatsNew(offset = 0, limit = 50)` | Page<Album> | library.read | |++#### `podcasts`++| Call | Returns | Right | Asks the user |+|---|---|---|---|+| `show(uri: string)` | Show | catalog | |+| `episodes(uri: string, offset = 0, limit = 50)` | Page<Episode> | catalog | |+| `episode(uri: string)` | Episode | catalog | |+| `audioUrl(uri: string)` | EpisodeAudio | catalog | |+| `audiobook(uri: string)` | Audiobook | catalog | |+| `chapters(uri: string, offset = 0, limit = 50)` | Page<Episode> | catalog | |+| `savedEpisodes(offset = 0, limit = 50)` | Page<Episode> | library.read | |+| `setEpisodeSaved(uri: string, saved: bool)` | — | write | only when `saved` is false |++#### `users`++| Call | Returns | Right | Asks the user |+|---|---|---|---|+| `me()` | Account | library.read | |+| `profile(userUri: string)` | UserProfile | library.read | |+| `followers(userUri: string)` | UserRef[] | library.read | |+| `following(userUri: string)` | UserRef[] | library.read | |+| `top(range: TimeRange = 'short_term', limit = 10)` | TopContent | library.read | |+| `isFollowing(userUris: string[])` | bool[] | library.read | |+| `friendActivity()` | FriendActivity[] | library.read | |+| `history()` | HistoryEntry[] | library.read | |+| `follow(userUris: string[])` | — | write | |+| `unfollow(userUris: string[])` | — | write | yes |+| `setPrivateSession(on: bool)` | — | write | |++#### `extras`++| Call | Returns | Right | Asks the user |+|---|---|---|---|+| `lyrics(trackUri: string)` | Lyrics? | catalog | |+| `canvas(trackUri: string)` | Canvas? | catalog | |+| `credits(trackUri: string)` | Credits | catalog | |+| `radio(seedUri: string)` | string? | catalog | |+| `isExcludedFromTaste(trackUris: string[])` | bool[] | library.read | |+| `isArtistBanned(artistUris: string[])` | bool[] | library.read | |+| `setExcludedFromTaste(trackUri: string, excluded: bool)` | — | write | |+| `setArtistBanned(artistUri: string, banned: bool)` | — | write | |++#### `devices`++| Call | Returns | Right | Asks the user |+|---|---|---|---|+| `list()` | Device[] | library.read | |+| `transfer(deviceId: string, play = true)` | — | write | |+| `pullHere()` | — | write | |++#### `recents`++| Call | Returns | Right | Asks the user |+|---|---|---|---|+| `recentEntries(offset = 0, limit = 50)` | Page<RecentEntry> | library.read | |++#### `blends`++| Call | Returns | Right | Asks the user |+|---|---|---|---|+| `invitation(linkOrId: string)` | BlendInvitation | library.read | |+| `group(playlist: string)` | BlendGroup | library.read | |+| `story(playlist: string)` | BlendStory? | library.read | |+| `invite()` | BlendInvite | write | |+| `join(linkOrId: string)` | string | write | |+| `rename(playlist: string, name: string)` | — | write | |+| `leave(playlist: string)` | — | write | yes |++#### `raw`++| Call | Returns | Right | Asks the user |+|---|---|---|---|+| `operations()` | string[] | raw | |+| `gql(operation: string, variables: object)` | JSON | raw | only if the operation is a mutation |+| `service(service: string, method: string)` | JSON | raw | always |+| `get(url: string)` | JSON or null | raw | |+| `request(method: string, url: string, body?: string\|object, headers?: object, options?: { encoding })` | `{ status, headers, body }` | raw | if the method is not GET or HEAD |++`raw.request` sends any method (`GET HEAD POST PUT PATCH DELETE`) to `https://*.spotify.com`+with the account's credentials, as the app's own calls (the Web Player's token, the client token,+its headers, no `X-Requested-With`), or to `https://*.spotifycdn.com` with none. Any other host or+plain http throws. A `body` that is not a string is sent as JSON; `Content-Type` defaults to JSON.+A binary body (a protobuf, say) is given as base64 with `{ encoding: 'base64' }` as the fifth+argument: its bytes are sent, and a body that is not base64 throws before anything leaves+(`myspoti.features` lists `raw.base64` where the app can do this).+Your headers cannot replace the credentials: `authorization`, `client-token`, `cookie`, `origin`,+`referer`, `app-platform`, `spotify-app-version`, `x-requested-with` and the transport's own are+dropped. A 4xx or 5xx is returned, not thrown; `body` is text, header names are lower case.++### 6.2 Result shapes++Models as plain JSON objects (`string?` = string or `null`; `T[]` = array). `Page<T>` is+`{ items: T[], offset, total, nextOffset: number? }`; `nextOffset` is `null` on the last page.+Enums come as their upper-case names.++```+Image { url: string, width: number?, height: number? }+ArtistRef { uri: string, name: string }+AlbumRef { uri: string, name: string, images: Image[] }+Track { uri: string, name: string, durationMs: number, artists: ArtistRef[], album: AlbumRef?, explicit: bool, playable: bool, uid: string?, addedAt: string?, hasVideo: bool }+Album { uri: string, name: string, artists: ArtistRef[], images: Image[], type: string, releaseDate: string?, trackCount: number, label: string? }+Artist { uri: string, name: string, images: Image[], followers: number?, monthlyListeners: number?, verified: bool }+Playlist { uri: string, name: string, description: string?, owner: string?, images: Image[], trackCount: number, editable: bool, ownerUri: string?, ownerImages: Image[], followers: number?, isBlend: bool }+SearchResults { tracks: Page<Track>, artists: Page<Artist>, albums: Page<Album>, playlists: Page<Playlist> }+NowPlaying { kind: ItemKind, uri: string, uid: string?, name: string, artists: ArtistRef[], album: AlbumRef?, imageUrl: string?, durationMs: number, explicit: bool, provider: string?, mediaType: string? }+PlayerRestrictions { canPause: bool, canResume: bool, canSeek: bool, canSkipNext: bool, canSkipPrevious: bool }+PlayerState { item: NowPlaying?, contextUri: string?, contextName: string?, previous: NowPlaying?, next: NowPlaying?, isPaused: bool, isBuffering: bool, positionMs: number, timestampMs: number, speed: number, shuffle: bool, repeat: Repeat, restrictions: PlayerRestrictions }+Queue { current: NowPlaying?, queued: NowPlaying[], nextUp: NowPlaying[] }+Media { uri: string, manifest: object }+TopTrack { track: Track, playcount: number? }+ArtistPage { artist: Artist, biography: string?, headerImages: Image[], topTracks: TopTrack[], popularReleases: Album[], appearsOn: Album[], related: Artist[] }+BlendInvite { id: string, link: string }+BlendMember { username: string, name: string, imageUrl: string? }+RowAdder { rowUid: string, trackUri: string, username: string }+PlaylistMember { username: string, name: string, imageUrl: string?, isOwner: bool }+BlendGroup { title: string?, inviteLabel: string?, link: string?, members: BlendMember[] }+BlendStory { title: string, subtitle: string?, detail: string?, background: string?, titleColor: string?, textColor: string?, image: string? }+BlendInvitation { state: BlendInvitationState, title: string?, subtitle: string?, inviter: BlendMember?, members: BlendMember[], playlist: string? }+MediaCard { uri: string, kind: MediaKind, title: string, subtitle: string?, images: Image[] }+RecentItem { uri: string, kind: MediaKind, title: string, subtitle: string?, images: Image[], durationMs: number, explicit: bool, playedAtMs: number?, typeLabel: string? }+Shelf { uri: string?, title: string?, items: MediaCard[], total: number }+HomeFeed { greeting: string, filters: HomeFilter[], shelves: Shelf[] }+Category { uri: string, title: string, images: Image[], color: string? }+BrowsePage { uri: string, title: string, shelves: Shelf[] }+LibraryItem { uri: string, kind: MediaKind, name: string, subtitle: string?, images: Image[], pinned: bool, addedAt: string?, count: number? }+SavedTrack { track: Track, addedAt: string? }+Account { uri: string, username: string, name: string, images: Image[], premium: bool, country: string? }+UserProfile { uri: string, name: string, images: Image[], followers: number?, following: number?, publicPlaylists: Playlist[] }+TopContent { artists: Artist[], tracks: Track[] }+FriendActivity { user: UserRef, track: Track?, contextUri: string?, timestampMs: number }+UserRef { uri: string, name: string, imageUrl: string? }+Show { uri: string, name: string, publisher: string, description: string?, images: Image[], saved: bool, rating: number?, topics: string[] }+Episode { uri: string, name: string, description: string?, durationMs: number, releaseDate: string?, images: Image[], show: AlbumRef?, playedPositionMs: number, played: bool, explicit: bool, playable: bool, previewUrl: string? }+EpisodeAudio { url: string?, passthrough: string, format: string }+Audiobook { uri: string, name: string, authors: string[], narrators: string[], description: string?, images: Image[], chapterCount: number }+LyricsLine { startMs: number, endMs: number?, text: string, words: LyricsWord[]? }+LyricsWord { startMs: number, text: string }+Lyrics { lines: LyricsLine[], synced: bool, language: string?, provider: string?, background: number?, text: number?, highlight: number? }+Canvas { uri: string, videoUrl: string, type: string }+Credits { roles: CreditRole[] }+CreditRole { role: string, artists: ArtistRef[] }+Device { id: string, name: string, type: string, active: bool, volume: number?, local: bool }+HistoryEntry { uri: string, kind: MediaKind, name: string, images: Image[], playedAtMs: number? }+RecentEntry { item: RecentItem, childrenGroup: string?, group: string?, groupCount: number?, saved: bool, music: bool }+```++Enums: `Repeat` OFF CONTEXT TRACK. `ItemKind` TRACK EPISODE AD. `MediaKind` TRACK ALBUM ARTIST+PLAYLIST SHOW EPISODE AUDIOBOOK CHAPTER USER GENRE COLLECTION FOLDER UNKNOWN. `PlaylistAccess`+PUBLIC PRIVATE COLLABORATIVE. `PlaylistSort` CUSTOM TITLE ARTIST ALBUM ADDED_AT DURATION.+`HomeFilter` ALL MUSIC PODCASTS AUDIOBOOKS. `LibraryFilter` ALL PLAYLISTS ARTISTS ALBUMS PODCASTS+AUDIOBOOKS. `LibrarySort` RECENTS RECENTLY_ADDED ALPHABETICAL CREATOR CUSTOM. `TimeRange` SHORT_TERM+MEDIUM_TERM LONG_TERM. `BlendInvitationState` WAITING JOINABLE FULL JOINED DELETED UNKNOWN.++Notes: `extras.lyrics` returns Spotify's own `Lyrics` shape (`startMs`), not the hook's shape+(`time`). `PlayerState.positionMs` is the position at `timestampMs` (epoch ms); add+`(now - timestampMs) * speed` for a live value while not paused. `raw.*` return Spotify's JSON as it+is. `playlists.setCover` takes a JPEG as base64.++## 7. Limits++| What | Limit |+|---|---|+| Loading the script (its top level; compiling it is not counted) | 3 s |+| A hook call | Set by the app per call (the app and the desktop runner: 8 s for `lyrics`, 15 s for `audio-source`, 30 s for `download-source`) |+| A `track` or `playback` event | 3 s |+| A `setting` event | 30 s |+| Script work | Checked every 5000 instructions against the call's time; a loop cannot hold the thread. A call that runs over is abandoned, and it cannot be caught by `try/catch`. The next call waits behind it on the extension's own thread, never on the app's. |+| Recursion | 800 interpreter frames |+| Time spent waiting for the user to confirm | Not counted |+| `myspoti.http` | 120 requests/min, 5 MB per response, 20 s per request, https only; `http.all`: 4 at once |+| `myspoti.spotify` | 60 calls/min, 256 KB of arguments, 1000 items per list, 2 MB per answer |+| Storage | 512 KB (keys and values together) |+| Sign-in page | One at a time |+| `myspoti.work.whenOnline()` | 30 s |+| Lyrics | 3000 lines, 500 characters per line and per word, 200 words per line |+| Audio and download headers | 20 |+| Download files | 10 per answer, a `dash-flac` manifest 1 MB |+| `notify` / `log` | 200 / 2000 characters |+| Package | 2 MB zip, 30 files, 1 MB script, 256 KB icon |++## 8. Testing on a computer++`myspoti-ext` runs an extension the way the app would, without a phone. From `base/`:++```+./gradlew :extensions-cli:installDist+extensions-cli/build/install/myspoti-ext/bin/myspoti-ext <command> ...+```++(`./gradlew :extensions-cli:run --args="..."` works too, but may not pass your terminal's input+to the confirmation prompt below. Give absolute paths.)++| Command | Does |+|---|---|+| `check <folder>` | Prints the manifest's problems (`✗ ...`, e.g. a missing or too long `why`), says when it is an old manifest, loads the script, prints each action as the user sees it (icon name, label, level, why), then asks each blocks hook it provides once with a sample and checks the blocks (and the page). Exit 1 on a problem. |+| `run <folder\|zip> lyrics --title T --artist A [options]` | Calls the hook and prints what it answered, parsed the way the app parses it (lines, `synced`, `word by word`, or the audio URL and headers). |+| `run <folder\|zip> audio-source ...` | Same for the audio hook. |+| `run <folder\|zip> download-source ... [--quality hi-res\|cd\|small]` | Same for the download hook: prints the files, best first, as the app reads them (default quality `cd`). |+| `run <folder\|zip> audio-source ... [--ahead true]` | Asks for a song's audio (with `ahead: true` when given) and prints the answer as the app reads it: address or manifest, `expiresInMs`, quality. |+| `run <folder\|zip> home\|search\|menu\|player\|trackinfo ...` | Calls a blocks hook (`--query Q` for search, `--kind track\|album\|playlist\|artist` for menu) and prints the blocks as the app reads them. |+| `run <folder\|zip> page\|message\|tap ...` | The page hook (prints title and HTML), a page message (`--data JSON`), a tap (`--action ID`). |+| `run <folder\|zip> status --title T` | Asks `status` as the app does (5 s) and prints live, or inactive and why (`check` prints it too). |+| `run <folder\|zip> track ...` | Delivers the `track` event. |+| `run <folder\|zip> playback ... [--played MS] [--leave skip\|end\|stop]` | Delivers a play of the song as `playback` events, at once, with the times they would have had: `start`, a `progress` every 10 s up to `--played` (default 40000), then `skip` (forward), `end` (finished) or `end` (stop). Also `--context URI`, `--shuffle true`, `--source local\|spotify`, `--origin spotify\|download\|audio-source\|local-file` and `--provider ID` (also for `track`). |+| `pack <folder> [out-folder]` | Checks, builds `<id>-<version>.zip`, prints its sha256 and its index entry. |+| `index <folder-of-zips> <name>` | Writes `index.json` for a repository (newest version of each extension; keeps the existing `blocked` list). |++`run` options: `--title T` (required), `--artist "A, B"` (comma-separated; the first one is+`artist`), `--album B`, `--duration MS`, `--id SPOTIFY_ID` (also sets `uri`), `--isrc ISRC`,+`--set key=value` (a setting; repeat; `true`, `false` and numbers are passed as such, anything else+as text; unset ones use the manifest `default`).++What the runner does: every right the manifest asks is granted. Storage is in memory for the run.+`log`, `console`, `notify` and failures go to stderr as `[id] message`. `player` controls print+`player: <action>` and answer `true`. `myspoti.player.current()` returns the `--title` track.+`http` is real (same host rules as the app).++**Spotify.** Without `--cdp`, every `myspoti.spotify` call throws, so you can test lyrics and audio+code but not Spotify code. With `--cdp PORT` (or `--cdp http://host:PORT`) the calls run against+the account signed in to the Web Player of a Chrome you started yourself:++```+google-chrome --user-data-dir=$HOME/.myspoti-chrome --remote-debugging-port=9222 # sign in to open.spotify.com once+myspoti-ext run ./my-ext lyrics --title "Papaoutai" --artist Stromae --cdp 9222+```++The runner reloads that Web Player page, waits (60 s at most) for it, and stops if nobody is signed+in. These are real calls on a real account. A call that asks for confirmation (section 6) prints+the question on stderr and reads one line from stdin:++```+[io.github.you.x] My Ext wants to remove from the library.+["spotify:track:1"]+Allow it? [y/N]+```++`y` or `yes` allows; anything else, or end of input, refuses (so `echo y | myspoti-ext ...`+allows every question, a script run with no input refuses them all).++**Limits of `check`.** It never calls a hook or an event and has no account, no current track and+no network of its own: it only reads the manifest and runs the script's top level once with all+rights granted. A bug inside `provide('lyrics', ...)`, a wrong response shape, a missing host,+or a `myspoti.spotify` call fail only under `run`. A top-level call to `myspoti.spotify` fails in+`check`. `run ... track` prints `delivered` even if the listener threw: read the `failed: ...` line+on stderr.++## 9. GitHub: install, updates, store, publishing++### 9.1 What the app does with a repository++**Install.** From the store (a discovered repository, or an index entry with `repo`) or by pasting+`https://github.com/you/name` in "Install from an address", the app reads the newest release+(GitHub's `releases/latest` redirect, not its API): its attached `extension.zip` when there is one,+else the release tag's archive; without a release, the default branch's archive. An archive is cut+down to a package: the files at the repository's root that a package holds (`manifest.json`, the+`main` script, the icon, `LICENSE`, `README.md`); nothing else of the repository is kept. Everything+comes from `github.com`, `codeload.github.com` and `raw.githubusercontent.com`, which have no rate+limit for this. The complete package is kept on the phone: the extension runs offline and keeps+running if the repository is deleted (its page then says "Source gone"). The app records the+repository, the tag or branch, the commit (GitHub writes it in the archive), the package's sha256,+and a snapshot of what the user accepted: actions with their `why`, network hosts, exclusive roles,+`replaces` and `conflictsWith`, author, repository and id.++**Updates.** Once a day per extension (and on "Check for updates" on its page), the app reads the+newest `manifest.json`; a higher `versionCode` is downloaded to a staging folder and compared with+the accepted snapshot (never with the version running, so dropping an action in one version and+adding it back in the next is still seen). It is applied by itself only when it asks nothing new.+Anything of the following holds it back, the old version running meanwhile, with an **"Update+needs your OK"** card listing only what changes, each with its icon and reason, the same single+box as the install prompt, and **Accept** (enabled once the box is ticked) / **Keep current**:++- a new action (critical or not, `webview.page` included), or a new network host (`*` is critical);+- an exclusive role it did not have;+- any change to a `why`, even a small one (the user judges the meaning, not the app);+- another author, repository or id;+- a new `replaces` or `conflictsWith` entry.++"Keep current" is remembered for that version; a newer one is weighed again. The previous version+stays on the phone: **Revert to X** on the extension's page brings it back in one tap (and the+version left is not reapplied by itself).++**Kill switch.** Once a day the app reads `blocked.json` from `kota-zo/myspoti-extensions` (a+missing file is an empty list): `{ "blocked": [{ "id": "…", "sha256": ["…"], "reason": "…" }],+"flagged": [{ "id": "…", "reason": "…" }] }`. A blocked id (every package, or the hashes listed) is+turned off with a notice and cannot be turned on, installed or reverted to; a flagged one (reported+and confirmed) is hidden from the store.++### 9.2 In the store++The store searches GitHub once per visit (cached 6 hours) for public repositories with the topic+`myspoti-extension`, up to 100, and reads each one's `manifest.json` on the default branch (a+missing or refused manifest leaves the repository out). They are listed under **On GitHub**, by+score, then the most recently updated.++**Ratings** are the 👍 and 👎 on one issue in your repository: open an issue titled `Ratings`,+labelled `myspoti-ratings`, from the repository owner's account (an issue opened by anyone else+does not count). The score is a Bayesian average (5 votes at 70 % are added to yours, shown as 1 to+5 stars), so a few votes do not outrank many. Reading them needs no account; voting from the app+signs in with GitHub (device code, no password in the app) once that is enabled. Downloads are the+`download_count` of the release's `extension.zip`, shown on the store page.++Hidden behind **Show all**: blocked or flagged extensions, a score under 0.4 with 10 votes or more,+and repositories not updated for 18 months. Every store page has **Report**: it opens a prefilled+report form (`report-extension.yml`) on `kota-zo/myspoti-extensions` in the browser (the extension's id, version, repository and+sha256; nothing about the user).++### 9.3 Publish in 5 minutes++Nobody approves an extension: you publish it in your own GitHub repository, and the store finds it+by its topic. Myspoti does not host, review or endorse third-party extensions; read the+[policy](https://github.com/kota-zo/myspoti-extensions/blob/main/POLICY.md) (no DRM circumvention,+piracy, credential theft, fake plays, malware) before you publish.++1. **Start from the template**, `github.com/kota-zo/myspoti-extension-template` (to be published):+ "Use this template" creates a public repository with this layout, everything at the root:++ ```+ manifest.json id, name, version, versionCode, author, actions (each with its why), category, tags+ main.js the script+ icon.png optional, square, 256 px or less+ README.md optional, shown on GitHub and kept in the package+ LICENSE optional, kept in the package+ scripts/pack.py builds extension.zip (the template's workflow runs it)+ .github/workflows/release.yml on a vX.Y.Z tag: builds extension.zip and attaches it to a release+ ```++ Other files and folders (screenshots, sources, workflows) can live there too: the app keeps only+ the package files above.+2. Rename the `id` (it never changes afterwards), edit `manifest.json` and `main.js`, and check it:+ `myspoti-ext check .` (section 8) must print no problem.+3. Add the topic **`myspoti-extension`** to the repository (About, Topics). The store finds it+ within 6 hours.+4. Release: raise `version` and `versionCode`, tag (`git tag v1.0.0 && git push origin v1.0.0`).+ The template's workflow checks that the tag matches `version`, builds the deterministic+ `extension.zip` and attaches it to a GitHub release (by hand: `myspoti-ext pack .`'s zip renamed+ **`extension.zip`**; without it, the tag's archive is used). Every phone gets it within a day, by+ itself if it asks nothing new.+5. Optional: open the `Ratings` issue with the `myspoti-ratings` label, from your own account+ (`gh label create myspoti-ratings && gh issue create --title Ratings --label myspoti-ratings`).++Changing an action, a host or a `why` in an update is fine: users are asked once, with your new+words. Keep `id` and the repository: a changed one is shown as a different source.++**Reports and takedowns.** The Report button on a store page opens the report form of+`kota-zo/myspoti-extensions` (prefilled with the id, version, source and sha256); reports, legal+notices and counter-notices can also go to [email protected]. On a valid report the owner adds+the extension to `blocked.json` (turned off on every phone, with the reason) or `flagged` (hidden+from the store); see `POLICY.md` and `REPORTING.md` in that repository. The same repository can also+list "verified" extensions in its `index.json` (optional, the owner's choice; the app shows it in the+store only when it lists at least one).diff --git a/docs/extensions/samples/blocks-demo/main.js b/docs/extensions/samples/blocks-demo/main.jsnew file mode 100644index 00000000..0f08bcb0--- /dev/null+++ b/docs/extensions/samples/blocks-demo/main.js@@ -0,0 +1,58 @@+// A sample of every block (docs/extensions/API.md §6). Counts the plays you tap, nothing more.+function counts() { return myspoti.storage.get('counts') || {}; }++function count(uri, title) {+ var c = counts();+ var e = c[uri] || { title: title, n: 0 };+ e.n += 1;+ c[uri] = e;+ myspoti.storage.set('counts', c);+ myspoti.notify('Counted: ' + title + ' (' + e.n + ')');+ myspoti.ui.refresh('home');+ myspoti.page.post(c);+}++myspoti.provide('home', function () {+ var c = counts();+ var uris = Object.keys(c).filter(function (u) { return u.indexOf('spotify:track:') === 0; }).slice(0, 10);+ if (uris.length === 0) return [{ type: 'section', title: 'Counted here', blocks: [{ type: 'text', text: 'Tap "Count a play" in a song menu.', style: 'caption' }] }];+ return [{ type: 'section', title: 'Counted here', blocks: [+ { type: 'tracks', items: uris.map(function (u) { return { uri: u, title: c[u].title, subtitle: c[u].n + ' plays' }; }) },+ { type: 'button', label: 'Reset', icon: 'refresh', action: 'reset' }+ ] }];+});++myspoti.provide('search', function (q) {+ return [{ type: 'text', text: 'Blocks demo: nothing to find for "' + q.query + '".', style: 'caption' }];+});++myspoti.provide('menu', function (target) {+ if (target.kind !== 'track') return [];+ return [{ type: 'menu', label: 'Count a play', icon: 'add', action: 'count' }];+});++myspoti.provide('player', function (track) {+ return [{ type: 'button', label: 'Count', icon: 'check', action: 'count' }];+});++myspoti.provide('trackinfo', function (track) {+ var e = counts()[track.uri];+ return [{ type: 'text', text: e ? 'Counted ' + e.n + ' times with the blocks demo.' : 'Not counted yet.' }];+});++myspoti.provide('tap', function (e) {+ if (e.action === 'reset') { myspoti.storage.set('counts', {}); myspoti.ui.refresh('home'); return; }+ if (e.action === 'count' && e.context && e.context.uri) count(e.context.uri, e.context.title || 'this song');+});++myspoti.provide('page', function () {+ return { title: 'Counted plays', html:+ '<body style="font-family:sans-serif;background:#121212;color:#eee"><h3>Counted plays</h3><ul id="l"></ul>' ++ '<button onclick="MyspotiPage.postMessage(JSON.stringify({ask:\'list\'}))">Refresh</button>' ++ '<script>function show(c){var l=document.getElementById("l");l.innerHTML="";Object.keys(c).forEach(function(u){var li=document.createElement("li");li.textContent=c[u].title+": "+c[u].n;l.appendChild(li);});}' ++ 'window.addEventListener("message",function(e){show(e.data);});MyspotiPage.postMessage(JSON.stringify({ask:"list"}));</script></body>' };+});++myspoti.provide('message', function (data) {+ return counts();+});diff --git a/docs/extensions/samples/blocks-demo/manifest.json b/docs/extensions/samples/blocks-demo/manifest.jsonnew file mode 100644index 00000000..be455e06--- /dev/null+++ b/docs/extensions/samples/blocks-demo/manifest.json@@ -0,0 +1,19 @@+{+ "id": "app.myspoti.samples.blocks",+ "name": "Blocks demo (sample)",+ "version": "1.0.0",+ "versionCode": 1,+ "author": "Myspoti",+ "description": "A sample that adds one block of each kind: a Home section, a search result, a menu entry, a player button, a line under the credits and a small page.",+ "category": "player",+ "actions": [+ { "name": "home.sections", "why": "Shows a 'Played here' section at the end of Home" },+ { "name": "search.provide", "why": "Adds a hint under the search results" },+ { "name": "menu.items", "why": "Adds 'Count a play' to song menus" },+ { "name": "player.buttons", "why": "Adds a counter button under the player" },+ { "name": "trackinfo.provide", "why": "Shows how often you counted the song in its credits" },+ { "name": "webview.page", "why": "A small page listing what you counted" },+ { "name": "storage", "why": "Remembers the counts on this phone" },+ { "name": "notify", "why": "Says when a play was counted" }+ ]+}diff --git a/docs/extensions/samples/lrclib-lyrics/main.js b/docs/extensions/samples/lrclib-lyrics/main.jsnew file mode 100644index 00000000..5d9577eb--- /dev/null+++ b/docs/extensions/samples/lrclib-lyrics/main.js@@ -0,0 +1,38 @@+// A sample lyrics extension (docs/extensions/API.md): LRCLIB's exact match by title, artist,+// album and length, then its search. Returns null when it finds nothing: the app's own sources answer.+myspoti.log('sample lyrics extension loaded');++function parseLrc(lrc) {+ var lines = [];+ lrc.split('\n').forEach(function (row) {+ var m = /^\[(\d+):(\d+)(?:[.:](\d+))?\](.*)$/.exec(row.trim());+ if (!m) return;+ var frac = m[3] ? parseInt((m[3] + '00').slice(0, 3), 10) : 0;+ lines.push({ time: parseInt(m[1], 10) * 60000 + parseInt(m[2], 10) * 1000 + frac, text: m[4].trim() });+ });+ return lines;+}++function answer(o) {+ if (!o) return null;+ if (o.syncedLyrics) return { provider: 'LRCLIB (sample extension)', lines: parseLrc(o.syncedLyrics) };+ if (o.plainLyrics && myspoti.settings.get('plainToo') !== false) return { provider: 'LRCLIB (sample extension)', plain: o.plainLyrics };+ return null;+}++myspoti.provide('lyrics', function (track) {+ var q = { track_name: track.title, artist_name: track.artist, album_name: track.album || null,+ duration: track.durationMs ? Math.round(track.durationMs / 1000) : null };+ var r = myspoti.http.get('https://lrclib.net/api/get?' + myspoti.query(q), { timeout: 5000 });+ if (r.ok) { var a = answer(r.json()); if (a) return a; }+ var s = myspoti.http.get('https://lrclib.net/api/search?' + myspoti.query({ track_name: track.title, artist_name: track.artist }), { timeout: 5000 });+ if (!s.ok) return null;+ var found = s.json();+ for (var i = 0; i < found.length; i++) {+ var d = found[i].duration * 1000;+ if (track.durationMs && Math.abs(d - track.durationMs) > 3000) continue;+ var a2 = answer(found[i]);+ if (a2) return a2;+ }+ return null;+});diff --git a/docs/extensions/samples/lrclib-lyrics/manifest.json b/docs/extensions/samples/lrclib-lyrics/manifest.jsonnew file mode 100644index 00000000..cbfb76cc--- /dev/null+++ b/docs/extensions/samples/lrclib-lyrics/manifest.json@@ -0,0 +1,16 @@+{+ "id": "app.myspoti.samples.lrclib",+ "name": "LRCLIB Lyrics (sample)",+ "version": "1.1.0",+ "versionCode": 2,+ "author": "Myspoti",+ "description": "A sample lyrics extension: line-synced lyrics from lrclib.net, plain text when that is all there is. Not part of Myspoti's built-in sources.",+ "actions": [+ { "name": "lyrics.provide", "why": "Line-synced lyrics from lrclib.net" },+ { "name": "network", "hosts": ["lrclib.net"], "why": "Asks lrclib.net for the song's lyrics" },+ { "name": "settings.page", "why": "Choose whether plain lyrics count too" }+ ],+ "settings": [+ { "key": "plainToo", "type": "toggle", "label": "Plain lyrics too", "description": "Also give lyrics without times.", "default": true }+ ]+}diff --git a/docs/spotiflac-research.md b/docs/spotiflac-research.mddeleted file mode 100644index 351af6ee..00000000--- a/docs/spotiflac-research.md+++ /dev/null@@ -1,76 +0,0 @@-# Intégration SpotiFLAC (repli du downloader YouTube Music)--Recherche du 16/10/2026, sources : spotbye/SpotiFLAC v7.2.2 (desktop, Go+Wails, MIT),-spotiflacapp/SpotiFLAC-Mobile (Flutter+Rust, MIT), Spotui v1.6 (clone GPL-3 vendored `/tmp/spotui-vendor`),-vérifications réseau live des endpoints le jour même.--## Décisions-- SpotiFLAC pour tous les téléchargements, **pas de YouTube** (plus de source YT).-- Sans match FLAC → **indisponible** (comportement actuel conservé).-- Qualité (16/24) = préférence utilisateur : onboarding + paramètre (comme les réglages data saver).-- Motivation : fiabilité (pas de live/remix) + qualité (FLAC 16/24-bit, jamais re-encodé).--## État des sources (vérifié live 2026-10-16)-- `tdl-oss.spotbye.qzz.io/health` → 200 OK (Tidal)-- `qbz-oss.spotbye.qzz.io/health` → 200 OK (Qobuz), `/api/dl` sans session → 404 "Verification session required."-- `amz-oss.spotbye.qzz.io/health` → 200 OK (Amazon), `/api/dl` sans session → 428 (Precondition Required)-- `verify.spotbye.qzz.io/bootstrap` → 400 + challenge_id/challenge_url (Turnstile)-- `amazon.spotbye.qzz.io` (ancien endpoint du code SpotiFlac.kt de Spotui) → **DNS mort**-- **Odesli fermé** au public (401 PUBLIC_API_ACCESS_DEPRECATED) → le mapping Spotify→ids de `SpotiFlac.kt` (Spotui) est obsolète ; Spotui matche désormais via la recherche du backend Tidal (`/search/?s=`, ISRC en priorité).--## Ordre de priorité recommandé (fiabilité d'abord)-1. **Deezer HiFi (optionnel)** si l'utilisateur connecte son propre compte (ARL) — le plus propre- juridiquement (abonnement personnel), FLAC direct, métadonnées/preview officiels pour la vérif.-2. **SpotiFLAC gated** : session signée du service lui-même — bootstrap `verify.spotbye.qzz.io` →- page challenge (Turnstile résolu par l'utilisateur, WebView) → grant → session (session_id +- session_secret) → `/api/dl` signée HMAC `SPOTIFLAC-HMAC-V1` (clé roulante- HMAC(session_secret, "{window:300}:{session_id}"), en-têtes X-Sig-*). Providers : Tidal → Qobuz →- Amazon, qualité HI_RES_LOSSLESS (24) puis LOSSLESS (16). C'est « their most reliable source ».-3. **Tidal direct** sans compte : endpoints du registre rotatif AES-GCM sur gist public- (défaut `tidal.anandserver.cfd`), `GET /track/?id=&quality=LOSSLESS` single-file, clé partagée- `X-API-Key: ak_...`. Qobuz (Odesli-only) est mort en direct ; Qobuz passe par la session.-4. **Amazon** : `/api/resolve/spotify/{id}` self-resolving — souvent dormant, jamais accepter une- `decryption_key` (pas de déchiffrement Amazon embarqué).-5. **Sinon → indisponible** (ni YouTube, ni Soulseek).--## Fiabilité/qualité — défenses à porter-- **Match** : ISRC strict d'abord ; sinon titre+artiste normalisés et durée ±3 s (jamais un live/cover).-- **Anti-preview** : lecture Range `bytes=0-41` → STREAMINFO FLAC → durée réelle ≥ durée attendue −5 s- (les backends servent parfois des previews 30 s). SpotiFLAC desktop rejette aussi toute piste <35 s.-- **Anti-fake audiophile** : le STREAMINFO donne les sample rate/bit depth réels — ne jamais faire- confiance au label « 24-bit » de l'API seule ; Tidal a des faux 24-bit connus (Reddit r/SpotiFLAC).-- **Vérification finale inchangée** de Myspoti : alignement avec la preview officielle Deezer 30 s- par ISRC (AudioAlign, score ≥ 0,5) rejette le même enregistrement qu'aujourd'hui.-- **DASH-BTS multi-segments** (les manifestes `{url:[...]}`) : soit single-file seulement- (choix Spotui v1.6), soit porter le remux `downloadDashFlacToFile` (fLaC + STREAMINFO + payloads- mdat, sans ffmpeg) pour débloquer HI_RES 24-bit — recommandé puisque la qualité est voulue.-- **Erreurs** (protocole officiel) : 429/502/504 → retry ×3 Retry-After clamp(1,300 s) ; 401- SESSION_INVALID → effacer la session + re-bootstrap ; 428 VERIFY_REQUIRED → relancer la WebView ;- 403 → 1 essai avec session rafraîchie. Status API `spotbye.qzz.io/api/status` (fail-open).-- **Concurrence** : 1 seul download FLAC simultané (android natif) ; backoff distribué 120 s si- un provider rate.--## Stockage-- FLAC brut tel que servi (jamais re-encodé), stockage privé app, ~30-40 Mo/titre.-- Réglage qualité : 24-bit hi-res si dispo / 16-bit CD uniquement / même hi-fi en data saver —- onboarding + paramètre (l'utilisateur a proposé).-- Gists/registre rafraîchi toutes les 30 min, retry sur échec 5 min, cache en mémoire.--## Licences & conformité du projet-- SpotiFLAC (desktop + mobile) = **MIT**, Spotui = **GPL-3** ; Myspoti est GPL-3 → port compatible.- Crédits à ajouter au README : Spotui, Spotui/SpotiFLAC (spotbye), SpotiFLAC-Mobile.-- README « Not included » doit être réécrit : le point « The audio comes from YouTube Music »- n'est plus vrai ; décrire honnêtement « audio lossless (FLAC) resolved from lossless catalogs- via the open SpotiFLAC community backends », disclaimer de risque inchangé- (pas de déchiffrement Amazon, pas de redistribution, rien de faux signalé à Spotify).-- La clé partagée `ak_...` est publiée dans les sources SpotiFLAC/Spotui — elle est « community »,- pas volée ; les endpoints suivent le registre rotatif (pas d'endpoint mort codé en dur comme- l'ancien SpotiFlac.kt).--## Si pratique autour-- Spotui a mis cette section derrière « SpotiFLAC (experimental) » + one-shot WebView verification- (constants : APP_VERSION=4.8.5, PLATFORM=android, CALLBACK=spotiflac://session-grant).-- Fichiers Spotui à porter : lossless/LosslessRegistry.kt, lossless/LosslessSource.kt,- lossless/SpotiflacGated.kt, data/preferences/SpotiflacSessionPref.kt,- ui/screens/SpotiflacVerifyScreen.kt (226 l.) + di/Downloads.kt downloadToFile (ordre).-- Tests existants chez Spotui : TidalMatchTest.kt, SoulseekPickTest.kt (matplotlib pick logic).diff --git a/docs/wrapped-playback-analysis.md b/docs/wrapped-playback-analysis.mddeleted file mode 100644index 5e4a1df3..00000000--- a/docs/wrapped-playback-analysis.md+++ /dev/null@@ -1,46 +0,0 @@-# Wrapped — comment une écoute compte (analyse des captures)--Source : capture CDP complète d'une session de lecture (bodies décodés), 16/10/2026.-Détail technique : skill myspoti → `references/wrapped-playback.md`.--## La chaîne exacte (Web Player réel)--| Étape | Requête | Contenu clé |-|---|---|---|-| 1 | `POST /connect-state/v1/player/command/from/{device}` | context.uri, play_origin (feature_identifier, referrer), logging_params |-| 2 | `PUT /track-playback/v1/devices/{device}/state` (×19) | `state_ref{state_machine_id, state_id=playback_id, paused}` + `sub_state{position, duration, media_type AUDIO, bitrate, audio_quality, format}` + `debug_source` |-| 3 | `POST /melody/v1/msg/batch` (base64 JSON) | `jssdk_playback_start`, `jssdk_playback_stats`, `media_playback_event_v2`, **`track_stream_verification`** (ms_played / ms_nominal_played / next_playback_id) |-| — | `GET /track-playback/v1/media/spotify:track:X?manifestFileFormat=file_ids_mp3` | l'audio lui-même (même host que le comptage) |--**Le jalon qui compte** : `debug_source: "played_threshold_reached"` (≈30 s jouées),-lancé sur la machine d'état dont `state_id` = le `playback_id` repris partout-(melody, verification). `track_data_finalized` clôt la piste.--## Ce qui ne compte PAS--`gabo-receiver-service/(public/)v3/events` (32 batches dans la session) = Ubi /-SemanticMetric / KmPageView — analytics produit, pas de comptage d'écoute.--## Comment brancher Myspoti (plan)--- `ControlRelay` relaie déjà `connect-state` + `track-playback` en OkHttp (token,- client-token, device id `hobs_…` gérés par l'engine). Le rappeur peut donc- émettre en natif.-- Hooks disponibles : `SongPlayer.onLocalState(position, playing, duration)` +- offline track uri (`spotify:track:{id}`).-- Intégration : un `PlaybackReporter` qui, pendant une écoute de fichier- téléchargé, émet (1) la commande play au démarrage, (2) les PUT state aux- milestones (`before_track_load`, `started_playing`, `played_threshold_reached`- au vrai passage de seuil, `track_data_finalized` à la fin), (3) les melody- batches (`jssdk_playback_start` au lancement, `track_stream_verification` à la- fin avec les ms joués réels).-- Position licences : écoutes réelles uniquement (aucun événement inventé), mais- pas de GET `/media/...` corrélé — le serveur peut le savoir ; à écrire- honnêtement dans le README (« no altered listening events » → « real listens- only, no fabricated events »).--## Décisions ouvertes (posées le 16/10, sans réponse)--1. Niveau d'honnêteté : écoutes réelles seules / + queue offline / match parfait des shapes.-2. sub_state qualité : reproduire 128k/HIGH/format 10 (comme le Web Player) ou valeurs réelles FLAC.-3. Implémentation maintenant vs après commit beta.3.diff --git a/tools/myspoti-cli b/tools/myspoti-clinew file mode 100755index 00000000..0df892a9--- /dev/null+++ b/tools/myspoti-cli@@ -0,0 +1,99 @@+#!/usr/bin/env python3+"""Drives a debug or beta Myspoti over adb, without screenshots or taps (docs/cli.md).++ tools/myspoti-cli status+ tools/myspoti-cli ext.install path/to/extension.zip # a local zip is pushed first+ tools/myspoti-cli ext.call my.ext lyrics '{"title":"…"}'++Each command is one broadcast to the app's CliReceiver; the app writes its JSON reply to+<external files>/cli/<request>.json, which this reads back (bounded wait). Exit codes:+0 ok, 1 the app answered an error, 2 no reply (app not installed, release build, timeout), 3 adb failed.+"""+import argparse+import base64+import json+import os+import shlex+import subprocess+import shutil+import sys+import time+import uuid++ADB = os.environ.get("ADB") or shutil.which("adb") or "adb"+# The app's own wait for a hook (download-source) is 30 s.+DEFAULT_TIMEOUT = 40.0+++def adb(serial, *args, check=True):+ cmd = [ADB] + (["-s", serial] if serial else []) + list(args)+ r = subprocess.run(cmd, capture_output=True, text=True)+ if check and r.returncode != 0:+ sys.stderr.write(f"adb failed: {' '.join(args[:2])}: {r.stderr.strip() or r.stdout.strip()}\n")+ sys.exit(3)+ return r+++def shell(serial, line, check=True):+ return adb(serial, "shell", line, check=check)+++def main():+ p = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)+ p.add_argument("-p", "--package", default=os.environ.get("MYSPOTI_PACKAGE", "app.myspoti.dev"))+ p.add_argument("-s", "--serial", default=os.environ.get("ANDROID_SERIAL"))+ p.add_argument("-t", "--timeout", type=float, default=DEFAULT_TIMEOUT, help="seconds to wait for the reply")+ p.add_argument("--raw", action="store_true", help="print the reply on one line, as the app wrote it")+ p.add_argument("cmd")+ p.add_argument("args", nargs="*")+ o = p.parse_args()++ pkg, args = o.package, list(o.args)+ files = f"/sdcard/Android/data/{pkg}/files/cli"++ # A zip on this computer goes to a folder the app reads without any permission.+ if o.cmd == "ext.install" and args and os.path.isfile(args[0]):+ remote = f"{files}/in/{os.path.basename(args[0])}"+ shell(o.serial, f"mkdir -p {shlex.quote(files + '/in')}")+ adb(o.serial, "push", args[0], remote)+ args[0] = remote++ req = uuid.uuid4().hex[:16]+ reply_path = f"{files}/{req}.json"+ args64 = base64.b64encode(json.dumps(args).encode()).decode()+ line = " ".join(shlex.quote(x) for x in [+ "am", "broadcast", "-a", f"{pkg}.CLI", "-p", pkg,+ "--es", "cmd", o.cmd, "--es", "args64", args64, "--es", "req", req,+ ])+ shell(o.serial, line)++ deadline = time.monotonic() + o.timeout+ text = None+ while time.monotonic() < deadline:+ r = shell(o.serial, f"cat {shlex.quote(reply_path)} 2>/dev/null", check=False)+ if r.returncode == 0 and r.stdout.strip():+ text = r.stdout.strip()+ break+ time.sleep(0.25)+ if text is None:+ sys.stderr.write(f"no reply from {pkg} after {o.timeout:g} s (installed? a debug or beta build? "+ f"adb logcat -s MyspotiCli)\n")+ sys.exit(2)+ shell(o.serial, f"rm -f {shlex.quote(reply_path)}", check=False)++ try:+ reply = json.loads(text)+ except ValueError:+ sys.stderr.write(f"unreadable reply: {text[:500]}\n")+ sys.exit(2)+ if o.raw:+ print(text)+ elif reply.get("ok"):+ print(json.dumps(reply.get("result"), indent=2, ensure_ascii=False))+ if not reply.get("ok"):+ sys.stderr.write(f"error: {reply.get('error')}\n")+ sys.exit(1)+++if __name__ == "__main__":+ main()