Maintaining the look of being busy
This commit is contained in:
1 parent
4f9465a204
commit
d116e85247
2 files changed
+6
-2
No files matched your search
+1
-1
@@ -53,7 +53,7 @@ fun AuxNavHost(
|
|||||||
|
|
||||||
val navigationViewModel: NavigationViewModel = viewModel (
|
val navigationViewModel: NavigationViewModel = viewModel (
|
||||||
factory = NavigationViewModel.factory(
|
factory = NavigationViewModel.factory(
|
||||||
NavigationUIState.Landing,
|
NavigationUIState.Loading,
|
||||||
nostrRepository
|
nostrRepository
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|||||||
+5
-1
@@ -10,6 +10,7 @@ import androidx.lifecycle.viewModelScope
|
|||||||
import co.touchlab.kermit.Logger
|
import co.touchlab.kermit.Logger
|
||||||
import com.vitorpamplona.quartz.nip01Core.core.toHexKey
|
import com.vitorpamplona.quartz.nip01Core.core.toHexKey
|
||||||
import com.vitorpamplona.quartz.nip01Core.crypto.KeyPair
|
import com.vitorpamplona.quartz.nip01Core.crypto.KeyPair
|
||||||
|
import kotlinx.coroutines.delay
|
||||||
import kotlinx.coroutines.flow.MutableStateFlow
|
import kotlinx.coroutines.flow.MutableStateFlow
|
||||||
import kotlinx.coroutines.flow.SharingStarted
|
import kotlinx.coroutines.flow.SharingStarted
|
||||||
import kotlinx.coroutines.flow.asStateFlow
|
import kotlinx.coroutines.flow.asStateFlow
|
||||||
@@ -58,8 +59,11 @@ class NavigationViewModel(
|
|||||||
|
|
||||||
private fun observeProfile() {
|
private fun observeProfile() {
|
||||||
viewModelScope.launch {
|
viewModelScope.launch {
|
||||||
|
delay(2_100) // Looking busy...
|
||||||
|
_navigationUIState.getAndUpdate {
|
||||||
|
NavigationUIState.Landing
|
||||||
|
}
|
||||||
nostrRepository.observeProfile(tempDevelopmentKeyPair.pubKey.toHexKey()).map { localProfile ->
|
nostrRepository.observeProfile(tempDevelopmentKeyPair.pubKey.toHexKey()).map { localProfile ->
|
||||||
|
|
||||||
_navigationUIState.getAndUpdate {
|
_navigationUIState.getAndUpdate {
|
||||||
if (localProfile == null) {
|
if (localProfile == null) {
|
||||||
NavigationUIState.Landing
|
NavigationUIState.Landing
|
||||||
|
|||||||
Reference in new issue
Block a user