Native Android client for Spotify, built with Jetpack Compose
Kotlin ad-freeadblockandroidjetpack-composekotlinlyricsmusic-playermusic-videomyspotispotifyspotify-adblockerspotify-clientspotify-connectspotui
One APK per architecture in each release, arm64-v8a and armeabi-v7a (no x86, no universal APK): the release job builds twice with -Pabis under the same versionCode and uploads myspoti-<beta|stable>-<version>-<abi>.apk, the in-app update takes the first of the phone's Build.SUPPORTED_ABIS that has an APK of its channel (a 64-bit phone that also runs armeabi-v7a takes arm64-v8a), an older release's APK without an ABI as before, and no link (the release page opens) on a phone none fits; the Discord post links arm64-v8a, and the README gives the Obtainium filters per architecture and how to pick one [skip ci]
kota-zo06eeadf84022
diff --git a/.github/workflows/android.yml b/.github/workflows/android.ymlindex cde79786..b3f6c920 100644--- a/.github/workflows/android.yml+++ b/.github/workflows/android.yml@@ -1,4 +1,4 @@-# Builds and tests every push / pull request; a "v*" tag publishes a signed APK+# Builds and tests every push / pull request; a "v*" tag publishes signed APKs (arm64-v8a, armeabi-v7a)# as a GitHub release (the app's update check reads those releases).name: Android@@ -110,13 +110,18 @@ jobs:MYSPOTI_KEY_PASSWORD: ${{ contains(github.ref_name, '-') && secrets.MYSPOTI_KEY_PASSWORD || secrets.MYSPOTI_STABLE_KEY_PASSWORD }}run: |VERSION="${GITHUB_REF_NAME#v}"- # myspoti-beta-2.2.1-beta.1.apk / myspoti-stable-2.2.1.apk: Obtainium filters on the channel.+ # One APK per ABI, same versionCode (a phone installs only its own; the app's update check+ # picks it, UpdateChecker.apkAsset): myspoti-beta-2.2.1-beta.1-arm64-v8a.apk,+ # myspoti-stable-2.2.1-armeabi-v7a.apk... Obtainium filters on the channel and the ABI.CHANNEL=stable; case "$VERSION" in *-*) CHANNEL=beta ;; esac- ./gradlew assembleRelease \- -PappVersionName="$VERSION" \- -PappVersionCode="$((1000 + GITHUB_RUN_NUMBER))" \- -PupdateRepo="$GITHUB_REPOSITORY"- mv app/build/outputs/apk/release/app-release.apk "app/build/outputs/apk/release/myspoti-$CHANNEL-$VERSION.apk"+ for ABI in arm64-v8a armeabi-v7a; do+ ./gradlew assembleRelease \+ -Pabis="$ABI" \+ -PappVersionName="$VERSION" \+ -PappVersionCode="$((1000 + GITHUB_RUN_NUMBER))" \+ -PupdateRepo="$GITHUB_REPOSITORY"+ mv app/build/outputs/apk/release/app-release.apk "app/build/outputs/apk/release/myspoti-$CHANNEL-$VERSION-$ABI.apk"+ done# This version's section of CHANGELOG.md becomes the release description.- name: Release notesdiff --git a/CHANGELOG.md b/CHANGELOG.mdindex 13dc4c0b..bfdfea9c 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -15,6 +15,7 @@ Each release on GitHub shows its section below. The app shows it too when it off- πΊ **Chromecast** plays Spotify songs too, through Spotify's own receiver.- π **Liked Songs** first in Home's shortcuts; switches in Settings, Display to hide the player's lyrics preview, its source line or its capsule; the keyboard closes when you tap a search result; a tap on an installed extension in the store opens its full page.- π οΈ **Fixes**: no run of skips or the wrong song after an ad, a pause during an ad stays a pause, a tap on the title opens the album for every song, playback on a locked Samsung explained in Settings, and the issues found by a code audit (downloads never removed when the app reads a backup index, safer file writes, stale page answers ignored, masked secrets in the diagnostic, a hardened Cast server and updater).+- π¦ **One APK per phone architecture** (arm64-v8a, armeabi-v7a), lighter to download: the in-app update takes yours, and Obtainium users set the new APK filter from the README.- π **Brazilian Portuguese**, and translations of everything new.## 2.2.0diff --git a/README.md b/README.mdindex bee43ca1..3c36a28b 100644--- a/README.md+++ b/README.md@@ -44,9 +44,11 @@ Under the hood, the official Spotify Web Player plays the music, hidden inside tNew versions are offered inside the app: one tap downloads and installs them.-Obtainium (add `https://github.com/kota-zo/myspoti`; the stable app and the beta app are two apps and each release carries one APK named for its channel):-- **Stable** (`app.myspoti.stable`): leave "Include prereleases" off and set the APK filter to `^myspoti-stable-.*\.apk$`.-- **Beta** (`app.myspoti`): turn "Include prereleases" on and set the APK filter to `^myspoti-beta-.*\.apk$`.+Each release carries one APK per architecture: `arm64-v8a` for almost every phone from the last ten years, `armeabi-v7a` for older or entry-level 32-bit phones (an app such as CPU-Z or Device Info shows which one yours is; when in doubt, take `arm64-v8a`, and if it refuses to install, `armeabi-v7a`). The in-app update picks the right one by itself.++Obtainium (add `https://github.com/kota-zo/myspoti`; the stable app and the beta app are two apps and each release carries their APKs named for the channel and the architecture):+- **Stable** (`app.myspoti.stable`): leave "Include prereleases" off and set the APK filter to `^myspoti-stable-.*-arm64-v8a\.apk$` (or `-armeabi-v7a` on a 32-bit phone).+- **Beta** (`app.myspoti`): turn "Include prereleases" on and set the APK filter to `^myspoti-beta-.*-arm64-v8a\.apk$` (or `-armeabi-v7a` on a 32-bit phone).- Betas are named `<next version>-beta.<n>` (`2.2.1-beta.1`, then `2.2.1-beta.2`...), marked prerelease on GitHub, and always newer than the last stable.## What you getdiff --git a/base/app/src/main/java/com/music/spotui/data/api/UpdateChecker.kt b/base/app/src/main/java/com/music/spotui/data/api/UpdateChecker.ktindex b4c8eb14..9455cd1a 100644--- a/base/app/src/main/java/com/music/spotui/data/api/UpdateChecker.kt+++ b/base/app/src/main/java/com/music/spotui/data/api/UpdateChecker.kt@@ -119,21 +119,31 @@ object UpdateChecker {return Release(version, url, prefs.getString("notes", null).orEmpty(), prefs.getString("apk", null).orEmpty()).takeIf { isNewer(version, BuildConfig.VERSION_NAME) }}+ /** The ABIs a release carries one APK for (`myspoti-<channel>-<version>-<abi>.apk`): no x86, no universal APK. */+ internal val RELEASE_ABIS = listOf("arm64-v8a", "armeabi-v7a")+/**- * The release's APK download link for this app's channel (the CI uploads one `myspoti-<beta|stable>-<version>.apk`;- * older releases `myspoti-<version>.apk`, which is the app's own channel since [fetch] only offers a release of it).- * Only this channel's APK: a release carrying both must not hand a phone the other channel's build- * (a different package, it could not update this one), and a name that matches none gives no link.+ * The release's APK download link for this app's channel and this phone: the CI uploads one+ * `myspoti-<beta|stable>-<version>-<abi>.apk` per ABI of [RELEASE_ABIS], and the first of [abis]+ * (the phone's, most preferred first) that has one wins, so a 64-bit phone that also runs+ * armeabi-v7a takes arm64-v8a. Older releases carry one APK without an ABI,+ * `myspoti-<beta|stable>-<version>.apk` or `myspoti-<version>.apk` (the app's own channel, since [fetch]+ * only offers a release of it), taken as before. Only this channel's APK: a release carrying both+ * must not hand a phone the other channel's build (a different package, it could not update this one),+ * and a name that matches none (or no APK for this phone's ABIs) gives no link.*/- internal fun apkAsset(release: JSONObject, beta: Boolean = isBeta): String {+ internal fun apkAsset(release: JSONObject, beta: Boolean = isBeta, abis: List<String> = deviceAbis): String {val assets = release.optJSONArray("assets") ?: return ""val version = release.optString("tag_name").removePrefix("v")- val want = setOf("myspoti-${if (beta) "beta" else "stable"}-$version.apk", "myspoti-$version.apk")- return (0 until assets.length()).map { assets.getJSONObject(it) }- .firstOrNull { it.optString("name") in want }- ?.optString("browser_download_url").orEmpty()+ val channel = "myspoti-${if (beta) "beta" else "stable"}-$version"+ val byName = (0 until assets.length()).map { assets.getJSONObject(it) }.associateBy { it.optString("name") }+ val want = abis.filter { it in RELEASE_ABIS }.map { "$channel-$it.apk" } + listOf("$channel.apk", "myspoti-$version.apk")+ return want.firstNotNullOfOrNull { byName[it] }?.optString("browser_download_url").orEmpty()}+ /** This phone's ABIs, most preferred first. */+ private val deviceAbis: List<String> get() = android.os.Build.SUPPORTED_ABIS.toList()+fun dismiss(context: Context, release: Release) {context.getSharedPreferences("updates", Context.MODE_PRIVATE).edit().putString("dismissed", release.version).apply()diff --git a/base/app/src/test/java/com/music/spotui/data/api/UpdateCheckerTest.kt b/base/app/src/test/java/com/music/spotui/data/api/UpdateCheckerTest.ktindex bd075b7a..2d2d68fc 100644--- a/base/app/src/test/java/com/music/spotui/data/api/UpdateCheckerTest.kt+++ b/base/app/src/test/java/com/music/spotui/data/api/UpdateCheckerTest.kt@@ -6,6 +6,7 @@ import org.junit.Assert.assertTrueimport org.junit.Testclass UpdateCheckerTest {+ private val arm64 = listOf("arm64-v8a", "armeabi-v7a", "armeabi")@Test fun comparesNumericallyNotAsText() {assertTrue(UpdateChecker.isNewer("1.10.0", "1.9.2"))assertTrue(UpdateChecker.isNewer("0.9.1", "0.9.0"))@@ -40,18 +41,37 @@ class UpdateCheckerTest {val legacy = org.json.JSONObject("""{"tag_name":"v2.0.0-beta.4","assets":[{"name":"checksums.txt","browser_download_url":"https://x/c.txt"},{"name":"myspoti-2.0.0-beta.4.apk","browser_download_url":"https://x/myspoti.apk"}]}""")- assertEquals("https://x/myspoti.apk", UpdateChecker.apkAsset(legacy, beta = true))- assertEquals("https://x/myspoti.apk", UpdateChecker.apkAsset(legacy, beta = false))+ assertEquals("https://x/myspoti.apk", UpdateChecker.apkAsset(legacy, beta = true, abis = arm64))+ assertEquals("https://x/myspoti.apk", UpdateChecker.apkAsset(legacy, beta = false, abis = arm64))val both = org.json.JSONObject("""{"tag_name":"v2.2.1","assets":[{"name":"myspoti-stable-2.2.1.apk","browser_download_url":"https://x/stable.apk"},{"name":"myspoti-beta-2.2.1.apk","browser_download_url":"https://x/beta.apk"}]}""")- assertEquals("https://x/beta.apk", UpdateChecker.apkAsset(both, beta = true))- assertEquals("https://x/stable.apk", UpdateChecker.apkAsset(both, beta = false))+ assertEquals("https://x/beta.apk", UpdateChecker.apkAsset(both, beta = true, abis = arm64))+ assertEquals("https://x/stable.apk", UpdateChecker.apkAsset(both, beta = false, abis = arm64))// Only the other channel's APK, or an unrelated .apk: no link, never the wrong build.val other = org.json.JSONObject("""{"tag_name":"v2.2.1","assets":[{"name":"myspoti-stable-2.2.1.apk","browser_download_url":"https://x/stable.apk"},{"name":"something-else.apk","browser_download_url":"https://x/else.apk"}]}""")- assertEquals("", UpdateChecker.apkAsset(other, beta = true))- assertEquals("", UpdateChecker.apkAsset(org.json.JSONObject("{}"), beta = true))+ assertEquals("", UpdateChecker.apkAsset(other, beta = true, abis = arm64))+ assertEquals("", UpdateChecker.apkAsset(org.json.JSONObject("{}"), beta = true, abis = arm64))+ }+ @Test fun findsTheApkOfThisPhonesAbi() {+ val split = org.json.JSONObject("""{"tag_name":"v2.3.0-beta.1","assets":[+ {"name":"myspoti-beta-2.3.0-beta.1-armeabi-v7a.apk","browser_download_url":"https://x/beta-v7a.apk"},+ {"name":"myspoti-beta-2.3.0-beta.1-arm64-v8a.apk","browser_download_url":"https://x/beta-arm64.apk"},+ {"name":"myspoti-stable-2.3.0-beta.1-arm64-v8a.apk","browser_download_url":"https://x/stable-arm64.apk"}]}""")+ // A 64-bit phone that also runs armeabi-v7a takes arm64-v8a, whatever the assets' order.+ assertEquals("https://x/beta-arm64.apk", UpdateChecker.apkAsset(split, beta = true, abis = arm64))+ assertEquals("https://x/beta-v7a.apk", UpdateChecker.apkAsset(split, beta = true, abis = listOf("armeabi-v7a", "armeabi")))+ assertEquals("https://x/stable-arm64.apk", UpdateChecker.apkAsset(split, beta = false, abis = arm64))+ // The other channel's APK for this ABI only: no link.+ assertEquals("", UpdateChecker.apkAsset(split, beta = false, abis = listOf("armeabi-v7a")))+ // An ABI the releases do not carry (x86 emulator, Chromebook): no link, the release page opens.+ assertEquals("", UpdateChecker.apkAsset(split, beta = true, abis = listOf("x86_64", "x86")))+ assertEquals("", UpdateChecker.apkAsset(split, beta = true, abis = emptyList()))+ // A release from before the ABI split: the channel's APK without a suffix, as before.+ val single = org.json.JSONObject("""{"tag_name":"v2.2.1","assets":[+ {"name":"myspoti-stable-2.2.1.apk","browser_download_url":"https://x/stable.apk"}]}""")+ assertEquals("https://x/stable.apk", UpdateChecker.apkAsset(single, beta = false, abis = listOf("armeabi-v7a")))}}diff --git a/docs/CHANGELOG-full.md b/docs/CHANGELOG-full.mdindex a1fb86e8..8c2b6016 100644--- a/docs/CHANGELOG-full.md+++ b/docs/CHANGELOG-full.md@@ -19,7 +19,7 @@ Every change, release by release. The short version is in [CHANGELOG.md](../CHAN- **Background and Cast**: power section and screen-off probes in the diagnostic, failed foreground starts logged, a Samsung "Never sleeping apps" hint, the idle 3 s loop sleeps when nothing plays; Chromecast plays Spotify songs through Spotify's receiver; Cast discovery can no longer stay stuck.- **Code audit fixes**: no file purge when the downloads index comes from its backup (unlisted files kept in recovered/), a failed restore of an account's downloads is retried instead of stamped, extension packages and caches written safely, encryption migration and account moves under one lock, sign-out cancels pending transports, bridge calls to a gone page fail at once, stale relay replies ignored, the legacy JS bridge requires a per-page token, https-only navigation, tokens and e-mails masked in logs, Cast covers capped at 5 MB and slow headers timed out, updates pick only their own channel's APK and clean up after a failure. Characterization tests for ads, reloads, the queue sync and the mirror.- **Support reminders** every 8 to 12 days, drawn per person.-- **Releases**: betas tagged in strict semver above the last stable (`tools/check_tag.py`), APKs named `myspoti-beta-*` and `myspoti-stable-*`; Obtainium setup in the README. CONTRIBUTING.md added.+- **Releases**: betas tagged in strict semver above the last stable (`tools/check_tag.py`), APKs named `myspoti-beta-*` and `myspoti-stable-*`; Obtainium setup in the README. CONTRIBUTING.md added. Then one APK per ABI, built twice with `-Pabis` under the same versionCode, `myspoti-<beta|stable>-<version>-arm64-v8a.apk` and `-armeabi-v7a.apk` (no x86, no universal APK); the update check takes the first of the phone's `Build.SUPPORTED_ABIS` that has one, an older release's APK without an ABI as before, and no APK for the phone opens the release page; the Discord post links arm64-v8a; Obtainium filters per ABI in the README.- **Translations**: Brazilian Portuguese (`values-pt-rBR`), and every new string in 10 languages.## 2.2.0diff --git a/tools/discord_release.py b/tools/discord_release.pyindex 471e1c85..1216002d 100755--- a/tools/discord_release.py+++ b/tools/discord_release.py@@ -46,7 +46,9 @@ def payload(release):version = tag.removeprefix("v")url = release["html_url"]notes = clean_notes(release.get("body")) or "See the release page for details."- apk = next((a for a in release.get("assets", []) if a["name"].endswith(".apk")), None)+ # One APK per ABI: the link goes to arm64-v8a (most phones); older releases have a single one.+ apks = [a for a in release.get("assets", []) if a["name"].endswith(".apk")]+ apk = next((a for a in apks if a["name"].endswith("-arm64-v8a.apk")), apks[0] if apks else None)fields = []if apk:size = apk["size"] / 1_048_576