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.

Remote buttons: offer only streaming apps the TV has

jesse-agent-232861fc6ce7474
diff --git a/app/src/main/java/app/tellyscope/data/Streaming.kt b/app/src/main/java/app/tellyscope/data/Streaming.kt
index e46b86d..4b552d1 100644
--- a/app/src/main/java/app/tellyscope/data/Streaming.kt
+++ b/app/src/main/java/app/tellyscope/data/Streaming.kt
@@ -58,10 +58,10 @@ fun parseStreaming(text: String): List<StreamingService> = try {
/** The Remote's row of streaming buttons, kept apart from the screen so it can be tested on its own. */
object RemoteButtons {
/**
- * Alpha: every service can be picked, installed or not, and a button stays when its app isn't on
+ * True: every service can be picked, installed or not, and a button stays when its app isn't on
* the TV, so the whole list can be tried on one TV. False: the picker lists only what the TV has.
*/
- const val ANY_SERVICE = true
+ const val ANY_SERVICE = false
/** Three buttons fit a phone; 600 dp and wider, a foldable or tablet, fits four. */
fun cap(widthDp: Int): Int = if (widthDp >= 600) Dock.MAX else 3
diff --git a/app/src/main/java/app/tellyscope/ui/TellyscopeViewModel.kt b/app/src/main/java/app/tellyscope/ui/TellyscopeViewModel.kt
index d7db786..685ffe4 100644
--- a/app/src/main/java/app/tellyscope/ui/TellyscopeViewModel.kt
+++ b/app/src/main/java/app/tellyscope/ui/TellyscopeViewModel.kt
@@ -2018,7 +2018,7 @@ class TellyscopeViewModel(
/**
* An app uninstalled, here or on the TV itself, takes its button off the Remote, and the snackbar
- * says so. Not in the alpha, where any service can have a button.
+ * says so. Not with [RemoteButtons.ANY_SERVICE], where any service can have a button.
*/
private suspend fun pruneDock(id: String, apps: List<AppInfo>) {
if (RemoteButtons.ANY_SERVICE) return
diff --git a/app/src/test/java/app/tellyscope/RestartAndDockTest.kt b/app/src/test/java/app/tellyscope/RestartAndDockTest.kt
index 50f40d0..4bf1693 100644
--- a/app/src/test/java/app/tellyscope/RestartAndDockTest.kt
+++ b/app/src/test/java/app/tellyscope/RestartAndDockTest.kt
@@ -30,6 +30,7 @@ import kotlinx.coroutines.test.runCurrent
import kotlinx.coroutines.test.setMain
import org.junit.After
import org.junit.Assert.assertEquals
+import org.junit.Assert.assertFalse
import org.junit.Assert.assertNull
import org.junit.Assert.assertTrue
import org.junit.Before
@@ -127,13 +128,14 @@ class RestartAndDockTest {
assertNull(vm.state.value.restarting["tv"])
}
- @Test fun anUninstalledAppKeepsItsButtonInTheAlpha() = with(test) {
- assertTrue(RemoteButtons.ANY_SERVICE)
+ @Test fun anAppUninstalledOnTheTvLeavesTheDock() = with(test) {
+ assertFalse(RemoteButtons.ANY_SERVICE)
tv.dock = listOf(Docked("com.youtube", "YouTube"), Docked("org.smarttube", "SmartTube"))
tv.apps = listOf(app("com.youtube", "YouTube"))
start()
- assertEquals(listOf("YouTube", "SmartTube"), vm.state.value.device.dock.map { it.label })
- assertEquals(listOf("YouTube", "SmartTube"), tv.dock.map { it.label })
+ assertEquals(listOf("YouTube"), vm.state.value.device.dock.map { it.label })
+ assertEquals(listOf("YouTube"), tv.dock.map { it.label })
+ assertEquals(Copy.leftDock(listOf("SmartTube")), vm.notice.value)
}
@Test fun aDockTapOpensTheAppWithoutHistory() = with(test) {
diff --git a/app/src/test/java/app/tellyscope/StreamingTest.kt b/app/src/test/java/app/tellyscope/StreamingTest.kt
index c2b86b5..118a049 100644
--- a/app/src/test/java/app/tellyscope/StreamingTest.kt
+++ b/app/src/test/java/app/tellyscope/StreamingTest.kt
@@ -72,9 +72,11 @@ class StreamingTest {
assertEquals(prime.packages.first(), prime.packageOn(emptyList()))
}
- @Test fun theAlphaOffersEveryService() {
- assertTrue(RemoteButtons.ANY_SERVICE)
- assertEquals(services, RemoteButtons.choices(services, emptyList()))
+ @Test fun thePickerOffersOnlyServicesOnTheTv() {
+ assertFalse(RemoteButtons.ANY_SERVICE)
+ val nvidia = AppInfo("com.amazon.amazonvideo.livingroom.nvidia", "Prime Video", null, false, true, null, "", launchable = true)
+ assertEquals(listOf("Prime Video"), RemoteButtons.choices(services, listOf(nvidia)).map { it.name })
+ assertEquals(emptyList<StreamingService>(), RemoteButtons.choices(services, emptyList()))
}
private val lightSheet = 0xFFEEF5F4