Skip to content
Snippets Groups Projects
Commit dd6170ab authored by Kamal Bramwell's avatar Kamal Bramwell
Browse files

Show loading UI while waiting for nodes to be ready

parent 5f68374e
Branches
Tags
3 merge requests!84Version 2.92 build 629,!77v2.9 b627,!72FE-948: Invite Friend
This commit is part of merge request !72. Comments created here will be created in the context of that merge request.
......@@ -275,13 +275,31 @@ class UserSearchViewModel @Inject constructor(
}
fun onInvitationReceived(username: String) {
_invitationFrom.value = username
_udSearchUi.value = searchRunningState
viewModelScope.launch {
if (repo.areNodesReady()) {
_invitationFrom.postValue(username)
} else {
showNetworkError(username)
}
}
}
fun onInvitationHandled() {
_invitationFrom.value = null
}
private fun showNetworkError(username: String) {
val errorUi = ToastUI.create(
header = "Nodes Registration",
body = "Could not connect to network. Please try again.",
leftIcon = R.drawable.ic_alert,
actionText = "Retry",
actionClick = { onInvitationReceived(username) }
)
_toastUi.postValue(errorUi)
}
suspend fun onUsernameSearch(username: String?): Flow<List<RequestItem>> {
_usernameResults.value = listOf()
val factQuery = FactQuery.UsernameQuery(username)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment