ignoring tab taps when already on the tab page

This commit is contained in:
Adam Brown 2022-09-19 22:09:25 +01:00
parent 3d7730bc32
commit f8f2eead36
1 changed files with 13 additions and 5 deletions

View File

@ -99,6 +99,19 @@ class HomeViewModel(
state = when (val current = state) {
Loading -> current
is SignedIn -> {
when (page) {
current.page -> current
else -> current.copy(page = page).also {
pageChangeSideEffects(page)
}
}
}
SignedOut -> current
}
}
private fun pageChangeSideEffects(page: Page) {
when (page) {
Page.Directory -> {
// do nothing
@ -106,11 +119,6 @@ class HomeViewModel(
Page.Profile -> profileViewModel.reset()
}
current.copy(page = page)
}
SignedOut -> current
}
}
fun stop() {