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.
Install dialog stays open when the TV reselects itself after the picker
jesse-agent-232c281afaa963c
diff --git a/app/src/main/java/app/tellyscope/ui/TellyscopeViewModel.kt b/app/src/main/java/app/tellyscope/ui/TellyscopeViewModel.ktindex 48970ee..fa8ea14 100644--- a/app/src/main/java/app/tellyscope/ui/TellyscopeViewModel.kt+++ b/app/src/main/java/app/tellyscope/ui/TellyscopeViewModel.kt@@ -708,12 +708,16 @@ class TellyscopeViewModel(}// Only an online TV gets its old lists back: the offline card stays as it was.val online = _state.value.devices.firstOrNull { it.id == id }?.state == DeviceState.Online- // A removal survives the reconnect it causes; the TV coming back reselects it.+ // A removal survives the reconnect it causes; the TV coming back reselects it. So does the+ // install dialog: the link drops behind the file picker, and its return reselected the TV+ // a few seconds after the dialog opened, closing it (#290)._state.update {- val removal = it.device.removal.takeIf { _ -> it.selectedId == id }+ val same = it.selectedId == id+ val removal = it.device.removal.takeIf { _ -> same }+ val sideload = it.device.sideload.takeIf { _ -> same }val apps = if (online) id?.let(lastApps::get).orEmpty() else emptyList()val lists = if (online) id?.let(lastLists::get) else null- it.copy(selectedId = id, device = DeviceUi(snapshot = id?.let(lastSnapshot::get), apps = apps, lists = lists, transfer = transfer, removal = removal), query = "")+ it.copy(selectedId = id, device = DeviceUi(snapshot = id?.let(lastSnapshot::get), apps = apps, lists = lists, transfer = transfer, removal = removal, sideload = sideload), query = "")}val device = _state.value.selected ?: return// History lives on the phone, so it shows (and undo is offered) even while the TV is off.diff --git a/app/src/test/java/app/tellyscope/SideloadPickTest.kt b/app/src/test/java/app/tellyscope/SideloadPickTest.ktindex 43056ca..b23db37 100644--- a/app/src/test/java/app/tellyscope/SideloadPickTest.kt+++ b/app/src/test/java/app/tellyscope/SideloadPickTest.kt@@ -26,6 +26,7 @@ import kotlinx.coroutines.cancelimport kotlinx.coroutines.flow.emptyFlowimport kotlinx.coroutines.test.StandardTestDispatcherimport kotlinx.coroutines.test.TestScope+import kotlinx.coroutines.test.advanceTimeByimport kotlinx.coroutines.test.resetMainimport kotlinx.coroutines.test.runCurrentimport kotlinx.coroutines.test.setMain@@ -38,12 +39,13 @@ import org.junit.runner.RunWithimport org.robolectric.RobolectricTestRunnerimport org.robolectric.annotation.Config-/** One online TV whose version check fails when [unreachable]; [asked] counts the checks. */+/** One TV, online until [state] says otherwise, whose version check fails when [unreachable]; [asked] counts the checks. */private class VersionCheckTv : DeviceSource by FakeDeviceSource(FakeDeviceSource.Scenario.Empty, clock = { 0L }) {var unreachable = falsevar asked = 0+ var state = DeviceState.Online- override suspend fun known() = listOf(Device("tv", ScanHit("tv", 5555, ScanKind.Classic, "tv", null), DeviceState.Online, null, null, null, 0L))+ override suspend fun known() = listOf(Device("tv", ScanHit("tv", 5555, ScanKind.Classic, "tv", null), state, null, null, null, 0L))override fun live(deviceId: String) = emptyFlow<Snapshot>()@@ -108,4 +110,15 @@ class SideloadPickTest {val ui = pick(Picked(readable = true))assertEquals(SideloadUi.Step.Ready, ui?.step)}++ /** Back from the picker the link drops and returns, which reselects the TV: the dialog stays (#290). */+ @Test fun theDialogOutlivesTheLinkDroppingAndComingBack() = with(test) {+ pick(Picked(readable = true))+ tv.state = DeviceState.Offline+ advanceTimeBy(3_100)+ tv.state = DeviceState.Online+ advanceTimeBy(3_100)+ assertEquals(DeviceState.Online, vm.state.value.selected?.state)+ assertEquals(SideloadUi.Step.Ready, vm.state.value.device.sideload?.step)+ }}