mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-12-02 20:21:59 -05:00
fix(tabs): keep More on the bar so tabs can always be edited (#3556)
Edit tabs only opens from the More page, and More left the bar once no tab was shelved in it. Hiding or moving every shelved tab therefore removed the only way back into the tab editor. More now always stays on the bar; with nothing shelved it opens to the Edit tabs button.
This commit is contained in:
1 parent
1b4aaf8a3b
commit
7ce53ccbed
2 files changed
+12
-4
No files matched your search
@@ -116,10 +116,7 @@ internal object NavTabs {
|
||||
|
||||
fun more(s: FrontEndState) = listed(s).filter { place(s, it) == TabPlace.MORE }
|
||||
|
||||
fun bar(s: FrontEndState): List<String> {
|
||||
val shown = listed(s).filter { place(s, it) == TabPlace.BAR }
|
||||
return if (more(s).isEmpty()) shown else shown + MORE
|
||||
}
|
||||
fun bar(s: FrontEndState): List<String> = listed(s).filter { place(s, it) == TabPlace.BAR } + MORE
|
||||
|
||||
fun setHidden(context: Context, key: String, hide: Boolean) {
|
||||
hidden = if (hide && hideable(key)) hidden + key else hidden - key
|
||||
|
||||
@@ -77,6 +77,17 @@ class NavTabsTest {
|
||||
assertFalse("desktop" in navigationKeys(s))
|
||||
}
|
||||
|
||||
@Test fun moreStaysOnTheBarWhenNoTabIsShelvedSoTabsCanStillBeEdited() {
|
||||
NavTabs.more(state()).forEach { place(it, TabPlace.HIDDEN) }
|
||||
assertTrue(NavTabs.more(state()).isEmpty())
|
||||
assertEquals(NavTabs.MORE, navigationKeys(state()).last())
|
||||
NavTabs.reset(ctx)
|
||||
NavTabs.more(state()).forEach { place(it, TabPlace.BAR) }
|
||||
assertTrue(NavTabs.more(state()).isEmpty())
|
||||
assertEquals(NavTabs.MORE, navigationKeys(state()).last())
|
||||
assertEquals(1, navigationKeys(state()).count { it == NavTabs.MORE })
|
||||
}
|
||||
|
||||
@Test fun appsAndTheDevHarnessCanBeShownWithoutHomeScreenOrDeveloperTools() {
|
||||
place("android-apps", TabPlace.MORE)
|
||||
assertTrue("android-apps" in NavTabs.more(state()))
|
||||
|
||||
Reference in new issue
Block a user