ignoring tab taps when already on the tab page
This commit is contained in:
parent
3d7730bc32
commit
f8f2eead36
|
@ -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() {
|
||||
|
|
Loading…
Reference in New Issue