Skip to content

Debloat your Android TV, install apps, browse and transfer files on it, all from your phone. Just 3 MB, no tracking, no root, no PC.

Update: Download APK in the browser instead of installing in the app

jesse-agent-23261db67667d6e
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 18dda5b..c3e7ac3 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -14,7 +14,7 @@ until this file has a section for its version.
- **New:** Spanish, Chinese, Japanese and Russian translations, machine-made; corrections welcome. [#272](../../pull/272)
- **New:** Settings › What's new shows each version's changes, and what an update brings. [#271](../../pull/271)
-- **New:** Update installs a new version from inside the app; Android asks first. [#271](../../pull/271)
+- **Improved:** The update dialog offers Download APK, which gets the new version straight from its release. [#271](../../pull/271)
- **Improved:** Tweaks shows the same TV-offline screen as Files. [#273](../../pull/273)
- **Fixed:** With the TV away, app rows grey out and won't open. [#273](../../pull/273)
- **Fixed:** Connect says when the phone has dropped off Wi-Fi, and Try again waits for Wi-Fi instead of failing at once. [#274](../../pull/274)
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 9faaa6d..f4702a0 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -7,8 +7,6 @@
<!-- Android 17 blocks every connection to LAN addresses (and mDNS) for apps targeting 37
without this runtime permission. The UI must request it before the first scan. -->
<uses-permission android:name="android.permission.ACCESS_LOCAL_NETWORK" />
- <!-- Update from inside the app: the release's APK goes to Android's installer, which asks first. -->
- <uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
<application
android:allowBackup="false"
@@ -26,15 +24,6 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
- <provider
- android:name="androidx.core.content.FileProvider"
- android:authorities="${applicationId}.updates"
- android:exported="false"
- android:grantUriPermissions="true">
- <meta-data
- android:name="android.support.FILE_PROVIDER_PATHS"
- android:resource="@xml/self_update_paths" />
- </provider>
</application>
</manifest>
diff --git a/app/src/main/java/app/tellyscope/MainActivity.kt b/app/src/main/java/app/tellyscope/MainActivity.kt
index da7e98d..cd3a4c5 100644
--- a/app/src/main/java/app/tellyscope/MainActivity.kt
+++ b/app/src/main/java/app/tellyscope/MainActivity.kt
@@ -45,7 +45,6 @@ import app.tellyscope.adb.Connector
import app.tellyscope.adb.StatsProfile
import app.tellyscope.data.AdbDeviceSource
import app.tellyscope.data.AndroidLauncherDownload
-import app.tellyscope.data.AndroidSelfUpdate
import app.tellyscope.data.AndroidPhoneStorage
import app.tellyscope.data.Device
import app.tellyscope.data.DeviceState
@@ -134,7 +133,6 @@ class MainActivity : ComponentActivity() {
historySeen = SeenBook(File(filesDir, "history-seen.properties")),
appFacts = AppFacts(installedVersion(), "${Build.MANUFACTURER} ${Build.MODEL}, Android ${Build.VERSION.RELEASE}"),
launcherDownload = if (scenario != null) null else AndroidLauncherDownload(applicationContext),
- selfUpdate = if (scenario != null) null else AndroidSelfUpdate(applicationContext),
)
}
},
@@ -226,18 +224,15 @@ fun TellyscopeApp(vm: TellyscopeViewModel) {
state.update?.let { u ->
UpdateDialog(
- u, state.updating,
- onUpdate = vm::startUpdate,
+ u,
+ onDownload = { vm.updateLater(); u.apk?.let { runCatching { browser.openUri(it) } } },
onRelease = { vm.updateLater(); runCatching { browser.openUri(u.url) } },
onCancel = vm::updateLater,
- onOpenSettings = vm::openInstallSettings,
- onBack = vm::backToOffer,
)
}
// On every return to the app, not just a cold start; the check itself enforces the interval.
- // Back from Install unknown apps with it allowed, the update download starts.
- LifecycleEventEffect(Lifecycle.Event.ON_RESUME) { vm.checkForUpdate(); vm.resumeUpdate() }
+ LifecycleEventEffect(Lifecycle.Event.ON_RESUME) { vm.checkForUpdate() }
// In the background nothing reads the TVs or sweeps the LAN; back on screen, everything picks up again.
LifecycleEventEffect(Lifecycle.Event.ON_STOP) { vm.pause() }
LifecycleEventEffect(Lifecycle.Event.ON_START) { vm.resume() }
diff --git a/app/src/main/java/app/tellyscope/data/SelfUpdate.kt b/app/src/main/java/app/tellyscope/data/SelfUpdate.kt
deleted file mode 100644
index d04cd49..0000000
--- a/app/src/main/java/app/tellyscope/data/SelfUpdate.kt
+++ /dev/null
@@ -1,93 +0,0 @@
-// SPDX-License-Identifier: GPL-3.0-only
-
-package app.tellyscope.data
-
-import android.content.Context
-import android.content.Intent
-import android.net.Uri
-import android.provider.Settings
-import androidx.core.content.FileProvider
-import app.tellyscope.adb.Progress
-import kotlinx.coroutines.Dispatchers
-import kotlinx.coroutines.ensureActive
-import kotlinx.coroutines.withContext
-import java.io.File
-import java.io.IOException
-import java.net.HttpURLConnection
-import java.net.URL
-
-/** Tellyscope is about 3 MB; anything far past that isn't it. */
-internal const val MAX_SELF_APK_BYTES = 64L shl 20
-
-/**
- * Update from inside the app: the release's APK comes from GitHub and goes to Android's installer,
- * which asks the user to confirm and refuses an APK not signed like the installed app.
- */
-interface SelfUpdate {
- /** "Install unknown apps" is on for this app. */
- fun allowed(): Boolean
-
- /** Android's Install unknown apps page for this app. */
- fun openSettings()
-
- suspend fun fetch(update: Update, onProgress: (Progress) -> Unit): File
-
- /** Hands [apk] to Android's installer. */
- fun install(apk: File)
-}
-
-class AndroidSelfUpdate(context: Context) : SelfUpdate {
- private val ctx = context.applicationContext
- private val dir get() = File(ctx.cacheDir, "update")
-
- override fun allowed() = ctx.packageManager.canRequestPackageInstalls()
-
- override fun openSettings() {
- ctx.startActivity(
- Intent(Settings.ACTION_MANAGE_UNKNOWN_APP_SOURCES, Uri.parse("package:${ctx.packageName}")).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK),
- )
- }
-
- override suspend fun fetch(update: Update, onProgress: (Progress) -> Unit): File = withContext(Dispatchers.IO) {
- val url = update.apk ?: throw IOException("no APK in the release")
- dir.deleteRecursively()
- dir.mkdirs()
- val file = File(dir, "tellyscope.apk")
- val c = URL(url).openConnection() as HttpURLConnection
- c.connectTimeout = 10_000
- c.readTimeout = 30_000
- try {
- if (c.responseCode != 200) throw IOException("HTTP ${c.responseCode}")
- c.inputStream.use { input ->
- file.outputStream().use { out ->
- val buf = ByteArray(64 * 1024)
- var done = 0L
- while (true) {
- ensureActive()
- val n = input.read(buf).takeIf { it >= 0 } ?: break
- done += n
- if (done > update.size) throw IOException("larger than the release says")
- out.write(buf, 0, n)
- onProgress(Progress(done, update.size))
- }
- if (done != update.size) throw IOException("download cut short")
- }
- }
- } finally {
- c.disconnect()
- }
- // The installer checks the signature; this only makes sure it's this app at the offered version.
- @Suppress("DEPRECATION") // the flags overload is API 33+
- val pkg = ctx.packageManager.getPackageArchiveInfo(file.path, 0)
- if (pkg == null || pkg.packageName != ctx.packageName || pkg.versionName != update.version) throw IOException("not Tellyscope ${update.version}")
- file
- }
-
- override fun install(apk: File) {
- val uri = FileProvider.getUriForFile(ctx, "${ctx.packageName}.updates", apk)
- ctx.startActivity(
- Intent(Intent.ACTION_VIEW).setDataAndType(uri, "application/vnd.android.package-archive")
- .addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION or Intent.FLAG_ACTIVITY_NEW_TASK),
- )
- }
-}
diff --git a/app/src/main/java/app/tellyscope/data/UpdateCheck.kt b/app/src/main/java/app/tellyscope/data/UpdateCheck.kt
index d161f97..4a3f450 100644
--- a/app/src/main/java/app/tellyscope/data/UpdateCheck.kt
+++ b/app/src/main/java/app/tellyscope/data/UpdateCheck.kt
@@ -18,8 +18,11 @@ private const val RELEASES_API = "https://api.github.com/repos/man15h/tellyscope
private const val RELEASE_INTERVAL_MS = 30 * 60 * 1000L
private const val ALPHA_INTERVAL_MS = 5 * 60 * 1000L
-/** A newer Tellyscope than the one running. [apk] is its release's APK, [size] bytes; null when the release has none. */
-data class Update(val version: String, val notes: String, val url: String, val apk: String? = null, val size: Long = 0)
+/** Tellyscope is about 3 MB; an APK far past that isn't it. */
+private const val MAX_APK_BYTES = 64L shl 20
+
+/** A newer Tellyscope than the one running. [apk] is its release's APK link; null when the release has none this build can install. */
+data class Update(val version: String, val notes: String, val url: String, val apk: String? = null)
/**
* Asks GitHub, at most every 30 minutes (5 minutes on alpha builds), whether a newer release is out. No auth and no download: it
@@ -104,8 +107,8 @@ fun newest(json: String, alpha: Boolean): Update? = runCatching {
// build can update to: alpha and release builds are different packages with different keys.
val apk = if ((parsed.alpha != null) != alpha) null else r.optJSONArray("assets")?.let { a -> (0 until a.length()).map(a::getJSONObject) }.orEmpty()
.singleOrNull { it.optString("name").endsWith(".apk") }
- ?.takeIf { it.optString("browser_download_url").startsWith("$RELEASES/download/") && it.optLong("size") in 1..MAX_SELF_APK_BYTES }
- Update(version, r.optString("body").trim(), "$RELEASES/tag/v$version", apk?.optString("browser_download_url"), apk?.optLong("size") ?: 0)
+ ?.takeIf { it.optString("browser_download_url").startsWith("$RELEASES/download/") && it.optLong("size") in 1..MAX_APK_BYTES }
+ Update(version, r.optString("body").trim(), "$RELEASES/tag/v$version", apk?.optString("browser_download_url"))
}
.maxWithOrNull { a, b -> compareVersions(a.version, b.version) }
}.getOrNull()
diff --git a/app/src/main/java/app/tellyscope/ui/TellyscopeViewModel.kt b/app/src/main/java/app/tellyscope/ui/TellyscopeViewModel.kt
index 842ee2d..908e958 100644
--- a/app/src/main/java/app/tellyscope/ui/TellyscopeViewModel.kt
+++ b/app/src/main/java/app/tellyscope/ui/TellyscopeViewModel.kt
@@ -62,7 +62,6 @@ import app.tellyscope.data.TvTweaks
import app.tellyscope.data.Update
import app.tellyscope.data.FoldBook
import app.tellyscope.data.SeenBook
-import app.tellyscope.data.SelfUpdate
import app.tellyscope.data.UpdateCheck
import app.tellyscope.data.UiText
import app.tellyscope.data.why
@@ -80,7 +79,6 @@ import kotlinx.coroutines.launch
import kotlinx.coroutines.sync.Mutex
import kotlinx.coroutines.sync.withLock
import kotlinx.coroutines.withTimeoutOrNull
-import java.io.File
import java.text.SimpleDateFormat
import java.util.Date
import java.util.Locale
@@ -283,13 +281,6 @@ data class FilesUi(
data class TransferUi(val name: String, val toTv: Boolean, val folder: TvFolder, val progress: Progress? = null)
-/** The update dialog after Update: allow installs first, then the download, or why it stopped. */
-sealed interface Updating {
- data object Allow : Updating
- data class Downloading(val progress: Progress) : Updating
- data object Failed : Updating
-}
-
data class UiState(
val scan: ScanUi = ScanUi(),
val devices: List<Device> = emptyList(),
@@ -308,8 +299,6 @@ data class UiState(
val alphaBuild: Boolean = false,
/** A newer release to offer; cleared once the user answers. */
val update: Update? = null,
- /** How far Update has got with [update]; null while it is only offered. */
- val updating: Updating? = null,
/** The newest release the last check found; unlike [update] it stays after Later, for What's new. */
val available: Update? = null,
/** What's new's CHANGELOG sections past the installed version, once [available] is set: empty until read, null if they couldn't be. */
@@ -419,8 +408,6 @@ class TellyscopeViewModel(
private val appFacts: AppFacts = AppFacts("unknown", "unknown phone"),
/** Projectivy from its developer's GitHub, for Fire OS. */
private val launcherDownload: LauncherDownload? = null,
- /** Update from inside the app; null in screenshots and tests. */
- private val selfUpdate: SelfUpdate? = null,
) : ViewModel() {
private val _state = MutableStateFlow(UiState(now = clock()))
@@ -483,9 +470,6 @@ class TellyscopeViewModel(
/** Watches the TV for a launcher's install from the Play Store. */
private var launcherJob: Job? = null
private var updateJob: Job? = null
- private var selfUpdateJob: Job? = null
- /** An update downloaded while the app was in the background, for the installer on return. */
- private var readyApk: File? = null
/** The clock and the device refresh, every second. */
private var tickJob: Job? = null
/** In the background since [pause]; [resume] starts everything again. */
@@ -1807,58 +1791,9 @@ class TellyscopeViewModel(
}
}
- /** "Get new release" or "Cancel": the offer goes away until the next check, and a download stops. */
+ /** "Download APK", "Check release" or "Cancel": the offer goes away until the next check. */
fun updateLater() {
- selfUpdateJob?.cancel()
- _state.update { it.copy(update = null, updating = null) }
- }
-
- /**
- * Update: downloads the release's APK and hands it to Android's installer. The first time,
- * Android has to allow this app to install, so the dialog asks for that first.
- */
- fun startUpdate() {
- val s = selfUpdate ?: return
- val u = _state.value.update ?: return
- if (!s.allowed()) {
- _state.update { it.copy(updating = Updating.Allow) }
- return
- }
- selfUpdateJob?.cancel()
- _state.update { it.copy(updating = Updating.Downloading(Progress(0, u.size))) }
- selfUpdateJob = viewModelScope.launch {
- val apk = try {
- s.fetch(u) { p -> _state.update { it.copy(updating = Updating.Downloading(p)) } }
- } catch (e: CancellationException) {
- throw e
- } catch (_: Exception) {
- _state.update { it.copy(updating = Updating.Failed) }
- return@launch
- }
- // Android's own confirm takes over from here. Android 10+ blocks it from the background
- // without a word, so a download that ends there waits for the app to come back.
- _state.update { it.copy(update = null, updating = null) }
- if (paused) readyApk = apk else runCatching { s.install(apk) }
- }
- }
-
- /** "Open settings": Android's Install unknown apps page; back from it, [resumeUpdate] goes on. */
- fun openInstallSettings() {
- runCatching { selfUpdate?.openSettings() }
- }
-
- /**
- * Back in the app: a download that finished in the background goes to the installer now, and if
- * the user just allowed installs, the download starts without a second tap.
- */
- fun resumeUpdate() {
- readyApk?.let { apk -> readyApk = null; runCatching { selfUpdate?.install(apk) } }
- if (_state.value.updating == Updating.Allow && selfUpdate?.allowed() == true) startUpdate()
- }
-
- /** "Cancel" on the Allow step: back to the offer. */
- fun backToOffer() {
- _state.update { it.copy(updating = null) }
+ _state.update { it.copy(update = null) }
}
/** What's new's Update card: the update check's offer again. */
diff --git a/app/src/main/java/app/tellyscope/ui/UpdateDialog.kt b/app/src/main/java/app/tellyscope/ui/UpdateDialog.kt
index 774bb8e..6d4ac42 100644
--- a/app/src/main/java/app/tellyscope/ui/UpdateDialog.kt
+++ b/app/src/main/java/app/tellyscope/ui/UpdateDialog.kt
@@ -2,20 +2,13 @@
package app.tellyscope.ui
-import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
-import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.heightIn
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
-import androidx.compose.material.icons.Icons
-import androidx.compose.material.icons.filled.Warning
import androidx.compose.material3.AlertDialog
import androidx.compose.material3.Button
-import androidx.compose.material3.ExperimentalMaterial3ExpressiveApi
-import androidx.compose.material3.Icon
-import androidx.compose.material3.LinearWavyProgressIndicator
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.material3.TextButton
@@ -30,85 +23,34 @@ import androidx.compose.ui.text.withStyle
import androidx.compose.ui.unit.dp
import app.tellyscope.R
import app.tellyscope.data.Update
-import app.tellyscope.data.resolve
/**
- * A newer release is out. Update downloads its APK inside the app and hands it to Android's
- * installer; Get new release opens its GitHub page instead. [updating] is how far Update got.
+ * A newer release is out. Download APK opens the release's APK in the browser, which downloads it
+ * for Android's installer; Check release opens its GitHub page.
*/
-@OptIn(ExperimentalMaterial3ExpressiveApi::class)
@Composable
-fun UpdateDialog(
- update: Update,
- updating: Updating?,
- onUpdate: () -> Unit,
- onRelease: () -> Unit,
- onCancel: () -> Unit,
- onOpenSettings: () -> Unit,
- onBack: () -> Unit,
-) {
- when (updating) {
- null -> AlertDialog(
- onDismissRequest = onCancel,
- title = { Text(stringResource(R.string.update_title, update.version)) },
- text = {
- Column(Modifier.heightIn(max = 320.dp).verticalScroll(rememberScrollState())) {
- Text(boldSpans(dialogNotes(update.notes, stringResource(R.string.update_more_notes)).ifEmpty { stringResource(R.string.update_no_notes) }), style = MaterialTheme.typography.bodyMedium)
+fun UpdateDialog(update: Update, onDownload: () -> Unit, onRelease: () -> Unit, onCancel: () -> Unit) {
+ AlertDialog(
+ onDismissRequest = onCancel,
+ title = { Text(stringResource(R.string.update_title, update.version)) },
+ text = {
+ Column(Modifier.heightIn(max = 320.dp).verticalScroll(rememberScrollState())) {
+ Text(boldSpans(dialogNotes(update.notes, stringResource(R.string.update_more_notes)).ifEmpty { stringResource(R.string.update_no_notes) }), style = MaterialTheme.typography.bodyMedium)
+ }
+ },
+ // Three actions stack full width; without an APK this build can install, only its page is left.
+ confirmButton = {
+ Column(Modifier.fillMaxWidth()) {
+ if (update.apk != null) {
+ Button(onClick = onDownload, Modifier.fillMaxWidth()) { Text(stringResource(R.string.update_download)) }
+ TextButton(onClick = onRelease, Modifier.fillMaxWidth()) { Text(stringResource(R.string.update_release)) }
+ } else {
+ Button(onClick = onRelease, Modifier.fillMaxWidth()) { Text(stringResource(R.string.update_release)) }
}
- },
- // Three actions stack full width; without an APK in the release, only its page is left.
- confirmButton = {
- Column(Modifier.fillMaxWidth()) {
- if (update.apk != null) {
- Button(onClick = onUpdate, Modifier.fillMaxWidth()) { Text(stringResource(R.string.update_install)) }
- TextButton(onClick = onRelease, Modifier.fillMaxWidth()) { Text(stringResource(R.string.update_release)) }
- } else {
- Button(onClick = onRelease, Modifier.fillMaxWidth()) { Text(stringResource(R.string.update_release)) }
- }
- TextButton(onClick = onCancel, Modifier.fillMaxWidth()) { Text(stringResource(R.string.update_cancel)) }
- }
- },
- )
- Updating.Allow -> AlertDialog(
- onDismissRequest = onBack,
- icon = { Icon(SystemUpdate, contentDescription = null) },
- title = { Text(stringResource(R.string.update_allow_title)) },
- text = { Text(boldSpans(stringResource(R.string.update_allow_text)), style = MaterialTheme.typography.bodyMedium) },
- confirmButton = { Button(onClick = onOpenSettings) { Text(stringResource(R.string.update_open_settings)) } },
- dismissButton = { TextButton(onClick = onBack) { Text(stringResource(R.string.update_cancel)) } },
- )
- is Updating.Downloading -> AlertDialog(
- onDismissRequest = onCancel,
- title = { Text(stringResource(R.string.update_downloading, update.version)) },
- text = {
- val p = updating.progress
- Column(verticalArrangement = Arrangement.spacedBy(12.dp)) {
- val fraction = p.fraction
- if (fraction != null) LinearWavyProgressIndicator(progress = { fraction }, Modifier.fillMaxWidth())
- else LinearWavyProgressIndicator(Modifier.fillMaxWidth())
- Text(
- stringResource(R.string.update_of, Copy.bytes(p.done).resolve(), Copy.bytes(p.total ?: update.size).resolve()),
- style = MaterialTheme.typography.bodySmall,
- color = MaterialTheme.colorScheme.onSurfaceVariant,
- )
- }
- },
- confirmButton = { TextButton(onClick = onCancel) { Text(stringResource(R.string.update_cancel)) } },
- )
- Updating.Failed -> AlertDialog(
- onDismissRequest = onCancel,
- icon = { Icon(Icons.Default.Warning, contentDescription = null, tint = MaterialTheme.colorScheme.error) },
- title = { Text(stringResource(R.string.update_failed_title, update.version)) },
- text = { Text(stringResource(R.string.update_failed_text), style = MaterialTheme.typography.bodyMedium) },
- confirmButton = { Button(onClick = onUpdate) { Text(stringResource(R.string.update_try_again)) } },
- dismissButton = {
- Row {
- TextButton(onClick = onCancel) { Text(stringResource(R.string.update_cancel)) }
- TextButton(onClick = onRelease) { Text(stringResource(R.string.update_release)) }
- }
- },
- )
- }
+ TextButton(onClick = onCancel, Modifier.fillMaxWidth()) { Text(stringResource(R.string.update_cancel)) }
+ }
+ },
+ )
}
/**
diff --git a/app/src/main/java/app/tellyscope/ui/WhatsNewScreen.kt b/app/src/main/java/app/tellyscope/ui/WhatsNewScreen.kt
index ea8fd97..64d5c03 100644
--- a/app/src/main/java/app/tellyscope/ui/WhatsNewScreen.kt
+++ b/app/src/main/java/app/tellyscope/ui/WhatsNewScreen.kt
@@ -274,7 +274,7 @@ private fun symbol(name: String, path: String) = ImageVector.Builder(name, 24.dp
.clearGroup()
.build()
-internal val SystemUpdate = symbol(
+private val SystemUpdate = symbol(
"SystemUpdate",
"M280-40q-33 0-56.5-23.5T200-120v-720q0-33 23.5-56.5T280-920h400q33 0 56.5 23.5T760-840v124q18 7 29 22t11 34v80q0 19-11 34t-29 22v404q0 33-23.5 56.5T680-40H280Zm0-80h400v-720H280v720Zm0 0v-720 720Zm200-200 160-160-56-56-64 62v-166h-80v166l-64-62-56 56 160 160Z",
)
diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml
index 758c577..688440b 100644
--- a/app/src/main/res/values-es/strings.xml
+++ b/app/src/main/res/values-es/strings.xml
@@ -981,8 +981,8 @@
<string name="settings_title">Ajustes</string>
<string name="settings_back_to_tv">Volver a la página de la TV</string>
<string name="settings_check_updates">Buscar actualizaciones</string>
- <string name="settings_check_updates_alpha">En las versiones alfa, pregunta a GitHub cada 5 minutos si hay una versión nueva de Tellyscope. No se descarga nada hasta que tocas Actualizar.</string>
- <string name="settings_check_updates_release">Cada 30 minutos, pregunta a GitHub si hay una versión nueva de Tellyscope. No se descarga nada hasta que tocas Actualizar.</string>
+ <string name="settings_check_updates_alpha">En las versiones alfa, pregunta a GitHub cada 5 minutos si hay una versión nueva de Tellyscope. No se descarga nada.</string>
+ <string name="settings_check_updates_release">Cada 30 minutos, pregunta a GitHub si hay una versión nueva de Tellyscope. No se descarga nada.</string>
<string name="settings_key_haptics">Vibrar al pulsar teclas</string>
<string name="settings_key_haptics_text">Una vibración corta por cada tecla del control remoto.</string>
<string name="settings_report">Informar de un problema</string>
@@ -1140,17 +1140,9 @@
<string name="update_title">🎉 Ya está disponible Tellyscope %1$s</string>
<string name="update_no_notes">No hay notas de la versión.</string>
<string name="update_more_notes">…y más en GitHub</string>
- <string name="update_install">Actualizar</string>
- <string name="update_release">Ver la nueva versión</string>
+ <string name="update_download">Descargar APK</string>
+ <string name="update_release">Ver la versión</string>
<string name="update_cancel">Cancelar</string>
- <string name="update_allow_title">¿Permitir que Tellyscope instale actualizaciones?</string>
- <string name="update_allow_text">Android lo pregunta una sola vez. En la siguiente pantalla, activa **Permitir de esta fuente** y vuelve aquí.\n\nAndroid sigue pidiéndote que confirmes cada actualización y solo acepta una firmada igual que el Tellyscope que tienes.</string>
- <string name="update_open_settings">Abrir ajustes</string>
- <string name="update_downloading">Descargando %1$s</string>
- <string name="update_of">%1$s de %2$s</string>
- <string name="update_failed_title">No se pudo descargar %1$s</string>
- <string name="update_failed_text">Comprueba que el teléfono tiene conexión y vuelve a intentarlo, o descárgala desde la página de la versión en GitHub.</string>
- <string name="update_try_again">Reintentar</string>
<string name="welcome_skip">Omitir</string>
<string name="welcome_title">Te damos la bienvenida a Tellyscope</string>
<string name="welcome_text">Mira qué se está ejecutando en tu Android TV y desactiva las apps que no necesitas. Todo desde tu teléfono, por Wi-Fi.</string>
diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml
index a05f755..782d1fa 100644
--- a/app/src/main/res/values-ja/strings.xml
+++ b/app/src/main/res/values-ja/strings.xml
@@ -897,8 +897,8 @@
<string name="settings_title">設定</string>
<string name="settings_back_to_tv">テレビのページに戻る</string>
<string name="settings_check_updates">アップデートを確認</string>
- <string name="settings_check_updates_alpha">アルファ版では 5 分ごとに、新しい Tellyscope が公開されているかを GitHub に確認します。「アップデート」をタップするまで何もダウンロードされません。</string>
- <string name="settings_check_updates_release">30 分ごとに、新しい Tellyscope が公開されているかを GitHub に確認します。「アップデート」をタップするまで何もダウンロードされません。</string>
+ <string name="settings_check_updates_alpha">アルファ版では 5 分ごとに、新しい Tellyscope が公開されているかを GitHub に確認します。何もダウンロードされません。</string>
+ <string name="settings_check_updates_release">30 分ごとに、新しい Tellyscope が公開されているかを GitHub に確認します。何もダウンロードされません。</string>
<string name="settings_key_haptics">キーを押したときに振動</string>
<string name="settings_key_haptics_text">リモコンのキーごとに短く振動します。</string>
<string name="settings_report">問題を報告</string>
@@ -1052,17 +1052,9 @@
<string name="update_title">🎉 Tellyscope %1$s が公開されました</string>
<string name="update_no_notes">リリースノートはありません。</string>
<string name="update_more_notes">…その他は GitHub で</string>
- <string name="update_install">アップデート</string>
- <string name="update_release">新しいリリースを入手</string>
+ <string name="update_download">APK をダウンロード</string>
+ <string name="update_release">リリースを確認</string>
<string name="update_cancel">キャンセル</string>
- <string name="update_allow_title">Tellyscope にアップデートのインストールを許可しますか?</string>
- <string name="update_allow_text">Android が確認するのは一度だけです。次の画面で「**この提供元のアプリを許可**」をオンにして、ここに戻ってください。\n\nアップデートのたびに Android が確認を求めます。また、今お使いの Tellyscope と同じ署名のものしか受け付けません。</string>
- <string name="update_open_settings">設定を開く</string>
- <string name="update_downloading">%1$s をダウンロード中</string>
- <string name="update_of">%1$s / %2$s</string>
- <string name="update_failed_title">%1$s をダウンロードできませんでした</string>
- <string name="update_failed_text">スマートフォンがオンラインか確認してもう一度お試しいただくか、GitHub のリリースページから入手してください。</string>
- <string name="update_try_again">再試行</string>
<string name="welcome_skip">スキップ</string>
<string name="welcome_title">Tellyscope へようこそ</string>
<string name="welcome_text">Android TV で実行中のアプリを確認し、不要なアプリを無効にできます。すべてスマートフォンから Wi-Fi 経由で操作できます。</string>
diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml
index f746b4b..bc30e9f 100644
--- a/app/src/main/res/values-ru/strings.xml
+++ b/app/src/main/res/values-ru/strings.xml
@@ -1023,8 +1023,8 @@
<string name="settings_title">Настройки</string>
<string name="settings_back_to_tv">Назад к странице телевизора</string>
<string name="settings_check_updates">Проверять обновления</string>
- <string name="settings_check_updates_alpha">В альфа-сборках каждые 5 минут спрашивать у GitHub, вышла ли новая версия Tellyscope. Ничего не скачивается, пока вы не нажмёте «Обновить».</string>
- <string name="settings_check_updates_release">Каждые 30 минут спрашивать у GitHub, вышла ли новая версия Tellyscope. Ничего не скачивается, пока вы не нажмёте «Обновить».</string>
+ <string name="settings_check_updates_alpha">В альфа-сборках каждые 5 минут спрашивать у GitHub, вышла ли новая версия Tellyscope. Ничего не скачивается.</string>
+ <string name="settings_check_updates_release">Каждые 30 минут спрашивать у GitHub, вышла ли новая версия Tellyscope. Ничего не скачивается.</string>
<string name="settings_key_haptics">Вибрация при нажатии</string>
<string name="settings_key_haptics_text">Короткий отклик на каждую кнопку пульта.</string>
<string name="settings_report">Сообщить о проблеме</string>
@@ -1184,17 +1184,9 @@
<string name="update_title">🎉 Вышла версия Tellyscope %1$s</string>
<string name="update_no_notes">Нет описания изменений.</string>
<string name="update_more_notes">…и многое другое на GitHub</string>
- <string name="update_install">Обновить</string>
- <string name="update_release">Открыть новую версию</string>
+ <string name="update_download">Скачать APK</string>
+ <string name="update_release">Открыть релиз</string>
<string name="update_cancel">Отмена</string>
- <string name="update_allow_title">Разрешить Tellyscope устанавливать обновления?</string>
- <string name="update_allow_text">Android спросит только один раз. На следующем экране включите **Разрешить установку из этого источника** и вернитесь сюда.\n\nAndroid всё равно попросит подтвердить каждое обновление и примет только версию с той же подписью, что у вашего Tellyscope.</string>
- <string name="update_open_settings">Открыть настройки</string>
- <string name="update_downloading">Загрузка %1$s</string>
- <string name="update_of">%1$s из %2$s</string>
- <string name="update_failed_title">Не удалось загрузить %1$s</string>
- <string name="update_failed_text">Проверьте подключение телефона к сети и повторите попытку или скачайте версию со страницы релиза на GitHub.</string>
- <string name="update_try_again">Повторить</string>
<string name="welcome_skip">Пропустить</string>
<string name="welcome_title">Добро пожаловать в Tellyscope</string>
<string name="welcome_text">Смотрите, что запущено на Android TV, и отключайте ненужные приложения. Все с телефона, по Wi-Fi.</string>
diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml
index 79aaa5f..97b3c1b 100644
--- a/app/src/main/res/values-zh-rCN/strings.xml
+++ b/app/src/main/res/values-zh-rCN/strings.xml
@@ -897,8 +897,8 @@
<string name="settings_title">设置</string>
<string name="settings_back_to_tv">返回电视页面</string>
<string name="settings_check_updates">检查更新</string>
- <string name="settings_check_updates_alpha">在 alpha 版本中,每 5 分钟向 GitHub 查询是否有新版 Tellyscope。在你点按“更新”之前不会下载任何内容。</string>
- <string name="settings_check_updates_release">每 30 分钟向 GitHub 查询是否有新版 Tellyscope。在你点按“更新”之前不会下载任何内容。</string>
+ <string name="settings_check_updates_alpha">在 alpha 版本中,每 5 分钟向 GitHub 查询是否有新版 Tellyscope。不会下载任何内容。</string>
+ <string name="settings_check_updates_release">每 30 分钟向 GitHub 查询是否有新版 Tellyscope。不会下载任何内容。</string>
<string name="settings_key_haptics">按键时振动</string>
<string name="settings_key_haptics_text">按遥控器上的每个键时短暂振动一下。</string>
<string name="settings_report">报告问题</string>
@@ -1052,17 +1052,9 @@
<string name="update_title">🎉 Tellyscope %1$s 已发布</string>
<string name="update_no_notes">没有版本说明。</string>
<string name="update_more_notes">…更多内容请见 GitHub</string>
- <string name="update_install">更新</string>
- <string name="update_release">获取新版本</string>
+ <string name="update_download">下载 APK</string>
+ <string name="update_release">查看版本</string>
<string name="update_cancel">取消</string>
- <string name="update_allow_title">允许 Tellyscope 安装更新?</string>
- <string name="update_allow_text">Android 只会询问一次。在下一个屏幕上开启“**允许来自此来源的应用**”,然后返回这里。\n\nAndroid 仍会要求你确认每次更新,并且只接受与你当前 Tellyscope 签名相同的版本。</string>
- <string name="update_open_settings">打开设置</string>
- <string name="update_downloading">正在下载 %1$s</string>
- <string name="update_of">%1$s / %2$s</string>
- <string name="update_failed_title">无法下载 %1$s</string>
- <string name="update_failed_text">请检查手机是否联网后重试,或从 GitHub 版本页面获取。</string>
- <string name="update_try_again">重试</string>
<string name="welcome_skip">跳过</string>
<string name="welcome_title">欢迎使用 Tellyscope</string>
<string name="welcome_text">查看 Android TV 上正在运行的内容,并停用你不需要的应用。全部通过 Wi-Fi 在手机上完成。</string>
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index aa3f4d5..48f5caf 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -1172,8 +1172,8 @@
<string name="settings_title">Settings</string>
<string name="settings_back_to_tv">Back to the TV\'s page</string>
<string name="settings_check_updates">Check for updates</string>
- <string name="settings_check_updates_alpha">Every 5 minutes on alpha builds, ask GitHub whether a newer Tellyscope is out. Nothing is downloaded until you tap Update.</string>
- <string name="settings_check_updates_release">Every 30 minutes, ask GitHub whether a newer Tellyscope is out. Nothing is downloaded until you tap Update.</string>
+ <string name="settings_check_updates_alpha">Every 5 minutes on alpha builds, ask GitHub whether a newer Tellyscope is out. Nothing is downloaded.</string>
+ <string name="settings_check_updates_release">Every 30 minutes, ask GitHub whether a newer Tellyscope is out. Nothing is downloaded.</string>
<string name="settings_key_haptics">Vibrate on key press</string>
<string name="settings_key_haptics_text">A short tick for each key on the Remote.</string>
<string name="settings_report">Report a problem</string>
@@ -1382,17 +1382,9 @@
<string name="update_no_notes">No release notes.</string>
<!-- Last line when the release notes are cut short. -->
<string name="update_more_notes">…and more on GitHub</string>
- <string name="update_install">Update</string>
- <string name="update_release">Get new release</string>
+ <string name="update_download">Download APK</string>
+ <string name="update_release">Check release</string>
<string name="update_cancel">Cancel</string>
- <string name="update_allow_title">Let Tellyscope install updates?</string>
- <string name="update_allow_text">Android asks once. On the next screen, turn on **Allow from this source**, then come back here.\n\nAndroid still asks you to confirm every update, and only accepts one signed like the Tellyscope you have.</string>
- <string name="update_open_settings">Open settings</string>
- <string name="update_downloading">Downloading %1$s</string>
- <string name="update_of">%1$s of %2$s</string>
- <string name="update_failed_title">Couldn\'t download %1$s</string>
- <string name="update_failed_text">Check the phone is online and try again, or get it from the GitHub release page.</string>
- <string name="update_try_again">Try again</string>
<!-- Welcome -->
<string name="welcome_skip">Skip</string>
diff --git a/app/src/main/res/xml/self_update_paths.xml b/app/src/main/res/xml/self_update_paths.xml
deleted file mode 100644
index 7de99b5..0000000
--- a/app/src/main/res/xml/self_update_paths.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- The downloaded update, shared only with Android's installer (SelfUpdate.kt). -->
-<paths>
- <cache-path name="update" path="update/" />
-</paths>
diff --git a/app/src/test/java/app/tellyscope/ScreenshotTest.kt b/app/src/test/java/app/tellyscope/ScreenshotTest.kt
index c429f2c..d6cc911 100644
--- a/app/src/test/java/app/tellyscope/ScreenshotTest.kt
+++ b/app/src/test/java/app/tellyscope/ScreenshotTest.kt
@@ -124,7 +124,6 @@ import app.tellyscope.ui.SettingsScreen
import app.tellyscope.ui.WhatsNewScreen
import app.tellyscope.data.Changelog
import app.tellyscope.data.Update
-import app.tellyscope.ui.Updating
import app.tellyscope.ui.UpdateDialog
import app.tellyscope.ui.SHARE_TEXT
import app.tellyscope.data.RELEASES
@@ -729,34 +728,32 @@ class ScreenshotTest {
compose.onNodeWithText("Not installed").assertDoesNotExist()
}
- /** 0.14.0 out with its APK; [updating] is how far Update got. */
- private fun updateDialog(updating: Updating?, onUpdate: () -> Unit = {}) = @Composable {
+ /** 0.14.0 out, with its APK unless [apk] is false. */
+ private fun updateDialog(apk: Boolean = true, onDownload: () -> Unit = {}, onRelease: () -> Unit = {}) = @Composable {
val notes = changelog.first().changes.joinToString("\n") { "- **${it.kind}:** ${it.text}" }
UpdateDialog(
- Update("0.14.0", notes, "", apk = "$RELEASES/download/v0.14.0/Tellyscope-0.14.0.apk", size = 3_040_000),
- updating, onUpdate = onUpdate, onRelease = {}, onCancel = {}, onOpenSettings = {}, onBack = {},
+ Update("0.14.0", notes, "", apk = if (apk) "$RELEASES/download/v0.14.0/Tellyscope-0.14.0.apk" else null),
+ onDownload = onDownload, onRelease = onRelease, onCancel = {},
)
}
@Test fun update_offer() {
- var updates = 0
- shot("99_update_offer", screen = true) { updateDialog(null) { updates++ }() }
- compose.onNodeWithText("Get new release").assertExists()
- compose.onNodeWithText("Skip this version").assertDoesNotExist()
- compose.onNodeWithText("Update").performClick()
- assertEquals(1, updates)
+ var downloads = 0
+ var releases = 0
+ shot("99_update_offer", screen = true) { updateDialog(onDownload = { downloads++ }, onRelease = { releases++ })() }
+ compose.onNodeWithText("Cancel").assertExists()
+ compose.onNodeWithText("Download APK").performClick()
+ compose.onNodeWithText("Check release").performClick()
+ assertEquals(1, downloads)
+ assertEquals(1, releases)
}
- @Test fun update_offer_dark() = shot("99_update_offer", dark = true, screen = true) { updateDialog(null)() }
+ @Test fun update_offer_dark() = shot("99_update_offer", dark = true, screen = true) { updateDialog()() }
- @Test fun update_allow() = shot("99_update_allow", screen = true) { updateDialog(Updating.Allow)() }
-
- @Test fun update_downloading() = shot("99_update_downloading", screen = true) { updateDialog(Updating.Downloading(Progress(1_260_000, 3_040_000)))() }
-
- @Test fun update_failed() {
- shot("99_update_failed", screen = true) { updateDialog(Updating.Failed)() }
- compose.onNodeWithText("Try again").assertExists()
- compose.onNodeWithText("Cancel").assertExists()
+ @Test fun update_offer_noApk() {
+ shot("99_update_offer_no_apk", screen = true) { updateDialog(apk = false)() }
+ compose.onNodeWithText("Download APK").assertDoesNotExist()
+ compose.onNodeWithText("Check release").assertExists()
}
@Test fun whatsNew_installedAndLinks() {
diff --git a/app/src/test/java/app/tellyscope/UpdateCheckTest.kt b/app/src/test/java/app/tellyscope/UpdateCheckTest.kt
index 76f74f8..de12677 100644
--- a/app/src/test/java/app/tellyscope/UpdateCheckTest.kt
+++ b/app/src/test/java/app/tellyscope/UpdateCheckTest.kt
@@ -79,7 +79,6 @@ class UpdateCheckTest {
releases("""{"tag_name":"v0.2.0","prerelease":false,"draft":false,"body":"","assets":[{"name":"Tellyscope-0.2.0.apk","browser_download_url":"$url","size":$size}]}""")
val u = newest(withAsset(base + "Tellyscope-0.2.0.apk", 3_000_000), alpha = false)
assertEquals(base + "Tellyscope-0.2.0.apk", u?.apk)
- assertEquals(3_000_000L, u?.size)
assertNull(newest(withAsset("https://example.com/Tellyscope-0.2.0.apk", 3_000_000), alpha = false)?.apk)
assertNull(newest(withAsset(base + "Tellyscope-0.2.0.apk", 0), alpha = false)?.apk)
assertNull(newest(releases(release("v0.2.0")), alpha = false)?.apk)