mirror of
https://github.com/ouchadam/small-talk.git
synced 2025-02-16 12:10:45 +01:00
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) {
|
state = when (val current = state) {
|
||||||
Loading -> current
|
Loading -> current
|
||||||
is SignedIn -> {
|
is SignedIn -> {
|
||||||
|
when (page) {
|
||||||
|
current.page -> current
|
||||||
|
else -> current.copy(page = page).also {
|
||||||
|
pageChangeSideEffects(page)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SignedOut -> current
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun pageChangeSideEffects(page: Page) {
|
||||||
when (page) {
|
when (page) {
|
||||||
Page.Directory -> {
|
Page.Directory -> {
|
||||||
// do nothing
|
// do nothing
|
||||||
@ -106,11 +119,6 @@ class HomeViewModel(
|
|||||||
|
|
||||||
Page.Profile -> profileViewModel.reset()
|
Page.Profile -> profileViewModel.reset()
|
||||||
}
|
}
|
||||||
current.copy(page = page)
|
|
||||||
}
|
|
||||||
|
|
||||||
SignedOut -> current
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun stop() {
|
fun stop() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user