From d66f0c0ab9ab633f514f44321446e45c2ceaadd5 Mon Sep 17 00:00:00 2001 From: Adam Brown Date: Thu, 10 Nov 2022 22:40:42 +0000 Subject: [PATCH] allowing the messages view to fail with nothing to see here - means the user can go into the settings and enable logging to find out what's going wrong --- .../src/main/kotlin/app/dapk/st/home/HomeViewModel.kt | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) 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 f4545d7..fd8de22 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 @@ -15,7 +15,6 @@ import app.dapk.st.profile.state.ProfileState import app.dapk.st.viewmodel.DapkViewModel import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Job -import kotlinx.coroutines.flow.first import kotlinx.coroutines.flow.launchIn import kotlinx.coroutines.flow.onEach import kotlinx.coroutines.launch @@ -58,11 +57,10 @@ internal class HomeViewModel( private suspend fun initialHomeContent(): SignedIn { val me = chatEngine.me(forceRefresh = false) - val initialInvites = chatEngine.invites().first().size 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) + Loading -> SignedIn(Page.Directory, me, invites = 0) + is SignedIn -> current.copy(me = me, invites = current.invites) + SignedOut -> SignedIn(Page.Directory, me, invites = 0) } }