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

@ -100,19 +100,27 @@ class HomeViewModel(
Loading -> current
is SignedIn -> {
when (page) {
Page.Directory -> {
// do nothing
current.page -> current
else -> current.copy(page = page).also {
pageChangeSideEffects(page)
}
Page.Profile -> profileViewModel.reset()
}
current.copy(page = page)
}
SignedOut -> current
}
}
private fun pageChangeSideEffects(page: Page) {
when (page) {
Page.Directory -> {
// do nothing
}
Page.Profile -> profileViewModel.reset()
}
}
fun stop() {
viewModelScope.cancel()
}