diff --git a/README.md b/README.md index 94a715e..a69c619 100644 --- a/README.md +++ b/README.md @@ -26,8 +26,8 @@ APIs directly: - automatic update checks against the selected release manifest - one-download-per-version APK cache, SHA-256 verification, and installer handoff -- native Update and About pages for version, protocol, permission, and release - information +- native Update and About pages for version/build type, protocol, permission, + selected update source, and release information ## Server URL @@ -185,5 +185,5 @@ In the app: state, and a `Check update` button. - Open the `Update` page and tap `App settings` for Android's full per-app permission/settings screen. -- Open the `About` page to see the app version, package name, API/protocol - summary, selected update source, and update policy. +- Open the `About` page to see the app version/build type, package name, + API/protocol summary, selected update source, and update policy. diff --git a/app/src/main/java/com/neatstudio/tmuxandroid/MainActivity.java b/app/src/main/java/com/neatstudio/tmuxandroid/MainActivity.java index e5b5789..c203da7 100644 --- a/app/src/main/java/com/neatstudio/tmuxandroid/MainActivity.java +++ b/app/src/main/java/com/neatstudio/tmuxandroid/MainActivity.java @@ -301,8 +301,9 @@ public final class MainActivity extends Activity { LinearLayout content = pageContent(); content.addView(infoBlock( "Installed", - "Version " + BuildConfig.VERSION_NAME + " (" + BuildConfig.VERSION_CODE + ")\n" - + "Update source:\n" + prefs.getString("update_url", BuildConfig.DEFAULT_UPDATE_URL) + appIdentityText() + "\n" + + "Update source: " + updateSourceHost() + "\n" + + prefs.getString("update_url", BuildConfig.DEFAULT_UPDATE_URL) )); content.addView(sectionTitle("Update")); content.addView(actionPanel( @@ -351,7 +352,7 @@ public final class MainActivity extends Activity { content.addView(infoBlock( "tmux-browser Android", "Native Android client for the remote tmux-browser API.\n" - + "Version " + BuildConfig.VERSION_NAME + " (" + BuildConfig.VERSION_CODE + ")\n" + + appIdentityText() + "\n" + "Package " + getPackageName() )); content.addView(infoBlock( @@ -362,7 +363,8 @@ public final class MainActivity extends Activity { )); content.addView(infoBlock( "Update policy", - "Selected source:\n" + prefs.getString("update_url", BuildConfig.DEFAULT_UPDATE_URL) + "\n" + "Selected source: " + updateSourceHost() + "\n" + + prefs.getString("update_url", BuildConfig.DEFAULT_UPDATE_URL) + "\n" + "The app checks only this source. APK downloads are cached by version and reused after Android install permission is granted." )); content.addView(actionPanel( @@ -1208,11 +1210,7 @@ public final class MainActivity extends Activity { private void showPermissionsAndUpdateStatus() { StringBuilder text = new StringBuilder(); - text.append("Installed app: ") - .append(BuildConfig.VERSION_NAME) - .append(" (") - .append(BuildConfig.VERSION_CODE) - .append(")\n"); + text.append("Installed app: ").append(appIdentityText()).append('\n'); text.append("Server: ").append(getServerUrl()).append('\n'); text.append('\n'); text.append("Manual APK download:\n"); @@ -1222,7 +1220,9 @@ public final class MainActivity extends Activity { text.append('\n'); text.append("In-app update:\n"); text.append("Tap Check now on the Update page. The app checks only the selected source, downloads one APK per version, verifies SHA-256, then opens Android's installer.\n"); - text.append("Selected manifest:\n") + text.append("Selected manifest: ") + .append(updateSourceHost()) + .append('\n') .append(prefs.getString("update_url", BuildConfig.DEFAULT_UPDATE_URL)) .append('\n'); text.append("Available sources:\n"); @@ -1738,6 +1738,22 @@ public final class MainActivity extends Activity { return prefs.getString("server_url", BuildConfig.DEFAULT_SERVER_URL); } + private String appIdentityText() { + return "Version " + BuildConfig.VERSION_NAME + + " (" + BuildConfig.VERSION_CODE + ", " + + (BuildConfig.DEBUG ? "debug" : "release") + + ")"; + } + + private String updateSourceHost() { + String url = prefs.getString("update_url", BuildConfig.DEFAULT_UPDATE_URL); + if (url == null || url.trim().isEmpty()) { + url = BuildConfig.DEFAULT_UPDATE_URL; + } + String host = Uri.parse(url).getHost(); + return host == null || host.isEmpty() ? "custom" : host; + } + private String normalizeServerUrl(String raw) { String value = raw.trim(); if (value.isEmpty()) { diff --git a/docs/android-client-notes.md b/docs/android-client-notes.md index 32570ce..14f0572 100644 --- a/docs/android-client-notes.md +++ b/docs/android-client-notes.md @@ -89,7 +89,7 @@ Implemented now: - one-download-per-version APK cache, SHA-256 verification, and installer handoff - permission/about surfaces for unknown-app install status, notification status, - app settings, app version, package name, selected update source, and + app settings, app version/build type, package name, selected update source, and HTTP/WebSocket API/protocol summary ## Update And Release Policy