Native Android client for Spotify, built with Jetpack Compose
Kotlin ad-freeadblockandroidjetpack-composekotlinlyricsmusic-playermusic-videomyspotispotifyspotify-adblockerspotify-clientspotify-connectspotui
Beta and release install side by side
kota-zob38305d76efa
diff --git a/.github/workflows/android.yml b/.github/workflows/android.ymlindex 57b4c0fb..19e220b8 100644--- a/.github/workflows/android.yml+++ b/.github/workflows/android.yml@@ -68,22 +68,26 @@ jobs:- uses: gradle/actions/setup-gradle@v6- # Secrets: MYSPOTI_KEYSTORE_BASE64 (base64 of the .jks), MYSPOTI_KEYSTORE_PASSWORD,- # MYSPOTI_KEY_ALIAS, MYSPOTI_KEY_PASSWORD. Keep the same key for every release,- # or installed apps cannot update.+ # Two keys, one per channel (they install side by side as two apps):+ # betas ("v2.0.0-beta.3") use MYSPOTI_KEYSTORE_BASE64, MYSPOTI_KEYSTORE_PASSWORD,+ # MYSPOTI_KEY_ALIAS, MYSPOTI_KEY_PASSWORD; releases use the same names with+ # MYSPOTI_STABLE_ in front. Keep each key for good, or installed apps cannot update.- name: Signing keyenv:- KEYSTORE_BASE64: ${{ secrets.MYSPOTI_KEYSTORE_BASE64 }}+ BETA: ${{ contains(github.ref_name, '-') }}+ BETA_KEYSTORE: ${{ secrets.MYSPOTI_KEYSTORE_BASE64 }}+ STABLE_KEYSTORE: ${{ secrets.MYSPOTI_STABLE_KEYSTORE_BASE64 }}run: |- test -n "$KEYSTORE_BASE64" || { echo "::error::MYSPOTI_KEYSTORE_BASE64 secret missing"; exit 1; }+ if [ "$BETA" = "true" ]; then KEYSTORE_BASE64="$BETA_KEYSTORE"; NAME=MYSPOTI_KEYSTORE_BASE64; else KEYSTORE_BASE64="$STABLE_KEYSTORE"; NAME=MYSPOTI_STABLE_KEYSTORE_BASE64; fi+ test -n "$KEYSTORE_BASE64" || { echo "::error::$NAME secret missing"; exit 1; }echo "$KEYSTORE_BASE64" | base64 -d > "$RUNNER_TEMP/release.jks"- name: Release APKenv:MYSPOTI_KEYSTORE: ${{ runner.temp }}/release.jks- MYSPOTI_KEYSTORE_PASSWORD: ${{ secrets.MYSPOTI_KEYSTORE_PASSWORD }}- MYSPOTI_KEY_ALIAS: ${{ secrets.MYSPOTI_KEY_ALIAS }}- MYSPOTI_KEY_PASSWORD: ${{ secrets.MYSPOTI_KEY_PASSWORD }}+ MYSPOTI_KEYSTORE_PASSWORD: ${{ contains(github.ref_name, '-') && secrets.MYSPOTI_KEYSTORE_PASSWORD || secrets.MYSPOTI_STABLE_KEYSTORE_PASSWORD }}+ MYSPOTI_KEY_ALIAS: ${{ contains(github.ref_name, '-') && secrets.MYSPOTI_KEY_ALIAS || secrets.MYSPOTI_STABLE_KEY_ALIAS }}+ MYSPOTI_KEY_PASSWORD: ${{ contains(github.ref_name, '-') && secrets.MYSPOTI_KEY_PASSWORD || secrets.MYSPOTI_STABLE_KEY_PASSWORD }}run: |VERSION="${GITHUB_REF_NAME#v}"./gradlew assembleRelease \diff --git a/base/app/build.gradle.kts b/base/app/build.gradle.ktsindex 2dcd50a5..741ef6c0 100644--- a/base/app/build.gradle.kts+++ b/base/app/build.gradle.kts@@ -18,13 +18,20 @@ android {namespace = "app.myspoti.engine"compileSdk = 37+ // Two channels that install side by side: betas ("2.0.0-beta.3") stay "app.myspoti",+ // signed with the first key, as "Myspoti Beta"; releases are "app.myspoti.stable",+ // signed with their own key, as "Myspoti".+ // Local builds (no version given) are on the beta side, like the phone test builds.+ val version = (findProperty("appVersionName") as String?) ?: "2.0.0"+ val beta = findProperty("appVersionName") == null || version.contains("-")defaultConfig {- applicationId = "app.myspoti"+ applicationId = if (beta) "app.myspoti" else "app.myspoti.stable"+ manifestPlaceholders["appLabel"] = if (beta) "Myspoti Beta" else "Myspoti"minSdk = 29targetSdk = 36// CI release builds pass the tag's version (-PappVersionName / -PappVersionCode).versionCode = (findProperty("appVersionCode") as String?)?.toIntOrNull() ?: 200- versionName = (findProperty("appVersionName") as String?) ?: "2.0.0"+ 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.@@ -33,6 +40,8 @@ android {ndk {abiFilters += listOf("arm64-v8a", "armeabi-v7a")}+ // On-device tests (codecs): ./gradlew connectedDebugAndroidTest+ testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"}buildFeatures {@@ -61,8 +70,9 @@ android {buildTypes {debug {- // Installs next to the release app (own data, own sign-in).+ // Installs next to the release apps (own data, own sign-in).applicationIdSuffix = ".dev"+ manifestPlaceholders["appLabel"] = "Myspoti dev"}release {// Real key when provided (CI releases); otherwise the debug key, so a local@@ -87,6 +97,8 @@ dependencies {// Jam: scan the invite QR code (Google code scanner, no camera permission).implementation("com.google.android.gms:play-services-code-scanner:16.1.0")testImplementation("junit:junit:4.13.2")+ androidTestImplementation("androidx.test:runner:1.6.2")+ androidTestImplementation("androidx.test.ext:junit:1.2.1")implementation(libs.androidx.core.ktx)implementation(libs.androidx.appcompat)implementation(libs.androidx.webkit)diff --git a/base/app/src/main/AndroidManifest.xml b/base/app/src/main/AndroidManifest.xmlindex 958ca33d..4e72005d 100644--- a/base/app/src/main/AndroidManifest.xml+++ b/base/app/src/main/AndroidManifest.xml@@ -23,7 +23,7 @@android:name="app.myspoti.MyspotiApplication"android:allowBackup="false"android:icon="@mipmap/ic_launcher"- android:label="@string/app_name"+ android:label="${appLabel}"android:roundIcon="@mipmap/ic_launcher_round"android:supportsRtl="true"android:theme="@style/Theme.Myspoti"@@ -181,7 +181,7 @@<receiverandroid:name="com.music.spotui.widget.NowPlayingWidget"android:exported="false"- android:label="@string/app_name">+ android:label="${appLabel}"><intent-filter><action android:name="android.appwidget.action.APPWIDGET_UPDATE" /></intent-filter>diff --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 8c68f759..b1b0fd04 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@@ -36,7 +36,8 @@ object UpdateChecker {if (!r.isSuccessful) return@runCatching nullval text = r.body.string()val list = if (isBeta) org.json.JSONArray(text).let { a -> (0 until a.length()).map { a.getJSONObject(it) } } else listOf(JSONObject(text))- list.filter { !it.optBoolean("draft") }+ // Betas and releases are two apps: each one is offered its own channel only.+ list.filter { !it.optBoolean("draft") && (!isBeta || it.optBoolean("prerelease")) }.map { Release(it.getString("tag_name").removePrefix("v"), it.getString("html_url"), cleanNotes(it.optString("body"))) }.reduceOrNull { best, next -> if (isNewer(next.version, best.version)) next else best }}