From a709fe503aa2c21a4d68accfbfaff45d53cbf6ef Mon Sep 17 00:00:00 2001 From: Adam Brown Date: Thu, 3 Nov 2022 17:24:47 +0000 Subject: [PATCH] avoid opening the room list when going back from the settings page --- .../home/src/main/kotlin/app/dapk/st/home/HomeViewModel.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/features/home/src/main/kotlin/app/dapk/st/home/HomeViewModel.kt b/features/home/src/main/kotlin/app/dapk/st/home/HomeViewModel.kt index 060ab4a..0b6a277 100644 --- a/features/home/src/main/kotlin/app/dapk/st/home/HomeViewModel.kt +++ b/features/home/src/main/kotlin/app/dapk/st/home/HomeViewModel.kt @@ -57,7 +57,11 @@ internal class HomeViewModel( private suspend fun initialHomeContent(): SignedIn { val me = chatEngine.me(forceRefresh = false) val initialInvites = chatEngine.invites().first().size - return SignedIn(Page.Directory, me, invites = initialInvites) + return when (val current = state) { + Loading -> SignedIn(Page.Directory, me, invites = initialInvites) + is SignedIn -> current.copy(me = me, invites = initialInvites) + SignedOut -> SignedIn(Page.Directory, me, invites = initialInvites) + } } fun loggedIn() {