ignoring tab taps when already on the tab page
This commit is contained in:
parent
3d7730bc32
commit
f8f2eead36
|
@ -100,19 +100,27 @@ class HomeViewModel(
|
||||||
Loading -> current
|
Loading -> current
|
||||||
is SignedIn -> {
|
is SignedIn -> {
|
||||||
when (page) {
|
when (page) {
|
||||||
Page.Directory -> {
|
current.page -> current
|
||||||
// do nothing
|
else -> current.copy(page = page).also {
|
||||||
|
pageChangeSideEffects(page)
|
||||||
}
|
}
|
||||||
|
|
||||||
Page.Profile -> profileViewModel.reset()
|
|
||||||
}
|
}
|
||||||
current.copy(page = page)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SignedOut -> current
|
SignedOut -> current
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun pageChangeSideEffects(page: Page) {
|
||||||
|
when (page) {
|
||||||
|
Page.Directory -> {
|
||||||
|
// do nothing
|
||||||
|
}
|
||||||
|
|
||||||
|
Page.Profile -> profileViewModel.reset()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fun stop() {
|
fun stop() {
|
||||||
viewModelScope.cancel()
|
viewModelScope.cancel()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue