commit
Hold the splash long enough to see, and name APKs by version
The splash now stays at least 1.5s so its opening plays even when mail is quick. CI names the APK inbox-<version>.apk, for artifacts and releases.
diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml
index 3236098..9a688cd 100644
--- a/.github/workflows/android.yml
+++ b/.github/workflows/android.yml
@@ -65,38 +65,45 @@ jobs:
if: env.GOOGLE_SERVICES_JSON != ''
run: echo "$GOOGLE_SERVICES_JSON" | base64 -d > app/google-services.json
+ # Tags are named by version (v1.2.0 builds 1.2.0); everything else is 1.0.<run>.
+ - name: Version
+ env:
+ TAG: ${{ startsWith(github.ref, 'refs/tags/v') && github.ref_name || '' }}
+ run: |
+ version=${TAG#v}
+ echo "VERSION_NAME=${version:-1.0.$GITHUB_RUN_NUMBER}" >> "$GITHUB_ENV"
+
- name: Build
env:
VERSION_CODE: ${{ github.run_number }}
- VERSION_NAME: ${{ startsWith(github.ref, 'refs/tags/v') && github.ref_name || format('1.0.{0}', github.run_number) }}
run: ./gradlew assembleRelease --console=plain
- name: Rename APK
run: |
src=$(ls app/build/outputs/apk/release/*.apk)
- mv "$src" inbox.apk
+ mv "$src" "inbox-$VERSION_NAME.apk"
+ echo "APK=inbox-$VERSION_NAME.apk" >> "$GITHUB_ENV"
- uses: actions/upload-artifact@v4
with:
- name: inbox-apk
- path: app/inbox.apk
+ name: inbox-${{ env.VERSION_NAME }}
+ path: app/${{ env.APK }}
- name: Publish release
if: startsWith(github.ref, 'refs/tags/v')
env:
GH_TOKEN: ${{ github.token }}
- run: gh release create "$GITHUB_REF_NAME" inbox.apk --generate-notes
+ run: gh release create "$GITHUB_REF_NAME" "$APK" --generate-notes
- # A rolling "latest" release that always holds the newest build from main,
- # so releases/download/latest/inbox.apk is a link that never changes.
+ # A rolling "latest" release that always holds the newest build from main.
+ # The site's /download link redirects to its APK, whatever it's named.
- name: Publish rolling latest
if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request' && env.HAS_SIGNING_KEY == 'true'
env:
GH_TOKEN: ${{ github.token }}
- VERSION_NAME: 1.0.${{ github.run_number }}
run: |
gh release delete latest --cleanup-tag --yes || true
- gh release create latest inbox.apk \
+ gh release create latest "$APK" \
--target "$GITHUB_SHA" \
--title "Latest build ($VERSION_NAME)" \
--notes "Built from ${GITHUB_SHA::7} on main. Installs over any earlier build." \
diff --git a/app/README.md b/app/README.md
index e6506c2..b976361 100644
--- a/app/README.md
+++ b/app/README.md
@@ -68,9 +68,10 @@ changing too.
## CI
`.github/workflows/android.yml` (at the repo root) builds whenever `app/`
-changes and uploads `inbox.apk` as an artifact. Each build from `main` replaces
-the rolling `latest` release, and pushing a `v*` tag attaches it to a GitHub
-release of its own. It signs with two repository secrets:
+changes and uploads the APK, named by version (`inbox-1.0.6.apk`), as an
+artifact. Each build from `main` replaces the rolling `latest` release, which
+the site's `/download` link redirects to, and pushing a `v1.2.0` tag attaches
+`inbox-1.2.0.apk` to a GitHub release of its own. It signs with two repository secrets:
- `KEYSTORE_BASE64`: `base64 -w0 inbox.jks`
- `KEYSTORE_PASSWORD`: the keystore password
diff --git a/app/app/src/main/java/gay/doughmination/mail/MainActivity.kt b/app/app/src/main/java/gay/doughmination/mail/MainActivity.kt
index 0be4e69..fcf001d 100644
--- a/app/app/src/main/java/gay/doughmination/mail/MainActivity.kt
+++ b/app/app/src/main/java/gay/doughmination/mail/MainActivity.kt
@@ -17,12 +17,14 @@ class MainActivity : ComponentActivity() {
private val vm: MailViewModel by viewModels()
override fun onCreate(savedInstanceState: Bundle?) {
- // The splash stays up while the inbox loads, so it opens already full.
+ // The splash stays up while the inbox loads, so it opens already full,
+ // and long enough for its opening to play even when mail is quick.
// A slow connection gets the app (and its spinner) after a few seconds.
val shown = SystemClock.uptimeMillis()
installSplashScreen().apply {
setKeepOnScreenCondition {
- !vm.ready && SystemClock.uptimeMillis() - shown < SPLASH_MAX_MS
+ val elapsed = SystemClock.uptimeMillis() - shown
+ (!vm.ready || elapsed < SPLASH_MIN_MS) && elapsed < SPLASH_MAX_MS
}
// Then it lifts off the top, uncovering the inbox.
setOnExitAnimationListener { splash ->
@@ -59,6 +61,7 @@ class MainActivity : ComponentActivity() {
}
private companion object {
+ const val SPLASH_MIN_MS = 1500L
const val SPLASH_MAX_MS = 4000L
}
}