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.
Say the phone is off Wi-Fi instead of "TV offline"
jesse-agent-2320d7c411b32dc
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 4025ec2..a0a8fc4 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -12,6 +12,7 @@ until this file has a section for its version.## Unreleased+- **Fixed:** Off Wi-Fi, the TV tabs and failed sends blame the phone, not the TV. [#313](../../pull/313)- **Fixed:** On a Fire TV or another HDMI box whose volume is fixed, the Remote's mute and volume keys are grayed out, with a line saying to use the TV's own remote. [#307](../../pull/307)- **Fixed:** On the Remote, a perfectly still tap on empty space now closes the keyboard. [#300](../../pull/300)- **Fixed:** Sending or installing a file picked from phone storage no longer drops the TV. [#301](../../pull/301)diff --git a/app/src/main/java/app/tellyscope/ui/Copy.kt b/app/src/main/java/app/tellyscope/ui/Copy.ktindex 402d5e8..e8399dc 100644--- a/app/src/main/java/app/tellyscope/ui/Copy.kt+++ b/app/src/main/java/app/tellyscope/ui/Copy.kt@@ -399,6 +399,8 @@ object Copy {/** Running, with no word from the TV. */val TV_OFFLINE = UiText(R.string.copy_tv_offline)+ val PHONE_OFF_WIFI = UiText(R.string.scan_off_wifi_title)+ val OFF_WIFI_LINE = UiText(R.string.copy_off_wifi_line)val RUNNING_OFFLINE = UiText(R.string.copy_running_offline)val ANDROID_SYSTEM = AppNames.SYSTEM@@ -559,6 +561,7 @@ object Copy {fun saved(name: String) = UiText(R.string.copy_saved, name)fun sendFailed(name: String) = UiText(R.string.copy_send_failed, name)+ fun sendFailedOffWifi(name: String) = UiText(R.string.copy_send_failed_off_wifi, name)fun saveFailed(name: String) = UiText(R.string.copy_save_failed, name)val CANCELLED_SEND = UiText(R.string.copy_cancelled_send)diff --git a/app/src/main/java/app/tellyscope/ui/DeviceScreen.kt b/app/src/main/java/app/tellyscope/ui/DeviceScreen.ktindex 422ac95..43f92ab 100644--- a/app/src/main/java/app/tellyscope/ui/DeviceScreen.kt+++ b/app/src/main/java/app/tellyscope/ui/DeviceScreen.kt@@ -312,7 +312,7 @@ private fun CardTitle(icon: androidx.compose.ui.graphics.vector.ImageVector, tex}@Composable-internal fun OfflineCard(device: Device, now: Long, onReconnect: () -> Unit) {+internal fun OfflineCard(device: Device, now: Long, offWifi: Boolean, onReconnect: () -> Unit) {// Material 3 has no warning role; tertiary is the standard stand-in, kept apart from error.Card(colors = CardDefaults.cardColors(@@ -322,9 +322,10 @@ internal fun OfflineCard(device: Device, now: Long, onReconnect: () -> Unit) {) {Row(Modifier.padding(16.dp), verticalAlignment = Alignment.CenterVertically) {Column(Modifier.weight(1f)) {- CardTitle(Icons.Default.Info, stringResource(R.string.device_offline))+ CardTitle(Icons.Default.Info, if (offWifi) Copy.PHONE_OFF_WIFI.resolve() else stringResource(R.string.device_offline))Text(- stringResource(R.string.device_offline_text, device.lastSeen?.let { Copy.ago(it, now).resolve() } ?: stringResource(R.string.device_a_while_ago)),+ if (offWifi) Copy.OFF_WIFI_LINE.resolve()+ else stringResource(R.string.device_offline_text, device.lastSeen?.let { Copy.ago(it, now).resolve() } ?: stringResource(R.string.device_a_while_ago)),style = MaterialTheme.typography.bodyMedium,)}diff --git a/app/src/main/java/app/tellyscope/ui/DeviceTabs.kt b/app/src/main/java/app/tellyscope/ui/DeviceTabs.ktindex dd647ca..73c4db7 100644--- a/app/src/main/java/app/tellyscope/ui/DeviceTabs.kt+++ b/app/src/main/java/app/tellyscope/ui/DeviceTabs.kt@@ -168,6 +168,10 @@ fun DeviceTabsScreen(var appsTab by rememberSaveable { mutableStateOf(AppsTab.Running) }val q = state.query.trim().lowercase()val offline = device.state != DeviceState.Online+ // Off Wi-Fi the phone is what's cut off, so the empty tabs say so rather than blame the TV.+ val offWifi = offline && state.offWifi+ val awayIcon = if (offWifi) DeviceIcons.WifiOff else DeviceIcons.Tv+ val awayTitle = (if (offWifi) Copy.PHONE_OFF_WIFI else Copy.TV_OFFLINE).resolve()val list = rememberLazyListState()val closeSearch = { searching = false; actions.query("") }BackHandler(enabled = searching, onBack = closeSearch)@@ -307,7 +311,7 @@ fun DeviceTabsScreen(} else if (device.state == DeviceState.NotAllowed) {item { NotAllowedCard(actions.reconnect) }} else if (offline) {- item { OfflineCard(device, state.clock(), actions.reconnect) }+ item { OfflineCard(device, state.clock(), offWifi, actions.reconnect) }}// A switch that left the launcher's service off: Home may go back to the TV's own.ui.apps.firstOrNull { it.homeServiceNote }?.takeIf { !offline }?.let { a ->@@ -374,7 +378,7 @@ fun DeviceTabsScreen(// Away, the TV can't say what's running, rather than nothing is.when {loading -> AppsLoading()- appsTab == AppsTab.Running && live == null -> EmptyState(DeviceIcons.Tv, Copy.TV_OFFLINE.resolve(), Copy.RUNNING_OFFLINE.resolve())+ appsTab == AppsTab.Running && live == null -> EmptyState(awayIcon, awayTitle, if (offWifi) Copy.OFF_WIFI_LINE.resolve() else Copy.RUNNING_OFFLINE.resolve())else -> EmptyLine(q)}}@@ -396,7 +400,7 @@ fun DeviceTabsScreen(}val folder = ui.files.folderwhen {- offline -> item { EmptyState(DeviceIcons.Tv, Copy.TV_OFFLINE.resolve(), stringResource(R.string.tabs_files_offline)) }+ offline -> item { EmptyState(awayIcon, awayTitle, if (offWifi) Copy.OFF_WIFI_LINE.resolve() else stringResource(R.string.tabs_files_offline)) }ui.files.error == null && ui.files.list?.isEmpty() == true -> item {EmptyState(if (folder == TvFolder.MOVIES) TileIcons.Movie else TabIcons.Folder,@@ -408,7 +412,7 @@ fun DeviceTabsScreen(}}TvTab.Tweaks -> {- if (offline) item { EmptyState(DeviceIcons.Tv, Copy.TV_OFFLINE.resolve(), stringResource(R.string.tabs_tweaks_offline)) }+ if (offline) item { EmptyState(awayIcon, awayTitle, if (offWifi) Copy.OFF_WIFI_LINE.resolve() else stringResource(R.string.tabs_tweaks_offline)) }else {if (homeLaunchers(ui.apps).isNotEmpty()) item { Panel(Copy.HOME_SCREEN.resolve()) { HomeScreenBlock(ui, actions, fire) } }item { Panel(Copy.TWEAKS.resolve()) { TweaksBlock(ui, actions) } }diff --git a/app/src/main/java/app/tellyscope/ui/TellyscopeViewModel.kt b/app/src/main/java/app/tellyscope/ui/TellyscopeViewModel.ktindex 9a5d24e..0c84d96 100644--- a/app/src/main/java/app/tellyscope/ui/TellyscopeViewModel.kt+++ b/app/src/main/java/app/tellyscope/ui/TellyscopeViewModel.kt@@ -289,6 +289,8 @@ data class UiState(val query: String = "",/** When this state was made; it doesn't tick. Screens read the time with [clock]. */val now: Long = System.currentTimeMillis(),+ /** This phone is on no Wi-Fi or Ethernet, so an offline TV is out of reach rather than off. */+ val offWifi: Boolean = false,/** TVs asked to restart, by id. */val restarting: Map<String, Restart> = emptyMap(),/** The user's own debloat-list source; null for tellyscope-devices. */@@ -527,6 +529,7 @@ class TellyscopeViewModel(while (true) {delay(1_000)_now.value = clock()+ _state.update { it.copy(offWifi = !source.onLan()) }if (++tick % 3 == 0) refreshDevices()}}@@ -1424,7 +1427,7 @@ class TellyscopeViewModel(_notice.value = Copy.CANCELLED_SENDthrow e} catch (_: Exception) {- _notice.value = Copy.sendFailed(file.name)+ _notice.value = if (source.onLan()) Copy.sendFailed(file.name) else Copy.sendFailedOffWifi(file.name)} finally {setTransfer(id, null)}diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xmlindex 1eb1ee5..3998db5 100644--- a/app/src/main/res/values/strings.xml+++ b/app/src/main/res/values/strings.xml@@ -272,6 +272,7 @@<string name="copy_reading_apps">Reading the TV\'s apps…</string><string name="copy_reading_apps_line">This takes a few seconds.</string><string name="copy_tv_offline">TV offline</string>+ <string name="copy_off_wifi_line">Join the same Wi-Fi as the TV. Tellyscope reconnects as soon as you\'re on.</string><string name="copy_running_offline">Running apps show here once the TV is connected.</string><!-- Connection state, next to the status dot -->@@ -364,6 +365,7 @@<string name="copy_sent_renamed">Sent to %1$s as %2$s, since %3$s was already there</string><string name="copy_saved">Saved %1$s to your phone</string><string name="copy_send_failed">Couldn\'t send %1$s. Check the TV is still connected and has space.</string>+ <string name="copy_send_failed_off_wifi">Couldn\'t send %1$s. This phone isn\'t on Wi-Fi.</string><string name="copy_save_failed">Couldn\'t save %1$s. Check the TV is still connected and the phone has space.</string><string name="copy_cancelled_send">Cancelled. Nothing was left on the TV.</string><string name="copy_cancelled_save">Cancelled. Nothing was saved.</string>